commit 3fb52c5c71dcfcf659c4de6cba207b8537420ca7 Author: Jonathan Williams Date: Tue Aug 27 08:14:08 2013 -0700 Initial Commit diff --git a/Maps/Domination/BarrenOasis.zip b/Maps/Domination/BarrenOasis.zip new file mode 100644 index 000000000..887deef03 Binary files /dev/null and b/Maps/Domination/BarrenOasis.zip differ diff --git a/Maps/Domination/NotInRotation/icydawn.zip b/Maps/Domination/NotInRotation/icydawn.zip new file mode 100644 index 000000000..4275e1db4 Binary files /dev/null and b/Maps/Domination/NotInRotation/icydawn.zip differ diff --git a/Maps/Domination/NotInRotation/killbox.zip b/Maps/Domination/NotInRotation/killbox.zip new file mode 100644 index 000000000..d40901ea9 Binary files /dev/null and b/Maps/Domination/NotInRotation/killbox.zip differ diff --git a/Maps/Domination/gulley.zip b/Maps/Domination/gulley.zip new file mode 100644 index 000000000..347429d67 Binary files /dev/null and b/Maps/Domination/gulley.zip differ diff --git a/Maps/Domination/hidden.zip b/Maps/Domination/hidden.zip new file mode 100644 index 000000000..55db9a090 Binary files /dev/null and b/Maps/Domination/hidden.zip differ diff --git a/Maps/Domination/pyramid.zip b/Maps/Domination/pyramid.zip new file mode 100644 index 000000000..f5c35d5ad Binary files /dev/null and b/Maps/Domination/pyramid.zip differ diff --git a/Maps/Domination/skyscrapers.zip b/Maps/Domination/skyscrapers.zip new file mode 100644 index 000000000..12aa692af Binary files /dev/null and b/Maps/Domination/skyscrapers.zip differ diff --git a/Maps/Domination/twin_peaks.zip b/Maps/Domination/twin_peaks.zip new file mode 100644 index 000000000..f1dbaa5e9 Binary files /dev/null and b/Maps/Domination/twin_peaks.zip differ diff --git a/Maps/Domination/village.zip b/Maps/Domination/village.zip new file mode 100644 index 000000000..233b66989 Binary files /dev/null and b/Maps/Domination/village.zip differ diff --git a/Maps/MK64/BattleA.zip b/Maps/MK64/BattleA.zip new file mode 100644 index 000000000..1a7201db2 Binary files /dev/null and b/Maps/MK64/BattleA.zip differ diff --git a/Maps/MK64/BattleB.zip b/Maps/MK64/BattleB.zip new file mode 100644 index 000000000..b795564f0 Binary files /dev/null and b/Maps/MK64/BattleB.zip differ diff --git a/Maps/MK64/BattleC.zip b/Maps/MK64/BattleC.zip new file mode 100644 index 000000000..43ccb0d64 Binary files /dev/null and b/Maps/MK64/BattleC.zip differ diff --git a/Maps/MK64/HUB.zip b/Maps/MK64/HUB.zip new file mode 100644 index 000000000..d8caef317 Binary files /dev/null and b/Maps/MK64/HUB.zip differ diff --git a/Maps/MK64/MushroomA.zip b/Maps/MK64/MushroomA.zip new file mode 100644 index 000000000..fd565a131 Binary files /dev/null and b/Maps/MK64/MushroomA.zip differ diff --git a/Maps/MK64/MushroomB.zip b/Maps/MK64/MushroomB.zip new file mode 100644 index 000000000..27a12583e Binary files /dev/null and b/Maps/MK64/MushroomB.zip differ diff --git a/Maps/MK64/MushroomC.zip b/Maps/MK64/MushroomC.zip new file mode 100644 index 000000000..5884a7ccd Binary files /dev/null and b/Maps/MK64/MushroomC.zip differ diff --git a/Maps/MK64/MushroomD.zip b/Maps/MK64/MushroomD.zip new file mode 100644 index 000000000..c00f04f7a Binary files /dev/null and b/Maps/MK64/MushroomD.zip differ diff --git a/Maps/MK64/Result.zip b/Maps/MK64/Result.zip new file mode 100644 index 000000000..78635b8e6 Binary files /dev/null and b/Maps/MK64/Result.zip differ diff --git a/Maps/world_ruins.rar b/Maps/world_ruins.rar new file mode 100644 index 000000000..892f80d93 Binary files /dev/null and b/Maps/world_ruins.rar differ diff --git a/Nautilus.Core.VoteHub/.classpath b/Nautilus.Core.VoteHub/.classpath new file mode 100644 index 000000000..1333821df --- /dev/null +++ b/Nautilus.Core.VoteHub/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Nautilus.Core.VoteHub/.externalToolBuilders/VoteHub.launch b/Nautilus.Core.VoteHub/.externalToolBuilders/VoteHub.launch new file mode 100644 index 000000000..28d1ff401 --- /dev/null +++ b/Nautilus.Core.VoteHub/.externalToolBuilders/VoteHub.launch @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/Nautilus.Core.VoteHub/.project b/Nautilus.Core.VoteHub/.project new file mode 100644 index 000000000..c151017a9 --- /dev/null +++ b/Nautilus.Core.VoteHub/.project @@ -0,0 +1,27 @@ + + + Nautilus.Core.VoteHub + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/VoteHub.launch + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Nautilus.Core.VoteHub/.settings/org.eclipse.jdt.core.prefs b/Nautilus.Core.VoteHub/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7341ab168 --- /dev/null +++ b/Nautilus.Core.VoteHub/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Nautilus.Core.VoteHub/Hub.xml b/Nautilus.Core.VoteHub/Hub.xml new file mode 100644 index 000000000..cf045bf6f --- /dev/null +++ b/Nautilus.Core.VoteHub/Hub.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Nautilus.Core.VoteHub/src/nautilus/core/votehub/Program.java b/Nautilus.Core.VoteHub/src/nautilus/core/votehub/Program.java new file mode 100644 index 000000000..b08cd9648 --- /dev/null +++ b/Nautilus.Core.VoteHub/src/nautilus/core/votehub/Program.java @@ -0,0 +1,40 @@ +package nautilus.core.votehub; + +import java.io.BufferedReader; +import java.io.InputStreamReader; + +public class Program +{ + public static void main(String[] args) throws Exception + { + VoteHub hub = new VoteHub(); + System.out.println("Enabled Nautilus Vote Hub"); + + BufferedReader br = new BufferedReader(new InputStreamReader( System.in )); + + while (hub.IsRunning()) + { + try + { + Thread.sleep(25); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + String line = br.readLine(); + if (line != null) + { + boolean handled = hub.ProcessCommand(line); + + if (!handled) + { + System.err.println("Command not found"); + } + } + } + + System.exit(0); + } +} \ No newline at end of file diff --git a/Nautilus.Core.VoteHub/src/nautilus/core/votehub/VoteHub.java b/Nautilus.Core.VoteHub/src/nautilus/core/votehub/VoteHub.java new file mode 100644 index 000000000..01329048b --- /dev/null +++ b/Nautilus.Core.VoteHub/src/nautilus/core/votehub/VoteHub.java @@ -0,0 +1,91 @@ +package nautilus.core.votehub; + +import java.io.File; +import java.io.IOException; + +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; + +import mineplex.core.server.ServerBroadcaster; +import nautilus.core.votehub.votifier.net.VoteReceiver; + +public class VoteHub +{ + private String WEB_CONFIG = "webServer"; + private String IP = "ip"; + private String PORT = "port"; + private String CONFIG_FILE = "config.yml"; + + private FileConfiguration _config; + private VoteReceiver _voteReceiver; + private boolean _isRunning = true; + + private ServerBroadcaster _serverTalker; + + public VoteHub() + { + _config = YamlConfiguration.loadConfiguration(new File(CONFIG_FILE)); + + _config.addDefault(WEB_CONFIG, "http://bettermc.com/"); + _config.set(WEB_CONFIG, _config.getString(WEB_CONFIG)); + + _config.addDefault(IP, "bettermc.com"); + _config.set(IP, _config.getString(IP)); + + _config.addDefault(PORT, 8192); + _config.set(PORT, _config.getInt(PORT)); + + try + { + _config.save(CONFIG_FILE); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + + _config = YamlConfiguration.loadConfiguration(new File(CONFIG_FILE)); + _serverTalker = new ServerBroadcaster(_config.getString(WEB_CONFIG)); + _serverTalker.start(); + + try + { + _voteReceiver = new VoteReceiver(_serverTalker, _config.getString(WEB_CONFIG), _config.getString(IP), _config.getInt(PORT)); + _voteReceiver.start(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + public boolean IsRunning() + { + return _isRunning; + } + + public boolean ProcessCommand(String line) + { + if (line.equalsIgnoreCase("stop")) + { + _isRunning = false; + System.out.println("Shutting down..."); + + return true; + } + else if (line.equalsIgnoreCase("packets")) + { + _serverTalker.PrintPackets(); + + return true; + } + else if (line.equalsIgnoreCase("servers")) + { + _serverTalker.PrintServers(); + + return true; + } + + return false; + } +} diff --git a/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/LogFilter.java b/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/LogFilter.java new file mode 100644 index 000000000..b4451fd87 --- /dev/null +++ b/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/LogFilter.java @@ -0,0 +1,32 @@ +package nautilus.core.votehub.votifier; + +import java.util.logging.*; + +/** + * A custom log filter for prepending plugin identifier on all log messages. + * + * @author frelling + * + */ +class LogFilter implements Filter { + + private String prefix; + + /** + * Constructs a log filter that prepends the given prefix on all log + * messages. + * + * @param prefix + */ + public LogFilter(String prefix) { + this.prefix = prefix; + } + + /** + * Always returns true, but adds prefix to log message. + */ + public boolean isLoggable(LogRecord record) { + record.setMessage(prefix + record.getMessage()); + return true; + } +} diff --git a/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/crypto/RSA.java b/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/crypto/RSA.java new file mode 100644 index 000000000..a9524401b --- /dev/null +++ b/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/crypto/RSA.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2011 Vex Software LLC + * This file is part of Votifier. + * + * Votifier is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Votifier is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Votifier. If not, see . + */ + +package nautilus.core.votehub.votifier.crypto; + +import java.security.PrivateKey; +import java.security.PublicKey; + +import javax.crypto.Cipher; + +/** + * Static RSA utility methods for encrypting and decrypting blocks of + * information. + * + * @author Blake Beaupain + */ +public class RSA { + + /** + * Encrypts a block of data. + * + * @param data + * The data to encrypt + * @param key + * The key to encrypt with + * @return The encrypted data + * @throws Exception + * If an error occurs + */ + public static byte[] encrypt(byte[] data, PublicKey key) throws Exception { + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.ENCRYPT_MODE, key); + return cipher.doFinal(data); + } + + /** + * Decrypts a block of data. + * + * @param data + * The data to decrypt + * @param key + * The key to decrypt with + * @return The decrypted data + * @throws Exception + * If an error occurs + */ + public static byte[] decrypt(byte[] data, PrivateKey key) throws Exception { + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.DECRYPT_MODE, key); + return cipher.doFinal(data); + } + +} diff --git a/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/crypto/RSAIO.java b/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/crypto/RSAIO.java new file mode 100644 index 000000000..92f720471 --- /dev/null +++ b/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/crypto/RSAIO.java @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2011 Vex Software LLC + * This file is part of Votifier. + * + * Votifier is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Votifier is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Votifier. If not, see . + */ + +package nautilus.core.votehub.votifier.crypto; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.security.KeyFactory; +import java.security.KeyPair; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; + +import javax.xml.bind.DatatypeConverter; + +/** + * Static utility methods for saving and loading RSA key pairs. + * + * @author Blake Beaupain + */ +public class RSAIO { + + /** + * Saves the key pair to the disk. + * + * @param directory + * The directory to save to + * @param keyPair + * The key pair to save + * @throws Exception + * If an error occurs + */ + public static void save(File directory, KeyPair keyPair) throws Exception { + PrivateKey privateKey = keyPair.getPrivate(); + PublicKey publicKey = keyPair.getPublic(); + + // Store the public key. + X509EncodedKeySpec publicSpec = new X509EncodedKeySpec( + publicKey.getEncoded()); + FileOutputStream out = new FileOutputStream(directory + "/public.key"); + out.write(DatatypeConverter.printBase64Binary(publicSpec.getEncoded()) + .getBytes()); + out.close(); + + // Store the private key. + PKCS8EncodedKeySpec privateSpec = new PKCS8EncodedKeySpec( + privateKey.getEncoded()); + out = new FileOutputStream(directory + "/private.key"); + out.write(DatatypeConverter.printBase64Binary(privateSpec.getEncoded()) + .getBytes()); + out.close(); + } + + /** + * Loads an RSA key pair from a directory. The directory must have the files + * "public.key" and "private.key". + * + * @param directory + * The directory to load from + * @return The key pair + * @throws Exception + * If an error occurs + */ + public static KeyPair load(File directory) throws Exception { + // Read the public key file. + File publicKeyFile = new File(directory + "/public.key"); + FileInputStream in = new FileInputStream(directory + "/public.key"); + byte[] encodedPublicKey = new byte[(int) publicKeyFile.length()]; + in.read(encodedPublicKey); + encodedPublicKey = DatatypeConverter.parseBase64Binary(new String( + encodedPublicKey)); + in.close(); + + // Read the private key file. + File privateKeyFile = new File(directory + "/private.key"); + in = new FileInputStream(directory + "/private.key"); + byte[] encodedPrivateKey = new byte[(int) privateKeyFile.length()]; + in.read(encodedPrivateKey); + encodedPrivateKey = DatatypeConverter.parseBase64Binary(new String( + encodedPrivateKey)); + in.close(); + + // Instantiate and return the key pair. + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec( + encodedPublicKey); + PublicKey publicKey = keyFactory.generatePublic(publicKeySpec); + PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec( + encodedPrivateKey); + PrivateKey privateKey = keyFactory.generatePrivate(privateKeySpec); + return new KeyPair(publicKey, privateKey); + } + +} diff --git a/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/crypto/RSAKeygen.java b/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/crypto/RSAKeygen.java new file mode 100644 index 000000000..5a5a313a7 --- /dev/null +++ b/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/crypto/RSAKeygen.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011 Vex Software LLC + * This file is part of Votifier. + * + * Votifier is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Votifier is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Votifier. If not, see . + */ + +package nautilus.core.votehub.votifier.crypto; + +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.spec.RSAKeyGenParameterSpec; +import java.util.logging.Logger; + +/** + * An RSA key pair generator. + * + * @author Blake Beaupain + */ +public class RSAKeygen { + + /** The logger instance. */ + private static final Logger LOG = Logger.getLogger("Votifier"); + + /** + * Generates an RSA key pair. + * + * @param bits + * The amount of bits + * @return The key pair + */ + public static KeyPair generate(int bits) throws Exception { + LOG.info("Votifier is generating an RSA key pair..."); + KeyPairGenerator keygen = KeyPairGenerator.getInstance("RSA"); + RSAKeyGenParameterSpec spec = new RSAKeyGenParameterSpec(bits, + RSAKeyGenParameterSpec.F4); + keygen.initialize(spec); + return keygen.generateKeyPair(); + } + +} diff --git a/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/model/Vote.java b/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/model/Vote.java new file mode 100644 index 000000000..03525625f --- /dev/null +++ b/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/model/Vote.java @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2011 Vex Software LLC + * This file is part of Votifier. + * + * Votifier is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Votifier is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Votifier. If not, see . + */ + +package nautilus.core.votehub.votifier.model; + +/** + * A model for a vote. + * + * @author Blake Beaupain + */ +public class Vote { + + /** The name of the vote service. */ + private String serviceName; + + /** The username of the voter. */ + private String username; + + /** The address of the voter. */ + private String address; + + /** The date and time of the vote. */ + private String timeStamp; + + @Override + public String toString() { + return "Vote (from:" + serviceName + " username:" + username + + " address:" + address + " timeStamp:" + timeStamp + ")"; + } + + /** + * Sets the serviceName. + * + * @param serviceName + * The new serviceName + */ + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + /** + * Gets the serviceName. + * + * @return The serviceName + */ + public String getServiceName() { + return serviceName; + } + + /** + * Sets the username. + * + * @param username + * The new username + */ + public void setUsername(String username) { + this.username = username; + } + + /** + * Gets the username. + * + * @return The username + */ + public String getUsername() { + return username; + } + + /** + * Sets the address. + * + * @param address + * The new address + */ + public void setAddress(String address) { + this.address = address; + } + + /** + * Gets the address. + * + * @return The address + */ + public String getAddress() { + return address; + } + + /** + * Sets the time stamp. + * + * @param timeStamp + * The new time stamp + */ + public void setTimeStamp(String timeStamp) { + this.timeStamp = timeStamp; + } + + /** + * Gets the time stamp. + * + * @return The time stamp + */ + public String getTimeStamp() { + return timeStamp; + } + +} diff --git a/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/net/VoteReceiver.java b/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/net/VoteReceiver.java new file mode 100644 index 000000000..98dc0f2d0 --- /dev/null +++ b/Nautilus.Core.VoteHub/src/nautilus/core/votehub/votifier/net/VoteReceiver.java @@ -0,0 +1,213 @@ +package nautilus.core.votehub.votifier.net; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.net.InetSocketAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.SocketException; +import java.security.KeyPair; +import java.util.logging.*; +import javax.crypto.BadPaddingException; + +import mineplex.core.server.ServerBroadcaster; +import mineplex.core.server.packet.PlayerVotePacket; +import mineplex.core.server.remotecall.AsyncJsonWebCall; +import mineplex.core.server.util.Callback; +import mineplex.minecraft.donation.repository.token.PlayerUpdateToken; +import nautilus.core.votehub.votifier.crypto.RSA; +import nautilus.core.votehub.votifier.crypto.RSAIO; +import nautilus.core.votehub.votifier.crypto.RSAKeygen; +import nautilus.core.votehub.votifier.model.Vote; + +public class VoteReceiver extends Thread +{ + private static final Logger LOG = Logger.getLogger("Votifier"); + + private final String _host; + private final int _port; + + private KeyPair _keyPair; + + private ServerSocket server; + private ServerBroadcaster _serverTalker; + + private String _webserver; + + private boolean running = true; + + public VoteReceiver(ServerBroadcaster serverTalker, String webserver, String host, int port) throws Exception + { + _serverTalker = serverTalker; + _webserver = webserver; + _host = host; + _port = port; + + initialize(); + } + + private void initialize() throws Exception + { + try + { + server = new ServerSocket(); + server.bind(new InetSocketAddress(_host, _port)); + System.out.println("Bound to : " + _host + ":" + _port); + } + catch (Exception ex) + { + LOG.log(Level.SEVERE, "Error initializing vote receiver. Please verify that the configured"); + LOG.log(Level.SEVERE, "IP address and port are not already in use. This is a common problem"); + LOG.log(Level.SEVERE, "with hosting services and, if so, you should check with your hosting provider.", ex); + throw new Exception(ex); + } + + File rsaDirectory = new File("rsa/"); + + try + { + if (!rsaDirectory.exists()) + { + rsaDirectory.mkdir(); + _keyPair = RSAKeygen.generate(2048); + RSAIO.save(rsaDirectory, _keyPair); + } + else + { + _keyPair = RSAIO.load(rsaDirectory); + } + } + catch (Exception ex) + { + LOG.log(Level.SEVERE, "Error reading configuration file or RSA keys", ex); + return; + } + } + + public void shutdown() + { + running = false; + if (server == null) + return; + try + { + server.close(); + } + catch (Exception ex) + { + LOG.log(Level.WARNING, "Unable to shut down vote receiver cleanly."); + } + } + + @Override + public void run() + { + while (running) + { + try + { + Socket socket = server.accept(); + socket.setSoTimeout(5000); // Don't hang on slow connections. + BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); + InputStream in = socket.getInputStream(); + + // Send them our version. + writer.write("VOTIFIER 1.9"); + writer.newLine(); + writer.flush(); + + // Read the 256 byte block. + byte[] block = new byte[256]; + in.read(block, 0, block.length); + + // Decrypt the block. + block = RSA.decrypt(block, _keyPair.getPrivate()); + int position = 0; + + // Perform the opcode check. + String opcode = readString(block, position); + position += opcode.length() + 1; + + if (!opcode.equals("VOTE")) + { + throw new Exception("Unable to decode RSA"); + } + + // Parse the block. + String serviceName = readString(block, position); + position += serviceName.length() + 1; + String username = readString(block, position); + position += username.length() + 1; + String address = readString(block, position); + position += address.length() + 1; + String timeStamp = readString(block, position); + position += timeStamp.length() + 1; + + // Create the vote. + final Vote vote = new Vote(); + vote.setServiceName(serviceName); + vote.setUsername(username); + vote.setAddress(address); + vote.setTimeStamp(timeStamp); + + System.out.println(serviceName); + System.out.println(address); + + if (serviceName.equalsIgnoreCase("MinecraftServers.org") || serviceName.equalsIgnoreCase("Minestatus")) + { + new AsyncJsonWebCall(_webserver + "PlayerAccount/PlayerVoted").Execute(PlayerUpdateToken.class, new Callback() + { + public void run(PlayerUpdateToken token) + { + _serverTalker.QueuePacket(new PlayerVotePacket(vote.getUsername(), token.Points)); + } + }, username); + } + else + { + System.out.println("Received invalid vote from : " + serviceName + " for username : " + username + " at : " + timeStamp); + } + + // Clean up. + writer.close(); + in.close(); + socket.close(); + } + catch (SocketException ex) + { + LOG.log(Level.WARNING, "Protocol error. Ignoring packet - " + ex.getLocalizedMessage()); + } + catch (BadPaddingException ex) + { + LOG.log(Level.WARNING, "Unable to decrypt vote record. Make sure that that your public key"); + LOG.log(Level.WARNING, "matches the one you gave the server list.", ex); + } + catch (Exception ex) + { + LOG.log(Level.WARNING, "Exception caught while receiving a vote notification", ex); + } + } + } + + /** + * Reads a string from a block of data. + * + * @param data + * The data to read from + * @return The string + */ + private String readString(byte[] data, int offset) + { + StringBuilder builder = new StringBuilder(); + for (int i = offset; i < data.length; i++) + { + if (data[i] == '\n') + break; // Delimiter reached. + + builder.append((char) data[i]); + } + return builder.toString(); + } +} diff --git a/Plugins/BuildFiles/GemAccountSystem.xml b/Plugins/BuildFiles/GemAccountSystem.xml new file mode 100644 index 000000000..98e226d3c --- /dev/null +++ b/Plugins/BuildFiles/GemAccountSystem.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Plugins/BuildFiles/common.xml b/Plugins/BuildFiles/common.xml new file mode 100644 index 000000000..8dbc37e71 --- /dev/null +++ b/Plugins/BuildFiles/common.xml @@ -0,0 +1,276 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Plugins/BungeeSigns/.classpath b/Plugins/BungeeSigns/.classpath new file mode 100644 index 000000000..fbeb69b51 --- /dev/null +++ b/Plugins/BungeeSigns/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Plugins/BungeeSigns/.project b/Plugins/BungeeSigns/.project new file mode 100644 index 000000000..61b31c543 --- /dev/null +++ b/Plugins/BungeeSigns/.project @@ -0,0 +1,17 @@ + + + Mineplex.Bungee.BungeeSigns + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/BungeeSigns/.settings/org.eclipse.jdt.core.prefs b/Plugins/BungeeSigns/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7341ab168 --- /dev/null +++ b/Plugins/BungeeSigns/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/BungeeSigns/bin/mineplex/bungee/BungeeSigns/BungeeSigns$1.class b/Plugins/BungeeSigns/bin/mineplex/bungee/BungeeSigns/BungeeSigns$1.class new file mode 100644 index 000000000..9c2770839 Binary files /dev/null and b/Plugins/BungeeSigns/bin/mineplex/bungee/BungeeSigns/BungeeSigns$1.class differ diff --git a/Plugins/BungeeSigns/bin/mineplex/bungee/BungeeSigns/BungeeSigns.class b/Plugins/BungeeSigns/bin/mineplex/bungee/BungeeSigns/BungeeSigns.class new file mode 100644 index 000000000..84f52cdd7 Binary files /dev/null and b/Plugins/BungeeSigns/bin/mineplex/bungee/BungeeSigns/BungeeSigns.class differ diff --git a/Plugins/BungeeSigns/plugin.yml b/Plugins/BungeeSigns/plugin.yml new file mode 100644 index 000000000..ce1e6bc40 --- /dev/null +++ b/Plugins/BungeeSigns/plugin.yml @@ -0,0 +1,4 @@ +name: BungeeSigns +main: mineplex.bungee.BungeeSigns.BungeeSigns +version: 1 +author: defek7 diff --git a/Plugins/BungeeSigns/src/mineplex/bungee/BungeeSigns/BungeeSigns.java b/Plugins/BungeeSigns/src/mineplex/bungee/BungeeSigns/BungeeSigns.java new file mode 100644 index 000000000..47d5bcbe5 --- /dev/null +++ b/Plugins/BungeeSigns/src/mineplex/bungee/BungeeSigns/BungeeSigns.java @@ -0,0 +1,220 @@ +package mineplex.bungee.BungeeSigns; + +import java.io.ByteArrayInputStream; +import java.io.DataInput; +import java.io.DataInputStream; +import java.io.DataOutput; +import java.io.DataOutputStream; +import java.io.IOException; +import java.net.ConnectException; +import java.net.Socket; +import java.net.SocketTimeoutException; + +import com.google.common.io.ByteArrayDataOutput; +import com.google.common.io.ByteStreams; + +import net.md_5.bungee.api.config.ServerInfo; +import net.md_5.bungee.api.connection.Connection; +import net.md_5.bungee.api.event.PluginMessageEvent; +import net.md_5.bungee.api.plugin.Listener; +import net.md_5.bungee.api.plugin.Plugin; +import net.md_5.bungee.event.EventHandler; +import net.md_5.bungee.protocol.packet.PacketFAPluginMessage; + +public class BungeeSigns extends Plugin implements Listener +{ + @Override + public void onEnable() + { + getProxy().getPluginManager().registerListener(this, this); + getProxy().registerChannel("BungeeSigns"); + } + + @EventHandler + public void ReceiveServerRequest(final PluginMessageEvent event) + { + if (event.getTag().equals("BungeeSigns")) + { + DataInputStream in = null; + + try + { + in = new DataInputStream(new ByteArrayInputStream(event.getData())); + final ServerInfo serverInfo = getProxy().getServerInfo(in.readUTF()); + + in.close(); + + if (serverInfo != null) + { + new Thread() { + public void run() + { + SendServerInfo(serverInfo, event.getSender()); + } + }.start(); + } + } + catch (IOException e) + { + System.out.println("[BungeeSigns] Error retrieving serverInfo."); + } + finally + { + try + { + if (in != null) + { + in.close(); + } + } + catch (Exception e) + { + + } + } + } + } + + protected void SendServerInfo(ServerInfo serverInfo, Connection sender) + { + Socket socket = null; + DataInputStream dataInputStream = null; + DataOutputStream dataOutputStream = null; + + try + { + socket = new Socket(); + socket.setSoTimeout(3000); + socket.setTcpNoDelay(true); + socket.setTrafficClass(18); + socket.connect(serverInfo.getAddress(), 3000); + dataInputStream = new DataInputStream(socket.getInputStream()); + dataOutputStream = new DataOutputStream(socket.getOutputStream()); + + dataOutputStream.writeByte(254); + dataOutputStream.writeByte(1); + dataOutputStream.writeByte(254); + writeString("MC|PingHost", dataOutputStream); + dataOutputStream.writeShort(3 + 2 * serverInfo.getAddress().getHostString().length() + 4); + dataOutputStream.writeByte(74); + writeString(serverInfo.getAddress().getHostString(), dataOutputStream); + dataOutputStream.writeInt(serverInfo.getAddress().getPort()); + + if (dataInputStream.read() != 255) + { + return; + } + + String var6 = readString(dataInputStream, 256); + + String[] var27; + + if (var6.startsWith("\u00a7") && var6.length() > 1) + { + var27 = var6.substring(1).split("\u0000"); + + ByteArrayDataOutput out = ByteStreams.newDataOutput(); + + out.writeUTF(serverInfo.getName()); + out.writeUTF(var27[3]); + out.writeInt(Integer.parseInt(var27[4])); + out.writeInt(Integer.parseInt(var27[5])); + + byte[] b = out.toByteArray(); + + if (b.length != 0) + { + sender.unsafe().sendPacket(new PacketFAPluginMessage("BungeeSigns", b)); + } + } + } + catch (SocketTimeoutException e) + { + ; + } + catch (ConnectException e) + { + ; + } + catch(IOException e) + { + System.out.println("[BungeeSigns] Error pinging " + serverInfo.getName() + "(" + serverInfo.getAddress().getHostString() + ":" + serverInfo.getAddress().getPort()); + } + finally + { + try + { + if (dataInputStream != null) + { + dataInputStream.close(); + } + } + catch (Exception exception) + { + ; + } + + try + { + if (dataOutputStream != null) + { + dataOutputStream.close(); + } + } + catch (Exception exception) + { + ; + } + + try + { + if (socket != null) + { + socket.close(); + } + } + catch (Exception exception) + { + ; + } + } + } + + public static void writeString(String par0Str, DataOutput par1DataOutput) throws IOException + { + if (par0Str.length() > 32767) + { + throw new IOException("String too big"); + } + else + { + par1DataOutput.writeShort(par0Str.length()); + par1DataOutput.writeChars(par0Str); + } + } + + public static String readString(DataInput par0DataInput, int par1) throws IOException + { + short var2 = par0DataInput.readShort(); + + if (var2 > par1) + { + throw new IOException("Received string length longer than maximum allowed (" + var2 + " > " + par1 + ")"); + } + else if (var2 < 0) + { + throw new IOException("Received string length is less than zero! Weird string!"); + } + else + { + StringBuilder var3 = new StringBuilder(); + + for (int var4 = 0; var4 < var2; ++var4) + { + var3.append(par0DataInput.readChar()); + } + + return var3.toString(); + } + } +} diff --git a/Plugins/Core/.classpath b/Plugins/Core/.classpath new file mode 100644 index 000000000..715fc22fd --- /dev/null +++ b/Plugins/Core/.classpath @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/Plugins/Core/.externalToolBuilders/CoreBuilder.launch b/Plugins/Core/.externalToolBuilders/CoreBuilder.launch new file mode 100644 index 000000000..b0edbb1f8 --- /dev/null +++ b/Plugins/Core/.externalToolBuilders/CoreBuilder.launch @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/Plugins/Core/.project b/Plugins/Core/.project new file mode 100644 index 000000000..1f5ee416f --- /dev/null +++ b/Plugins/Core/.project @@ -0,0 +1,27 @@ + + + Core + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/CoreBuilder.launch + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Core/.settings/org.eclipse.jdt.core.prefs b/Plugins/Core/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..8000cd6ca --- /dev/null +++ b/Plugins/Core/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/Plugins/Core/Core.xml b/Plugins/Core/Core.xml new file mode 100644 index 000000000..391b3682a --- /dev/null +++ b/Plugins/Core/Core.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Plugins/Core/bin/me/chiss/Core/Chat/Chat.class b/Plugins/Core/bin/me/chiss/Core/Chat/Chat.class new file mode 100644 index 000000000..d1a6adac6 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Chat/Chat.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Chat/command/SilenceCommand.class b/Plugins/Core/bin/me/chiss/Core/Chat/command/SilenceCommand.class new file mode 100644 index 000000000..38ef7d45c Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Chat/command/SilenceCommand.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/ClientAcc.class b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientAcc.class new file mode 100644 index 000000000..930049a15 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientAcc.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/ClientBan.class b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientBan.class new file mode 100644 index 000000000..654722ab7 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientBan.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/ClientBanEntry.class b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientBanEntry.class new file mode 100644 index 000000000..6353a63b8 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientBanEntry.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/ClientClan.class b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientClan.class new file mode 100644 index 000000000..2c730a110 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientClan.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/ClientClass.class b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientClass.class new file mode 100644 index 000000000..fcd584ec7 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientClass.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/ClientCondition.class b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientCondition.class new file mode 100644 index 000000000..1d27d305e Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientCondition.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/ClientConditionEntry.class b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientConditionEntry.class new file mode 100644 index 000000000..8fa28e4c0 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientConditionEntry.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/ClientDataBase.class b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientDataBase.class new file mode 100644 index 000000000..993f2accd Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientDataBase.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/ClientDonor.class b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientDonor.class new file mode 100644 index 000000000..6576cc286 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientDonor.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/ClientGame.class b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientGame.class new file mode 100644 index 000000000..28a1593d7 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientGame.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/ClientIgnore.class b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientIgnore.class new file mode 100644 index 000000000..01a9a6600 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientIgnore.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/ClientMute.class b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientMute.class new file mode 100644 index 000000000..2e9a7f7b4 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientMute.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/ClientNAC.class b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientNAC.class new file mode 100644 index 000000000..3157058c5 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientNAC.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/ClientPlayer.class b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientPlayer.class new file mode 100644 index 000000000..45268cae5 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientPlayer.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/ClientPlayer.java.orig b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientPlayer.java.orig new file mode 100644 index 000000000..04bba2a0c --- /dev/null +++ b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientPlayer.java.orig @@ -0,0 +1,90 @@ +package me.chiss.Core.ClientData; + +import org.bukkit.Location; + +import mineplex.core.account.CoreClient; + +public class ClientPlayer extends ClientDataBase +{ + private long _lastAction = 0; + private long _lastGrounded = 0; + private long _lastMovement = 0; + private long _lastDamagee = 0; + private long _lastDamager = 0; + + private Location _lastLocation = null; + + public ClientPlayer(CoreClient client) + { + super(client, "Player", null); + } + + @Override + public void Load() + { + + } + + @Override + protected void LoadToken(Object token) + { + + } + + public long GetLastAction() { + return _lastAction; + } + + public void SetLastAction(long _lastAction) { + this._lastAction = _lastAction; + } + + public long GetLastGrounded() { + return _lastGrounded; + } + + public void SetLastGrounded(long _lastGrounded) { + this._lastGrounded = _lastGrounded; + } + + public long GetLastMovement() { + return _lastMovement; + } + + public void SetLastMovement(long _lastMovement) { + this._lastMovement = _lastMovement; + } + + public Location GetLastLocation() { + return _lastLocation; + } + + public void SetLastLocation(Location _lastLocation) { + this._lastLocation = _lastLocation; + } + + public long GetLastDamagee() + { + return _lastDamagee; + } + + public void SetLastDamagee(long _lastDamaged) { + this._lastDamagee = _lastDamaged; + } + + public long GetLastDamager() + { + return _lastDamager; + } + + public void SetLastDamager(long _lastDamaged) { + this._lastDamager = _lastDamaged; + } + + public long GetLastCombat() + { + if (_lastDamager > _lastDamagee) + return _lastDamager; + return _lastDamagee; + } +} diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/ClientRank.class b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientRank.class new file mode 100644 index 000000000..5aeaedd94 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientRank.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/ClientWiki.class b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientWiki.class new file mode 100644 index 000000000..028ce4715 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/ClientWiki.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/IClientClass.class b/Plugins/Core/bin/me/chiss/Core/ClientData/IClientClass.class new file mode 100644 index 000000000..146248e97 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/IClientClass.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/ClientData/IClientDataLoad.class b/Plugins/Core/bin/me/chiss/Core/ClientData/IClientDataLoad.class new file mode 100644 index 000000000..2f9fc51a2 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/ClientData/IClientDataLoad.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Config/Config.class b/Plugins/Core/bin/me/chiss/Core/Config/Config.class new file mode 100644 index 000000000..7c217d790 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Config/Config.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Delayed/delayNACQuery.class b/Plugins/Core/bin/me/chiss/Core/Delayed/delayNACQuery.class new file mode 100644 index 000000000..150d91e0a Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Delayed/delayNACQuery.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Events/ServerSaveEvent.class b/Plugins/Core/bin/me/chiss/Core/Events/ServerSaveEvent.class new file mode 100644 index 000000000..cd4fff345 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Events/ServerSaveEvent.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Frame/ADelay.class b/Plugins/Core/bin/me/chiss/Core/Frame/ADelay.class new file mode 100644 index 000000000..d3e316f97 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Frame/ADelay.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Loot/LootBase.class b/Plugins/Core/bin/me/chiss/Core/Loot/LootBase.class new file mode 100644 index 000000000..63d362c2a Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Loot/LootBase.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Loot/LootFactory.class b/Plugins/Core/bin/me/chiss/Core/Loot/LootFactory.class new file mode 100644 index 000000000..22bfeb5b0 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Loot/LootFactory.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/AlligatorsTooth.class b/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/AlligatorsTooth.class new file mode 100644 index 000000000..59128b0fc Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/AlligatorsTooth.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/GiantsSword.class b/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/GiantsSword.class new file mode 100644 index 000000000..f61faf7ed Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/GiantsSword.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/HyperAxe.class b/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/HyperAxe.class new file mode 100644 index 000000000..d0a6cc7b3 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/HyperAxe.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/LightningScythe.class b/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/LightningScythe.class new file mode 100644 index 000000000..5f104caab Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/LightningScythe.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/MagneticBlade.class b/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/MagneticBlade.class new file mode 100644 index 000000000..5222b8b3b Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/MagneticBlade.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/MeteorBow.class b/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/MeteorBow.class new file mode 100644 index 000000000..ad153ea57 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/MeteorBow.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/WindBlade.class b/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/WindBlade.class new file mode 100644 index 000000000..7671fe3c1 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Loot/Weapons/WindBlade.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/MemoryFix/MemoryFix$1.class b/Plugins/Core/bin/me/chiss/Core/MemoryFix/MemoryFix$1.class new file mode 100644 index 000000000..d9951ce72 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/MemoryFix/MemoryFix$1.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/MemoryFix/MemoryFix.class b/Plugins/Core/bin/me/chiss/Core/MemoryFix/MemoryFix.class new file mode 100644 index 000000000..646254e65 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/MemoryFix/MemoryFix.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Module/AModule.class b/Plugins/Core/bin/me/chiss/Core/Module/AModule.class new file mode 100644 index 000000000..85042830b Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Module/AModule.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Module/ModuleManager.class b/Plugins/Core/bin/me/chiss/Core/Module/ModuleManager.class new file mode 100644 index 000000000..504872cf0 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Module/ModuleManager.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/BlockRegenerate.class b/Plugins/Core/bin/me/chiss/Core/Modules/BlockRegenerate.class new file mode 100644 index 000000000..126146f9b Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/BlockRegenerate.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/BlockRegenerateData.class b/Plugins/Core/bin/me/chiss/Core/Modules/BlockRegenerateData.class new file mode 100644 index 000000000..9f5bcd7b5 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/BlockRegenerateData.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/BlockRegenerateSet.class b/Plugins/Core/bin/me/chiss/Core/Modules/BlockRegenerateSet.class new file mode 100644 index 000000000..0b03bceb2 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/BlockRegenerateSet.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Blood.class b/Plugins/Core/bin/me/chiss/Core/Modules/Blood.class new file mode 100644 index 000000000..c75401cbe Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Blood.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Compass.class b/Plugins/Core/bin/me/chiss/Core/Modules/Compass.class new file mode 100644 index 000000000..5f46ffbbb Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Compass.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Explosion.java.orig b/Plugins/Core/bin/me/chiss/Core/Modules/Explosion.java.orig new file mode 100644 index 000000000..7bb4479ec --- /dev/null +++ b/Plugins/Core/bin/me/chiss/Core/Modules/Explosion.java.orig @@ -0,0 +1,253 @@ +package me.chiss.Core.Modules; + +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map.Entry; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.MiniPlugin; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.ExplosionPrimeEvent; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class Explosion extends MiniPlugin +{ + private boolean _damageEnabled = true; + private boolean _regenerateGround = false; + private HashSet _explosionBlocks = new HashSet(); + + private BlockRestore _blockRestore; + + public Explosion(JavaPlugin plugin, BlockRestore blockRestore) + { + super("Block Restore", plugin); + + _blockRestore = blockRestore; + } + + @EventHandler + public void ExplosionPrime(ExplosionPrimeEvent event) + { + if (event.getRadius() >= 5) + return; + + for (Block block : UtilBlock.getInRadius(event.getEntity().getLocation(), (double) event.getRadius()).keySet()) + if (block.isLiquid()) + block.setTypeId(0); + } + + @EventHandler + public void ExplosionEntity(EntityExplodeEvent event) + { + if (event.isCancelled()) + return; + + try + { + if (event.getEntityType() == EntityType.CREEPER) + event.blockList().clear(); + + if (event.getEntityType() == EntityType.WITHER_SKULL) + event.blockList().clear(); + } + catch(Exception e) + { + //Bloop + } + + + if (event.blockList().isEmpty()) + return; + + event.setYield(0f); + + //Save + final HashMap> blocks = new HashMap>(); + + for (Block cur : event.blockList()) + { + if (cur.getTypeId() == 0 || cur.isLiquid()) + continue; + + if (cur.getType() == Material.CHEST || + cur.getType() == Material.IRON_ORE || + cur.getType() == Material.COAL_ORE || + cur.getType() == Material.GOLD_ORE || + cur.getType() == Material.DIAMOND_ORE) + { + cur.breakNaturally(); + continue; + } + + blocks.put(cur, new AbstractMap.SimpleEntry(cur.getTypeId(), cur.getData())); + + if (!_regenerateGround) + { + if (cur.getTypeId() != 98 || cur.getData() != 0) + cur.setTypeId(0); + } + + else + _blockRestore.Add(cur, 0, (byte)0, 10000); + } + + event.blockList().clear(); + + //DELAY + + final Entity fEnt = event.getEntity(); + final Location fLoc = event.getLocation(); + _plugin.getServer().getScheduler().runTaskLater(_plugin, new Runnable() + { + public void run() + { + //Launch + for (Block cur : blocks.keySet()) + { + if (blocks.get(cur).getKey() == 98) + if (blocks.get(cur).getValue() == 0) + continue; + + //TNT + if (blocks.get(cur).getKey() == 46) + { + TNTPrimed ent = cur.getWorld().spawn(cur.getLocation().add(0.5, 0.5, 0.5), TNTPrimed.class); + Vector vec = UtilAlg.getTrajectory(fEnt, ent); + if (vec.getY() < 0) vec.setY(vec.getY() * -1); + + UtilAction.velocity(ent, vec, 1, false, 0, 0.6, 10, false); + + ent.setFuseTicks(10); + } + //Other + else + { + FallingBlock fall = cur.getWorld().spawnFallingBlock(cur.getLocation().add(0.5, 0.5, 0.5), blocks.get(cur).getKey(), blocks.get(cur).getValue()); + + Vector vec = UtilAlg.getTrajectory(fEnt, fall); + if (vec.getY() < 0) vec.setY(vec.getY() * -1); + + vec.multiply(0.6 + 0.4*Math.random()); + + UtilAction.velocity(fall, vec, 0.75, false, 0, 0.6, 10, false); + + _explosionBlocks.add(fall); + } + } + + //Items + /** + for (Item item : event.getEntity().getWorld().getEntitiesByClass(Item.class)) + if (UtilMath.offset(item, event.getEntity()) < 5) + { + Vector vec = UtilAlg.getTrajectory(event.getEntity(), item); + if (vec.getY() < 0) vec.setY(vec.getY() * -1); + + UtilAction.velocity(item, vec, 1, false, 0, 0.6, 10, false); + } + **/ + + //Crack + for (Block cur : UtilBlock.getInRadius(fLoc, 4d).keySet()) + if (cur.getTypeId() == 98) + if (cur.getData() == 0) + cur.setTypeIdAndData(98, (byte)2, true); + } + }, 1); + } + + @EventHandler + public void ExplosionBlockUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + HashSet fallen = new HashSet(); + + for (FallingBlock cur : _explosionBlocks) + { + if (cur.isDead() || !cur.isValid() || cur.getTicksLived() > 600) + fallen.add(cur); + } + + for (FallingBlock cur : fallen) + { + _explosionBlocks.remove(cur); + + if (cur.getTicksLived() > 600) + { + cur.remove(); + continue; + } + + Block block = cur.getLocation().getBlock(); + block.setTypeIdAndData(0, (byte)0, true); + + //Block Replace + _blockRestore.Add(block, cur.getBlockId(), cur.getBlockData(), 10000); + + cur.remove(); + } + } + + @EventHandler + public void ExplosionItemSpawn(ItemSpawnEvent event) + { + for (FallingBlock block : _explosionBlocks) + if (UtilMath.offset(event.getEntity().getLocation(), block.getLocation()) < 1) + event.setCancelled(true); + } + + @EventHandler + public void ExplosionDamage(CustomDamageEvent event) + { + if (_damageEnabled) + return; + + if (event.GetCause() == DamageCause.ENTITY_EXPLOSION || event.GetCause() == DamageCause.BLOCK_EXPLOSION) + event.SetCancelled("Explosion Damage Disabled"); + } + + @EventHandler(priority = EventPriority.LOW) + public void ExplosionBlocks(EntityExplodeEvent event) + { + if (event.getEntity() == null) + event.blockList().clear(); + } + + public void SetDamage(boolean enabled) + { + _damageEnabled = enabled; + } + + public void SetRegenerate(boolean regenerate) + { + _regenerateGround = regenerate; + } + + public HashSet GetExplosionBlocks() + { + return _explosionBlocks; + } +} diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Firework.class b/Plugins/Core/bin/me/chiss/Core/Modules/Firework.class new file mode 100644 index 000000000..e89ad040e Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Firework.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Fix.class b/Plugins/Core/bin/me/chiss/Core/Modules/Fix.class new file mode 100644 index 000000000..c68dc7b3c Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Fix.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Give.class b/Plugins/Core/bin/me/chiss/Core/Modules/Give.class new file mode 100644 index 000000000..c792f371b Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Give.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Ignore.class b/Plugins/Core/bin/me/chiss/Core/Modules/Ignore.class new file mode 100644 index 000000000..f6820fc84 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Ignore.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Information.class b/Plugins/Core/bin/me/chiss/Core/Modules/Information.class new file mode 100644 index 000000000..89dd35985 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Information.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/JoinQuit.class b/Plugins/Core/bin/me/chiss/Core/Modules/JoinQuit.class new file mode 100644 index 000000000..560ec3bd3 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/JoinQuit.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Logger.class b/Plugins/Core/bin/me/chiss/Core/Modules/Logger.class new file mode 100644 index 000000000..74719cc0f Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Logger.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Observer.class b/Plugins/Core/bin/me/chiss/Core/Modules/Observer.class new file mode 100644 index 000000000..b5ff1e184 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Observer.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/PlayerInfo.class b/Plugins/Core/bin/me/chiss/Core/Modules/PlayerInfo.class new file mode 100644 index 000000000..5e29eb78b Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/PlayerInfo.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/PointManager.class b/Plugins/Core/bin/me/chiss/Core/Modules/PointManager.class new file mode 100644 index 000000000..94c928446 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/PointManager.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Quit.class b/Plugins/Core/bin/me/chiss/Core/Modules/Quit.class new file mode 100644 index 000000000..0ed28e2ec Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Quit.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/QuitDataLog.class b/Plugins/Core/bin/me/chiss/Core/Modules/QuitDataLog.class new file mode 100644 index 000000000..15c050b7e Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/QuitDataLog.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/QuitDataQuit.class b/Plugins/Core/bin/me/chiss/Core/Modules/QuitDataQuit.class new file mode 100644 index 000000000..785b8cd51 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/QuitDataQuit.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/QuitInventory.class b/Plugins/Core/bin/me/chiss/Core/Modules/QuitInventory.class new file mode 100644 index 000000000..6a95c6f9a Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/QuitInventory.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Tester$1.class b/Plugins/Core/bin/me/chiss/Core/Modules/Tester$1.class new file mode 100644 index 000000000..04a284287 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Tester$1.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Tester$2.class b/Plugins/Core/bin/me/chiss/Core/Modules/Tester$2.class new file mode 100644 index 000000000..140af1453 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Tester$2.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Tester$3.class b/Plugins/Core/bin/me/chiss/Core/Modules/Tester$3.class new file mode 100644 index 000000000..2c1594fe1 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Tester$3.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Tester$4.class b/Plugins/Core/bin/me/chiss/Core/Modules/Tester$4.class new file mode 100644 index 000000000..d088f30e9 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Tester$4.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Tester$5.class b/Plugins/Core/bin/me/chiss/Core/Modules/Tester$5.class new file mode 100644 index 000000000..42ef82971 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Tester$5.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Tester.class b/Plugins/Core/bin/me/chiss/Core/Modules/Tester.class new file mode 100644 index 000000000..3c3c9a05b Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Tester.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/UpdateThread.class b/Plugins/Core/bin/me/chiss/Core/Modules/UpdateThread.class new file mode 100644 index 000000000..e21fdd2d7 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/UpdateThread.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Utility.class b/Plugins/Core/bin/me/chiss/Core/Modules/Utility.class new file mode 100644 index 000000000..776ef13ad Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Utility.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Modules/Wiki.class b/Plugins/Core/bin/me/chiss/Core/Modules/Wiki.class new file mode 100644 index 000000000..8e7b9acf8 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Modules/Wiki.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Plugin/IChat.class b/Plugins/Core/bin/me/chiss/Core/Plugin/IChat.class new file mode 100644 index 000000000..c522d158a Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Plugin/IChat.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Plugin/ILogger.class b/Plugins/Core/bin/me/chiss/Core/Plugin/ILogger.class new file mode 100644 index 000000000..67f928395 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Plugin/ILogger.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Plugin/IPlugin.class b/Plugins/Core/bin/me/chiss/Core/Plugin/IPlugin.class new file mode 100644 index 000000000..33c6309c7 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Plugin/IPlugin.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Plugin/IPlugin.java.orig b/Plugins/Core/bin/me/chiss/Core/Plugin/IPlugin.java.orig new file mode 100644 index 000000000..930933390 --- /dev/null +++ b/Plugins/Core/bin/me/chiss/Core/Plugin/IPlugin.java.orig @@ -0,0 +1,77 @@ +package me.chiss.Core.Plugin; + +import org.bukkit.Location; +import org.bukkit.plugin.java.JavaPlugin; + +import me.chiss.Core.Clans.Clans; +import me.chiss.Core.Class.ClassFactory; +import me.chiss.Core.Client.CoreClientManager; +import me.chiss.Core.Combat.CombatManager; +import me.chiss.Core.Condition.ConditionManager; +import me.chiss.Core.Config.Config; +import me.chiss.Core.Damage.DamageManager; +import me.chiss.Core.Loot.LootFactory; +import me.chiss.Core.Module.ModuleManager; +import me.chiss.Core.Modules.*; +import me.chiss.Core.NAC.NAC; +import me.chiss.Core.Pet.PetManager; +import me.chiss.Core.PlayerTagNamer.INameColorer; +import me.chiss.Core.Punish.Punish; +import me.chiss.Core.Skill.SkillFactory; + +public interface IPlugin +{ + public void Log(String moduleName, String data); + + public JavaPlugin GetPlugin(); + + public IRelation GetRelation(); + + public ModuleManager GetModules(); + public Config GetConfig(); + public CoreClientManager GetClients(); + public Utility GetUtility(); + + public Punish GetBan(); + public Blood GetBlood(); + public BlockRegenerate GetBlockRegenerate(); + public BlockRestore GetBlockRestore(); + public NAC GetNAC(); + public Clans GetClans(); + public ClassFactory GetClasses(); + public Compass GetCompass(); + public ConditionManager GetCondition(); + public CombatManager GetCombat(); + public Creature GetCreature(); + public DamageManager GetDamage(); + public Donation GetDonation(); + public Energy GetEnergy(); + public Explosion GetExplosion(); + public Field GetField(); + public Fire GetFire(); + public Fix GetFix(); + public Give GetGive(); + public Ignore GetIgnore(); + public ItemStackFactory GetItemStackFactory(); + public me.chiss.Core.Modules.Logger GetLogger(); + public LootFactory GetLoot(); + public Message GetMessage(); + public Observer GetObserver(); + public Recharge GetRecharge(); + public Server GetServer(); + public SkillFactory GetSkills(); + public Spawn GetSpawn(); + public Teleport GetTeleport(); + public Throw GetThrow(); + public Weapon GetWeapon(); + public Wiki GetWiki(); + public Location GetSpawnLocation(); + + public String GetWebServerAddress(); + + public INameColorer GetNameColorer(); + + public PetManager GetPetManager(); + + +} diff --git a/Plugins/Core/bin/me/chiss/Core/Plugin/IRelation.class b/Plugins/Core/bin/me/chiss/Core/Plugin/IRelation.class new file mode 100644 index 000000000..b172e0e47 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Plugin/IRelation.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Plugin/Logger.class b/Plugins/Core/bin/me/chiss/Core/Plugin/Logger.class new file mode 100644 index 000000000..097934203 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Plugin/Logger.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/PvpShop/IPvpShopFactory.class b/Plugins/Core/bin/me/chiss/Core/PvpShop/IPvpShopFactory.class new file mode 100644 index 000000000..0c52f661c Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/PvpShop/IPvpShopFactory.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/PvpShop/IShopItem.class b/Plugins/Core/bin/me/chiss/Core/PvpShop/IShopItem.class new file mode 100644 index 000000000..f4d7e7e42 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/PvpShop/IShopItem.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/PvpShop/PvpShopFactory.class b/Plugins/Core/bin/me/chiss/Core/PvpShop/PvpShopFactory.class new file mode 100644 index 000000000..9080740e6 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/PvpShop/PvpShopFactory.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/PvpShop/ShopItem.class b/Plugins/Core/bin/me/chiss/Core/PvpShop/ShopItem.class new file mode 100644 index 000000000..fec111e48 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/PvpShop/ShopItem.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Scheduler/ForceDailyCommand.class b/Plugins/Core/bin/me/chiss/Core/Scheduler/ForceDailyCommand.class new file mode 100644 index 000000000..3c53e22bb Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Scheduler/ForceDailyCommand.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Scheduler/IScheduleListener.class b/Plugins/Core/bin/me/chiss/Core/Scheduler/IScheduleListener.class new file mode 100644 index 000000000..30aa099ae Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Scheduler/IScheduleListener.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Scheduler/Scheduler.class b/Plugins/Core/bin/me/chiss/Core/Scheduler/Scheduler.class new file mode 100644 index 000000000..9517644f6 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Scheduler/Scheduler.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Server/Server.class b/Plugins/Core/bin/me/chiss/Core/Server/Server.class new file mode 100644 index 000000000..0b50b6883 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Server/Server.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Server/command/BroadcastCommand.class b/Plugins/Core/bin/me/chiss/Core/Server/command/BroadcastCommand.class new file mode 100644 index 000000000..330188d10 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Server/command/BroadcastCommand.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Server/command/ListCommand.class b/Plugins/Core/bin/me/chiss/Core/Server/command/ListCommand.class new file mode 100644 index 000000000..674d16954 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Server/command/ListCommand.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Server/command/SpawnSetCommand.class b/Plugins/Core/bin/me/chiss/Core/Server/command/SpawnSetCommand.class new file mode 100644 index 000000000..9efb6571b Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Server/command/SpawnSetCommand.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Server/command/WaterSpreadCommand.class b/Plugins/Core/bin/me/chiss/Core/Server/command/WaterSpreadCommand.class new file mode 100644 index 000000000..3ed053021 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Server/command/WaterSpreadCommand.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/CustomBuildShop.class b/Plugins/Core/bin/me/chiss/Core/Shop/CustomBuildShop.class new file mode 100644 index 000000000..1e5d4c9da Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/CustomBuildShop.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/DonatorShop.class b/Plugins/Core/bin/me/chiss/Core/Shop/DonatorShop.class new file mode 100644 index 000000000..54f51be6f Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/DonatorShop.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/GameShop.class b/Plugins/Core/bin/me/chiss/Core/Shop/GameShop.class new file mode 100644 index 000000000..c29156907 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/GameShop.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/IButton.class b/Plugins/Core/bin/me/chiss/Core/Shop/IButton.class new file mode 100644 index 000000000..fdbd2a58c Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/IButton.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/PvpBuildShop.class b/Plugins/Core/bin/me/chiss/Core/Shop/PvpBuildShop.class new file mode 100644 index 000000000..9b2f0dec5 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/PvpBuildShop.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/PvpDonatorShop.class b/Plugins/Core/bin/me/chiss/Core/Shop/PvpDonatorShop.class new file mode 100644 index 000000000..9151a58ea Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/PvpDonatorShop.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/PvpItemShop.class b/Plugins/Core/bin/me/chiss/Core/Shop/PvpItemShop.class new file mode 100644 index 000000000..d27284197 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/PvpItemShop.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/Shop.class b/Plugins/Core/bin/me/chiss/Core/Shop/Shop.class new file mode 100644 index 000000000..df5545568 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/Shop.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/actions/ChangeCurrency.class b/Plugins/Core/bin/me/chiss/Core/Shop/actions/ChangeCurrency.class new file mode 100644 index 000000000..ef627abf7 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/actions/ChangeCurrency.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/actions/NextPage.class b/Plugins/Core/bin/me/chiss/Core/Shop/actions/NextPage.class new file mode 100644 index 000000000..ffb486878 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/actions/NextPage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/actions/PreviousPage.class b/Plugins/Core/bin/me/chiss/Core/Shop/actions/PreviousPage.class new file mode 100644 index 000000000..680101d7b Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/actions/PreviousPage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/actions/Purchase.class b/Plugins/Core/bin/me/chiss/Core/Shop/actions/Purchase.class new file mode 100644 index 000000000..a9a8a8332 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/actions/Purchase.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/actions/PvpReturn.class b/Plugins/Core/bin/me/chiss/Core/Shop/actions/PvpReturn.class new file mode 100644 index 000000000..d18b51aa5 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/actions/PvpReturn.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/actions/Reset.class b/Plugins/Core/bin/me/chiss/Core/Shop/actions/Reset.class new file mode 100644 index 000000000..0a9f1bb68 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/actions/Reset.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/actions/Return.class b/Plugins/Core/bin/me/chiss/Core/Shop/actions/Return.class new file mode 100644 index 000000000..8f41e24ea Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/actions/Return.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/actions/ShopActionBase.class b/Plugins/Core/bin/me/chiss/Core/Shop/actions/ShopActionBase.class new file mode 100644 index 000000000..bcf50ef49 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/actions/ShopActionBase.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/currency/CreditHandler.class b/Plugins/Core/bin/me/chiss/Core/Shop/currency/CreditHandler.class new file mode 100644 index 000000000..eb4e6acc2 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/currency/CreditHandler.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/currency/EconomyHandler.class b/Plugins/Core/bin/me/chiss/Core/Shop/currency/EconomyHandler.class new file mode 100644 index 000000000..2efaddfe3 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/currency/EconomyHandler.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/currency/ICurrencyHandler.class b/Plugins/Core/bin/me/chiss/Core/Shop/currency/ICurrencyHandler.class new file mode 100644 index 000000000..e7ac532c5 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/currency/ICurrencyHandler.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/currency/ItemTokenHandler.class b/Plugins/Core/bin/me/chiss/Core/Shop/currency/ItemTokenHandler.class new file mode 100644 index 000000000..f06d799af Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/currency/ItemTokenHandler.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/currency/PointHandler.class b/Plugins/Core/bin/me/chiss/Core/Shop/currency/PointHandler.class new file mode 100644 index 000000000..762604bb3 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/currency/PointHandler.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/currency/SkillTokenHandler.class b/Plugins/Core/bin/me/chiss/Core/Shop/currency/SkillTokenHandler.class new file mode 100644 index 000000000..e3941a52b Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/currency/SkillTokenHandler.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/events/PurchasePackageEvent.class b/Plugins/Core/bin/me/chiss/Core/Shop/events/PurchasePackageEvent.class new file mode 100644 index 000000000..091a097a4 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/events/PurchasePackageEvent.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/listeners/IPurchaseListener.class b/Plugins/Core/bin/me/chiss/Core/Shop/listeners/IPurchaseListener.class new file mode 100644 index 000000000..739368b88 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/listeners/IPurchaseListener.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/listeners/IResetListener.class b/Plugins/Core/bin/me/chiss/Core/Shop/listeners/IResetListener.class new file mode 100644 index 000000000..d771a7359 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/listeners/IResetListener.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/listeners/IReturnListener.class b/Plugins/Core/bin/me/chiss/Core/Shop/listeners/IReturnListener.class new file mode 100644 index 000000000..4b13fee67 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/listeners/IReturnListener.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/page/IPage.class b/Plugins/Core/bin/me/chiss/Core/Shop/page/IPage.class new file mode 100644 index 000000000..4eb832e45 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/page/IPage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/page/IShopPage.class b/Plugins/Core/bin/me/chiss/Core/Shop/page/IShopPage.class new file mode 100644 index 000000000..3495c1679 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/page/IShopPage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/page/PageBase.class b/Plugins/Core/bin/me/chiss/Core/Shop/page/PageBase.class new file mode 100644 index 000000000..047de8317 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/page/PageBase.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/page/ShopPageBase.class b/Plugins/Core/bin/me/chiss/Core/Shop/page/ShopPageBase.class new file mode 100644 index 000000000..ed32bacd4 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/page/ShopPageBase.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/page/game/CustomBuildPage.class b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/CustomBuildPage.class new file mode 100644 index 000000000..869930155 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/CustomBuildPage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/page/game/ItemPage.class b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/ItemPage.class new file mode 100644 index 000000000..21106aca8 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/ItemPage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/page/game/PvpCustomBuildPage.class b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/PvpCustomBuildPage.class new file mode 100644 index 000000000..bce6f0260 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/PvpCustomBuildPage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/page/game/ShopItemPage.class b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/ShopItemPage.class new file mode 100644 index 000000000..1a91fd00f Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/ShopItemPage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/page/game/SkillsPage.class b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/SkillsPage.class new file mode 100644 index 000000000..e0117b0a9 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/SkillsPage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/page/game/WeaponPage.class b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/WeaponPage.class new file mode 100644 index 000000000..63d7198de Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/WeaponPage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/page/game/purchase/ArmorPurchasePage.class b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/purchase/ArmorPurchasePage.class new file mode 100644 index 000000000..d68523b2d Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/purchase/ArmorPurchasePage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/page/game/purchase/ConfirmationPage.class b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/purchase/ConfirmationPage.class new file mode 100644 index 000000000..0a2514e15 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/purchase/ConfirmationPage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/page/game/purchase/ItemPurchasePage.class b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/purchase/ItemPurchasePage.class new file mode 100644 index 000000000..3a83aecc4 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/purchase/ItemPurchasePage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/page/game/purchase/SkillsPurchasePage.class b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/purchase/SkillsPurchasePage.class new file mode 100644 index 000000000..39f47ca47 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/purchase/SkillsPurchasePage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/page/game/purchase/WeaponPurchasePage.class b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/purchase/WeaponPurchasePage.class new file mode 100644 index 000000000..61d5ef41b Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/page/game/purchase/WeaponPurchasePage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/IPageBuilder.class b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/IPageBuilder.class new file mode 100644 index 000000000..1333642f5 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/IPageBuilder.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/PageBuilderBase.class b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/PageBuilderBase.class new file mode 100644 index 000000000..45fa7566b Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/PageBuilderBase.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/CustomBuildPageBuilder.class b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/CustomBuildPageBuilder.class new file mode 100644 index 000000000..2c5f00464 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/CustomBuildPageBuilder.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/ItemPageBuilder.class b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/ItemPageBuilder.class new file mode 100644 index 000000000..496a45e58 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/ItemPageBuilder.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/PvpCustomBuildPageBuilder.class b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/PvpCustomBuildPageBuilder.class new file mode 100644 index 000000000..d83e6fec8 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/PvpCustomBuildPageBuilder.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/PvpShopPageBuilder.class b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/PvpShopPageBuilder.class new file mode 100644 index 000000000..073d1dbf4 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/PvpShopPageBuilder.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/SkillsPageBuilder.class b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/SkillsPageBuilder.class new file mode 100644 index 000000000..b73a0dcc8 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/SkillsPageBuilder.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/WeaponPageBuilder.class b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/WeaponPageBuilder.class new file mode 100644 index 000000000..40040479f Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/WeaponPageBuilder.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/purchase/ArmorPurchasePageBuilder.class b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/purchase/ArmorPurchasePageBuilder.class new file mode 100644 index 000000000..1ca15288e Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/purchase/ArmorPurchasePageBuilder.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/purchase/ItemPurchasePageBuilder.class b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/purchase/ItemPurchasePageBuilder.class new file mode 100644 index 000000000..2a84fac54 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/purchase/ItemPurchasePageBuilder.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/purchase/SkillsPurchasePageBuilder.class b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/purchase/SkillsPurchasePageBuilder.class new file mode 100644 index 000000000..3862791e7 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/purchase/SkillsPurchasePageBuilder.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/purchase/WeaponPurchasePageBuilder.class b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/purchase/WeaponPurchasePageBuilder.class new file mode 100644 index 000000000..d3dc07261 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/game/purchase/WeaponPurchasePageBuilder.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/itemwrapper/DonationWrapper.class b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/itemwrapper/DonationWrapper.class new file mode 100644 index 000000000..6eaa4e3ef Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/itemwrapper/DonationWrapper.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/itemwrapper/IItemWrapper.class b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/itemwrapper/IItemWrapper.class new file mode 100644 index 000000000..5160c06c1 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/itemwrapper/IItemWrapper.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/itemwrapper/NoWrapper.class b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/itemwrapper/NoWrapper.class new file mode 100644 index 000000000..09fd9c9e1 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/pagebuilder/itemwrapper/NoWrapper.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/ArmorPackage.class b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/ArmorPackage.class new file mode 100644 index 000000000..dfed5b43f Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/ArmorPackage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/DefaultClassPackage.class b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/DefaultClassPackage.class new file mode 100644 index 000000000..bfb73c1a9 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/DefaultClassPackage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/DonationPackage.class b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/DonationPackage.class new file mode 100644 index 000000000..5867c28b7 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/DonationPackage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/ISalesPackage.class b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/ISalesPackage.class new file mode 100644 index 000000000..ade562bda Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/ISalesPackage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/ItemPackage.class b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/ItemPackage.class new file mode 100644 index 000000000..7d4975563 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/ItemPackage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/PvpItemPackage.class b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/PvpItemPackage.class new file mode 100644 index 000000000..504ed34ce Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/PvpItemPackage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/PvpShopItem.class b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/PvpShopItem.class new file mode 100644 index 000000000..d484be996 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/PvpShopItem.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/ShopItem.class b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/ShopItem.class new file mode 100644 index 000000000..3f7ddb493 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/ShopItem.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/SkillPackage.class b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/SkillPackage.class new file mode 100644 index 000000000..29cd50bb1 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Shop/salespackage/SkillPackage.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Utility/AUtility.class b/Plugins/Core/bin/me/chiss/Core/Utility/AUtility.class new file mode 100644 index 000000000..f992c8677 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Utility/AUtility.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Utility/InventoryUtil.class b/Plugins/Core/bin/me/chiss/Core/Utility/InventoryUtil.class new file mode 100644 index 000000000..70dadc657 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Utility/InventoryUtil.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Utility/UtilAccount.class b/Plugins/Core/bin/me/chiss/Core/Utility/UtilAccount.class new file mode 100644 index 000000000..2867094e3 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Utility/UtilAccount.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Utility/UtilInput.class b/Plugins/Core/bin/me/chiss/Core/Utility/UtilInput.class new file mode 100644 index 000000000..ead43a4c7 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Utility/UtilInput.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Utility/UtilItem.class b/Plugins/Core/bin/me/chiss/Core/Utility/UtilItem.class new file mode 100644 index 000000000..955b3331b Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Utility/UtilItem.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Vote/VoteManager.class b/Plugins/Core/bin/me/chiss/Core/Vote/VoteManager.class new file mode 100644 index 000000000..e6d5484a9 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Vote/VoteManager.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Weapon/Commands/WeaponCommand.class b/Plugins/Core/bin/me/chiss/Core/Weapon/Commands/WeaponCommand.class new file mode 100644 index 000000000..b1862c2e0 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Weapon/Commands/WeaponCommand.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Weapon/IWeapon.class b/Plugins/Core/bin/me/chiss/Core/Weapon/IWeapon.class new file mode 100644 index 000000000..3c99148ba Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Weapon/IWeapon.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Weapon/IWeaponFactory.class b/Plugins/Core/bin/me/chiss/Core/Weapon/IWeaponFactory.class new file mode 100644 index 000000000..20337dc65 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Weapon/IWeaponFactory.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Weapon/Weapon.class b/Plugins/Core/bin/me/chiss/Core/Weapon/Weapon.class new file mode 100644 index 000000000..51fbf2903 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Weapon/Weapon.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Weapon/WeaponFactory$1.class b/Plugins/Core/bin/me/chiss/Core/Weapon/WeaponFactory$1.class new file mode 100644 index 000000000..a60fdd863 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Weapon/WeaponFactory$1.class differ diff --git a/Plugins/Core/bin/me/chiss/Core/Weapon/WeaponFactory.class b/Plugins/Core/bin/me/chiss/Core/Weapon/WeaponFactory.class new file mode 100644 index 000000000..e38dc1fa8 Binary files /dev/null and b/Plugins/Core/bin/me/chiss/Core/Weapon/WeaponFactory.class differ diff --git a/Plugins/Core/src/me/chiss/Core/Chat/Chat.java b/Plugins/Core/src/me/chiss/Core/Chat/Chat.java new file mode 100644 index 000000000..b8b185437 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Chat/Chat.java @@ -0,0 +1,127 @@ +package me.chiss.Core.Chat; + +import me.chiss.Core.Chat.command.SilenceCommand; +import me.chiss.Core.Plugin.IChat; +import mineplex.core.MiniPlugin; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class Chat extends MiniPlugin +{ + private CoreClientManager _clientManager; + private IChat _chat; + + private long _silenced = 0; + + public Chat(JavaPlugin plugin, CoreClientManager clientManager,IChat chat) + { + super("Chat", plugin); + + _clientManager = clientManager; + _chat = chat; + } + + @Override + public void AddCommands() + { + AddCommand(new SilenceCommand(this)); + } + + public void Silence(long duration, boolean inform) + { + //Set Silenced + if (duration > 0) + _silenced = System.currentTimeMillis() + duration; + else + _silenced = duration; + + if (!inform) + return; + + //Announce + if (duration == -1) + UtilServer.broadcast(F.main("Chat", "Chat has been silenced for " + F.time("Permanent") + ".")); + else if (duration == 0) + UtilServer.broadcast(F.main("Chat", "Chat is no longer silenced.")); + else + UtilServer.broadcast(F.main("Chat", "Chat has been silenced for " + F.time(UtilTime.MakeStr(duration, 1)) + ".")); + } + + @EventHandler + public void SilenceUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + SilenceEnd(); + } + + public void SilenceEnd() + { + if (_silenced <= 0) + return; + + if (System.currentTimeMillis() > _silenced) + Silence(0, true); + } + + public boolean SilenceCheck(Player player) + { + SilenceEnd(); + + if (_silenced == 0) + return false; + + if (_clientManager.Get(player).GetRank().Has(player, Rank.MODERATOR, false)) + return false; + + if (_silenced == -1) + UtilPlayer.message(player, F.main(GetName(), "Chat is silenced permanently.")); + else + UtilPlayer.message(player, F.main(GetName(), "Chat is silenced for " + F.time(UtilTime.MakeStr(_silenced - System.currentTimeMillis(), 1)) + ".")); + + return true; + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void HandleChat(AsyncPlayerChatEvent event) + { + if (event.isCancelled()) + return; + + Player sender = event.getPlayer(); + + if (SilenceCheck(sender)) + { + event.setCancelled(true); + return; + } + else if (!Recharge.Instance.use(sender, "Chat Message", 500, false)) + { + UtilPlayer.message(sender, F.main("Chat", "You are sending messages too fast.")); + event.setCancelled(true); + } + else + { + _chat.HandleChat(event, event.getMessage()); + } + } + + public long Silenced() + { + return _silenced; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Chat/command/SilenceCommand.java b/Plugins/Core/src/me/chiss/Core/Chat/command/SilenceCommand.java new file mode 100644 index 000000000..5b6501898 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Chat/command/SilenceCommand.java @@ -0,0 +1,50 @@ +package me.chiss.Core.Chat.command; + +import org.bukkit.entity.Player; + +import me.chiss.Core.Chat.Chat; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +public class SilenceCommand extends CommandBase +{ + public SilenceCommand(Chat plugin) + { + super(plugin, Rank.ADMIN, "silence"); + } + + @Override + public void Execute(Player caller, String[] args) + { + try + { + //Toggle + if (args.length == 0) + { + //Disable + if (Plugin.Silenced() != 0) + { + Plugin.Silence(0, true); + } + //Enable + else + { + Plugin.Silence(-1, true); + } + } + //Timer + else + { + long time = (long) (Double.valueOf(args[0]) * 3600000); + + Plugin.Silence(time, true); + } + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main("Chat", "Invalid Time Parameter.")); + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientAcc.java b/Plugins/Core/src/me/chiss/Core/ClientData/ClientAcc.java new file mode 100644 index 000000000..f0e208edd --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/ClientAcc.java @@ -0,0 +1,123 @@ +package me.chiss.Core.ClientData; + +import java.util.HashSet; + +import nautilus.minecraft.core.webserver.token.Account.AccountToken; + +import mineplex.core.account.CoreClient; +import mineplex.core.server.IRepository; + +public class ClientAcc extends ClientDataBase +{ + private long _playTime = 0; + + private long _loginLast = 0; + private int _loginCount = 0; + + private String _ip = "Unknown"; + private String _mac = "Unknown"; + + private HashSet _listIP = new HashSet(); + private HashSet _listMAC = new HashSet(); + + private HashSet _aliasIP = new HashSet(); + private HashSet _aliasMAC = new HashSet(); + + public ClientAcc(CoreClient client, IRepository repository) + { + super(client, "Account", repository); + } + + public ClientAcc(CoreClient client, IRepository repository, AccountToken token) + { + super(client, "Account", repository, token); + } + + @Override + public void Load() + { + + } + + @Override + public void LoadToken(AccountToken token) + { + _playTime = token.TotalPlayingTime; + _loginLast = token.LastLogin; + _loginCount = token.LoginCount; + + _listIP = new HashSet(); + _listMAC = new HashSet(); + + _aliasIP = new HashSet(); + _aliasMAC = new HashSet(); + + _listIP.addAll(token.IpAddresses); + _listMAC.addAll(token.MacAddresses); + _aliasIP.addAll(token.IpAliases); + _aliasMAC.addAll(token.MacAliases); + } + + public void SetIP(String ip) + { + _ip = ip; + } + + public String GetIP() + { + return _ip; + } + + public void SetMac(String mac) + { + _mac = mac; + } + + public String GetMac() + { + return _mac; + } + + public long GetPlayTime() + { + return _playTime; + } + + public long GetLoginLast() + { + if (_loginLast == 0) + _loginLast = System.currentTimeMillis(); + + return _loginLast; + } + + public void SetLoginLast(long loginLast) + { + _loginLast = loginLast; + } + + public int GetLoginCount() + { + return _loginCount; + } + + public HashSet GetListIP() + { + return _listIP; + } + + public HashSet GetListMAC() + { + return _listMAC; + } + + public HashSet GetAliasIP() + { + return _aliasIP; + } + + public HashSet GetAliasMAC() + { + return _aliasMAC; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientBan.java b/Plugins/Core/src/me/chiss/Core/ClientData/ClientBan.java new file mode 100644 index 000000000..a27b2cf96 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/ClientBan.java @@ -0,0 +1,62 @@ +package me.chiss.Core.ClientData; + +import mineplex.core.account.CoreClient; +import mineplex.core.server.IRepository; +import mineplex.minecraft.punish.Tokens.PunishToken; + +public class ClientBan extends ClientDataBase +{ + private PunishToken _activeBan; + + public ClientBan(CoreClient client, IRepository repository) + { + super(client, "Ban", repository); + //_bans = new LinkedList(); + } + + public ClientBan(CoreClient client, IRepository repository, PunishToken banToken) + { + super(client, "Ban", repository, banToken); + //_bans = new LinkedList(); + } + + @Override + public void Load() + { + + } + + @Override + public void LoadToken(PunishToken banToken) + { + _activeBan = banToken; + } + + public boolean IsBanned() + { + return _activeBan != null; + } + + public ClientBanEntry GetBan() + { + /* + for (ClientBanEntry cur : _bans) + if (cur.Active()) + return cur; + + */ + return null; + } + + public String Reason() + { + String reason = "Unknown"; + + if (_activeBan != null) + { + //reason = C.consoleBody + _activeBan.Reason + C.consoleFill + " - " + C.consoleBody + "Remaining : " + C.cGreen + UtilTime.convertString((long)(_activeBan.Hours * 3600000), 1, TimeUnit.FIT) + "."; + } + + return "Banned > " + reason; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientBanEntry.java b/Plugins/Core/src/me/chiss/Core/ClientData/ClientBanEntry.java new file mode 100644 index 000000000..01f0cd980 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/ClientBanEntry.java @@ -0,0 +1,103 @@ +package me.chiss.Core.ClientData; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; + +public class ClientBanEntry +{ + public ClientBan _ban; + public ClientBanEntry(ClientBan ban, String admin, Rank rank, String reason, + long banTime, long banDuration, boolean alias, String ip, String mac) + { + _ban = ban; + + _admin = admin; + _rank = rank; + _reason = reason; + _banTime = banTime; + _banDuration = banDuration; + _aliasBan = alias; + _ip = ip; + _mac = mac; + } + + private boolean _unbanned = false; + + private String _admin = ""; + private Rank _rank = Rank.ALL; + private String _reason = ""; + + private long _banTime = 0; + private long _banDuration = 0; + + private boolean _aliasBan = false; + private String _ip = ""; + private String _mac = ""; + + public boolean Active() + { + if (_unbanned) + return false; + + if (_banDuration == 0) + return true; + + return UtilTime.elapsed(_banTime, _banDuration); + } + + public boolean Alias() + { + return _aliasBan; + } + + public long Remaining() + { + return _banDuration - (System.currentTimeMillis() - _banTime); + } + + public String GetAdmin() { + return _admin; + } + + public String GetReason() { + return _reason; + } + + public long GetBanTime() { + return _banTime; + } + + public long GetBanDuration() { + return _banDuration; + } + + public boolean IsAliasBan() { + return _aliasBan; + } + + public String GetIP() { + return _ip; + } + + public String GetMac() { + return _mac; + } + + public Rank GetRank() { + return _rank; + } + + public boolean GetUnbanned() { + return _unbanned; + } + + public void SetUnbanned(boolean _unbanned) { + this._unbanned = _unbanned; + } + + public String RemainingString() + { + return UtilTime.convertString(Remaining(), 1, TimeUnit.FIT) + " Remaining"; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientClan.java b/Plugins/Core/src/me/chiss/Core/ClientData/ClientClan.java new file mode 100644 index 000000000..b72e828f2 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/ClientClan.java @@ -0,0 +1,186 @@ +package me.chiss.Core.ClientData; + +import java.util.HashMap; + +import nautilus.minecraft.core.webserver.token.Account.ClientClanToken; + +import me.chiss.Core.Clans.ClansUtility.ClanRelation; +import mineplex.core.account.CoreClient; +import mineplex.core.server.IRepository; + +public class ClientClan extends ClientDataBase +{ + //Data + private String _clanName = ""; + private String _inviter = ""; + private long _delay = 0; + + //Temp - Territory + private boolean _safe = false; + private boolean _mapOn = false; + private String _territory = ""; + private String _owner = ""; + private boolean _clanChat = false; + private boolean _allyChat = false; + + //Colors + private HashMap _relations = new HashMap(); + + + //Admin + private String mimic = ""; + private boolean autoClaim = false; + + public ClientClan(CoreClient client, IRepository repository) + { + super(client, "Clan", repository); + } + + @Override + public void Load() + { + //Load Clients + } + + @Override + public void LoadToken(ClientClanToken token) + { + if (token != null) + { + _clanName = token.Name; + } + } + + public void Update(String clanName, String inviter, long delay) + { + _clanName = clanName; + _inviter = inviter; + _delay = delay; + } + + public boolean CanJoin() + { + if (System.currentTimeMillis() > _delay) + return true; + + return false; + } + + public boolean InClan() + { + return (!_clanName.equals("")); + } + + public void Reset() + { + _clanName = ""; + _inviter = ""; + } + + public String GetClanName() { + return _clanName; + } + + public void SetClan(String _clanName) { + this._clanName = _clanName; + } + + public String GetInviter() { + return _inviter; + } + + public void SetInviter(String _inviter) { + this._inviter = _inviter; + } + + public long GetDelay() { + return _delay; + } + + public void SetDelay(long _delay) { + this._delay = _delay; + } + + public boolean IsSafe() { + return _safe; + } + + public void SetSafe(boolean _safe) { + this._safe = _safe; + } + + public boolean IsMapOn() { + return _mapOn; + } + + public void SetMapOn(boolean _mapOn) { + this._mapOn = _mapOn; + } + + public String GetTerritory() { + return _territory; + } + + public void SetTerritory(String _territory) { + this._territory = _territory; + } + + public String GetOwner() { + return _owner; + } + + public void SetOwner(String _owner) { + this._owner = _owner; + } + + public boolean IsClanChat() { + return _clanChat; + } + + public void SetClanChat(boolean enabled) + { + this._clanChat = enabled; + + if (enabled) + _allyChat = false; + } + + public boolean IsAllyChat() { + return _allyChat; + } + + public void SetAllyChat(boolean enabled) + { + this._allyChat = enabled; + + if (enabled) + _clanChat = false; + } + + public String GetMimic() { + return mimic; + } + + public void SetMimic(String mimic) { + this.mimic = mimic; + } + + public boolean IsAutoClaim() + { + return autoClaim; + } + + public void SetAutoClaim(boolean claim) { + this.autoClaim = claim; + } + + public void SetRelationship(String player, ClanRelation relation) + { + _relations.put(player, relation); + } + + public ClanRelation GetRelation(String player) + { + return _relations.get(player); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientClass.java b/Plugins/Core/src/me/chiss/Core/ClientData/ClientClass.java new file mode 100644 index 000000000..883e44701 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/ClientClass.java @@ -0,0 +1,483 @@ +package me.chiss.Core.ClientData; + +import java.util.AbstractMap; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map.Entry; + + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; + +import me.chiss.Core.Class.IPvpClass; +import me.chiss.Core.Skill.ISkill; +import me.chiss.Core.Skill.ISkill.SkillType; +import mineplex.core.account.CoreClient; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.minecraft.game.core.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.classcombat.Class.repository.token.CustomBuildToken; + +public class ClientClass extends ClientDataBase implements IClientClass +{ + //Class and Skills + private IPvpClass _gameClass; + private HashMap> _skillMap; + + //Temp + private IPvpClass _lastClass; + private ItemStack[] _lastArmor; + private HashMap _lastItems; + private HashMap> _lastSkillMap; + + public ClientClass(CoreClient client) + { + super(client, "Class", null); + + _lastItems = new HashMap(); + _lastArmor = new ItemStack[4]; + _lastSkillMap = new HashMap>(); + } + + @Override + public void Load() + { + + } + + @Override + protected void LoadToken(Object token) + { + // TODO Auto-generated method stub + + } + + @Override + public String GetName() + { + return Client.GetPlayerName(); + } + + @Override + public void ResetToDefaults(boolean equipItems, boolean equipDefaultArmor) + { + if (equipDefaultArmor) + { + if (_lastArmor[3] != null) + GetInventory().setHelmet(_lastArmor[3].clone()); + + if (_lastArmor[2] != null) + GetInventory().setChestplate(_lastArmor[2].clone()); + + if (_lastArmor[1] != null) + GetInventory().setLeggings(_lastArmor[1].clone()); + + if (_lastArmor[0] != null) + GetInventory().setBoots(_lastArmor[0].clone()); + } + + if (equipItems) + { + for (Entry defaultItem : _lastItems.entrySet()) + { + GetInventory().setItem(defaultItem.getKey(), (defaultItem.getValue() == null ? new ItemStack(Material.AIR) : defaultItem.getValue().clone())); + } + } + + SetGameClass(_lastClass, false); + + NewSkills(); + for (Entry> entry : _lastSkillMap.entrySet()) + AddSkill(entry.getValue().getKey(), entry.getValue().getValue()); + } + + @Override + public void SetGameClass(IPvpClass gameClass) + { + SetGameClass(gameClass, true); + } + + @Override + public void SetGameClass(IPvpClass gameClass, boolean addDefaultSkills) + { + ClearSkills(); + + _gameClass = gameClass; + + if (_gameClass == null) + return; + + //Load Saved + if (Client.Manager.Classes().GetRestore().IsActive()) + { + Collection> skills = Client.Manager.Classes().GetRestore().GetBuild(Client.GetPlayerName(), gameClass); + + if (skills != null) + { + for (Entry skill : skills) + AddSkill(skill.getKey(), skill.getValue()); + + //Inform + UtilPlayer.message(Client.GetPlayer(), F.main("Class", "Armor Class: " + F.oo(_gameClass.GetName(), true))); + return; + } + } + + _lastClass = gameClass; + + for (ISkill cur : gameClass.GetDefaultSkills().keySet()) + { + if (addDefaultSkills || cur.GetSkillType() == SkillType.Class) + AddSkill(cur, gameClass.GetDefaultSkills().get(cur)); + } + + //Inform + UtilPlayer.message(Client.GetPlayer(), F.main("Class", "Armor Class: " + F.oo(_gameClass.GetName(), true))); + } + + @Override + public IPvpClass GetGameClass() + { + return _gameClass; + } + + @Override + public void ClearDefaults() + { + _lastItems.clear(); + _lastArmor = new ItemStack[4]; + _lastSkillMap.clear(); + } + + public String GetGameClassTag() + { + IPvpClass gameClass = GetGameClass(); + if (gameClass == null) return ""; + return gameClass.GetName().charAt(0)+"."; + } + + public void NewSkills() + { + ClearSkills(); + _skillMap = new HashMap>(); + } + + public void ClearSkills() + { + if (_skillMap != null) + for (Entry entry : _skillMap.values()) + entry.getKey().RemoveUser(Client.GetPlayer()); + + _skillMap = null; + } + + public void AddSkill(String skillName, int level) + { + ISkill skill = Client.Manager.Skills().GetSkill(skillName); + if (skill == null) + return; + + AddSkill(skill, level); + } + + @Override + public void AddSkill(ISkill skill, int level) + { + if (level <= 0) + return; + + if (_skillMap == null) + _skillMap = new HashMap>(); + + if (_skillMap.get(skill.GetSkillType()) != null) + _skillMap.get(skill.GetSkillType()).getKey().RemoveUser(Client.GetPlayer()); + + _skillMap.put(skill.GetSkillType(), new AbstractMap.SimpleEntry(skill, level)); + _lastSkillMap.put(skill.GetSkillType(), new AbstractMap.SimpleEntry(skill, level)); + + skill.AddUser(Client.GetPlayer(), level); + + //Save + if (Client.Manager.Classes().GetRestore().IsActive()) + Client.Manager.Classes().GetRestore().SaveBuild(Client.GetPlayerName(), _gameClass, GetSkills()); + } + + @Override + public void RemoveSkill(ISkill skill) + { + if (skill == null) + return; + + if (_skillMap == null) + return; + + _skillMap.remove(skill.GetSkillType()); + _lastSkillMap.remove(skill.GetSkillType()); + + skill.RemoveUser(Client.GetPlayer()); + } + + @Override + public Collection> GetSkills() + { + if (_skillMap == null) + _skillMap = new HashMap>(); + + return _skillMap.values(); + } + + @Override + public Collection> GetDefaultSkills() + { + return _lastSkillMap.values(); + } + + @Override + public void ResetSkills() + { + for (Entry entry : GetSkills()) + { + entry.getKey().Reset(Client.GetPlayer()); + } + } + + public void ClearDefaultSkills() + { + _lastSkillMap = new HashMap>(); + } + + public boolean IsGameClass(ClassType type) + { + if (GetGameClass() == null) + return false; + + return GetGameClass().GetType() == type; + } + + public ISkill GetSkillByType(SkillType skillType) + { + if (_skillMap == null) + _skillMap = new HashMap>(); + + if (_skillMap.containsKey(skillType)) + return _skillMap.get(skillType).getKey(); + + return null; + } + + public int GetSkillLevel(ISkill skill) + { + //No Class + if (_skillMap == null) + return 0; + + if (_skillMap.containsKey(skill.GetSkillType()) && _skillMap.get(skill.GetSkillType()).getKey() == skill) + return _skillMap.get(skill.GetSkillType()).getValue(); + + return 0; + } + + public void SetSkillLevel(ISkill skill, int level) + { + _skillMap.put(skill.GetSkillType(), new AbstractMap.SimpleEntry(skill, level)); + } + + @Override + public PlayerInventory GetInventory() + { + if (Client.GetPlayer() == null) + return null; + + return Client.GetPlayer().getInventory(); + } + + @Override + public void OpenInventory(Inventory skillsCategory) + { + if (Client.GetPlayer() == null) + return; + + Client.GetPlayer().openInventory(skillsCategory); + } + + @Override + public void CloseInventory() + { + if (Client.GetPlayer() == null) + return; + + Client.GetPlayer().closeInventory(); + } + + @SuppressWarnings("deprecation") + @Override + public void UpdateInventory() + { + if (Client.GetPlayer() == null) + return; + + Client.GetPlayer().updateInventory(); + } + + public void ListSkills(Player caller) + { + UtilPlayer.message(caller, F.main("Skill", "Listing Class Skills;")); + + for (SkillType type : SkillType.values()) + if (caller.isOp() || type != SkillType.Class) + if (_skillMap.containsKey(type)) + UtilPlayer.message(caller, F.desc(type.toString(), _skillMap.get(type).getKey().GetName() + " " + F.elem(_skillMap.get(type).getValue() + "/" + _skillMap.get(type).getKey().GetMaxLevel()))); + } + + @Override + public void AddDefaultArmor(ItemStack[] armorContents) + { + _lastArmor = armorContents; + } + + @Override + public void PutDefaultItem(ItemStack deliverable, int slot) + { + _lastItems.put(slot, deliverable); + } + + @Override + public ItemStack[] GetDefaultArmor() + { + if (_lastArmor[0] == null || _lastArmor[1] == null || _lastArmor[2] == null || _lastArmor[3] == null) + return new ItemStack[4]; + + ItemStack[] armorReturn = new ItemStack[4]; + + armorReturn[3] = _lastArmor[3].clone(); + armorReturn[2] = _lastArmor[2].clone(); + armorReturn[1] = _lastArmor[1].clone(); + armorReturn[0] = _lastArmor[0].clone(); + + return armorReturn; + } + + @Override + public HashMap GetDefaultItems() + { + return _lastItems; + } + + @Override + public void SetDefaultHead(ItemStack armor) + { + _lastArmor[3] = armor; + } + + @Override + public void SetDefaultChest(ItemStack armor) + { + _lastArmor[2] = armor; + } + + @Override + public void SetDefaultLegs(ItemStack armor) + { + _lastArmor[1] = armor; + } + + @Override + public void SetDefaultFeet(ItemStack armor) + { + _lastArmor[0] = armor; + } + + public void EquipCustomBuild(CustomBuildToken customBuild) + { + EquipCustomBuild(customBuild, true, true); + } + + public void EquipCustomBuild(CustomBuildToken customBuild, boolean equipItems, boolean equipDefaultArmor) + { + _lastClass = Client.Manager.Classes().GetClass(customBuild.PvpClassId); + + if (_lastClass == null) + return; + + _lastSkillMap.remove(SkillType.Class); + + if (equipDefaultArmor) + { + SetDefaultHead(ItemStackFactory.Instance.CreateStack(_lastClass.GetHead())); + SetDefaultChest(ItemStackFactory.Instance.CreateStack(_lastClass.GetChestplate())); + SetDefaultLegs(ItemStackFactory.Instance.CreateStack(_lastClass.GetLeggings())); + SetDefaultFeet(ItemStackFactory.Instance.CreateStack(_lastClass.GetBoots())); + } + + if (equipItems) + { + for (int i=0; i < 9; i++) + { + if (customBuild.Slots == null || customBuild.Slots.size() <= i || customBuild.Slots.get(i).Material == "AIR" || customBuild.Slots.get(i).Material == "NULL") + _lastItems.put(i, null); + else + { + /* + if (ItemFactory.Instance.GetItem(customBuild.Slots.get(i).Material) != null) + _lastItems.put(i, ItemFactory.Instance.GetItem(customBuild.Slots.get(i).Material).); + */ + _lastItems.put(i, ItemStackFactory.Instance.CreateStack(Material.getMaterial(customBuild.Slots.get(i).Material), customBuild.Slots.get(i).Amount)); + } + } + } + + if (customBuild.SwordSkillId != -1) + _lastSkillMap.put(SkillType.Sword, Client.Manager.Skills().GetSkillBySalesPackageId(customBuild.SwordSkillId)); + else + _lastSkillMap.remove(SkillType.Sword); + + if (customBuild.AxeSkillId != -1) + _lastSkillMap.put(SkillType.Axe, Client.Manager.Skills().GetSkillBySalesPackageId(customBuild.AxeSkillId)); + else + _lastSkillMap.remove(SkillType.Axe); + + if (customBuild.BowSkillId != -1) + _lastSkillMap.put(SkillType.Bow, Client.Manager.Skills().GetSkillBySalesPackageId(customBuild.BowSkillId)); + else + _lastSkillMap.remove(SkillType.Bow); + + if (customBuild.ClassPassiveASkillId != -1) + _lastSkillMap.put(SkillType.PassiveA, Client.Manager.Skills().GetSkillBySalesPackageId(customBuild.ClassPassiveASkillId)); + else + _lastSkillMap.remove(SkillType.PassiveA); + + if (customBuild.ClassPassiveBSkillId != -1) + _lastSkillMap.put(SkillType.PassiveB, Client.Manager.Skills().GetSkillBySalesPackageId(customBuild.ClassPassiveBSkillId)); + else + _lastSkillMap.remove(SkillType.PassiveB); + + if (customBuild.GlobalPassiveASkillId != -1) + _lastSkillMap.put(SkillType.PassiveC, Client.Manager.Skills().GetSkillBySalesPackageId(customBuild.GlobalPassiveASkillId)); + else + _lastSkillMap.remove(SkillType.PassiveC); + + if (customBuild.GlobalPassiveBSkillId != -1) + _lastSkillMap.put(SkillType.PassiveD, Client.Manager.Skills().GetSkillBySalesPackageId(customBuild.GlobalPassiveBSkillId)); + else + _lastSkillMap.remove(SkillType.PassiveD); + + if (customBuild.GlobalPassiveCSkillId != -1) + _lastSkillMap.put(SkillType.PassiveE, Client.Manager.Skills().GetSkillBySalesPackageId(customBuild.GlobalPassiveCSkillId)); + else + _lastSkillMap.remove(SkillType.PassiveE); + + ResetToDefaults(equipItems, equipDefaultArmor); + + Client.Donor().SetTokens(customBuild.SkillTokensBalance, customBuild.ItemTokensBalance); + + ListSkills(Client.GetPlayer()); + Client.GetPlayer().getWorld().playSound(Client.GetPlayer().getLocation(), Sound.LEVEL_UP, 1f, 1f); + + Client.GetPlayer().sendMessage(F.main("Class", "You equipped " + F.skill(customBuild.Name) + ".")); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientCondition.java b/Plugins/Core/src/me/chiss/Core/ClientData/ClientCondition.java new file mode 100644 index 000000000..e22069fc9 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/ClientCondition.java @@ -0,0 +1,44 @@ +package me.chiss.Core.ClientData; + +import java.util.HashMap; + + +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.account.CoreClient; +import mineplex.core.server.IRepository; + +public class ClientCondition extends ClientDataBase +{ + private HashMap _conditions; + + public ClientCondition(CoreClient client, IRepository repository) + { + super(client, "Condition", repository); + } + + public ClientCondition(CoreClient client, IRepository repository, String token) + { + super(client, "Condition", repository, token); + } + + @Override + public void Load() + { + + } + + @Override + public void LoadToken(String token) + { + + } + + public HashMap get_conditions() { + return _conditions; + } + + public void set_conditions(HashMap _conditions) { + this._conditions = _conditions; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientConditionEntry.java b/Plugins/Core/src/me/chiss/Core/ClientData/ClientConditionEntry.java new file mode 100644 index 000000000..e166a62a5 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/ClientConditionEntry.java @@ -0,0 +1,5 @@ +package me.chiss.Core.ClientData; + +public class ClientConditionEntry { + +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientDataBase.java b/Plugins/Core/src/me/chiss/Core/ClientData/ClientDataBase.java new file mode 100644 index 000000000..e9dfd5bda --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/ClientDataBase.java @@ -0,0 +1,42 @@ +package me.chiss.Core.ClientData; + +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.server.IRepository; + +public abstract class ClientDataBase implements IClientDataLoad +{ + protected CoreClient Client; + protected String DataName; + protected IRepository Repository; + + public ClientDataBase(CoreClient client, String dataName, IRepository repository) + { + Client = client; + DataName = dataName; + Repository = repository; + + Load(); + } + + public ClientDataBase(CoreClient client, String dataName, IRepository repository, TokenType token) + { + Client = client; + DataName = dataName; + Repository = repository; + + LoadToken(token); + } + + public String GetDataName() + { + return DataName; + } + + protected abstract void LoadToken(TokenType token); + + public CoreClientManager Manager() + { + return Client.Manager(); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientDonor.java b/Plugins/Core/src/me/chiss/Core/ClientData/ClientDonor.java new file mode 100644 index 000000000..844c89402 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/ClientDonor.java @@ -0,0 +1,443 @@ +package me.chiss.Core.ClientData; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; + +import nautilus.minecraft.core.webserver.token.Account.DonorToken; + +import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; + +import me.chiss.Core.Class.IPvpClass; +import mineplex.core.CurrencyType; +import mineplex.core.Rank; +import mineplex.core.server.IRepository; +import mineplex.core.common.util.C; +import mineplex.core.common.util.NautHashMap; +import mineplex.minecraft.account.CoreClient; +import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; +import mineplex.minecraft.game.classcombat.Class.repository.token.SlotToken; +import me.chiss.Core.Pet.repository.token.PetToken; +import me.chiss.Core.Skill.ISkill; +import me.chiss.Core.Skill.ISkill.SkillType; + +public class ClientDonor +{ + private DonationRepository + private int _blueGems; + private int _greenGems; + private boolean _donated; + private List _salesPackagesOwned; + + public ClientDonor(CoreClient client, IRepository repository) + { + super(client, "Donor", repository); + } + + public ClientDonor(CoreClient client, IRepository repository, DonorToken token) + { + super(client, "Donor", repository, token); + } + + @Override + public void Load() + { + + } + + @Override + public void LoadToken(DonorToken token) + { + int creditChange = token.BlueGems - _blueGems; + int pointChange = token.GreenGems - _greenGems; + _blueGems = token.BlueGems; + _greenGems = token.GreenGems; + _donated = token.Donated; + + _salesPackagesOwned = token.SalesPackages; + + + + _customBuilds = new NautHashMap>(); + _activeCustomBuilds = new NautHashMap(); + + if (Client.Manager().Classes() != null && Client.Manager.Skills() != null) + { + for (IPvpClass pvpClass : Client.Manager().Classes().GetAllClasses()) + { + _customBuilds.put(pvpClass, new HashMap()); + } + + for (CustomBuildToken buildToken : token.CustomBuilds) + { + IPvpClass pvpClass = Client.Manager().Classes().GetClass(buildToken.PvpClassId); + + int skillTokenCount = buildToken.SkillTokensBalance; + + Entry swordSkill = Client.Manager.Skills().GetSkillBySalesPackageId(buildToken.SwordSkillId); + Entry axeSkill = Client.Manager.Skills().GetSkillBySalesPackageId(buildToken.AxeSkillId); + Entry bowSkill = Client.Manager.Skills().GetSkillBySalesPackageId(buildToken.BowSkillId); + Entry classPassiveASkill = Client.Manager.Skills().GetSkillBySalesPackageId(buildToken.ClassPassiveASkillId); + Entry classPassiveBSkill = Client.Manager.Skills().GetSkillBySalesPackageId(buildToken.ClassPassiveBSkillId); + Entry globalPassiveA = Client.Manager.Skills().GetSkillBySalesPackageId(buildToken.GlobalPassiveASkillId); + Entry globalPassiveB = Client.Manager.Skills().GetSkillBySalesPackageId(buildToken.GlobalPassiveBSkillId); + Entry globalPassiveC = Client.Manager.Skills().GetSkillBySalesPackageId(buildToken.GlobalPassiveCSkillId); + + if (buildToken.SwordSkillId != -1 && (swordSkill == null || swordSkill.getKey().GetSkillType() != SkillType.Sword + || (!swordSkill.getKey().IsFree(swordSkill.getValue()) && !Owns(buildToken.SwordSkillId) && !Client.Rank().Has(Rank.DIAMOND, false)))) + continue; + if (buildToken.AxeSkillId != -1 && (axeSkill == null || axeSkill.getKey().GetSkillType() != SkillType.Axe + || (!axeSkill.getKey().IsFree(axeSkill.getValue()) && !Owns(buildToken.AxeSkillId) && !Client.Rank().Has(Rank.DIAMOND, false)))) + continue; + if (buildToken.BowSkillId != -1 && (bowSkill == null || bowSkill.getKey().GetSkillType() != SkillType.Bow + || (!bowSkill.getKey().IsFree(bowSkill.getValue()) && !Owns(buildToken.BowSkillId) && !Client.Rank().Has(Rank.DIAMOND, false)))) + continue; + if (buildToken.ClassPassiveASkillId != -1 && (classPassiveASkill == null || classPassiveASkill.getKey().GetSkillType() != SkillType.PassiveA + || (!classPassiveASkill.getKey().IsFree(classPassiveASkill.getValue()) && !Owns(buildToken.ClassPassiveASkillId) && !Client.Rank().Has(Rank.DIAMOND, false)))) + continue; + if (buildToken.ClassPassiveBSkillId != -1 && (classPassiveBSkill == null || classPassiveBSkill.getKey().GetSkillType() != SkillType.PassiveB + || (!classPassiveBSkill.getKey().IsFree(classPassiveBSkill.getValue()) && !Owns(buildToken.ClassPassiveBSkillId) && !Client.Rank().Has(Rank.DIAMOND, false)))) + continue; + if (buildToken.GlobalPassiveASkillId != -1 && (globalPassiveA == null || globalPassiveA.getKey().GetSkillType() != SkillType.PassiveC + || (!globalPassiveA.getKey().IsFree(globalPassiveA.getValue()) && !Owns(buildToken.GlobalPassiveASkillId) && !Client.Rank().Has(Rank.DIAMOND, false)))) + continue; + if (buildToken.GlobalPassiveBSkillId != -1 && (globalPassiveB == null || globalPassiveB.getKey().GetSkillType() != SkillType.PassiveD + || (!globalPassiveB.getKey().IsFree(globalPassiveB.getValue()) && !Owns(buildToken.GlobalPassiveBSkillId) && !Client.Rank().Has(Rank.DIAMOND, false)))) + continue; + if (buildToken.GlobalPassiveCSkillId != -1 && (globalPassiveC == null || globalPassiveC.getKey().GetSkillType() != SkillType.PassiveE + || (!globalPassiveC.getKey().IsFree(globalPassiveC.getValue()) && !Owns(buildToken.GlobalPassiveCSkillId) && !Client.Rank().Has(Rank.DIAMOND, false)))) + continue; + + if (buildToken.SwordSkillId != -1) + skillTokenCount += swordSkill.getKey().GetTokenCost() * swordSkill.getValue(); + + if (buildToken.AxeSkillId != -1) + skillTokenCount += axeSkill.getKey().GetTokenCost() * axeSkill.getValue(); + + if (buildToken.BowSkillId != -1) + skillTokenCount += bowSkill.getKey().GetTokenCost() * bowSkill.getValue(); + + if (buildToken.ClassPassiveASkillId != -1) + skillTokenCount += classPassiveASkill.getKey().GetTokenCost() * classPassiveASkill.getValue(); + + if (buildToken.ClassPassiveBSkillId != -1) + skillTokenCount += classPassiveBSkill.getKey().GetTokenCost() * classPassiveBSkill.getValue(); + + if (buildToken.GlobalPassiveASkillId != -1) + skillTokenCount += globalPassiveA.getKey().GetTokenCost() * globalPassiveA.getValue(); + + if (buildToken.GlobalPassiveBSkillId != -1) + skillTokenCount += globalPassiveB.getKey().GetTokenCost() * globalPassiveB.getValue(); + + if (buildToken.GlobalPassiveCSkillId != -1) + skillTokenCount += globalPassiveC.getKey().GetTokenCost() * globalPassiveC.getValue(); + + if (skillTokenCount <= 120) + { + _customBuilds.get(pvpClass).put(buildToken.CustomBuildNumber, buildToken); + + if (buildToken.Active) + { + _activeCustomBuilds.put(pvpClass, buildToken); + } + } + } + } + + if (Client.GetPlayer() != null) + { + if (creditChange > 0) + { + Client.GetPlayer().sendMessage(C.cGray + "You've received " + C.cAqua + pointChange + C.cGray + " credits. Thanks for donating!"); + } + else if (creditChange < 0) + { + Client.GetPlayer().sendMessage(C.cGray + "Your credit balance is now : " + C.cAqua + pointChange + C.cGray + "."); + } + + if (pointChange > 0) + { + Client.GetPlayer().sendMessage(C.cGray + "You've received " + C.cGreen + pointChange + C.cGray + " points. Thanks for playing!"); + } + else if (pointChange < 0) + { + Client.GetPlayer().sendMessage(C.cGray + "Your point balance is now : " + C.cGreen + pointChange + C.cGray + "."); + } + } + } + + public int GetBlueGems() + { + return _blueGems; + } + + public int GetGreenGems() + { + return _greenGems; + } + + public void AddPoints(int points) + { + _greenGems += points; + } + + public List GetSalesPackagesOwned() + { + return _salesPackagesOwned; + } + + public HashMap GetCustomBuilds(IPvpClass pvpClass) + { + return _customBuilds.get(pvpClass); + } + + public void PurchaseItem(int cost) + { + _itemTokens -= cost; + } + + public void PurchaseSkill(int cost) + { + _skillTokens -= cost; + } + + public void ReturnSkill(int cost) + { + _skillTokens += cost; + } + + public void ReturnItem(int cost) + { + _itemTokens += cost; + } + + public void SetCredits(int credits) + { + _blueGems = credits; + } + + public void DeductCost(int cost, CurrencyType currencyType, boolean premium) + { + switch (currencyType) + { + case Coins: + Client.Game().SetEconomyBalance(Client.Game().GetEconomyBalance() - cost); + break; + case Gems: + if (premium) + _blueGems -= cost; + else + _greenGems -= cost; + break; + default: + break; + } + } + + public boolean Owns(Integer salesPackageId) + { + return salesPackageId == -1 || _salesPackagesOwned.contains(salesPackageId); + } + + public void SetTokens(int skillTokens, int itemTokens) + { + _skillTokens = skillTokens; + _itemTokens = itemTokens; + } + + public void SetDefaultTokens(int skillTokens, int itemTokens) + { + _defaultSkillTokens = skillTokens; + _defaultItemTokens = itemTokens; + } + + public int GetSkillTokens() + { + return _skillTokens; + } + + public int GetItemTokens() + { + return _itemTokens; + } + + public void ResetItemTokens() + { + _itemTokens = _defaultItemTokens; + } + + public void ResetSkillTokens() + { + _skillTokens = _defaultSkillTokens; + } + + public void AddSalesPackagesOwned(int salesPackageId) + { + _salesPackagesOwned.add(salesPackageId); + } + + public void SetItemTokens(int itemTokens) + { + _itemTokens = itemTokens; + } + + public void SetSkillTokens(int skillTokens) + { + _skillTokens = skillTokens; + } + + public void SetPoints(int points) + { + _greenGems = points; + } + + public boolean HasDonated() + { + return _donated; + } + + public void SaveActiveCustomBuild(boolean saveItems) + { + if (Client == null || Client.Class().GetGameClass() == null) + return; + + _savingCustomBuild.PvpClassId = Client.Class().GetGameClass().GetSalesPackageId(); + _savingCustomBuild.PlayerName = Client.GetPlayerName(); + _savingCustomBuild.SkillTokensBalance = _skillTokens; + _savingCustomBuild.ItemTokensBalance = _itemTokens; + + ISkill swordSkill = Client.Class().GetSkillByType(SkillType.Sword); + + if (swordSkill != null) + _savingCustomBuild.SwordSkillId = swordSkill.GetSalesPackageId(Client.Class().GetSkillLevel(swordSkill)); + else + _savingCustomBuild.SwordSkillId = -1; + + ISkill axeSkill = Client.Class().GetSkillByType(SkillType.Axe); + + if (axeSkill != null) + _savingCustomBuild.AxeSkillId = axeSkill.GetSalesPackageId(Client.Class().GetSkillLevel(axeSkill)); + else + _savingCustomBuild.AxeSkillId = -1; + + ISkill bowSkill = Client.Class().GetSkillByType(SkillType.Bow); + + if (bowSkill != null) + _savingCustomBuild.BowSkillId = bowSkill.GetSalesPackageId(Client.Class().GetSkillLevel(bowSkill)); + else + _savingCustomBuild.BowSkillId = -1; + + ISkill passiveASkill = Client.Class().GetSkillByType(SkillType.PassiveA); + + if (passiveASkill != null) + _savingCustomBuild.ClassPassiveASkillId = passiveASkill.GetSalesPackageId(Client.Class().GetSkillLevel(passiveASkill)); + else + _savingCustomBuild.ClassPassiveASkillId = -1; + + ISkill passiveBSkill = Client.Class().GetSkillByType(SkillType.PassiveB); + + if (passiveBSkill != null) + _savingCustomBuild.ClassPassiveBSkillId = passiveBSkill.GetSalesPackageId(Client.Class().GetSkillLevel(passiveBSkill)); + else + _savingCustomBuild.ClassPassiveBSkillId = -1; + + ISkill passiveCSkill = Client.Class().GetSkillByType(SkillType.PassiveC); + + if (passiveCSkill != null) + _savingCustomBuild.GlobalPassiveASkillId = passiveCSkill.GetSalesPackageId(Client.Class().GetSkillLevel(passiveCSkill)); + else + _savingCustomBuild.GlobalPassiveASkillId = -1; + + ISkill passiveDSkill = Client.Class().GetSkillByType(SkillType.PassiveD); + + if (passiveDSkill != null) + _savingCustomBuild.GlobalPassiveBSkillId = passiveDSkill.GetSalesPackageId(Client.Class().GetSkillLevel(passiveDSkill)); + else + _savingCustomBuild.GlobalPassiveBSkillId = -1; + + ISkill passiveESkill = Client.Class().GetSkillByType(SkillType.PassiveE); + + if (passiveESkill != null) + _savingCustomBuild.GlobalPassiveCSkillId = passiveESkill.GetSalesPackageId(Client.Class().GetSkillLevel(passiveESkill)); + else + _savingCustomBuild.GlobalPassiveCSkillId = -1; + + _savingCustomBuild.Slots = new ArrayList(9); + + if (saveItems) + { + for (int i=0; i < 9; i++) + { + SlotToken slotToken = new SlotToken(); + ItemStack itemStack = Client.Class().GetInventory().getItem(i); + slotToken.Material = itemStack == null ? org.bukkit.Material.AIR.toString() : itemStack.getType().toString(); + slotToken.Amount = itemStack == null ? 1 : itemStack.getAmount(); + + _savingCustomBuild.Slots.add(slotToken); + } + } + + Repository.SaveCustomBuild(_savingCustomBuild); + _savingCustomBuild = null; + } + + public void SetSavingCustomBuild(int i, IPvpClass pvpClass, CustomBuildToken customBuild) + { + _savingCustomBuild = customBuild; + _savingCustomBuild.CustomBuildNumber = i; + _customBuilds.get(pvpClass).put(i, _savingCustomBuild); + } + + public void SetActiveCustomBuild(int i, IPvpClass pvpClass, CustomBuildToken customBuild) + { + customBuild.Active = true; + _activeCustomBuilds.put(pvpClass, customBuild); + } + + public CustomBuildToken GetActiveCustomBuild(IPvpClass pvpClass) + { + return _activeCustomBuilds.get(pvpClass); + } + + public CustomBuildToken GetSavingCustomBuild() + { + return _savingCustomBuild; + } + + public boolean IsSavingCustomBuild() + { + return _savingCustomBuild != null; + } + + public NautHashMap GetPets() + { + return _pets; + } + + public Integer GetPetNameTagCount() + { + return _petNameTagCount; + } + + public void SetPetNameTagCount(int count) + { + _petNameTagCount = count; + } + + public int GetBalance(CurrencyType currencyType, boolean premium) + { + switch (currencyType) + { + case Coins: + return Client.Game().GetEconomyBalance(); + case Gems: + return premium ? _blueGems : (_greenGems + _blueGems); + case Tokens: + return 0; + default: + return 0; + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientGame.java b/Plugins/Core/src/me/chiss/Core/ClientData/ClientGame.java new file mode 100644 index 000000000..d1b4b935b --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/ClientGame.java @@ -0,0 +1,282 @@ +package me.chiss.Core.ClientData; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.HashMap; + +import mineplex.core.account.CoreClient; + +public class ClientGame extends ClientDataBase +{ + private String _lastTo = null; + private String _lastAdminTo = null; + private String _lastSentMessage = ""; + private String _lastReceivedMessage = ""; + + private String _lastChat = ""; + private boolean _unfilteredChat; + + private boolean _cloaked = false; + private long _cloakEnd = 0; + + private HashMap _recharge = new HashMap(); + + private double _energy = 0; + + private int _economyBalance; + + private long _lastPPH = 0; + + public ClientGame(CoreClient client) + { + super(client, "Game", null); + } + + @Override + public void Load() + { + _economyBalance = 0; + LoadEconomyBalance(); + } + + @Override + public void LoadToken(Object token) + { + + } + + public String GetLastTo() { + return _lastTo; + } + + public void SetLastTo(String _lastTo) { + this._lastTo = _lastTo; + } + + public String GetLastAdminTo() { + return _lastAdminTo; + } + + public void SetLastAdminTo(String _lastAdminTo) { + this._lastAdminTo = _lastAdminTo; + } + + public String GetLastSentMessage() { + return _lastSentMessage; + } + + public void SetLastSentMessage(String _lastSentMessage) { + this._lastSentMessage = _lastSentMessage; + } + + public String GetLastReceivedMessage() { + return _lastReceivedMessage; + } + + public void SetLastReceivedMessage(String _lastReceivedMessage) { + this._lastReceivedMessage = _lastReceivedMessage; + } + + public boolean IsCloaked() { + return _cloaked; + } + + public void SetCloaked(boolean _cloaked) { + this._cloaked = _cloaked; + } + + public long GetCloakEnd() { + return _cloakEnd; + } + + public void SetCloakEnd(long _cloakEnd) { + this._cloakEnd = _cloakEnd; + } + + public HashMap GetRecharge() { + return _recharge; + } + + public void SetRecharge(HashMap _recharge) { + this._recharge = _recharge; + } + + public double GetEnergy() { + return _energy; + } + + public void SetEnergy(double _energy) { + this._energy = _energy; + } + + public String GetLastChat() { + return _lastChat; + } + + public void SetLastChat(String _lastChat) { + this._lastChat = _lastChat; + } + + public int GetEconomyBalance() + { + return _economyBalance; + } + + public void SetEconomyBalance(int economyBalance) + { + _economyBalance = economyBalance; + SaveEconomyBalance(); + } + + public void ModifyEconomyBalance(int mod) + { + _economyBalance += mod; + SaveEconomyBalance(); + } + + public void LoadEconomyBalance() + { + FileInputStream fstream = null; + DataInputStream in = null; + BufferedReader br = null; + + try + { + fstream = new FileInputStream("economy/" + Client.GetPlayerName() + ".dat"); + in = new DataInputStream(fstream); + br = new BufferedReader(new InputStreamReader(in)); + String strLine = br.readLine(); + + try + { + _economyBalance = Integer.parseInt(strLine); + } + catch (Exception e) + { + System.out.println("Invalid Balance: " + Client.GetPlayerName()); + _economyBalance = 0; + SaveEconomyBalance(); + } + + in.close(); + } + catch (Exception e) + { + _economyBalance = 0; + SaveEconomyBalance(); + } + finally + { + if (br != null) + { + try + { + br.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (in != null) + { + try + { + in.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + private void SaveEconomyBalance() + { + FileWriter fstream = null; + BufferedWriter out = null; + + try + { + File file = new File("economy/"); + file.mkdirs(); + + fstream = new FileWriter("economy/" + Client.GetPlayerName() + ".dat"); + out = new BufferedWriter(fstream); + + out.write("" + _economyBalance); + + out.close(); + } + catch (Exception e) + { + System.err.println("Balance Save Error: " + e.getMessage()); + } + finally + { + if (out != null) + { + try + { + out.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + public void SetFilterChat(boolean filterChat) + { + _unfilteredChat = filterChat; + } + + public boolean GetFilterChat() + { + return _unfilteredChat; + } + + public long GetLastPPH() + { + return _lastPPH; + } + + public void SetLastPPH(long _lastPPH) + { + this._lastPPH = _lastPPH; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientIgnore.java b/Plugins/Core/src/me/chiss/Core/ClientData/ClientIgnore.java new file mode 100644 index 000000000..6a1064c1c --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/ClientIgnore.java @@ -0,0 +1,69 @@ +package me.chiss.Core.ClientData; + +import java.util.HashSet; +import java.util.Set; + +import nautilus.minecraft.core.webserver.token.Account.ClientIgnoreToken; + +import mineplex.core.account.CoreClient; + +public class ClientIgnore extends ClientDataBase +{ + private HashSet _ignore = new HashSet(); + + public ClientIgnore(CoreClient client) + { + super(client, "Ignore", null); + } + + @Override + public void Load() + { + + } + + @Override + public void LoadToken(ClientIgnoreToken token) + { + if (token != null) + { + for (String cur : token.Ignored) + _ignore.add(cur); + } + } + + public boolean ToggleIgnore(String name) + { + if (_ignore.contains(name)) + { + //Memory + _ignore.remove(name); + + Save(); + + return false; + } + + //Memory + _ignore.add(name); + + Save(); + + return true; + } + + public void Save() + { + //XXX + } + + public boolean IsIgnored(String name) + { + return _ignore.contains(name); + } + + public Set GetIgnored() + { + return _ignore; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientMute.java b/Plugins/Core/src/me/chiss/Core/ClientData/ClientMute.java new file mode 100644 index 000000000..3eb41c36f --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/ClientMute.java @@ -0,0 +1,116 @@ +package me.chiss.Core.ClientData; + + +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.minecraft.punish.Tokens.PunishToken; + +public class ClientMute extends ClientDataBase +{ + private String _admin = ""; + private String _reason = ""; + private Rank _rank = Rank.ALL; + + private long _muteTime = 0; + private long _muteDuration = -1; + + public ClientMute(CoreClient client) + { + super(client, "Mute", null); + } + + @Override + public void Load() + { + + } + + @Override + public void LoadToken(PunishToken token) + { + SetAdmin(token.Admin); + //SetMuteDuration((long)(3600000 * token.Hours)); + SetMuteTime(System.currentTimeMillis()); + SetReason(token.Reason); + } + + public void DisplayData(Player player) + { + if (IsMuted()) + { + player.sendMessage(F.value("Muted", "True", true)); + + player.sendMessage(F.value(1, "Date", UtilTime.when(_muteTime))); + player.sendMessage(F.value(1, "Duration", UtilTime.when(_muteDuration))); + if (_muteTime != 0) + player.sendMessage(F.value(1, "Remaining", UtilTime.convertString(GetRemaining(), 1, TimeUnit.FIT))); + player.sendMessage(F.value(1, "Admin", _admin)); + player.sendMessage(F.value(1, "Reason", _reason)); + } + else + { + player.sendMessage(F.value("Muted", "False", false)); + } + } + + public boolean IsMuted() + { + if (_muteDuration == -1) + return false; + + if (_muteDuration == 0) + return true; + + return !UtilTime.elapsed(_muteTime, _muteDuration); + } + + public long GetRemaining() + { + return _muteDuration - (System.currentTimeMillis() - _muteTime); + } + + public String GetAdmin() { + return _admin; + } + + public void SetAdmin(String admin) { + this._admin = admin; + } + + public String GetReason() { + return _reason; + } + + public void SetReason(String reason) { + this._reason = reason; + } + + public long GetMuteTime() { + return _muteTime; + } + + public void SetMuteTime(long muteTime) { + _muteTime = muteTime; + } + + public long GetMuteDuration() { + return _muteDuration; + } + + public void SetMuteDuration(long muteDuration) { + _muteDuration = muteDuration; + } + + public Rank GetRank() { + return _rank; + } + + public void SetRank(Rank rank) { + _rank = rank; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientNAC.java b/Plugins/Core/src/me/chiss/Core/ClientData/ClientNAC.java new file mode 100644 index 000000000..51d4b1314 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/ClientNAC.java @@ -0,0 +1,182 @@ +package me.chiss.Core.ClientData; + +import mineplex.core.account.CoreClient; + +public class ClientNAC extends ClientDataBase +{ + //XXX - Temp + private long _requireTime = 86400000; + + //Loaded at Plugin Load + private boolean _required = false; + private String _date = ""; + private String _admin = ""; + private String _reason = ""; + + //Loaded on Client Connect + private boolean _using = false; + + private long _queryTime = 0; + + private String _token = ""; + + private String _pack = ""; + private String _packHash = ""; + + public ClientNAC(CoreClient client) + { + super(client, "CAH", null); + } + + @Override + public void Load() + { + //Load Requirements + } + + @Override + public void LoadToken(Object token) + { + + } + + public void SetRequired(boolean required) + { + _required = required; + } + + public boolean GetRequired() + { + return _required; + } + + public long GetRequireTime() + { + return _requireTime; + } + + public boolean IsRequired() + { + if (_required) + return true; + + if (Client.Acc().GetPlayTime() > _requireTime) + return true; + + return false; + } + + public void SetUsing(boolean using) + { + _using = using; + } + + public boolean IsUsing() + { + return _using; + } + + public void Reset() + { + _using = false; + + _queryTime = 0; + + _token = ""; + + _pack = ""; + _packHash = ""; + } + + public void SetQueryTime(long time) + { + _queryTime = time; + } + + public long GetQueryTime() + { + return _queryTime; + } + + public String GetPack() + { + return _pack; + } + + public void SetPack(String pack) + { + _pack = pack; + } + + public String GetPackHash() + { + return _packHash; + } + + public void SetPackHash(String packHash) + { + _packHash = packHash; + } + + public boolean HasToken() + { + return _token.length() > 0; + } + + public String GetToken() + { + return _token; + } + + public void SetToken(String token) + { + _token = token; + } + + public void SetDate(String date) + { + _date = date; + } + + public String GetDate() + { + return _date; + } + + public void SetAdmin(String admin) + { + _admin = admin; + } + + public String GetAdmin() + { + return _admin; + } + + public void SetReason(String reason) + { + _reason = reason; + } + + public String GetReason() + { + return _reason; + } + + public void Save() + { + if (!_required) + return; + + /* + String statement = "REPLACE INTO client_cah (client, date, admin, reason, systime) VALUES (" + + Client.Manager().SQL().f(Client.GetPlayerName()) + ", " + + Client.Manager().SQL().f(_date) + ", " + + Client.Manager().SQL().f(_admin) + ", " + + Client.Manager().SQL().f(_reason) + ", " + + System.currentTimeMillis() + ")"; + + //Insert + Client.Manager().SQL().doStatement(statement, DB.REMOTE, true);*/ + } +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientPlayer.java b/Plugins/Core/src/me/chiss/Core/ClientData/ClientPlayer.java new file mode 100644 index 000000000..c1fe109d8 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/ClientPlayer.java @@ -0,0 +1,101 @@ +package me.chiss.Core.ClientData; + +import org.bukkit.Location; + +import mineplex.core.account.CoreClient; + +public class ClientPlayer extends ClientDataBase +{ + private long _lastAction = 0; + private long _lastGrounded = 0; + private long _lastMovement = 0; + private long _lastDamagee = 0; + private long _lastDamager = 0; + private long _lastEnergy = 0; + + private Location _lastLocation = null; + + public ClientPlayer(CoreClient client) + { + super(client, "Player", null); + } + + @Override + public void Load() + { + + } + + @Override + protected void LoadToken(Object token) + { + + } + + public long GetLastAction() { + return _lastAction; + } + + public void SetLastAction(long _lastAction) { + this._lastAction = _lastAction; + } + + public long GetLastGrounded() { + return _lastGrounded; + } + + public void SetLastGrounded(long _lastGrounded) { + this._lastGrounded = _lastGrounded; + } + + public long GetLastMovement() { + return _lastMovement; + } + + public void SetLastMovement(long _lastMovement) { + this._lastMovement = _lastMovement; + } + + public Location GetLastLocation() { + return _lastLocation; + } + + public void SetLastLocation(Location _lastLocation) { + this._lastLocation = _lastLocation; + } + + public long GetLastDamagee() + { + return _lastDamagee; + } + + public void SetLastDamagee(long _lastDamaged) { + this._lastDamagee = _lastDamaged; + } + + public long GetLastDamager() + { + return _lastDamager; + } + + public void SetLastDamager(long _lastDamaged) { + this._lastDamager = _lastDamaged; + } + + public long GetLastCombat() + { + if (_lastDamager > _lastDamagee) + return _lastDamager; + return _lastDamagee; + } + + public void SetLastEnergy(long time) + { + _lastEnergy = time; + } + + public long GetLastEnergy() + { + return _lastEnergy; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientPlayer.java.orig b/Plugins/Core/src/me/chiss/Core/ClientData/ClientPlayer.java.orig new file mode 100644 index 000000000..04bba2a0c --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/ClientPlayer.java.orig @@ -0,0 +1,90 @@ +package me.chiss.Core.ClientData; + +import org.bukkit.Location; + +import mineplex.core.account.CoreClient; + +public class ClientPlayer extends ClientDataBase +{ + private long _lastAction = 0; + private long _lastGrounded = 0; + private long _lastMovement = 0; + private long _lastDamagee = 0; + private long _lastDamager = 0; + + private Location _lastLocation = null; + + public ClientPlayer(CoreClient client) + { + super(client, "Player", null); + } + + @Override + public void Load() + { + + } + + @Override + protected void LoadToken(Object token) + { + + } + + public long GetLastAction() { + return _lastAction; + } + + public void SetLastAction(long _lastAction) { + this._lastAction = _lastAction; + } + + public long GetLastGrounded() { + return _lastGrounded; + } + + public void SetLastGrounded(long _lastGrounded) { + this._lastGrounded = _lastGrounded; + } + + public long GetLastMovement() { + return _lastMovement; + } + + public void SetLastMovement(long _lastMovement) { + this._lastMovement = _lastMovement; + } + + public Location GetLastLocation() { + return _lastLocation; + } + + public void SetLastLocation(Location _lastLocation) { + this._lastLocation = _lastLocation; + } + + public long GetLastDamagee() + { + return _lastDamagee; + } + + public void SetLastDamagee(long _lastDamaged) { + this._lastDamagee = _lastDamaged; + } + + public long GetLastDamager() + { + return _lastDamager; + } + + public void SetLastDamager(long _lastDamaged) { + this._lastDamager = _lastDamaged; + } + + public long GetLastCombat() + { + if (_lastDamager > _lastDamagee) + return _lastDamager; + return _lastDamagee; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientRank.java b/Plugins/Core/src/me/chiss/Core/ClientData/ClientRank.java new file mode 100644 index 000000000..dcaccf86c --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/ClientRank.java @@ -0,0 +1,62 @@ +package me.chiss.Core.ClientData; + +import mineplex.core.server.IRepository; +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; + +public class ClientRank extends ClientDataBase +{ + private Rank _rank; + + public ClientRank(CoreClient client, IRepository repository) + { + super(client, "Rank", repository); + } + + public ClientRank(CoreClient client, IRepository repository, String token) + { + super(client, "Rank", repository, token); + } + + @Override + public void Load() + { + _rank = Rank.ALL; + } + + @Override + public void LoadToken(String token) + { + _rank = Rank.valueOf(token); + } + + public Rank GetRank() + { + return _rank; + } + + public boolean Has(Rank rank, boolean inform) + { + if (Client.GetPlayer() != null) + if (Client.GetPlayer().isOp()) + return true; + + if (_rank.compareTo(rank) <= 0) + { + return true; + } + + if (inform) + { + UtilPlayer.message(Client.GetPlayer(), C.mHead + "Permissions > " + + C.mBody + "This requires Permission Rank [" + + C.mHead + rank + + C.mBody + "]."); + System.out.println("Rank: " + _rank + " compareTo:" + _rank.compareTo(rank)); + } + + return false; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientWiki.java b/Plugins/Core/src/me/chiss/Core/ClientData/ClientWiki.java new file mode 100644 index 000000000..0a07da789 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/ClientWiki.java @@ -0,0 +1,103 @@ +package me.chiss.Core.ClientData; + +import nautilus.minecraft.core.webserver.token.Account.ClientWikiToken; +import me.chiss.Core.Wiki.WikiArticle; +import mineplex.core.account.CoreClient; +import mineplex.core.server.IRepository; + +public class ClientWiki extends ClientDataBase +{ + private int _articlesActive = 0; + private int _articlesDeprecated = 0; + private int _articlesDenied = 0; + + private WikiArticle _last = null; + private long _lastTime = 0; + + private String _lastBlock; + + public ClientWiki(CoreClient client) + { + super(client, "Wiki", null); + } + + public ClientWiki(CoreClient client, IRepository repository, ClientWikiToken token) + { + super(client, "Wiki", repository, token); + } + + @Override + public void Load() + { + + } + + @Override + public void LoadToken(ClientWikiToken token) + { + if (token == null) + return; + + _articlesActive = token.ArticlesActive; + _articlesDeprecated = token.ArticlesDeprecated; + _articlesDenied = token.ArticlesDenied; + } + + public WikiArticle GetLastArticle() + { + return _last; + } + + public void SetLastArticle(WikiArticle last) + { + _last = last; + } + + public long GetLastTime() + { + return _lastTime; + } + + public void SetLastTime(long lastTime) + { + _lastTime = lastTime; + } + + public String GetLastBlock() + { + return _lastBlock; + } + + public void SetLastBlock(String lastBlock) + { + _lastBlock = lastBlock; + } + + public int GetActive() + { + return _articlesActive; + } + + public int GetDeprecated() + { + return _articlesDeprecated; + } + + public int GetDenied() + { + return _articlesDenied; + } + + public void RegisterArticle(WikiArticle article) + { + if (article.GetRevision() > 0) + { + if (article.IsActive()) + _articlesActive++; + else + _articlesDeprecated++; + } + else + _articlesDenied++; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/IClientClass.java b/Plugins/Core/src/me/chiss/Core/ClientData/IClientClass.java new file mode 100644 index 000000000..e845c167e --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/IClientClass.java @@ -0,0 +1,54 @@ +package me.chiss.Core.ClientData; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map.Entry; + +import me.chiss.Core.Class.IPvpClass; +import me.chiss.Core.Skill.ISkill; +import me.chiss.Core.Skill.ISkill.SkillType; + +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; + +public interface IClientClass +{ + String GetName(); + + void SetGameClass(IPvpClass gameClass); + void SetGameClass(IPvpClass gameClass, boolean addDefaultSkills); + IPvpClass GetGameClass(); + + void AddSkill(ISkill skill, int level); + void RemoveSkill(ISkill getSkill); + + Collection> GetSkills(); + Collection> GetDefaultSkills(); + ISkill GetSkillByType(SkillType skillType); + void ResetSkills(); + void ClearSkills(); + void ClearDefaultSkills(); + + int GetSkillLevel(ISkill skill); + + PlayerInventory GetInventory(); + void OpenInventory(Inventory skillsCategory); + void CloseInventory(); + void UpdateInventory(); + + void ClearDefaults(); + + void AddDefaultArmor(ItemStack[] armorContents); + void PutDefaultItem(ItemStack deliverable, int slot); + HashMap GetDefaultItems(); + + ItemStack[] GetDefaultArmor(); + + void SetDefaultHead(ItemStack armor); + void SetDefaultChest(ItemStack armor); + void SetDefaultLegs(ItemStack armor); + void SetDefaultFeet(ItemStack armor); + + void ResetToDefaults(boolean equipItems, boolean equipDefaultArmor); +} diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/IClientDataLoad.java b/Plugins/Core/src/me/chiss/Core/ClientData/IClientDataLoad.java new file mode 100644 index 000000000..42f1a342f --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/ClientData/IClientDataLoad.java @@ -0,0 +1,6 @@ +package me.chiss.Core.ClientData; + +public interface IClientDataLoad +{ + public void Load(); +} diff --git a/Plugins/Core/src/me/chiss/Core/Config/Config.java b/Plugins/Core/src/me/chiss/Core/Config/Config.java new file mode 100644 index 000000000..9dc7ac728 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Config/Config.java @@ -0,0 +1,227 @@ +package me.chiss.Core.Config; + +import java.util.HashMap; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import me.chiss.Core.Module.AModule; + +public class Config extends AModule +{ + public Config(JavaPlugin plugin) + { + super("Config", plugin); + } + + //Configuation + private HashMap> _moduleConfig = new HashMap>(); + + @Override + public void enable() + { + _moduleConfig.clear(); + /* + ResultSet rs = _sql.doQuery("SELECT module,variable,value FROM config", DB.LOCAL); + + try + { + while (rs.next()) + { + String module = rs.getString(1); + String variable = rs.getString(2); + String value = rs.getString(3); + + //Ensure Module Exists + if (!_moduleConfig.containsKey(module)) + _moduleConfig.put(module, new HashMap()); + + //Add Variable + _moduleConfig.get(module).put(variable, value); + } + + Log("Configuration Loaded from SQL"); + } + catch (Exception e) + { + Log(DB.LOCAL + " SQL Error: " + e.getMessage()); + Log("SELECT module,variable,value FROM config"); + }*/ + } + + @Override + public void disable() + { + long epoch = System.currentTimeMillis(); + Log("Saving Config..."); + + //writeVars(); + + Log("Config Saved. Took " + (System.currentTimeMillis()-epoch) + " milliseconds."); + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + + } + + public void writeVars() + { + /* + //Clear + _sql.doStatement("DELETE FROM config", DB.LOCAL, false); + + //Write + for (String curModule : _moduleConfig.keySet()) + { + for (String curVariable : _moduleConfig.get(curModule).keySet()) + { + writeVar(curModule, curVariable, _moduleConfig.get(curModule).get(curVariable)); + } + }*/ + } + + public void writeVar(String module, String variable, String value) + {/* + String statement = "REPLACE INTO config (module,variable,value) VALUES (" + + _sql.f(module) + ", " + + _sql.f(variable) + ", " + + _sql.f(value) + ")"; + + //Insert + _sql.doStatement(statement, DB.LOCAL, true); + */} + + public void addVar(String module, String variable, String value) + { + Log("Adding Variable [" + module + ": " + variable + " = " + value + "]"); + + //Ensure Module Exists + if (!_moduleConfig.containsKey(module)) + _moduleConfig.put(module, new HashMap()); + + //Add Variable + _moduleConfig.get(module).put(variable, value); + + writeVar(module, variable, value); + } + + public String getString(String module, String variable, String def) + { + if (!_moduleConfig.containsKey(module)) + { + Log("Variable Not Found [" + module + ": " + variable + "]"); + addVar(module, variable, def); + return def; + } + + HashMap varMap = _moduleConfig.get(module); + + if (!varMap.containsKey(variable)) + { + Log("Variable Not Found [" + module + ": " + variable + "]"); + addVar(module, variable, def); + return def; + } + + return varMap.get(variable); + } + + public int getInt(String module, String variable, int def) + { + if (!_moduleConfig.containsKey(module)) + { + Log("Variable Not Found [" + module + ": " + variable + "]"); + addVar(module, variable, def+""); + return def; + } + + HashMap varMap = _moduleConfig.get(module); + + if (!varMap.containsKey(variable)) + { + Log("Variable Not Found [" + module + ": " + variable + "]"); + addVar(module, variable, def+""); + return def; + } + + try + { + return Integer.parseInt(varMap.get(variable)); + } + catch (Exception e) + { + return 0; + } + } + + public long getLong(String module, String variable, long def) + { + if (!_moduleConfig.containsKey(module)) + { + Log("Variable Not Found [" + module + ": " + variable + "]"); + addVar(module, variable, def+""); + return def; + } + + HashMap varMap = _moduleConfig.get(module); + + if (!varMap.containsKey(variable)) + { + Log("Variable Not Found [" + module + ": " + variable + "]"); + addVar(module, variable, def+""); + return def; + } + + try + { + return Long.parseLong(varMap.get(variable)); + } + catch (Exception e) + { + return 0; + } + } + + public boolean getBool(String module, String variable, boolean def) + { + if (!_moduleConfig.containsKey(module)) + { + Log("Variable Not Found [" + module + ": " + variable + "]"); + addVar(module, variable, def+""); + return def; + } + + HashMap varMap = _moduleConfig.get(module); + + if (!varMap.containsKey(variable)) + { + Log("Variable Not Found [" + module + ": " + variable + "]"); + addVar(module, variable, def+""); + return def; + } + + try + { + return Boolean.parseBoolean(varMap.get(variable)); + } + catch (Exception e) + { + addVar(module, variable, def+""); + return def; + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Delayed/delayNACQuery.java b/Plugins/Core/src/me/chiss/Core/Delayed/delayNACQuery.java new file mode 100644 index 000000000..2e4e45725 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Delayed/delayNACQuery.java @@ -0,0 +1,26 @@ +package me.chiss.Core.Delayed; + +import org.bukkit.entity.Player; + +import me.chiss.Core.Frame.ADelay; +import me.chiss.Core.NAC.NACTask; + +public class delayNACQuery extends ADelay +{ + private NACTask _task; + public delayNACQuery(Player player, String data, NACTask task) + { + super(player, data); + _task = task; + } + + @Override + public void delayed() + { + if (player == null) + return; + + _task.sendQuery(player, false); + } + +} diff --git a/Plugins/Core/src/me/chiss/Core/Events/ServerSaveEvent.java b/Plugins/Core/src/me/chiss/Core/Events/ServerSaveEvent.java new file mode 100644 index 000000000..7597be9b5 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Events/ServerSaveEvent.java @@ -0,0 +1,33 @@ +package me.chiss.Core.Events; + +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ServerSaveEvent extends Event implements Cancellable +{ + private static final HandlerList handlers = new HandlerList(); + private boolean _cancelled = false; + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean cancel) + { + _cancelled = cancel; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Frame/ADelay.java b/Plugins/Core/src/me/chiss/Core/Frame/ADelay.java new file mode 100644 index 000000000..2bb62ec64 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Frame/ADelay.java @@ -0,0 +1,23 @@ +package me.chiss.Core.Frame; + +import org.bukkit.entity.Player; + +public abstract class ADelay implements Runnable +{ + public Player player; + public String data; + + public ADelay(Player player, String data) + { + this.player = player; + this.data = data; + } + + @Override + public void run() + { + delayed(); + } + + public abstract void delayed(); +} \ No newline at end of file diff --git a/Plugins/Core/src/me/chiss/Core/Loot/LootBase.java b/Plugins/Core/src/me/chiss/Core/Loot/LootBase.java new file mode 100644 index 000000000..0a83ee7d8 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Loot/LootBase.java @@ -0,0 +1,209 @@ +package me.chiss.Core.Loot; + +import java.util.HashSet; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import me.chiss.Core.Loot.LootFactory; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.itemstack.ItemStackFactory; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemHeldEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; + +public abstract class LootBase implements Listener +{ + protected LootFactory Factory; + + private String _name; + private String[] _lore; + private Material _mat; + private ActionType _trigger; + private int _enchLevel; + + private HashSet _users; + + public LootBase(LootFactory factory, String name, String[] lore, Material mat, ActionType trigger, int level) + { + Factory = factory; + + _name = name; + _lore = lore; + _mat = mat; + _trigger = trigger; + + _enchLevel = level; + + _users = new HashSet(); + } + + @EventHandler + public void EquipHeld(PlayerItemHeldEvent event) + { + ItemStack newSlot = event.getPlayer().getInventory().getItem(event.getNewSlot()); + + if (!_users.contains(event.getPlayer())) + Equip(event.getPlayer(), newSlot); + } + + @EventHandler + public void EquipPickup(PlayerPickupItemEvent event) + { + if (event.isCancelled()) + return; + + Equip(event.getPlayer(), event.getPlayer().getItemInHand()); + } + + @EventHandler + public void EquipInventory(InventoryCloseEvent event) + { + if (event.getPlayer() instanceof Player) + Equip((Player) event.getPlayer(), event.getPlayer().getItemInHand()); + } + + @EventHandler + public void EquipJoin(PlayerJoinEvent event) + { + Equip(event.getPlayer(), event.getPlayer().getItemInHand()); + } + + public void Equip(Player ent, ItemStack item) + { + if (_users.contains(ent)) + return; + + if (!UtilGear.isMat(item, _mat)) + return; + + if (!CraftItemStack.asNMSCopy(item).getName().contains(_name)) + return; + + _users.add(ent); + } + + @EventHandler + public void UpdateUnequip(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + HashSet remove = new HashSet(); + + for (Entity cur : _users) + { + if (!(cur instanceof Player)) + continue; + + if (Unequip((Player)cur)) + remove.add(cur); + } + + for (Entity cur : remove) + _users.remove(cur); + } + + public boolean Unequip(Player player) + { + if (!UtilGear.isMat(player.getItemInHand(), _mat)) + return true; + + if (!CraftItemStack.asNMSCopy(player.getItemInHand()).getName().contains(_name)) + return true; + + return false; + } + + @EventHandler + public void DamageTrigger(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!_users.contains(damager)) + return; + + Damage(event); + } + + public abstract void Damage(CustomDamageEvent event); + + @EventHandler + public void AbilityTrigger(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, _trigger)) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (Unequip(event.getPlayer())) + return; + + if (!_users.contains(event.getPlayer())) + return; + + Ability(event); + } + + public abstract void Ability(PlayerInteractEvent event); + + public String GetName() + { + return _name; + } + + public Material GetMaterial() + { + return _mat; + } + + public HashSet GetUsers() + { + return _users; + } + + public void GiveTo(Player caller) + { + caller.getInventory().addItem(Get()); + } + + public ItemStack Get() + { + ItemStack loot = ItemStackFactory.Instance.CreateStack(_mat.getId(), (byte)0, 1, "§r" + ChatColor.RESET + C.mLoot +_name, _lore); + + loot.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, _enchLevel); + + return loot; + } + + public void Reset(Player player) + { + _users.remove(player); + ResetCustom(player); + } + + public abstract void ResetCustom(Player player); +} diff --git a/Plugins/Core/src/me/chiss/Core/Loot/LootFactory.java b/Plugins/Core/src/me/chiss/Core/Loot/LootFactory.java new file mode 100644 index 000000000..78194979b --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Loot/LootFactory.java @@ -0,0 +1,170 @@ +package me.chiss.Core.Loot; + +import java.util.ArrayList; +import java.util.HashMap; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import me.chiss.Core.Loot.Weapons.AlligatorsTooth; +import me.chiss.Core.Loot.Weapons.GiantsSword; +import me.chiss.Core.Loot.Weapons.HyperAxe; +import me.chiss.Core.Loot.Weapons.LightningScythe; +import me.chiss.Core.Loot.Weapons.MagneticBlade; +import me.chiss.Core.Loot.Weapons.MeteorBow; +import me.chiss.Core.Loot.Weapons.WindBlade; +import me.chiss.Core.Module.AModule; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.itemstack.ItemStackFactory; + +public class LootFactory extends AModule +{ + private ArrayList _legendary; + + private HashMap _loot = new HashMap(); + + public LootFactory(JavaPlugin plugin) + { + super("Loot Factory", plugin); + } + + @Override + public void enable() + { + _legendary = new ArrayList(); + + AddLoot(new WindBlade(this)); + AddLoot(new LightningScythe(this)); + AddLoot(new HyperAxe(this)); + AddLoot(new GiantsSword(this)); + AddLoot(new MeteorBow(this)); + AddLoot(new AlligatorsTooth(this)); + AddLoot(new MagneticBlade(this)); + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("giveloot"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) + return; + + for (LootBase loot : _legendary) + loot.GiveTo(caller); + } + + @EventHandler + public void Interact(PlayerInteractEvent event) + { + if (event.getPlayer().getItemInHand() == null) + return; + + if (!Clients().Get(event.getPlayer()).Rank().Has(Rank.ADMIN, false)) + return; + + if (event.getPlayer().getItemInHand().getType() != Material.BLAZE_POWDER) + return; + + DropLoot(event.getPlayer().getTargetBlock(null, 0).getRelative(BlockFace.UP).getLocation().add(0.5, 0.5, 0.5), 2, 3, 0.05f, 0.01f, 2d); + + event.setCancelled(true); + } + + private void AddLoot(LootBase loot) + { + _legendary.add(loot); + + //Register Events + UtilServer.getServer().getPluginManager().registerEvents(loot, Plugin()); + } + + @EventHandler + public void Quit(PlayerQuitEvent event) + { + for (LootBase loot : _legendary) + loot.Reset(event.getPlayer()); + } + + public void DropLoot(Location loc, int eMin, int eRan, float rareChance, float legendChance, double forceMult) + { + //Emerald + DropEmerald(loc, eMin, eRan, forceMult); + + //Enchantment + if (Math.random() < rareChance) + DropRare(loc, forceMult); + + //Weapon + if (Math.random() < legendChance) + DropLegendary(loc, forceMult); + } + + public void DropEmerald(Location loc, int eMin, int eRan, double forceMult) + { + for (int i=0 ; i < eMin + UtilMath.r(eRan+1) ; i++) + { + Item e = loc.getWorld().dropItemNaturally(loc, ItemStackFactory.Instance.CreateStack(Material.EMERALD)); + e.setVelocity(e.getVelocity().multiply(forceMult)); + } + } + + public void DropRare(Location loc, double forceMult) + { + + } + + public void DropLegendary(Location loc, double forceMult) + { + LootBase loot = _legendary.get(UtilMath.r(_legendary.size())); + Item e = loc.getWorld().dropItemNaturally(loc, loot.Get()); + e.setVelocity(e.getVelocity().multiply(forceMult)); + + _loot.put(e, loot); + } + + @EventHandler + public void Pickup(PlayerPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (!_loot.containsKey(event.getItem())) + return; + + LootBase loot = _loot.remove(event.getItem()); + + UtilServer.broadcastSpecial("Legendary Loot", + F.name(event.getPlayer().getName()) + " looted " + F.item(C.cRed + loot.GetName()) + " near " + + F.elem(UtilWorld.locToStrClean(event.getPlayer().getLocation()))); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Loot/Weapons/AlligatorsTooth.java b/Plugins/Core/src/me/chiss/Core/Loot/Weapons/AlligatorsTooth.java new file mode 100644 index 000000000..47f32f68b --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Loot/Weapons/AlligatorsTooth.java @@ -0,0 +1,123 @@ +package me.chiss.Core.Loot.Weapons; + +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import me.chiss.Core.Loot.LootBase; +import me.chiss.Core.Loot.LootFactory; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; + +public class AlligatorsTooth extends LootBase +{ + private HashSet _active = new HashSet(); + + public AlligatorsTooth(LootFactory factory) + { + super(factory, "Alligators Tooth", new String[] + { + "", + C.cGray + "Damage: " + C.cYellow + "7 + 2 in Water", + C.cGray + "Ability: " + C.cYellow + "Alliagtor Rush", + C.cGray + "Passive: " + C.cYellow + "Water Breathing", + C.cGray + "Knockback: " + C.cYellow + "100%", + "", + C.cWhite + "A blade forged from hundreds of", + C.cWhite + "alligators teeth. It's powers allow ", + C.cWhite + "its owner to swim with great speed,", + C.cWhite + "able to catch any prey.", + "" + }, + Material.IRON_SWORD, ActionType.R, 1); + } + + @Override + public void Damage(CustomDamageEvent event) + { + event.AddMod("Negate", GetName(), -event.GetDamageInitial(), false); + + //Base Damage + event.AddMod(event.GetDamagerPlayer(false).getName(), C.mLoot + GetName(), 7, true); + + if (event.GetDamageeEntity().getLocation().getBlock().isLiquid()) + { + event.AddMod(event.GetDamagerPlayer(false).getName(), C.mLoot + "Water Bonus", 2, false); + event.AddKnockback(GetName(), 0.5); + } + } + + @Override + public void Ability(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!player.getLocation().getBlock().isLiquid()) + { + UtilPlayer.message(player, F.main(GetName(), "You cannot use " + F.skill("Alligator Rush") + " out of water.")); + return; + } + + if (!Factory.Energy().Use(player, "Alligator Rush", 10, true, true)) + return; + + _active.add(player); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() == UpdateType.TICK) + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + if (!cur.isBlocking()) + { + _active.remove(cur); + continue; + } + + if (!cur.getLocation().getBlock().isLiquid()) + continue; + + if (!Factory.Energy().Use(cur, "Alligator Rush", 1, true, true)) + { + _active.remove(cur); + continue; + } + + UtilAction.velocity(cur, 0.6, 0.1, 1, true); + + //Effect + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, 8); + + if (!cur.getEyeLocation().getBlock().isLiquid()) + cur.getWorld().playSound(cur.getEyeLocation(), Sound.SPLASH, 0.25f, 1f); + + cur.getWorld().playSound(cur.getLocation(), Sound.SPLASH, 0.25f, 1f); + } + + if (event.getType() == UpdateType.FAST) + for (Player cur : GetUsers()) + Factory.Condition().Factory().Breath(GetName(), cur, cur, 1.9, 0, false, false); + } + + @Override + public void ResetCustom(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Loot/Weapons/GiantsSword.java b/Plugins/Core/src/me/chiss/Core/Loot/Weapons/GiantsSword.java new file mode 100644 index 000000000..38bf749f2 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Loot/Weapons/GiantsSword.java @@ -0,0 +1,73 @@ +package me.chiss.Core.Loot.Weapons; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import me.chiss.Core.Loot.LootBase; +import me.chiss.Core.Loot.LootFactory; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; + +public class GiantsSword extends LootBase +{ + public GiantsSword(LootFactory factory) + { + super(factory, "Giants Broadsword", new String[] + { + "", + C.cGray + "Damage: " + C.cYellow + "10", + C.cGray + "Ability: " + C.cYellow + "Giant Recovery", + C.cGray + "Knockback: " + C.cYellow + "100%", + "", + C.cWhite + "Forged by the ancient giants. It's blade", + C.cWhite + "deals more damage than any other weapon.", + C.cWhite + "Upon blocking, it protects its owner.", + "" + }, + Material.IRON_SWORD, ActionType.R, 3); + } + + @Override + public void Damage(CustomDamageEvent event) + { + event.AddMod("Negate", GetName(), -event.GetDamageInitial(), false); + + //Base Damage + event.AddMod(event.GetDamagerPlayer(false).getName(), C.mLoot + GetName(), 10, true); + } + + @Override + public void Ability(PlayerInteractEvent event) + { + + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : GetUsers()) + { + if (!cur.isBlocking()) + continue; + + UtilPlayer.health(cur, 1); + Factory.Condition().Factory().Regen(GetName(), cur, cur, 0.9, 1, false, true); + Factory.Condition().Factory().Protection(GetName(), cur, cur, 0.9, 1, false, true); + } + } + + @Override + public void ResetCustom(Player player) + { + + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Loot/Weapons/HyperAxe.java b/Plugins/Core/src/me/chiss/Core/Loot/Weapons/HyperAxe.java new file mode 100644 index 000000000..36a65a148 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Loot/Weapons/HyperAxe.java @@ -0,0 +1,147 @@ +package me.chiss.Core.Loot.Weapons; + +import java.util.HashMap; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.potion.PotionEffectType; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import me.chiss.Core.Loot.LootBase; +import me.chiss.Core.Loot.LootFactory; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilEvent.ActionType; + +public class HyperAxe extends LootBase +{ + private HashMap _rate = new HashMap(); + + public HyperAxe(LootFactory factory) + { + super(factory, "Hyper Axe", new String[] + { + "", + C.cGray + "Damage: " + C.cYellow + "3", + C.cGray + "Ability: " + C.cYellow + "Hyper Speed", + C.cGray + "Passive: " + C.cYellow + "Hyper Attack", + C.cGray + "Knockback: " + C.cYellow + "25%", + "", + C.cWhite + "Rumoured to attack foes 500% faster", + C.cWhite + "than any other weapon known to man.", + "" + }, + Material.IRON_AXE, ActionType.R, 1); + } + + @Override + public void Damage(CustomDamageEvent event) + { + + } + + @EventHandler (priority = EventPriority.LOWEST) + public void Rate(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!GetUsers().contains(damager)) + return; + + if (!damager.hasPotionEffect(PotionEffectType.FAST_DIGGING)) + return; + + //Rate + if (_rate.containsKey(damager)) + if (!UtilTime.elapsed(_rate.get(damager), 80)) + { + event.SetCancelled("Damage Rate"); + return; + } + + _rate.put(damager, System.currentTimeMillis()); + event.SetIgnoreRate(true); + + event.SetCancelled(GetName()); + } + + @EventHandler (priority = EventPriority.HIGHEST) + public void DoDamage(CustomDamageEvent event) + { + if (!event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!GetUsers().contains(damager)) + return; + + if (!event.GetCancellers().remove(GetName())) + return; + + if (event.IsCancelled()) + return; + + //Negate + event.AddMod("Negate", GetName(), -event.GetDamageInitial(), false); + + //Damage + event.AddMod(damager.getName(), C.mLoot + GetName(), 3, true); + event.AddKnockback(GetName(), 0.25); + damager.getWorld().playSound(damager.getLocation(), Sound.NOTE_PLING, 0.5f, 2f); + } + + @Override + public void Ability(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!Factory.Energy().Use(player, GetName(), 40, false, true)) + return; + + if (!Recharge.Instance.use(player, GetName(), 18000, true)) + return; + + if (!Factory.Energy().Use(player, GetName(), 40, true, true)) + return; + + //Inform + UtilPlayer.message(player, F.main(GetName(), "You used " + F.skill("Hyper Speed") + ".")); + + //Add + Factory.Condition().Factory().Speed(GetName(), player, player, 8, 3, false, true); + } + + @EventHandler + public void SwingSpeed(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : GetUsers()) + Factory.Condition().Factory().DigFast(GetName(), cur, cur, 1.9, 1, false, false); + } + + @Override + public void ResetCustom(Player player) + { + _rate.remove(player); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Loot/Weapons/LightningScythe.java b/Plugins/Core/src/me/chiss/Core/Loot/Weapons/LightningScythe.java new file mode 100644 index 000000000..638c8f3f6 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Loot/Weapons/LightningScythe.java @@ -0,0 +1,115 @@ +package me.chiss.Core.Loot.Weapons; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import me.chiss.Core.Loot.LootBase; +import me.chiss.Core.Loot.LootFactory; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; + +public class LightningScythe extends LootBase +{ + public LightningScythe(LootFactory factory) + { + super(factory, "Lightning Scythe", new String[] + { + "", + C.cGray + "Damage: " + C.cYellow + "7", + C.cGray + "Ability: " + C.cYellow + "Lightning Strike", + C.cGray + "Passive: " + C.cYellow + "Lightning Speed", + C.cGray + "Passive: " + C.cYellow + "Electric Shock", + C.cGray + "Knockback: " + C.cYellow + "100%", + "", + C.cWhite + "An old scythe that is infused with the", + C.cWhite + "powers of the skies, able to strike ", + C.cWhite + "lightning at the owners command.", + "" + }, + Material.IRON_HOE, ActionType.R, 2); + } + + @Override + public void Damage(CustomDamageEvent event) + { + event.AddMod("Negate", GetName(), -event.GetDamageInitial(), false); + + //Base Damage + event.AddMod(event.GetDamagerPlayer(false).getName(), C.mLoot + GetName(), 7, true); + + //Double Knockback + event.SetKnockback(false); + + //Effect + Factory.Condition().Factory().Shock(GetName(), event.GetDamageeEntity(), event.GetDamagerPlayer(false), 2, false, false); + } + + @Override + public void Ability(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + Block target = event.getPlayer().getTargetBlock(null, 0); + + if (target == null) + return; + + if (UtilMath.offset(target.getLocation(), player.getLocation()) > 24) + { + UtilPlayer.message(player, F.main(GetName(), "Target is out of range.")); + return; + } + + if (!Factory.Energy().Use(player, "Lightning Strike", 20, false, true)) + return; + + if (!Recharge.Instance.use(player, "Lightning Strike", 8000, true)) + return; + + if (!Factory.Energy().Use(player, "Lightning Strike", 20, true, true)) + return; + + //Durability + player.getItemInHand().setDurability((short) (player.getItemInHand().getDurability() + 6)); + if (player.getItemInHand().getDurability() > 251) + player.setItemInHand(null); + UtilInv.Update(player); + + //Condition + for (Player cur : UtilPlayer.getNearby(target.getLocation(), 8)) + Factory.Condition().Factory().Lightning("Lightning Strike", cur, player, 0, 1, false, true); + + //Strike + target.getWorld().strikeLightning(target.getLocation()); + + UtilPlayer.message(player, F.main(GetName(), "You used " + F.skill("Lightning Strike") + ".")); + + event.setCancelled(true); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : GetUsers()) + Factory.Condition().Factory().Speed(GetName(), cur, cur, 1.9, 0, false, true); + } + + @Override + public void ResetCustom(Player player) + { + + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Loot/Weapons/MagneticBlade.java b/Plugins/Core/src/me/chiss/Core/Loot/Weapons/MagneticBlade.java new file mode 100644 index 000000000..5397933a3 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Loot/Weapons/MagneticBlade.java @@ -0,0 +1,150 @@ +package me.chiss.Core.Loot.Weapons; + +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import me.chiss.Core.Loot.LootBase; +import me.chiss.Core.Loot.LootFactory; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; + +public class MagneticBlade extends LootBase +{ + private HashSet _active = new HashSet(); + + public MagneticBlade(LootFactory factory) + { + super(factory, "Magnetic Blade", new String[] + { + "", + C.cGray + "Damage: " + C.cYellow + "7", + C.cGray + "Ability: " + C.cYellow + "Magnetic Pull", + C.cGray + "Knockback: " + C.cYellow + "Negative 40%", + "", + C.cWhite + "The Magnetic Blade is said to be able", + C.cWhite + "to pull nearby objects towards itself", + C.cWhite + "with unstoppable force.", + "" + }, + Material.IRON_SWORD, ActionType.R, 2); + } + + @Override + public void Damage(CustomDamageEvent event) + { + event.AddMod("Negate", GetName(), -event.GetDamageInitial(), false); + + //Base Damage + event.AddMod(event.GetDamagerPlayer(false).getName(), C.mLoot + GetName(), 7, true); + + //Reverse Knockback + event.AddKnockback(GetName(), -0.4); + } + + @Override + public void Ability(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (player.getLocation().getBlock().isLiquid()) + { + UtilPlayer.message(player, F.main(GetName(), "You cannot use " + F.skill(GetName()) + " in water.")); + return; + } + + if (!Factory.Energy().Use(player, GetName(), 10, true, true)) + return; + + _active.add(player); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + if (!cur.isBlocking()) + { + _active.remove(cur); + continue; + } + + if (cur.getLocation().getBlock().isLiquid()) + continue; + + //Target + Block target = cur.getTargetBlock(null, 0); + + if (target == null) + continue; + + if (UtilMath.offset(target.getLocation(), cur.getLocation()) > 16) + continue; + + //Energy + if (!Factory.Energy().Use(cur, GetName(), 1, true, true)) + { + _active.remove(cur); + continue; + } + + //Effect + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, 42); + + //Pull + for (Player other : cur.getWorld().getEntitiesByClass(Player.class)) + { + //Other to Block + if (UtilMath.offset(target.getLocation(), other.getLocation()) > 3) + continue; + + //Other to Cur + if (UtilMath.offset(cur, other) < 2) + continue; + + if (!Factory.Relation().CanHurt(cur, other)) + continue; + + UtilAction.velocity(other, UtilAlg.getTrajectory(other, cur), + 0.3, false, 0, 0, 1, true); + } + + for (Entity other : cur.getWorld().getEntitiesByClass(org.bukkit.entity.Item.class)) + { + //Other to Block + if (UtilMath.offset(target.getLocation(), other.getLocation()) > 3) + continue; + + UtilAction.velocity(other, UtilAlg.getTrajectory(other.getLocation(), cur.getEyeLocation()), + 0.3, false, 0, 0, 1, true); + } + } + } + + @Override + public void ResetCustom(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Loot/Weapons/MeteorBow.java b/Plugins/Core/src/me/chiss/Core/Loot/Weapons/MeteorBow.java new file mode 100644 index 000000000..96805ad58 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Loot/Weapons/MeteorBow.java @@ -0,0 +1,128 @@ +package me.chiss.Core.Loot.Weapons; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import me.chiss.Core.Loot.LootBase; +import me.chiss.Core.Loot.LootFactory; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; + +public class MeteorBow extends LootBase +{ + private HashSet _arrows = new HashSet(); + + public MeteorBow(LootFactory factory) + { + super(factory, "Meteor Bow", new String[] + { + "", + C.cGray + "Damage: " + C.cYellow + "10 (AoE)", + C.cGray + "Passive: " + C.cYellow + "Explosive Arrows", + "", + C.cWhite + "The mythical bow that reigned down", + C.cWhite + "hell from the heavens. Each shot", + C.cWhite + "is as deadly as a meteor.", + "" + }, + Material.BOW, ActionType.L, 2); + } + + @Override + @EventHandler + public void DamageTrigger(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Projectile proj = event.GetProjectile(); + if (proj == null) return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + if (!GetUsers().contains(damager)) + return; + + event.SetCancelled("Meteor Shot"); + } + + @Override + public void Damage(CustomDamageEvent event) + { + + } + + @EventHandler + public void ProjectileShoot(EntityShootBowEvent event) + { + if (!GetUsers().contains(event.getEntity())) + return; + + _arrows.add(event.getProjectile()); + } + + @EventHandler + public void ProjectileHit(ProjectileHitEvent event) + { + Projectile proj = event.getEntity(); + + if (proj.getShooter() == null) + return; + + if (!(proj.getShooter() instanceof Player)) + return; + + Player damager = (Player)proj.getShooter(); + + if (!_arrows.contains(proj) && !GetUsers().contains(damager)) + return; + + //Condition + for (Player cur : UtilPlayer.getNearby(proj.getLocation(), 6)) + Factory.Condition().Factory().Explosion(C.mLoot + "Meteor Arrow", cur, damager, 10, 1, false, true); + + proj.getWorld().createExplosion(proj.getLocation(), 1.6f); + proj.remove(); + } + + @Override + public void Ability(PlayerInteractEvent event) + { + + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + HashSet remove = new HashSet(); + + for (Entity cur : _arrows) + if (cur.isDead() || !cur.isValid()) + remove.add(cur); + + for (Entity cur : remove) + _arrows.remove(cur); + } + + @Override + public void ResetCustom(Player player) + { + + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Loot/Weapons/WindBlade.java b/Plugins/Core/src/me/chiss/Core/Loot/Weapons/WindBlade.java new file mode 100644 index 000000000..9b10c986d --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Loot/Weapons/WindBlade.java @@ -0,0 +1,116 @@ +package me.chiss.Core.Loot.Weapons; + +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import me.chiss.Core.Loot.LootBase; +import me.chiss.Core.Loot.LootFactory; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; + +public class WindBlade extends LootBase +{ + private HashSet _active = new HashSet(); + + public WindBlade(LootFactory factory) + { + super(factory, "Wind Blade", new String[] + { + "", + C.cGray + "Damage: " + C.cYellow + "7", + C.cGray + "Ability: " + C.cYellow + "Wind Rider", + C.cGray + "Knockback: " + C.cYellow + "300%", + "", + C.cWhite + "Once owned by the God Zephyrus,", + C.cWhite + "it is rumoured the Wind Blade", + C.cWhite + "grants its owner flight.", + "" + }, + Material.IRON_SWORD, ActionType.R, 3); + } + + @Override + public void Damage(CustomDamageEvent event) + { + event.AddMod("Negate", GetName(), -event.GetDamageInitial(), false); + + //Base Damage + event.AddMod(event.GetDamagerPlayer(false).getName(), C.mLoot + GetName(), 7, true); + + //Double Knockback + event.AddKnockback("Wind Blade", 3); + } + + @Override + public void Ability(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (player.getLocation().getBlock().isLiquid()) + { + UtilPlayer.message(player, F.main(GetName(), "You cannot use " + F.skill("Wind Rider") + " in water.")); + return; + } + + if (!Factory.Energy().Use(player, "Wind Rider", 20, true, true)) + return; + + _active.add(player); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + if (!cur.isBlocking()) + { + _active.remove(cur); + continue; + } + + if (cur.getLocation().getBlock().isLiquid()) + { + UtilPlayer.message(cur, F.main(GetName(), "You cannot use " + F.skill("Wind Rider") + " in water.")); + _active.remove(cur); + continue; + } + + if (!Factory.Energy().Use(cur, "Wind Rider", 2, true, true)) + { + _active.remove(cur); + continue; + } + + UtilAction.velocity(cur, 0.6, 0.1, 1, true); + + //Effect + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, 80); + cur.getWorld().playSound(cur.getLocation(), Sound.FIZZ, 1.2f, 1.5f); + } + } + + @Override + public void ResetCustom(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/MemoryFix/MemoryFix.java b/Plugins/Core/src/me/chiss/Core/MemoryFix/MemoryFix.java new file mode 100644 index 000000000..8d74d1a42 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/MemoryFix/MemoryFix.java @@ -0,0 +1,49 @@ +package me.chiss.Core.MemoryFix; + +import java.util.Iterator; + +import net.minecraft.server.v1_6_R2.IInventory; + +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.craftbukkit.v1_6_R2.CraftWorld; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.HumanEntity; +import org.bukkit.plugin.java.JavaPlugin; + +public class MemoryFix +{ + private JavaPlugin _plugin; + + public MemoryFix(JavaPlugin plugin) + { + _plugin = plugin; + + _plugin.getServer().getScheduler().scheduleSyncRepeatingTask(_plugin, new Runnable() + { + public void run() + { + for (World world : Bukkit.getWorlds()) + { + for (Object tileEntity : ((CraftWorld)world).getHandle().tileEntityList) + { + if (tileEntity instanceof IInventory) + { + Iterator entityIterator = ((IInventory)tileEntity).getViewers().iterator(); + + while (entityIterator.hasNext()) + { + HumanEntity entity = entityIterator.next(); + + if (entity instanceof CraftPlayer && !((CraftPlayer)entity).isOnline()) + { + entityIterator.remove(); + } + } + } + } + } + } + }, 100L, 100L); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Module/AModule.java b/Plugins/Core/src/me/chiss/Core/Module/AModule.java new file mode 100644 index 000000000..1573f1f40 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Module/AModule.java @@ -0,0 +1,419 @@ +package me.chiss.Core.Module; + +import java.util.HashSet; + + +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; + +import me.chiss.Core.Clans.Clans; +import me.chiss.Core.Config.Config; +import me.chiss.Core.Loot.LootFactory; +import me.chiss.Core.Field.Field; +import me.chiss.Core.Modules.*; +import me.chiss.Core.Plugin.IPlugin; +import me.chiss.Core.Plugin.IRelation; +import me.chiss.Core.Server.Server; +import mineplex.core.account.CoreClientManager; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.creature.Creature; +import mineplex.core.energy.Energy; +import mineplex.core.explosion.Explosion; +import mineplex.core.projectile.ProjectileManager; +import mineplex.core.recharge.Recharge; +import mineplex.core.server.IRepository; +import mineplex.core.spawn.Spawn; +import mineplex.core.teleport.Teleport; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.fire.Fire; +import mineplex.minecraft.game.core.mechanics.Weapon; + +public abstract class AModule implements Listener +{ + private IRepository _repository; + + protected String _moduleName = "Default"; + + protected CoreClientManager _clients; + protected JavaPlugin _plugin; + + protected Config _config; + + protected HashSet _commands; + + public AModule(String moduleName, JavaPlugin plugin) + { + this(moduleName, plugin, null); + } + + public AModule(String moduleName, JavaPlugin plugin, IRepository repository) + { + _moduleName = moduleName; + _plugin = plugin; + _repository = repository; + + _commands = new HashSet(); + + //Register Self + Modules().Register(this); + + //Register Events + plugin.getServer().getPluginManager().registerEvents(this, _plugin); + + //Enable + onEnable(); + + commands(); + } + + public IRepository GetRepository() + { + return _repository; + } + + public final AModule onEnable() + { + //long epoch = System.currentTimeMillis(); + Log("Initialising..."); + //config(); XXX + enable(); + // Log("Enabled in " + UtilTime.convertString(System.currentTimeMillis() - epoch, 1, TimeUnit.FIT) + "."); + + return this; + } + + public final void onDisable() + { + disable(); + + Log("Disabled."); + } + + public void enable() { } + public void disable() { } + public void config() { } + public void commands() { } + public void command(Player caller, String cmd, String[] args) { } + + public final String GetName() + { + return _moduleName; + } + + public final void AddCommand(String command) + { + _commands.add(command.toLowerCase()); + } + + public final boolean HasCommand(String command) + { + return _commands.contains(command.toLowerCase()); + } + + public void Log(String data) + { + if (!(_plugin instanceof IPlugin)) + return; + + IPlugin plugin = (IPlugin)_plugin; + + plugin.Log(_moduleName, data); + } + + //Common Modules + public JavaPlugin Plugin() + { + return _plugin; + } + + public ModuleManager Modules() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetModules(); + } + + public Config Config() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetConfig(); + } + + public Utility Util() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetUtility(); + } + + public BlockRegenerate BlockRegenerate() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetBlockRegenerate(); + } + + public BlockRestore BlockRestore() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetBlockRestore(); + } + + public Blood Blood() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetBlood(); + } + + public Clans Clans() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetClans(); + } + + public ClassFactory Classes() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetClasses(); + } + + public ConditionManager Condition() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetCondition(); + } + + public Creature Creature() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetCreature(); + } + + public DamageManager Damage() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetDamage(); + } + + public Energy Energy() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetEnergy(); + } + + public Explosion Explosion() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetExplosion(); + } + + public Field Field() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetField(); + } + + public Fire Fire() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetFire(); + } + + public Ignore Ignore() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetIgnore(); + } + + public Logger Logger() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetLogger(); + } + + public LootFactory Loot() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetLoot(); + } + + public Observer Observer() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetObserver(); + } + + public IRelation Relation() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetRelation(); + } + + public Recharge Recharge() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetRecharge(); + } + + public Server ServerM() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetServer(); + } + + public SkillFactory Skills() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetSkills(); + } + + public Spawn Spawn() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetSpawn(); + } + + public Teleport Teleport() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetTeleport(); + } + + public ProjectileManager Throw() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetThrow(); + } + + public Weapon Weapon() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetWeapon(); + } + + public SkillFactory SkillFactory() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetSkills(); + } + + public Wiki Wiki() + { + if (!(_plugin instanceof IPlugin)) + return null; + + IPlugin plugin = (IPlugin)_plugin; + + return plugin.GetWiki(); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Module/ModuleManager.java b/Plugins/Core/src/me/chiss/Core/Module/ModuleManager.java new file mode 100644 index 000000000..476e23872 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Module/ModuleManager.java @@ -0,0 +1,29 @@ +package me.chiss.Core.Module; + +import java.util.HashSet; + +public class ModuleManager +{ + private HashSet _modules; + + public ModuleManager() + { + _modules = new HashSet(); + } + + public void Register(AModule module) + { + _modules.add(module); + } + + public HashSet GetAll() + { + return _modules; + } + + public void onDisable() + { + for (AModule module : _modules) + module.onDisable(); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/BlockRegenerate.java b/Plugins/Core/src/me/chiss/Core/Modules/BlockRegenerate.java new file mode 100644 index 000000000..e7d8ef86b --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/BlockRegenerate.java @@ -0,0 +1,82 @@ +package me.chiss.Core.Modules; + +import java.util.HashSet; + +import me.chiss.Core.Module.AModule; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + +public class BlockRegenerate extends AModule +{ + public HashSet _blockSets = new HashSet(); + + public BlockRegenerate(JavaPlugin plugin) + { + super("Block Regenerate", plugin); + } + + @Override + public void enable() + { + + } + + @Override + public void disable() + { + for (BlockRegenerateSet sets : _blockSets) + for (int i=sets.GetBlocks().size() - 1 ; i>=0 ; i--) + sets.GetBlocks().get(i).RestoreSlow(); + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + + } + + public BlockRegenerateSet CreateSet(int blocksPerTick) + { + BlockRegenerateSet newSet = new BlockRegenerateSet(blocksPerTick); + + _blockSets.add(newSet); + + return newSet; + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet remove = new HashSet(); + + for (BlockRegenerateSet set : _blockSets) + if (set.IsRestoring()) + for (int i=0 ; i _chunks) + { + _chunks.add(_loc.getChunk()); + QuickRestoreBlock(); + } + + public void QuickRestoreBlock() + { + //if (_loc.getBlock().getType() == Material.CHEST) + // return; + + net.minecraft.server.v1_6_R2.Chunk c = ((CraftChunk)_loc.getChunk()).getHandle(); + + c.a(_loc.getBlockX() & 0xF, _loc.getBlockY(), _loc.getBlockZ() & 0xF, _id, _data); + ((CraftWorld)_loc.getChunk().getWorld()).getHandle().notify(_loc.getBlockX(), _loc.getBlockY(), _loc.getBlockZ()); + } + + public void RestoreSlow() + { + _loc.getBlock().setTypeIdAndData(_id, _data, true); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/BlockRegenerateSet.java b/Plugins/Core/src/me/chiss/Core/Modules/BlockRegenerateSet.java new file mode 100644 index 000000000..430220947 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/BlockRegenerateSet.java @@ -0,0 +1,73 @@ +package me.chiss.Core.Modules; + +import java.util.ArrayList; +import java.util.HashSet; + +import org.bukkit.Chunk; +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_6_R2.CraftChunk; + +public class BlockRegenerateSet +{ + private boolean _restore = false; + private int _blocksPerTick = 10; + private int _index = 0; + + private ArrayList _blocks = new ArrayList(); + private HashSet _chunks = new HashSet(); + + public BlockRegenerateSet(int blocksPerTick) + { + _blocksPerTick = blocksPerTick; + } + + public void AddBlock(Location loc, int id, byte data) + { + if (!_restore) + _blocks.add(new BlockRegenerateData(loc, id, data)); + } + + public void Start() + { + _restore = true; + _index = _blocks.size() - 1; + } + + public int GetRate() + { + return _blocksPerTick; + } + + public boolean IsRestoring() + { + return _restore; + } + + public boolean RestoreNext() + { + if (_index < 0) + { + LightChunks(); + return false; + } + + _blocks.get(_index).Restore(_chunks); + _index--; + + return true; + } + + private void LightChunks() + { + for (Chunk chunk : _chunks) + { + net.minecraft.server.v1_6_R2.Chunk c = ((CraftChunk)chunk).getHandle(); + c.initLighting(); + } + } + + public ArrayList GetBlocks() + { + return _blocks; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/Blood.java b/Plugins/Core/src/me/chiss/Core/Modules/Blood.java new file mode 100644 index 000000000..de3215718 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/Blood.java @@ -0,0 +1,95 @@ +package me.chiss.Core.Modules; + +import java.util.HashSet; + +import mineplex.core.MiniPlugin; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Item; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.InventoryPickupItemEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class Blood extends MiniPlugin +{ + private HashSet _blood = new HashSet(); + + public Blood(JavaPlugin plugin) + { + super("Blood", plugin); + } + + @EventHandler + public void Death(PlayerDeathEvent event) + { + Effects(event.getEntity().getEyeLocation(), 10, 0.5, Sound.HURT, 1f, 1f, Material.INK_SACK, (byte)1, true); + } + + public void Effects(Location loc, int particles, double velMult, Sound sound, + float soundVol, float soundPitch, Material type, byte data, boolean bloodStep) + { + for (int i = 0 ; i < particles ; i++) + { + Item item = loc.getWorld().dropItem(loc, + ItemStackFactory.Instance.CreateStack(type, data)); + + item.setVelocity(new Vector((Math.random() - 0.5)*velMult,Math.random()*velMult,(Math.random() - 0.5)*velMult)); + + _blood.add(item); + } + + if (bloodStep) + loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 55); + + loc.getWorld().playSound(loc, sound, soundVol, soundPitch); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + HashSet expire = new HashSet(); + + for (Item cur : _blood) + if (cur.getTicksLived() > 10 || !cur.isValid()) + expire.add(cur); + + for (Item cur : expire) + { + cur.remove(); + _blood.remove(cur); + } + + } + + @EventHandler + public void Pickup(PlayerPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (_blood.contains(event.getItem())) + event.setCancelled(true); + } + + @EventHandler + public void HopperPickup(InventoryPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (_blood.contains(event.getItem())) + event.setCancelled(true); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/Compass.java b/Plugins/Core/src/me/chiss/Core/Modules/Compass.java new file mode 100644 index 000000000..e80dc7927 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/Compass.java @@ -0,0 +1,288 @@ +package me.chiss.Core.Modules; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.*; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import me.chiss.Core.Module.AModule; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; + +public class Compass extends AModule +{ + //Search Map + private HashMap _searchMap = new HashMap(); + + public Compass(JavaPlugin plugin) + { + super("Compass", plugin); + } + + //Module Functions + @Override + public void enable() + { + + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("compass"); + AddCommand("find"); + AddCommand("q"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + //No Compass + if (!caller.getInventory().contains(Material.COMPASS)) + { + UtilPlayer.message(caller, F.main(_moduleName, "You do not have a Compass.")); + return; + } + + //No Args + if (args.length < 1) + { + UtilPlayer.message(caller, F.main(_moduleName, "Missing Entity Parameter.")); + return; + } + + //Parse Input + if (UtilEnt.searchName(null, args[0], true) != null) + findCreature(caller, UtilEnt.searchName(null, args[0], false)); + + else if (args[0].equalsIgnoreCase("random")) + findRandom(caller); + + else + findPlayer(caller, args[0]); + } + + public void findRandom(Player caller) + { + //Recharge + if (!Recharge().use(caller, "Random Compass Search", 12000, true)) + return; + + //Find Players + ArrayList findList = new ArrayList(); + for (Player cur : UtilServer.getPlayers()) + { + if (caller.getWorld().getEnvironment() != cur.getWorld().getEnvironment()) + continue; + + if (Clans().CUtil().playerAlly(caller.getName(), cur.getName())) + continue; + + findList.add(cur); + } + + // + if (findList.size() == 0) + { + UtilPlayer.message(caller, F.main(_moduleName, "You do not have a Compass.")); + return; + } + + findPlayer(caller, findList.get(UtilMath.r(findList.size())).getName()); + } + + public void findCreature(Player caller, String name) + { + //Type + EntityType type = UtilEnt.searchEntity(null, name, false); + + //Target Creature + Entity bestTarget = null; + double bestDist = 999999; + + //Search World + for (Entity ent : caller.getWorld().getEntities()) + if (ent.getType() == type) + { + double newDist = closer(caller, ent, bestDist); + if (newDist < bestDist) + { + bestTarget = ent; + bestDist = newDist; + } + } + + //None Found + if (bestTarget == null) + { + UtilPlayer.message(caller, F.main(_moduleName, "There are no " + F.elem(name) + " nearby.")); + setTarget(caller, caller); + return; + } + + //Inform + UtilPlayer.message(caller, F.main(_moduleName, "The nearest " + F.elem(name) + " is at " + F.elem(UtilWorld.locToStrClean(bestTarget.getLocation())) + ".")); + + //Set + setTarget(caller, bestTarget); + } + + + public double closer(Player caller, Entity newEnt, double oldDist) + { + double newDist = caller.getLocation().toVector().subtract(newEnt.getLocation().toVector()).length(); + + if (newDist < oldDist) + return newDist; + + return 999999999; + } + + public void findPlayer(Player caller, String name) + { + Player target = UtilPlayer.searchOnline(caller, name, true); + + if (target == null) + return; + + if (caller.getLocation().getWorld().equals(target.getLocation().getWorld())) + { + //Inform + UtilPlayer.message(caller, F.main(_moduleName, F.name(target.getName()) + " is in " + + F.elem(UtilWorld.envToStr(caller.getLocation().getWorld().getEnvironment())) + + " at " + F.elem(UtilWorld.locToStrClean(target.getLocation())) + ".")); + + //Lock + setTarget(caller, target); + } + else + { + //Inform + UtilPlayer.message(caller, F.main(_moduleName, F.name(target.getName()) + " was last seen in " + + F.elem(UtilWorld.envToStr(caller.getLocation().getWorld().getEnvironment())) + ".")); + + //Lock + setTarget(caller, caller); + } + } + + public void setTarget(Player caller, Entity target) + { + _searchMap.put(caller, target); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : UtilServer.getPlayers()) + updateCompass(cur); + + updateTarget(); + } + + @EventHandler + public void Quit(PlayerQuitEvent event) + { + _searchMap.remove(event.getPlayer()); + } + + public void updateCompass(Player player) + { + //No Compass + if (!player.getInventory().contains(Material.COMPASS)) + { + _searchMap.remove(player); + return; + } + + //Ensure + if (!_searchMap.containsKey(player)) + setTarget(player,player); + + //No Target + if (_searchMap.get(player).equals(player)) + { + double x = player.getLocation().getX() + (Math.sin((System.currentTimeMillis()/800)%360d)*20); + double y = player.getLocation().getY(); + double z = player.getLocation().getZ() + (Math.cos((System.currentTimeMillis()/800)%360d)*20); + player.setCompassTarget(new Location(player.getWorld(), x, y, z)); + return; + } + + //Lock + Entity target = _searchMap.get(player); + + //Changed World + if (!player.getLocation().getWorld().equals(target.getLocation().getWorld())) + { + UtilPlayer.message(player, F.main(_moduleName, "Target is no longer in your World.")); + setTarget(player,player); + return; + } + + //Lock + player.setCompassTarget(target.getLocation()); + } + + public void updateTarget() + { + HashSet toRemove = new HashSet(); + + for (Player cur : _searchMap.keySet()) + { + //Target Living + if (_searchMap.get(cur) instanceof LivingEntity) + { + LivingEntity ent = (LivingEntity)_searchMap.get(cur); + if (ent.isDead()) + { + toRemove.add(cur); + UtilPlayer.message(cur, F.main(_moduleName, "Target has been killed.")); + continue; + } + } + + //Target Player + if (_searchMap.get(cur) instanceof Player) + { + Player ent = (Player)_searchMap.get(cur); + if (!ent.isOnline()) + { + toRemove.add(cur); + UtilPlayer.message(cur, F.main(_moduleName, "Target has left the game.")); + continue; + } + } + } + + for (Player cur : toRemove) + setTarget(cur, cur); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/Explosion.java.orig b/Plugins/Core/src/me/chiss/Core/Modules/Explosion.java.orig new file mode 100644 index 000000000..7bb4479ec --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/Explosion.java.orig @@ -0,0 +1,253 @@ +package me.chiss.Core.Modules; + +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map.Entry; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.MiniPlugin; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.ExplosionPrimeEvent; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class Explosion extends MiniPlugin +{ + private boolean _damageEnabled = true; + private boolean _regenerateGround = false; + private HashSet _explosionBlocks = new HashSet(); + + private BlockRestore _blockRestore; + + public Explosion(JavaPlugin plugin, BlockRestore blockRestore) + { + super("Block Restore", plugin); + + _blockRestore = blockRestore; + } + + @EventHandler + public void ExplosionPrime(ExplosionPrimeEvent event) + { + if (event.getRadius() >= 5) + return; + + for (Block block : UtilBlock.getInRadius(event.getEntity().getLocation(), (double) event.getRadius()).keySet()) + if (block.isLiquid()) + block.setTypeId(0); + } + + @EventHandler + public void ExplosionEntity(EntityExplodeEvent event) + { + if (event.isCancelled()) + return; + + try + { + if (event.getEntityType() == EntityType.CREEPER) + event.blockList().clear(); + + if (event.getEntityType() == EntityType.WITHER_SKULL) + event.blockList().clear(); + } + catch(Exception e) + { + //Bloop + } + + + if (event.blockList().isEmpty()) + return; + + event.setYield(0f); + + //Save + final HashMap> blocks = new HashMap>(); + + for (Block cur : event.blockList()) + { + if (cur.getTypeId() == 0 || cur.isLiquid()) + continue; + + if (cur.getType() == Material.CHEST || + cur.getType() == Material.IRON_ORE || + cur.getType() == Material.COAL_ORE || + cur.getType() == Material.GOLD_ORE || + cur.getType() == Material.DIAMOND_ORE) + { + cur.breakNaturally(); + continue; + } + + blocks.put(cur, new AbstractMap.SimpleEntry(cur.getTypeId(), cur.getData())); + + if (!_regenerateGround) + { + if (cur.getTypeId() != 98 || cur.getData() != 0) + cur.setTypeId(0); + } + + else + _blockRestore.Add(cur, 0, (byte)0, 10000); + } + + event.blockList().clear(); + + //DELAY + + final Entity fEnt = event.getEntity(); + final Location fLoc = event.getLocation(); + _plugin.getServer().getScheduler().runTaskLater(_plugin, new Runnable() + { + public void run() + { + //Launch + for (Block cur : blocks.keySet()) + { + if (blocks.get(cur).getKey() == 98) + if (blocks.get(cur).getValue() == 0) + continue; + + //TNT + if (blocks.get(cur).getKey() == 46) + { + TNTPrimed ent = cur.getWorld().spawn(cur.getLocation().add(0.5, 0.5, 0.5), TNTPrimed.class); + Vector vec = UtilAlg.getTrajectory(fEnt, ent); + if (vec.getY() < 0) vec.setY(vec.getY() * -1); + + UtilAction.velocity(ent, vec, 1, false, 0, 0.6, 10, false); + + ent.setFuseTicks(10); + } + //Other + else + { + FallingBlock fall = cur.getWorld().spawnFallingBlock(cur.getLocation().add(0.5, 0.5, 0.5), blocks.get(cur).getKey(), blocks.get(cur).getValue()); + + Vector vec = UtilAlg.getTrajectory(fEnt, fall); + if (vec.getY() < 0) vec.setY(vec.getY() * -1); + + vec.multiply(0.6 + 0.4*Math.random()); + + UtilAction.velocity(fall, vec, 0.75, false, 0, 0.6, 10, false); + + _explosionBlocks.add(fall); + } + } + + //Items + /** + for (Item item : event.getEntity().getWorld().getEntitiesByClass(Item.class)) + if (UtilMath.offset(item, event.getEntity()) < 5) + { + Vector vec = UtilAlg.getTrajectory(event.getEntity(), item); + if (vec.getY() < 0) vec.setY(vec.getY() * -1); + + UtilAction.velocity(item, vec, 1, false, 0, 0.6, 10, false); + } + **/ + + //Crack + for (Block cur : UtilBlock.getInRadius(fLoc, 4d).keySet()) + if (cur.getTypeId() == 98) + if (cur.getData() == 0) + cur.setTypeIdAndData(98, (byte)2, true); + } + }, 1); + } + + @EventHandler + public void ExplosionBlockUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + HashSet fallen = new HashSet(); + + for (FallingBlock cur : _explosionBlocks) + { + if (cur.isDead() || !cur.isValid() || cur.getTicksLived() > 600) + fallen.add(cur); + } + + for (FallingBlock cur : fallen) + { + _explosionBlocks.remove(cur); + + if (cur.getTicksLived() > 600) + { + cur.remove(); + continue; + } + + Block block = cur.getLocation().getBlock(); + block.setTypeIdAndData(0, (byte)0, true); + + //Block Replace + _blockRestore.Add(block, cur.getBlockId(), cur.getBlockData(), 10000); + + cur.remove(); + } + } + + @EventHandler + public void ExplosionItemSpawn(ItemSpawnEvent event) + { + for (FallingBlock block : _explosionBlocks) + if (UtilMath.offset(event.getEntity().getLocation(), block.getLocation()) < 1) + event.setCancelled(true); + } + + @EventHandler + public void ExplosionDamage(CustomDamageEvent event) + { + if (_damageEnabled) + return; + + if (event.GetCause() == DamageCause.ENTITY_EXPLOSION || event.GetCause() == DamageCause.BLOCK_EXPLOSION) + event.SetCancelled("Explosion Damage Disabled"); + } + + @EventHandler(priority = EventPriority.LOW) + public void ExplosionBlocks(EntityExplodeEvent event) + { + if (event.getEntity() == null) + event.blockList().clear(); + } + + public void SetDamage(boolean enabled) + { + _damageEnabled = enabled; + } + + public void SetRegenerate(boolean regenerate) + { + _regenerateGround = regenerate; + } + + public HashSet GetExplosionBlocks() + { + return _explosionBlocks; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/Firework.java b/Plugins/Core/src/me/chiss/Core/Modules/Firework.java new file mode 100644 index 000000000..525c0cd4e --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/Firework.java @@ -0,0 +1,197 @@ +package me.chiss.Core.Modules; + +import java.util.ArrayList; +import java.util.HashSet; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Module.AModule; + +import org.bukkit.Color; +import org.bukkit.FireworkEffect; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.FireworkMeta; +import org.bukkit.plugin.java.JavaPlugin; + +public class Firework extends AModule +{ + private HashSet _colors; + + public Firework(JavaPlugin plugin) + { + super("Firework", plugin); + } + + //Module Functions + @Override + public void enable() + { + _colors = new HashSet(); + + _colors.add(Color.AQUA); + _colors.add(Color.BLACK); + _colors.add(Color.BLUE); + _colors.add(Color.FUCHSIA); + _colors.add(Color.GRAY); + _colors.add(Color.GREEN); + _colors.add(Color.LIME); + _colors.add(Color.MAROON); + _colors.add(Color.NAVY); + _colors.add(Color.OLIVE); + _colors.add(Color.ORANGE); + _colors.add(Color.PURPLE); + _colors.add(Color.RED); + _colors.add(Color.SILVER); + _colors.add(Color.TEAL); + _colors.add(Color.WHITE); + _colors.add(Color.YELLOW); + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("fw"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) + return; + + if (args.length >= 1 && args[0].equalsIgnoreCase("type")) + { + for (Type type : Type.values()) + caller.sendMessage(type.toString()); + return; + } + + if (args.length >= 1 && args[0].equalsIgnoreCase("color")) + { + for (Color color : _colors) + caller.sendMessage(color.toString()); + return; + } + + if (args.length < 4) + { + caller.sendMessage(F.link("/fw (Flicker,Trail)")); + caller.sendMessage(F.link("/fw type") + " for Type List."); + caller.sendMessage(F.link("/fw color") + " for Color List."); + return; + } + + FireworkEffect fe = BuildFirework(caller, args[0], args[1], args[3]); + + //Power + int power = 2; + try + { + power = Integer.parseInt(args[2]); + caller.sendMessage(F.value("Power", power+"")); + } + catch (Exception e) + { + caller.sendMessage(F.value("Invalid Power", args[2])); + } + + //Make Firework + ItemStack firework = ItemStackFactory.Instance.CreateStack(401, 64); + FireworkMeta fm = (FireworkMeta)firework.getItemMeta(); + fm.addEffect(fe); + fm.setPower(power); + firework.setItemMeta(fm); + caller.setItemInHand(firework); + } + + public FireworkEffect BuildFirework(Player caller, String typeString, String colorString, String specialString) + { + //Type + Type type = Type.BALL; + for (Type cur : Type.values()) + if (typeString.equalsIgnoreCase(cur.toString())) + { + caller.sendMessage(F.value("Type", type.toString())); + type = cur; + break; + } + + //Colors + ArrayList colors = new ArrayList(); + colorString = colorString.toLowerCase(); + for (String colorToken : colorString.split(",")) + { + ArrayList matchList = new ArrayList(); + Color match = null; + + for (Color cur : _colors) + { + if (cur.toString().toLowerCase().equals(colorToken)) + { + match = cur; + break; + } + + else if (cur.toString().toLowerCase().contains(colorToken)) + { + matchList.add(cur); + } + } + + if (match != null) + { + caller.sendMessage(F.value("Added Color", match.toString())); + colors.add(match); + } + else if (!matchList.isEmpty()) + { + if (matchList.size() == 1) + { + caller.sendMessage(F.value("Added Color", matchList.get(0).toString())); + colors.add(matchList.get(0)); + } + else + { + caller.sendMessage(F.value("Multiple Color Matches", colorToken)); + } + } + else + { + caller.sendMessage(F.value("No Color Matches", colorToken)); + } + } + if (colors.isEmpty()) + colors.add(Color.WHITE); + + boolean flicker = false; + boolean trail = false; + + if (specialString.toLowerCase().contains("flicker") || + specialString.toLowerCase().contains("flick") || + specialString.toLowerCase().contains("f")) + flicker = true; + + if (specialString.toLowerCase().contains("trail") || + specialString.toLowerCase().contains("t")) + flicker = true; + + return FireworkEffect.builder().flicker(flicker).trail(trail) + .withColor(colors).withFade(colors).with(type).build(); + } + +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/Fix.java b/Plugins/Core/src/me/chiss/Core/Modules/Fix.java new file mode 100644 index 000000000..2b9f2f618 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/Fix.java @@ -0,0 +1,237 @@ +package me.chiss.Core.Modules; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import me.chiss.Core.Module.AModule; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilWorld; + +public class Fix extends AModule +{ + public Fix(JavaPlugin plugin) + { + super("Glitch Fix", plugin); + } + + //Module Functions + @Override + public void enable() + { + + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("speed1"); + AddCommand("speed2"); + AddCommand("speed3"); + AddCommand("speed4"); + AddCommand("speed5"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (cmd.equals("speed1")) + Condition().Factory().Speed("test", caller, caller, 20, 0, false, true); + if (cmd.equals("speed2")) + Condition().Factory().Speed("test", caller, caller, 20, 1, false, true); + if (cmd.equals("speed3")) + Condition().Factory().Speed("test", caller, caller, 20, 2, false, true); + if (cmd.equals("speed4")) + Condition().Factory().Speed("test", caller, caller, 20, 3, false, true); + if (cmd.equals("speed5")) + Condition().Factory().Speed("test", caller, caller, 20, 4, false, true); + } + + + @EventHandler + public void fixDoorGlitch(BlockPlaceEvent event) + { + if (event.getBlock().getTypeId() != 64) + return; + + //Make Iron Door + event.getBlockPlaced().setType(Material.IRON_DOOR_BLOCK); + + //Inform + UtilPlayer.message(event.getPlayer(), F.main(_moduleName, "Please use Iron Doors.")); + } + + @EventHandler + public void fixWallClimb(BlockBreakEvent event) + { + if (!event.isCancelled()) + return; + + Block player = event.getPlayer().getLocation().getBlock(); + Block block = event.getBlock(); + + if (player.getRelative(BlockFace.DOWN).getTypeId() != 0) + return; + + if (block.getY() != player.getY() + 2) + return; + + //One HAS to be the same. + if (block.getX() != player.getX() && block.getZ() != player.getZ()) + return; + + //One HAS to be offset by 1. + if (Math.abs(block.getX() - player.getX()) != 1 && Math.abs(block.getZ() - player.getZ()) != 1) + return; + + //Teleport + Teleport().TP(event.getPlayer(), UtilWorld.locMerge(event.getPlayer().getLocation(), player.getLocation().add(0.5, 0, 0.5))); + + //Inform + UtilPlayer.message(event.getPlayer(), F.main(_moduleName, "Wall Climb Prevented.")); + } + + @EventHandler + public void fixBlockClimb(PlayerInteractEvent event) + { + if (!event.isCancelled()) + return; + + if (event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (!UtilBlock.isBlock(event.getPlayer().getItemInHand())) + return; + + Block player = event.getPlayer().getLocation().getBlock(); + Block block = event.getClickedBlock().getRelative(event.getBlockFace()); + + if ( + Math.abs(event.getPlayer().getLocation().getX() - ((double)block.getX()+0.5)) > 0.8 || + Math.abs(event.getPlayer().getLocation().getZ() - ((double)block.getZ()+0.5)) > 0.8 || + player.getY() < block.getY() || player.getY() > block.getY() + 1) + return; + + if (!UtilBlock.solid(block.getRelative(BlockFace.DOWN))) + return; + + //Teleport + Teleport().TP(event.getPlayer(), UtilWorld.locMerge(event.getPlayer().getLocation(), block.getLocation().add(0.5, 0, 0.5))); + + //Inform + UtilPlayer.message(event.getPlayer(), F.main(_moduleName, "Block Climb Prevented.")); + } + + /* + private HashMap> _sprintMonitor = new HashMap>(); + @EventHandler(priority = EventPriority.MONITOR) + public void fixSprintMod(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player player = event.GetDamagerPlayer(false); + if (player == null) return; + + if (!UtilEnt.isGrounded(player)) + return; + + if (!_sprintMonitor.containsKey(player)) + _sprintMonitor.put(player, new AbstractMap.SimpleEntry(System.currentTimeMillis(), player.getLocation())); + } + + @EventHandler + public void fixSprintMove(PlayerMoveEvent event) + { + if (!_sprintMonitor.containsKey(event.getPlayer())) + return; + + if (!UtilEnt.isGrounded(event.getPlayer())) + { + _sprintMonitor.remove(event.getPlayer()); + return; + } + + if (event.getPlayer().getLocation().getBlock().isLiquid()) + { + _sprintMonitor.remove(event.getPlayer()); + return; + } + + if (System.currentTimeMillis() - _sprintMonitor.get(event.getPlayer()).getKey() < 100) + return; + + if (event.getPlayer().isSprinting()) + { + _sprintMonitor.remove(event.getPlayer()); + return; + } + + double limit = 0.22; + for (PotionEffect pe : event.getPlayer().getActivePotionEffects()) + if (pe.getType().equals(PotionEffectType.SPEED)) + { + if (pe.getAmplifier() == 0) limit = 0.26; + else if (pe.getAmplifier() == 1) limit = 0.30; + else if (pe.getAmplifier() == 2) limit = 0.34; + else if (pe.getAmplifier() == 3) limit = 0.39; + else if (pe.getAmplifier() == 4) limit = 0.43; + } + + if (UtilMath.offset(event.getFrom(), event.getTo()) < limit) + { + _sprintMonitor.remove(event.getPlayer()); + return; + } + + if (System.currentTimeMillis() - _sprintMonitor.get(event.getPlayer()).getKey() > 400) + { + _sprintMonitor.remove(event.getPlayer()); + + Condition().Factory().Slow("Sprint Hack", event.getPlayer(), event.getPlayer(), 12, 4, false, true, true); + Condition().Factory().Weakness("Sprint Hack", event.getPlayer(), event.getPlayer(), 12, 4, false, true); + Condition().Factory().Poison("Sprint Hack", event.getPlayer(), event.getPlayer(), 12, 0, false, true); + + //Inform + UtilPlayer.message(event.getPlayer(), F.main(_moduleName, "Sprint Hack Prevented.")); + + System.out.println("Sprint Hack: " + event.getPlayer().getName()); + } + } + + @EventHandler + public void fixSprintQuit(PlayerQuitEvent event) + { + _sprintMonitor.remove(event.getPlayer()); + } + + @EventHandler + public void fixSprintDamage(CustomDamageEvent event) + { + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + _sprintMonitor.remove(damagee); + }*/ +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/Give.java b/Plugins/Core/src/me/chiss/Core/Modules/Give.java new file mode 100644 index 000000000..e2a764e69 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/Give.java @@ -0,0 +1,152 @@ +package me.chiss.Core.Modules; + +import java.util.LinkedList; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Module.AModule; + +public class Give extends AModule +{ + public Give(JavaPlugin plugin) + { + super("Give", plugin); + } + + //Module Functions + @Override + public void enable() + { + + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("g"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (args.length == 0) + help(caller); + + else if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) + return; + + else if (args.length == 1) + give(caller, caller.getName(), args[0], "1"); + + else if (args.length == 2) + give(caller, args[0], args[1], "1"); + + else + give(caller, args[0], args[1], args[2]); + + } + + public void help(Player caller) + { + UtilPlayer.message(caller, F.main("Give", "Commands List;")); + UtilPlayer.message(caller, F.help("/g (amount)", "Give Item to Self", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/g (amount)", "Give Item to Player", Rank.ADMIN)); + } + + public void give(Player caller, String target, String name, String amount) + { + //Item + LinkedList itemList = new LinkedList(); + itemList = Util().Items().matchItem(caller, name, true); + if (itemList.isEmpty()) return; + + //Player + LinkedList giveList = new LinkedList(); + + if (target.equalsIgnoreCase("all")) + { + for (Player cur : UtilServer.getPlayers()) + giveList.add(cur); + } + else + { + giveList = UtilPlayer.matchOnline(caller, target, true); + if (giveList.isEmpty()) return; + } + + + //Amount + int count = 1; + try + { + count = Integer.parseInt(amount); + + if (count < 1) + { + UtilPlayer.message(caller, F.main("Give", "Invalid Amount [" + amount + "]. Defaulting to [1].")); + count = 1; + } + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main("Give", "Invalid Amount [" + amount + "]. Defaulting to [1].")); + } + + //Create + String givenList = ""; + for (Player cur : giveList) + givenList += cur.getName() + " "; + if (givenList.length() > 0) + givenList = givenList.substring(0, givenList.length()-1); + + for (Material curItem : itemList) + { + for (Player cur : giveList) + { + ItemStack stack = ItemStackFactory.Instance.CreateStack(curItem, count); + + //Give + if (UtilInv.insert(cur, stack)) + { + //Inform + if (!cur.equals(caller)) + UtilPlayer.message(cur, F.main("Give", "You received " + F.item(count + " " + ItemStackFactory.Instance.GetName(curItem, (byte)0, false)) + " from " + F.elem(caller.getName()) + ".")); + } + } + + if (target.equalsIgnoreCase("all")) + UtilPlayer.message(caller, F.main("Give", "You gave " + F.item(count + " " + ItemStackFactory.Instance.GetName(curItem, (byte)0, false)) + " to " + F.elem("ALL")) + "."); + + else if (giveList.size() > 1) + UtilPlayer.message(caller, F.main("Give", "You gave " + F.item(count + " " + ItemStackFactory.Instance.GetName(curItem, (byte)0, false)) + " to " + F.elem(givenList) + ".")); + + else + UtilPlayer.message(caller, F.main("Give", "You gave " + F.item(count + " " + ItemStackFactory.Instance.GetName(curItem, (byte)0, false)) + " to " + F.elem(giveList.getFirst().getName()) + ".")); + + + //Log + Log("Gave [" + count + " " + ItemStackFactory.Instance.GetName(curItem, (byte)0, false) + "] to [" + givenList + "] from [" + caller.getName() + "]."); + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/Ignore.java b/Plugins/Core/src/me/chiss/Core/Modules/Ignore.java new file mode 100644 index 000000000..c5bc8dcee --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/Ignore.java @@ -0,0 +1,87 @@ +package me.chiss.Core.Modules; + +import java.util.List; + + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import me.chiss.Core.Module.AModule; +import mineplex.core.server.IRepository; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +public class Ignore extends AModule +{ + public Ignore(JavaPlugin plugin, IRepository repository) + { + super("Ignore", plugin, repository); + } + + //Module Functions + @Override + public void enable() + { + + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("ignore"); + AddCommand("i"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (args.length == 0) + return; //UtilPlayer.message(caller, Clients().Get(caller).Ignore().Display()); + + else + ignore(caller, args[0]); + } + + public void ignore(final Player caller, final String arg) + { + if (!Recharge().use(caller, "Ignore Command", 2000, true)) + return; + + GetRepository().MatchPlayerName(new Callback>() + { + public void run(List matches) + { + UtilPlayer.searchOffline(matches, new Callback() + { + public void run(String target) + { + if (target == null) + return; + + if (!caller.isOnline()) + return; + + boolean muted = Clients().Get(caller).Ignore().ToggleIgnore(target); + + if (muted) UtilPlayer.message(caller, F.main(_moduleName, "You ignored " + F.name(target) + ".")); + else UtilPlayer.message(caller, F.main(_moduleName, "You unignored " + F.name(target) + ".")); + } + }, caller, arg, true); + } + }, arg); + + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/Information.java b/Plugins/Core/src/me/chiss/Core/Modules/Information.java new file mode 100644 index 000000000..266bdbfee --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/Information.java @@ -0,0 +1,304 @@ +package me.chiss.Core.Modules; + +import java.util.LinkedList; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import me.chiss.Core.Module.AModule; +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; + +public class Information extends AModule +{ + public Information(JavaPlugin plugin) + { + super("Client Information", plugin); + + AddCommand("x"); + AddCommand("info"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (args.length == 0 || args[0].equals("help")) + { + help(caller); + return; + } + + Handle(caller, args); + } + + private void help(Player caller) + { + + } + + public void Handle(Player caller, String[] args) + { + //Get Client + CoreClient target = null; + if (args.length >= 2) + { + Player other = UtilPlayer.searchOnline(caller, args[1], true); + if (other == null) + { + UtilPlayer.message(caller, C.cDGray + "-- Offline Player Data Coming Soon --"); + return; + } + + target = Clients().Get(other); + } + else + { + target = Clients().Get(caller); + } + + if (target == null) + return; + + //Element + if (args[0].equals("acc") || args[0].equals("account")) + Account(caller, target); + + else if (args[0].equals("acc")) + Account(caller, target); + + else if (args[0].equals("nac")) + NAC(caller, target); + + else if (args[0].equals("ban")) + Ban(caller, target); + + else if (args[0].equals("mute")) + Mute(caller, target); + + else if (args[0].equals("alias")) + Alias(caller, target); + + else if (args[0].equals("clan")) + Clan(caller, target); + + else if (args[0].equals("ignore")) + Ignore(caller, target); + } + + public void Account(Player caller, CoreClient target) + { + CoreClient self = Clients().Get(caller); + LinkedList out = new LinkedList(); + + //Header + out.add(F.main(GetName(), "Account Information - " + target.GetPlayerName())); + + //Public + out.add(F.value("Play Time", UtilTime.convertString(target.Acc().GetPlayTime(), 1, TimeUnit.FIT))); + out.add(F.value("Play Count", target.Acc().GetLoginCount()+"")); + out.add(F.value("Last Login", UtilTime.convertString(System.currentTimeMillis() - target.Acc().GetLoginLast(), 1, TimeUnit.FIT) + " Ago")); + + //IP Alias > Mod + if (self.Rank().Has(Rank.MODERATOR, false)) + { + out.add(F.value("IP Count", target.Acc().GetListIP().size() + "")); + + String alias = ""; + + for (String cur :target.Acc().GetAliasIP()) + alias += cur + " "; + + if (alias.length() == 0) + alias = "None"; + + out.add(F.value("IP Alias", alias)); + } + + //MAC Alias > Admin + if (self.Rank().Has(Rank.ADMIN, false)) + { + out.add(F.value("MAC Count", target.Acc().GetListMAC().size() + "")); + + String alias = ""; + + for (String cur : target.Acc().GetAliasMAC()) + alias += cur + " "; + + if (alias.length() == 0) + alias = "None"; + + out.add(F.value("MAC Alias", alias)); + } + + //Send + UtilPlayer.message(caller, out); + } + + public void NAC(Player caller, CoreClient target) + { + CoreClient self = Clients().Get(caller); + LinkedList out = new LinkedList(); + + //Header + out.add(F.main(GetName(), "NAC Information - " + target.GetPlayerName())); + + //Requirement + if (target.NAC().IsRequired()) + { + if (target.NAC().GetRequired()) + { + out.add(F.value("Required", "True", true)); + out.add(F.value(1, "Date", target.NAC().GetDate())); + out.add(F.value(1, "Admin", target.NAC().GetAdmin())); + out.add(F.value(1, "Reason", target.NAC().GetReason())); + } + else + { + out.add(F.value("Required", "True", true)); + out.add(F.value(1, "Time Played", UtilTime.convertString(target.Acc().GetPlayTime(), 1, TimeUnit.FIT))); + } + } + else + { + out.add(F.value("Required", "False", false)); + out.add(F.value(1, "Time Played", UtilTime.convertString(target.Acc().GetPlayTime(), 1, TimeUnit.FIT))); + out.add(F.value(1, "Required In", UtilTime.convertString(target.NAC().GetRequireTime() - target.Acc().GetPlayTime(), 1, TimeUnit.FIT))); + } + + if (!UtilPlayer.isOnline(target.GetPlayerName())) + return; + + //Usage + if (target.NAC().IsUsing()) + { + out.add(F.value("Using CAH", "True", true)); + out.add(F.value(1, "Build", target.NAC().GetPack())); + + if (self.Rank().Has(Rank.ADMIN, false)) + out.add(F.value(1, "Token", target.NAC().GetToken())); + } + else + { + out.add(F.value("Using CAH", "False", false)); + if (self.Rank().Has(Rank.ADMIN, false)) + { + out.add(F.value(1, "Build", target.NAC().GetPack())); + out.add(F.value(1, "Token", target.NAC().GetToken())); + } + } + + //Send + UtilPlayer.message(caller, out); + } + + public void Ban(Player caller, CoreClient target) + { + LinkedList out = new LinkedList(); + + //Header + out.add(F.main(GetName(), "Ban Information - " + target.GetPlayerName())); + + if (target.Ban().GetBan() != null) + { + out.add(F.value(1, "Banned", F.tf(true))); + + out.add(F.value(1, "Date", UtilTime.when(target.Ban().GetBan().GetBanTime()))); + out.add(F.value(1, "Duration", UtilTime.convertString(target.Ban().GetBan().GetBanDuration(), 1, TimeUnit.FIT))); + + if (target.Ban().GetBan().GetBanDuration() > 0) + out.add(F.value(1, "Remaining", target.Ban().GetBan().RemainingString())); + + out.add(F.value(1, "Admin", target.Ban().GetBan().GetAdmin())); + out.add(F.value(1, "Rank", target.Ban().GetBan().GetRank().toString())); + out.add(F.value(1, "Reason", target.Ban().GetBan().GetReason())); + + if (target.Ban().GetBan().IsAliasBan()) out.add(F.value(1, "Alias Ban", "True", true)); + else out.add(F.value(1, "Alias Ban", "False", false)); + + if (!target.Ban().GetBan().Active()) out.add(F.value(1, "Unbanned", "True", true)); + else out.add(F.value(1, "Unbanned", "False", false)); + } + else + { + out.add(F.value(1, "Banned", F.tf(false))); + } + + //Send + UtilPlayer.message(caller, out); + } + + public void Mute(Player caller, CoreClient target) + { + LinkedList out = new LinkedList(); + + //Header + out.add(F.main(GetName(), "Mute Information - " + target.GetPlayerName())); + + //Send + UtilPlayer.message(caller, out); + } + + public void Alias(Player caller, CoreClient target) + { + LinkedList out = new LinkedList(); + + //Header + out.add(F.main(GetName(), "Alias Information - " + target.GetPlayerName())); + + //Send + UtilPlayer.message(caller, out); + } + + public void Clan(Player caller, CoreClient target) + { + LinkedList out = new LinkedList(); + + //Header + out.add(F.main(GetName(), "Clan Information - " + target.GetPlayerName())); + + if (target.Clan().GetClanName().equals("")) + { + out.add(F.value("Clan", "No Clan", false)); + } + else + { + out.add(F.value("Clan", target.Clan().GetClanName())); + out.add(F.value("Invited By", target.Clan().GetInviter())); + } + + if (target.Clan().CanJoin()) + out.add(F.value("Leave Timer", "No Timer", true)); + else + out.add(F.value("Leave Timer", UtilTime.convertString(System.currentTimeMillis() - target.Clan().GetDelay(), 1, TimeUnit.FIT), false)); + + //Send + UtilPlayer.message(caller, out); + } + + public void Ignore(Player caller, CoreClient target) + { + LinkedList out = new LinkedList(); + + //Header + out.add(F.main(GetName(), "Ignore Information - " + target.GetPlayerName())); + + String ignoreString = ""; + + for (String cur : UtilAlg.sortKey(target.Ignore().GetIgnored())) + ignoreString += cur + " "; + + if (ignoreString.length() == 0) + ignoreString = "Empty"; + + out.add(F.value("Ignore List", ignoreString)); + + //Send + UtilPlayer.message(caller, out); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/JoinQuit.java b/Plugins/Core/src/me/chiss/Core/Modules/JoinQuit.java new file mode 100644 index 000000000..434fc392d --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/JoinQuit.java @@ -0,0 +1,22 @@ +package me.chiss.Core.Modules; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import mineplex.core.common.util.F; + +public class JoinQuit +{ + @EventHandler + public void Join(PlayerJoinEvent event) + { + event.setJoinMessage(F.sys("Join", event.getPlayer().getName())); + } + + @EventHandler + public void Quit(PlayerQuitEvent event) + { + event.setQuitMessage(F.sys("Quit", event.getPlayer().getName())); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/Logger.java b/Plugins/Core/src/me/chiss/Core/Modules/Logger.java new file mode 100644 index 000000000..8878a84ac --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/Logger.java @@ -0,0 +1,100 @@ +package me.chiss.Core.Modules; + +import me.chiss.Core.Module.AModule; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class Logger extends AModule +{ + public Logger(JavaPlugin plugin) + { + super("Logger", plugin); + } + + //Module Functions + @Override + public void enable() + { + + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + + } + + @EventHandler + public void handleCommand(PlayerCommandPreprocessEvent event) + { + /* + String statement = "INSERT INTO log_command (client, command, location, date, systime) VALUES (?, ?, ?, ?, ?)"; + + try + { + PreparedStatement stmt = SQL().prepareStatement(statement, DB.LOCAL); + + stmt.setString(1, event.getPlayer().getName()); + stmt.setString(2, event.getMessage()); + stmt.setString(3, UtilWorld.locToStr(event.getPlayer().getLocation())); + stmt.setString(4, UtilTime.now()); + stmt.setLong(5, System.currentTimeMillis()); + + SQL().doStatement(stmt, DB.LOCAL, true); + } + catch (SQLException e) + { + Log("Statement: " + statement); + Log(DB.LOCAL + " Error: " + e.getMessage()); + } + */ + } + + public void logChat(String type, Player from, String to, String message) + { + /* + String statement = "INSERT INTO log_chat (date, type, m_from, m_to, message, location, systime) VALUES (?, ?, ?, ?, ?, ?, ?)"; + + try + { + PreparedStatement stmt = SQL().prepareStatement(statement, DB.LOCAL); + + stmt.setString(1, UtilTime.now()); + stmt.setString(2, type); + stmt.setString(3, from.getName()); + stmt.setString(4, to); + stmt.setString(5, message); + stmt.setString(6, UtilWorld.locToStrClean(from.getLocation())); + stmt.setLong(7, System.currentTimeMillis()); + + SQL().doStatement(stmt, DB.LOCAL, true); + } + catch (SQLException e) + { + Log("Statement: " + statement); + Log(DB.LOCAL + " Error: " + e.getMessage()); + } + */ + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/Observer.java b/Plugins/Core/src/me/chiss/Core/Modules/Observer.java new file mode 100644 index 000000000..c94031755 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/Observer.java @@ -0,0 +1,216 @@ +package me.chiss.Core.Modules; + +import java.util.WeakHashMap; + +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryOpenEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import me.chiss.Core.Module.AModule; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemStackFactory; + +public class Observer extends AModule +{ + private WeakHashMap _obs = new WeakHashMap(); + + public Observer(JavaPlugin plugin) + { + super("Observer", plugin); + } + + //Module Functions + @Override + public void enable() + { + + } + + @Override + public void disable() + { + for (Player player : _obs.keySet()) + remove(player, false); + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("o"); + AddCommand("obs"); + AddCommand("observer"); + AddCommand("z"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (!Clients().Get(caller).Rank().Has(Rank.MODERATOR, true)) + return; + + if (isObserver(caller, false)) remove(caller, true); + else add(caller, true); + } + + @EventHandler + public void handleJoin(PlayerQuitEvent event) + { + event.getPlayer().setGameMode(GameMode.SURVIVAL); + remove(event.getPlayer(), false); + } + + public void add(Player player, boolean inform) + { + _obs.put(player, player.getLocation()); + player.setGameMode(GameMode.CREATIVE); + UtilInv.Clear(player); + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.WEB, 1)); + + if (inform) + UtilPlayer.message(player, F.main(_moduleName, "You entered Observer Mode.")); + } + + public boolean remove(Player player, boolean inform) + { + Location loc = _obs.remove(player); + if (loc != null && inform) + { + UtilPlayer.message(player, F.main(_moduleName, "You left Observer Mode.")); + player.setGameMode(GameMode.SURVIVAL); + UtilInv.Clear(player); + Teleport().TP(player, loc); + return true; + } + + return false; + } + + + public boolean isObserver(Player player, boolean adminReq) + { + if (adminReq) + { + if (_obs.containsKey(player) && Clients().Get(player).Rank().Has(Rank.ADMIN, false)) + return true; + } + else if (_obs.containsKey(player)) + return true; + + return false; + } + + //Invisible + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player player : _obs.keySet()) + Condition().Factory().Cloak("Observer", player, player, 1.9, false, true); + } + + //Inventory Open + @EventHandler + public void handleInventoryOpen(InventoryOpenEvent event) + { + //Not Obs + if (!_obs.containsKey((Entity)event.getPlayer())) + return; + + //Non-Admin > DISALLOW ALL + if (!Clients().Get(event.getPlayer().getName()).Rank().Has(Rank.ADMIN, false)) + { + + UtilPlayer.message(UtilPlayer.searchExact(event.getPlayer().getName()), F.main(_moduleName, "You cannot open Inventory.")); + event.setCancelled(true); + return; + } + } + + @EventHandler + public void handleInventoryClick(InventoryClickEvent event) + { + //Not Obs + if (!_obs.containsKey((Entity)event.getWhoClicked())) + return; + + UtilPlayer.message(UtilPlayer.searchExact(event.getWhoClicked().getName()), F.main(_moduleName, "You cannot interact with Inventory.")); + event.getWhoClicked().closeInventory(); + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void handlePickup(PlayerPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (_obs.containsKey((Entity)event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void handleDrop(PlayerDropItemEvent event) + { + if (event.isCancelled()) + return; + + if (_obs.containsKey((Entity)event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void handleBlockPlace(BlockPlaceEvent event) + { + if (event.isCancelled()) + return; + + if (_obs.containsKey((Entity)event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void handleBlockBreak(BlockBreakEvent event) + { + if (event.isCancelled()) + return; + + if (_obs.containsKey((Entity)event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void handleDamage(CustomDamageEvent event) + { + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + if (_obs.containsKey((Entity)damager)) + event.SetCancelled("Observer Mode"); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/PlayerInfo.java b/Plugins/Core/src/me/chiss/Core/Modules/PlayerInfo.java new file mode 100644 index 000000000..81e45a2de --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/PlayerInfo.java @@ -0,0 +1,70 @@ +package me.chiss.Core.Modules; + +import me.chiss.Core.ClientData.ClientPlayer; +import me.chiss.Core.Module.AModule; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; + +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class PlayerInfo extends AModule +{ + public PlayerInfo(JavaPlugin plugin) + { + super("Player Update", plugin); + } + + //Module Functions + @Override + public void enable() + { + + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + + } + + @EventHandler + public void handleInteract(PlayerInteractEvent event) + { + if (event.getAction() == Action.PHYSICAL) + return; + + Clients().Get(event.getPlayer()).Player().SetLastAction(System.currentTimeMillis()); + } + + @EventHandler + public void handleJoin(PlayerJoinEvent event) + { + Clients().Get(event.getPlayer()).Acc().SetLoginLast(System.currentTimeMillis()); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/PointManager.java b/Plugins/Core/src/me/chiss/Core/Modules/PointManager.java new file mode 100644 index 000000000..1df362e4c --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/PointManager.java @@ -0,0 +1,521 @@ +package me.chiss.Core.Modules; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.HashMap; + +import me.chiss.Core.Clans.ClansClan; +import me.chiss.Core.Clans.ClansUtility.ClanRelation; +import me.chiss.Core.ClientData.ClientGame; +import me.chiss.Core.Module.AModule; +import me.chiss.Core.Scheduler.IScheduleListener; +import me.chiss.Core.Scheduler.Scheduler; +import mineplex.core.server.IRepository; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.donation.repository.token.PlayerUpdateToken; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.inventory.InventoryOpenEvent; +import org.bukkit.event.inventory.InventoryPickupItemEvent; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class PointManager extends AModule implements IScheduleListener +{ + private IRepository Repository; + + private long _interval = 900000; + + private String _folder = "data/pph/"; + + private HashMap _quitMap = new HashMap(); + private HashMap _pointTotals = new HashMap(); + + + private int _maxPPH; + + private int _pphOnline; + + private int _pphOnlineClan; + private int _pphOfflineClan; + + private int _pphOnlinePet; + private int _pphOfflinePet; + + private int _pphNAC; + + public PointManager(JavaPlugin plugin, Scheduler scheduler, IRepository repository, int maxPPH, int pphOnline, int pphOnlineClanAge, int pphOfflineClanAge, int pphOnlinePetLevel, int pphOfflinePetLevel, int pphNAC) + { + super("Point Manager", plugin); + + scheduler.ScheduleDailyRecurring(this, 0); + + Repository = repository; + + //Dir + File file = new File(_folder); + file.mkdirs(); + + + _maxPPH = maxPPH; + _pphOnline = pphOnline; + + _pphOnlineClan = pphOnlineClanAge; + _pphOfflineClan = pphOfflineClanAge; + + _pphOnlinePet = pphOnlinePetLevel; + _pphOfflinePet = pphOfflinePetLevel; + + _pphNAC = pphNAC; + } + + //Module Functions + @Override + public void enable() + { + + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + + } + + @EventHandler(priority = EventPriority.LOWEST) + public void Drop(PlayerDropItemEvent event) + { + if (event.isCancelled()) + return; + + if (event.getItemDrop().getItemStack().getType() != Material.EMERALD) + return; + + UtilPlayer.message(event.getPlayer(), F.main("Loot", "You cannot drop " + F.item("Emerald") + ".")); + + event.setCancelled(true); + } + + @EventHandler + public void Pickup(PlayerPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (event.getItem().getItemStack().getType() != Material.EMERALD) + return; + + //Effect + event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 0.5f, 1f); + } + + @EventHandler + public void HopperPickup(InventoryPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (event.getItem().getItemStack().getType() != Material.EMERALD) + return; + + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void Inventory(InventoryOpenEvent event) + { + if (event.isCancelled()) + return; + + if (!event.getPlayer().getInventory().contains(Material.EMERALD)) + return; + + UtilPlayer.message(event.getPlayer(), F.main("Loot", "You cannot use this while holding " + F.item("Emerald") + ".")); + + event.setCancelled(true); + } + + @EventHandler + public void Deposit(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (player.getItemInHand() == null) + return; + + if (player.getItemInHand().getType() != Material.EMERALD) + return; + + if (!Clans().CUtil().isClaimed(player.getLocation()) || + Clans().CUtil().getAccess(player, player.getLocation()) != ClanRelation.SELF) + { + UtilPlayer.message(event.getPlayer(), F.main("Loot", "You can only claim " + F.item("Emerald") + + " in your Territory.")); + return; + } + + int amount = UtilInv.removeAll(player, Material.EMERALD, (byte)0); + int per = 1000; + + UtilPlayer.message(event.getPlayer(), F.main("Loot", "You claimed " + F.item(amount + " Emeralds") + + " for " + F.count((amount * per) + " Coins") + ".")); + + //Economy + Clients().Get(player).Game().ModifyEconomyBalance(amount * per); + + //Effect + player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 2f); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void AsyncLogin(AsyncPlayerPreLoginEvent event) + { + if (event.getLoginResult() != Result.ALLOWED) + return; + + long quit = ReadQuit(event.getName()); + + Clients().Get(event.getName()).Game().SetLastPPH(System.currentTimeMillis()); + + if (!UtilTime.elapsed(quit, 3600000)) + return; + + _quitMap.put(event.getName(), quit); + WriteQuit(event.getName()); + } + + @EventHandler + public void Quit(PlayerQuitEvent event) + { + _quitMap.remove(event.getPlayer().getName()); + WriteQuit(event.getPlayer().getName()); + } + + @EventHandler + public void UpdateOffline(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + for (String name : _quitMap.keySet()) + { + Player cur = UtilPlayer.searchExact(name); + if (cur == null) continue; + + boolean capped = false; + + if (!_pointTotals.containsKey(cur.getName())) + _pointTotals.put(cur.getName(), 0); + if ( _pointTotals.get(cur.getName()) >= _maxPPH) + capped = true; + + if (capped) + { + UtilPlayer.message(cur, "§c§lYou have already earned the max of " + _maxPPH + " Points today."); + UtilPlayer.message(cur, F.value("You will earn more in:", UtilTime.convertString(Scheduler.Instance.GetTimeTilNextAppt(this), 1, TimeUnit.FIT))); + continue; + } + + double hours = (System.currentTimeMillis() - _quitMap.get(name)) / 3600000d; + if (hours > 12) + hours = 12; + + double petLevel = 0; + double clanAge = 0; + + ClansClan clan = Clans().CUtil().getClanByPlayer(cur); + if (clan != null) clanAge = (System.currentTimeMillis() - clan.GetDateCreated()) / 86400000d; + if (clanAge > 7) + clanAge = 7; + + int clanPoints = (int) (_pphOfflineClan * clanAge * hours); + int petPoints = (int) (_pphOfflinePet * petLevel * hours); + int totalPoints = clanPoints + petPoints; + boolean hitCap = false; + + if (totalPoints == 0) + continue; + else if (totalPoints + _pointTotals.get(cur.getName()) > _maxPPH) + { + hitCap = true; + totalPoints = _maxPPH - _pointTotals.get(cur.getName()); + } + + UtilPlayer.message(cur, "§c§lOffline Point Reward - " + UtilTime.convertString(System.currentTimeMillis() - _quitMap.get(name), 1, TimeUnit.FIT)); + UtilPlayer.message(cur, F.value("Clan Age", clanPoints + " Points")); + UtilPlayer.message(cur, F.value("Battle Pet", petPoints + " Points")); + UtilPlayer.message(cur, "You received " + F.count(totalPoints + " Points") + "."); + + if (hitCap) + { + UtilPlayer.message(cur, "§c§lYou have already earned the max of " + _maxPPH + " Points today."); + UtilPlayer.message(cur, F.value("You will earn more in:", UtilTime.convertString(Scheduler.Instance.GetTimeTilNextAppt(this), 1, TimeUnit.FIT))); + } + + //Effect + cur.playSound(cur.getLocation(), Sound.LEVEL_UP, 1f, 2f); + + //Give Points + PlayerUpdateToken token = new PlayerUpdateToken(); + token.Name = cur.getName(); + token.Points = totalPoints; + Repository.PlayerUpdate(null, token); + + _pointTotals.put(cur.getName(), _pointTotals.get(cur.getName()) + totalPoints); + } + + _quitMap.clear(); + } + + @EventHandler + public void UpdateOnline(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + for (Player cur : UtilServer.getPlayers()) + { + boolean capped = false; + + if (!_pointTotals.containsKey(cur.getName())) + _pointTotals.put(cur.getName(), 0); + if ( _pointTotals.get(cur.getName()) >= _maxPPH) + capped = true; + + ClientGame client = Clients().Get(cur).Game(); + + if (!UtilTime.elapsed(client.GetLastPPH(), _interval)) //15 Minutes + continue; + + client.SetLastPPH(System.currentTimeMillis()); + + if (capped) + { + UtilPlayer.message(cur, "§c§lYou have already earned the max of " + _maxPPH + " Points today."); + UtilPlayer.message(cur, F.value("You will earn more in:", UtilTime.convertString(Scheduler.Instance.GetTimeTilNextAppt(this), 1, TimeUnit.FIT))); + continue; + } + + double mult = _interval / 3600000d; + + double petLevel = 0; + double clanAge = 0; + + ClansClan clan = Clans().CUtil().getClanByPlayer(cur); + if (clan != null) clanAge = (System.currentTimeMillis() - clan.GetDateCreated()) / 86400000d; + if (clanAge > 7) + clanAge = 7; + + int NACPoints = 0; + + if (Clients().Get(cur).NAC().IsUsing()) + NACPoints = (int) (_pphNAC * mult); + + int clanPoints = (int) (mult * _pphOnlineClan * clanAge); + int petPoints = (int) (mult * _pphOnlinePet * petLevel); + int onlinePoints = (int) (mult * _pphOnline); + + int totalPoints = clanPoints + petPoints + NACPoints + onlinePoints; + boolean hitCap = false; + + if (totalPoints == 0) + continue; + else if (totalPoints + _pointTotals.get(cur.getName()) > _maxPPH) + { + hitCap = true; + totalPoints = _maxPPH - _pointTotals.get(cur.getName()); + } + + UtilPlayer.message(cur, "§a§lOnline Point Reward - " + UtilTime.convertString(_interval, 1, TimeUnit.FIT)); + UtilPlayer.message(cur, F.value("Online", onlinePoints + " Points")); + UtilPlayer.message(cur, F.value("NAC User", NACPoints + " Points")); + UtilPlayer.message(cur, F.value("Clan Age", clanPoints + " Points")); + UtilPlayer.message(cur, F.value("Battle Pet", petPoints + " Points")); + UtilPlayer.message(cur, "You received " + F.count(totalPoints + " Points") + "."); + + if (hitCap) + { + UtilPlayer.message(cur, "§c§lYou have already earned the max of " + _maxPPH + " Points today."); + UtilPlayer.message(cur, F.value("You will earn more in:", UtilTime.convertString(Scheduler.Instance.GetTimeTilNextAppt(this), 1, TimeUnit.FIT))); + } + + //Effect + cur.playSound(cur.getLocation(), Sound.LEVEL_UP, 1f, 2f); + + //Give Points + PlayerUpdateToken token = new PlayerUpdateToken(); + token.Name = cur.getName(); + token.Points = totalPoints; + Repository.PlayerUpdate(null, token); + + _pointTotals.put(cur.getName(), _pointTotals.get(cur.getName()) + totalPoints); + } + } + + private long ReadQuit(String name) + { + long quitTime = System.currentTimeMillis(); + + FileInputStream fstream = null; + DataInputStream in = null; + BufferedReader br = null; + + try + { + File f = new File(_folder + name + ".dat"); + + if (!f.exists()) + return quitTime; + + fstream = new FileInputStream(f); + in = new DataInputStream(fstream); + br = new BufferedReader(new InputStreamReader(in)); + String strLine = br.readLine(); + + try + { + quitTime = Long.parseLong(strLine); + } + catch (Exception e) + { + + } + } + catch (Exception e) + { + System.err.println("Build Read Error: " + e.getMessage()); + } + finally + { + if (br != null) + { + try + { + br.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (in != null) + { + try + { + in.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + + return quitTime; + } + + private void WriteQuit(String name) + { + FileWriter fstream = null; + BufferedWriter out = null; + + try + { + fstream = new FileWriter(_folder + name + ".dat"); + out = new BufferedWriter(fstream); + + out.write("" + System.currentTimeMillis()); + + out.close(); + } + catch (Exception e) + { + System.err.println("PPH Write Error: " + e.getMessage()); + } + finally + { + if (out != null) + { + try + { + out.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + @Override + public void AppointmentFire() + { + _pointTotals.clear(); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/Quit.java b/Plugins/Core/src/me/chiss/Core/Modules/Quit.java new file mode 100644 index 000000000..55fdf16eb --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/Quit.java @@ -0,0 +1,419 @@ +package me.chiss.Core.Modules; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; + +import me.chiss.Core.Clans.ClansClan; +import me.chiss.Core.Clans.ClansUtility.ClanRelation; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import me.chiss.Core.Module.AModule; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerKickEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class Quit extends AModule +{ + //Config + private int _logTime = 10; + private long _rejoinTime = 60000; + + //Track Offline Players + private HashMap _logMap = new HashMap(); + private HashMap _quitMap = new HashMap(); + private HashSet _clearSet = new HashSet(); + + public Quit(JavaPlugin plugin) + { + super("Quit", plugin); + } + + //Module Functions + @Override + public void enable() + { + + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("log"); + AddCommand("quit"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (!checkItems(caller)) + return; + + if (!checkLand(caller)) + return; + + if (!checkWar(caller)) + return; + + //Set + _logMap.put(caller, new QuitDataLog(_logTime, caller.getLocation())); + + //Inform + UtilPlayer.message(caller, F.main(GetName(), "Logging out in " + + F.time(_logTime + " Seconds") + + ".")); + } + + @EventHandler + public void Join(PlayerJoinEvent event) + { + if (_clearSet.remove(event.getPlayer().getName())) + UtilInv.Clear(event.getPlayer()); + + QuitDataQuit quit = _quitMap.get(event.getPlayer().getName()); + + //Set + if (quit != null) + { + quit.SetOffline(false); + Condition().Factory().Silence("Unsafe Log", event.getPlayer(), event.getPlayer(), 10, false, true); + Condition().Factory().Weakness("Unsafe Log", event.getPlayer(), event.getPlayer(), 10, 3, false, true); + Condition().Factory().Slow("Unsafe Log", event.getPlayer(), event.getPlayer(), 10, 3, false, true, false); + } + + //Message + if (quit != null) event.setJoinMessage(F.sys("Join", event.getPlayer().getName() + C.sysHead + " (" + C.cGreen + "Recover" + C.sysHead + ")")); + else event.setJoinMessage(F.sys("Join", event.getPlayer().getName())); + + //Log + System.out.println("Client Join [" + event.getPlayer().getName() + "] with Recovery [" + (quit != null) + "]."); + } + + public void AddQuit(Player player) + { + if (!_quitMap.containsKey(player.getName())) + { + _quitMap.put(player.getName(), new QuitDataQuit(player)); + } + + else + { + if (_quitMap.get(player.getName()).SetOffline(true)) + { + final Player punish = player; + _plugin.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() + { + public void run() + { + Punish(punish.getName()); + } + }, 0); + } + } + } + + @EventHandler + public void Kick(PlayerKickEvent event) + { + QuitDataLog data = _logMap.get(event.getPlayer()); + + boolean safe = false; + if (data != null) + safe = data.GetLogTime() == 0; + + if (event.getPlayer().isDead()) + safe = true; + + if (!safe) + { + boolean clear = false; + for (Player other : event.getPlayer().getWorld().getPlayers()) + if (UtilMath.offset(event.getPlayer(), other) < 32) + if (Clans().CanHurt(event.getPlayer(), other)) + clear = true; + + if (!clear) + safe = true; + } + + int number = 1; + if (_quitMap.containsKey(event.getPlayer().getName())) + number = _quitMap.get(event.getPlayer().getName()).GetCount() + 1; + + //String + String type = C.sysHead + " (" + C.cRed + "Unsafe " + number + "/3" + C.sysHead + ")"; + if (safe) type = C.sysHead + " (" + C.cGreen + "Safe" + C.sysHead + ")"; + + //DONT DO STUFF + + //Message + event.setLeaveMessage(F.sys("Quit", event.getPlayer().getName() + type)); + + //Log + System.out.println("Client Kick [" + event.getPlayer().getName() + "] with Safe [" + safe + "]."); + } + + + @EventHandler + public void Quits(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + + QuitDataLog data = _logMap.remove(player); + + boolean safe = false; + if (data != null) + safe = data.GetLogTime() == 0; + + if (player.isDead()) + safe = true; + + if (!safe) + { + boolean clear = false; + for (Player other : player.getWorld().getPlayers()) + if (UtilMath.offset(player, other) < 32) + if (Clans().CanHurt(player, other)) + clear = true; + + if (!clear) + safe = true; + } + + //Combat Log + if (!player.isDead() && + (!UtilTime.elapsed(Clients().Get(player).Player().GetLastDamagee(), 15000) || + !UtilTime.elapsed(Clients().Get(player).Player().GetLastDamager(), 15000))) + { + //String + String type = C.sysHead + " (" + C.cRed + "Combat Log" + C.sysHead + ")"; + AddQuit(player); + + //Message + event.setQuitMessage(F.sys("Quit", player.getName() + type)); + + //Log + System.out.println("Client Quit [" + player.getName() + "] with Safe [" + "Combat Log" + "]."); + } + //Unsafe Log + else + { + int number = 1; + if (_quitMap.containsKey(player.getName())) + number = _quitMap.get(player.getName()).GetCount() + 1; + + //String + String type = C.sysHead + " (" + C.cRed + "Unsafe " + number + "/3" + C.sysHead + ")"; + if (safe) type = C.sysHead + " (" + C.cGreen + "Safe" + C.sysHead + ")"; + + if (!safe) AddQuit(player); + else _quitMap.remove(player.getName()); + + //Message + event.setQuitMessage(F.sys("Quit", player.getName() + type)); + + //Log + System.out.println("Client Quit [" + player.getName() + "] with Safe [" + safe + "]."); + } + } + + @EventHandler + public void Interact(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + //Inform + if (_logMap.remove(event.getPlayer()) != null) + UtilPlayer.message(event.getPlayer(), F.main(GetName(), "Log cancelled due to action.")); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + //Take Damage + if (!(event.GetDamageeEntity() instanceof Player)) + return; + + Player damagee = (Player)event.GetDamageeEntity(); + + //Inform + if (_logMap.remove(damagee) != null) + UtilPlayer.message(damagee, F.main(GetName(), "Log cancelled due to damage.")); + } + + @EventHandler + public void Pickup(PlayerPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (_logMap.containsKey(event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() == UpdateType.FAST) + updateQuit(); + + if (event.getType() == UpdateType.TICK) + updateLog(); + } + + public void updateLog() + { + for (Iterator i = _logMap.keySet().iterator(); i.hasNext();) + { + Player cur = i.next(); + + QuitDataLog log = _logMap.get(cur); + + if (!UtilTime.elapsed(log.GetLogLast(), 1000)) + continue; + + //Set + log.SetLogTime(log.GetLogTime() - 1); + log.SetLogLast(System.currentTimeMillis()); + + //Safely Log + if (log.GetLogTime() == 0) + { + UtilPlayer.kick(cur, GetName(), "Safely Logged Out", false); + i.remove(); + continue; + } + + //Other + if (UtilMath.offset(log.GetLogLoc(), cur.getLocation()) > 0.5) + { + //Inform + UtilPlayer.message(cur, F.main(GetName(), "Log cancelled due to movement.")); + i.remove(); + } + else + { + //Inform + UtilPlayer.message(cur, F.main(GetName(), "Logging out in " + + F.time(log.GetLogTime() + " Seconds") + + ".")); + } + } + } + + public void updateQuit() + { + HashSet expired = new HashSet(); + HashSet punish = new HashSet(); + + for (String cur : _quitMap.keySet()) + { + QuitDataQuit quit = _quitMap.get(cur); + + if (!UtilTime.elapsed(quit.GetQuitTime(), _rejoinTime)) + continue; + + //Online and Expired + if (!quit.IsOffline()) + { + expired.add(cur); + continue; + } + + //Done + punish.add(cur); + } + + for (String cur : punish) + Punish(cur); + + for (String cur : expired) + { + _quitMap.remove(cur); + System.out.println("Expired [" + cur + "] for staying online."); + } + } + + public void Punish(String cur) + { + Player player = _quitMap.remove(cur).GetPlayer(); + + //Inform + for (Player other : UtilServer.getPlayers()) + UtilPlayer.message(other, F.main("Log", + F.name(player.getName()) + + C.cGray + " dropped inventory for unsafe logging.")); + + //Log + System.out.println("Punished [" + cur + "] for unsafe logging."); + + //Drop Inventory + UtilInv.drop(player, true); + + // + _clearSet.add(player.getName()); + } + + public boolean checkLand(Player caller) + { + if (Clans().CUtil().getAccess(caller, caller.getLocation()) == ClanRelation.NEUTRAL && + !Clans().CUtil().isAdmin(caller.getLocation())) + { + UtilPlayer.message(caller, F.main(GetName(), "You cannot log in enemy territory.")); + return false; + } + + return true; + } + + public boolean checkWar(Player caller) + { + + ClansClan clan = Clans().CUtil().getClanByPlayer(caller); + + if (clan == null) + return true; + + if (clan.GetEnemyEvent().isEmpty()) + return true; + + UtilPlayer.message(caller, F.main(GetName(), "You cannot log during invasion event.")); + return false; + } + + public boolean checkItems(Player player) + { + return (new QuitInventory(this)).Check(player); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/QuitDataLog.java b/Plugins/Core/src/me/chiss/Core/Modules/QuitDataLog.java new file mode 100644 index 000000000..5988a76af --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/QuitDataLog.java @@ -0,0 +1,42 @@ +package me.chiss.Core.Modules; + +import org.bukkit.Location; + +public class QuitDataLog +{ + //Log Timer + private int _logTime = 0; + private long _logLast = 0; + private Location _logLoc = null; + + public QuitDataLog(int time, Location loc) + { + _logTime = time; + _logLast = System.currentTimeMillis(); + _logLoc = loc; + } + + public int GetLogTime() { + return _logTime; + } + + public void SetLogTime(int _logTime) { + this._logTime = _logTime; + } + + public long GetLogLast() { + return _logLast; + } + + public void SetLogLast(long _logLast) { + this._logLast = _logLast; + } + + public Location GetLogLoc() { + return _logLoc; + } + + public void SetLogLoc(Location _logLoc) { + this._logLoc = _logLoc; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/QuitDataQuit.java b/Plugins/Core/src/me/chiss/Core/Modules/QuitDataQuit.java new file mode 100644 index 000000000..243084a56 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/QuitDataQuit.java @@ -0,0 +1,62 @@ +package me.chiss.Core.Modules; + +import org.bukkit.entity.Player; + +public class QuitDataQuit +{ + //Quit + private boolean _offline = false; + private long _quitTime = 0; + private int _quitCount = 0; + + private Player _player = null; + + public QuitDataQuit(Player player) + { + SetOffline(true); + SetPlayer(player); + _quitTime = System.currentTimeMillis(); + } + + public long GetQuitTime() { + return _quitTime; + } + + public void SetQuitTime(long _quitTime) { + this._quitTime = _quitTime; + } + + public boolean IsOffline() { + return _offline; + } + + public boolean SetOffline(boolean offline) + { + this._offline = offline; + + _quitTime = System.currentTimeMillis(); + + if (offline) + { + _quitCount++; + + if (_quitCount >= 3) + return true; + } + + return false; + } + + public int GetCount() + { + return _quitCount; + } + + public Player GetPlayer() { + return _player; + } + + public void SetPlayer(Player _quitRef) { + this._player = _quitRef; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/QuitInventory.java b/Plugins/Core/src/me/chiss/Core/Modules/QuitInventory.java new file mode 100644 index 000000000..3582bdc99 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/QuitInventory.java @@ -0,0 +1,272 @@ +package me.chiss.Core.Modules; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; + +public class QuitInventory +{ + //Quit Limits + public int[] limSword = new int[] {3, 0}; + public int[] limSwordEnch = new int[] {12, 0}; + + public int[] limAxe = new int[] {3, 0}; + public int[] limAxeEnch = new int[] {12, 0}; + + public int[] limBow = new int[] {2, 0}; + public int[] limBowEnch = new int[] {8, 0};; + public int[] limBowArrow = new int[] {128, 0}; + + public int[] limHelm = new int[] {3, 0}; + public int[] limHelmEnch = new int[] {8, 0}; + + public int[] limChest = new int[] {3, 0}; + public int[] limChestEnch = new int[] {8, 0}; + + public int[] limLeg = new int[] {3, 0}; + public int[] limLegEnch = new int[] {8, 0}; + + public int[] limBoot = new int[] {3, 0}; + public int[] limBootEnch = new int[] {8, 0}; + + public int[] limTNT = new int[] {8, 0}; + + public int[] limMaterial = new int[] {128, 0}; + public int[] limEmerald = new int[] {64, 0}; + + private Quit Quit; + public QuitInventory(Quit quit) + { + Quit = quit; + } + + public int CountEnch(ItemStack stack) + { + int count = 0; + + for (int cur : stack.getEnchantments().values()) + count += cur; + + return count; + } + + public boolean Check(Player player) + { + PlayerInventory inv = player.getInventory(); + + for (ItemStack cur : inv.getContents()) + { + if (cur == null) continue; + if (cur.getType() == Material.AIR) continue; + + //Sword + if (cur.getType() == Material.IRON_SWORD) { limSword[1]++; limSwordEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.GOLD_SWORD) { limSword[1]++; limSwordEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.DIAMOND_SWORD) { limSword[1]++; limSwordEnch[1] += CountEnch(cur); } + + //Axe + else if (cur.getType() == Material.IRON_AXE) { limAxe[1]++; limAxeEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.GOLD_AXE) { limAxe[1]++; limAxeEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.DIAMOND_AXE) { limSword[1]++; limSwordEnch[1] += CountEnch(cur); } + + //Bow + else if (cur.getType() == Material.BOW) { limBow[1]++; limBowEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.ARROW) { limBowArrow[1] += cur.getAmount();} + + //Helm + else if (cur.getType() == Material.IRON_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.GOLD_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.DIAMOND_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.LEATHER_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.CHAINMAIL_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); } + + //Chest + else if (cur.getType() == Material.IRON_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.GOLD_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.DIAMOND_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.LEATHER_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.CHAINMAIL_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); } + + //Leg + else if (cur.getType() == Material.IRON_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.GOLD_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.DIAMOND_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.LEATHER_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.CHAINMAIL_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); } + + //Boot + else if (cur.getType() == Material.IRON_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.GOLD_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.DIAMOND_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.LEATHER_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.CHAINMAIL_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); } + + //Items + else if (cur.getType() == Material.TNT) { limTNT[1]++;} + else if (cur.getType() == Material.IRON_ORE) { limMaterial[1]++;} + else if (cur.getType() == Material.IRON_INGOT) { limMaterial[1]++;} + else if (cur.getType() == Material.IRON_BLOCK) { limMaterial[1] += 9;} + else if (cur.getType() == Material.GOLD_ORE) { limMaterial[1]++;} + else if (cur.getType() == Material.GOLD_INGOT) { limMaterial[1]++;} + else if (cur.getType() == Material.GOLD_BLOCK) { limMaterial[1] += 9;} + else if (cur.getType() == Material.DIAMOND) { limMaterial[1]++;} + else if (cur.getType() == Material.DIAMOND_BLOCK) { limMaterial[1] += 9;} + else if (cur.getType() == Material.LEATHER) { limMaterial[1]++;} + else if (cur.getType() == Material.EMERALD) { limEmerald[1]++;} + else if (cur.getType() == Material.EMERALD_BLOCK) { limEmerald[1] += 9;} + } + + for (ItemStack cur : inv.getArmorContents()) + { + if (cur == null) continue; + if (cur.getType() == Material.AIR) continue; + + //Helm + if (cur.getType() == Material.IRON_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.GOLD_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.DIAMOND_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.LEATHER_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.CHAINMAIL_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); } + + //Chest + else if (cur.getType() == Material.IRON_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.GOLD_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.DIAMOND_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.LEATHER_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.CHAINMAIL_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); } + + //Leg + else if (cur.getType() == Material.IRON_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.GOLD_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.DIAMOND_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.LEATHER_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.CHAINMAIL_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); } + + //Boot + else if (cur.getType() == Material.IRON_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.GOLD_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.DIAMOND_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.LEATHER_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); } + else if (cur.getType() == Material.CHAINMAIL_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); } + } + + boolean valid = true; + + //Weapons + if (limSword[1] > limSword[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Swords [" + limSword[1] + "/" + limSword[0] + "].")); + valid = false; + } + + if (limSwordEnch[1] > limSwordEnch[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Sword Enchantments [" + limSwordEnch[1] + "/" + limSwordEnch[0] + "].")); + valid = false; + } + + if (limAxe[1] > limAxe[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Axes [" + limAxe[1] + "/" + limAxe[0] + "].")); + valid = false; + } + + if (limAxeEnch[1] > limAxeEnch[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Axe Enchantments [" + limAxeEnch[1] + "/" + limAxeEnch[0] + "].")); + valid = false; + } + + if (limBow[1] > limBow[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Bows [" + limBow[1] + "/" + limBow[0] + "].")); + valid = false; + } + + if (limBowEnch[1] > limBowEnch[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Bow Enchantments [" + limBowEnch[1] + "/" + limBowEnch[0] + "].")); + valid = false; + } + + if (limBowArrow[1] > limBowArrow[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Arrows [" + limBowArrow[1] + "/" + limBowArrow[0] + "].")); + valid = false; + } + + //Armor + if (limHelm[1] > limHelm[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Helmets [" + limHelm[1] + "/" + limHelm[0] + "].")); + valid = false; + } + + if (limHelmEnch[1] > limHelmEnch[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Helmet Enchantments [" + limHelmEnch[1] + "/" + limHelmEnch[0] + "].")); + valid = false; + } + + if (limChest[1] > limChest[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Chestplates [" + limChest[1] + "/" + limChest[0] + "].")); + valid = false; + } + + if (limChestEnch[1] > limChestEnch[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Chestplate Enchantments [" + limChestEnch[1] + "/" + limChestEnch[0] + "].")); + valid = false; + } + + if (limLeg[1] > limLeg[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Leggings [" + limLeg[1] + "/" + limLeg[0] + "].")); + valid = false; + } + + if (limLegEnch[1] > limLegEnch[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Legging Enchantments [" + limLegEnch[1] + "/" + limLegEnch[0] + "].")); + valid = false; + } + + if (limBoot[1] > limBoot[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Boots [" + limBoot[1] + "/" + limBoot[0] + "].")); + valid = false; + } + + if (limBootEnch[1] > limBootEnch[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Boot Enchantments [" + limBootEnch[1] + "/" + limBootEnch[0] + "].")); + valid = false; + } + + //Items + if (limTNT[1] > limTNT[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too much TNT [" + limTNT[1] + "/" + limTNT[0] + "].")); + valid = false; + } + + if (limMaterial[1] > limMaterial[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too much Ore/Material [" + limMaterial[1] + "/" + limMaterial[0] + "].")); + valid = false; + } + + if (limEmerald[1] > limEmerald[0]) + { + UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Emeralds [" + limEmerald[1] + "/" + limEmerald[0] + "].")); + valid = false; + } + + return valid; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/Tester.java b/Plugins/Core/src/me/chiss/Core/Modules/Tester.java new file mode 100644 index 000000000..b73ef7daa --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/Tester.java @@ -0,0 +1,532 @@ +package me.chiss.Core.Modules; + +import java.util.HashMap; +import java.util.HashSet; + +import me.chiss.Core.Module.AModule; +import mineplex.core.common.Rank; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.fakeEntity.FakeEntity; +import mineplex.core.fakeEntity.FakeEntityManager; +import mineplex.core.fakeEntity.FakePlayer; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import net.minecraft.server.v1_6_R2.EntityInsentient; +import net.minecraft.server.v1_6_R2.EntityLiving; +import net.minecraft.server.v1_6_R2.EntityPlayer; +import net.minecraft.server.v1_6_R2.MathHelper; +import net.minecraft.server.v1_6_R2.Packet28EntityVelocity; +import net.minecraft.server.v1_6_R2.Packet31RelEntityMove; +import net.minecraft.server.v1_6_R2.Packet34EntityTeleport; +import net.minecraft.server.v1_6_R2.PathfinderGoalSelector; + +import org.bukkit.Bukkit; +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_6_R2.CraftWorld; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftAgeable; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class Tester extends AModule +{ + private HashMap> _test = new HashMap>(); + + private HashMap _speed = new HashMap(); + private HashMap _speedVert = new HashMap(); + + public Tester(JavaPlugin plugin) + { + super("Tester", plugin); + } + + //Module Functions + @Override + public void enable() + { + + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("e1"); + AddCommand("spleef"); + AddCommand("coinset"); + AddCommand("sin"); + AddCommand("wi"); + AddCommand("arraylist"); + AddCommand("spinme"); + AddCommand("karts"); + AddCommand("blocks"); + AddCommand("testi"); + AddCommand("flag"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) + return; + + if (cmd.equals("coinset")) + { + Clients().Get(caller).Game().SetEconomyBalance(100000); + } + + if (cmd.equals("sin")) + { + try + { + double a = Double.parseDouble(args[0]); + caller.sendMessage("sin(" + a + ") = " + Math.sin(a)); + } + catch (Exception e) + { + + } + } + + if (!_test.containsKey(caller)) + _test.put(caller, new HashSet()); + + if (cmd.equals("e1")) + { + if (!_test.get(caller).remove("e1")) + _test.get(caller).add("e1"); + + caller.sendMessage("Toggled E1"); + } + + if (cmd.equals("wi")) + { + caller.sendMessage("Block: " + caller.getLocation().getBlock().getTypeId() + ":" + caller.getLocation().getBlock().getData()); + } + + if (cmd.equals("arraylist")) + { + + } + + if (cmd.equals("spinme")) + { + SpinHim(caller); + } + + if (cmd.equals("karts")) + { + ShowPlayersInKarts(); + } + + if (cmd.equals("blocks")) + { + ShowBlocks(caller); + } + + if (cmd.equals("testi")) + { + ShowBobInvis(caller); + } + + if (cmd.equals("flag")) + { + TestFlag(caller); + } + + if (cmd.equals("fakepig")) + { + ShowFakePig(caller); + } + + if (cmd.equals("fakeperson")) + { + ShowRealPig(caller); + } + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : _test.keySet()) + if (_test.get(cur).contains("e1")) + cur.getWorld().playEffect(cur.getLocation().add(0, 2, 0), Effect.ENDER_SIGNAL, 0); + } + + @EventHandler + public void Spleef(PlayerInteractEvent event) + { + if (!event.getPlayer().getName().equals("Chiss")) + return; + + if (event.getClickedBlock() == null) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (event.getPlayer().getItemInHand().getType() != Material.BOWL) + return; + + event.getPlayer().sendMessage("Light Level: " + event.getClickedBlock().getLightFromSky()); + } + + public Vector GetSpeed(Player player) + { + if (!_speed.containsKey(player)) + _speed.put(player, new Vector(0,0,0)); + + return _speed.get(player); + } + + public double GetSpeedVert(Player player) + { + if (!_speedVert.containsKey(player)) + _speedVert.put(player, 0d); + + return _speedVert.get(player); + } + + public void ShowBobInvis(Player player) + { + final EntityPlayer mcPlayer = ((CraftPlayer)player).getHandle(); + final FakePlayer fakePlayer = new FakePlayer("BOB", player.getEyeLocation().add(1, 0, -3)); + + mcPlayer.playerConnection.sendPacket(fakePlayer.Spawn()); + + Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable() + { + public void run() + { + mcPlayer.playerConnection.sendPacket(fakePlayer.Hide()); + System.out.println("Sent meta packet"); + } + }, 20L); + } + + public void ShowBlocks(Player player) + { + EntityPlayer mcPlayer = ((CraftPlayer)player).getHandle(); + /* + final FakePlayer fakePlayer = new FakePlayer("BOB", player.getEyeLocation().add(1, 0, 0)); + final FakePlayer fakePlayer2 = new FakePlayer("BOB2", player.getEyeLocation().add(0, 0, 1)); + final FakePlayer fakePlayer3 = new FakePlayer("BOB3", player.getEyeLocation().add(-1, 0, 0)); + + final FakeEntity fakePlayer = new FakeEntity(EntityType.GHAST, player.getLocation().add(1, -3, 0)); + final FakeEntity fakePlayer2 = new FakeEntity(EntityType.GHAST, player.getLocation().add(0, -3, 1)); + final FakeEntity fakePlayer3 = new FakeEntity(EntityType.GHAST, player.getLocation().add(-1, -3, 0)); + */ + // Falling blocks + /* + FakeEntity entity = new FakeFallingBlock(Material.LAVA.getId(), (byte)0, player.getLocation().add(1, 0, 0)); + FakeEntity entity2 = new FakeFallingBlock(Material.LAVA.getId(), (byte)0, player.getLocation().add(1, 0, 0)); + FakeEntity entity3 = new FakeFallingBlock(Material.LAVA.getId(), (byte)0, player.getLocation().add(1, 0, 0)); + */ + + final FakeEntity entity = new FakeEntity(EntityType.SLIME, player.getLocation().add(1.5, 0, 0)); + final FakeEntity entity2 = new FakeEntity(EntityType.SLIME, player.getLocation().add(0, 0, 1.5)); + final FakeEntity entity3 = new FakeEntity(EntityType.SLIME, player.getLocation().add(-1.5, 0, 0)); + + //FakeEntityManager.Instance.AddFakeEntity(fakePlayer, player.getName()); + FakeEntityManager.Instance.AddFakeEntity(entity, player.getName()); + //FakeEntityManager.Instance.AddFakeEntity(fakePlayer2, player.getName()); + FakeEntityManager.Instance.AddFakeEntity(entity2, player.getName()); + //FakeEntityManager.Instance.AddFakeEntity(fakePlayer3, player.getName()); + FakeEntityManager.Instance.AddFakeEntity(entity3, player.getName()); + + //mcPlayer.playerConnection.sendPacket(fakePlayer.Spawn()); + mcPlayer.playerConnection.sendPacket(entity.Spawn()); + //mcPlayer.playerConnection.sendPacket(fakePlayer.SetPassenger(entity.GetEntityId())); + //mcPlayer.playerConnection.sendPacket(fakePlayer.Hide()); + + //mcPlayer.playerConnection.sendPacket(fakePlayer2.Spawn()); + mcPlayer.playerConnection.sendPacket(entity2.Spawn()); + //mcPlayer.playerConnection.sendPacket(fakePlayer2.SetPassenger(entity2.GetEntityId())); + //mcPlayer.playerConnection.sendPacket(fakePlayer2.Hide()); + + //mcPlayer.playerConnection.sendPacket(fakePlayer3.Spawn()); + mcPlayer.playerConnection.sendPacket(entity3.Spawn()); + //mcPlayer.playerConnection.sendPacket(fakePlayer3.SetPassenger(entity3.GetEntityId())); + //mcPlayer.playerConnection.sendPacket(fakePlayer3.Hide()); + + /* + for (int i=0; i < 21; i++) + { + Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable() + { + public void run() + { + mcPlayer.playerConnection.sendPacket(new Packet28EntityVelocity(fakePlayer.GetEntityId(), .1, 0, 0)); + mcPlayer.playerConnection.sendPacket(new Packet31RelEntityMove(fakePlayer.GetEntityId(), (byte)(1), (byte)0, (byte)0)); + } + }, i); + } + */ + + new UpdateThread(mcPlayer, entity, entity2, entity3).start(); + } + + public void ShowFakePig(Player player) + { + FakeEntity entity = new FakeEntity(EntityType.PIG, player.getLocation()); + + final EntityPlayer mcPlayer = ((CraftPlayer)player).getHandle(); + + mcPlayer.playerConnection.sendPacket(entity.Spawn()); + mcPlayer.playerConnection.sendPacket(new Packet28EntityVelocity(entity.GetEntityId(), 100, 0, 0)); + } + + public void ShowRealPig(Player player) + { + FakePlayer fakePlayer = new FakePlayer(player.getName() + "1", player.getLocation()); + + final EntityPlayer mcPlayer = ((CraftPlayer)player).getHandle(); + + mcPlayer.playerConnection.sendPacket(fakePlayer.Spawn()); + mcPlayer.playerConnection.sendPacket(new Packet28EntityVelocity(fakePlayer.GetEntityId(), 10000, 0, 0)); + } + + public void ShowPlayersInKarts() + { + for (Player player : Bukkit.getOnlinePlayers()) + { + FakeEntity entity = new FakeEntity(EntityType.PIG, player.getLocation()); + + for (Player otherPlayer : Bukkit.getOnlinePlayers()) + { + if (player == otherPlayer) + continue; + + final EntityPlayer mcPlayer = ((CraftPlayer)otherPlayer).getHandle(); + + mcPlayer.playerConnection.sendPacket(entity.Spawn()); + mcPlayer.playerConnection.sendPacket(entity.SetPassenger(player.getEntityId())); + FakeEntityManager.Instance.ForwardMovement(otherPlayer, player, entity.GetEntityId()); + } + } + + Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable() + { + public void run() + { + for (Player player : Bukkit.getOnlinePlayers()) + { + Location location = player.getLocation(); + Packet34EntityTeleport teleportPacket = new Packet34EntityTeleport(player.getEntityId(), MathHelper.floor(location.getX() * 32.0D), MathHelper.floor(location.getY() * 32.0D), MathHelper.floor(location.getZ() * 32.0D), (byte) ((int) (MathHelper.d(location.getYaw() * 256.0F / 360.0F))), (byte) ((int) (MathHelper.d(location.getPitch() * 256.0F / 360.0F)))); + + for (Player otherPlayer : Bukkit.getOnlinePlayers()) + { + final EntityPlayer mcPlayer = ((CraftPlayer)otherPlayer).getHandle(); + + if (player == otherPlayer) + continue; + + mcPlayer.playerConnection.sendPacket(teleportPacket); + } + } + } + }, 0L, 40L); + + /* + for (Player player : Bukkit.getOnlinePlayers()) + { + FakeEntity entity = new FakeEntity(EntityType.PIG, player.getLocation()); + FakePlayer fakePlayer = new FakePlayer(player.getName(), player.getLocation().subtract(new Vector(0, 1, 0))); + //Entity kart = player.getWorld().spawnEntity(player.getLocation(), EntityType.PIG); + + for (Player otherPlayer : Bukkit.getOnlinePlayers()) + { + final EntityPlayer mcPlayer = ((CraftPlayer)otherPlayer).getHandle(); + + if (player == otherPlayer) + { + // mcPlayer.playerConnection.sendPacket(fakePlayer.Hide(kart.getEntityId())); + continue; + } + + mcPlayer.playerConnection.sendPacket(fakePlayer.Spawn()); + mcPlayer.playerConnection.sendPacket(entity.Spawn()); + mcPlayer.playerConnection.sendPacket(fakePlayer.SetPassenger(entity.GetEntityId())); + mcPlayer.playerConnection.sendPacket(entity.SetPassenger(player.getEntityId())); + mcPlayer.playerConnection.sendPacket(fakePlayer.Hide()); + + FakeEntityManager.Instance.ForwardMovement(otherPlayer, player, fakePlayer.GetEntityId()); + //FakeEntityManager.Instance.BlockMovement(otherPlayer, kart.getEntityId()); + } + } + */ + } + + public void TestFlag(final Player player) + { + final EntityPlayer mcPlayer = ((CraftPlayer)player).getHandle(); + + for (final Player onlinePlayer : Bukkit.getOnlinePlayers()) + { + if (onlinePlayer == player) + continue; + + + + final Item anchor = player.getWorld().dropItem(onlinePlayer.getEyeLocation(), new ItemStack(Material.WOOL.getId(), 1, (byte)11)); + Item flag12 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(0, 1, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)12)); + Item flag13 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(0, 2, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)13)); + Item flag14 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(0, 2, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)14)); + Item flag15 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(0, 4, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)15)); + + anchor.setPassenger(flag12); + flag12.setPassenger(flag13); + flag13.setPassenger(flag14); + flag14.setPassenger(flag15); + + anchor.setPickupDelay(600); + flag12.setPickupDelay(600); + flag13.setPickupDelay(600); + flag14.setPickupDelay(600); + flag15.setPickupDelay(600); + + final Item anchor2 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(1, 1, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)0)); + Item flag22 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(1, 2, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)1)); + Item flag23 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(1, 3, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)2)); + Item flag24 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(1, 4, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)3)); + + anchor2.setPassenger(flag22); + flag22.setPassenger(flag23); + flag23.setPassenger(flag24); + + anchor2.setPickupDelay(600); + flag22.setPickupDelay(600); + flag23.setPickupDelay(600); + flag24.setPickupDelay(600); + + final Item anchor3 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(2, 1, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)4)); + Item flag32 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(2, 2, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)5)); + Item flag33 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(2, 3, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)6)); + Item flag34 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(2, 4, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)7)); + + anchor3.setPassenger(flag32); + flag32.setPassenger(flag33); + flag33.setPassenger(flag34); + + anchor3.setPickupDelay(600); + flag32.setPickupDelay(600); + flag33.setPickupDelay(600); + flag34.setPickupDelay(600); + + onlinePlayer.setPassenger(anchor); + + final FakePlayer fakePlayer = new FakePlayer("test", onlinePlayer.getLocation().add(1, 0, 0)); + final FakePlayer fakePlayer2 = new FakePlayer("test2", onlinePlayer.getLocation().add(2, 0, 0)); + + mcPlayer.playerConnection.sendPacket(fakePlayer.Spawn()); + mcPlayer.playerConnection.sendPacket(fakePlayer.Hide()); + + mcPlayer.playerConnection.sendPacket(fakePlayer2.Spawn()); + mcPlayer.playerConnection.sendPacket(fakePlayer2.Hide()); + + mcPlayer.playerConnection.sendPacket(fakePlayer.SetPassenger(anchor2.getEntityId())); + mcPlayer.playerConnection.sendPacket(fakePlayer2.SetPassenger(anchor3.getEntityId())); + + for (int i=0; i < 101; i++) + { + Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable() + { + public void run() + { + Vector player1 = UtilAlg.getTrajectory(fakePlayer.GetLocation().toVector(), onlinePlayer.getLocation().toVector().subtract(new Vector(1, 0, 0))); + Vector player2 = UtilAlg.getTrajectory(fakePlayer2.GetLocation().toVector(), onlinePlayer.getLocation().toVector().subtract(new Vector(2, 0, 0))); + + player1.multiply(20); + player2.multiply(20); + + mcPlayer.playerConnection.sendPacket(new Packet31RelEntityMove(fakePlayer.GetEntityId(), (byte)player1.getX(), (byte)player1.getY(), (byte)player1.getZ())); + mcPlayer.playerConnection.sendPacket(new Packet31RelEntityMove(fakePlayer2.GetEntityId(), (byte)player2.getX(), (byte)player2.getY(), (byte)player2.getZ())); + + fakePlayer.SetLocation(onlinePlayer.getLocation().subtract(new Vector(1, 0, 0))); + fakePlayer2.SetLocation(onlinePlayer.getLocation().subtract(new Vector(2, 0, 0))); + } + }, i + 1); + } + } + } + + public void SpinHim(final Player player) + { + Entity entity = player.getWorld().spawnEntity(player.getLocation(), EntityType.OCELOT); + ((CraftAgeable)entity).setBaby(); + ((CraftAgeable)entity).setAgeLock(true); + + try + { + java.lang.reflect.Field _goalSelector = EntityInsentient.class.getDeclaredField("goalSelector"); + _goalSelector.setAccessible(true); + java.lang.reflect.Field _targetSelector = EntityInsentient.class.getDeclaredField("targetSelector"); + _targetSelector.setAccessible(true); + + _goalSelector.set(((CraftLivingEntity)entity).getHandle(), new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler)); + _targetSelector.set(((CraftLivingEntity)entity).getHandle(), new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler)); + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + catch (NoSuchFieldException e) + { + e.printStackTrace(); + } + catch (SecurityException e) + { + e.printStackTrace(); + } + + entity.setPassenger(player); + + final Entity newEntity = entity; + + Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable() + { + public void run() + { + ((CraftEntity)newEntity).getHandle().yaw = ((CraftEntity)newEntity).getHandle().yaw + 179; + } + }, 20L); + + Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable() + { + public void run() + { + player.leaveVehicle(); + newEntity.remove(); + } + }, 110L); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/UpdateThread.java b/Plugins/Core/src/me/chiss/Core/Modules/UpdateThread.java new file mode 100644 index 000000000..0db7dd7ab --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/UpdateThread.java @@ -0,0 +1,97 @@ +package me.chiss.Core.Modules; + +import java.util.Arrays; +import java.util.List; + +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAlg; +import mineplex.core.fakeEntity.FakeEntity; +import net.minecraft.server.v1_6_R2.EntityPlayer; +import net.minecraft.server.v1_6_R2.Packet28EntityVelocity; + +public class UpdateThread extends Thread +{ + private EntityPlayer _player; + private List _entities; + + private int counter = 0; + + public UpdateThread(EntityPlayer mcPlayer, FakeEntity...entities) + { + _player = mcPlayer; + _entities = Arrays.asList(entities); + } + + public void run() + { + int incrementer = 1; + while (counter >= 0) + { + int i = 0; + for (FakeEntity item : _entities) + { + double radialLead = i * ((2d * Math.PI)/3); + i++; + + Vector desiredA = GetTarget(_player.locX, _player.locY, _player.locZ, counter, radialLead); + //Vector desiredB = GetTarget(_player.locX, _player.locY, _player.locZ, counter, radialLead + 1); + + //double distA = UtilMath.offset(item.GetLocation().toVector(), desiredA); + //double distB = UtilMath.offset(item.GetLocation().toVector(), desiredB); + //double distAB = UtilMath.offset(desiredA, desiredB); + + //if (distA > distB) + // continue; + + //if (distA < distAB / 2) + // continue; + + Vector vel = UtilAlg.getTrajectory(item.GetLocation().toVector(), desiredA); + + vel = vel.normalize(); + + // Player + //vel = vel.multiply(2); + //_player.playerConnection.sendPacket(new Packet31RelEntityMove(item.GetEntityId(), (byte)(incrementer + vel.getX()), (byte)vel.getY(), (byte)(incrementer + vel.getZ()))); + + // Ghast + vel = vel.multiply(.08); + //vel = vel.add(FakeEntityManager.Instance.GetKartVelocity()); + _player.playerConnection.sendPacket(new Packet28EntityVelocity(item.GetEntityId(), vel.getX(), vel.getY(), vel.getZ())); + item.SetLocation(item.GetLocation().add(vel)); + + if (counter % 20 == 0) + { + //_player.playerConnection.sendPacket(new Packet34EntityTeleport(item.GetEntityId(), (int)(desiredA.getX() / 1.6), (int)desiredA.getY(), (int)(desiredA.getZ() / 1.6), (byte)0, (byte)0)); + } + } + + if (counter == 200) + incrementer = -1; + + counter += incrementer; + + try + { + Thread.sleep(50); + } + catch (InterruptedException e) + { + e.printStackTrace(); + } + } + } + + public static Vector GetTarget(double originX, double originY, double originZ, int tick, double radialLead) + { + //Orbit + double speed = 10d; + + double oX = Math.sin(tick/speed + radialLead) * 1.5; + double oY = 0.5; + double oZ = Math.cos(tick/speed + radialLead) * 1.5; + + return new Vector(originX + oX, originY + oY, originZ + oZ); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/Utility.java b/Plugins/Core/src/me/chiss/Core/Modules/Utility.java new file mode 100644 index 000000000..4fc204c8b --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/Utility.java @@ -0,0 +1,92 @@ +package me.chiss.Core.Modules; + +import org.bukkit.plugin.java.JavaPlugin; + +import me.chiss.Core.Module.AModule; +import me.chiss.Core.Utility.*; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilGear; + +public class Utility extends AModule +{ + public Utility(JavaPlugin plugin) + { + super("Utility", plugin); + } + + @Override + public void enable() + { + + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + + } + + @Override + public void command(org.bukkit.entity.Player caller, String cmd, String[] args) + { + + } + + private UtilAccount _utilAccount; + private UtilEvent _utilEvent; + private UtilGear _utilGear; + private UtilInput _utilInput; + private UtilItem _utilItem; + + public UtilAccount Acc() + { + if (_utilAccount == null) + _utilAccount = new UtilAccount(this); + + return _utilAccount; + } + + public UtilEvent Event() + { + if (_utilEvent == null) + _utilEvent = new UtilEvent(this); + + return _utilEvent; + } + + public UtilGear Gear() + { + if (_utilGear == null) + _utilGear = new UtilGear(this); + + return _utilGear; + } + + public UtilInput Input() + { + if (_utilInput == null) + _utilInput = new UtilInput(this); + + return _utilInput; + } + + public UtilItem Items() + { + if (_utilItem == null) + _utilItem = new UtilItem(this); + + return _utilItem; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Modules/Wiki.java b/Plugins/Core/src/me/chiss/Core/Modules/Wiki.java new file mode 100644 index 000000000..a763fd51c --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Modules/Wiki.java @@ -0,0 +1,308 @@ +package me.chiss.Core.Modules; + +import java.util.HashMap; +import java.util.LinkedList; + + +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; + +import me.chiss.Core.Module.AModule; +import me.chiss.Core.Wiki.WikiArticle; +import me.chiss.Core.Wiki.WikiInput; +import me.chiss.Core.Wiki.WikiUtil; +import mineplex.core.server.IRepository; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +public class Wiki extends AModule +{ + private WikiInput _wikiInput; + + public Wiki(JavaPlugin plugin, IRepository repository) + { + super("Wiki", plugin, repository); + } + + private HashMap> _articleMap; + private HashMap _itemMap; + private LinkedList _pendingMap; + private LinkedList _deniedMap; + + @Override + public void enable() + { + _wikiInput = new WikiInput(this); + _articleMap = new HashMap>(); + _itemMap = new HashMap(); + _pendingMap = new LinkedList(); + _deniedMap = new LinkedList(); + + _articleMap.clear(); + + /* + ServerWikiToken serverWikiToken = Repository.GetServerWikis(); + + for (ItemWikiToken item : serverWikiToken.ItemWikis) + { + for (WikiRevisionToken revision : item.Revisions) + { + AddItem(item.TypeId, item.Data, revision.Title, revision.Body, revision.Revision, revision.Author, revision.SystemTime); + + if (revision.Revision > 0) + { + publishCount++; + } + else if (revision.Revision == 0) + { + pendingCount++; + } + else + { + deniedCount++; + } + } + } + + for (GameClassWikiToken gameClass : serverWikiToken.GameClassWikis) + { + for (WikiRevisionToken revision : gameClass.Revisions) + { + AddArticle(new WikiArticle(revision.Title, revision.Body, revision.Revision, revision.Author, revision.SystemTime)); + + if (revision.Revision > 0) + { + publishCount++; + } + else if (revision.Revision == 0) + { + pendingCount++; + } + else + { + deniedCount++; + } + } + } + + for (SkillWikiToken skillWiki : serverWikiToken.SkillWikis) + { + for (WikiRevisionToken revision : skillWiki.Revisions) + { + AddArticle(new WikiArticle(revision.Title, revision.Body, revision.Revision, revision.Author, revision.SystemTime)); + + if (revision.Revision > 0) + { + publishCount++; + } + else if (revision.Revision == 0) + { + pendingCount++; + } + else + { + deniedCount++; + } + } + } + + Log("Loaded " + publishCount + " Published Wiki Articles"); + Log("Loaded " + pendingCount + " Pending Wiki Articles."); + Log("Loaded " + deniedCount + " Denied Wiki Articles."); + Log("Loaded Wiki. " + UtilTime.since(epoch)); + */ + } + + @Override + public void disable() + { + _articleMap.clear(); + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + // AddCommand("w"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (args.length == 0) + return; + + // create commands + } + + @EventHandler + public void handleInteract(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + _wikiInput.wikiBlock(event); + } + + @EventHandler + public void handleInteractEntity(PlayerInteractEntityEvent event) + { + _wikiInput.wikiEntity(event); + } + + public HashMap> GetArticles() + { + return _articleMap; + } + + public HashMap GetItems() + { + return _itemMap; + } + + public LinkedList GetArticlesPending() + { + return _pendingMap; + } + + + public LinkedList GetArticlesDenied() + { + return _deniedMap; + } + + public void Display(Player player, WikiArticle article) + { + if (article == null) + return; + + //Display + UtilPlayer.message(player, article.Display(), true); + + //Save + Clients().Get(player).Wiki().SetLastArticle(article); + Clients().Get(player).Wiki().SetLastTime(System.currentTimeMillis()); + } + + public String link(String message) + { + for (String cur : GetArticles().keySet()) + { + String endColor = ChatColor.getLastColors(C.cWhite + message); + message = message.replaceAll("(?i)" + C.mChat + cur, C.mLink + cur + endColor); + message = message.replaceAll("(?i)" + " " + cur, C.mLink + " " + cur + endColor); + } + + return message; + } + + public WikiArticle searchArticle(String title, Player caller, boolean inform) + { + LinkedList matchList = new LinkedList(); + + for (String cur : GetArticles().keySet()) + { + if (cur.equalsIgnoreCase(title)) + return getActive(cur); + + if (cur.toLowerCase().contains(title.toLowerCase())) + { + matchList.add(cur); + } + } + + if (matchList.size() != 1) + { + if (!inform) + return null; + + //Inform + UtilPlayer.message(caller, F.main("Wiki Search", "" + + C.mCount + matchList.size() + + C.mBody + " matches for [" + + C.mElem + title + + C.mBody + "].")); + + if (matchList.size() > 0) + { + String matchString = ""; + for (String cur : matchList) + matchString += C.mElem + cur + C.mBody + ", "; + matchString = matchString.substring(0, matchString.length()-2); + + UtilPlayer.message(caller, F.main("Wiki Search", "" + + C.mBody + "Matches [" + + C.mElem + matchString + + C.mBody + "].")); + } + + return null; + } + + return getActive(matchList.getFirst()); + } + + public WikiArticle getActive(String title) + { + if (!GetArticles().containsKey(title)) + return null; + + return GetArticles().get(title).getFirst(); + } + + public WikiArticle getActive(ItemStack stack) + { + String title = GetItems().get(WikiUtil.getItem(stack, false)); + + if (title != null) + return getActive(title); + + title = GetItems().get(WikiUtil.getItem(stack, true)); + + if (title != null) + return getActive(title); + + return null; + } + + public WikiArticle getActive(Block block) + { + String title = GetItems().get(WikiUtil.getBlock(block, false)); + + if (title != null) + return getActive(title); + + title = GetItems().get(WikiUtil.getBlock(block, true)); + + if (title != null) + return getActive(title); + + return null; + } + + public WikiArticle getRevision(String title, int revision) + { + if (!GetArticles().containsKey(title)) + return null; + + if (revision < 0) + revision = 0; + + if (revision >= GetArticles().get(title).size()) + revision = GetArticles().get(title).size() - 1; + + return GetArticles().get(title).get(revision); + } +} \ No newline at end of file diff --git a/Plugins/Core/src/me/chiss/Core/Plugin/IChat.java b/Plugins/Core/src/me/chiss/Core/Plugin/IChat.java new file mode 100644 index 000000000..7fe91b9f7 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Plugin/IChat.java @@ -0,0 +1,8 @@ +package me.chiss.Core.Plugin; + +import org.bukkit.event.player.AsyncPlayerChatEvent; + +public interface IChat +{ + public void HandleChat(AsyncPlayerChatEvent event, String filteredMessage); +} diff --git a/Plugins/Core/src/me/chiss/Core/Plugin/ILogger.java b/Plugins/Core/src/me/chiss/Core/Plugin/ILogger.java new file mode 100644 index 000000000..6ff4bf968 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Plugin/ILogger.java @@ -0,0 +1,6 @@ +package me.chiss.Core.Plugin; + +public interface ILogger +{ + public void Log(String moduleName, String data); +} diff --git a/Plugins/Core/src/me/chiss/Core/Plugin/IPlugin.java b/Plugins/Core/src/me/chiss/Core/Plugin/IPlugin.java new file mode 100644 index 000000000..4e8815434 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Plugin/IPlugin.java @@ -0,0 +1,49 @@ +package me.chiss.Core.Plugin; + +import org.bukkit.Location; +import org.bukkit.plugin.java.JavaPlugin; + +import me.chiss.Core.Config.Config; +import me.chiss.Core.Loot.LootFactory; +import me.chiss.Core.Module.ModuleManager; +import me.chiss.Core.Modules.*; +import me.chiss.Core.Server.Server; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.creature.Creature; +import mineplex.core.energy.Energy; +import mineplex.core.packethandler.INameColorer; +import mineplex.core.pet.PetManager; +import mineplex.core.projectile.ProjectileManager; +import mineplex.core.spawn.Spawn; +import mineplex.core.teleport.Teleport; +import mineplex.minecraft.game.core.fire.Fire; + +public interface IPlugin +{ + public void Log(String moduleName, String data); + + public JavaPlugin GetPlugin(); + + public ModuleManager GetModules(); + public Config GetConfig(); + public Utility GetUtility(); + + public Blood GetBlood(); + public BlockRegenerate GetBlockRegenerate(); + public BlockRestore GetBlockRestore(); + public Creature GetCreature(); + public Energy GetEnergy(); + public Fire GetFire(); + public me.chiss.Core.Modules.Logger GetLogger(); + public LootFactory GetLoot(); + public Observer GetObserver(); + public Server GetServer(); + public Spawn GetSpawn(); + public Teleport GetTeleport(); + public ProjectileManager GetThrow(); + public Location GetSpawnLocation(); + + public String GetWebServerAddress(); + + public PetManager GetPetManager(); +} diff --git a/Plugins/Core/src/me/chiss/Core/Plugin/IPlugin.java.orig b/Plugins/Core/src/me/chiss/Core/Plugin/IPlugin.java.orig new file mode 100644 index 000000000..930933390 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Plugin/IPlugin.java.orig @@ -0,0 +1,77 @@ +package me.chiss.Core.Plugin; + +import org.bukkit.Location; +import org.bukkit.plugin.java.JavaPlugin; + +import me.chiss.Core.Clans.Clans; +import me.chiss.Core.Class.ClassFactory; +import me.chiss.Core.Client.CoreClientManager; +import me.chiss.Core.Combat.CombatManager; +import me.chiss.Core.Condition.ConditionManager; +import me.chiss.Core.Config.Config; +import me.chiss.Core.Damage.DamageManager; +import me.chiss.Core.Loot.LootFactory; +import me.chiss.Core.Module.ModuleManager; +import me.chiss.Core.Modules.*; +import me.chiss.Core.NAC.NAC; +import me.chiss.Core.Pet.PetManager; +import me.chiss.Core.PlayerTagNamer.INameColorer; +import me.chiss.Core.Punish.Punish; +import me.chiss.Core.Skill.SkillFactory; + +public interface IPlugin +{ + public void Log(String moduleName, String data); + + public JavaPlugin GetPlugin(); + + public IRelation GetRelation(); + + public ModuleManager GetModules(); + public Config GetConfig(); + public CoreClientManager GetClients(); + public Utility GetUtility(); + + public Punish GetBan(); + public Blood GetBlood(); + public BlockRegenerate GetBlockRegenerate(); + public BlockRestore GetBlockRestore(); + public NAC GetNAC(); + public Clans GetClans(); + public ClassFactory GetClasses(); + public Compass GetCompass(); + public ConditionManager GetCondition(); + public CombatManager GetCombat(); + public Creature GetCreature(); + public DamageManager GetDamage(); + public Donation GetDonation(); + public Energy GetEnergy(); + public Explosion GetExplosion(); + public Field GetField(); + public Fire GetFire(); + public Fix GetFix(); + public Give GetGive(); + public Ignore GetIgnore(); + public ItemStackFactory GetItemStackFactory(); + public me.chiss.Core.Modules.Logger GetLogger(); + public LootFactory GetLoot(); + public Message GetMessage(); + public Observer GetObserver(); + public Recharge GetRecharge(); + public Server GetServer(); + public SkillFactory GetSkills(); + public Spawn GetSpawn(); + public Teleport GetTeleport(); + public Throw GetThrow(); + public Weapon GetWeapon(); + public Wiki GetWiki(); + public Location GetSpawnLocation(); + + public String GetWebServerAddress(); + + public INameColorer GetNameColorer(); + + public PetManager GetPetManager(); + + +} diff --git a/Plugins/Core/src/me/chiss/Core/Plugin/IRelation.java b/Plugins/Core/src/me/chiss/Core/Plugin/IRelation.java new file mode 100644 index 000000000..a6dc4dec0 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Plugin/IRelation.java @@ -0,0 +1,10 @@ +package me.chiss.Core.Plugin; + +import org.bukkit.entity.Player; + +public interface IRelation +{ + public boolean CanHurt(Player a, Player b); + public boolean CanHurt(String a, String b); + public boolean IsSafe(Player a); +} diff --git a/Plugins/Core/src/me/chiss/Core/Plugin/Logger.java b/Plugins/Core/src/me/chiss/Core/Plugin/Logger.java new file mode 100644 index 000000000..8fb2d5224 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Plugin/Logger.java @@ -0,0 +1,9 @@ +package me.chiss.Core.Plugin; + +public class Logger implements ILogger +{ + public void Log(String source, String message) + { + System.out.println("[" + source + "]" + " " + message); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/PvpShop/IPvpShopFactory.java b/Plugins/Core/src/me/chiss/Core/PvpShop/IPvpShopFactory.java new file mode 100644 index 000000000..0b85c660e --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/PvpShop/IPvpShopFactory.java @@ -0,0 +1,8 @@ +package me.chiss.Core.PvpShop; + +import java.util.Collection; + +public interface IPvpShopFactory +{ + Collection GetItems(); +} diff --git a/Plugins/Core/src/me/chiss/Core/PvpShop/IShopItem.java b/Plugins/Core/src/me/chiss/Core/PvpShop/IShopItem.java new file mode 100644 index 000000000..1ca06bb0b --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/PvpShop/IShopItem.java @@ -0,0 +1,21 @@ +package me.chiss.Core.PvpShop; + +import org.bukkit.Material; + +public interface IShopItem +{ + Material GetType(); + byte GetData(); + int GetAmount(); + int GetTokenCost(); + int GetPointCost(); + int GetCreditCost(); + int GetEconomyCost(); + boolean IsFree(); + int GetSalesPackageId(); + String GetName(); + String[] GetDesc(); + int GetSlot(); + String GetDeliveryName(); + float GetReturnPercent(); +} diff --git a/Plugins/Core/src/me/chiss/Core/PvpShop/PvpShopFactory.java b/Plugins/Core/src/me/chiss/Core/PvpShop/PvpShopFactory.java new file mode 100644 index 000000000..216916dff --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/PvpShop/PvpShopFactory.java @@ -0,0 +1,248 @@ +package me.chiss.Core.PvpShop; + +import java.io.BufferedReader; +import java.io.DataInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Collection; +import java.util.HashMap; + +import mineplex.core.server.IRepository; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Module.AModule; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +public class PvpShopFactory extends AModule implements IPvpShopFactory +{ + private String _loadFile; + private HashMap _items; + + public PvpShopFactory(JavaPlugin plugin, IRepository repository, String loadFile) + { + super("Shop Factory", plugin, repository); + + _items = new HashMap(); + _loadFile = loadFile; + + PopulateItems(); + } + + @Override + public void enable() + { + + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("pvpshop"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) + return; + + if (args.length == 0) + { + UtilPlayer.message(caller, F.main(GetName(), "Listing Items;")); + + for (IShopItem cur : GetItems()) + { + UtilPlayer.message(caller, cur.GetName()); + } + + UtilPlayer.message(caller, "Type " + F.elem("/pvpshop ") + " to receive Item."); + return; + } + + for (IShopItem cur : GetItems()) + { + if (cur.GetName().toLowerCase().contains(args[0].toLowerCase())) + { + caller.getInventory().addItem(ItemStackFactory.Instance.CreateStack(cur.GetType(), cur.GetAmount())); + + UtilPlayer.message(caller, F.main(GetName(), "You received " + F.elem(cur.GetName()) + ".")); + } + } + } + + private void PopulateItems() + { + _items.clear(); + + FileInputStream fstream = null; + DataInputStream in = null; + BufferedReader br = null; + + try + { + fstream = new FileInputStream(_loadFile); + in = new DataInputStream(fstream); + br = new BufferedReader(new InputStreamReader(in)); + String strLine; + + int line = 1; + int col = 0; + while ((strLine = br.readLine()) != null) + { + String[] tokens = strLine.split(" "); + + if (tokens.length == 1) + { + if (tokens[0].equals("-")) + { + col++; + continue; + } + + try + { + line = Integer.parseInt(tokens[0]); + col = 0; + continue; + } + catch (Exception e) + { + System.out.println("Shop Load - Invalid Line: " + tokens[0]); + continue; + } + } + + if (tokens.length != 8) + { + System.out.println("Shop Load - Invalid Token Count: (" + tokens.length + ") " + strLine); + continue; + } + + try + { + //Name + String name = null; + if (!tokens[5].equals("null")) name = tokens[5].replaceAll("_", " "); + + //Delivery Name + String deliveryName = null; + if (!tokens[6].equals("null")) deliveryName = tokens[6].replaceAll("_", " "); + + //Desc + String[] desc = null; + if (!tokens[7].equals("null")) + { + desc = tokens[7].split(","); + + for (int i=0 ; i GetItems() + { + return _items.values(); + } + + public void AddItem(IShopItem newItem) + { + _items.put(newItem.GetName(), newItem); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/PvpShop/ShopItem.java b/Plugins/Core/src/me/chiss/Core/PvpShop/ShopItem.java new file mode 100644 index 000000000..ac9e9cbf0 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/PvpShop/ShopItem.java @@ -0,0 +1,161 @@ +package me.chiss.Core.PvpShop; + +import mineplex.minecraft.game.core.classcombat.item.repository.ItemToken; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +public class ShopItem implements IShopItem, Listener +{ + protected PvpShopFactory Factory; + + private int _salesPackageId = 0; + private Material _type; + private byte _data; + private String _name; + private String _deliveryName; + private String[] _desc; + private int _amount; + private boolean _free; + private int _tokenCost; + private int _creditCost; + private int _pointCost; + private int _economyCost; + private int _slot; + private boolean _canDamage; + private float _returnPercent = 0.25f; + + public ShopItem(PvpShopFactory factory, String name, String deliveryName, String[] desc, + Material type, byte data, int amount, int economyCost, float returnPercent, int slot) + { + Factory = factory; + + if (name != null) _name = name; + else _name = ItemStackFactory.Instance.GetName(type, data, false); + + if (deliveryName != null) _deliveryName = name; + else _deliveryName = ItemStackFactory.Instance.GetName(type, data, true); + + _returnPercent = returnPercent; + + if (desc != null) _desc = desc; + else _desc = new String[]{"Left-Click: " + C.cWhite + "Purchase", "Right-Click: " + C.cWhite + "Sell All at " + (int)(_returnPercent * 100) + "%"}; + + _type = type; + _data = data; + _amount = amount; + _slot = slot; + _economyCost = economyCost; + + _free = true; + } + + @Override + public Material GetType() + { + return _type; + } + + @Override + public byte GetData() + { + return _data; + } + + @Override + public int GetAmount() + { + return _amount; + } + + @Override + public int GetTokenCost() + { + return _tokenCost; + } + + @Override + public int GetCreditCost() + { + return _creditCost; + } + + @Override + public int GetPointCost() + { + return _pointCost; + } + + @Override + public int GetEconomyCost() + { + return _economyCost; + } + + @Override + public int GetSalesPackageId() + { + return _salesPackageId; + } + + @Override + public String GetName() + { + return _name; + } + + @Override + public String GetDeliveryName() + { + return _deliveryName; + } + + @EventHandler + public void Damage(CustomDamageEvent event) + { + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!UtilGear.isMat(damager.getItemInHand(), GetType())) + return; + + if (!_canDamage) + event.SetCancelled("Item Damage Cancel"); + } + + @Override + public boolean IsFree() + { + return _free; + } + + public void Update(ItemToken itemToken) + { + _salesPackageId = itemToken.SalesPackage.GameSalesPackageId; + _creditCost = itemToken.SalesPackage.BlueGems; + _pointCost = itemToken.SalesPackage.GreenGems; + _free = itemToken.SalesPackage.Free; + } + + @Override + public String[] GetDesc() + { + return _desc; + } + + @Override + public int GetSlot() + { + return _slot; + } + + public float GetReturnPercent() + { + return _returnPercent; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Scheduler/ForceDailyCommand.java b/Plugins/Core/src/me/chiss/Core/Scheduler/ForceDailyCommand.java new file mode 100644 index 000000000..69b143df6 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Scheduler/ForceDailyCommand.java @@ -0,0 +1,22 @@ +package me.chiss.Core.Scheduler; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; + +public class ForceDailyCommand extends CommandBase +{ + + public ForceDailyCommand(Scheduler plugin) + { + super(plugin, Rank.ADMIN, "forcedaily"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.ResetStartOfDay(); + } + +} diff --git a/Plugins/Core/src/me/chiss/Core/Scheduler/IScheduleListener.java b/Plugins/Core/src/me/chiss/Core/Scheduler/IScheduleListener.java new file mode 100644 index 000000000..1357662fa --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Scheduler/IScheduleListener.java @@ -0,0 +1,6 @@ +package me.chiss.Core.Scheduler; + +public interface IScheduleListener +{ + public void AppointmentFire(); +} diff --git a/Plugins/Core/src/me/chiss/Core/Scheduler/Scheduler.java b/Plugins/Core/src/me/chiss/Core/Scheduler/Scheduler.java new file mode 100644 index 000000000..e155aeedc --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Scheduler/Scheduler.java @@ -0,0 +1,90 @@ +package me.chiss.Core.Scheduler; + +import java.util.Calendar; +import java.util.HashMap; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.TimeSpan; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; + +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + +public class Scheduler extends MiniPlugin +{ + public static Scheduler Instance; + + private HashMap _listenerMap; + private long _startOfDay = 0; + + public static void Initialize(JavaPlugin plugin) + { + if (Instance == null) + Instance = new Scheduler(plugin); + } + + private Scheduler(JavaPlugin plugin) + { + super("Scheduler", plugin); + + _listenerMap = new HashMap(); + + Calendar calender = Calendar.getInstance(); + + _startOfDay = System.currentTimeMillis() - calender.get(Calendar.HOUR_OF_DAY) * TimeSpan.HOUR - calender.get(Calendar.MINUTE) * TimeSpan.MINUTE - calender.get(Calendar.SECOND) * TimeSpan.SECOND - calender.get(Calendar.MILLISECOND); + } + + @Override + public void AddCommands() + { + AddCommand(new ForceDailyCommand(this)); + } + + @EventHandler + public void UpdateDaily(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (IScheduleListener listener : _listenerMap.keySet()) + { + if (_listenerMap.get(listener) < TimeSpan.DAY && _listenerMap.get(listener) + _startOfDay <= System.currentTimeMillis()) + { + listener.AppointmentFire(); + _listenerMap.put(listener, _listenerMap.get(listener) + TimeSpan.DAY); + } + } + + if (System.currentTimeMillis() - _startOfDay >= TimeSpan.DAY) + ResetStartOfDay(); + } + + public void ScheduleDailyRecurring(IScheduleListener listener, long offsetFromDay) + { + long time = (TimeSpan.DAY + offsetFromDay) % TimeSpan.DAY; + + _listenerMap.put(listener, time); + + if (_listenerMap.get(listener) + _startOfDay <= System.currentTimeMillis()) + _listenerMap.put(listener, _listenerMap.get(listener) + TimeSpan.DAY); + } + + public void ResetStartOfDay() + { + for (IScheduleListener listener : _listenerMap.keySet()) + { + if (_listenerMap.get(listener) >= TimeSpan.DAY) + { + _listenerMap.put(listener, _listenerMap.get(listener) - TimeSpan.DAY); + } + } + + _startOfDay = System.currentTimeMillis(); + } + + public long GetTimeTilNextAppt(IScheduleListener listener) + { + return _listenerMap.get(listener) + _startOfDay - System.currentTimeMillis(); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Server/Server.java b/Plugins/Core/src/me/chiss/Core/Server/Server.java new file mode 100644 index 000000000..ada33dff4 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Server/Server.java @@ -0,0 +1,182 @@ +package me.chiss.Core.Server; + +import me.chiss.Core.Events.ServerSaveEvent; +import me.chiss.Core.Server.command.BroadcastCommand; +import me.chiss.Core.Server.command.ListCommand; +import me.chiss.Core.Server.command.SpawnSetCommand; +import me.chiss.Core.Server.command.WaterSpreadCommand; +import mineplex.core.MiniPlugin; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; + +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class Server extends MiniPlugin +{ + private CoreClientManager _clientManager; + public boolean stopWeather = true; + public boolean liquidSpread = true; + + public Server(JavaPlugin plugin, CoreClientManager clientManager) + { + super("Server", plugin); + + _clientManager = clientManager; + } + + @Override + public void AddCommands() + { + AddCommand(new BroadcastCommand(this)); + AddCommand(new ListCommand(this)); + AddCommand(new SpawnSetCommand(this)); + AddCommand(new WaterSpreadCommand(this)); + } + + @EventHandler + public void WorldTimeWeather(UpdateEvent event) + { + if (event.getType() == UpdateType.TICK) + { + for (World cur : UtilServer.getServer().getWorlds()) + { + if (cur.getTime() > 12000 && cur.getTime() < 24000) + cur.setTime(cur.getTime() + 5); + + if (cur.getTime() > 14000 && cur.getTime() < 22000) + cur.setTime(22000); + + if (stopWeather) + { + cur.setStorm(false); + cur.setThundering(false); + } + } + } + + if (event.getType() == UpdateType.MIN_04) + { + ServerSaveEvent saveEvent = new ServerSaveEvent(); + _plugin.getServer().getPluginManager().callEvent(saveEvent); + + if (!saveEvent.isCancelled()) + { + saveClients(); + saveWorlds(); + } + } + } + + @EventHandler + public void WaterSpread(BlockFromToEvent event) + { + if (!liquidSpread) + event.setCancelled(true); + } + + public void saveClients() + { + long epoch = System.currentTimeMillis(); + + //Save Clients + for (Player cur : UtilServer.getPlayers()) + cur.saveData(); + + Log("Saved Clients to Disk. Took " + (System.currentTimeMillis()-epoch) + " milliseconds."); + } + + public void saveWorlds() + { + long epoch = System.currentTimeMillis(); + + //Save World + for (World cur : UtilServer.getServer().getWorlds()) + cur.save(); + + UtilServer.broadcast(C.cGray + "Saved Worlds [" + + F.time(UtilTime.convertString((System.currentTimeMillis()-epoch), 1, TimeUnit.FIT)) + + "]."); + + Log("Saved Worlds to Disk. Took " + (System.currentTimeMillis()-epoch) + " milliseconds."); + } + + public void reload() + { + UtilServer.broadcast(F.main(_moduleName, "Reloading Plugins...")); + Log("Reloading Plugins..."); + UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "reload"); + } + + public void restart() + { + UtilServer.broadcast(F.main(_moduleName, "Restarting Server...")); + Log("Restarting Server..."); + + for (Player cur : UtilServer.getPlayers()) + UtilPlayer.kick(cur, _moduleName, "Server Restarting"); + + UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "stop"); + } + + @EventHandler + public void handleCommand(PlayerCommandPreprocessEvent event) + { + String cmdName = event.getMessage().split("\\s+")[0].substring(1); + + if (cmdName.equalsIgnoreCase("reload") || cmdName.equalsIgnoreCase("rl")) + { + event.setCancelled(true); + + if (_clientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.ADMIN, true)) + reload(); + } + else if (cmdName.equalsIgnoreCase("stop")) + { + event.setCancelled(true); + + if (_clientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.ADMIN, true)) + restart(); + } + else if (cmdName.equalsIgnoreCase("reload")) + { + if (event.getPlayer().getName().equals("Chiss")) + return; + + event.getPlayer().sendMessage("Plugins cannot be reloaded."); + + event.setCancelled(true); + } + else if (cmdName.equalsIgnoreCase("me")) + { + event.setCancelled(true); + } + } + + public CoreClientManager GetClientManager() + { + return _clientManager; + } + + public void ToggleLiquidSpread() + { + liquidSpread = !liquidSpread; + } + + public boolean GetLiquidSpread() + { + return liquidSpread; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Server/command/BroadcastCommand.java b/Plugins/Core/src/me/chiss/Core/Server/command/BroadcastCommand.java new file mode 100644 index 000000000..0498bb08e --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Server/command/BroadcastCommand.java @@ -0,0 +1,30 @@ +package me.chiss.Core.Server.command; + +import org.bukkit.entity.Player; + +import me.chiss.Core.Server.Server; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.UtilServer; + +public class BroadcastCommand extends CommandBase +{ + public BroadcastCommand(Server plugin) + { + super(plugin, Rank.MODERATOR, "s"); + } + + @Override + public void Execute(Player caller, String[] args) + { + String announcement = ""; + + for (String arg : args) + announcement += arg + " "; + + if (announcement.length() > 0) + announcement = announcement.substring(0, announcement.length()-1); + + UtilServer.broadcast(caller.getName(), announcement); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Server/command/ListCommand.java b/Plugins/Core/src/me/chiss/Core/Server/command/ListCommand.java new file mode 100644 index 000000000..94ba8a729 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Server/command/ListCommand.java @@ -0,0 +1,52 @@ +package me.chiss.Core.Server.command; + +import org.bukkit.entity.Player; + +import me.chiss.Core.Server.Server; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; + +public class ListCommand extends CommandBase +{ + public ListCommand(Server plugin) + { + super(plugin, Rank.ALL, "list", "playerlist", "who"); + } + + @Override + public void Execute(Player caller, String[] args) + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Listing Online Players:")); + + String staff = ""; + String other = ""; + for (Player cur : UtilServer.getPlayers()) + { + if (Plugin.GetClientManager().Get(cur).GetRank().Has(cur, Rank.MODERATOR, false)) + { + staff += C.cWhite + cur.getName() + " "; + } + else + { + other += C.cWhite + cur.getName() + " "; + } + + } + + if (staff.length() == 0) staff = "None"; + else staff = staff.substring(0, staff.length() - 1); + + if (other.length() == 0) other = "None"; + else other = other.substring(0, other.length() - 1); + + UtilPlayer.message(caller, "§c§l" + "Staff"); + UtilPlayer.message(caller, staff); + + UtilPlayer.message(caller, "§a§l" + "Players"); + UtilPlayer.message(caller, other); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Server/command/SpawnSetCommand.java b/Plugins/Core/src/me/chiss/Core/Server/command/SpawnSetCommand.java new file mode 100644 index 000000000..50c3ae29f --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Server/command/SpawnSetCommand.java @@ -0,0 +1,21 @@ +package me.chiss.Core.Server.command; + +import org.bukkit.entity.Player; + +import me.chiss.Core.Server.Server; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; + +public class SpawnSetCommand extends CommandBase +{ + public SpawnSetCommand(Server plugin) + { + super(plugin, Rank.ADMIN, "spawnset"); + } + + @Override + public void Execute(Player caller, String[] args) + { + caller.getWorld().setSpawnLocation(caller.getLocation().getBlockX(), caller.getLocation().getBlockY(), caller.getLocation().getBlockZ()); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Server/command/WaterSpreadCommand.java b/Plugins/Core/src/me/chiss/Core/Server/command/WaterSpreadCommand.java new file mode 100644 index 000000000..37f77323a --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Server/command/WaterSpreadCommand.java @@ -0,0 +1,22 @@ +package me.chiss.Core.Server.command; + +import org.bukkit.entity.Player; + +import me.chiss.Core.Server.Server; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; + +public class WaterSpreadCommand extends CommandBase +{ + public WaterSpreadCommand(Server plugin) + { + super(plugin, Rank.ADMIN, "waterspread"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.ToggleLiquidSpread(); + caller.sendMessage("Liquid Spread: " + Plugin.GetLiquidSpread()); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/CustomBuildShop.java b/Plugins/Core/src/me/chiss/Core/Shop/CustomBuildShop.java new file mode 100644 index 000000000..ae966b95a --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/CustomBuildShop.java @@ -0,0 +1,127 @@ +package me.chiss.Core.Shop; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import me.chiss.Core.Plugin.IPlugin; +import me.chiss.Core.Shop.actions.ChangeCurrency; +import me.chiss.Core.Shop.actions.NextPage; +import me.chiss.Core.Shop.actions.PreviousPage; +import me.chiss.Core.Shop.actions.Purchase; +import me.chiss.Core.Shop.actions.Reset; +import me.chiss.Core.Shop.actions.Return; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.currency.ItemTokenHandler; +import me.chiss.Core.Shop.currency.SkillTokenHandler; +import me.chiss.Core.Shop.page.IShopPage; +import me.chiss.Core.Shop.pagebuilder.game.CustomBuildPageBuilder; +import me.chiss.Core.Shop.pagebuilder.game.ItemPageBuilder; +import me.chiss.Core.Shop.pagebuilder.game.SkillsPageBuilder; +import me.chiss.Core.Shop.pagebuilder.game.WeaponPageBuilder; +import me.chiss.Core.Weapon.IWeaponFactory; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.UtilServer; +import mineplex.minecraft.game.classcombat.shop.page.ArmorPageBuilder; +import mineplex.minecraft.game.core.classcombat.Class.ClassManager; +import mineplex.minecraft.game.core.classcombat.Class.ClientClass; +import mineplex.minecraft.game.core.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.classcombat.Class.event.ClassSetupEvent; +import mineplex.minecraft.game.core.classcombat.Class.event.ClassSetupEvent.SetupType; +import mineplex.minecraft.game.core.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.core.classcombat.item.IItemFactory; + +public class CustomBuildShop extends Shop +{ + private IWeaponFactory _weaponFactory; + private IItemFactory _itemFactory; + + public CustomBuildShop(IPlugin plugin, CoreClientManager manager, ClassManager gameClassFactory, SkillFactory skillFactory, IWeaponFactory weaponFactory, IItemFactory itemFactory) + { + super(plugin, manager); + + _weaponFactory = weaponFactory; + _itemFactory = itemFactory; + + ShopBlockType = Material.ENCHANTMENT_TABLE; + + ICurrencyHandler itemTokenHandler = new ItemTokenHandler(); + ICurrencyHandler skillTokenHandler = new SkillTokenHandler(); + + AddPageBuilder(new ArmorPageBuilder(this, "-----------Class-------Skills", gameClassFactory)); + AddPageBuilder(new CustomBuildPageBuilder(this, "Class------Custom------Skills", gameClassFactory)); + AddPageBuilder(new SkillsPageBuilder(this,"Class-------Skills-----------", skillFactory, gameClassFactory)); + + CreateShopActions(); + } + + @Override + protected void CreateShopActions() + { + new NextPage(Plugin.GetPlugin(), this, ClientManager); + new PreviousPage(Plugin.GetPlugin(), this, ClientManager); + new Reset(Plugin.GetPlugin(), this, ClientManager); + new Return(Plugin.GetPlugin(), this, ClientManager, _weaponFactory, _itemFactory); + new Purchase(Plugin.GetPlugin(), this, ClientManager); + new ChangeCurrency(Plugin.GetPlugin(), this, ClientManager); + } + + @Override + public void ShowSkillHotBarForPlayer(CoreClient player) { } + + @Override + public void OpenShopForPlayer(Player player) + { + super.OpenShopForPlayer(player); + + ClientClass clientClass = ClassManager.Get(player); + + ClassType classType = null; + if (clientClass.GetGameClass() != null) + classType = clientClass.GetGameClass().GetType(); + + ClassSetupEvent event = new ClassSetupEvent(player, SetupType.OpenMain, classType, 0, null); + + UtilServer.getServer().getPluginManager().callEvent(event); + } + + @SuppressWarnings("deprecation") + public void CloseShopForPlayer(CoreClient player) + { + String key = player.GetPlayerName(); + GetPage(player).CloseForPlayer(player); + + IShopPage page = GetPage(player); + + while (page.HasPreviousPage()) + { + page = page.GetPreviousPage(); + } + + IShopPage nextPage; + + while (page.HasNextPage()) + { + nextPage = page.GetNextPage(); + page.SetNextPage(null); + nextPage.SetPreviousPage(null); + page = nextPage; + } + + PageMap.remove(key); + + if (player.Donor().IsSavingCustomBuild()) + player.Donor().SaveActiveCustomBuild(true); + + if (InventoryMap.containsKey(player.GetPlayerName())) + { + player.GetPlayer().getInventory().setContents(InventoryMap.get(player.GetPlayerName())); + player.GetPlayer().getInventory().setArmorContents(ArmorMap.get(player.GetPlayerName())); + player.Class().SetGameClass(null); + InventoryMap.remove(key); + ArmorMap.remove(key); + } + + player.GetPlayer().updateInventory(); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/DonatorShop.java b/Plugins/Core/src/me/chiss/Core/Shop/DonatorShop.java new file mode 100644 index 000000000..8f1db8796 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/DonatorShop.java @@ -0,0 +1,57 @@ +package me.chiss.Core.Shop; + +import me.chiss.Core.Class.IClassFactory; +import me.chiss.Core.Plugin.IPlugin; +import me.chiss.Core.Shop.actions.ChangeCurrency; +import me.chiss.Core.Shop.actions.NextPage; +import me.chiss.Core.Shop.actions.PreviousPage; +import me.chiss.Core.Shop.actions.Purchase; +import me.chiss.Core.Shop.currency.CreditHandler; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.currency.PointHandler; +import me.chiss.Core.Shop.pagebuilder.game.purchase.ArmorPurchasePageBuilder; +import me.chiss.Core.Shop.pagebuilder.game.purchase.ItemPurchasePageBuilder; +import me.chiss.Core.Shop.pagebuilder.game.purchase.SkillsPurchasePageBuilder; +import me.chiss.Core.Shop.pagebuilder.game.purchase.WeaponPurchasePageBuilder; +import me.chiss.Core.Skill.ISkillFactory; +import me.chiss.Core.Weapon.IWeaponFactory; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.server.IRepository; +import mineplex.minecraft.game.core.classcombat.item.IItemFactory; + +import org.bukkit.Material; + +public class DonatorShop extends Shop +{ + public DonatorShop(IPlugin plugin, IRepository repository, CoreClientManager manager, IClassFactory gameClassFactory, ISkillFactory skillFactory, IWeaponFactory weaponFactory, IItemFactory itemFactory) + { + super(plugin, repository, manager); + + ShopBlockType = Material.ENDER_CHEST; + + ICurrencyHandler creditHandler = new CreditHandler(); + ICurrencyHandler pointHandler = new PointHandler(); + + AddPageBuilder(new ArmorPurchasePageBuilder(this, "-----------Class-------Skills", gameClassFactory, creditHandler, pointHandler)); + AddPageBuilder(new SkillsPurchasePageBuilder(this, "Class-------Skills----Weapons", skillFactory, gameClassFactory, creditHandler, pointHandler)); + AddPageBuilder(new WeaponPurchasePageBuilder(this, "Skills------Weapons-----Items", weaponFactory, gameClassFactory, creditHandler, pointHandler)); + AddPageBuilder(new ItemPurchasePageBuilder(this, "Weapons-----Items----------", itemFactory, creditHandler, pointHandler)); + + CreateShopActions(); + + RestoreInventory = true; + } + + @Override + protected void CreateShopActions() + { + new NextPage(Plugin.GetPlugin(), this, ClientManager); + new PreviousPage(Plugin.GetPlugin(), this, ClientManager); + new Purchase(Plugin.GetPlugin(), this, ClientManager); + new ChangeCurrency(Plugin.GetPlugin(), this, ClientManager); + } + + @Override + public void ShowSkillHotBarForPlayer(CoreClient player) { } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/GameShop.java b/Plugins/Core/src/me/chiss/Core/Shop/GameShop.java new file mode 100644 index 000000000..e8426b66a --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/GameShop.java @@ -0,0 +1,71 @@ +package me.chiss.Core.Shop; + +import me.chiss.Core.Plugin.IPlugin; +import me.chiss.Core.Shop.actions.Return; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.currency.ItemTokenHandler; +import me.chiss.Core.Shop.currency.SkillTokenHandler; +import me.chiss.Core.Shop.pagebuilder.game.CustomBuildPageBuilder; +import me.chiss.Core.Shop.pagebuilder.game.ItemPageBuilder; +import me.chiss.Core.Shop.pagebuilder.game.SkillsPageBuilder; +import me.chiss.Core.Shop.pagebuilder.game.WeaponPageBuilder; +import me.chiss.Core.Weapon.IWeaponFactory; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.minecraft.game.classcombat.shop.page.ArmorPageBuilder; +import mineplex.minecraft.game.core.classcombat.Class.ClassManager; +import mineplex.minecraft.game.core.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.core.classcombat.item.IItemFactory; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +public class GameShop extends Shop +{ + public GameShop(JavaPlugin plugin, CoreClientManager manager, ClassManager gameClassFactory, SkillFactory skillFactory) + { + super(plugin, manager); + + ICurrencyHandler itemTokenHandler = new ItemTokenHandler(); + ICurrencyHandler skillTokenHandler = new SkillTokenHandler(); + + AddPageBuilder(new ArmorPageBuilder(this, "-----------Class-------Skills", gameClassFactory)); + AddPageBuilder(new CustomBuildPageBuilder(this, "Class------Custom------Skills", gameClassFactory)); + AddPageBuilder(new SkillsPageBuilder(this,"Class-------Skills----Weapons", skillFactory, gameClassFactory)); + + CreateShopActions(); + } + + public void GiveDefaultBuild(Player player) + { + CoreClient gamePlayer = ClientManager.Get(player); + String key = gamePlayer.GetPlayerName(); + InventoryMap.put(key, player.getInventory().getContents()); + + if (!PageMap.containsKey(key)) + { + BuildPagesForPlayer(gamePlayer); + } + + ShowSkillHotBarForPlayer(gamePlayer); + + /* HARDCODE FTW */ + GetPage(gamePlayer).PrepSlotsForPlayer(gamePlayer); + GetPage(gamePlayer).PlayerWants(gamePlayer, 11); + } + + @Override + protected void CreateShopActions() + { + super.CreateShopActions(); + new Return(Plugin.GetPlugin(), this, ClientManager, _weaponFactory, _itemFactory); + } + + @Override + public boolean ShouldOpenShop(Block clickedBlock) + { + return super.ShouldOpenShop(clickedBlock) || clickedBlock.getType() == Material.ENCHANTMENT_TABLE; + } +} \ No newline at end of file diff --git a/Plugins/Core/src/me/chiss/Core/Shop/IButton.java b/Plugins/Core/src/me/chiss/Core/Shop/IButton.java new file mode 100644 index 000000000..c85618673 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/IButton.java @@ -0,0 +1,8 @@ +package me.chiss.Core.Shop; + +import org.bukkit.entity.Player; + +public interface IButton +{ + public void Clicked(Player player); +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/PvpBuildShop.java b/Plugins/Core/src/me/chiss/Core/Shop/PvpBuildShop.java new file mode 100644 index 000000000..cd1ff93cf --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/PvpBuildShop.java @@ -0,0 +1,73 @@ +package me.chiss.Core.Shop; + + +import org.bukkit.Material; + +import me.chiss.Core.Class.IClassFactory; +import me.chiss.Core.Plugin.IPlugin; +import me.chiss.Core.Shop.actions.Return; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.currency.ItemTokenHandler; +import me.chiss.Core.Shop.currency.SkillTokenHandler; +import me.chiss.Core.Shop.pagebuilder.game.PvpCustomBuildPageBuilder; +import me.chiss.Core.Shop.pagebuilder.game.SkillsPageBuilder; +import me.chiss.Core.Skill.ISkillFactory; +import me.chiss.Core.Weapon.IWeaponFactory; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.server.IRepository; +import mineplex.minecraft.game.core.classcombat.item.IItemFactory; + +public class PvpBuildShop extends Shop +{ + private IWeaponFactory _weaponFactory; + private IItemFactory _itemFactory; + + public PvpBuildShop(IPlugin plugin, IRepository repository, CoreClientManager manager, IClassFactory gameClassFactory, ISkillFactory skillFactory) + { + super(plugin, repository, manager); + + ShopBlockType = Material.ENCHANTMENT_TABLE; + + ICurrencyHandler itemTokenHandler = new ItemTokenHandler(); + ICurrencyHandler skillTokenHandler = new SkillTokenHandler(); + + AddPageBuilder(new PvpCustomBuildPageBuilder(this, "----------Builds------Skills", gameClassFactory, itemTokenHandler)); + AddPageBuilder(new SkillsPageBuilder(this,"Builds-------Skills---------", skillFactory, gameClassFactory, skillTokenHandler)); + + CreateShopActions(); + } + + @Override + public void ShowSkillHotBarForPlayer(CoreClient player) { } + + @Override + protected void CreateShopActions() + { + super.CreateShopActions(); + new Return(Plugin.GetPlugin(), this, ClientManager, _weaponFactory, _itemFactory); + } + + public void CloseShopForPlayer(CoreClient player) + { + String key = player.GetPlayerName(); + GetPage(player).CloseForPlayer(player); + + PageMap.remove(key); + + if (player.Donor().IsSavingCustomBuild()) + player.Donor().SaveActiveCustomBuild(false); + + if (InventoryMap.containsKey(player.GetPlayerName())) + { + player.Class().GetInventory().setContents(InventoryMap.get(player.GetPlayerName())); + player.Class().GetInventory().setArmorContents(ArmorMap.get(player.GetPlayerName())); + player.Donor().SetTokens(0, 0); + player.Donor().SetDefaultTokens(0, 0); + InventoryMap.remove(key); + ArmorMap.remove(key); + } + + player.Class().UpdateInventory(); + } +} \ No newline at end of file diff --git a/Plugins/Core/src/me/chiss/Core/Shop/PvpDonatorShop.java b/Plugins/Core/src/me/chiss/Core/Shop/PvpDonatorShop.java new file mode 100644 index 000000000..14a73566a --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/PvpDonatorShop.java @@ -0,0 +1,51 @@ +package me.chiss.Core.Shop; + +import me.chiss.Core.Class.IClassFactory; +import me.chiss.Core.Plugin.IPlugin; +import me.chiss.Core.Shop.actions.ChangeCurrency; +import me.chiss.Core.Shop.actions.NextPage; +import me.chiss.Core.Shop.actions.PreviousPage; +import me.chiss.Core.Shop.actions.Purchase; +import me.chiss.Core.Shop.currency.CreditHandler; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.currency.PointHandler; +import me.chiss.Core.Shop.pagebuilder.game.purchase.ArmorPurchasePageBuilder; +import me.chiss.Core.Shop.pagebuilder.game.purchase.SkillsPurchasePageBuilder; +import me.chiss.Core.Skill.ISkillFactory; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.server.IRepository; + +import org.bukkit.Material; + +public class PvpDonatorShop extends Shop +{ + public PvpDonatorShop(IPlugin plugin, IRepository repository, CoreClientManager manager, IClassFactory gameClassFactory, ISkillFactory skillFactory) + { + super(plugin, repository, manager); + + ShopBlockType = Material.ENDER_CHEST; + + ICurrencyHandler creditHandler = new CreditHandler(); + ICurrencyHandler pointHandler = new PointHandler(); + + AddPageBuilder(new ArmorPurchasePageBuilder(this, "-----------Class-------Skills", gameClassFactory, creditHandler, pointHandler)); + AddPageBuilder(new SkillsPurchasePageBuilder(this, "Class-------Skills----------", skillFactory, gameClassFactory, creditHandler, pointHandler)); + + CreateShopActions(); + + RestoreInventory = true; + } + + @Override + protected void CreateShopActions() + { + new NextPage(Plugin.GetPlugin(), this, ClientManager); + new PreviousPage(Plugin.GetPlugin(), this, ClientManager); + new Purchase(Plugin.GetPlugin(), this, ClientManager); + new ChangeCurrency(Plugin.GetPlugin(), this, ClientManager); + } + + @Override + public void ShowSkillHotBarForPlayer(CoreClient player) { } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/PvpItemShop.java b/Plugins/Core/src/me/chiss/Core/Shop/PvpItemShop.java new file mode 100644 index 000000000..8fd573bb9 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/PvpItemShop.java @@ -0,0 +1,61 @@ +package me.chiss.Core.Shop; + + +import org.bukkit.ChatColor; +import org.bukkit.entity.LivingEntity; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEntityEvent; + +import me.chiss.Core.Plugin.IPlugin; +import me.chiss.Core.PvpShop.IPvpShopFactory; +import me.chiss.Core.Shop.actions.PvpReturn; +import me.chiss.Core.Shop.currency.EconomyHandler; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.pagebuilder.game.PvpShopPageBuilder; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.server.IRepository; + +public class PvpItemShop extends Shop +{ + IPvpShopFactory ShopFactory; + + private String _npcKey; + + public PvpItemShop(IPlugin plugin, IRepository repository, CoreClientManager accountManager, IPvpShopFactory shopFactory, String name) + { + super(plugin, repository, accountManager); + + ShopBlockType = null; + ShopFactory = shopFactory; + _npcKey = ChatColor.stripColor(name); + + ICurrencyHandler economyHandler = new EconomyHandler(); + + AddPageBuilder(new PvpShopPageBuilder(this, name, shopFactory, economyHandler)); + + CreateShopActions(); + } + + @EventHandler + public void OnPlayerInteractEntity(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() instanceof LivingEntity && ((LivingEntity)event.getRightClicked()).isCustomNameVisible() && ChatColor.stripColor(((LivingEntity)event.getRightClicked()).getCustomName()).equalsIgnoreCase(_npcKey)) + { + OpenShopForPlayer(event.getPlayer()); + } + } + + @Override + protected void CreateShopActions() + { + super.CreateShopActions(); + new PvpReturn(GetPlugin(), this, ClientManager, ShopFactory); + } + + @Override + public void ShowSkillHotBarForPlayer(CoreClient player) + { + + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/Shop.java b/Plugins/Core/src/me/chiss/Core/Shop/Shop.java new file mode 100644 index 000000000..b0e50fbfa --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/Shop.java @@ -0,0 +1,444 @@ +package me.chiss.Core.Shop; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass; +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.Class.event.ClassSetupEvent; +import mineplex.minecraft.game.classcombat.Skill.ISkill; +import mineplex.minecraft.game.classcombat.Skill.ISkill.SkillType; +import me.chiss.Core.ClientData.IClientClass; +import me.chiss.Core.Plugin.IPlugin; +import me.chiss.Core.Shop.actions.ChangeCurrency; +import me.chiss.Core.Shop.actions.NextPage; +import me.chiss.Core.Shop.actions.PreviousPage; +import me.chiss.Core.Shop.actions.Purchase; +import me.chiss.Core.Shop.actions.Reset; +import me.chiss.Core.Shop.page.IShopPage; +import me.chiss.Core.Shop.pagebuilder.IPageBuilder; +import me.chiss.Core.Shop.salespackage.ShopItem; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilServer; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.inventory.InventoryOpenEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; +import org.bukkit.plugin.java.JavaPlugin; + +public abstract class Shop implements Listener +{ + private HashMap _classMap; + private HashMap _errorThrottling; + private HashMap _purchaseBlock; + + protected IPlugin Plugin; + protected CoreClientManager ClientManager; + protected List PageBuilders; + protected Material ShopBlockType; + protected HashMap InventoryMap; + protected HashMap ArmorMap; + + protected HashMap PageMap; + + protected boolean RestoreInventory; + + public Shop(IPlugin plugin, CoreClientManager accountManager) + { + Plugin = plugin; + ClientManager = accountManager; + PageBuilders = new ArrayList(); + ShopBlockType = Material.AIR; + PageMap = new HashMap(); + InventoryMap = new HashMap(); + ArmorMap = new HashMap(); + _classMap = new HashMap(); + _errorThrottling = new HashMap(); + _purchaseBlock = new HashMap(); + + Plugin.GetPlugin().getServer().getPluginManager().registerEvents(this, Plugin.GetPlugin()); + } + + @EventHandler(priority = EventPriority.LOW) + public void OnPlayerClickItem(InventoryClickEvent event) + { + if (ClickedCurrentPage(event)) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void OnPlayerPickupItem(PlayerPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (GetPage(event.getPlayer().getName()) != null) + event.setCancelled(true); + } + + @EventHandler + public void OnPlayerCloseInventory(InventoryCloseEvent event) + { + if (ClickedCurrentPage(event.getPlayer(), event.getInventory())) + { + CloseShopForPlayer(ClientManager.Get((Player)event.getPlayer())); + } + } + + @EventHandler + public void OnPlayerQuit(PlayerQuitEvent event) + { + IShopPage page = GetPage(event.getPlayer().getName()); + + if (page != null) + { + CloseShopForPlayer(ClientManager.Get((Player)event.getPlayer())); + event.getPlayer().closeInventory(); + } + } + + @EventHandler + public void OnPlayerOpenInventory(InventoryOpenEvent event) + { + if (event.isCancelled() && ClickedCurrentPage(event.getPlayer(), event.getInventory())) + { + CloseShopForPlayer(ClientManager.Get((Player)event.getPlayer())); + } + } + + public boolean ShouldOpenShop(Block clickedBlock) + { + return clickedBlock.getType() == ShopBlockType; + } + + public boolean HasNextPage(CoreClient gamePlayer) + { + String key = gamePlayer.GetPlayerName(); + return PageMap.get(key).HasNextPage(); + } + + public boolean HasPreviousPage(CoreClient gamePlayer) + { + String key = gamePlayer.GetPlayerName(); + return PageMap.get(key).HasPreviousPage(); + } + + public void OpenShopForPlayer(Player player) + { + CoreClient gamePlayer = ClientManager.Get(player); + String key = gamePlayer.GetPlayerName(); + InventoryMap.put(key, player.getInventory().getContents().clone()); + ArmorMap.put(key, player.getInventory().getArmorContents()); + + if (!PageMap.containsKey(key)) + { + BuildPagesForPlayer(gamePlayer); + } + + ShowSkillHotBarForPlayer(gamePlayer); + + GetPage(gamePlayer).OpenForPlayer(gamePlayer); + } + + public void TurnToNextPage(CoreClient gamePlayer) + { + gamePlayer.GetPlayer().playSound(gamePlayer.GetPlayer().getLocation(), Sound.SILVERFISH_KILL, .6f, .9f); + + GetPage(gamePlayer).CloseForPlayer(gamePlayer); + + String key = gamePlayer.GetPlayerName(); + PageMap.put(key, PageMap.get(key).GetNextPage()); + + GetPage(gamePlayer).OpenForPlayer(gamePlayer); + } + + public void TurnToPreviousPage(CoreClient gamePlayer) + { + gamePlayer.GetPlayer().playSound(gamePlayer.GetPlayer().getLocation(), Sound.SILVERFISH_KILL, .6f, .9f); + + GetPage(gamePlayer).CloseForPlayer(gamePlayer); + + String key = gamePlayer.GetPlayerName(); + PageMap.put(key, PageMap.get(key).GetPreviousPage()); + + GetPage(gamePlayer).OpenForPlayer(gamePlayer); + } + + protected IShopPage GetPage(String playerName) + { + return PageMap.get(playerName); + } + + public IShopPage GetPage(CoreClient gamePlayer) + { + String key = gamePlayer.GetPlayerName(); + return PageMap.get(key); + } + + public void SetPage(CoreClient gamePlayer, IShopPage category) + { + String key = gamePlayer.GetPlayerName(); + PageMap.put(key, category); + } + + public boolean ClickedCurrentPage(InventoryClickEvent event) + { + return ClickedCurrentPage(event.getWhoClicked(), event.getInventory()); + } + + public boolean ClickedCurrentPage(HumanEntity clicker, Inventory inventory) + { + return PageMap.containsKey(clicker.getName()) && inventory.getTitle().equalsIgnoreCase(GetPage(ClientManager.Get((Player)clicker)).GetTitle()); + } + + protected void CreateShopActions() + { + new NextPage(Plugin.GetPlugin(), this, ClientManager); + new PreviousPage(Plugin.GetPlugin(), this, ClientManager); + new Purchase(Plugin.GetPlugin(), this, ClientManager); + new Reset(Plugin.GetPlugin(), this, ClientManager); + new ChangeCurrency(Plugin.GetPlugin(), this, ClientManager); + } + + protected void AddPageBuilder(IPageBuilder pageBuilder) + { + PageBuilders.add(pageBuilder); + } + + protected void BuildPagesForPlayer(CoreClient player) + { + String key = player.GetPlayerName(); + int pageNumber = 1; + IShopPage previousPage = null; + + for (IPageBuilder page : PageBuilders) + { + if (!PageMap.containsKey(key)) + { + IShopPage newPage = page.BuildForPlayer(player); + newPage.SetPageNumber(pageNumber); + + PageMap.put(key, newPage); + } + else + { + previousPage = PageMap.get(key); + + while (previousPage.HasNextPage()) + { + previousPage = previousPage.GetNextPage(); + } + + IShopPage newPage = page.BuildForPlayer(player); + newPage.SetPageNumber(pageNumber); + + previousPage.SetNextPage(newPage); + newPage.SetPreviousPage(previousPage); + } + + pageNumber++; + } + } + + @SuppressWarnings("deprecation") + public void CloseShopForPlayer(CoreClient player) + { + String key = player.GetPlayerName(); + GetPage(player).CloseForPlayer(player); + + IShopPage page = GetPage(player); + + while (page.HasPreviousPage()) + { + page = page.GetPreviousPage(); + } + + IShopPage nextPage; + + while (page.HasNextPage()) + { + nextPage = page.GetNextPage(); + page.SetNextPage(null); + nextPage.SetPreviousPage(null); + page = nextPage; + } + + if (RestoreInventory) + { + if (InventoryMap.containsKey(player.GetPlayerName())) + player.GetPlayer().getInventory().setContents(InventoryMap.get(player.GetPlayerName())); + + if (ArmorMap.containsKey(player.GetPlayerName())) + player.GetPlayer().getInventory().setArmorContents(ArmorMap.get(player.GetPlayerName())); + } + + player.GetPlayer().updateInventory(); + + PageMap.remove(key); + InventoryMap.remove(key); + ArmorMap.remove(key); + + if (player.Donor().IsSavingCustomBuild()) + player.Donor().SaveActiveCustomBuild(true); + + if (player.GetPlayer().isOnline()) + { + player.GetPlayer().sendMessage(ChatColor.BLUE + "Shop>" + ChatColor.GRAY + " Visit " + ChatColor.YELLOW + Plugin.GetWebServerAddress() + "Store" + ChatColor.GRAY + " to purchase Credits!"); + } + } + + public void ResetShopFor(Player player) + { + String key = player.getName(); + + if (PageMap.containsKey(key)) + { + IShopPage currentPage = PageMap.get(key); + + while (currentPage.HasNextPage()) + { + currentPage = currentPage.GetNextPage(); + } + + currentPage.ResetVisuals(); + + while (currentPage.HasPreviousPage()) + { + currentPage = currentPage.GetPreviousPage(); + currentPage.ResetVisuals(); + } + + PageMap.put(key, currentPage); + } + } + + public void SetClassForPlayer(CoreClient player, IPvpClass gameClass) + { + _classMap.put(player.GetPlayerName(), gameClass); + } + + public IPvpClass GetClassForPlayer(CoreClient player) + { + return _classMap.get(player.GetPlayerName()); + } + + public void ShowSkillHotBarForPlayer(CoreClient player) + { + PlayerInventory playerInv = player.Class().GetInventory(); + + for (int i = 9; i < 18; i++) + { + playerInv.setItem(i, null); + } + + for (int i = 27; i < 36; i++) + { + playerInv.setItem(i, null); + } + + String[] skillList = new String[3]; + + ISkill swordSkill = player.Class().GetSkillByType(SkillType.Sword); + ISkill axeSkill = player.Class().GetSkillByType(SkillType.Axe); + ISkill bowSkill = player.Class().GetSkillByType(SkillType.Bow); + ISkill classPassiveASkill = player.Class().GetSkillByType(SkillType.PassiveA); + ISkill classPassiveBSkill = player.Class().GetSkillByType(SkillType.PassiveB); + ISkill globalPassiveASkill = player.Class().GetSkillByType(SkillType.PassiveC); + ISkill globalPassiveBSkill = player.Class().GetSkillByType(SkillType.PassiveD); + ISkill globalPassiveCSkill = player.Class().GetSkillByType(SkillType.PassiveE); + + String swordString = (swordSkill == null ? "None" : swordSkill.GetName() + " " + player.Class().GetSkillLevel(swordSkill)); + String axeString = (axeSkill == null ? "None" : axeSkill.GetName() + " " + player.Class().GetSkillLevel(axeSkill)); + String bowString = (bowSkill == null ? "None" : bowSkill.GetName() + " " + player.Class().GetSkillLevel(bowSkill)); + String classPassiveAString = (classPassiveASkill == null ? "None" : classPassiveASkill.GetName() + " " + player.Class().GetSkillLevel(classPassiveASkill)); + String classPassiveBString = (classPassiveBSkill == null ? "None" : classPassiveBSkill.GetName() + " " + player.Class().GetSkillLevel(classPassiveBSkill)); + String globalPassiveAString = (globalPassiveASkill == null ? "None" : globalPassiveASkill.GetName() + " " + player.Class().GetSkillLevel(globalPassiveASkill)); + String globalPassiveBString = (globalPassiveBSkill == null ? "None" : globalPassiveBSkill.GetName() + " " + player.Class().GetSkillLevel(globalPassiveBSkill)); + String globalPassiveCString = (globalPassiveCSkill == null ? "None" : globalPassiveCSkill.GetName() + " " + player.Class().GetSkillLevel(globalPassiveCSkill)); + + skillList[0] = C.cGray + "Weapon skills: " + swordString + ", " + axeString + ", " + bowString; + skillList[1] = C.cGray + "Class Passive Skills: " + classPassiveAString + ", " + classPassiveBString; + skillList[2] = C.cGray + "Global Passive Skills: " + globalPassiveAString + ", " + globalPassiveBString + ", " + globalPassiveCString; + + ShopItem sword = new ShopItem(Material.IRON_SWORD, "Sword Skill:", GetLore(player.Class(), swordSkill), 1, true, true); + ShopItem axe = new ShopItem(Material.IRON_AXE, "Axe Skill:", GetLore(player.Class(), axeSkill), 1, true, true); + ShopItem bow = new ShopItem(Material.BOW, "Bow Skill:", GetLore(player.Class(), bowSkill), 1, true, true); + ShopItem classPassiveA = new ShopItem(Material.BOOK, "Class Passive A Skills:", GetLore(player.Class(), classPassiveASkill), 1, true, true); + ShopItem classPassiveB = new ShopItem(Material.BOOK, "Class Passive B Skills:", GetLore(player.Class(), classPassiveBSkill), 1, true, true); + ShopItem globalPassiveA = new ShopItem(Material.BOOK, "Global Passive A Skill:", GetLore(player.Class(), globalPassiveASkill), 1, true, true); + ShopItem globalPassiveB = new ShopItem(Material.BOOK, "Global Passive B Skill:", GetLore(player.Class(), globalPassiveBSkill), 1, true, true); + ShopItem globalPassiveC = new ShopItem(Material.BOOK, "Global Passive C Skill:", GetLore(player.Class(), globalPassiveCSkill), 1, true, true); + + playerInv.setItem(18, new ShopItem(Material.WRITTEN_BOOK, "Your Skills:", skillList, 1, true, true)); + playerInv.setItem(19, sword); + playerInv.setItem(20, axe); + playerInv.setItem(21, bow); + playerInv.setItem(22, classPassiveA); + playerInv.setItem(23, classPassiveB); + playerInv.setItem(24, globalPassiveA); + playerInv.setItem(25, globalPassiveB); + playerInv.setItem(26, globalPassiveC); + } + + protected String[] GetLore(IClientClass playerClass, ISkill skill) + { + if (skill == null) + return new String[] { ChatColor.GRAY + "None" }; + + int skillLevel = skill.; + String[] lore = new String[2 + skill.GetDesc().length]; + lore[0] = ChatColor.GRAY + "§l" + (skillLevel == 0 ? "None" : (skill.GetName() + " " + skillLevel)); + + if (skillLevel != 0) + lore[1] = " "; + + for (int i=2; i <= skill.GetDesc().length; i++) + { + lore[i] = ChatColor.GRAY + "" + skill.GetDesc()[i-1]; + } + + return lore; + } + + public JavaPlugin GetPlugin() + { + return Plugin.GetPlugin(); + } + + public void AddPlayerProcessError(CoreClient player) + { + if (_errorThrottling.containsKey(player.GetPlayerName()) && (System.currentTimeMillis() - _errorThrottling.get(player.GetPlayerName()) <= 5000)) + _purchaseBlock.put(player.GetPlayerName(), System.currentTimeMillis()); + + _errorThrottling.put(player.GetPlayerName(), System.currentTimeMillis()); + } + + public boolean CanPlayerAttemptPurchase(CoreClient player) + { + return !_purchaseBlock.containsKey(player.GetPlayerName()) || (System.currentTimeMillis() - _purchaseBlock.get(player.GetPlayerName()) > 10000); + } + + public Material GetBlockType() + { + return ShopBlockType; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/actions/ChangeCurrency.java b/Plugins/Core/src/me/chiss/Core/Shop/actions/ChangeCurrency.java new file mode 100644 index 000000000..30f071f69 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/actions/ChangeCurrency.java @@ -0,0 +1,32 @@ +package me.chiss.Core.Shop.actions; + +import me.chiss.Core.Shop.Shop; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class ChangeCurrency extends ShopActionBase +{ + public ChangeCurrency(JavaPlugin plugin, Shop shop, CoreClientManager clientManager) + { + super(plugin, shop, clientManager); + } + + @EventHandler + public void InventoryClick(InventoryClickEvent event) + { + if (Shop.ClickedCurrentPage(event) && event.isLeftClick() && event.getRawSlot() == 4) + { + CoreClient player = ClientManager.Get((Player)event.getWhoClicked()); + + Shop.GetPage(player).ChangeCurrency(player); + Shop.GetPage(player).UpdateBalance(player); + + event.setCancelled(true); + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/actions/NextPage.java b/Plugins/Core/src/me/chiss/Core/Shop/actions/NextPage.java new file mode 100644 index 000000000..79eb1fc9a --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/actions/NextPage.java @@ -0,0 +1,31 @@ +package me.chiss.Core.Shop.actions; + +import me.chiss.Core.Shop.Shop; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class NextPage extends ShopActionBase +{ + public NextPage(JavaPlugin plugin, Shop shop, CoreClientManager clientManager) + { + super(plugin, shop, clientManager); + } + + @EventHandler + public void InventoryClick(InventoryClickEvent event) + { + CoreClient player = ClientManager.Get((Player)event.getWhoClicked()); + + if (Shop.ClickedCurrentPage(event) && event.getRawSlot() == 8 && Shop.HasNextPage(player)) + { + Shop.TurnToNextPage(player); + + event.setCancelled(true); + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/actions/PreviousPage.java b/Plugins/Core/src/me/chiss/Core/Shop/actions/PreviousPage.java new file mode 100644 index 000000000..8cdf2c32c --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/actions/PreviousPage.java @@ -0,0 +1,31 @@ +package me.chiss.Core.Shop.actions; + +import me.chiss.Core.Shop.Shop; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class PreviousPage extends ShopActionBase +{ + public PreviousPage(JavaPlugin plugin, Shop shop, CoreClientManager clientManager) + { + super(plugin, shop, clientManager); + } + + @EventHandler + public void InventoryClick(InventoryClickEvent event) + { + CoreClient player = ClientManager.Get((Player)event.getWhoClicked()); + + if (Shop.ClickedCurrentPage(event) && event.getRawSlot() == 0 && Shop.HasPreviousPage(player)) + { + Shop.TurnToPreviousPage(player); + + event.setCancelled(true); + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/actions/Purchase.java b/Plugins/Core/src/me/chiss/Core/Shop/actions/Purchase.java new file mode 100644 index 000000000..5f043eb4f --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/actions/Purchase.java @@ -0,0 +1,42 @@ +package me.chiss.Core.Shop.actions; + +import me.chiss.Core.Shop.Shop; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class Purchase extends ShopActionBase +{ + public Purchase(JavaPlugin plugin, Shop shop, CoreClientManager clientManager) + { + super(plugin, shop, clientManager); + } + + @EventHandler + public void InventoryClick(InventoryClickEvent event) + { + if (Shop.ClickedCurrentPage(event) && event.isLeftClick() && !event.isShiftClick() && event.getRawSlot() > 0) + { + if (event.getCurrentItem().getType() != Material.AIR) + { + if (event.getRawSlot() > 8 && event.getRawSlot() < 81) + { + CoreClient player = ClientManager.Get((Player)event.getWhoClicked()); + int slot = event.getRawSlot(); + + Shop.GetPage(player).PlayerWants(player, slot); + + if (Shop.GetPage(player) != null) + Shop.GetPage(player).UpdateBalance(player); + + event.setCancelled(true); + } + } + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/actions/PvpReturn.java b/Plugins/Core/src/me/chiss/Core/Shop/actions/PvpReturn.java new file mode 100644 index 000000000..b187dc480 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/actions/PvpReturn.java @@ -0,0 +1,150 @@ +package me.chiss.Core.Shop.actions; + +import me.chiss.Core.PvpShop.IPvpShopFactory; +import me.chiss.Core.PvpShop.IShopItem; +import me.chiss.Core.Shop.Shop; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; + +public class PvpReturn extends ShopActionBase +{ + private IPvpShopFactory _itemFactory; + + public PvpReturn(JavaPlugin plugin, Shop shop, CoreClientManager clientManager, IPvpShopFactory itemFactory) + { + super(plugin, shop, clientManager); + _itemFactory = itemFactory; + } + + @EventHandler + public void InventoryClick(InventoryClickEvent event) + { + if (!Shop.ClickedCurrentPage(event)) + return; + + if (!event.isRightClick()) + return; + + if (event.isShiftClick()) + return; + + if (event.getRawSlot() <= 0) + return; + + if (event.getCurrentItem().getType() == Material.AIR) + return; + + if (event.getRawSlot() >= 54 && event.getRawSlot() <= 89) + SellStack(event); + + if (event.getRawSlot() >= 9 && event.getRawSlot() <= 53) + SellAll(event); + } + + public void SellAll(InventoryClickEvent event) + { + event.setCancelled(true); + + CoreClient player = ClientManager.Get((Player)event.getWhoClicked()); + ItemStack playerItem = event.getCurrentItem(); + + if (playerItem == null || playerItem.getType() == Material.AIR) + return; + + boolean durable = (playerItem.getType().getMaxDurability() > 0); + + IShopItem sellItem = null; + + for(IShopItem item : _itemFactory.GetItems()) + { + if (item.GetType() != playerItem.getType()) + continue; + + //Compare Data for Non-Durable Only + if (!durable) + if (playerItem.getData() != null) + if (item.GetData() != playerItem.getData().getData()) + continue; + + sellItem = item; + break; + } + + if (sellItem == null) + return; + + byte data = sellItem.GetData(); + if (durable) + data = -1; + + double cost = (double)sellItem.GetEconomyCost() / (double)sellItem.GetAmount() * sellItem.GetReturnPercent(); + int count = UtilInv.removeAll((Player)event.getWhoClicked(), sellItem.GetType(), data); + + //Set Balance + player.Game().SetEconomyBalance(player.Game().GetEconomyBalance() + (int)(count * cost)); + + //Update Balance + Shop.GetPage(player).UpdateBalance(player); + + //Effect + player.GetPlayer().playSound(player.GetPlayer().getLocation(), Sound.PISTON_RETRACT, 0.5f, 2f); + + //Inform + UtilPlayer.message(event.getWhoClicked(), F.main("Shop", "You sold " + + F.item(count + " " + sellItem.GetName()) + " for " + F.count((int)(count * cost) + " Coins") + ".")); + } + + public void SellStack(InventoryClickEvent event) + { + CoreClient player = ClientManager.Get((Player)event.getWhoClicked()); + ItemStack playerItem = event.getCurrentItem(); + + if (playerItem == null || playerItem.getType() == Material.AIR) + return; + + for(IShopItem item : _itemFactory.GetItems()) + { + if (item.GetType() != playerItem.getType()) + continue; + + //Compare Data for Durable Only + if (playerItem.getType().getMaxDurability() == 0) + if (playerItem.getData() != null) + if (item.GetData() != playerItem.getData().getData()) + continue; + + double cost = (double)item.GetEconomyCost() / (double)item.GetAmount() * item.GetReturnPercent(); + int count = playerItem.getAmount(); + + //Set Balance + player.Game().SetEconomyBalance(player.Game().GetEconomyBalance() + (int)(count * cost)); + + //Remove Item + event.setCurrentItem(null); + + //Update Balance + Shop.GetPage(player).UpdateBalance(player); + + //Effect + player.GetPlayer().playSound(player.GetPlayer().getLocation(), Sound.PISTON_RETRACT, 0.5f, 2f); + + //Inform + UtilPlayer.message(event.getWhoClicked(), F.main("Shop", "You sold " + + F.item(count + " " + item.GetName()) + " for " + F.count((int)(count * cost) + " Coins") + ".")); + + event.setCancelled(true); + break; + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/actions/Reset.java b/Plugins/Core/src/me/chiss/Core/Shop/actions/Reset.java new file mode 100644 index 000000000..f3bb3952e --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/actions/Reset.java @@ -0,0 +1,32 @@ +package me.chiss.Core.Shop.actions; + +import me.chiss.Core.Shop.Shop; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class Reset extends ShopActionBase +{ + public Reset(JavaPlugin plugin, Shop shop, CoreClientManager clientManager) + { + super(plugin, shop, clientManager); + } + + @EventHandler + public void InventoryClick(InventoryClickEvent event) + { + if (Shop.ClickedCurrentPage(event) && event.isRightClick() && event.getRawSlot() == 4) + { + CoreClient player = ClientManager.Get((Player)event.getWhoClicked()); + + Shop.GetPage(player).Reset(player); + Shop.GetPage(player).UpdateBalance(player); + + event.setCancelled(true); + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/actions/Return.java b/Plugins/Core/src/me/chiss/Core/Shop/actions/Return.java new file mode 100644 index 000000000..c5a0c6218 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/actions/Return.java @@ -0,0 +1,100 @@ +package me.chiss.Core.Shop.actions; + +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.salespackage.ShopItem; +import me.chiss.Core.Utility.InventoryUtil; +import me.chiss.Core.Weapon.IWeapon; +import me.chiss.Core.Weapon.IWeaponFactory; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.minecraft.game.core.classcombat.item.IItem; +import mineplex.minecraft.game.core.classcombat.item.IItemFactory; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftInventory; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; + +public class Return extends ShopActionBase +{ + private IWeaponFactory _weaponFactory; + private IItemFactory _itemFactory; + + public Return(JavaPlugin plugin, Shop shop, CoreClientManager clientManager, IWeaponFactory weaponFactory, IItemFactory itemFactory) + { + super(plugin, shop, clientManager); + _weaponFactory = weaponFactory; + _itemFactory = itemFactory; + } + + @EventHandler + public void InventoryClick(InventoryClickEvent event) + { + if (Shop.ClickedCurrentPage(event) && event.isRightClick() && !event.isShiftClick() && event.getRawSlot() > 0) + { + if (event.getCurrentItem().getType() != Material.AIR) + { + if (event.getRawSlot() > 8 && event.getRawSlot() < 81) + { + CoreClient player = ClientManager.Get((Player)event.getWhoClicked()); + int slot = event.getRawSlot(); + + Shop.GetPage(player).PlayerReturning(player, slot); + Shop.GetPage(player).UpdateBalance(player); + + event.setCancelled(true); + } + else if (event.getRawSlot() > 80 && event.getRawSlot() < 90) + { + CoreClient player = ClientManager.Get((Player)event.getWhoClicked()); + ItemStack playerItem = event.getCurrentItem(); + boolean foundItem = false; + + for(IWeapon weapon : _weaponFactory.GetWeapons()) + { + if (weapon.GetType() == playerItem.getType() && playerItem.getAmount() >= weapon.GetAmount() && playerItem.getDurability() == 0) + { + ItemStack itemStack = new ShopItem(weapon.GetType(), weapon.GetName(), weapon.GetAmount(), false); + int returnAmount = InventoryUtil.GetCountOfObjectsRemovedInSlot((CraftInventory)player.Class().GetInventory(), event.getSlot(), itemStack); + int cost = weapon.GetTokenCost(); + + player.Donor().ReturnItem(returnAmount * cost); + foundItem = true; + break; + } + } + + if (!foundItem) + { + for(IItem item : _itemFactory.GetItems()) + { + if (item.GetType() == playerItem.getType() && playerItem.getAmount() >= item.GetAmount() && playerItem.getDurability() == 0) + { + ItemStack itemStack = new ShopItem(item.GetType(), item.GetName(), item.GetAmount(), false); + int returnAmount = InventoryUtil.GetCountOfObjectsRemovedInSlot((CraftInventory)player.Class().GetInventory(), event.getSlot(), itemStack); + int cost = item.GetTokenCost(); + + player.Donor().ReturnItem(returnAmount * cost); + foundItem = true; + break; + } + } + } + + if (foundItem) + { + Shop.GetPage(player).UpdateBalance(player); + + player.GetPlayer().playSound(player.GetPlayer().getLocation(), Sound.SPIDER_WALK, 1, .6f); + + event.setCancelled(true); + } + } + } + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/actions/ShopActionBase.java b/Plugins/Core/src/me/chiss/Core/Shop/actions/ShopActionBase.java new file mode 100644 index 000000000..956c25c7b --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/actions/ShopActionBase.java @@ -0,0 +1,23 @@ +package me.chiss.Core.Shop.actions; + +import me.chiss.Core.Shop.Shop; +import mineplex.core.account.CoreClientManager; + +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; + +public abstract class ShopActionBase implements Listener +{ + protected JavaPlugin Plugin; + protected Shop Shop; + protected CoreClientManager ClientManager; + + public ShopActionBase(JavaPlugin plugin, Shop shop, CoreClientManager clientManager) + { + Plugin = plugin; + Shop = shop; + ClientManager = clientManager; + + Plugin.getServer().getPluginManager().registerEvents(this, Plugin); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/currency/CreditHandler.java b/Plugins/Core/src/me/chiss/Core/Shop/currency/CreditHandler.java new file mode 100644 index 000000000..62ca30762 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/currency/CreditHandler.java @@ -0,0 +1,57 @@ +package me.chiss.Core.Shop.currency; + + +import org.bukkit.Material; + +import mineplex.core.account.CoreClient; +import mineplex.minecraft.shop.item.ISalesPackage; + +public class CreditHandler implements ICurrencyHandler +{ + @Override + public int GetCost(ISalesPackage salesPackage) + { + return salesPackage.GetCreditCost(); + } + + @Override + public void Deduct(CoreClient player, ISalesPackage salesPackage) + { + player.Donor().SetCredits(player.Donor().GetBlueGems() - salesPackage.GetCreditCost()); + } + + @Override + public void Return(CoreClient player, ISalesPackage salesPackage) + { + player.Donor().SetCredits(player.Donor().GetBlueGems() + salesPackage.ReturnFrom(player) * salesPackage.GetCreditCost()); + } + + @Override + public String GetName() + { + return "Credits"; + } + + @Override + public boolean CanAfford(CoreClient player, ISalesPackage salesPackage) + { + return player.Donor().GetBlueGems() >= salesPackage.GetCreditCost(); + } + + @Override + public Material GetItemDisplayType() + { + return Material.DIAMOND; + } + + @Override + public void ResetBalance(CoreClient player) + { + } + + @Override + public int GetBalance(CoreClient player) + { + return player.Donor().GetBlueGems(); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/currency/EconomyHandler.java b/Plugins/Core/src/me/chiss/Core/Shop/currency/EconomyHandler.java new file mode 100644 index 000000000..b689e4b04 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/currency/EconomyHandler.java @@ -0,0 +1,58 @@ +package me.chiss.Core.Shop.currency; + + +import org.bukkit.Material; + +import mineplex.core.account.CoreClient; +import mineplex.minecraft.shop.item.ISalesPackage; + +public class EconomyHandler implements ICurrencyHandler +{ + @Override + public int GetCost(ISalesPackage salesPackage) + { + return salesPackage.GetEconomyCost(); + } + + @Override + public void Deduct(CoreClient player, ISalesPackage salesPackage) + { + player.Game().SetEconomyBalance(player.Game().GetEconomyBalance() - salesPackage.GetEconomyCost()); + } + + @Override + public void Return(CoreClient player, ISalesPackage salesPackage) + { + player.Game().SetEconomyBalance(player.Game().GetEconomyBalance() + salesPackage.ReturnFrom(player) * salesPackage.GetEconomyCost()); + } + + @Override + public String GetName() + { + return "Coins"; + } + + @Override + public boolean CanAfford(CoreClient player, ISalesPackage salesPackage) + { + return player.Game().GetEconomyBalance() >= salesPackage.GetEconomyCost(); + } + + @Override + public Material GetItemDisplayType() + { + return Material.GOLD_INGOT; + } + + @Override + public void ResetBalance(CoreClient player) + { + //player.Game().SetEconomyBalance(0); + } + + @Override + public int GetBalance(CoreClient player) + { + return player.Game().GetEconomyBalance(); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/currency/ICurrencyHandler.java b/Plugins/Core/src/me/chiss/Core/Shop/currency/ICurrencyHandler.java new file mode 100644 index 000000000..be38e15c1 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/currency/ICurrencyHandler.java @@ -0,0 +1,19 @@ +package me.chiss.Core.Shop.currency; + + +import org.bukkit.Material; + +import mineplex.core.account.CoreClient; +import mineplex.minecraft.shop.item.ISalesPackage; + +public interface ICurrencyHandler +{ + int GetCost(ISalesPackage salesPackage); + void Deduct(CoreClient player, ISalesPackage salesPackage); + void Return(CoreClient player, ISalesPackage salesPackage); + String GetName(); + Material GetItemDisplayType(); + boolean CanAfford(CoreClient player, ISalesPackage salesPackage); + void ResetBalance(CoreClient player); + int GetBalance(CoreClient player); +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/currency/ItemTokenHandler.java b/Plugins/Core/src/me/chiss/Core/Shop/currency/ItemTokenHandler.java new file mode 100644 index 000000000..8e9dda087 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/currency/ItemTokenHandler.java @@ -0,0 +1,58 @@ +package me.chiss.Core.Shop.currency; + + +import org.bukkit.Material; + +import mineplex.core.account.CoreClient; +import mineplex.minecraft.shop.item.ISalesPackage; + +public class ItemTokenHandler implements ICurrencyHandler +{ + @Override + public int GetCost(ISalesPackage salesPackage) + { + return salesPackage.GetTokenCost(); + } + + @Override + public void Deduct(CoreClient player, ISalesPackage salesPackage) + { + player.Donor().SetItemTokens(player.Donor().GetItemTokens() - salesPackage.GetTokenCost()); + } + + @Override + public void Return(CoreClient player, ISalesPackage salesPackage) + { + player.Donor().SetItemTokens(player.Donor().GetItemTokens() + salesPackage.ReturnFrom(player) * salesPackage.GetTokenCost()); + } + + @Override + public String GetName() + { + return "Item Tokens"; + } + + @Override + public boolean CanAfford(CoreClient player, ISalesPackage salesPackage) + { + return player.Donor().GetItemTokens() >= salesPackage.GetTokenCost(); + } + + @Override + public Material GetItemDisplayType() + { + return Material.EMERALD; + } + + @Override + public void ResetBalance(CoreClient player) + { + player.Donor().ResetItemTokens(); + } + + @Override + public int GetBalance(CoreClient player) + { + return player.Donor().GetItemTokens(); + } +} \ No newline at end of file diff --git a/Plugins/Core/src/me/chiss/Core/Shop/currency/PointHandler.java b/Plugins/Core/src/me/chiss/Core/Shop/currency/PointHandler.java new file mode 100644 index 000000000..bd623f289 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/currency/PointHandler.java @@ -0,0 +1,57 @@ +package me.chiss.Core.Shop.currency; + + +import org.bukkit.Material; + +import mineplex.core.account.CoreClient; +import mineplex.minecraft.shop.item.ISalesPackage; + +public class PointHandler implements ICurrencyHandler +{ + @Override + public int GetCost(ISalesPackage salesPackage) + { + return salesPackage.GetPointCost(); + } + + @Override + public void Deduct(CoreClient player, ISalesPackage salesPackage) + { + player.Donor().SetPoints(player.Donor().GetGreenGems() - salesPackage.GetPointCost()); + } + + @Override + public void Return(CoreClient player, ISalesPackage salesPackage) + { + player.Donor().SetPoints(player.Donor().GetGreenGems() + salesPackage.ReturnFrom(player) * salesPackage.GetPointCost()); + } + + @Override + public String GetName() + { + return "Points"; + } + + @Override + public boolean CanAfford(CoreClient player, ISalesPackage salesPackage) + { + return player.Donor().GetGreenGems() >= salesPackage.GetPointCost(); + } + + @Override + public Material GetItemDisplayType() + { + return Material.EMERALD; + } + + @Override + public void ResetBalance(CoreClient player) + { + } + + @Override + public int GetBalance(CoreClient player) + { + return player.Donor().GetGreenGems(); + } +} \ No newline at end of file diff --git a/Plugins/Core/src/me/chiss/Core/Shop/currency/SkillTokenHandler.java b/Plugins/Core/src/me/chiss/Core/Shop/currency/SkillTokenHandler.java new file mode 100644 index 000000000..97280d596 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/currency/SkillTokenHandler.java @@ -0,0 +1,58 @@ +package me.chiss.Core.Shop.currency; + + +import org.bukkit.Material; + +import mineplex.core.account.CoreClient; +import mineplex.minecraft.shop.item.ISalesPackage; + +public class SkillTokenHandler implements ICurrencyHandler +{ + @Override + public int GetCost(ISalesPackage salesPackage) + { + return salesPackage.GetTokenCost(); + } + + @Override + public void Deduct(CoreClient player, ISalesPackage salesPackage) + { + player.Donor().SetSkillTokens(player.Donor().GetSkillTokens() - salesPackage.GetTokenCost()); + } + + @Override + public void Return(CoreClient player, ISalesPackage salesPackage) + { + player.Donor().SetSkillTokens(player.Donor().GetSkillTokens() + salesPackage.ReturnFrom(player) * salesPackage.GetTokenCost()); + } + + @Override + public String GetName() + { + return "Skill Tokens"; + } + + @Override + public boolean CanAfford(CoreClient player, ISalesPackage salesPackage) + { + return player.Donor().GetSkillTokens() >= salesPackage.GetTokenCost(); + } + + @Override + public Material GetItemDisplayType() + { + return Material.DIAMOND; + } + + @Override + public void ResetBalance(CoreClient player) + { + player.Donor().ResetSkillTokens(); + } + + @Override + public int GetBalance(CoreClient player) + { + return player.Donor().GetSkillTokens(); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/events/PurchasePackageEvent.java b/Plugins/Core/src/me/chiss/Core/Shop/events/PurchasePackageEvent.java new file mode 100644 index 000000000..8c0ee08d9 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/events/PurchasePackageEvent.java @@ -0,0 +1,63 @@ +package me.chiss.Core.Shop.events; + +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class PurchasePackageEvent extends Event implements Cancellable +{ + private static final HandlerList handlers = new HandlerList(); + private boolean _cancelled = false; + + private String _playerName; + private String _itemName; + private String _reason; + + public PurchasePackageEvent(String player, String item) + { + _playerName = player; + _itemName = item; + } + + public String GetPlayerName() + { + return _playerName; + } + + public String GetItemName() + { + return _itemName; + } + + public String GetReason() + { + return _reason; + } + + public void SetReason(String reason) + { + _reason = reason; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean cancel) + { + _cancelled = cancel; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/listeners/IPurchaseListener.java b/Plugins/Core/src/me/chiss/Core/Shop/listeners/IPurchaseListener.java new file mode 100644 index 000000000..69fc2e453 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/listeners/IPurchaseListener.java @@ -0,0 +1,8 @@ +package me.chiss.Core.Shop.listeners; + +import mineplex.minecraft.shop.item.ISalesPackage; + +public interface IPurchaseListener +{ + void OnPurchasePackage(ISalesPackage salesPackage); +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/listeners/IResetListener.java b/Plugins/Core/src/me/chiss/Core/Shop/listeners/IResetListener.java new file mode 100644 index 000000000..6800ea787 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/listeners/IResetListener.java @@ -0,0 +1,6 @@ +package me.chiss.Core.Shop.listeners; + +public interface IResetListener +{ + +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/listeners/IReturnListener.java b/Plugins/Core/src/me/chiss/Core/Shop/listeners/IReturnListener.java new file mode 100644 index 000000000..30d89017a --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/listeners/IReturnListener.java @@ -0,0 +1,8 @@ +package me.chiss.Core.Shop.listeners; + +import mineplex.minecraft.shop.item.ISalesPackage; + +public interface IReturnListener +{ + void OnReturnPackage(ISalesPackage salesPackage); +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/page/IPage.java b/Plugins/Core/src/me/chiss/Core/Shop/page/IPage.java new file mode 100644 index 000000000..968d5981b --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/page/IPage.java @@ -0,0 +1,26 @@ +package me.chiss.Core.Shop.page; + +import java.util.List; + +import org.bukkit.entity.HumanEntity; + +import mineplex.core.account.CoreClient; + +public interface IPage> +{ + String GetTitle(); + boolean HasNextPage(); + boolean HasPreviousPage(); + void SetPreviousPage(PageType previousPage); + void SetNextPage(PageType nextPage); + PageType GetPreviousPage(); + PageType GetNextPage(); + + void OpenForPlayer(CoreClient clicker); + void CloseForPlayer(CoreClient clicker); + + void SetPageNumber(int pageNumber); + int GetPageNumber(); + + List getViewers(); +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/page/IShopPage.java b/Plugins/Core/src/me/chiss/Core/Shop/page/IShopPage.java new file mode 100644 index 000000000..bd22b5542 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/page/IShopPage.java @@ -0,0 +1,22 @@ +package me.chiss.Core.Shop.page; + +import me.chiss.Core.Shop.salespackage.ISalesPackage; +import mineplex.core.account.CoreClient; + +public interface IShopPage extends IPage +{ + void AddItem(ISalesPackage iSalesPackage, int slot); + ISalesPackage GetItem(int itemSlot); + + void Reset(CoreClient player); + + void PlayerWants(CoreClient donor, int slot); + void PlayerReturning(CoreClient player, int slot); + + void ChangeCurrency(CoreClient player); + void UpdateBalance(CoreClient player); + + void UpdateSlot(CoreClient player, int slot); + void ResetVisuals(); + void PrepSlotsForPlayer(CoreClient player); +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/page/PageBase.java b/Plugins/Core/src/me/chiss/Core/Shop/page/PageBase.java new file mode 100644 index 000000000..cf281f20d --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/page/PageBase.java @@ -0,0 +1,86 @@ +package me.chiss.Core.Shop.page; + +import mineplex.core.account.CoreClient; +import net.minecraft.server.v1_6_R2.Item; + +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftInventoryCustom; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; + +public class PageBase> extends CraftInventoryCustom implements IPage +{ + private int _pageNumber; + + protected PageType PreviousPage; + protected PageType NextPage; + + public PageBase(String title) + { + super(null, 54, title); + setMaxStackSize(128); + } + + public void SetPageNumber(int pageNumber) + { + _pageNumber = pageNumber; + } + + public int GetPageNumber() + { + return _pageNumber; + } + + public void SetPreviousPage(PageType previousPage) + { + if (previousPage != null) + { + getInventory().setItem(0, CraftItemStack.asNewCraftStack(Item.PAPER, previousPage.GetPageNumber()).getHandle()); + PreviousPage = previousPage; + } + } + + public PageType GetPreviousPage() + { + return PreviousPage; + } + + public boolean HasPreviousPage() + { + return (PreviousPage != null); + } + + public void SetNextPage(PageType nextPage) + { + if (nextPage != null) + { + getInventory().setItem(8, CraftItemStack.asNewCraftStack(Item.PAPER, nextPage.GetPageNumber()).getHandle()); + NextPage = nextPage; + } + } + + public PageType GetNextPage() + { + return NextPage; + } + + public boolean HasNextPage() + { + return (NextPage != null); + } + + public String GetTitle() + { + return getTitle(); + } + + public void OpenForPlayer(CoreClient playerClient) + { + playerClient.GetPlayer().openInventory(this); + } + + public void CloseForPlayer(CoreClient playerClient) + { + playerClient.GetPlayer().closeInventory(); + this.inventory.onClose((CraftPlayer)playerClient.GetPlayer()); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/page/ShopPageBase.java b/Plugins/Core/src/me/chiss/Core/Shop/page/ShopPageBase.java new file mode 100644 index 000000000..fb6d618fd --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/page/ShopPageBase.java @@ -0,0 +1,208 @@ +package me.chiss.Core.Shop.page; + +import java.util.HashMap; +import java.util.List; + +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.salespackage.ISalesPackage; +import me.chiss.Core.Shop.salespackage.ItemPackage; +import me.chiss.Core.Shop.salespackage.ShopItem; +import mineplex.core.account.CoreClient; + +import org.bukkit.ChatColor; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; + +public abstract class ShopPageBase extends PageBase implements IShopPage +{ + protected Shop Shop; + protected HashMap SalesPackageMap; + protected HashMap UnlockedMap; + protected HashMap LockedMap; + protected List CurrencyHandlers; + protected ICurrencyHandler CurrentCurrencyHandler; + + public ShopPageBase(Shop shop, String title, List currencyHandlers, HashMap unlockedMap, HashMap lockedMap) + { + super(title); + + Shop = shop; + SalesPackageMap = new HashMap(); + UnlockedMap = unlockedMap; + LockedMap = lockedMap; + CurrencyHandlers = currencyHandlers; + + if (CurrencyHandlers != null && CurrencyHandlers.size() > 0) + CurrentCurrencyHandler = CurrencyHandlers.get(0); + } + + public ISalesPackage GetItem(int i) + { + return SalesPackageMap.get(i); + } + + public void UpdateBalance(CoreClient player) + { + int balance = CurrentCurrencyHandler.GetBalance(player); + + String[] lore = new String[5]; + lore[0] = "§rBalance: " + ChatColor.YELLOW + balance + " " + CurrentCurrencyHandler.GetName(); + + SetResetButtonLore(balance, lore); + } + + protected void SetResetButtonLore(int balance, String[] lore) + { + lore[1] = "§rRight-click to return all items on this page."; + + ShopItem currencyItem = new ShopItem(CurrentCurrencyHandler.GetItemDisplayType(), CurrentCurrencyHandler.GetName(), lore, 0, false, true); + + /* Max is 64 still. + if (balance <= 128) + currencyItem.setAmount(balance); + */ + + setItem(4, currencyItem); + } + + public void ResetVisuals() + { + + } + + public void Reset(CoreClient player) + { + player.GetPlayer().playSound(player.GetPlayer().getLocation(), Sound.SPIDER_WALK, 1, .6f); + + for (ISalesPackage salesPackage : SalesPackageMap.values()) + { + CurrentCurrencyHandler.Return(player, salesPackage); + } + } + + public void OpenForPlayer(CoreClient playerClient) + { + PrepSlotsForPlayer(playerClient); + + UpdateBalance(playerClient); + + playerClient.GetPlayer().openInventory(this); + } + + public void PrepSlotsForPlayer(CoreClient playerClient) + { + for (int slot : UnlockedMap.keySet()) + { + UpdateSlot(playerClient, slot); + } + } + + public void CloseForPlayer(CoreClient playerClient) + { + playerClient.GetPlayer().closeInventory(); + this.inventory.onClose((CraftPlayer)playerClient.GetPlayer()); + } + + public void ChangeCurrency(CoreClient playerClient) + { + if (CurrencyHandlers != null) + { + if (CurrencyHandlers.size() > 1) + { + playerClient.GetPlayer().playSound(playerClient.GetPlayer().getLocation(), Sound.NOTE_PLING, 1, .6f); + } + else + { + playerClient.GetPlayer().playSound(playerClient.GetPlayer().getLocation(), Sound.ITEM_BREAK, 1, .6f); + } + + CurrentCurrencyHandler = GetNextCurrencyHandler(); + } + } + + protected ICurrencyHandler GetNextCurrencyHandler() + { + if (CurrencyHandlers.size() > 1) + { + int currentIndex = CurrencyHandlers.indexOf(CurrentCurrencyHandler); + + if (currentIndex + 1 < CurrencyHandlers.size()) + { + return CurrencyHandlers.get(currentIndex + 1); + } + else + { + return CurrencyHandlers.get(0); + } + } + + return CurrentCurrencyHandler; + } + + public void PlayerWants(CoreClient player, int slot) + { + ISalesPackage sellable = GetItem(slot); + + if (sellable != null && CanPurchasePackage(player, sellable)) + { + PurchaseSalesPackage(player, sellable); + } + else + { + player.GetPlayer().playSound(player.GetPlayer().getLocation(), Sound.ITEM_BREAK, 1f, .6f); + } + + UpdateSlot(player, slot); + } + + protected boolean CanPurchasePackage(CoreClient player, ISalesPackage sellable) + { + return CurrentCurrencyHandler.CanAfford(player, sellable) && sellable.CanFitIn(player); + } + + protected void PurchaseSalesPackage(CoreClient player, ISalesPackage sellable) + { + player.GetPlayer().playSound(player.GetPlayer().getLocation(), Sound.ORB_PICKUP, 1f, .6f); + sellable.PurchaseBy(player); + CurrentCurrencyHandler.Deduct(player, sellable); + } + + public void PlayerReturning(CoreClient player, int slot) + { + ISalesPackage sellable = GetItem(slot); + + if (sellable != null && CurrentCurrencyHandler != null) + { + CurrentCurrencyHandler.Return(player, sellable); + } + } + + public void AddItem(ISalesPackage salesItem, int slot) + { + for (Integer salesItemslot : salesItem.AddToCategory(getInventory(), slot)) + { + SalesPackageMap.put(salesItemslot, salesItem); + } + } + + public void UpdateSlot(CoreClient player, int slot) + { + if (UnlockedMap != null && UnlockedMap.get(slot) != null) + { + if (ShowUnlockedAtSlot(player, slot)) + { + AddItem(UnlockedMap.get(slot), slot); + } + else + { + AddItem(LockedMap.get(slot), slot); + } + } + } + + protected boolean ShowUnlockedAtSlot(CoreClient player, int slot) + { + return player.Donor().Owns(UnlockedMap.get(slot).GetSalesPackageId()) || UnlockedMap.get(slot).IsFree(); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/page/game/CustomBuildPage.java b/Plugins/Core/src/me/chiss/Core/Shop/page/game/CustomBuildPage.java new file mode 100644 index 000000000..49c199a0d --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/page/game/CustomBuildPage.java @@ -0,0 +1,270 @@ +package me.chiss.Core.Shop.page.game; + +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; + + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.inventory.ItemStack; + +import me.chiss.Core.Class.IPvpClass; +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.minecraft.game.core.classcombat.Class.repository.token.CustomBuildToken; +import mineplex.minecraft.game.core.classcombat.events.ClassSetupEvent; +import mineplex.minecraft.game.core.classcombat.events.ClassSetupEvent.SetupType; +import mineplex.minecraft.shop.item.ISalesPackage; +import mineplex.minecraft.shop.item.ItemPackage; +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.ShopPageBase; +import me.chiss.Core.Shop.salespackage.ShopItem; + +public class CustomBuildPage extends ShopPageBase +{ + protected IPvpClass _currentClass; + + protected HashMap> UnlockedClassMap; + protected HashMap> LockedClassMap; + + protected boolean equipItems = true; + protected boolean equipDefaultArmor = true; + protected boolean saveActiveCustomBuild = false; + + public CustomBuildPage(Shop shop, String title, List currencyHandlers, HashMap> unlockedClassMap, HashMap> lockedClassMap) + { + super(shop, title, currencyHandlers, null, null); + + UnlockedClassMap = unlockedClassMap; + LockedClassMap = lockedClassMap; + } + + @Override + public void PlayerWants(CoreClient player, int slot) + { + ISalesPackage shopItem = GetItem(slot); + if (shopItem != null) + { + ItemStack item = getItem(slot); + + if (shopItem.CanFitIn(player)) + { + int customBuildIndex = (slot % 9) / 2; + CustomBuildToken customBuild; + + if ((customBuildIndex > 1 && !player.Rank().Has(Rank.EMERALD, false)) + || (customBuildIndex > 2 && !player.Rank().Has(Rank.DIAMOND, false))) + { + player.GetPlayer().playSound(player.GetPlayer().getLocation(), Sound.ITEM_BREAK, 1f, .6f); + } + else + { + if (player.Donor().GetCustomBuilds(_currentClass).containsKey(customBuildIndex)) + { + customBuild = player.Donor().GetCustomBuilds(_currentClass).get(customBuildIndex); + player.Donor().SetTokens(customBuild.SkillTokensBalance, customBuild.ItemTokensBalance); + player.Donor().SetDefaultTokens(120, 120); + } + else + { + customBuild = new CustomBuildToken(); + customBuild.Name = "Build " + (customBuildIndex + 1); + customBuild.PvpClassId = _currentClass.GetSalesPackageId(); + customBuild.SkillTokensBalance = 120; + customBuild.ItemTokensBalance = 120; + player.Donor().SetDefaultTokens(120, 120); + } + + player.Donor().SetActiveCustomBuild(customBuildIndex, _currentClass, customBuild); + + if (item.getType() == Material.INK_SACK && item.getData().getData() != 8) + { + //Event + ClassSetupEvent event = new ClassSetupEvent(player.GetPlayer(), SetupType.ApplyCustomBuild, + _currentClass.GetType(), customBuild.CustomBuildNumber + 1, customBuild); + Shop.GetPlugin().getServer().getPluginManager().callEvent(event); + + if (event.IsCancelled()) + return; + + player.Class().EquipCustomBuild(customBuild, equipItems, equipDefaultArmor); + + if (saveActiveCustomBuild) + player.Donor().SetSavingCustomBuild(customBuildIndex, _currentClass, customBuild); + + Shop.CloseShopForPlayer(player); + } + else if (item.getType() == Material.ANVIL) + { + //Event + ClassSetupEvent event = new ClassSetupEvent(player.GetPlayer(), SetupType.SaveEditCustomBuild, + _currentClass.GetType(), customBuild.CustomBuildNumber + 1, customBuild); + Shop.GetPlugin().getServer().getPluginManager().callEvent(event); + + if (event.IsCancelled()) + return; + + player.Class().EquipCustomBuild(customBuild, equipItems, equipDefaultArmor); + player.Donor().SetSavingCustomBuild(customBuildIndex, _currentClass, customBuild); + Shop.TurnToNextPage(player); + } + else if (item.getType() == Material.WORKBENCH && customBuild.CustomBuildNumber != null) + { + //Event + ClassSetupEvent event = new ClassSetupEvent(player.GetPlayer(), SetupType.EditCustomBuild, + _currentClass.GetType(), customBuild.CustomBuildNumber + 1, customBuild); + Shop.GetPlugin().getServer().getPluginManager().callEvent(event); + + if (event.IsCancelled()) + return; + + player.Class().EquipCustomBuild(customBuild, equipItems, equipDefaultArmor); + Shop.TurnToNextPage(player); + } + else if (item.getType() == Material.FIRE && customBuild.CustomBuildNumber != null) + { + //Event + ClassSetupEvent event = new ClassSetupEvent(player.GetPlayer(), SetupType.DeleteCustomBuild, + _currentClass.GetType(), customBuild.CustomBuildNumber + 1, customBuild); + Shop.GetPlugin().getServer().getPluginManager().callEvent(event); + + if (event.IsCancelled()) + return; + + player.Donor().GetCustomBuilds(_currentClass).remove(customBuildIndex); + ReconstructPageForPlayer(player); + player.Class().UpdateInventory(); + } + } + } + else + { + player.GetPlayer().playSound(player.GetPlayer().getLocation(), Sound.ITEM_BREAK, 1f, .6f); + } + } + } + + @Override + public void UpdateBalance(CoreClient player) + { + + } + + @Override + public void Reset(CoreClient player) + { + + } + + @Override + public void OpenForPlayer(CoreClient player) + { + if (_currentClass == null || _currentClass != player.Class().GetGameClass()) + { + _currentClass = player.Class().GetGameClass(); + + if (_currentClass == null) + _currentClass = Shop.GetClassForPlayer(player); + } + else + { + if (player.Donor().IsSavingCustomBuild()) + player.Donor().SaveActiveCustomBuild(!equipItems); + } + + ReconstructPageForPlayer(player); + + UpdateBalance(player); + + player.Class().OpenInventory(this); + } + + private void ReconstructPageForPlayer(CoreClient player) + { + SalesPackageMap.clear(); + HashMap packageMap = UnlockedClassMap.get(_currentClass); + + if (_currentClass != null) + { + for (Entry entry : packageMap.entrySet()) + { + UpdateClassSlot(player, entry.getKey()); + } + + int slot = 9; + + for (int i=0; i < 5; i++) + { + byte itemData; + String[] lockedText = new String[] { }; + boolean locked = false; + + switch (i) + { + case 0: + itemData = 1; + break; + case 1: + itemData = 14; + break; + case 2: + itemData = 11; + + if (!player.Rank().Has(Rank.EMERALD, false)) + { + locked = true; + lockedText = new String[] { "§rGet " + (i < 3 ? "Silver" : "Gold") + " rank to access this slot" }; + } + break; + case 3: + itemData = 2; + + if (!player.Rank().Has(Rank.DIAMOND, false)) + { + locked = true; + lockedText = new String[] { "§rGet " + (i < 3 ? "GOLD" : "DIAMOND") + " rank to access this slot" }; + } + break; + default: + itemData = 4; + + if (!player.Rank().Has(Rank.DIAMOND, false)) + { + locked = true; + lockedText = new String[] { "§rGet " + (i < 3 ? "GOLD" : "DIAMOND") + " rank to access this slot" }; + } + break; + } + + if (player.Donor().GetCustomBuilds(_currentClass).containsKey(i)) + { + CustomBuildToken customBuild = player.Donor().GetCustomBuilds(_currentClass).get(i); + + AddItem(new ItemPackage(new ShopItem(Material.INK_SACK, itemData, customBuild.Name, lockedText, 1, locked, true), 0, 0, 0, 0, false, -1), slot); + } + else + { + AddItem(new ItemPackage(new ShopItem(Material.INK_SACK, (byte)8, locked ? "Locked Build" : "Unsaved Build", lockedText, 1, locked, true), 0, 0, 0, 0, false, -1), slot); + } + + slot += 2; + } + } + } + + protected void UpdateClassSlot(CoreClient player, int slot) + { + if (UnlockedClassMap.get(_currentClass).get(slot).IsFree() + || (player.Rank().Has(Rank.EMERALD, false) && slot % 9 == 4) + || (player.Rank().Has(Rank.DIAMOND, false) && (slot % 9 == 6 || slot % 9 == 8))) + { + AddItem(UnlockedClassMap.get(_currentClass).get(slot), slot); + } + else + { + AddItem(LockedClassMap.get(_currentClass).get(slot), slot); + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/page/game/ItemPage.java b/Plugins/Core/src/me/chiss/Core/Shop/page/game/ItemPage.java new file mode 100644 index 000000000..d423e11ad --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/page/game/ItemPage.java @@ -0,0 +1,24 @@ +package me.chiss.Core.Shop.page.game; + +import java.util.HashMap; +import java.util.List; + +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.minecraft.shop.item.ISalesPackage; +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.ShopPageBase; + +public class ItemPage extends ShopPageBase +{ + public ItemPage(Shop shop, String title, List currencyHandlers, HashMap unlockedMap, HashMap lockedMap) + { + super(shop, title, currencyHandlers, unlockedMap, lockedMap); + } + + protected boolean ShowUnlockedAtSlot(CoreClient player, int slot) + { + return super.ShowUnlockedAtSlot(player, slot) || player.Rank().Has(Rank.EMERALD, false); + } +} \ No newline at end of file diff --git a/Plugins/Core/src/me/chiss/Core/Shop/page/game/PvpCustomBuildPage.java b/Plugins/Core/src/me/chiss/Core/Shop/page/game/PvpCustomBuildPage.java new file mode 100644 index 000000000..2af170b6b --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/page/game/PvpCustomBuildPage.java @@ -0,0 +1,24 @@ +package me.chiss.Core.Shop.page.game; + +import java.util.HashMap; +import java.util.List; + +import me.chiss.Core.Class.IPvpClass; +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import mineplex.minecraft.shop.item.ISalesPackage; + +public class PvpCustomBuildPage extends CustomBuildPage +{ + public PvpCustomBuildPage(Shop shop, String title, List currencyHandlers, HashMap> unlockedClassMap, HashMap> lockedClassMap) + { + super(shop, title, currencyHandlers, null, null); + + UnlockedClassMap = unlockedClassMap; + LockedClassMap = lockedClassMap; + + equipItems = false; + equipDefaultArmor = false; + saveActiveCustomBuild = true; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/page/game/ShopItemPage.java b/Plugins/Core/src/me/chiss/Core/Shop/page/game/ShopItemPage.java new file mode 100644 index 000000000..292ad72de --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/page/game/ShopItemPage.java @@ -0,0 +1,35 @@ +package me.chiss.Core.Shop.page.game; + +import java.util.HashMap; +import java.util.List; + +import org.bukkit.Sound; + +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.ShopPageBase; +import me.chiss.Core.Shop.salespackage.ShopItem; +import mineplex.core.account.CoreClient; +import mineplex.minecraft.shop.item.ISalesPackage; + +public class ShopItemPage extends ShopPageBase +{ + public ShopItemPage(Shop shop, String title, List currencyHandlers, HashMap unlockedMap, HashMap lockedMap) + { + super(shop, title, currencyHandlers, unlockedMap, lockedMap); + } + + @Override + protected void SetResetButtonLore(int balance, String[] lore) + { + setItem(4, new ShopItem(CurrentCurrencyHandler.GetItemDisplayType(), CurrentCurrencyHandler.GetName(), lore, 0, false, true)); + } + + @Override + protected void PurchaseSalesPackage(CoreClient player, ISalesPackage sellable) + { + player.GetPlayer().playSound(player.GetPlayer().getLocation(), Sound.ORB_PICKUP, 1f, .6f); + sellable.PurchaseBy(player); + CurrentCurrencyHandler.Deduct(player, sellable); + } +} \ No newline at end of file diff --git a/Plugins/Core/src/me/chiss/Core/Shop/page/game/SkillsPage.java b/Plugins/Core/src/me/chiss/Core/Shop/page/game/SkillsPage.java new file mode 100644 index 000000000..2a26bc2db --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/page/game/SkillsPage.java @@ -0,0 +1,340 @@ +package me.chiss.Core.Shop.page.game; + +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.inventory.PlayerInventory; + +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.minecraft.game.core.classcombat.Class.IPvpClass; +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.ShopPageBase; +import me.chiss.Core.Shop.salespackage.DonationPackage; +import me.chiss.Core.Shop.salespackage.ISalesPackage; +import me.chiss.Core.Shop.salespackage.ShopItem; +import me.chiss.Core.Shop.salespackage.SkillPackage; + +public class SkillsPage extends ShopPageBase +{ + protected IPvpClass CurrentClass; + protected HashMap>> UnlockedClassMap; + protected HashMap> UnlockedGlobalMap; + protected HashMap>> LockedClassMap; + protected HashMap> LockedGlobalMap; + + public SkillsPage(Shop shop, String title, List currencyHandlers, + HashMap>> unlockedClassMap, HashMap> unlockedGlobalMap, + HashMap>> lockedClassMap, HashMap> lockedGlobalMap) + { + super(shop, title, currencyHandlers, null, null); + + UnlockedClassMap = unlockedClassMap; + UnlockedGlobalMap = unlockedGlobalMap; + LockedClassMap = lockedClassMap; + LockedGlobalMap = lockedGlobalMap; + } + + @Override + public void OpenForPlayer(CoreClient player) + { + if (CurrentClass == null || CurrentClass != player.Class().GetGameClass()) + { + CurrentClass = player.Class().GetGameClass(); + + if (CurrentClass == null) + CurrentClass = Shop.GetClassForPlayer(player); + } + + ReconstructPageForPlayer(player); + + PlayerInventory playerInv = player.Class().GetInventory(); + + for (int i = 9; i < 36; i++) + { + playerInv.setItem(i, null); + } + + TranslateIntoVirtualInventory(player); + + UpdateBalance(player); + + player.Class().OpenInventory(this); + } + + @Override + public void CloseForPlayer(CoreClient player) + { + PlayerInventory playerInv = player.Class().GetInventory(); + + for (int i = 9; i < 36; i++) + { + playerInv.setItem(i, null); + } + + Shop.ShowSkillHotBarForPlayer(player); + + player.GetPlayer().closeInventory(); + this.inventory.onClose((CraftPlayer)player.GetPlayer()); + } + + @Override + public void PlayerWants(CoreClient player, int slot) + { + ISalesPackage sellable = GetItem(slot); + + if (sellable == null) + { + player.GetPlayer().playSound(player.GetPlayer().getLocation(), Sound.ITEM_BREAK, 1f, .6f); + return; + } + + if (CurrentCurrencyHandler.CanAfford(player, sellable) && sellable.CanFitIn(player)) + { + PurchaseSalesPackage(player, sellable, slot); + } + else + { + player.GetPlayer().playSound(player.GetPlayer().getLocation(), Sound.ITEM_BREAK, 1f, .6f); + } + } + + protected void PurchaseSalesPackage(CoreClient player, ISalesPackage sellable, int slot) + { + if (sellable instanceof SkillPackage) + { + SkillPackage skillSellable = GetSkillPackage(sellable); + + ISkill existingSkill = player.Class().GetSkillByType(skillSellable.GetSkill().GetSkillType()); + + if (existingSkill != null) + { + for (Entry salesPackage : SalesPackageMap.entrySet()) + { + if (salesPackage.getValue() instanceof SkillPackage) + { + SkillPackage otherSkillSellable = GetSkillPackage(salesPackage.getValue()); + + if (otherSkillSellable.GetSkill() == existingSkill) + { + if (existingSkill != skillSellable.GetSkill()) + { + int skillLevel = player.Class().GetSkillLevel(existingSkill); + for (int i=0; i < skillLevel; i++) + { + CurrentCurrencyHandler.Return(player, otherSkillSellable); + } + + otherSkillSellable.ReturnAllLevels(player); + + if (slot >= 54) + { + UnlockedGlobalMap.get(salesPackage.getKey() - 45).get(0).DeliverTo(player.Class(), salesPackage.getKey() - 45); + SalesPackageMap.put(salesPackage.getKey(), UnlockedGlobalMap.get(salesPackage.getKey() - 45).get(0)); + } + else + { + AddItem(UnlockedClassMap.get(CurrentClass).get(salesPackage.getKey()).get(0), salesPackage.getKey()); + } + } + + break; + } + } + } + } + + if (!skillSellable.IsActive() || skillSellable.GetLevel() < skillSellable.GetSkill().GetMaxLevel()) + { + int index = skillSellable.IsActive() ? skillSellable.GetLevel() + 1 : skillSellable.GetLevel(); + + if (player.Donor().Owns(skillSellable.GetSkill().GetSalesPackageId(index)) || skillSellable.GetSkill().IsFree(index) || player.Rank().Has(Rank.DIAMOND, false)) + { + player.GetPlayer().playSound(player.GetPlayer().getLocation(), Sound.ORB_PICKUP, 1f, .6f); + + if (slot >= 54) + { + UpdateGlobalSlot(player, slot, index); + } + else + { + UpdateClassSlot(player, slot, index); + } + + GetItem(slot).PurchaseBy(player); + CurrentCurrencyHandler.Deduct(player, GetItem(slot)); + } + } + } + } + + @Override + public void Reset(CoreClient player) + { + player.GetPlayer().playSound(player.GetPlayer().getLocation(), Sound.SPIDER_WALK, 1, .6f); + + for (Entry entry : SalesPackageMap.entrySet()) + { + if (entry.getValue() instanceof SkillPackage) + { + SkillPackage skillSellable = (SkillPackage)entry.getValue(); + int skillLevel = player.Class().GetSkillLevel(skillSellable.GetSkill()); + + for (int i=0; i < skillLevel; i++) + CurrentCurrencyHandler.Return(player, skillSellable); + + skillSellable.ReturnAllLevels(player); + + skillLevel = player.Class().GetSkillLevel(skillSellable.GetSkill()); + + player.Class().AddSkill(skillSellable.GetSkill(), 0); + + if (entry.getKey() >= 54) + { + UpdateGlobalSlot(player, entry.getKey(), player.Class().GetSkillLevel(skillSellable.GetSkill())); + } + else + { + UpdateClassSlot(player, entry.getKey(), player.Class().GetSkillLevel(skillSellable.GetSkill())); + } + } + } + + player.Donor().ResetSkillTokens(); + } + + @Override + public void PlayerReturning(CoreClient player, int slot) + { + ISalesPackage sellable = GetItem(slot); + + if (sellable instanceof SkillPackage) + { + SkillPackage skillSellable = (SkillPackage)sellable; + + if (skillSellable.IsActive()) + { + player.GetPlayer().playSound(player.GetPlayer().getLocation(), Sound.SPIDER_WALK, 1, .6f); + + int index = skillSellable.GetLevel() - 1; + + if (slot >= 54) + { + UpdateGlobalSlot(player, slot, index); + } + else + { + UpdateClassSlot(player, slot, index); + } + + CurrentCurrencyHandler.Return(player, sellable); + } + } + } + + public void ResetVisuals() + { + CurrentClass = null; + } + + protected void TranslateIntoVirtualInventory(CoreClient player) + { + PlayerInventory playerInv = player.Class().GetInventory(); + playerInv.setItem(9, new ShopItem(Material.INK_SACK, (byte)11, "Global Passive A Skills", null, 1, true, true)); + playerInv.setItem(18, new ShopItem(Material.INK_SACK, (byte)2, "Global Passive B Skills", null, 1, true, true)); + playerInv.setItem(27, new ShopItem(Material.INK_SACK, (byte)4, "Global Passive C Skills", null, 1, true, true)); + + for (Entry> entry : UnlockedGlobalMap.entrySet()) + { + UpdateGlobalSlot(player, 45 + entry.getKey(), GetIndexForSkill(player, entry, GetSkillPackage(0, entry.getValue()))); + } + } + + private void ReconstructPageForPlayer(CoreClient player) + { + clear(); + + if (PreviousPage != null) + { + SetPreviousPage(PreviousPage); + } + + if (NextPage != null) + { + SetNextPage(NextPage); + } + + SalesPackageMap.clear(); + HashMap> packageMap = UnlockedClassMap.get(CurrentClass); + + AddItem(new ItemPackage(new ShopItem(Material.IRON_SWORD, "Sword Skills", null, 1, true, true), 0, 0, 0, 0, false, -1), 9); + AddItem(new ItemPackage(new ShopItem(Material.IRON_AXE, "Axe Skills", null, 1, true, true), 0, 0, 0, 0, false, -1), 18); + AddItem(new ItemPackage(new ShopItem(Material.BOW, "Bow Skills", null, 1, true, true), 0, 0, 0, 0, false, -1), 27); + AddItem(new ItemPackage(new ShopItem(Material.INK_SACK, (byte)1, "Class Passive A Skills", null, 1, true, true), 0, 0, 0, 0, false, -1), 36); + AddItem(new ItemPackage(new ShopItem(Material.INK_SACK, (byte)14, "Class Passive B Skills", null, 1, true, true), 0, 0, 0, 0, false, -1), 45); + + if (CurrentClass != null) + { + for (Entry> entry : packageMap.entrySet()) + { + UpdateClassSlot(player, entry.getKey(), GetIndexForSkill(player, entry, GetSkillPackage(0, entry.getValue()))); + } + } + } + + protected int GetIndexForSkill(CoreClient player, Entry> entry, SkillPackage skillPackage) + { + return player.Class().GetSkillLevel(skillPackage.GetSkill()); + } + + protected SkillPackage GetSkillPackage(int number, List salesPacakgeList) + { + return GetSkillPackage(salesPacakgeList.get(number)); + } + + protected SkillPackage GetSkillPackage(ISalesPackage salesPackage) + { + SkillPackage skillPackage; + if (salesPackage instanceof DonationPackage) + { + skillPackage = (SkillPackage)((DonationPackage)salesPackage).GetWrappedPackage(); + } + else + { + skillPackage = (SkillPackage)salesPackage; + } + + return skillPackage; + } + + protected void UpdateGlobalSlot(CoreClient player, int slot, int index) + { + if (player.Donor().Owns(UnlockedGlobalMap.get(slot - 45).get(index).GetSalesPackageId()) || UnlockedGlobalMap.get(slot - 45).get(index).IsFree() || player.Rank().Has(Rank.DIAMOND, false)) + { + UnlockedGlobalMap.get(slot - 45).get(index).DeliverTo(player.Class(), slot - 45); + SalesPackageMap.put(slot, UnlockedGlobalMap.get(slot - 45).get(index)); + } + else + { + LockedGlobalMap.get(slot - 45).get(index).DeliverTo(player.Class(), slot - 45); + SalesPackageMap.put(slot, LockedGlobalMap.get(slot - 45).get(index)); + } + } + + protected void UpdateClassSlot(CoreClient player, int slot, int index) + { + if (player.Donor().Owns(UnlockedClassMap.get(CurrentClass).get(slot).get(index).GetSalesPackageId()) || UnlockedClassMap.get(CurrentClass).get(slot).get(index).IsFree() || player.Rank().Has(Rank.DIAMOND, false)) + { + AddItem(UnlockedClassMap.get(CurrentClass).get(slot).get(index), slot); + } + else + { + AddItem(LockedClassMap.get(CurrentClass).get(slot).get(index), slot); + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/page/game/WeaponPage.java b/Plugins/Core/src/me/chiss/Core/Shop/page/game/WeaponPage.java new file mode 100644 index 000000000..98ffa6a9c --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/page/game/WeaponPage.java @@ -0,0 +1,78 @@ +package me.chiss.Core.Shop.page.game; + +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; + +import me.chiss.Core.Class.IPvpClass; +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.minecraft.shop.item.ISalesPackage; +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.ShopPageBase; + +public class WeaponPage extends ShopPageBase +{ + private IPvpClass _currentClass; + + private HashMap> UnlockedClassMap; + private HashMap> LockedClassMap; + + public WeaponPage(Shop shop, String title, List currencyHandlers, HashMap> unlockedClassMap, HashMap> lockedClassMap) + { + super(shop, title, currencyHandlers, null, null); + + UnlockedClassMap = unlockedClassMap; + LockedClassMap = lockedClassMap; + } + + @Override + public void OpenForPlayer(CoreClient player) + { + if (_currentClass == null || _currentClass != player.Class().GetGameClass()) + { + _currentClass = player.Class().GetGameClass(); + + if (_currentClass == null) + _currentClass = Shop.GetClassForPlayer(player); + } + + ReconstructPageForPlayer(player); + + UpdateBalance(player); + + player.Class().OpenInventory(this); + } + + private void ReconstructPageForPlayer(CoreClient player) + { + SalesPackageMap.clear(); + HashMap packageMap = UnlockedClassMap.get(_currentClass); + + if (_currentClass != null) + { + for (Entry entry : packageMap.entrySet()) + { + UpdateClassSlot(player, entry.getKey()); + } + } + } + + protected void UpdateClassSlot(CoreClient player, int slot) + { + if (player.Donor().Owns(UnlockedClassMap.get(_currentClass).get(slot).GetSalesPackageId()) || UnlockedClassMap.get(_currentClass).get(slot).IsFree() || player.Rank().Has(Rank.EMERALD, false)) + { + AddItem(UnlockedClassMap.get(_currentClass).get(slot), slot); + } + else + { + AddItem(LockedClassMap.get(_currentClass).get(slot), slot); + } + } + + protected boolean ShowUnlockedAtSlot(CoreClient player, int slot) + { + return super.ShowUnlockedAtSlot(player, slot) || player.Rank().Has(Rank.EMERALD, false); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/page/game/purchase/ArmorPurchasePage.java b/Plugins/Core/src/me/chiss/Core/Shop/page/game/purchase/ArmorPurchasePage.java new file mode 100644 index 000000000..81120e335 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/page/game/purchase/ArmorPurchasePage.java @@ -0,0 +1,81 @@ +package me.chiss.Core.Shop.page.game.purchase; + +import java.util.HashMap; +import java.util.List; + +import org.bukkit.ChatColor; + +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.game.purchase.ConfirmationPage; +import me.chiss.Core.Shop.salespackage.DefaultClassPackage; +import me.chiss.Core.Shop.salespackage.DonationPackage; +import me.chiss.Core.Shop.salespackage.ShopItem; +import mineplex.core.account.CoreClient; +import mineplex.minecraft.game.classcombat.shop.page.ArmorPage; +import mineplex.minecraft.shop.item.ISalesPackage; + +public class ArmorPurchasePage extends ArmorPage +{ + public ArmorPurchasePage(Shop shop, String title, List currencyHandlers, HashMap unlockedMap, HashMap lockedMap) + { + super(shop, title, currencyHandlers, unlockedMap, lockedMap); + } + + @Override + protected void SetResetButtonLore(int balance, String[] lore) + { + if (CurrencyHandlers.size() > 1) + { + lore[1] = "§rClick to change to " + GetNextCurrencyHandler().GetName(); + } + + if (balance <= 0) + { + setItem(4, new ShopItem(CurrentCurrencyHandler.GetItemDisplayType(), CurrentCurrencyHandler.GetName() + "(None)", lore, 0, false, true)); + } + else + { + setItem(4, new ShopItem(CurrentCurrencyHandler.GetItemDisplayType(), CurrentCurrencyHandler.GetName(), lore, 0, false, true)); + } + } + + @Override + protected void PurchaseSalesPackage(CoreClient player, ISalesPackage sellable) + { + player.Class().GetInventory().clear(); + + for (ICurrencyHandler allCurrencyHandler : CurrencyHandlers) + { + allCurrencyHandler.ResetBalance(player); + } + + player.Class().SetGameClass(null); + + player.Class().ClearDefaults(); + + if (player.Donor().Owns(sellable.GetSalesPackageId()) || sellable.IsFree()) + { + DefaultClassPackage wrappedPackage = (DefaultClassPackage)((DonationPackage)sellable).GetWrappedPackage(); + Shop.SetClassForPlayer(player, wrappedPackage.GetGameClass()); + + SetNextPage(NextPage); + Shop.TurnToNextPage(player); + } + else + { + new ConfirmationPage(Shop, this, sellable, CurrentCurrencyHandler, player).OpenForPlayer(player); + } + } + + @Override + public void UpdateBalance(CoreClient player) + { + int balance = CurrentCurrencyHandler.GetBalance(player); + + String[] lore = new String[5]; + lore[0] = "§rBalance: " + ChatColor.YELLOW + balance + " " + CurrentCurrencyHandler.GetName(); + + SetResetButtonLore(balance, lore); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/page/game/purchase/ConfirmationPage.java b/Plugins/Core/src/me/chiss/Core/Shop/page/game/purchase/ConfirmationPage.java new file mode 100644 index 000000000..7dcf2e1dc --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/page/game/purchase/ConfirmationPage.java @@ -0,0 +1,387 @@ +package me.chiss.Core.Shop.page.game.purchase; + +import java.util.List; + +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.CreditHandler; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.events.PurchasePackageEvent; +import me.chiss.Core.Shop.page.IShopPage; +import me.chiss.Core.Shop.salespackage.ShopItem; +import mineplex.core.server.util.TransactionResponse; +import mineplex.core.account.CoreClient; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.minecraft.shop.item.ISalesPackage; +import mineplex.minecraft.shop.item.ItemPackage; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftInventoryCustom; +import org.bukkit.inventory.ItemStack; + +public class ConfirmationPage extends CraftInventoryCustom implements IShopPage, Runnable +{ + private Shop _shop; + private Runnable _runnable; + private IShopPage _returnCategory; + private ISalesPackage _salesItem; + private ICurrencyHandler _currencyHandler; + private CoreClient _player; + private String _title; + private int _okSquareSlotStart; + private boolean _processing; + private boolean _receivedResult; + private int _progressCount; + private ShopItem _progressItem; + private int _taskId; + + public ConfirmationPage(Shop shop, IShopPage returnCategory, ISalesPackage salesItem, ICurrencyHandler currencyHandler, CoreClient player) + { + this(shop, null, returnCategory, salesItem, currencyHandler, player); + } + + public ConfirmationPage(Shop shop, Runnable runnable, IShopPage returnCategory, ISalesPackage salesItem, ICurrencyHandler currencyHandler, CoreClient player) + { + super(null, 54, " Confirmation"); + + _shop = shop; + _runnable = runnable; + _title = " Confirmation"; + _returnCategory = returnCategory; + _salesItem = salesItem; + _currencyHandler = currencyHandler; + _player = player; + _progressItem = new ShopItem(Material.WOOL, (byte)11, ChatColor.BLUE + "Processing", null, 1, false, true); + _okSquareSlotStart = 27; + + if (_shop.CanPlayerAttemptPurchase(player)) + { + BuildPage(); + } + else + { + BuildErrorPage("You have attempted too many invalid transactions. Please wait 10 seconds before retrying."); + _taskId = _shop.GetPlugin().getServer().getScheduler().scheduleSyncRepeatingTask(_shop.GetPlugin(), this, 2L, 2L); + } + } + + private void BuildPage() + { + _salesItem.AddToCategory(this.getInventory(), 22); + + this.getInventory().setItem(4, new ShopItem(_currencyHandler.GetItemDisplayType(), (byte)0, _currencyHandler.GetName(), new String[] { C.cGray + _currencyHandler.GetCost(_salesItem) + " " + _currencyHandler.GetName() + " will be deducted from your account balance." }, 1, false, true).getHandle()); + + BuildSquareAt(_okSquareSlotStart, new ShopItem(Material.WOOL, (byte)5, ChatColor.GREEN + "OK", null, 1, false, true)); + BuildSquareAt(_okSquareSlotStart + 6, new ShopItem(Material.WOOL, (byte)14, ChatColor.RED + "CANCEL", null, 1, false, true)); + } + + private void BuildSquareAt(int slot, ShopItem item) + { + BuildSquareAt(slot, item, new ItemPackage(item, 0, 0, 0, 0, false, -1)); + } + + private void BuildSquareAt(int slot, ShopItem item, ISalesPackage middleItem) + { + this.setItem(slot, item); + this.setItem(slot + 1, item); + this.setItem(slot + 2, item); + + slot += 9; + + this.setItem(slot, item); + List slotsAddedTo = middleItem.AddToCategory(this.getInventory(), slot + 1); + this.setItem(slot + 2, item); + + boolean crossedItem = true; + + while (crossedItem) + { + crossedItem = false; + + slot += 9; + + if (!slotsAddedTo.contains(slot)) + this.setItem(slot, item); + else + crossedItem = true; + + if (!slotsAddedTo.contains(slot + 1)) + this.setItem(slot + 1, item); + else + crossedItem = true; + + if (!slotsAddedTo.contains(slot + 2)) + this.setItem(slot + 2, item); + else + crossedItem = true; + } + } + + @Override + public ISalesPackage GetItem(int itemSlot) + { + return null; + } + + @Override + public void PrepSlotsForPlayer(CoreClient clicker) + { + + } + + @Override + public void OpenForPlayer(CoreClient clicker) + { + _shop.SetPage(clicker, this); + + clicker.Class().OpenInventory(this); + } + + @Override + public void CloseForPlayer(CoreClient clicker) + { + clicker.Class().CloseInventory(); + _processing = false; + } + + @Override + public String GetTitle() + { + return _title; + } + + @Override + public void Reset(CoreClient player) + { + } + + @Override + public boolean HasNextPage() + { + return false; + } + + @Override + public boolean HasPreviousPage() + { + return false; + } + + @Override + public void SetPreviousPage(IShopPage previousPage) + { + + } + + @Override + public void SetNextPage(IShopPage nextPage) + { + + } + + @Override + public IShopPage GetPreviousPage() + { + return null; + } + + @Override + public IShopPage GetNextPage() + { + return null; + } + + @Override + public void AddItem(ISalesPackage iSalesPackage, int slot) + { + } + + @Override + public void SetPageNumber(int pageNumber) + { + } + + @Override + public int GetPageNumber() + { + return 0; + } + + @Override + public void UpdateBalance(CoreClient player) + { + + } + + @Override + public void PlayerWants(CoreClient donor, int slot) + { + ItemStack item = getItem(slot); + if (item != null) + { + if (item.getType() == Material.WOOL) + { + if (_receivedResult) + { + _returnCategory.OpenForPlayer(donor); + _shop.SetPage(donor, _returnCategory); + _shop.GetPlugin().getServer().getScheduler().cancelTask(_taskId); + } + else + { + if (item.getData().getData() == 5) + { + ProcessTransaction(); + } + else if (item.getData().getData() == 14) + { + _returnCategory.OpenForPlayer(donor); + _shop.SetPage(donor, _returnCategory); + _shop.GetPlugin().getServer().getScheduler().cancelTask(_taskId); + } + } + } + } + } + + @Override + public void PlayerReturning(CoreClient player, int slot) + { + + } + + @Override + public void ResetVisuals() + { + + } + + @Override + public void ChangeCurrency(CoreClient player) + { + + } + + @Override + public void UpdateSlot(CoreClient player, int slot) + { + + } + + private void ProcessTransaction() + { + for (int i=_okSquareSlotStart; i < 54; i++) + { + clear(i); + } + + _processing = true; + + PurchasePackageEvent event = new PurchasePackageEvent(_player.GetPlayerName(), _salesItem.GetName()); + + _shop.GetPlugin().getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) + { + _shop.GetRepository().PurchaseSalesPackage(new Callback () + { + public void run(TransactionResponse response) + { + ShowResultsPage(response); + } + }, _player.GetPlayerName(), _currencyHandler instanceof CreditHandler, _salesItem.GetSalesPackageId()); + + _taskId = _shop.GetPlugin().getServer().getScheduler().scheduleSyncRepeatingTask(_shop.GetPlugin(), this, 2L, 2L); + } + else + { + BuildErrorPage(event.GetReason()); + _shop.AddPlayerProcessError(_player); + } + } + + private void ShowResultsPage(TransactionResponse response) + { + _processing = false; + _receivedResult = true; + + switch (response) + { + case Failed: + BuildErrorPage("There was an error processing your request."); + _shop.AddPlayerProcessError(_player); + break; + case InsufficientFunds: + BuildErrorPage("Your account has insufficient funds."); + _shop.AddPlayerProcessError(_player); + break; + case Success: + _salesItem.PurchaseBy(_player); + _currencyHandler.Deduct(_player, _salesItem); + + BuildSuccessPage("Your purchase was successful."); + + if (_runnable != null) + _runnable.run(); + + break; + } + + _progressCount = 0; + } + + private void BuildErrorPage(String message) + { + ShopItem item = new ShopItem(Material.WOOL, (byte)14, ChatColor.RED + message, null, 1, false, true); + for (int i = 0; i < this.getSize(); i++) + { + this.setItem(i, item); + } + + _player.GetPlayer().playSound(_player.GetPlayer().getLocation(), Sound.BLAZE_DEATH, 1, .1f); + } + + private void BuildSuccessPage(String message) + { + ShopItem item = new ShopItem(Material.WOOL, (byte)5, ChatColor.GREEN + message, null, 1, false, true); + for (int i = 0; i < this.getSize(); i++) + { + this.setItem(i, item); + } + + _player.GetPlayer().playSound(_player.GetPlayer().getLocation(), Sound.NOTE_PLING, 1, .9f); + } + + @Override + public void run() + { + if (_processing) + { + if (_progressCount == 9) + { + for (int i=45; i < 54; i++) + { + clear(i); + } + + _progressCount = 0; + } + + setItem(45 + _progressCount, _progressItem); + } + else + { + if (_progressCount >= 20) + { + _shop.GetPlugin().getServer().getScheduler().cancelTask(_taskId); + + _shop.SetPage(_player, _returnCategory); + _returnCategory.OpenForPlayer(_player); + } + } + + _progressCount++; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/page/game/purchase/ItemPurchasePage.java b/Plugins/Core/src/me/chiss/Core/Shop/page/game/purchase/ItemPurchasePage.java new file mode 100644 index 000000000..e45a540f7 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/page/game/purchase/ItemPurchasePage.java @@ -0,0 +1,51 @@ +package me.chiss.Core.Shop.page.game.purchase; + +import java.util.HashMap; +import java.util.List; + +import org.bukkit.Sound; + +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.minecraft.shop.item.ISalesPackage; +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.game.ItemPage; +import me.chiss.Core.Shop.salespackage.ShopItem; + +public class ItemPurchasePage extends ItemPage +{ + public ItemPurchasePage(Shop shop, String title, List currencyHandlers, HashMap unlockedMap, HashMap lockedMap) + { + super(shop, title, currencyHandlers, unlockedMap, lockedMap); + } + + @Override + protected void SetResetButtonLore(int balance, String[] lore) + { + if (CurrencyHandlers.size() > 1) + { + lore[1] = "§rClick to change to " + GetNextCurrencyHandler().GetName(); + } + + if (balance <= 0) + { + setItem(4, new ShopItem(CurrentCurrencyHandler.GetItemDisplayType(), CurrentCurrencyHandler.GetName() + "(None)", lore, 0, false, true)); + } + else + { + setItem(4, new ShopItem(CurrentCurrencyHandler.GetItemDisplayType(), CurrentCurrencyHandler.GetName(), lore, 0, false, true)); + } + } + + @Override + protected void PurchaseSalesPackage(CoreClient player, ISalesPackage sellable) + { + if (!player.Donor().Owns(sellable.GetSalesPackageId()) && !sellable.IsFree() && !player.Rank().Has(Rank.EMERALD, false)) + new ConfirmationPage(Shop, this, sellable, CurrentCurrencyHandler, player).OpenForPlayer(player); + else + { + player.GetPlayer().playSound(player.GetPlayer().getLocation(), Sound.ITEM_BREAK, 1f, .6f); + } + } +} \ No newline at end of file diff --git a/Plugins/Core/src/me/chiss/Core/Shop/page/game/purchase/SkillsPurchasePage.java b/Plugins/Core/src/me/chiss/Core/Shop/page/game/purchase/SkillsPurchasePage.java new file mode 100644 index 000000000..af82eb4e0 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/page/game/purchase/SkillsPurchasePage.java @@ -0,0 +1,109 @@ +package me.chiss.Core.Shop.page.game.purchase; + +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; + +import org.bukkit.Sound; + +import me.chiss.Core.Class.IPvpClass; +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.minecraft.shop.item.ISalesPackage; +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.game.SkillsPage; +import me.chiss.Core.Shop.salespackage.DonationPackage; +import me.chiss.Core.Shop.salespackage.ShopItem; +import me.chiss.Core.Shop.salespackage.SkillPackage; + +public class SkillsPurchasePage extends SkillsPage +{ + public SkillsPurchasePage(Shop shop, String title, List currencyHandlers, + HashMap>> unlockedClassMap, HashMap> unlockedGlobalMap, + HashMap>> lockedClassMap, HashMap> lockedGlobalMap) + { + super(shop, title, currencyHandlers, unlockedClassMap, unlockedGlobalMap, lockedClassMap, lockedGlobalMap); + } + + @Override + protected void SetResetButtonLore(int balance, String[] lore) + { + if (CurrencyHandlers.size() > 1) + { + lore[1] = "§rClick to change to " + GetNextCurrencyHandler().GetName(); + } + + if (balance <= 0) + { + setItem(4, new ShopItem(CurrentCurrencyHandler.GetItemDisplayType(), CurrentCurrencyHandler.GetName() + "(None)", lore, 0, false, true)); + } + else + { + ShopItem currencyItem = new ShopItem(CurrentCurrencyHandler.GetItemDisplayType(), CurrentCurrencyHandler.GetName(), lore, 0, false, true); + + /* Max is still 64 + if (balance <= 128) + currencyItem.setAmount(balance); + */ + + setItem(4, currencyItem); + } + } + + @Override + protected void PurchaseSalesPackage(CoreClient player, ISalesPackage sellable, int slot) + { + if (sellable instanceof DonationPackage) + { + SkillPackage skillSellable = GetSkillPackage(sellable); + + if (player.Rank().Has(Rank.DIAMOND, false)) + { + player.GetPlayer().playSound(player.GetPlayer().getLocation(), Sound.ITEM_BREAK, 1f, .6f); + return; + } + + if (!skillSellable.IsActive() || skillSellable.GetLevel() < skillSellable.GetSkill().GetMaxLevel()) + { + int index = skillSellable.IsActive() ? skillSellable.GetLevel() + 1 : skillSellable.GetLevel(); + + if (slot >= 54) + { + sellable = LockedGlobalMap.get(slot - 45).get(index); + } + else + { + sellable = LockedClassMap.get(CurrentClass).get(slot).get(index); + } + + new ConfirmationPage(Shop, this, sellable, CurrentCurrencyHandler, player).OpenForPlayer(player); + } + } + } + + @Override + protected int GetIndexForSkill(CoreClient player, Entry> entry, SkillPackage skillPackage) + { + int index = 0; + + if (player.Donor().Owns(entry.getValue().get(index).GetSalesPackageId()) || entry.getValue().get(index).IsFree() || player.Rank().Has(Rank.DIAMOND, false)) + { + for (int i = 1; i <= skillPackage.GetSkill().GetMaxLevel(); i++) + { + skillPackage = GetSkillPackage(entry.getValue().get(i)); + + if (!player.Donor().Owns(skillPackage.GetSalesPackageId()) && !skillPackage.IsFree() && !player.Rank().Has(Rank.DIAMOND, false)) + break; + + index = i; + } + } + else + { + index = player.Class().GetSkillLevel(skillPackage.GetSkill()); + } + + return index; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/page/game/purchase/WeaponPurchasePage.java b/Plugins/Core/src/me/chiss/Core/Shop/page/game/purchase/WeaponPurchasePage.java new file mode 100644 index 000000000..11a5d5fe2 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/page/game/purchase/WeaponPurchasePage.java @@ -0,0 +1,52 @@ +package me.chiss.Core.Shop.page.game.purchase; + +import java.util.HashMap; +import java.util.List; + +import org.bukkit.Sound; + +import me.chiss.Core.Class.IPvpClass; +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.minecraft.shop.item.ISalesPackage; +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.game.WeaponPage; +import me.chiss.Core.Shop.salespackage.ShopItem; + +public class WeaponPurchasePage extends WeaponPage +{ + public WeaponPurchasePage(Shop shop, String title, List currencyHandlers, HashMap> unlockedClassMap, HashMap> lockedClassMap) + { + super(shop, title, currencyHandlers, unlockedClassMap, lockedClassMap); + } + + @Override + protected void SetResetButtonLore(int balance, String[] lore) + { + if (CurrencyHandlers.size() > 1) + { + lore[1] = "§rClick to change to " + GetNextCurrencyHandler().GetName(); + } + + if (balance <= 0) + { + setItem(4, new ShopItem(CurrentCurrencyHandler.GetItemDisplayType(), CurrentCurrencyHandler.GetName() + "(None)", lore, 0, false, true)); + } + else + { + setItem(4, new ShopItem(CurrentCurrencyHandler.GetItemDisplayType(), CurrentCurrencyHandler.GetName(), lore, 0, false, true)); + } + } + + @Override + protected void PurchaseSalesPackage(CoreClient player, ISalesPackage sellable) + { + if (!player.Donor().Owns(sellable.GetSalesPackageId()) && !sellable.IsFree() && !player.Rank().Has(Rank.EMERALD, false)) + new ConfirmationPage(Shop, this, sellable, CurrentCurrencyHandler, player).OpenForPlayer(player); + else + { + player.GetPlayer().playSound(player.GetPlayer().getLocation(), Sound.ITEM_BREAK, 1f, .6f); + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/IPageBuilder.java b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/IPageBuilder.java new file mode 100644 index 000000000..b85dbf935 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/IPageBuilder.java @@ -0,0 +1,9 @@ +package me.chiss.Core.Shop.pagebuilder; + +import me.chiss.Core.Shop.page.IShopPage; +import mineplex.core.account.CoreClient; + +public interface IPageBuilder +{ + IShopPage BuildForPlayer(CoreClient player); +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/PageBuilderBase.java b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/PageBuilderBase.java new file mode 100644 index 000000000..38c754a2a --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/PageBuilderBase.java @@ -0,0 +1,54 @@ +package me.chiss.Core.Shop.pagebuilder; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; + +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.pagebuilder.itemwrapper.IItemWrapper; +import mineplex.minecraft.shop.item.ISalesPackage; + +public abstract class PageBuilderBase implements IPageBuilder +{ + protected Shop Shop; + protected String Title; + protected IItemWrapper ItemWrapper; + protected HashMap LockedSalesPackageMap; + protected HashMap UnlockedSalesPackageMap; + protected List CurrencyHandlers; + + public PageBuilderBase(Shop shop, String title, IItemWrapper itemWrapper, ICurrencyHandler...currencyHandlers) + { + Shop = shop; + Title = title; + ItemWrapper = itemWrapper; + CurrencyHandlers = Arrays.asList(currencyHandlers); + + LockedSalesPackageMap = new HashMap(); + UnlockedSalesPackageMap = new HashMap(); + } + + protected void AddItem(HashMap map, ISalesPackage salesItem, int slot) + { + map.put(slot, ItemWrapper.WrapPackage(salesItem)); + } + + protected void AddItem(HashMap map, ISalesPackage salesItem) + { + map.put(GetNextAvailableSlotNumber(map), ItemWrapper.WrapPackage(salesItem)); + } + + protected int GetNextAvailableSlotNumber(HashMap map) + { + int slot = 45; + + while(map.get(slot) != null) + { + slot++; + slot += slot % 9 == 0 ? -18 : 0; + } + + return slot; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/CustomBuildPageBuilder.java b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/CustomBuildPageBuilder.java new file mode 100644 index 000000000..245891aae --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/CustomBuildPageBuilder.java @@ -0,0 +1,89 @@ +package me.chiss.Core.Shop.pagebuilder.game; + +import java.util.HashMap; +import java.util.List; + +import org.bukkit.Material; + +import me.chiss.Core.Class.IClassFactory; +import me.chiss.Core.Class.IPvpClass; +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.IShopPage; +import me.chiss.Core.Shop.page.game.CustomBuildPage; +import me.chiss.Core.Shop.pagebuilder.PageBuilderBase; +import me.chiss.Core.Shop.pagebuilder.itemwrapper.NoWrapper; +import me.chiss.Core.Shop.salespackage.ShopItem; +import mineplex.core.account.CoreClient; +import mineplex.minecraft.shop.item.ISalesPackage; +import mineplex.minecraft.shop.item.ItemPackage; + +public class CustomBuildPageBuilder extends PageBuilderBase +{ + protected HashMap> ClassLockedSalesPackageMap; + protected HashMap> ClassUnlockedSalesPackageMap; + + protected ItemPackage _unlockedEditSavedBuild; + protected ItemPackage _lockedEditSavedBuild; + + protected ItemPackage _unlockedEditDontSaveBuild; + protected ItemPackage _lockedEditDontSaveBuild; + + protected ItemPackage _unlockedDeleteBuild; + protected ItemPackage _lockedDeleteBuild; + + protected List CurrencyHandlers; + + public CustomBuildPageBuilder(Shop shop, String title, IClassFactory gameClassFactory, ICurrencyHandler...currencyHandlers) + { + super(shop, title, new NoWrapper(), currencyHandlers); + + ClassLockedSalesPackageMap = new HashMap>(); + ClassUnlockedSalesPackageMap = new HashMap>(); + + _unlockedEditSavedBuild = new ItemPackage(new ShopItem(Material.ANVIL, "Edit & Save Build", new String[] { }, 1, false, true), 0, 0, 0, 0, true, -1); + _lockedEditSavedBuild = new ItemPackage(new ShopItem(Material.ANVIL, "Edit & Save Build", new String[] { }, 1, true, true), 0, 0, 0, 0, true, -1); + + _unlockedEditDontSaveBuild = new ItemPackage(new ShopItem(Material.WORKBENCH, "Edit & Don't Save Build", new String[] { }, 1, false, true), 0, 0, 0, 0, true, -1); + _lockedEditDontSaveBuild = new ItemPackage(new ShopItem(Material.WORKBENCH, "Edit & Don't Save Build", new String[] { }, 1, true, true), 0, 0, 0, 0, true, -1); + + _unlockedDeleteBuild = new ItemPackage(new ShopItem(Material.FIRE, "Delete Build", new String[] { "§rIt will never come back..."}, 1, false, true), 0, 0, 0, 0, true, -1); + _lockedDeleteBuild = new ItemPackage(new ShopItem(Material.FIRE, "Delete Build", new String[] { "§rIt will never come back..." }, 1, true, true), 0, 0, 0, 0, true, -1); + + for (IPvpClass gameClass : gameClassFactory.GetGameClasses()) + { + HashMap lockedClassMap = new HashMap(); + HashMap unlockedClassMap = new HashMap(); + + BuildCustomBuildPage(unlockedClassMap, lockedClassMap); + + ClassLockedSalesPackageMap.put(gameClass, lockedClassMap); + ClassUnlockedSalesPackageMap.put(gameClass, unlockedClassMap); + } + } + + @Override + public IShopPage BuildForPlayer(CoreClient player) + { + return new CustomBuildPage(Shop, Title, CurrencyHandlers, ClassUnlockedSalesPackageMap, ClassLockedSalesPackageMap); + } + + protected void BuildCustomBuildPage(HashMap unlockedClassMap, HashMap lockedClassMap) + { + int slot = 18; + + for (int i=0; i < 5; i++) + { + lockedClassMap.put(slot, _lockedEditSavedBuild); + unlockedClassMap.put(slot, _unlockedEditSavedBuild); + + lockedClassMap.put(slot + 9, _lockedEditDontSaveBuild); + unlockedClassMap.put(slot + 9, _unlockedEditDontSaveBuild); + + lockedClassMap.put(slot + 27, _lockedDeleteBuild); + unlockedClassMap.put(slot + 27, _unlockedDeleteBuild); + + slot += 2; + } + } +} \ No newline at end of file diff --git a/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/ItemPageBuilder.java b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/ItemPageBuilder.java new file mode 100644 index 000000000..268b20cd1 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/ItemPageBuilder.java @@ -0,0 +1,121 @@ +package me.chiss.Core.Shop.pagebuilder.game; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.IShopPage; +import me.chiss.Core.Shop.page.game.ItemPage; +import me.chiss.Core.Shop.pagebuilder.PageBuilderBase; +import me.chiss.Core.Shop.pagebuilder.itemwrapper.IItemWrapper; +import me.chiss.Core.Shop.pagebuilder.itemwrapper.NoWrapper; +import me.chiss.Core.Shop.salespackage.ShopItem; +import mineplex.core.account.CoreClient; +import mineplex.core.common.util.C; +import mineplex.minecraft.game.core.classcombat.item.IItem; +import mineplex.minecraft.game.core.classcombat.item.IItemFactory; +import mineplex.minecraft.shop.item.ItemPackage; + +public class ItemPageBuilder extends PageBuilderBase +{ + private IItemFactory _itemFactory; + + public ItemPageBuilder(Shop shop, String title, IItemWrapper itemWrapper, IItemFactory itemFactory, ICurrencyHandler...currencyHandlers) + { + super(shop, title, itemWrapper, currencyHandlers); + + _itemFactory = itemFactory; + + for (IItem item : _itemFactory.GetItems()) + { + int slot = 9; + + switch (item.GetType()) + { + case POTATO_ITEM: + slot = 9; + break; + case APPLE: + slot = 10; + break; + case CARROT_ITEM: + slot = 11; + break; + case MUSHROOM_SOUP: + slot = 12; + break; + case COMMAND: + slot = 18; + break; + case NOTE_BLOCK: + slot = 19; + break; + case REDSTONE_LAMP_ON: + slot = 20; + break; + case POTION: + slot = 27; + break; + case SLIME_BALL: + slot = 28; + break; + case ENDER_PEARL: + slot = 29; + break; + case STONE_AXE: + slot = 30; + break; + case NETHER_STAR: + slot = 31; + break; + case MELON_SEEDS: + slot = 32; + break; + case SHEARS: + slot = 36; + break; + case ARROW: + slot = 45; + break; + case WEB: + slot = 46; + break; + default: + break; + } + + AddItemPackage(item, slot); + } + } + + public ItemPageBuilder(Shop shop, String title, IItemFactory itemFactory, ICurrencyHandler...currencyHandlers) + { + this(shop, title, new NoWrapper(), itemFactory, currencyHandlers); + } + + @Override + public IShopPage BuildForPlayer(CoreClient player) + { + return new ItemPage(Shop, Title, CurrencyHandlers, UnlockedSalesPackageMap, LockedSalesPackageMap); + } + + protected void AddItemPackage(IItem item, int slot) + { + List itemLore = new ArrayList(); + + itemLore.add(C.cYellow + item.GetTokenCost() + " Tokens"); + itemLore.add(C.cBlack); + + itemLore.addAll(Arrays.asList(item.GetDesc())); + + for (int i = 2; i < itemLore.size(); i++) + { + itemLore.set(i, C.cGray + itemLore.get(i)); + } + + AddItem(LockedSalesPackageMap, new ItemPackage(new ShopItem(item.GetType(), item.GetName(), itemLore.toArray(new String[itemLore.size()]), item.GetAmount(), true), item.GetCreditCost(), item.GetPointCost(), item.GetTokenCost(), item.GetEconomyCost(), item.IsFree(), item.GetSalesPackageId()), slot); + AddItem(UnlockedSalesPackageMap, new ItemPackage(new ShopItem(item.GetType(), item.GetName(), itemLore.toArray(new String[itemLore.size()]), item.GetAmount(), false), item.GetCreditCost(), item.GetPointCost(), item.GetTokenCost(), item.GetEconomyCost(), item.IsFree(), item.GetSalesPackageId()), slot); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/PvpCustomBuildPageBuilder.java b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/PvpCustomBuildPageBuilder.java new file mode 100644 index 000000000..b791ad53c --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/PvpCustomBuildPageBuilder.java @@ -0,0 +1,22 @@ +package me.chiss.Core.Shop.pagebuilder.game; + +import me.chiss.Core.Class.IClassFactory; +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.IShopPage; +import me.chiss.Core.Shop.page.game.PvpCustomBuildPage; +import mineplex.core.account.CoreClient; + +public class PvpCustomBuildPageBuilder extends CustomBuildPageBuilder +{ + public PvpCustomBuildPageBuilder(Shop shop, String title, IClassFactory gameClassFactory, ICurrencyHandler...currencyHandlers) + { + super(shop, title, gameClassFactory, currencyHandlers); + } + + @Override + public IShopPage BuildForPlayer(CoreClient player) + { + return new PvpCustomBuildPage(Shop, Title, CurrencyHandlers, ClassUnlockedSalesPackageMap, ClassLockedSalesPackageMap); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/PvpShopPageBuilder.java b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/PvpShopPageBuilder.java new file mode 100644 index 000000000..bbdf2fc52 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/PvpShopPageBuilder.java @@ -0,0 +1,63 @@ +package me.chiss.Core.Shop.pagebuilder.game; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import me.chiss.Core.PvpShop.IPvpShopFactory; +import me.chiss.Core.PvpShop.IShopItem; +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.IShopPage; +import me.chiss.Core.Shop.page.game.ShopItemPage; +import me.chiss.Core.Shop.pagebuilder.PageBuilderBase; +import me.chiss.Core.Shop.pagebuilder.itemwrapper.IItemWrapper; +import me.chiss.Core.Shop.pagebuilder.itemwrapper.NoWrapper; +import me.chiss.Core.Shop.salespackage.PvpItemPackage; +import me.chiss.Core.Shop.salespackage.PvpShopItem; +import mineplex.core.account.CoreClient; +import mineplex.core.common.util.C; + +public class PvpShopPageBuilder extends PageBuilderBase +{ + private IPvpShopFactory _shopFactory; + + public PvpShopPageBuilder(Shop shop, String title, IItemWrapper itemWrapper, IPvpShopFactory shopFactory, ICurrencyHandler...currencyHandlers) + { + super(shop, title, itemWrapper, currencyHandlers); + + _shopFactory = shopFactory; + + for (IShopItem item : _shopFactory.GetItems()) + AddItemPackage(item, item.GetSlot()); + } + + public PvpShopPageBuilder(Shop shop, String title, IPvpShopFactory shopFactory, ICurrencyHandler...currencyHandlers) + { + this(shop, title, new NoWrapper(), shopFactory, currencyHandlers); + } + + @Override + public IShopPage BuildForPlayer(CoreClient player) + { + return new ShopItemPage(Shop, Title, CurrencyHandlers, UnlockedSalesPackageMap, LockedSalesPackageMap); + } + + protected void AddItemPackage(IShopItem item, int slot) + { + List itemLore = new ArrayList(); + + itemLore.add(C.cGreen + item.GetEconomyCost() + " Coins"); + itemLore.add(C.cBlack); + + itemLore.addAll(Arrays.asList(item.GetDesc())); + + for (int i = 2; i < itemLore.size(); i++) + { + itemLore.set(i, C.cGray + itemLore.get(i)); + } + + AddItem(UnlockedSalesPackageMap, new PvpItemPackage(new PvpShopItem(item.GetType(), item.GetData(), item.GetName(), item.GetDeliveryName(), itemLore.toArray(new String[itemLore.size()]), item.GetAmount(), false, true), + item.GetCreditCost(), item.GetPointCost(), item.GetTokenCost(), item.GetEconomyCost(), item.IsFree(), item.GetSalesPackageId()), slot); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/SkillsPageBuilder.java b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/SkillsPageBuilder.java new file mode 100644 index 000000000..36420377a --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/SkillsPageBuilder.java @@ -0,0 +1,191 @@ +package me.chiss.Core.Shop.pagebuilder.game; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; + +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.IShopPage; +import me.chiss.Core.Shop.page.game.SkillsPage; +import me.chiss.Core.Shop.pagebuilder.IPageBuilder; +import me.chiss.Core.Shop.salespackage.ISalesPackage; +import me.chiss.Core.Shop.salespackage.SkillPackage; +import mineplex.core.account.CoreClient; +import mineplex.core.common.util.C; +import mineplex.minecraft.game.core.classcombat.Class.ClassManager; +import mineplex.minecraft.game.core.classcombat.Class.IClassFactory; +import mineplex.minecraft.game.core.classcombat.Class.IPvpClass; +import mineplex.minecraft.game.core.classcombat.Skill.ISkillFactory; +import mineplex.minecraft.game.core.classcombat.Skill.SkillFactory; + +public class SkillsPageBuilder implements IPageBuilder +{ + private SkillFactory _skillFactory; + private ClassManager _gameClassFactory; + + protected Shop Shop; + protected String Title; + + protected HashMap>> ClassLockedSalesPackageMap; + protected HashMap>> ClassUnlockedSalesPackageMap; + + protected HashMap> GlobalLockedSalesPackageMap; + protected HashMap> GlobalUnlockedSalesPackageMap; + + protected List CurrencyHandlers; + + public SkillsPageBuilder(Shop shop, String title, SkillFactory skillFactory, ClassManager gameClassFactory, ICurrencyHandler...currencyHandlers) + { + Shop = shop; + CurrencyHandlers = Arrays.asList(currencyHandlers); + Title = title; + _skillFactory = skillFactory; + _gameClassFactory = gameClassFactory; + + ClassLockedSalesPackageMap = new HashMap>>(); + ClassUnlockedSalesPackageMap = new HashMap>>(); + + GlobalLockedSalesPackageMap = new HashMap>(); + GlobalUnlockedSalesPackageMap = new HashMap>(); + + BuildClassSkills(); + BuildGlobalSkills(); + } + + @Override + public IShopPage BuildForPlayer(CoreClient player) + { + IShopPage category = new SkillsPage(Shop, Title, CurrencyHandlers, + ClassUnlockedSalesPackageMap, GlobalUnlockedSalesPackageMap, + ClassLockedSalesPackageMap, GlobalLockedSalesPackageMap); + + return category; + } + + private void BuildClassSkills() + { + int slotNumber = 53; + + for (IPvpClass gameClass : _gameClassFactory.GetGameClasses()) + { + HashMap> lockedClassMap = new HashMap>(); + HashMap> unlockedClassMap = new HashMap>(); + + int swordSlotNumber = 10; + int axeSlotNumber = 19; + int bowSlotNumber = 28; + int passiveASlotNumber = 37; + int passiveBSlotNumber = 46; + + for (ISkill skill : _skillFactory.GetSkillsFor(gameClass)) + { + switch (skill.GetSkillType()) + { + case Sword: + slotNumber = swordSlotNumber; + swordSlotNumber++; + break; + case Axe: + slotNumber = axeSlotNumber; + axeSlotNumber++; + break; + case Bow: + slotNumber = bowSlotNumber; + bowSlotNumber++; + break; + case PassiveA: + slotNumber = passiveASlotNumber; + passiveASlotNumber++; + break; + case PassiveB: + slotNumber = passiveBSlotNumber; + passiveBSlotNumber++; + break; + + default: + continue; + } + + List unlockedskillPackages = new ArrayList(skill.GetMaxLevel()); + List lockedSkillPackages = new ArrayList(skill.GetMaxLevel()); + + BuildSkillPackages(skill, unlockedskillPackages, lockedSkillPackages); + + lockedClassMap.put(slotNumber, lockedSkillPackages); + unlockedClassMap.put(slotNumber, unlockedskillPackages); + } + + ClassLockedSalesPackageMap.put(gameClass, lockedClassMap); + ClassUnlockedSalesPackageMap.put(gameClass, unlockedClassMap); + } + } + + private void BuildGlobalSkills() + { + int slotNumber = 53; + + int passiveCSlotNumber = 10; + int passiveDSlotNumber = 19; + int passiveESlotNumber = 28; + + for (ISkill skill : _skillFactory.GetGlobalSkills()) + { + switch (skill.GetSkillType()) + { + case PassiveC: + slotNumber = passiveCSlotNumber; + passiveCSlotNumber++; + break; + case PassiveD: + slotNumber = passiveDSlotNumber; + passiveDSlotNumber++; + break; + case PassiveE: + slotNumber = passiveESlotNumber; + passiveESlotNumber++; + break; + + default: + continue; + } + + List unlockedskillPackages = new ArrayList(skill.GetMaxLevel()); + List lockedSkillPackages = new ArrayList(skill.GetMaxLevel()); + + BuildSkillPackages(skill, unlockedskillPackages, lockedSkillPackages); + + GlobalLockedSalesPackageMap.put(slotNumber, lockedSkillPackages); + GlobalUnlockedSalesPackageMap.put(slotNumber, unlockedskillPackages); + } + } + + protected void BuildSkillPackages(ISkill skill, List unlockedSkillPackages, List lockedSkillPackages) + { + List skillLore = new ArrayList(); + + skillLore.add(C.cYellow + skill.GetTokenCost() + " Tokens" + C.cWhite + " per Level"); + skillLore.add(C.cWhite + "Equipped " + C.cYellow + "0/" + skill.GetMaxLevel() + C.cWhite + " Levels"); + // skillLore.add(C.cWhite + "You own " + C.cYellow + levelOwned + "/" + skill.GetMaxLevel() + C.cWhite + " Levels"); + skillLore.add(C.cBlack); + + skillLore.addAll(Arrays.asList(skill.GetDesc())); + + for (int i = 2; i < skillLore.size(); i++) + { + skillLore.set(i, C.cGray + skillLore.get(i)); + } + + lockedSkillPackages.add(new SkillPackage(skill, skillLore.toArray(new String[skillLore.size()]), false, 1, true)); + unlockedSkillPackages.add(new SkillPackage(skill, skillLore.toArray(new String[skillLore.size()]), false, 1, false)); + + for (int i = 1; i <= skill.GetMaxLevel(); i++) + { + skillLore.set(1, C.cWhite + "Equipped " + C.cYellow + i + "/" + skill.GetMaxLevel() + C.cWhite + " Levels"); + // skillLore.add(C.cWhite + "You own " + C.cYellow + levelOwned + "/" + skill.GetMaxLevel() + C.cWhite + " Levels"); + lockedSkillPackages.add(new SkillPackage(skill, skillLore.toArray(new String[skillLore.size()]), true, i, true)); + unlockedSkillPackages.add(new SkillPackage(skill, skillLore.toArray(new String[skillLore.size()]), true, i, false)); + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/WeaponPageBuilder.java b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/WeaponPageBuilder.java new file mode 100644 index 000000000..ba30b417e --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/WeaponPageBuilder.java @@ -0,0 +1,120 @@ +package me.chiss.Core.Shop.pagebuilder.game; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; + +import me.chiss.Core.Class.IClassFactory; +import me.chiss.Core.Class.IPvpClass; +import mineplex.minecraft.game.core.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.shop.item.ISalesPackage; +import mineplex.minecraft.shop.item.ItemPackage; +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.IShopPage; +import me.chiss.Core.Shop.page.game.WeaponPage; +import me.chiss.Core.Shop.pagebuilder.IPageBuilder; +import me.chiss.Core.Shop.salespackage.ShopItem; +import me.chiss.Core.Weapon.IWeapon; +import me.chiss.Core.Weapon.IWeaponFactory; +import mineplex.core.account.CoreClient; +import mineplex.core.common.util.C; + +public class WeaponPageBuilder implements IPageBuilder +{ + protected Shop Shop; + protected String Title; + + private IWeaponFactory _weaponFactory; + + protected HashMap> ClassLockedSalesPackageMap; + protected HashMap> ClassUnlockedSalesPackageMap; + + protected List CurrencyHandlers; + + public WeaponPageBuilder(Shop shop, String title, IWeaponFactory weaponFactory, IClassFactory gameClassFactory, ICurrencyHandler...currencyHandlers) + { + Shop = shop; + CurrencyHandlers = Arrays.asList(currencyHandlers); + Title = title; + _weaponFactory = weaponFactory; + + ClassLockedSalesPackageMap = new HashMap>(); + ClassUnlockedSalesPackageMap = new HashMap>(); + + for (IPvpClass gameClass : gameClassFactory.GetGameClasses()) + { + HashMap lockedClassMap = new HashMap(); + HashMap unlockedClassMap = new HashMap(); + + for (IWeapon weapon : _weaponFactory.GetWeapons()) + { + int slot = 9; + + switch (weapon.GetType()) + { + case IRON_SWORD: + slot = 9; + break; + case DIAMOND_SWORD: + slot = 10; + break; + case GOLD_SWORD: + slot = 11; + break; + case IRON_AXE: + slot = 18; + break; + case DIAMOND_AXE: + slot = 19; + break; + case GOLD_AXE: + slot = 20; + break; + case BOW: + if (gameClass.GetType() != ClassType.Assassin && gameClass.GetType() != ClassType.Ranger) + continue; + + slot = 27; + if (weapon.GetName().contains("Booster")) + slot ++; + else if (weapon.GetName().contains("Power")) + slot += 2; + break; + default: + break; + } + + BuildWeaponPackages(weapon, unlockedClassMap, lockedClassMap, slot); + } + + ClassLockedSalesPackageMap.put(gameClass, lockedClassMap); + ClassUnlockedSalesPackageMap.put(gameClass, unlockedClassMap); + } + } + + @Override + public IShopPage BuildForPlayer(CoreClient player) + { + return new WeaponPage(Shop, Title, CurrencyHandlers, ClassUnlockedSalesPackageMap, ClassLockedSalesPackageMap); + } + + protected void BuildWeaponPackages(IWeapon weapon, HashMap unlockedClassMap, HashMap lockedClassMap, int slot) + { + List itemLore = new ArrayList(); + + itemLore.add(C.cYellow + weapon.GetTokenCost() + " Tokens"); + itemLore.add(C.cBlack); + + itemLore.addAll(Arrays.asList(weapon.GetDesc())); + + for (int i = 2; i < itemLore.size(); i++) + { + itemLore.set(i, C.cGray + itemLore.get(i)); + } + + lockedClassMap.put(slot, new ItemPackage(new ShopItem(weapon.GetType(), weapon.GetName(), itemLore.toArray(new String[itemLore.size()]), weapon.GetAmount(), true), weapon.GetCreditCost(), weapon.GetPointCost(), weapon.GetTokenCost(), weapon.GetEconomyCost(), weapon.IsFree(), weapon.GetSalesPackageId())); + unlockedClassMap.put(slot, new ItemPackage(new ShopItem(weapon.GetType(), weapon.GetName(), itemLore.toArray(new String[itemLore.size()]), weapon.GetAmount(), false), weapon.GetCreditCost(), weapon.GetPointCost(), weapon.GetTokenCost(), weapon.GetEconomyCost(), weapon.IsFree(), weapon.GetSalesPackageId())); + } +} \ No newline at end of file diff --git a/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/purchase/ArmorPurchasePageBuilder.java b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/purchase/ArmorPurchasePageBuilder.java new file mode 100644 index 000000000..4fa2af743 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/purchase/ArmorPurchasePageBuilder.java @@ -0,0 +1,57 @@ +package me.chiss.Core.Shop.pagebuilder.game.purchase; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import me.chiss.Core.Class.IPvpClass; +import me.chiss.Core.Class.IClassFactory; +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.IShopPage; +import me.chiss.Core.Shop.page.game.purchase.ArmorPurchasePage; +import me.chiss.Core.Shop.pagebuilder.itemwrapper.DonationWrapper; +import me.chiss.Core.Shop.salespackage.DefaultClassPackage; +import mineplex.core.account.CoreClient; +import mineplex.core.common.util.C; +import mineplex.minecraft.game.classcombat.shop.page.ArmorPageBuilder; + +public class ArmorPurchasePageBuilder extends ArmorPageBuilder +{ + public ArmorPurchasePageBuilder(Shop shop, String title, IClassFactory gameClassFactory, ICurrencyHandler...currencyHandlers) + { + super(shop, title, new DonationWrapper(), gameClassFactory, currencyHandlers); + } + + @Override + public IShopPage BuildForPlayer(CoreClient player) + { + return new ArmorPurchasePage(Shop, Title, CurrencyHandlers, UnlockedSalesPackageMap, LockedSalesPackageMap); + } + + protected void PrepareCachedMaps(IPvpClass gameClass, int slot) + { + List lockedClassDesc = new ArrayList(); + List unlockedClassDesc = new ArrayList(); + + lockedClassDesc.add(C.cYellow + gameClass.GetCreditCost() + "c" + C.cWhite + " or " + C.cYellow + gameClass.GetPointCost() + "p "); + unlockedClassDesc.add(C.cBlack); + + lockedClassDesc.addAll(Arrays.asList(gameClass.GetDesc())); + unlockedClassDesc.addAll(Arrays.asList(gameClass.GetDesc())); + + for (int i = 2; i < lockedClassDesc.size(); i++) + { + lockedClassDesc.set(i, C.cGray + lockedClassDesc.get(i)); + } + + for (int i = 1; i < unlockedClassDesc.size(); i++) + { + unlockedClassDesc.set(i, C.cGray + unlockedClassDesc.get(i)); + } + + + AddItem(LockedSalesPackageMap, new DefaultClassPackage(gameClass, lockedClassDesc.toArray(new String[lockedClassDesc.size()]), true, true), slot); + AddItem(UnlockedSalesPackageMap, new DefaultClassPackage(gameClass, unlockedClassDesc.toArray(new String[unlockedClassDesc.size()]), true, false), slot); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/purchase/ItemPurchasePageBuilder.java b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/purchase/ItemPurchasePageBuilder.java new file mode 100644 index 000000000..f155bfffa --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/purchase/ItemPurchasePageBuilder.java @@ -0,0 +1,51 @@ +package me.chiss.Core.Shop.pagebuilder.game.purchase; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.IShopPage; +import me.chiss.Core.Shop.page.game.purchase.ItemPurchasePage; +import me.chiss.Core.Shop.pagebuilder.game.ItemPageBuilder; +import me.chiss.Core.Shop.pagebuilder.itemwrapper.DonationWrapper; +import me.chiss.Core.Shop.salespackage.ShopItem; +import mineplex.core.account.CoreClient; +import mineplex.core.common.util.C; +import mineplex.minecraft.game.core.classcombat.item.IItem; +import mineplex.minecraft.game.core.classcombat.item.IItemFactory; +import mineplex.minecraft.shop.item.ItemPackage; + +public class ItemPurchasePageBuilder extends ItemPageBuilder +{ + public ItemPurchasePageBuilder(Shop shop, String title, IItemFactory itemFactory, ICurrencyHandler...currencyHandlers) + { + super(shop, title, new DonationWrapper(), itemFactory, currencyHandlers); + } + + @Override + public IShopPage BuildForPlayer(CoreClient player) + { + return new ItemPurchasePage(Shop, Title, CurrencyHandlers, UnlockedSalesPackageMap, LockedSalesPackageMap); + } + + @Override + protected void AddItemPackage(IItem item, int slot) + { + List itemLore = new ArrayList(); + + itemLore.add(C.cYellow + item.GetCreditCost() + "c" + C.cWhite + " or " + C.cYellow + item.GetPointCost() + "p"); + itemLore.add(C.cBlack); + + itemLore.addAll(Arrays.asList(item.GetDesc())); + + for (int i = 2; i < itemLore.size(); i++) + { + itemLore.set(i, C.cGray + itemLore.get(i)); + } + + AddItem(LockedSalesPackageMap, new ItemPackage(new ShopItem(item.GetType(), item.GetName(), itemLore.toArray(new String[itemLore.size()]), item.GetAmount(), true), item.GetCreditCost(), item.GetPointCost(), item.GetTokenCost(), item.GetEconomyCost(), item.IsFree(), item.GetSalesPackageId()), slot); + AddItem(UnlockedSalesPackageMap, new ItemPackage(new ShopItem(item.GetType(), item.GetName(), itemLore.toArray(new String[itemLore.size()]), item.GetAmount(), false), item.GetCreditCost(), item.GetPointCost(), item.GetTokenCost(), item.GetEconomyCost(), item.IsFree(), item.GetSalesPackageId()), slot); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/purchase/SkillsPurchasePageBuilder.java b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/purchase/SkillsPurchasePageBuilder.java new file mode 100644 index 000000000..25c260633 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/purchase/SkillsPurchasePageBuilder.java @@ -0,0 +1,64 @@ +package me.chiss.Core.Shop.pagebuilder.game.purchase; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import me.chiss.Core.Class.IClassFactory; +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.IShopPage; +import me.chiss.Core.Shop.page.game.purchase.SkillsPurchasePage; +import me.chiss.Core.Shop.pagebuilder.game.SkillsPageBuilder; +import me.chiss.Core.Shop.salespackage.DonationPackage; +import me.chiss.Core.Shop.salespackage.SkillPackage; +import me.chiss.Core.Skill.ISkill; +import me.chiss.Core.Skill.ISkillFactory; +import mineplex.core.account.CoreClient; +import mineplex.core.common.util.C; +import mineplex.minecraft.shop.item.ISalesPackage; + +public class SkillsPurchasePageBuilder extends SkillsPageBuilder +{ + public SkillsPurchasePageBuilder(Shop shop, String title, ISkillFactory skillFactory, IClassFactory gameClassFactory, ICurrencyHandler...currencyHandlers) + { + super(shop, title, skillFactory, gameClassFactory, currencyHandlers); + } + + @Override + public IShopPage BuildForPlayer(CoreClient player) + { + IShopPage category = new SkillsPurchasePage(Shop, Title, CurrencyHandlers, + ClassUnlockedSalesPackageMap, GlobalUnlockedSalesPackageMap, + ClassLockedSalesPackageMap, GlobalLockedSalesPackageMap); + + return category; + } + + @Override + protected void BuildSkillPackages(ISkill skill, List unlockedSkillPackages, List lockedSkillPackages) + { + List skillLore = new ArrayList(); + + skillLore.add(C.cYellow + skill.GetCreditCost() + "c" + C.cWhite + " or " + C.cYellow + skill.GetPointCost() + "p " + C.cWhite + "per Level"); + skillLore.add(C.cWhite + "You own " + C.cYellow + "0/" + skill.GetMaxLevel() + C.cWhite + " Levels"); + skillLore.add(C.cBlack); + + skillLore.addAll(Arrays.asList(skill.GetDesc())); + + for (int i = 2; i < skillLore.size(); i++) + { + skillLore.set(i, C.cGray + skillLore.get(i)); + } + + lockedSkillPackages.add(new DonationPackage(new SkillPackage(skill, skillLore.toArray(new String[skillLore.size()]), false, 1, true))); + unlockedSkillPackages.add(new DonationPackage(new SkillPackage(skill, skillLore.toArray(new String[skillLore.size()]), false, 1, false))); + + for (int i = 1; i <= skill.GetMaxLevel(); i++) + { + skillLore.set(1, C.cWhite + "You own " + C.cYellow + i + "/" + skill.GetMaxLevel() + C.cWhite + " Levels"); + lockedSkillPackages.add(new DonationPackage(new SkillPackage(skill, skillLore.toArray(new String[skillLore.size()]), true, i, false))); + unlockedSkillPackages.add(new DonationPackage(new SkillPackage(skill, skillLore.toArray(new String[skillLore.size()]), true, i, false))); + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/purchase/WeaponPurchasePageBuilder.java b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/purchase/WeaponPurchasePageBuilder.java new file mode 100644 index 000000000..a51c0d06e --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/game/purchase/WeaponPurchasePageBuilder.java @@ -0,0 +1,54 @@ +package me.chiss.Core.Shop.pagebuilder.game.purchase; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; + +import me.chiss.Core.Class.IClassFactory; +import me.chiss.Core.Shop.Shop; +import me.chiss.Core.Shop.currency.ICurrencyHandler; +import me.chiss.Core.Shop.page.IShopPage; +import me.chiss.Core.Shop.page.game.purchase.WeaponPurchasePage; +import me.chiss.Core.Shop.pagebuilder.game.WeaponPageBuilder; +import me.chiss.Core.Shop.salespackage.DonationPackage; +import me.chiss.Core.Shop.salespackage.ShopItem; +import me.chiss.Core.Weapon.IWeapon; +import me.chiss.Core.Weapon.IWeaponFactory; +import mineplex.core.account.CoreClient; +import mineplex.core.common.util.C; +import mineplex.minecraft.shop.item.ISalesPackage; +import mineplex.minecraft.shop.item.ItemPackage; + +public class WeaponPurchasePageBuilder extends WeaponPageBuilder +{ + public WeaponPurchasePageBuilder(Shop shop, String title, IWeaponFactory weaponFactory, IClassFactory gameClassFactory, ICurrencyHandler...currencyHandlers) + { + super(shop, title, weaponFactory, gameClassFactory, currencyHandlers); + } + + @Override + public IShopPage BuildForPlayer(CoreClient player) + { + return new WeaponPurchasePage(Shop, Title, CurrencyHandlers, ClassUnlockedSalesPackageMap, ClassLockedSalesPackageMap); + } + + @Override + protected void BuildWeaponPackages(IWeapon weapon, HashMap unlockedClassMap, HashMap lockedClassMap, int slot) + { + List itemLore = new ArrayList(); + + itemLore.add(C.cYellow + weapon.GetCreditCost() + "c" + C.cWhite + " or " + C.cYellow + weapon.GetPointCost()+ "p"); + itemLore.add(C.cBlack); + + itemLore.addAll(Arrays.asList(weapon.GetDesc())); + + for (int i = 2; i < itemLore.size(); i++) + { + itemLore.set(i, C.cGray + itemLore.get(i)); + } + + lockedClassMap.put(slot, new DonationPackage(new ItemPackage(new ShopItem(weapon.GetType(), weapon.GetName(), itemLore.toArray(new String[itemLore.size()]), weapon.GetAmount(), true), weapon.GetCreditCost(), weapon.GetPointCost(), weapon.GetTokenCost(), weapon.GetEconomyCost(), weapon.IsFree(), weapon.GetSalesPackageId()))); + unlockedClassMap.put(slot, new DonationPackage(new ItemPackage(new ShopItem(weapon.GetType(), weapon.GetName(), itemLore.toArray(new String[itemLore.size()]), weapon.GetAmount(), false), weapon.GetCreditCost(), weapon.GetPointCost(), weapon.GetTokenCost(), weapon.GetEconomyCost(), weapon.IsFree(), weapon.GetSalesPackageId()))); + } +} \ No newline at end of file diff --git a/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/itemwrapper/DonationWrapper.java b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/itemwrapper/DonationWrapper.java new file mode 100644 index 000000000..eb094cb63 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/itemwrapper/DonationWrapper.java @@ -0,0 +1,13 @@ +package me.chiss.Core.Shop.pagebuilder.itemwrapper; + +import me.chiss.Core.Shop.salespackage.DonationPackage; +import mineplex.minecraft.shop.item.ISalesPackage; + +public class DonationWrapper implements IItemWrapper +{ + @Override + public ISalesPackage WrapPackage(ISalesPackage salesPackage) + { + return new DonationPackage(salesPackage); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/itemwrapper/IItemWrapper.java b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/itemwrapper/IItemWrapper.java new file mode 100644 index 000000000..9decdb4ef --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/itemwrapper/IItemWrapper.java @@ -0,0 +1,8 @@ +package me.chiss.Core.Shop.pagebuilder.itemwrapper; + +import mineplex.minecraft.shop.item.ISalesPackage; + +public interface IItemWrapper +{ + ISalesPackage WrapPackage(ISalesPackage salesPackage); +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/itemwrapper/NoWrapper.java b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/itemwrapper/NoWrapper.java new file mode 100644 index 000000000..c2feb008d --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/pagebuilder/itemwrapper/NoWrapper.java @@ -0,0 +1,12 @@ +package me.chiss.Core.Shop.pagebuilder.itemwrapper; + +import mineplex.minecraft.shop.item.ISalesPackage; + +public class NoWrapper implements IItemWrapper +{ + @Override + public ISalesPackage WrapPackage(ISalesPackage salesPackage) + { + return salesPackage; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/salespackage/ArmorPackage.java b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/ArmorPackage.java new file mode 100644 index 000000000..54ffac807 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/ArmorPackage.java @@ -0,0 +1,219 @@ +package me.chiss.Core.Shop.salespackage; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + +import me.chiss.Core.Class.IPvpClass; +import me.chiss.Core.ClientData.IClientClass; +import mineplex.core.account.CoreClient; +import mineplex.minecraft.shop.item.ISalesPackage; +import net.minecraft.server.v1_6_R2.IInventory; + +public class ArmorPackage implements ISalesPackage +{ + private IPvpClass _gameClass; + private HashMap _shopItemMap; + private int _cost = 0; + private boolean _locked; + + public ArmorPackage(IPvpClass gameClass, boolean locked) + { + this(gameClass, 0, locked); + } + + public ArmorPackage(IPvpClass gameClass, int creditCost, boolean locked) + { + _gameClass = gameClass; + _cost = creditCost; + _locked = locked; + _shopItemMap = new HashMap(); + + SetHelmet(new ShopItem(_gameClass.GetHead(), _gameClass.GetName(), 1, _locked)); + SetChestplate(new ShopItem(_gameClass.GetChestplate(), _gameClass.GetName(), 1, _locked)); + SetLeggings(new ShopItem(_gameClass.GetLeggings(), _gameClass.GetName(), 1, _locked)); + SetBoots(new ShopItem(_gameClass.GetBoots(), _gameClass.GetName(), 1, _locked)); + } + + @Override + public String GetName() + { + return _gameClass.GetName(); + } + + @Override + public int GetSalesPackageId() + { + return _gameClass.GetSalesPackageId(); + } + + public void SetHelmet(ShopItem shopItem) + { + _shopItemMap.put(0, shopItem); + } + + public ShopItem GetHelmet() + { + return _shopItemMap.get(0); + } + + public void SetChestplate(ShopItem shopItem) + { + _shopItemMap.put(1, shopItem); + } + + public ShopItem GetChestplate() + { + return _shopItemMap.get(1); + } + + public void SetLeggings(ShopItem shopItem) + { + _shopItemMap.put(2, shopItem); + } + + public ShopItem GetLeggings() + { + return _shopItemMap.get(2); + } + + public void SetBoots(ShopItem shopItem) + { + _shopItemMap.put(3, shopItem); + } + + public ShopItem GetBoots() + { + return _shopItemMap.get(3); + } + + public int GetCost() + { + return _cost; + } + + @Override + public boolean IsFree() + { + return _gameClass.IsFree(); + } + + @Override + public boolean CanFitIn(CoreClient player) + { + return !_locked || _gameClass.IsFree(); + } + + @Override + public void DeliverTo(IClientClass player) + { + ShopItem head = GetHelmet().clone(); + head.SetDeliverySettings(); + + ShopItem chest = GetChestplate().clone(); + chest.SetDeliverySettings(); + + ShopItem legs = GetLeggings().clone(); + legs.SetDeliverySettings(); + + ShopItem boots = GetBoots().clone(); + boots.SetDeliverySettings(); + + player.GetInventory().setHelmet(head.clone()); + player.GetInventory().setChestplate(chest.clone()); + player.GetInventory().setLeggings(legs.clone()); + player.GetInventory().setBoots(boots.clone()); + + player.SetDefaultHead(head); + player.SetDefaultChest(chest); + player.SetDefaultLegs(legs); + player.SetDefaultFeet(boots); + } + + @Override + public void DeliverTo(IClientClass player, int slot) + { + + } + + @Override + public void PurchaseBy(CoreClient player) + { + if (player.Class().GetGameClass() == null) + { + player.Class().SetGameClass(_gameClass, false); + DeliverTo(player.Class()); + } + } + + @Override + public int ReturnFrom(CoreClient playerClient) + { + IClientClass player = playerClient.Class(); + + ShopItem head = GetHelmet().clone(); + head.SetDeliverySettings(); + + ShopItem chest = GetChestplate().clone(); + chest.SetDeliverySettings(); + + ShopItem legs = GetLeggings().clone(); + legs.SetDeliverySettings(); + + ShopItem boots = GetBoots().clone(); + boots.SetDeliverySettings(); + + if ((player.GetInventory().getHelmet() != null && player.GetInventory().getHelmet().equals(head)) + && (player.GetInventory().getChestplate() != null && player.GetInventory().getChestplate().equals(chest)) + && (player.GetInventory().getLeggings() != null && player.GetInventory().getLeggings().equals(legs)) + && (player.GetInventory().getBoots() != null && player.GetInventory().getBoots().equals(boots))) + { + + player.GetInventory().setArmorContents(new ItemStack[4]); + player.AddDefaultArmor(player.GetInventory().getArmorContents()); + player.SetGameClass(null); + + return 1; + } + + return 0; + } + + @Override + public List AddToCategory(IInventory inventory, int slot) + { + List slotList = new ArrayList(); + + slotList.add(slot); + inventory.setItem(slot, new ShopItem(Material.ANVIL, _gameClass.GetName() + " Custom Build", null, 0, _locked, true).getHandle()); + + return slotList; + } + + @Override + public int GetTokenCost() + { + return 0; + } + + @Override + public int GetCreditCost() + { + return _gameClass.GetCreditCost(); + } + + @Override + public int GetPointCost() + { + return _gameClass.GetPointCost(); + } + + @Override + public int GetEconomyCost() + { + return 0; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/salespackage/DefaultClassPackage.java b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/DefaultClassPackage.java new file mode 100644 index 000000000..5ccac89d9 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/DefaultClassPackage.java @@ -0,0 +1,293 @@ +package me.chiss.Core.Shop.salespackage; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; + +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + +import me.chiss.Core.Class.IPvpClass; +import mineplex.minecraft.game.core.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.shop.item.ISalesPackage; +import me.chiss.Core.ClientData.IClientClass; +import mineplex.core.account.CoreClient; +import net.minecraft.server.v1_6_R2.IInventory; + +public class DefaultClassPackage implements ISalesPackage +{ + private IPvpClass _gameClass; + private HashMap _shopItemMap; + private int _itemCost = 120; + private int _skillCost = 120; + private boolean _locked; + + private HashMap _defaultItems; + private List _defaultSkills; + + public DefaultClassPackage(IPvpClass gameClass, String[] desc, boolean donation, boolean locked) + { + _gameClass = gameClass; + _locked = locked; + _shopItemMap = new HashMap(); + _defaultItems = new HashMap(); + _defaultSkills = new ArrayList(); + + AddDefaultItem(new ShopItem(Material.IRON_SWORD, "Standard Sword", 1, false), 0); + AddDefaultItem(new ShopItem(Material.IRON_AXE, "Standard Axe", 1, false), 1); + + if (_gameClass.GetType() == ClassType.Knight) + { + AddDefaultItem(new ShopItem(Material.MUSHROOM_SOUP, "Mushroom Soup", 1, false), 2); + AddDefaultItem(new ShopItem(Material.MUSHROOM_SOUP, "Mushroom Soup", 1, false), 3); + } + else if (_gameClass.GetType() == ClassType.Ranger) + { + AddDefaultItem(new ShopItem(Material.BOW, "Standard Bow", 1, false), 2); + AddDefaultItem(new ShopItem(Material.ARROW, "Arrow", 30, false), 3); + } + else if (_gameClass.GetType() == ClassType.Brute) + { + AddDefaultItem(new ShopItem(Material.MUSHROOM_SOUP, "Mushroom Soup", 1, false), 2); + AddDefaultItem(new ShopItem(Material.MUSHROOM_SOUP, "Mushroom Soup", 1, false), 3); + } + else if (_gameClass.GetType() == ClassType.Assassin) + { + AddDefaultItem(new ShopItem(Material.BOW, "Standard Bow", 1, false), 2); + AddDefaultItem(new ShopItem(Material.ARROW, "Arrow", 30, false), 3); + } + else if (_gameClass.GetType() == ClassType.Mage) + { + AddDefaultItem(new ShopItem(Material.MUSHROOM_SOUP, "Mushroom Soup", 1, false), 2); + AddDefaultItem(new ShopItem(Material.MUSHROOM_SOUP, "Mushroom Soup", 1, false), 3); + } + + AddDefaultItem(new ShopItem(Material.MUSHROOM_SOUP, "Mushroom Soup", 1, false), 4); + AddDefaultItem(new ShopItem(Material.MUSHROOM_SOUP, "Mushroom Soup", 1, false), 5); + AddDefaultItem(new ShopItem(Material.MUSHROOM_SOUP, "Mushroom Soup", 1, false), 6); + AddDefaultItem(new ShopItem(Material.MUSHROOM_SOUP, "Mushroom Soup", 1, false), 7); + AddDefaultItem(new ShopItem(Material.MUSHROOM_SOUP, "Mushroom Soup", 1, false), 8); + + + String name = _gameClass.GetName() + (donation ? " Class" : " Default Build"); + + SetHelmet(new ShopItem(_gameClass.GetHead(), name, desc, 1, _locked)); + SetChestplate(new ShopItem(_gameClass.GetChestplate(), name, desc, 1, _locked)); + SetLeggings(new ShopItem(_gameClass.GetLeggings(), name, desc, 1, _locked)); + SetBoots(new ShopItem(_gameClass.GetBoots(), name, desc, 1, _locked)); + } + + public IPvpClass GetGameClass() + { + return _gameClass; + } + + @Override + public String GetName() + { + return _gameClass.GetName(); + } + + @Override + public int GetSalesPackageId() + { + return _gameClass.GetSalesPackageId(); + } + + public void SetHelmet(ShopItem shopItem) + { + _shopItemMap.put(0, shopItem); + } + + public ShopItem GetHelmet() + { + return _shopItemMap.get(0); + } + + public void SetChestplate(ShopItem shopItem) + { + _shopItemMap.put(1, shopItem); + } + + public ShopItem GetChestplate() + { + return _shopItemMap.get(1); + } + + public void SetLeggings(ShopItem shopItem) + { + _shopItemMap.put(2, shopItem); + } + + public ShopItem GetLeggings() + { + return _shopItemMap.get(2); + } + + public void SetBoots(ShopItem shopItem) + { + _shopItemMap.put(3, shopItem); + } + + public ShopItem GetBoots() + { + return _shopItemMap.get(3); + } + + @Override + public boolean IsFree() + { + return _gameClass.IsFree(); + } + + @Override + public boolean CanFitIn(CoreClient player) + { + return !_locked || _gameClass.IsFree(); + } + + @Override + public void DeliverTo(IClientClass player) + { + ShopItem head = GetHelmet().clone(); + head.SetDeliverySettings(); + + ShopItem chest = GetChestplate().clone(); + chest.SetDeliverySettings(); + + ShopItem legs = GetLeggings().clone(); + legs.SetDeliverySettings(); + + ShopItem boots = GetBoots().clone(); + boots.SetDeliverySettings(); + + player.GetInventory().setHelmet(head.clone()); + player.GetInventory().setChestplate(chest.clone()); + player.GetInventory().setLeggings(legs.clone()); + player.GetInventory().setBoots(boots.clone()); + + player.SetDefaultHead(head); + player.SetDefaultChest(chest); + player.SetDefaultLegs(legs); + player.SetDefaultFeet(boots); + + for (Entry defaultItem : _defaultItems.entrySet()) + { + ShopItem deliverable = defaultItem.getValue().clone(); + deliverable.SetDeliverySettings(); + + player.GetInventory().setItem(defaultItem.getKey(), deliverable); + player.PutDefaultItem(deliverable.clone(), defaultItem.getKey()); + } + } + + @Override + public void DeliverTo(IClientClass player, int slot) + { + + } + + @Override + public void PurchaseBy(CoreClient player) + { + if (player.Class().GetGameClass() == null) + { + player.Class().SetGameClass(_gameClass); + DeliverTo(player.Class()); + player.Donor().PurchaseItem(_itemCost); + player.Donor().PurchaseSkill(_skillCost); + } + } + + @Override + public int ReturnFrom(CoreClient playerClient) + { + IClientClass player = playerClient.Class(); + + ShopItem head = GetHelmet().clone(); + head.SetDeliverySettings(); + + ShopItem chest = GetChestplate().clone(); + chest.SetDeliverySettings(); + + ShopItem legs = GetLeggings().clone(); + legs.SetDeliverySettings(); + + ShopItem boots = GetBoots().clone(); + boots.SetDeliverySettings(); + + if ((player.GetInventory().getHelmet() != null && player.GetInventory().getHelmet().equals(head)) + && (player.GetInventory().getChestplate() != null && player.GetInventory().getChestplate().equals(chest)) + && (player.GetInventory().getLeggings() != null && player.GetInventory().getLeggings().equals(legs)) + && (player.GetInventory().getBoots() != null && player.GetInventory().getBoots().equals(boots))) + { + player.GetInventory().setArmorContents(new ItemStack[4]); + player.AddDefaultArmor(player.GetInventory().getArmorContents()); + + player.SetGameClass(null); + + return 1; + } + + return 0; + } + + @Override + public List AddToCategory(IInventory inventory, int slot) + { + List slotList = new ArrayList(); + + slotList.add(slot); + inventory.setItem(slot, GetHelmet().getHandle()); + slot += 9; + + slotList.add(slot); + inventory.setItem(slot, GetChestplate().getHandle()); + slot += 9; + + slotList.add(slot); + inventory.setItem(slot, GetLeggings().getHandle()); + slot += 9; + + slotList.add(slot); + inventory.setItem(slot, GetBoots().getHandle()); + slot += 9; + + return slotList; + } + + public void AddDefaultItem(ShopItem shopItem, int slot) + { + _defaultItems.put(slot, shopItem); + } + + public void AddDefaultSkill(ShopItem shopItem) + { + _defaultSkills.add(shopItem); + } + + @Override + public int GetTokenCost() + { + return 0; + } + + @Override + public int GetCreditCost() + { + return _gameClass.GetCreditCost(); + } + + @Override + public int GetPointCost() + { + return _gameClass.GetPointCost(); + } + + @Override + public int GetEconomyCost() + { + return 0; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/salespackage/DonationPackage.java b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/DonationPackage.java new file mode 100644 index 000000000..e338cc913 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/DonationPackage.java @@ -0,0 +1,97 @@ +package me.chiss.Core.Shop.salespackage; + +import java.util.List; + +import me.chiss.Core.ClientData.IClientClass; +import mineplex.core.account.CoreClient; +import mineplex.minecraft.shop.item.ISalesPackage; +import net.minecraft.server.v1_6_R2.IInventory; + +public class DonationPackage implements ISalesPackage +{ + private ISalesPackage _salesPackage; + + public DonationPackage(ISalesPackage salesPackage) + { + _salesPackage = salesPackage; + } + + @Override + public String GetName() + { + return _salesPackage.GetName(); + } + + public int GetCreditCost() + { + return _salesPackage.GetCreditCost(); + } + + public int GetPointCost() + { + return _salesPackage.GetPointCost(); + } + + public int GetTokenCost() + { + return _salesPackage.GetTokenCost(); + } + + public int GetEconomyCost() + { + return _salesPackage.GetEconomyCost(); + } + + @Override + public boolean IsFree() + { + return _salesPackage.IsFree(); + } + + @Override + public boolean CanFitIn(CoreClient player) + { + return true; + } + + @Override + public List AddToCategory(IInventory inventory, int slot) + { + return _salesPackage.AddToCategory(inventory, slot); + } + + @Override + public void DeliverTo(IClientClass player) + { + + } + + @Override + public void PurchaseBy(CoreClient player) + { + player.Donor().AddSalesPackagesOwned(_salesPackage.GetSalesPackageId()); + } + + @Override + public int ReturnFrom(CoreClient player) + { + return 0; + } + + @Override + public void DeliverTo(IClientClass player, int slot) + { + _salesPackage.DeliverTo(player, slot); + } + + @Override + public int GetSalesPackageId() + { + return _salesPackage.GetSalesPackageId(); + } + + public ISalesPackage GetWrappedPackage() + { + return _salesPackage; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/salespackage/ISalesPackage.java b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/ISalesPackage.java new file mode 100644 index 000000000..35b75acad --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/ISalesPackage.java @@ -0,0 +1,22 @@ +package me.chiss.Core.Shop.salespackage; + +import java.util.List; + +import me.chiss.Core.ClientData.IClientClass; +import mineplex.core.account.CoreClient; +import net.minecraft.server.v1_6_R2.IInventory; + +public interface ISalesPackage +{ + String GetName(); + int GetCreditCost(); + int GetPointCost(); + boolean CanFitIn(CoreClient player); + List AddToCategory(IInventory inventory, int slot); + void DeliverTo(IClientClass player); + void PurchaseBy(CoreClient player); + int ReturnFrom(CoreClient player); + void DeliverTo(IClientClass player, int slot); + int GetSalesPackageId(); + boolean IsFree(); +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/salespackage/ItemPackage.java b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/ItemPackage.java new file mode 100644 index 000000000..8d53ef87c --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/ItemPackage.java @@ -0,0 +1,186 @@ +package me.chiss.Core.Shop.salespackage; + +import java.util.Arrays; +import java.util.List; +import java.util.Map.Entry; + +import me.chiss.Core.ClientData.IClientClass; +import me.chiss.Core.Shop.salespackage.ShopItem; +import me.chiss.Core.Utility.InventoryUtil; +import mineplex.core.account.CoreClient; +import net.minecraft.server.v1_6_R2.IInventory; + +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftInventory; +import org.bukkit.inventory.ItemStack; + +public class ItemPackage implements ISalesPackage +{ + private ShopItem _shopItem; + private boolean _restrictToHotbar; + private int _creditCost; + private int _pointCost; + private int _tokenCost; + private int _economyCost; + private boolean _free; + private int _salesPackageId; + + public ItemPackage(ShopItem shopItem, int creditCost, int pointCost, int tokenCost, int economyCost, boolean isFree, int salesPackageId) + { + this(shopItem, true, creditCost, pointCost, tokenCost, economyCost, isFree, salesPackageId); + } + + public ItemPackage(ShopItem shopItem, boolean restrictToHotbar, int creditCost, int pointCost, int tokenCost, int economyCost, boolean isFree, int salesPackageId) + { + _shopItem = shopItem; + _restrictToHotbar = restrictToHotbar; + _creditCost = creditCost; + _pointCost = pointCost; + _economyCost = economyCost; + _tokenCost = tokenCost; + _free = isFree; + _salesPackageId = salesPackageId; + } + + @Override + public String GetName() + { + return _shopItem.GetName(); + } + + @Override + public int GetSalesPackageId() + { + return _salesPackageId; + } + + public int GetCreditCost() + { + return _creditCost; + } + + public int GetPointCost() + { + return _pointCost; + } + + public int GetTokenCost() + { + return _tokenCost; + } + + public int GetEconomyCost() + { + return _economyCost; + } + + @Override + public boolean IsFree() + { + return _free; + } + + @Override + public boolean CanFitIn(CoreClient player) + { + if (_shopItem.IsLocked() && !IsFree()) + return false; + + for (ItemStack itemStack : player.Class().GetInventory()) + { + if (itemStack != null && itemStack.getType() == _shopItem.getType() && (itemStack.getAmount() + _shopItem.getAmount()) <= (itemStack.getType() == Material.ARROW ? itemStack.getMaxStackSize() : 1)) + { + return true; + } + } + + if (_tokenCost == 0 && _creditCost == 0 && _pointCost == 0) + return true; + + if (InventoryUtil.first((CraftInventory)player.Class().GetInventory(), _restrictToHotbar ? 9 : player.Class().GetInventory().getSize(), null, true) == -1) + return false; + else + return true; + } + + @Override + public void DeliverTo(IClientClass player) + { + ShopItem shopItem = _shopItem.clone(); + shopItem.SetDeliverySettings(); + + if (shopItem.getType() == Material.ARROW) + { + int firstEmpty = player.GetInventory().firstEmpty(); + + player.GetInventory().addItem(shopItem); + + if (player.GetInventory().firstEmpty() != firstEmpty) + { + player.PutDefaultItem(player.GetInventory().getItem(firstEmpty), firstEmpty); + } + + for (Entry entry : player.GetInventory().all(Material.ARROW).entrySet()) + { + player.PutDefaultItem(entry.getValue().clone(), entry.getKey()); + } + } + else + { + int emptySlot = player.GetInventory().firstEmpty(); + + player.GetInventory().setItem(emptySlot, shopItem); + player.PutDefaultItem(shopItem.clone(), emptySlot); + } + } + + @Override + public void DeliverTo(IClientClass player, int slot) + { + ShopItem shopItem = _shopItem.clone(); + shopItem.SetDeliverySettings(); + + player.GetInventory().setItem(slot, shopItem); + player.PutDefaultItem(shopItem.clone(), slot); + } + + @Override + public void PurchaseBy(CoreClient player) + { + DeliverTo(player.Class()); + } + + @Override + public int ReturnFrom(CoreClient player) + { + if (_shopItem.IsDisplay()) + return 0; + + ShopItem shopItem = _shopItem.clone(); + shopItem.SetDeliverySettings(); + + int count = 0; + + count = InventoryUtil.GetCountOfObjectsRemoved((CraftInventory)player.Class().GetInventory(), 9, (ItemStack)shopItem); + + for (int i=0; i < 9; i++) + { + player.Class().PutDefaultItem(player.Class().GetInventory().getItem(i), i); + } + + return count; + } + + @Override + public List AddToCategory(IInventory inventory, int slot) + { + inventory.setItem(slot, _shopItem.getHandle()); + + return Arrays.asList(slot); + } + + public ShopItem GetItem() + { + return _shopItem; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/salespackage/PvpItemPackage.java b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/PvpItemPackage.java new file mode 100644 index 000000000..d411926fd --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/PvpItemPackage.java @@ -0,0 +1,176 @@ +package me.chiss.Core.Shop.salespackage; + +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Calendar; +import java.util.List; + +import me.chiss.Core.ClientData.IClientClass; +import me.chiss.Core.Utility.InventoryUtil; +import mineplex.core.account.CoreClient; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.minecraft.shop.item.ISalesPackage; +import net.minecraft.server.v1_6_R2.IInventory; + +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftInventory; +import org.bukkit.inventory.ItemStack; + +public class PvpItemPackage implements ISalesPackage +{ + private ShopItem _shopItem; + private int _creditCost; + private int _pointCost; + private int _tokenCost; + private int _economyCost; + private boolean _free; + private int _salesPackageId; + + public PvpItemPackage(ShopItem shopItem, int creditCost, int pointCost, int tokenCost, int economyCost, boolean isFree, int salesPackageId) + { + _shopItem = shopItem; + _creditCost = creditCost; + _pointCost = pointCost; + _economyCost = economyCost; + _tokenCost = tokenCost; + _free = isFree; + _salesPackageId = salesPackageId; + } + + @Override + public String GetName() + { + return _shopItem.GetName(); + } + + @Override + public int GetSalesPackageId() + { + return _salesPackageId; + } + + public int GetCreditCost() + { + return _creditCost; + } + + public int GetPointCost() + { + return _pointCost; + } + + public int GetTokenCost() + { + return _tokenCost; + } + + public int GetEconomyCost() + { + return _economyCost; + } + + @Override + public boolean IsFree() + { + return _free; + } + + @Override + public boolean CanFitIn(CoreClient player) + { + if (_shopItem.IsLocked() && !IsFree()) + return false; + + for (ItemStack itemStack : player.Class().GetInventory()) + { + if (itemStack != null && itemStack.getType() == _shopItem.getType() && (itemStack.getAmount() + _shopItem.getAmount()) <= (itemStack.getType() == Material.ARROW ? itemStack.getMaxStackSize() : 1)) + { + return true; + } + } + + if (_tokenCost == 0 && _creditCost == 0 && _pointCost == 0) + return true; + + if (InventoryUtil.first((CraftInventory)player.Class().GetInventory(), 9, null, true) == -1) + return false; + else + return true; + } + + public ItemStack GetStack(String player) + { + byte data = 0; + if (_shopItem.getData() != null) + data =_shopItem.getData().getData(); + + ItemStack stack; + if (_shopItem.getType().getMaxStackSize() == 1) + stack = ItemStackFactory.Instance.CreateStack(_shopItem.getType(), data, _shopItem.getAmount(), + null, new String[] {}, player + " Shop"); + else + stack = ItemStackFactory.Instance.CreateStack(_shopItem.getType(), data, _shopItem.getAmount()); + + return stack; + } + + @Override + public void DeliverTo(IClientClass player) + { + player.GetInventory().addItem(GetStack(player.GetName())); + } + + public final String DATE_FORMAT_DAY = "yyyy-MM-dd"; + public String date() + { + Calendar cal = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_DAY); + return sdf.format(cal.getTime()); + } + + @Override + public void DeliverTo(IClientClass player, int slot) + { + player.GetInventory().setItem(slot, GetStack(player.GetName())); + } + + @Override + public void PurchaseBy(CoreClient player) + { + DeliverTo(player.Class()); + } + + @Override + public int ReturnFrom(CoreClient player) + { + if (_shopItem.IsDisplay()) + return 0; + + ShopItem shopItem = _shopItem.clone(); + shopItem.SetDeliverySettings(); + + int count = 0; + + count = InventoryUtil.GetCountOfObjectsRemoved((CraftInventory)player.Class().GetInventory(), 9, (ItemStack)shopItem); + + for (int i=0; i < 9; i++) + { + player.Class().PutDefaultItem(player.Class().GetInventory().getItem(i), i); + } + + return count; + } + + @Override + public List AddToCategory(IInventory inventory, int slot) + { + inventory.setItem(slot, _shopItem.getHandle()); + + return Arrays.asList(slot); + } + + public ShopItem GetItem() + { + return _shopItem; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/salespackage/PvpShopItem.java b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/PvpShopItem.java new file mode 100644 index 000000000..3b778476c --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/PvpShopItem.java @@ -0,0 +1,39 @@ +package me.chiss.Core.Shop.salespackage; + +import net.minecraft.server.v1_6_R2.NBTTagList; +import net.minecraft.server.v1_6_R2.NBTTagString; + +import org.bukkit.ChatColor; +import org.bukkit.Material; + +public class PvpShopItem extends ShopItem +{ + public PvpShopItem(Material type, byte data, String name, + String deliveryName, String[] lore, int deliveryAmount, + boolean locked, boolean displayItem) + { + super(type, data, name, deliveryName, lore, deliveryAmount, locked, displayItem); + } + + @Override + protected void UpdateVisual(boolean clone) + { + if (!clone) + { + this.getHandle().c(ChatColor.YELLOW + _name); + } + + NBTTagList lore = new NBTTagList("Lore"); + + if (_lore != null) + { + for (String line : _lore) + { + if (line != null && !line.isEmpty()) + lore.add(new NBTTagString("Test", line)); + } + } + + getHandle().tag.getCompound("display").set("Lore", lore); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/salespackage/ShopItem.java b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/ShopItem.java new file mode 100644 index 000000000..532002828 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/ShopItem.java @@ -0,0 +1,173 @@ +package me.chiss.Core.Shop.salespackage; + +import net.minecraft.server.v1_6_R2.NBTTagList; +import net.minecraft.server.v1_6_R2.NBTTagString; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; +import org.bukkit.inventory.ItemStack; + +public class ShopItem extends CraftItemStack +{ + protected String _name; + private String _deliveryName; + protected String[] _lore; + private int _deliveryAmount; + private boolean _locked; + private boolean _displayItem; + + public ShopItem(ItemStack itemStack, String name, String deliveryName, int deliveryAmount, boolean locked, boolean displayItem) + { + super(itemStack); + + _name = name; + _deliveryName = deliveryName; + _displayItem = displayItem; + _deliveryAmount = deliveryAmount; + + getHandle().tag = ((CraftItemStack)itemStack).getHandle().tag; + + UpdateVisual(true); + } + + public ShopItem(Material type, String name, int deliveryAmount, boolean locked) + { + this(type, name, null, deliveryAmount, locked); + } + + public ShopItem(Material type, String name, String[] lore, int deliveryAmount, boolean locked) + { + this(type, name, lore, deliveryAmount, locked, false); + } + + public ShopItem(Material type, String name, String[] lore, int deliveryAmount, boolean locked, boolean displayItem) + { + this(type, (byte)0, name, null, lore, deliveryAmount, locked, displayItem); + } + + public ShopItem(Material type, byte data, String name, String[] lore, int deliveryAmount, boolean locked, boolean displayItem) + { + this(type, data, name, null, lore, deliveryAmount, locked, displayItem); + } + + public ShopItem(Material type, byte data, String name, String deliveryName, String[] lore, int deliveryAmount, boolean locked, boolean displayItem) + { + super(type.getId(), Math.max(deliveryAmount, 1), data, null); + + _name = name; + _deliveryName = deliveryName; + _lore = lore; + _displayItem = displayItem; + _deliveryAmount = deliveryAmount; + _locked = locked; + + UpdateVisual(false); + + // Fix for temp save junk(fixes problem when disconnecting and trying to return) + if (getHandle().tag != null) + getHandle().tag.setName("tag"); + + getHandle().tag.setByte("Count", (byte)Math.max(deliveryAmount, 1)); + } + + public boolean IsLocked() + { + return _locked; + } + + public void SetDeliverySettings() + { + setAmount(_deliveryAmount); + + //Delivery Name + if (_deliveryName != null) + this.getHandle().c(_deliveryName); + } + + public ShopItem clone() + { + return new ShopItem(super.clone(), _name, _deliveryName, _deliveryAmount, _locked, _displayItem); + } + + @Override + public boolean equals(Object obj) + { + if (!super.equals(obj)) + { + return false; + } + + net.minecraft.server.v1_6_R2.ItemStack original = ((CraftItemStack)this).getHandle(); + net.minecraft.server.v1_6_R2.ItemStack comparison = ((CraftItemStack)obj).getHandle(); + + return original.tag == null || original.tag.equals(comparison.tag); + } + + protected void UpdateVisual(boolean clone) + { + if (!clone) + { + if (_locked && !_displayItem) + { + this.getHandle().c(ChatColor.RED + "§l" + _name); + } + else + { + this.getHandle().c(ChatColor.GREEN + "§l" + _name); + } + } + + NBTTagList lore = new NBTTagList("Lore"); + + if (_lore != null) + { + for (String line : _lore) + { + if (line != null && !line.isEmpty()) + lore.add(new NBTTagString("Test", line)); + } + } + + getHandle().tag.getCompound("display").set("Lore", lore); + } + + public boolean IsDisplay() + { + return _displayItem; + } + + public void SetLocked(boolean owns) + { + _locked = owns; + UpdateVisual(false); + } + + public String GetName() + { + return _name; + } + + public void SetName(String name) + { + _name = name; + } + + public void SetLore(String[] string) + { + _lore = string; + + NBTTagList lore = new NBTTagList("Lore"); + + if (_lore != null) + { + for (String line : _lore) + { + if (line != null && !line.isEmpty()) + lore.add(new NBTTagString("Test", line)); + } + } + + getHandle().tag.getCompound("display").set("Lore", lore); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Shop/salespackage/SkillPackage.java b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/SkillPackage.java new file mode 100644 index 000000000..fe5d1cdd1 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Shop/salespackage/SkillPackage.java @@ -0,0 +1,153 @@ +package me.chiss.Core.Shop.salespackage; + +import java.util.Arrays; +import java.util.List; + +import org.bukkit.Material; + +import me.chiss.Core.ClientData.IClientClass; +import mineplex.core.account.CoreClient; +import mineplex.minecraft.game.core.classcombat.Skill.ISkill; +import net.minecraft.server.v1_6_R2.IInventory; + +public class SkillPackage implements ISalesPackage +{ + private ShopItem _skillItem; + private ISkill _skill; + private int _level; + private boolean _active; + private boolean _locked; + + public SkillPackage(ISkill skill, String[] lore, boolean active, int level, boolean locked) + { + _skill = skill; + _active = active; + _level = level; + _locked = locked; + + _skillItem = new ShopItem((_locked ? Material.BOOK : _active ? Material.WRITTEN_BOOK : Material.BOOK), _skill.GetName(), null, _level, _locked); + _skillItem.SetLore(lore); + } + + @Override + public String GetName() + { + return _skillItem.GetName(); + } + + @Override + public int GetSalesPackageId() + { + return _skill.GetSalesPackageId(); + } + + public ISkill GetSkill() + { + return _skill; + } + + public int GetCreditCost() + { + return _skill.GetCreditCost(); + } + + public int GetPointCost() + { + return _skill.GetPointCost(); + } + + @Override + public boolean IsFree() + { + return _skill.IsFree(_level); + } + + @Override + public boolean CanFitIn(CoreClient player) + { + if (_locked && !IsFree()) + return false; + + ISkill existingSkill = player.Class().GetSkillByType(_skill.GetSkillType()); + + if (existingSkill == _skill) + { + return player.Class().GetSkillLevel(existingSkill) < _skill.GetMaxLevel(); + } + + return true; + } + + @Override + public void DeliverTo(IClientClass player) + { + } + + @Override + public void DeliverTo(IClientClass player, int slot) + { + player.GetInventory().setItem(slot, _skillItem); + } + + @Override + public void PurchaseBy(CoreClient player) + { + ISkill skill = GetSkill(); + + ISkill existingSkill = player.Class().GetSkillByType(skill.GetSkillType()); + + if (existingSkill != null) + { + player.Class().RemoveSkill(existingSkill); + } + + player.Class().AddSkill(skill, _skillItem.getAmount()); + + DeliverTo(player.Class()); + } + + public int ReturnAllLevels(CoreClient player) + { + if (player.Class().GetSkillByType(GetSkill().GetSkillType()) != null && player.Class().GetSkillByType(GetSkill().GetSkillType()) == GetSkill()) + { + player.Class().RemoveSkill(GetSkill()); + + return _skillItem.getAmount(); + } + + return 0; + } + + @Override + public int ReturnFrom(CoreClient player) + { + if (player.Class().GetSkillByType(GetSkill().GetSkillType()) != null && player.Class().GetSkillByType(GetSkill().GetSkillType()) == GetSkill()) + { + player.Class().RemoveSkill(GetSkill()); + + if (_skillItem.getAmount() > 1) + player.Class().AddSkill(GetSkill(), _skillItem.getAmount() - 1); + + return 1; + } + + return 0; + } + + @Override + public List AddToCategory(IInventory inventory, int slot) + { + inventory.setItem(slot, _skillItem.getHandle()); + return Arrays.asList(slot); + } + + public int GetLevel() + { + return _level; + } + + public boolean IsActive() + { + return _active; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Utility/AUtility.java b/Plugins/Core/src/me/chiss/Core/Utility/AUtility.java new file mode 100644 index 000000000..4156bf9f3 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Utility/AUtility.java @@ -0,0 +1,17 @@ +package me.chiss.Core.Utility; + +import me.chiss.Core.Modules.Utility; + +public class AUtility +{ + private Utility _util; + public AUtility(Utility util) + { + _util = util; + } + + public Utility Util() + { + return _util; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Utility/InventoryUtil.java b/Plugins/Core/src/me/chiss/Core/Utility/InventoryUtil.java new file mode 100644 index 000000000..560814f3f --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Utility/InventoryUtil.java @@ -0,0 +1,125 @@ +package me.chiss.Core.Utility; + +import java.util.HashMap; + +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftInventory; +import org.bukkit.inventory.ItemStack; + +public class InventoryUtil +{ + public static HashMap removeItem(CraftInventory inventory, int endingSlot, ItemStack... items) + { + HashMap leftover = new HashMap(); + + if (endingSlot >= 54) + return leftover; + + for (int i = 0; i < items.length; i++) + { + ItemStack item = items[i]; + int toDelete = item.getAmount(); + + while (true) + { + int first = first(inventory, endingSlot, item, false); + + if (first == -1) + { + item.setAmount(toDelete); + leftover.put(i, item); + break; + } + else + { + ItemStack itemStack = inventory.getItem(first); + int amount = itemStack.getAmount(); + + if (amount <= toDelete) + { + toDelete -= amount; + inventory.clear(first); + } + else + { + itemStack.setAmount(amount - toDelete); + inventory.setItem(first, itemStack); + toDelete = 0; + } + } + + if (toDelete <= 0) + break; + } + } + + return leftover; + } + + public static int first(CraftInventory craftInventory, int endingSlot, ItemStack item, boolean withAmount) + { + if (endingSlot >= 54) + return -1; + + ItemStack[] inventory = craftInventory.getContents(); + + for (int i = 0; i < endingSlot; i++) + { + if (inventory[i] == null) + { + if (item == null) + return i; + else + continue; + } + else if (item == null) + continue; + + boolean equals = false; + + if (withAmount) + { + equals = item.equals(inventory[i]); + } + else + { + equals = item.getTypeId() == inventory[i].getTypeId() && item.getDurability() == inventory[i].getDurability() && item.getEnchantments().equals(inventory[i].getEnchantments()); + } + + if (equals) + { + return i; + } + } + + return -1; + } + + public static int GetCountOfObjectsRemoved(CraftInventory getInventory, int i, ItemStack itemStack) + { + int count = 0; + + while(getInventory.contains(itemStack.getType(), itemStack.getAmount()) && InventoryUtil.removeItem(getInventory, i, itemStack).size() == 0) + { + count++; + } + + return count; + } + + public static int GetCountOfObjectsRemovedInSlot(CraftInventory getInventory, int slot, ItemStack itemStack) + { + int count = 0; + ItemStack slotStack = getInventory.getItem(slot); + + while(slotStack.getType() == itemStack.getType() && slotStack.getAmount() >= itemStack.getAmount()) + { + slotStack.setAmount(slotStack.getAmount() - itemStack.getAmount()); + count++; + } + + if (slotStack.getAmount() == 0) + getInventory.setItem(slot, null); + + return count; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Utility/UtilAccount.java b/Plugins/Core/src/me/chiss/Core/Utility/UtilAccount.java new file mode 100644 index 000000000..b5e3d5e38 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Utility/UtilAccount.java @@ -0,0 +1,37 @@ +package me.chiss.Core.Utility; + +import me.chiss.Core.Modules.Utility; + +import org.bukkit.entity.Player; + +public class UtilAccount extends AUtility +{ + public UtilAccount(Utility util) + { + super(util); + } + + //Return Clean IP + public String IPtoStr(Player player) + { + if (player == null) + return "Unknown"; + + if (player.getAddress() == null) + return "Unknown"; + + String IP = player.getAddress().toString(); + String trimIP = ""; + + for (int i = 0 ; i < IP.length() ; i++) + { + if (IP.charAt(i) == ':') + { + trimIP = IP.substring(1, i); + break; + } + } + + return trimIP; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Utility/UtilInput.java b/Plugins/Core/src/me/chiss/Core/Utility/UtilInput.java new file mode 100644 index 000000000..52bd107c5 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Utility/UtilInput.java @@ -0,0 +1,128 @@ +package me.chiss.Core.Utility; + +import java.util.HashSet; + +import me.chiss.Core.Modules.Utility; + +public class UtilInput extends AUtility +{ + public UtilInput(Utility util) + { + super(util); + } + + //Valid Chars + protected HashSet validSet = new HashSet(); + protected HashSet filterSet = new HashSet(); + + public boolean valid(String input) + { + if (validSet.isEmpty()) + addChars(); + + for (char cur : input.toCharArray()) + if (!validSet.contains(cur)) + return false; + + return true; + } + + public String filter(String input) + { + if (filterSet.isEmpty()) + addDictionary(); + + for (String cur : filterSet) + { + if (input.equalsIgnoreCase(cur)) + { + String out = "" + input.charAt(0); + while (out.length() < input.length()) + out += '*'; + return out; + } + } + + return input; + } + + public void addDictionary() + { + filterSet.add("fuck"); + filterSet.add("shit"); + filterSet.add("cunt"); + filterSet.add("ass"); + filterSet.add("asshole"); + filterSet.add("faggot"); + filterSet.add("fag"); + filterSet.add("gay"); + } + + public void addChars() + { + validSet.add('1'); + validSet.add('2'); + validSet.add('3'); + validSet.add('4'); + validSet.add('5'); + validSet.add('6'); + validSet.add('7'); + validSet.add('8'); + validSet.add('9'); + validSet.add('0'); + + validSet.add('a'); + validSet.add('b'); + validSet.add('c'); + validSet.add('d'); + validSet.add('e'); + validSet.add('f'); + validSet.add('g'); + validSet.add('h'); + validSet.add('i'); + validSet.add('j'); + validSet.add('k'); + validSet.add('l'); + validSet.add('m'); + validSet.add('n'); + validSet.add('o'); + validSet.add('p'); + validSet.add('q'); + validSet.add('r'); + validSet.add('s'); + validSet.add('t'); + validSet.add('u'); + validSet.add('v'); + validSet.add('w'); + validSet.add('x'); + validSet.add('y'); + validSet.add('z'); + + validSet.add('A'); + validSet.add('B'); + validSet.add('C'); + validSet.add('D'); + validSet.add('E'); + validSet.add('F'); + validSet.add('G'); + validSet.add('H'); + validSet.add('I'); + validSet.add('J'); + validSet.add('K'); + validSet.add('L'); + validSet.add('M'); + validSet.add('N'); + validSet.add('O'); + validSet.add('P'); + validSet.add('Q'); + validSet.add('R'); + validSet.add('S'); + validSet.add('T'); + validSet.add('U'); + validSet.add('V'); + validSet.add('W'); + validSet.add('X'); + validSet.add('Y'); + validSet.add('Z'); + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Utility/UtilItem.java b/Plugins/Core/src/me/chiss/Core/Utility/UtilItem.java new file mode 100644 index 000000000..9b6bd3683 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Utility/UtilItem.java @@ -0,0 +1,123 @@ +package me.chiss.Core.Utility; + +import java.util.LinkedList; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import me.chiss.Core.Modules.Utility; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +public class UtilItem extends AUtility +{ + public UtilItem(Utility util) + { + super(util); + } + + public LinkedList matchItem(Player caller, String items, boolean inform) + { + LinkedList matchList = new LinkedList(); + + String failList = ""; + + //Mass Search + for (String cur : items.split(",")) + { + Material match = searchItem(caller, cur, inform); + + if (match != null) + matchList.add(match); + + else + failList += cur + " " ; + } + + if (inform && failList.length() > 0) + { + failList = failList.substring(0, failList.length() - 1); + UtilPlayer.message(caller, F.main("Item(s) Search", "" + + C.mBody + " Invalid [" + + C.mElem + failList + + C.mBody + "].")); + } + + return matchList; + } + + public Material searchItem(Player caller, String args, boolean inform) + { + LinkedList matchList = new LinkedList(); + + for (Material cur : Material.values()) + { + //By Name + if (cur.toString().equalsIgnoreCase(args)) + return cur; + + if (cur.toString().toLowerCase().contains(args.toLowerCase())) + matchList.add(cur); + + //By ID:Data + String[] arg = args.split(":"); + + int id = 0; + + try + { + if (arg.length > 0) id = Integer.parseInt(arg[0]); + } + catch (Exception e) + { + continue; + } + + if (id == cur.getId()) + return cur; + } + + //No / Non-Unique + if (matchList.size() != 1) + { + if (!inform) + return null; + + //Inform + UtilPlayer.message(caller, F.main("Item Search", "" + + C.mCount + matchList.size() + + C.mBody + " matches for [" + + C.mElem + args + + C.mBody + "].")); + + if (matchList.size() > 0) + { + String matchString = ""; + for (Material cur : matchList) + matchString += F.elem(cur.toString()) + ", "; + if (matchString.length() > 1) + matchString = matchString.substring(0 , matchString.length() - 2); + + UtilPlayer.message(caller, F.main("Item Search", "" + + C.mBody + "Matches [" + + C.mElem + matchString + + C.mBody + "].")); + } + + return null; + } + + return matchList.get(0); + } + + public String itemToStr(ItemStack item) + { + String data = "0"; + if (item.getData() != null) + data = item.getData().getData() + ""; + + return item.getType() + ":" + item.getAmount() + ":" + item.getDurability() + ":" + data; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Vote/VoteManager.java b/Plugins/Core/src/me/chiss/Core/Vote/VoteManager.java new file mode 100644 index 000000000..b485e7492 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Vote/VoteManager.java @@ -0,0 +1,55 @@ +package me.chiss.Core.Vote; + + +import org.bukkit.ChatColor; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClient; +import mineplex.core.account.event.GetClientEvent; +import mineplex.core.server.event.PlayerVoteEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; + +public class VoteManager extends MiniPlugin +{ + public VoteManager(JavaPlugin plugin) + { + super("Vote", plugin); + } + + @SuppressWarnings("deprecation") + @EventHandler(priority = EventPriority.LOWEST) + public void onPlayerVote(PlayerVoteEvent event) + { + GetClientEvent clientEvent = new GetClientEvent(event.GetPlayerName()); + GetPluginManager().callEvent(clientEvent); + + CoreClient client = clientEvent.GetClient(); + + if (client != null) + { + client.Donor().AddPoints(event.GetPointsReceived()); + + client.GetPlayer().sendMessage(ChatColor.AQUA + "*************************************"); + client.GetPlayer().sendMessage(C.cDGreen + " Thanks for voting!"); + client.GetPlayer().sendMessage(C.cDGreen + " You received " + ChatColor.YELLOW + event.GetPointsReceived() + C.cDGreen + " points! "); + client.GetPlayer().sendMessage(ChatColor.AQUA + "*************************************"); + client.GetPlayer().playSound(client.GetPlayer().getLocation(), Sound.LEVEL_UP, .3f, 1f); + + for (Player player : GetPlugin().getServer().getOnlinePlayers()) + { + if (player == client.GetPlayer()) + continue; + + player.sendMessage(F.main(GetName(), ChatColor.YELLOW + event.GetPlayerName() + ChatColor.GRAY + " voted at bettermc.com/Vote for " + ChatColor.YELLOW + event.GetPointsReceived() + C.cGray + " points! ")); + } + + client.GetPlayer().updateInventory(); + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Weapon/Commands/WeaponCommand.java b/Plugins/Core/src/me/chiss/Core/Weapon/Commands/WeaponCommand.java new file mode 100644 index 000000000..c8f306228 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Weapon/Commands/WeaponCommand.java @@ -0,0 +1,46 @@ +package me.chiss.Core.Weapon.Commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Weapon.IWeapon; +import me.chiss.Core.Weapon.WeaponFactory; + +public class WeaponCommand extends CommandBase +{ + public WeaponCommand(WeaponFactory plugin) + { + super(plugin, Rank.ADMIN, "wep", "weapon"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args == null || args.length == 0) + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Listing Weapons:")); + + for (IWeapon cur : Plugin.GetWeapons()) + { + UtilPlayer.message(caller, cur.GetName()); + } + + UtilPlayer.message(caller, "Type " + F.elem("/weapon ") + " to receive Weapon."); + return; + } + + for (IWeapon cur : Plugin.GetWeapons()) + { + if (cur.GetName().toLowerCase().contains(args[0].toLowerCase())) + { + caller.getInventory().addItem(ItemStackFactory.Instance.CreateStack(cur.GetType(), cur.GetAmount())); + + UtilPlayer.message(caller, F.main("WeaponFactory", "You received " + F.elem(cur.GetName()) + ".")); + } + } + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Weapon/IWeapon.java b/Plugins/Core/src/me/chiss/Core/Weapon/IWeapon.java new file mode 100644 index 000000000..3548933db --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Weapon/IWeapon.java @@ -0,0 +1,18 @@ +package me.chiss.Core.Weapon; + +import nautilus.minecraft.core.webserver.token.Server.WeaponToken; + +import org.bukkit.Material; + +public interface IWeapon +{ + Material GetType(); + int GetAmount(); + int GetGemCost(); + int GetEconomyCost(); + boolean IsFree(); + int GetSalesPackageId(); + String GetName(); + void Update(WeaponToken weaponToken); + String[] GetDesc(); +} diff --git a/Plugins/Core/src/me/chiss/Core/Weapon/IWeaponFactory.java b/Plugins/Core/src/me/chiss/Core/Weapon/IWeaponFactory.java new file mode 100644 index 000000000..b7773247b --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Weapon/IWeaponFactory.java @@ -0,0 +1,8 @@ +package me.chiss.Core.Weapon; + +import java.util.Collection; + +public interface IWeaponFactory +{ + Collection GetWeapons(); +} diff --git a/Plugins/Core/src/me/chiss/Core/Weapon/Weapon.java b/Plugins/Core/src/me/chiss/Core/Weapon/Weapon.java new file mode 100644 index 000000000..59af7b0d3 --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Weapon/Weapon.java @@ -0,0 +1,83 @@ +package me.chiss.Core.Weapon; + +import nautilus.minecraft.core.webserver.token.Server.WeaponToken; + +import org.bukkit.Material; + +public class Weapon implements IWeapon +{ + private int _salesPackageId; + private String _customName; + private Material _type; + private int _amount; + private int _gemCost; + private int _economyCost; + private boolean _free; + private String[] _desc; + + public Weapon(String customName, String[] desc, Material type, int amount, int gemCost) + { + _customName = customName; + _desc = desc; + _type = type; + _amount = amount; + _gemCost = gemCost; + _economyCost = 0; + } + + @Override + public Material GetType() + { + return _type; + } + + @Override + public int GetAmount() + { + return _amount; + } + + @Override + public int GetGemCost() + { + return _gemCost; + } + + @Override + public int GetEconomyCost() + { + return _economyCost; + } + + @Override + public int GetSalesPackageId() + { + return _salesPackageId; + } + + @Override + public String GetName() + { + return (_customName != null ? _customName :_type.name()); + } + + @Override + public boolean IsFree() + { + return _free; + } + + @Override + public void Update(WeaponToken weaponToken) + { + _salesPackageId = weaponToken.SalesPackage.GameSalesPackageId; + _gemCost = weaponToken.SalesPackage.Gems; + _free = weaponToken.SalesPackage.Free; + } + + @Override + public String[] GetDesc() + { + return _desc; + } +} diff --git a/Plugins/Core/src/me/chiss/Core/Weapon/WeaponFactory.java b/Plugins/Core/src/me/chiss/Core/Weapon/WeaponFactory.java new file mode 100644 index 000000000..648bd0f5b --- /dev/null +++ b/Plugins/Core/src/me/chiss/Core/Weapon/WeaponFactory.java @@ -0,0 +1,100 @@ +package me.chiss.Core.Weapon; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; + +import me.chiss.Core.Weapon.Commands.WeaponCommand; +import mineplex.core.MiniPlugin; +import mineplex.core.donation.repository.GameSalesPackageToken; +import mineplex.core.server.remotecall.JsonWebCall; +import nautilus.minecraft.core.webserver.token.Server.WeaponToken; + +import org.bukkit.Material; +import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; +import org.bukkit.plugin.java.JavaPlugin; + +public class WeaponFactory extends MiniPlugin implements IWeaponFactory +{ + public static WeaponFactory Instance; + + private HashMap _weapons; + private String _webServerAddress; + + protected WeaponFactory(JavaPlugin plugin, String webServerAddress) + { + super("Weapon Factory", plugin); + + _weapons = new HashMap(); + _webServerAddress = webServerAddress; + + PopulateWeapons(); + } + + public static void Initialize(JavaPlugin plugin, String webServerAddress) + { + Instance = new WeaponFactory(plugin, webServerAddress); + } + + @Override + public void AddCommands() + { + AddCommand(new WeaponCommand(this)); + } + + private void PopulateWeapons() + { + _weapons.clear(); + + AddWeapon(new Weapon("Standard Bow", new String[] { }, Material.BOW, 1, 800)); + AddWeapon(new Weapon("Power Bow", new String[] { "+1 Damage" }, Material.BOW, 1, 800)); + AddWeapon(new Weapon("Booster Bow", new String[] { "+1 Skill Level", "-1 Damage" }, Material.BOW, 1, 800)); + + AddWeapon(new Weapon("Standard Axe", new String[] { }, Material.IRON_AXE, 1, 600)); + AddWeapon(new Weapon("Power Axe", new String[] { "+1 Damage", "Low Durability" }, Material.GOLD_AXE, 1, 600)); + AddWeapon(new Weapon("Booster Axe", new String[] { "+1 Skill Level", "-1 Damage" }, Material.DIAMOND_AXE, 1, 600)); + + AddWeapon(new Weapon("Standard Sword", new String[] { }, Material.IRON_SWORD, 1, 600)); + AddWeapon(new Weapon("Power Sword", new String[] { "+1 Damage", "Low Durability" }, Material.GOLD_SWORD, 1, 600)); + AddWeapon(new Weapon("Booster Sword", new String[] { "+1 Skill Level", "-1 Damage" }, Material.DIAMOND_SWORD, 1, 600)); + + List weaponTokens = new ArrayList(); + + for (IWeapon weapon : _weapons.values()) + { + WeaponToken weaponToken = new WeaponToken(); + weaponToken.Name = weapon.GetName(); + weaponToken.SalesPackage = new GameSalesPackageToken(); + weaponToken.SalesPackage.Gems = weapon.GetGemCost(); + + weaponTokens.add(weaponToken); + } + + List weapons = new JsonWebCall(_webServerAddress + "Dominate/GetWeapons").Execute(new TypeToken>(){}.getType(), weaponTokens); + + for (WeaponToken weaponToken : weapons) + { + if (_weapons.containsKey(weaponToken.Name)) + { + _weapons.get(weaponToken.Name).Update(weaponToken); + } + } + } + + public IWeapon GetWeapon(String weaponName) + { + return _weapons.get(weaponName); + } + + @Override + public Collection GetWeapons() + { + return _weapons.values(); + } + + public void AddWeapon(IWeapon newWeapon) + { + _weapons.put(newWeapon.GetName(), newWeapon); + } +} diff --git a/Plugins/Libraries/BungeeCord.jar b/Plugins/Libraries/BungeeCord.jar new file mode 100644 index 000000000..d9c98453c Binary files /dev/null and b/Plugins/Libraries/BungeeCord.jar differ diff --git a/Plugins/Libraries/NoCheatPlus.jar b/Plugins/Libraries/NoCheatPlus.jar new file mode 100644 index 000000000..db4083ca2 Binary files /dev/null and b/Plugins/Libraries/NoCheatPlus.jar differ diff --git a/Plugins/Libraries/TerrainControl.jar b/Plugins/Libraries/TerrainControl.jar new file mode 100644 index 000000000..e023e8be7 Binary files /dev/null and b/Plugins/Libraries/TerrainControl.jar differ diff --git a/Plugins/Libraries/bcprov-jdk15on-147.jar b/Plugins/Libraries/bcprov-jdk15on-147.jar new file mode 100644 index 000000000..0b80922e6 Binary files /dev/null and b/Plugins/Libraries/bcprov-jdk15on-147.jar differ diff --git a/Plugins/Libraries/bukkit.jar b/Plugins/Libraries/bukkit.jar new file mode 100644 index 000000000..c3bd10c98 Binary files /dev/null and b/Plugins/Libraries/bukkit.jar differ diff --git a/Plugins/Libraries/commons-codec-1.6.jar b/Plugins/Libraries/commons-codec-1.6.jar new file mode 100644 index 000000000..ee1bc49ac Binary files /dev/null and b/Plugins/Libraries/commons-codec-1.6.jar differ diff --git a/Plugins/Libraries/commons-io-2.4.jar b/Plugins/Libraries/commons-io-2.4.jar new file mode 100644 index 000000000..90035a4fe Binary files /dev/null and b/Plugins/Libraries/commons-io-2.4.jar differ diff --git a/Plugins/Libraries/commons-lang3-3.1.jar b/Plugins/Libraries/commons-lang3-3.1.jar new file mode 100644 index 000000000..a85e539b1 Binary files /dev/null and b/Plugins/Libraries/commons-lang3-3.1.jar differ diff --git a/Plugins/Libraries/commons-logging-1.1.1.jar b/Plugins/Libraries/commons-logging-1.1.1.jar new file mode 100644 index 000000000..1deef144c Binary files /dev/null and b/Plugins/Libraries/commons-logging-1.1.1.jar differ diff --git a/Plugins/Libraries/craftbukkit.jar b/Plugins/Libraries/craftbukkit.jar new file mode 100644 index 000000000..e907b924f Binary files /dev/null and b/Plugins/Libraries/craftbukkit.jar differ diff --git a/Plugins/Libraries/craftbukkit_official.jar b/Plugins/Libraries/craftbukkit_official.jar new file mode 100644 index 000000000..7f3f2e1bf Binary files /dev/null and b/Plugins/Libraries/craftbukkit_official.jar differ diff --git a/Plugins/Libraries/ebean-2.7.7.jar b/Plugins/Libraries/ebean-2.7.7.jar new file mode 100644 index 000000000..6232038f3 Binary files /dev/null and b/Plugins/Libraries/ebean-2.7.7.jar differ diff --git a/Plugins/Libraries/fluent-hc-4.2.jar b/Plugins/Libraries/fluent-hc-4.2.jar new file mode 100644 index 000000000..1f0e5d711 Binary files /dev/null and b/Plugins/Libraries/fluent-hc-4.2.jar differ diff --git a/Plugins/Libraries/gson-2.2.1.jar b/Plugins/Libraries/gson-2.2.1.jar new file mode 100644 index 000000000..93ac6d70b Binary files /dev/null and b/Plugins/Libraries/gson-2.2.1.jar differ diff --git a/Plugins/Libraries/guava-r07.jar b/Plugins/Libraries/guava-r07.jar new file mode 100644 index 000000000..9ff5f8905 Binary files /dev/null and b/Plugins/Libraries/guava-r07.jar differ diff --git a/Plugins/Libraries/httpclient-4.2.jar b/Plugins/Libraries/httpclient-4.2.jar new file mode 100644 index 000000000..9e0df5098 Binary files /dev/null and b/Plugins/Libraries/httpclient-4.2.jar differ diff --git a/Plugins/Libraries/httpclient-cache-4.2.jar b/Plugins/Libraries/httpclient-cache-4.2.jar new file mode 100644 index 000000000..a06f4bc66 Binary files /dev/null and b/Plugins/Libraries/httpclient-cache-4.2.jar differ diff --git a/Plugins/Libraries/httpcore-4.2.jar b/Plugins/Libraries/httpcore-4.2.jar new file mode 100644 index 000000000..20214eabd Binary files /dev/null and b/Plugins/Libraries/httpcore-4.2.jar differ diff --git a/Plugins/Libraries/httpmime-4.2.jar b/Plugins/Libraries/httpmime-4.2.jar new file mode 100644 index 000000000..8cec2fc23 Binary files /dev/null and b/Plugins/Libraries/httpmime-4.2.jar differ diff --git a/Plugins/Libraries/jansi-1.3.jar b/Plugins/Libraries/jansi-1.3.jar new file mode 100644 index 000000000..680d5758e Binary files /dev/null and b/Plugins/Libraries/jansi-1.3.jar differ diff --git a/Plugins/Libraries/jline-2.6.jar b/Plugins/Libraries/jline-2.6.jar new file mode 100644 index 000000000..0e32654ff Binary files /dev/null and b/Plugins/Libraries/jline-2.6.jar differ diff --git a/Plugins/Libraries/jopt-simple-3.2.jar b/Plugins/Libraries/jopt-simple-3.2.jar new file mode 100644 index 000000000..563736216 Binary files /dev/null and b/Plugins/Libraries/jopt-simple-3.2.jar differ diff --git a/Plugins/Libraries/snakeyaml-1.10.jar b/Plugins/Libraries/snakeyaml-1.10.jar new file mode 100644 index 000000000..75a4e7d43 Binary files /dev/null and b/Plugins/Libraries/snakeyaml-1.10.jar differ diff --git a/Plugins/Mineplex.Core.Common/.classpath b/Plugins/Mineplex.Core.Common/.classpath new file mode 100644 index 000000000..55c1f0232 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/Plugins/Mineplex.Core.Common/.project b/Plugins/Mineplex.Core.Common/.project new file mode 100644 index 000000000..801869e42 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/.project @@ -0,0 +1,17 @@ + + + Mineplex.Core.Common + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Mineplex.Core.Common/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.Core.Common/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7341ab168 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/CurrencyType.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/CurrencyType.class new file mode 100644 index 000000000..47aef0117 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/CurrencyType.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/Rank.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/Rank.class new file mode 100644 index 000000000..136b69beb Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/Rank.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/C.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/C.class new file mode 100644 index 000000000..13c78bcda Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/C.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/Callback.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/Callback.class new file mode 100644 index 000000000..7e5c5e600 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/Callback.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/F.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/F.class new file mode 100644 index 000000000..569382dca Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/F.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/FileUtil.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/FileUtil.class new file mode 100644 index 000000000..8bb1897cf Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/FileUtil.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/FireworkUtil.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/FireworkUtil.class new file mode 100644 index 000000000..2f363d0f1 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/FireworkUtil.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/InventoryUtil.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/InventoryUtil.class new file mode 100644 index 000000000..e5744354c Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/InventoryUtil.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/MapUtil.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/MapUtil.class new file mode 100644 index 000000000..2a8bf0f2e Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/MapUtil.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/NautHashMap.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/NautHashMap.class new file mode 100644 index 000000000..3cd1f039e Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/NautHashMap.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/TimeSpan.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/TimeSpan.class new file mode 100644 index 000000000..95bf381b9 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/TimeSpan.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilAction.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilAction.class new file mode 100644 index 000000000..712f3c1f5 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilAction.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilAlg.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilAlg.class new file mode 100644 index 000000000..83be39034 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilAlg.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilBlock.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilBlock.class new file mode 100644 index 000000000..3532e43a1 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilBlock.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilEnt.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilEnt.class new file mode 100644 index 000000000..968cf2644 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilEnt.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilEnum.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilEnum.class new file mode 100644 index 000000000..5da307eab Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilEnum.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilEvent$ActionType.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilEvent$ActionType.class new file mode 100644 index 000000000..ddd044925 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilEvent$ActionType.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilEvent.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilEvent.class new file mode 100644 index 000000000..de2dafccf Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilEvent.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilGear.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilGear.class new file mode 100644 index 000000000..3c9500a44 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilGear.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilInv.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilInv.class new file mode 100644 index 000000000..7e658341b Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilInv.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilMath.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilMath.class new file mode 100644 index 000000000..8d7046857 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilMath.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilPlayer.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilPlayer.class new file mode 100644 index 000000000..84d0d938a Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilPlayer.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilServer.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilServer.class new file mode 100644 index 000000000..6e4a50722 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilServer.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilSound.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilSound.class new file mode 100644 index 000000000..a74e09a47 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilSound.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilSystem.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilSystem.class new file mode 100644 index 000000000..f58527f07 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilSystem.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilText$TextAlign.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilText$TextAlign.class new file mode 100644 index 000000000..7d5d4679b Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilText$TextAlign.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilText.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilText.class new file mode 100644 index 000000000..cad6f3e63 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilText.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilTime$TimeUnit.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilTime$TimeUnit.class new file mode 100644 index 000000000..c62a5a520 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilTime$TimeUnit.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilTime.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilTime.class new file mode 100644 index 000000000..7da89f7b4 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilTime.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilWorld.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilWorld.class new file mode 100644 index 000000000..0161d4a82 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/UtilWorld.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/WorldChunkLoader.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/WorldChunkLoader.class new file mode 100644 index 000000000..38f88cec6 Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/WorldChunkLoader.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/WorldLoadInfo.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/WorldLoadInfo.class new file mode 100644 index 000000000..28c90618b Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/WorldLoadInfo.class differ diff --git a/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/WorldUtil.class b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/WorldUtil.class new file mode 100644 index 000000000..ca4b26a4f Binary files /dev/null and b/Plugins/Mineplex.Core.Common/bin/mineplex/core/common/util/WorldUtil.class differ diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/CurrencyType.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/CurrencyType.java new file mode 100644 index 000000000..6cc400874 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/CurrencyType.java @@ -0,0 +1,29 @@ +package mineplex.core.common; + +import org.bukkit.Material; + +public enum CurrencyType +{ + Tokens(" Tokens", Material.EMERALD), + Coins(" Coins", Material.GOLD_INGOT), + Gems("Gems", Material.DIAMOND); + + private String _prefix; + private Material _displayMaterial; + + CurrencyType(String prefix, Material displayMaterial) + { + _prefix = prefix; + _displayMaterial = displayMaterial; + } + + public String Prefix() + { + return _prefix; + } + + public Material GetDisplayMaterial() + { + return _displayMaterial; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java new file mode 100644 index 000000000..2aeb25748 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java @@ -0,0 +1,49 @@ +package mineplex.core.common; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +public enum Rank +{ + OWNER("Owner", ChatColor.DARK_RED), + DEVELOPER("Dev", ChatColor.RED), + ADMIN("Admin", ChatColor.RED), + MODERATOR("Mod", ChatColor.GOLD), + HELPER("Helper", ChatColor.YELLOW), + MAPDEV("Mapper", ChatColor.LIGHT_PURPLE), + ULTRA("Ultra", ChatColor.AQUA), + ALL("All", ChatColor.GREEN); + + public ChatColor Color; + public String Name; + + Rank(String name, ChatColor color) + { + Color = color; + Name = name; + } + + public boolean Has(Rank rank) + { + return Has(null, rank, false); + } + + public boolean Has(Player player, Rank rank, boolean inform) + { + if (compareTo(rank) <= 0) + return true; + + if (inform) + { + UtilPlayer.message(player, C.mHead + "Permissions > " + + C.mBody + "This requires Permission Rank [" + + C.mHead + rank + + C.mBody + "]."); + } + + return false; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/C.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/C.java new file mode 100644 index 000000000..5c4244c03 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/C.java @@ -0,0 +1,94 @@ +package mineplex.core.common.util; + +import org.bukkit.ChatColor; + +public class C +{ + public static String Bold = "§l"; + public static String Strike = "§m"; + public static String Line = "§n"; + + public static String cAqua = "" + ChatColor.AQUA; + public static String cBlack = "" + ChatColor.BLACK; + public static String cBlue = "" + ChatColor.BLUE; + public static String cDAqua = "" + ChatColor.DARK_AQUA; + public static String cDBlue = "" + ChatColor.DARK_BLUE; + public static String cDGray = "" + ChatColor.DARK_GRAY; + public static String cDGreen = "" + ChatColor.DARK_GREEN; + public static String cDPurple = "" + ChatColor.DARK_PURPLE; + public static String cDRed = "" + ChatColor.DARK_RED; + public static String cGold = "" + ChatColor.GOLD; + public static String cGray = "" + ChatColor.GRAY; + public static String cGreen = "" + ChatColor.GREEN; + public static String cPurple = "" + ChatColor.LIGHT_PURPLE; + public static String cRed = "" + ChatColor.RED; + public static String cWhite = "" + ChatColor.WHITE; + public static String cYellow = "" + ChatColor.YELLOW; + + public static String mHead = "" + ChatColor.BLUE; + public static String mBody = "" + ChatColor.GRAY; + public static String mChat = "" + ChatColor.WHITE; + public static String mElem = "" + ChatColor.YELLOW; + public static String mCount = "" + ChatColor.YELLOW; + public static String mTime = "" + ChatColor.GREEN; + public static String mItem = "" + ChatColor.YELLOW; + public static String mSkill = "" + ChatColor.GREEN; + public static String mLink = "" + ChatColor.WHITE; + public static String mLoot = "" + ChatColor.RED; + public static String mGame = "" + ChatColor.LIGHT_PURPLE; + + public static String wField = "" + ChatColor.WHITE; + public static String wFrame = "" + ChatColor.DARK_GRAY; + + public static String descHead = "" + ChatColor.DARK_GREEN; + public static String descBody = "" + ChatColor.WHITE; + + public static String chatPMHead = "" + ChatColor.DARK_GREEN; + public static String chatPMBody = "" + ChatColor.GREEN; + + public static String chatClanHead = "" + ChatColor.DARK_AQUA; + public static String chatClanBody = "" + ChatColor.AQUA; + + public static String chatAdminHead = "" + ChatColor.DARK_PURPLE; + public static String chatAdminBody = "" + ChatColor.LIGHT_PURPLE; + + public static String listTitle = "" + ChatColor.WHITE; + public static String listValue = "" + ChatColor.YELLOW; + public static String listValueOn = "" + ChatColor.GREEN; + public static String listValueOff = "" + ChatColor.RED; + + public static String rAll = "" + ChatColor.GREEN; + public static String rHelp = "" + ChatColor.YELLOW; + public static String rMod = "" + ChatColor.GOLD; + public static String rAdmin = "" + ChatColor.RED; + public static String rOwner = "" + ChatColor.DARK_RED; + + public static String consoleHead = "" + ChatColor.RED; + public static String consoleFill = "" + ChatColor.WHITE; + public static String consoleBody = "" + ChatColor.YELLOW; + + public static String sysHead = "" + ChatColor.DARK_GRAY; + public static String sysBody = "" + ChatColor.GRAY; + + public static String chat = "" + ChatColor.WHITE; + + public static String xBorderlands = "" + ChatColor.GOLD; + public static String xWilderness = "" + ChatColor.YELLOW; + public static String xMid = "" + ChatColor.WHITE; + public static String xNone = "" + ChatColor.GRAY; + + public static ChatColor xAdmin = ChatColor.WHITE; + public static ChatColor xSafe = ChatColor.AQUA; + + public static ChatColor xSelf = ChatColor.AQUA; + public static ChatColor xAlly = ChatColor.GREEN; + public static ChatColor xEnemy = ChatColor.YELLOW; + public static ChatColor xWar = ChatColor.RED; + public static ChatColor xPillage = ChatColor.LIGHT_PURPLE; + + public static ChatColor xdSelf = ChatColor.DARK_AQUA; + public static ChatColor xdAlly = ChatColor.DARK_GREEN; + public static ChatColor xdEnemy = ChatColor.GOLD; + public static ChatColor xdWar = ChatColor.DARK_RED; + public static ChatColor xdPillage = ChatColor.DARK_PURPLE; +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/Callback.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/Callback.java new file mode 100644 index 000000000..c9f26d703 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/Callback.java @@ -0,0 +1,6 @@ +package mineplex.core.common.util; + +public interface Callback +{ + public void run(T data); +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java new file mode 100644 index 000000000..ee2c49907 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java @@ -0,0 +1,189 @@ +package mineplex.core.common.util; + +import mineplex.core.common.Rank; + +import org.bukkit.ChatColor; + +public class F +{ + public static String main(String module, String body) + { + return C.mHead + module + "> " + C.mBody + body; + //return C.mBody + body; + } + + public static String tute(String sender, String body) + { + return C.cGold + sender + "> " + C.cWhite + body; + } + + public static String te(String message) + { + return C.cYellow + message + C.cWhite; + } + + public static String game(String elem) + { + return C.mGame + elem + C.mBody; + } + + public static String ta(String message) + { + return C.cGreen + message + C.cWhite; + } + + public static String ts(String message) + { + return C.cGold + message + C.cWhite; + } + + public static String sys(String head, String body) + { + return C.sysHead + head + "> " + C.sysBody + body; + } + + public static String elem(String elem) + { + return C.mElem + elem + ChatColor.RESET + C.mBody; + } + + public static String name(String elem) + { + return C.mElem + elem + C.mBody; + } + + public static String count(String elem) + { + return C.mCount + elem + C.mBody; + } + + public static String item(String elem) + { + return C.mItem + elem + C.mBody; + } + + public static String link(String elem) + { + return C.mLink + elem + C.mBody; + } + + public static String skill(String elem) + { + return C.mSkill + elem + C.mBody; + } + + public static String time(String elem) + { + return C.mTime + elem + C.mBody; + } + + public static String desc(String head, String body) + { + return C.descHead + head + ": " + C.descBody + body; + } + + public static String wField(String field, String data) + { + return C.wFrame + "[" + C.wField + field + C.wFrame + "] " + C.mBody + data + " "; + } + + public static String help(String cmd, String body, Rank rank) + { + if (rank == Rank.OWNER) return C.rOwner + cmd + " " + C.mBody + body + " " + rank(Rank.OWNER); + else if (rank == Rank.ADMIN) return C.rAdmin + cmd + " " + C.mBody + body + " " + rank(Rank.ADMIN); + else if (rank == Rank.MODERATOR) return C.rMod + cmd + " " + C.mBody + body + " " + rank(Rank.MODERATOR); + else if (rank == Rank.HELPER) return C.rHelp + cmd + " " + C.mBody + body + " " + rank(Rank.HELPER); + else return C.rAll + cmd + " " + C.mBody + body + " " + rank(Rank.ALL); + } + + public static String rank(Rank rank) + { + if (rank == Rank.OWNER) return C.rOwner + "Owner"; + else if (rank == Rank.ADMIN) return C.rAdmin + "Admin"; + else if (rank == Rank.MODERATOR) return C.rMod + "Mod"; + else if (rank == Rank.HELPER) return C.rHelp + "Helper"; + else return C.rAll + "Player"; + } + + public static String value(String variable, String value) + { + return value(0, variable, value); + } + + public static String value(int a, String variable, String value) + { + String indent = ""; + while (indent.length() < a) + indent += ChatColor.GRAY + ">"; + + return indent + C.listTitle + variable + ": " + C.listValue + value; + } + + public static String value(String variable, String value, boolean on) + { + return value(0, variable, value, on); + } + + public static String value(int a, String variable, String value, boolean on) + { + String indent = ""; + while (indent.length() < a) + indent += ChatColor.GRAY + ">"; + + if (on) return indent + C.listTitle + variable + ": " + C.listValueOn + value; + else return indent + C.listTitle + variable + ": " + C.listValueOff + value; + } + + public static String oo(boolean var) + { + if (var) + return C.listValueOn + "On" + C.mBody; + return C.listValueOff + "Off" + C.mBody; + } + + public static String tf(boolean var) + { + if (var) + return C.listValueOn + "True" + C.mBody; + return C.listValueOff + "False" + C.mBody; + } + + public static String oo(String variable, boolean value) + { + if (value) + return C.listValueOn + variable + C.mBody; + return C.listValueOff + variable + C.mBody; + } + + public static String combine(String[] args, int start, String color, boolean comma) + { + if (args.length == 0) + return ""; + + String out = ""; + + for (int i = start ; i 0) + if (comma) out = out.substring(0, out.length() - 2); + else out = out.substring(0, out.length() - 1); + + return out; + } + + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/FileUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/FileUtil.java new file mode 100644 index 000000000..2246c6142 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/FileUtil.java @@ -0,0 +1,117 @@ +package mineplex.core.common.util; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; + +public class FileUtil +{ + public static void DeleteFolder(File folder) + { + if (!folder.exists()) + return; + + File[] files = folder.listFiles(); + + if(files != null) + { + for(File f: files) + { + if(f.isDirectory()) + DeleteFolder(f); + else + f.delete(); + } + } + + folder.delete(); + } + + public static void CopyToDirectory(File file, String outputDirectory) + { + FileInputStream fileInputStream = null; + FileOutputStream fileOutputStream = null; + BufferedOutputStream bufferedOutputStream = null; + BufferedInputStream bufferedInputStream = null; + + try + { + fileInputStream = new FileInputStream(file); + bufferedInputStream = new BufferedInputStream(fileInputStream); + + int size; + byte[] buffer = new byte[2048]; + + fileOutputStream = new FileOutputStream(outputDirectory + "\\" + file.getName()); + bufferedOutputStream = new BufferedOutputStream(fileOutputStream, buffer.length); + + while ((size = bufferedInputStream.read(buffer, 0, buffer.length)) != -1) + { + bufferedOutputStream.write(buffer, 0, size); + } + + bufferedOutputStream.flush(); + bufferedOutputStream.close(); + fileOutputStream.flush(); + fileOutputStream.close(); + + bufferedInputStream.close(); + fileInputStream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + + if (fileInputStream != null) + { + try + { + fileInputStream.close(); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + } + + if (bufferedInputStream != null) + { + try + { + bufferedInputStream.close(); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + } + + if (fileOutputStream != null) + { + try + { + fileOutputStream.close(); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + } + + if (bufferedOutputStream != null) + { + try + { + bufferedOutputStream.close(); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + } + } + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/FireworkUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/FireworkUtil.java new file mode 100644 index 000000000..e9b9783c4 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/FireworkUtil.java @@ -0,0 +1,44 @@ +package mineplex.core.common.util; + +import org.apache.commons.lang.math.RandomUtils; +import org.bukkit.Color; +import org.bukkit.FireworkEffect; +import org.bukkit.FireworkEffect.Builder; +import org.bukkit.Location; +import org.bukkit.entity.Firework; +import org.bukkit.inventory.meta.FireworkMeta; + +public class FireworkUtil +{ + public static void LaunchRandomFirework(Location location) + { + Builder builder = FireworkEffect.builder(); + + if (RandomUtils.nextInt(3) == 0) + { + builder.withTrail(); + } + else if (RandomUtils.nextInt(2) == 0) + { + builder.withFlicker(); + } + + builder.with(FireworkEffect.Type.values()[RandomUtils.nextInt(FireworkEffect.Type.values().length)]); + + int colorCount = 17; + + builder.withColor(Color.fromRGB(RandomUtils.nextInt(255), RandomUtils.nextInt(255), RandomUtils.nextInt(255))); + + while (RandomUtils.nextInt(colorCount) != 0) + { + builder.withColor(Color.fromRGB(RandomUtils.nextInt(255), RandomUtils.nextInt(255), RandomUtils.nextInt(255))); + colorCount--; + } + + Firework firework = location.getWorld().spawn(location, Firework.class); + FireworkMeta data = (FireworkMeta) firework.getFireworkMeta(); + data.addEffects(builder.build()); + data.setPower(RandomUtils.nextInt(3)); + firework.setFireworkMeta(data); + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/InventoryUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/InventoryUtil.java new file mode 100644 index 000000000..effbdef42 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/InventoryUtil.java @@ -0,0 +1,125 @@ +package mineplex.core.common.util; + +import java.util.HashMap; + +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftInventory; +import org.bukkit.inventory.ItemStack; + +public class InventoryUtil +{ + public static HashMap removeItem(CraftInventory inventory, int endingSlot, ItemStack... items) + { + HashMap leftover = new HashMap(); + + if (endingSlot >= 54) + return leftover; + + for (int i = 0; i < items.length; i++) + { + ItemStack item = items[i]; + int toDelete = item.getAmount(); + + while (true) + { + int first = first(inventory, endingSlot, item, false); + + if (first == -1) + { + item.setAmount(toDelete); + leftover.put(i, item); + break; + } + else + { + ItemStack itemStack = inventory.getItem(first); + int amount = itemStack.getAmount(); + + if (amount <= toDelete) + { + toDelete -= amount; + inventory.clear(first); + } + else + { + itemStack.setAmount(amount - toDelete); + inventory.setItem(first, itemStack); + toDelete = 0; + } + } + + if (toDelete <= 0) + break; + } + } + + return leftover; + } + + public static int first(CraftInventory craftInventory, int endingSlot, ItemStack item, boolean withAmount) + { + if (endingSlot >= 54) + return -1; + + ItemStack[] inventory = craftInventory.getContents(); + + for (int i = 0; i < endingSlot; i++) + { + if (inventory[i] == null) + { + if (item == null) + return i; + else + continue; + } + else if (item == null) + continue; + + boolean equals = false; + + if (withAmount) + { + equals = item.equals(inventory[i]); + } + else + { + equals = item.getTypeId() == inventory[i].getTypeId() && item.getDurability() == inventory[i].getDurability() && item.getEnchantments().equals(inventory[i].getEnchantments()); + } + + if (equals) + { + return i; + } + } + + return -1; + } + + public static int GetCountOfObjectsRemoved(CraftInventory getInventory, int i, ItemStack itemStack) + { + int count = 0; + + while(getInventory.contains(itemStack.getType(), itemStack.getAmount()) && InventoryUtil.removeItem(getInventory, i, itemStack).size() == 0) + { + count++; + } + + return count; + } + + public static int GetCountOfObjectsRemovedInSlot(CraftInventory getInventory, int slot, ItemStack itemStack) + { + int count = 0; + ItemStack slotStack = getInventory.getItem(slot); + + while(slotStack.getType() == itemStack.getType() && slotStack.getAmount() >= itemStack.getAmount()) + { + slotStack.setAmount(slotStack.getAmount() - itemStack.getAmount()); + count++; + } + + if (slotStack.getAmount() == 0) + getInventory.setItem(slot, null); + + return count; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java new file mode 100644 index 000000000..d6b2f55a2 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java @@ -0,0 +1,278 @@ +package mineplex.core.common.util; + +import java.io.File; +import java.io.RandomAccessFile; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import net.minecraft.server.v1_6_R2.ChunkCoordIntPair; +import net.minecraft.server.v1_6_R2.MinecraftServer; +import net.minecraft.server.v1_6_R2.RegionFile; + +import org.bukkit.Bukkit; +import org.bukkit.Chunk; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.craftbukkit.v1_6_R2.CraftChunk; +import org.bukkit.craftbukkit.v1_6_R2.CraftServer; +import org.bukkit.craftbukkit.v1_6_R2.CraftWorld; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.world.WorldUnloadEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class MapUtil +{ + public static void ReplaceOreInChunk(Chunk chunk, Material replacee, Material replacer) + { + net.minecraft.server.v1_6_R2.Chunk c = ((CraftChunk)chunk).getHandle(); + + for(int x = 0; x < 16; x++) + { + for(int z = 0; z < 16; z++) + { + for(int y = 0; y < 18; y++) + { + int bX = c.x << 4 | x & 0xF; + int bY = y & 0xFF; + int bZ = c.z << 4 | z & 0xF; + + if(c.getTypeId(bX & 0xF, bY, bZ & 0xF) == replacee.getId()) + { + c.b(bX & 0xF, bY, bZ & 0xF, replacer.getId()); + } + } + } + } + + c.initLighting(); + } + + public static void QuickChangeBlockAt(Location location, Material setTo) + { + QuickChangeBlockAt(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), setTo); + } + + public static void QuickChangeBlockAt(Location location, int id, byte data) + { + QuickChangeBlockAt(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), id, data); + } + + public static void QuickChangeBlockAt(World world, int x, int y, int z, Material setTo) + { + QuickChangeBlockAt(world, x, y, z, setTo, 0); + } + + public static void QuickChangeBlockAt(World world, int x, int y, int z, Material setTo, int data) + { + QuickChangeBlockAt(world, x, y, z, setTo.getId(), data); + } + + public static void QuickChangeBlockAt(World world, int x, int y, int z, int id, int data) + { + Chunk chunk = world.getChunkAt(x >> 4, z >> 4); + net.minecraft.server.v1_6_R2.Chunk c = ((CraftChunk)chunk).getHandle(); + + c.a(x & 0xF, y, z & 0xF, id, data); + ((CraftWorld)world).getHandle().notify(x, y, z); + } + + public static int GetHighestBlockInCircleAt(World world, int bx, int bz, int radius) + { + int count = 0; + int totalHeight = 0; + + final double invRadiusX = 1 / radius; + final double invRadiusZ = 1 / radius; + + final int ceilRadiusX = (int) Math.ceil(radius); + final int ceilRadiusZ = (int) Math.ceil(radius); + + double nextXn = 0; + forX: for (int x = 0; x <= ceilRadiusX; ++x) + { + final double xn = nextXn; + nextXn = (x + 1) * invRadiusX; + double nextZn = 0; + forZ: for (int z = 0; z <= ceilRadiusZ; ++z) + { + final double zn = nextZn; + nextZn = (z + 1) * invRadiusZ; + + double distanceSq = xn*xn + zn*zn; + if (distanceSq > 1) + { + if (z == 0) { + break forX; + } + break forZ; + } + + totalHeight += world.getHighestBlockAt(bx + x, bz + z).getY(); + count++; + } + } + + return totalHeight / count; + } + + /* + public static void ResendChunksForNearbyPlayers(Collection chunks) + { + for (net.minecraft.server.Chunk c : chunks) + { + + for (Player player : onlinePlayers) + { + Vector pV = player.getLocation().toVector(); + int xDist = Math.abs((pV.getBlockX() >> 4) - c.x); + int zDist = Math.abs((pV.getBlockZ() >> 4) - c.z); + + if (xDist + zDist <= 12) + { + SendChunkForPlayer(c, player); + } + } + } + } + */ + + public static void SendChunkForPlayer(net.minecraft.server.v1_6_R2.Chunk chunk, Player player) + { + SendChunkForPlayer(chunk.x, chunk.z, player); + } + + @SuppressWarnings("unchecked") + public static void SendChunkForPlayer(int x, int z, Player player) + { + ((CraftPlayer)player).getHandle().chunkCoordIntPairQueue.add(new ChunkCoordIntPair(x, z)); + } + + public static void UnloadWorld(JavaPlugin plugin, World world) + { + world.setAutoSave(false); + + for (Entity entity : world.getEntities()) + { + entity.remove(); + } + + CraftServer server = (CraftServer)plugin.getServer(); + CraftWorld craftWorld = (CraftWorld)world; + + Bukkit.getPluginManager().callEvent(new WorldUnloadEvent(((CraftWorld)world).getHandle().getWorld())); + + Iterator chunkIterator = ((CraftWorld)world).getHandle().chunkProviderServer.chunks.values().iterator(); + + while (chunkIterator.hasNext()) + { + net.minecraft.server.v1_6_R2.Chunk chunk = chunkIterator.next(); + chunk.removeEntities(); + } + + ((CraftWorld)world).getHandle().chunkProviderServer.chunks.clear(); + ((CraftWorld)world).getHandle().chunkProviderServer.unloadQueue.clear(); + + try + { + Field f = server.getClass().getDeclaredField("worlds"); + f.setAccessible(true); + @SuppressWarnings("unchecked") + Map worlds = (Map)f.get(server); + worlds.remove(world.getName().toLowerCase()); + f.setAccessible(false); + } + catch (IllegalAccessException ex) + { + System.out.println("Error removing world from bukkit master list: " + ex.getMessage()); + } + catch (NoSuchFieldException ex) + { + System.out.println("Error removing world from bukkit master list: " + ex.getMessage()); + } + + MinecraftServer ms = null; + + try + { + Field f = server.getClass().getDeclaredField("console"); + f.setAccessible(true); + ms = (MinecraftServer)f.get(server); + f.setAccessible(false); + } + catch (IllegalAccessException ex) + { + System.out.println("Error getting minecraftserver variable: " + ex.getMessage()); + } + catch (NoSuchFieldException ex) + { + System.out.println("Error getting minecraftserver variable: " + ex.getMessage()); + } + + ms.worlds.remove(ms.worlds.indexOf(craftWorld.getHandle())); + } + + @SuppressWarnings({ "rawtypes"}) + public static boolean ClearWorldReferences(String worldName) + { + HashMap regionfiles = null; + Field rafField = null; + + try + { + Field a = net.minecraft.server.v1_6_R2.RegionFileCache.class.getDeclaredField("a"); + a.setAccessible(true); + regionfiles = (HashMap) a.get(null); + rafField = net.minecraft.server.v1_6_R2.RegionFile.class.getDeclaredField("c"); + rafField.setAccessible(true); + } + catch (Throwable t) + { + System.out.println("Error binding to region file cache."); + t.printStackTrace(); + } + + if (regionfiles == null) return false; + if (rafField == null) return false; + + ArrayList removedKeys = new ArrayList(); + try + { + for (Object o : regionfiles.entrySet()) + { + Map.Entry e = (Map.Entry) o; + File f = (File) e.getKey(); + + if (f.toString().startsWith("." + File.separator + worldName)) + { + RegionFile file = (RegionFile) e.getValue(); + try + { + RandomAccessFile raf = (RandomAccessFile) rafField.get(file); + raf.close(); + removedKeys.add(f); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + } + } + catch (Exception ex) + { + System.out.println("Exception while removing world reference for '" + worldName + "'!"); + ex.printStackTrace(); + } + + for (Object key : removedKeys) + regionfiles.remove(key); + + return true; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/NautHashMap.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/NautHashMap.java new file mode 100644 index 000000000..802a5f763 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/NautHashMap.java @@ -0,0 +1,66 @@ +package mineplex.core.common.util; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.Set; + +public class NautHashMap +{ + private HashMap _wrappedHashMap = new HashMap(); + + public boolean containsKey(KeyType key) + { + return _wrappedHashMap.containsKey(key); + } + + public boolean containsValue(ValueType key) + { + return _wrappedHashMap.containsValue(key); + } + + public Set> entrySet() + { + return _wrappedHashMap.entrySet(); + } + + public Set keySet() + { + return _wrappedHashMap.keySet(); + } + + public Collection values() + { + return _wrappedHashMap.values(); + } + + public ValueType get(KeyType key) + { + return _wrappedHashMap.get(key); + } + + public ValueType remove(KeyType key) + { + return _wrappedHashMap.remove(key); + } + + public ValueType put(KeyType key, ValueType value) + { + return _wrappedHashMap.put(key, value); + } + + public void clear() + { + _wrappedHashMap.clear(); + } + + public int size() + { + return _wrappedHashMap.size(); + } + + public boolean isEmpty() + { + return _wrappedHashMap.isEmpty(); + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/TimeSpan.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/TimeSpan.java new file mode 100644 index 000000000..3a813fee4 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/TimeSpan.java @@ -0,0 +1,9 @@ +package mineplex.core.common.util; + +public class TimeSpan +{ + public static final long DAY = 86400000; + public static final long HOUR = 3600000; + public static final long MINUTE = 60000; + public static final long SECOND = 1000; +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAction.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAction.java new file mode 100644 index 000000000..16977a29a --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAction.java @@ -0,0 +1,42 @@ +package mineplex.core.common.util; + + +import org.bukkit.entity.Entity; +import org.bukkit.util.Vector; + +public class UtilAction +{ + public static void velocity(Entity ent, double str, double yAdd, double yMax, boolean groundBoost) + { + velocity(ent, ent.getLocation().getDirection(), str, false, 0, yAdd, yMax, groundBoost); + } + + public static void velocity(Entity ent, Vector vec, double str, boolean ySet, double yBase, double yAdd, double yMax, boolean groundBoost) + { + if (Double.isNaN(vec.getX()) || Double.isNaN(vec.getY()) || Double.isNaN(vec.getZ()) || vec.length() == 0) + return; + + //YSet + if (ySet) + vec.setY(yBase); + + //Modify + vec.normalize(); + vec.multiply(str); + + //YAdd + vec.setY(vec.getY() + yAdd); + + //Limit + if (vec.getY() > yMax) + vec.setY(yMax); + + if (groundBoost) + if (UtilEnt.isGrounded(ent)) + vec.setY(vec.getY() + 0.2); + + //Velocity + ent.setFallDistance(0); + ent.setVelocity(vec); + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java new file mode 100644 index 000000000..4ef023f93 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java @@ -0,0 +1,114 @@ +package mineplex.core.common.util; + +import java.util.Set; +import java.util.TreeSet; + + +import org.bukkit.Location; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +public class UtilAlg +{ + public static TreeSet sortKey(Set toSort) + { + TreeSet sortedSet = new TreeSet(); + for (String cur : toSort) + sortedSet.add(cur); + + return sortedSet; + } + + public static Vector getTrajectory(Entity from, Entity to) + { + return getTrajectory(from.getLocation().toVector(), to.getLocation().toVector()); + } + + public static Vector getTrajectory(Location from, Location to) + { + return getTrajectory(from.toVector(), to.toVector()); + } + + public static Vector getTrajectory(Vector from, Vector to) + { + return to.subtract(from).normalize(); + } + + public static Vector getTrajectory2d(Entity from, Entity to) + { + return getTrajectory2d(from.getLocation().toVector(), to.getLocation().toVector()); + } + + public static Vector getTrajectory2d(Location from, Location to) + { + return getTrajectory2d(from.toVector(), to.toVector()); + } + + public static Vector getTrajectory2d(Vector from, Vector to) + { + return to.subtract(from).setY(0).normalize(); + } + + public static boolean HasSight(Location from, Player to) + { + return HasSight(from, to.getLocation()) || HasSight(from, to.getEyeLocation()); + } + + public static boolean HasSight(Location from, Location to) + { + //Clone Location + Location cur = new Location(from.getWorld(), from.getX(), from.getY(), from.getZ()); + + double rate = 0.1; + Vector vec = getTrajectory(from, to).multiply(0.1); + + while (UtilMath.offset(cur, to) > rate) + { + cur.add(vec); + + if (!UtilBlock.airFoliage(cur.getBlock())) + return false; + } + + return true; + } + + public static float GetPitch(Vector vec) + { + double x = vec.getX(); + double y = vec.getY(); + double z = vec.getZ(); + double xz = Math.sqrt((x*x) + (z*z)); + + double pitch = Math.toDegrees(Math.atan(xz/y)); + if (y <= 0) pitch += 90; + else pitch -= 90; + + return (float) pitch; + } + + public static float GetYaw(Vector vec) + { + double x = vec.getX(); + double z = vec.getZ(); + + double yaw = Math.toDegrees(Math.atan((-x)/z)); + if (z < 0) yaw += 180; + + return (float) yaw; + } + + public static Vector Normalize(Vector vec) + { + if (vec.length() > 0) + vec.normalize(); + + return vec; + } + + public static Vector Clone(Vector vec) + { + return new Vector(vec.getX(), vec.getY(), vec.getZ()); + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java new file mode 100644 index 000000000..ac9627cf2 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -0,0 +1,323 @@ +package mineplex.core.common.util; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.inventory.ItemStack; + +public class UtilBlock +{ + public static HashSet blockPassSet = new HashSet(); + public static boolean solid(Block block) + { + if (block == null) return false; + return solid(block.getTypeId()); + } + public static boolean solid(int block) + { + return solid((byte)block); + } + public static boolean solid(byte block) + { + if (blockPassSet.isEmpty()) + { + blockPassSet.add((byte)0); + blockPassSet.add((byte)6); + blockPassSet.add((byte)8); + blockPassSet.add((byte)9); + blockPassSet.add((byte)10); + blockPassSet.add((byte)11); + blockPassSet.add((byte)26); + blockPassSet.add((byte)27); + blockPassSet.add((byte)28); + blockPassSet.add((byte)30); + blockPassSet.add((byte)31); + blockPassSet.add((byte)32); + blockPassSet.add((byte)37); + blockPassSet.add((byte)38); + blockPassSet.add((byte)39); + blockPassSet.add((byte)40); + blockPassSet.add((byte)50); + blockPassSet.add((byte)51); + blockPassSet.add((byte)55); + blockPassSet.add((byte)59); + blockPassSet.add((byte)63); + blockPassSet.add((byte)64); + blockPassSet.add((byte)65); + blockPassSet.add((byte)66); + blockPassSet.add((byte)68); + blockPassSet.add((byte)69); + blockPassSet.add((byte)70); + blockPassSet.add((byte)71); + blockPassSet.add((byte)72); + blockPassSet.add((byte)75); + blockPassSet.add((byte)76); + blockPassSet.add((byte)77); + blockPassSet.add((byte)78); + blockPassSet.add((byte)83); + blockPassSet.add((byte)90); + blockPassSet.add((byte)92); + blockPassSet.add((byte)93); + blockPassSet.add((byte)94); + blockPassSet.add((byte)96); + blockPassSet.add((byte)101); + blockPassSet.add((byte)102); + blockPassSet.add((byte)104); + blockPassSet.add((byte)105); + blockPassSet.add((byte)106); + blockPassSet.add((byte)107); + blockPassSet.add((byte)111); + blockPassSet.add((byte)115); + blockPassSet.add((byte)116); + blockPassSet.add((byte)117); + blockPassSet.add((byte)118); + blockPassSet.add((byte)119); + blockPassSet.add((byte)120); + } + + return !blockPassSet.contains(block); + } + + public static HashSet blockAirFoliageSet = new HashSet(); + public static boolean airFoliage(Block block) + { + if (block == null) return false; + return airFoliage(block.getTypeId()); + } + public static boolean airFoliage(int block) + { + return airFoliage((byte)block); + } + public static boolean airFoliage(byte block) + { + if (blockAirFoliageSet.isEmpty()) + { + blockAirFoliageSet.add((byte)0); + blockAirFoliageSet.add((byte)6); + blockAirFoliageSet.add((byte)31); + blockAirFoliageSet.add((byte)32); + blockAirFoliageSet.add((byte)37); + blockAirFoliageSet.add((byte)38); + blockAirFoliageSet.add((byte)39); + blockAirFoliageSet.add((byte)40); + blockAirFoliageSet.add((byte)51); + blockAirFoliageSet.add((byte)59); + blockAirFoliageSet.add((byte)104); + blockAirFoliageSet.add((byte)105); + blockAirFoliageSet.add((byte)115); + blockAirFoliageSet.add((byte)141); + blockAirFoliageSet.add((byte)142); + } + + return blockAirFoliageSet.contains(block); + } + + public static HashSet fullSolid = new HashSet(); + public static boolean fullSolid(Block block) + { + if (block == null) + return false; + + return fullSolid(block.getTypeId()); + } + public static boolean fullSolid(int block) + { + return fullSolid((byte)block); + } + public static boolean fullSolid(byte block) + { + if (fullSolid.isEmpty()) + { + fullSolid.add((byte)1); // + fullSolid.add((byte)2); // + fullSolid.add((byte)3); // + fullSolid.add((byte)4); // + fullSolid.add((byte)5); // + fullSolid.add((byte)7); // + fullSolid.add((byte)12); // + fullSolid.add((byte)13); // + fullSolid.add((byte)14); // + fullSolid.add((byte)15); // + fullSolid.add((byte)16); // + fullSolid.add((byte)17); // + fullSolid.add((byte)19); // + fullSolid.add((byte)20); // + fullSolid.add((byte)21); // + fullSolid.add((byte)22); // + fullSolid.add((byte)23); // + fullSolid.add((byte)24); // + fullSolid.add((byte)25); // + fullSolid.add((byte)29); // + fullSolid.add((byte)33); // + fullSolid.add((byte)35); // + fullSolid.add((byte)41); // + fullSolid.add((byte)42); // + fullSolid.add((byte)43); // + fullSolid.add((byte)44); // + fullSolid.add((byte)45); // + fullSolid.add((byte)46); // + fullSolid.add((byte)47); // + fullSolid.add((byte)48); // + fullSolid.add((byte)49); // + fullSolid.add((byte)56); // + fullSolid.add((byte)57); // + fullSolid.add((byte)58); // + fullSolid.add((byte)60); // + fullSolid.add((byte)61); // + fullSolid.add((byte)62); // + fullSolid.add((byte)73); // + fullSolid.add((byte)74); // + fullSolid.add((byte)79); // + fullSolid.add((byte)80); // + fullSolid.add((byte)82); // + fullSolid.add((byte)84); // + fullSolid.add((byte)86); // + fullSolid.add((byte)87); // + fullSolid.add((byte)88); // + fullSolid.add((byte)89); // + fullSolid.add((byte)91); // + fullSolid.add((byte)95); // + fullSolid.add((byte)97); // + fullSolid.add((byte)98); // + fullSolid.add((byte)99); // + fullSolid.add((byte)100); // + fullSolid.add((byte)103); // + fullSolid.add((byte)110); // + fullSolid.add((byte)112); // + fullSolid.add((byte)121); // + fullSolid.add((byte)123); // + fullSolid.add((byte)124); // + fullSolid.add((byte)125); // + fullSolid.add((byte)126); // + fullSolid.add((byte)129); // + fullSolid.add((byte)133); // + fullSolid.add((byte)137); // + fullSolid.add((byte)138); // + fullSolid.add((byte)152); // + fullSolid.add((byte)153); // + fullSolid.add((byte)155); // + fullSolid.add((byte)158); // + } + + return fullSolid.contains(block); + } + + public static HashSet blockUseSet = new HashSet(); + public static boolean usable(Block block) + { + if (block == null) + return false; + + return usable(block.getTypeId()); + } + public static boolean usable(int block) + { + return usable((byte)block); + } + public static boolean usable(byte block) + { + if (blockUseSet.isEmpty()) + { + blockUseSet.add((byte)23); //Dispenser + blockUseSet.add((byte)26); //Bed + blockUseSet.add((byte)33); //Piston + blockUseSet.add((byte)47); //Bookcase + blockUseSet.add((byte)54); //Chest + blockUseSet.add((byte)58); //Workbench + blockUseSet.add((byte)61); //Furnace + blockUseSet.add((byte)62); //Furnace + blockUseSet.add((byte)64); //Wood Door + blockUseSet.add((byte)69); //Lever + blockUseSet.add((byte)71); //Iron Door + blockUseSet.add((byte)77); //Button + blockUseSet.add((byte)93); //Repeater + blockUseSet.add((byte)94); //Repeater + blockUseSet.add((byte)96); //Trapdoor + blockUseSet.add((byte)107); //Fence Gate + blockUseSet.add((byte)116); //Enchantment Table + blockUseSet.add((byte)117); //Brewing Stand + blockUseSet.add((byte)130); //Ender Chest + blockUseSet.add((byte)145); //Anvil + blockUseSet.add((byte)146); //Trapped Chest + blockUseSet.add((byte)154); //Hopper + blockUseSet.add((byte)158); //Dropper + } + + return blockUseSet.contains(block); + } + + public static HashMap getInRadius(Location loc, Double dR) + { + return getInRadius(loc, dR, 999); + } + + public static HashMap getInRadius(Location loc, Double dR, double heightLimit) + { + HashMap blockList = new HashMap(); + int iR = dR.intValue() + 1; + + for (int x=-iR ; x <= iR ; x++) + for (int z=-iR ; z <= iR ; z++) + for (int y=-iR ; y <= iR ; y++) + { + if (Math.abs(y) > heightLimit) + continue; + + Block curBlock = loc.getWorld().getBlockAt((int)(loc.getX()+x), (int)(loc.getY()+y), (int)(loc.getZ()+z)); + + double offset = UtilMath.offset(loc, curBlock.getLocation().add(0.5, 0.5, 0.5));; + + if (offset <= dR) + blockList.put(curBlock, 1 - (offset/dR)); + } + + return blockList; + } + + public static boolean isBlock(ItemStack item) + { + if (item == null) + return false; + + return item.getTypeId() > 0 && item.getTypeId() < 256; + } + + public static Block getHighest(World world, int x, int z) + { + return getHighest(world, x, z, null); + } + + public static Block getHighest(World world, int x, int z, HashSet ignore) + { + Block block = world.getHighestBlockAt(x, z); + + //Shuffle Down + while (airFoliage(block) || + block.getType() == Material.LEAVES || + (ignore != null && ignore.contains(block.getType()))) + { + block = block.getRelative(BlockFace.DOWN); + } + + return block.getRelative(BlockFace.UP); + } + public static ArrayList getSurrounding(Block block) + { + ArrayList blocks = new ArrayList(); + + blocks.add(block.getRelative(BlockFace.UP)); + blocks.add(block.getRelative(BlockFace.DOWN)); + blocks.add(block.getRelative(BlockFace.NORTH)); + blocks.add(block.getRelative(BlockFace.SOUTH)); + blocks.add(block.getRelative(BlockFace.EAST)); + blocks.add(block.getRelative(BlockFace.WEST)); + + return blocks; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java new file mode 100644 index 000000000..fbf023531 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java @@ -0,0 +1,357 @@ +package mineplex.core.common.util; + +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.LinkedList; + +import net.minecraft.server.v1_6_R2.EntityCreature; +import net.minecraft.server.v1_6_R2.EntityHuman; +import net.minecraft.server.v1_6_R2.EntityInsentient; +import net.minecraft.server.v1_6_R2.PathfinderGoalLookAtPlayer; +import net.minecraft.server.v1_6_R2.PathfinderGoalMoveTowardsRestriction; +import net.minecraft.server.v1_6_R2.PathfinderGoalRandomLookaround; +import net.minecraft.server.v1_6_R2.PathfinderGoalSelector; + +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; + +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_6_R2.CraftWorld; + +public class UtilEnt +{ + //Custom Entity Names + private static HashMap _nameMap = new HashMap(); + private static HashMap creatureMap = new HashMap(); + + private static Field _goalSelector; + private static Field _targetSelector; + private static Field _bsRestrictionGoal; + + public static HashMap GetEntityNames() + { + return _nameMap; + } + + public static void Vegetate(Entity entity) + { + try + { + if (_goalSelector == null) + { + _goalSelector = EntityInsentient.class.getDeclaredField("goalSelector"); + _goalSelector.setAccessible(true); + } + + if (_targetSelector == null) + { + _targetSelector = EntityInsentient.class.getDeclaredField("targetSelector"); + _targetSelector.setAccessible(true); + } + + if (entity instanceof CraftCreature) + { + EntityCreature creature = ((CraftCreature)entity).getHandle(); + + if (_bsRestrictionGoal == null) + { + _bsRestrictionGoal = EntityCreature.class.getDeclaredField("bs"); + _bsRestrictionGoal.setAccessible(true); + } + + _bsRestrictionGoal.set(creature, new PathfinderGoalMoveTowardsRestriction(creature, 0D)); + } + + if (((CraftEntity)entity).getHandle() instanceof EntityInsentient) + { + EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle(); + + PathfinderGoalSelector goalSelector = new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler); + + goalSelector.a(7, new PathfinderGoalLookAtPlayer(creature, EntityHuman.class, 6.0F)); + goalSelector.a(7, new PathfinderGoalRandomLookaround(creature)); + + _goalSelector.set(creature, goalSelector); + _targetSelector.set(creature, new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler)); + } + + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + catch (NoSuchFieldException e) + { + e.printStackTrace(); + } + catch (SecurityException e) + { + e.printStackTrace(); + } + } + + public static void populate() + { + if (creatureMap.isEmpty()) + { + creatureMap.put("Bat", EntityType.BAT); + creatureMap.put("Blaze", EntityType.BLAZE); + creatureMap.put("Arrow", EntityType.ARROW); + creatureMap.put("Cave Spider", EntityType.CAVE_SPIDER); + creatureMap.put("Chicken", EntityType.CHICKEN); + creatureMap.put("Cow", EntityType.COW); + creatureMap.put("Creeper", EntityType.CREEPER); + creatureMap.put("Ender Dragon", EntityType.ENDER_DRAGON); + creatureMap.put("Enderman", EntityType.ENDERMAN); + creatureMap.put("Ghast", EntityType.GHAST); + creatureMap.put("Giant", EntityType.GIANT); + creatureMap.put("Horse", EntityType.HORSE); + creatureMap.put("Iron Golem", EntityType.IRON_GOLEM); + creatureMap.put("Item", EntityType.DROPPED_ITEM); + creatureMap.put("Magma Cube", EntityType.MAGMA_CUBE); + creatureMap.put("Mooshroom", EntityType.MUSHROOM_COW); + creatureMap.put("Ocelot", EntityType.OCELOT); + creatureMap.put("Pig", EntityType.PIG); + creatureMap.put("Pig Zombie", EntityType.PIG_ZOMBIE); + creatureMap.put("Sheep", EntityType.SHEEP); + creatureMap.put("Silverfish", EntityType.SILVERFISH); + creatureMap.put("Skeleton", EntityType.SKELETON); + creatureMap.put("Slime", EntityType.SLIME); + creatureMap.put("Snowman", EntityType.SNOWMAN); + creatureMap.put("Spider", EntityType.SPIDER); + creatureMap.put("Squid", EntityType.SQUID); + creatureMap.put("Villager", EntityType.VILLAGER); + creatureMap.put("Witch", EntityType.WITCH); + creatureMap.put("Wither", EntityType.WITHER); + creatureMap.put("WitherSkull", EntityType.WITHER_SKULL); + creatureMap.put("Wolf", EntityType.WOLF); + creatureMap.put("Zombie", EntityType.ZOMBIE); + + creatureMap.put("Item", EntityType.DROPPED_ITEM); + } + } + + public static String getName(Entity ent) + { + if (ent == null) + return "Null"; + + if (ent.getType() == EntityType.PLAYER) + return ((Player)ent).getName(); + + if (GetEntityNames().containsKey(ent)) + return GetEntityNames().get(ent); + + return getName(ent.getType()); + } + + public static String getName(EntityType type) + { + for (String cur : creatureMap.keySet()) + if (creatureMap.get(cur) == type) + return cur; + + return type.getName(); + } + + public static String searchName(Player caller, String arg, boolean inform) + { + populate(); + + arg = arg.toLowerCase().replaceAll("_", " "); + LinkedList matchList = new LinkedList(); + for (String cur : creatureMap.keySet()) + { + if (cur.equalsIgnoreCase(arg)) + return cur; + + if (cur.toLowerCase().contains(arg)) + matchList.add(cur); + } + + + //No / Non-Unique + if (matchList.size() != 1) + { + if (!inform) + return null; + + //Inform + UtilPlayer.message(caller, F.main("Creature Search", "" + + C.mCount + matchList.size() + + C.mBody + " matches for [" + + C.mElem + arg + + C.mBody + "].")); + + if (matchList.size() > 0) + { + String matchString = ""; + for (String cur : matchList) + matchString += F.elem(cur) + ", "; + if (matchString.length() > 1) + matchString = matchString.substring(0 , matchString.length() - 2); + + UtilPlayer.message(caller, F.main("Creature Search", "" + + C.mBody + "Matches [" + + C.mElem + matchString + + C.mBody + "].")); + } + + return null; + } + + return matchList.get(0); + } + + public static EntityType searchEntity(Player caller, String arg, boolean inform) + { + populate(); + + arg = arg.toLowerCase(); + LinkedList matchList = new LinkedList(); + for (String cur : creatureMap.keySet()) + { + if (cur.equalsIgnoreCase(arg)) + return creatureMap.get(cur); + + if (cur.toLowerCase().contains(arg)) + matchList.add(creatureMap.get(cur)); + } + + + //No / Non-Unique + if (matchList.size() != 1) + { + if (!inform) + return null; + + //Inform + UtilPlayer.message(caller, F.main("Creature Search", "" + + C.mCount + matchList.size() + + C.mBody + " matches for [" + + C.mElem + arg + + C.mBody + "].")); + + if (matchList.size() > 0) + { + String matchString = ""; + for (EntityType cur : matchList) + matchString += F.elem(cur.getName()) + ", "; + if (matchString.length() > 1) + matchString = matchString.substring(0 , matchString.length() - 2); + + UtilPlayer.message(caller, F.main("Creature Search", "" + + C.mBody + "Matches [" + + C.mElem + matchString + + C.mBody + "].")); + } + + return null; + } + + return matchList.get(0); + } + + public static HashMap getInRadius(Location loc, double dR) + { + HashMap ents = new HashMap(); + + for (Entity cur : loc.getWorld().getEntities()) + { + if (!(cur instanceof LivingEntity) || (cur instanceof Player && ((Player)cur).getGameMode() == GameMode.CREATIVE)) + continue; + + LivingEntity ent = (LivingEntity)cur; + + double offset = UtilMath.offset(loc, ent.getLocation()); + + if (offset < dR) + ents.put(ent, 1 - (offset/dR)); + } + + return ents; + } + + public static boolean hitBox(Location loc, LivingEntity ent, double mult) + { + if (ent instanceof Player) + { + Player player = (Player)ent; + + if (UtilMath.offset(loc, player.getEyeLocation()) < 0.4 * mult) + { + return true; + } + else if (UtilMath.offset2d(loc, player.getLocation()) < 0.6 * mult) + { + if (loc.getY() > player.getLocation().getY() && loc.getY() < player.getEyeLocation().getY()) + { + return true; + } + } + } + else + if (loc.getY() > ent.getLocation().getY() && loc.getY() < ent.getLocation().getY() + 1) + if (UtilMath.offset2d(loc, ent.getLocation()) < 0.5) + return true; + + + return false; + } + + public static boolean isGrounded(Entity ent) + { + if (ent instanceof CraftEntity) + return ((CraftEntity)ent).getHandle().onGround; + + return UtilBlock.solid(ent.getLocation().getBlock().getRelative(BlockFace.DOWN)); + } + + public static void PlayDamageSound(LivingEntity damagee) + { + Sound sound = Sound.HURT_FLESH; + + if (damagee.getType() == EntityType.BAT) sound = Sound.BAT_HURT; + else if (damagee.getType() == EntityType.BLAZE) sound = Sound.BLAZE_HIT; + else if (damagee.getType() == EntityType.CAVE_SPIDER) sound = Sound.SPIDER_IDLE; + else if (damagee.getType() == EntityType.CHICKEN) sound = Sound.CHICKEN_HURT; + else if (damagee.getType() == EntityType.COW) sound = Sound.COW_HURT; + else if (damagee.getType() == EntityType.CREEPER) sound = Sound.CREEPER_HISS; + else if (damagee.getType() == EntityType.ENDER_DRAGON) sound = Sound.ENDERDRAGON_GROWL; + else if (damagee.getType() == EntityType.ENDERMAN) sound = Sound.ENDERMAN_HIT; + else if (damagee.getType() == EntityType.GHAST) sound = Sound.GHAST_SCREAM; + else if (damagee.getType() == EntityType.GIANT) sound = Sound.ZOMBIE_HURT; + //else if (damagee.getType() == EntityType.HORSE) sound = Sound. + else if (damagee.getType() == EntityType.IRON_GOLEM) sound = Sound.IRONGOLEM_HIT; + else if (damagee.getType() == EntityType.MAGMA_CUBE) sound = Sound.MAGMACUBE_JUMP; + else if (damagee.getType() == EntityType.MUSHROOM_COW) sound = Sound.COW_HURT; + else if (damagee.getType() == EntityType.OCELOT) sound = Sound.CAT_MEOW; + else if (damagee.getType() == EntityType.PIG) sound = Sound.PIG_IDLE; + else if (damagee.getType() == EntityType.PIG_ZOMBIE) sound = Sound.ZOMBIE_HURT; + else if (damagee.getType() == EntityType.SHEEP) sound = Sound.SHEEP_IDLE; + else if (damagee.getType() == EntityType.SILVERFISH) sound = Sound.SILVERFISH_HIT; + else if (damagee.getType() == EntityType.SKELETON) sound = Sound.SKELETON_HURT; + else if (damagee.getType() == EntityType.SLIME) sound = Sound.SLIME_ATTACK; + else if (damagee.getType() == EntityType.SNOWMAN) sound = Sound.STEP_SNOW; + else if (damagee.getType() == EntityType.SPIDER) sound = Sound.SPIDER_IDLE; + //else if (damagee.getType() == EntityType.SQUID) sound = Sound; + //else if (damagee.getType() == EntityType.VILLAGER) sound = Sound; + //else if (damagee.getType() == EntityType.WITCH) sound = Sound.; + else if (damagee.getType() == EntityType.WITHER) sound = Sound.WITHER_HURT; + else if (damagee.getType() == EntityType.WOLF) sound = Sound.WOLF_HURT; + else if (damagee.getType() == EntityType.ZOMBIE) sound = Sound.ZOMBIE_HURT; + + damagee.getWorld().playSound(damagee.getLocation(), sound, 1.5f + (float)(0.5f * Math.random()), 0.8f + (float)(0.4f * Math.random())); + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnum.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnum.java new file mode 100644 index 000000000..447258e6a --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnum.java @@ -0,0 +1,17 @@ +package mineplex.core.common.util; + +public class UtilEnum +{ + public static > T fromString(Class t, String text) + { + for (T value : t.getEnumConstants()) + { + if (text.equalsIgnoreCase(value.name())) + { + return (T)value; + } + } + + throw new IllegalArgumentException("There is no value with name '" + text + " in Enum " + t.getClass().getName()); + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEvent.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEvent.java new file mode 100644 index 000000000..afa8218a0 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEvent.java @@ -0,0 +1,40 @@ +package mineplex.core.common.util; + +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +public class UtilEvent +{ + public enum ActionType + { + L, + L_AIR, + L_BLOCK, + R, + R_AIR, + R_BLOCK + } + + public static boolean isAction(PlayerInteractEvent event, ActionType action) + { + if (action == ActionType.L) + return (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK); + + if (action == ActionType.L_AIR) + return (event.getAction() == Action.LEFT_CLICK_AIR); + + if (action == ActionType.L_BLOCK) + return (event.getAction() == Action.LEFT_CLICK_BLOCK); + + if (action == ActionType.R) + return (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK); + + if (action == ActionType.R_AIR) + return (event.getAction() == Action.RIGHT_CLICK_AIR); + + if (action == ActionType.R_BLOCK) + return (event.getAction() == Action.RIGHT_CLICK_BLOCK); + + return false; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilGear.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilGear.java new file mode 100644 index 000000000..c590e4f83 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilGear.java @@ -0,0 +1,159 @@ +package mineplex.core.common.util; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + +public class UtilGear +{ + private static HashSet _axeSet = new HashSet(); + private static HashSet _swordSet = new HashSet(); + private static HashSet _maulSet = new HashSet(); + private static HashSet pickSet = new HashSet(); + private static HashSet diamondSet = new HashSet(); + private static HashSet goldSet = new HashSet(); + + public static boolean isAxe(ItemStack item) + { + if (item == null) + return false; + + if (_axeSet.isEmpty()) + { + _axeSet.add(Material.WOOD_AXE); + _axeSet.add(Material.STONE_AXE); + _axeSet.add(Material.IRON_AXE); + _axeSet.add(Material.GOLD_AXE); + _axeSet.add(Material.DIAMOND_AXE); + } + + return _axeSet.contains(item.getType()); + } + + public static boolean isSword(ItemStack item) + { + + if (item == null) + return false; + + if (_swordSet.isEmpty()) + { + _swordSet.add(Material.WOOD_SWORD); + _swordSet.add(Material.STONE_SWORD); + _swordSet.add(Material.IRON_SWORD); + _swordSet.add(Material.GOLD_SWORD); + _swordSet.add(Material.DIAMOND_SWORD); + } + + return _swordSet.contains(item.getType()); + } + + public static boolean isShovel(ItemStack item) + { + if (item == null) + return false; + + if (_maulSet.isEmpty()) + { + _maulSet.add(Material.WOOD_SPADE); + _maulSet.add(Material.STONE_SPADE); + _maulSet.add(Material.IRON_SPADE); + _maulSet.add(Material.GOLD_SPADE); + _maulSet.add(Material.DIAMOND_SPADE); + } + + return _maulSet.contains(item.getType()); + } + + public HashSet scytheSet = new HashSet(); + public boolean isHoe(ItemStack item) + { + if (item == null) + return false; + + if (scytheSet.isEmpty()) + { + scytheSet.add(Material.WOOD_HOE); + scytheSet.add(Material.STONE_HOE); + scytheSet.add(Material.IRON_HOE); + scytheSet.add(Material.GOLD_HOE); + scytheSet.add(Material.DIAMOND_HOE); + } + + return scytheSet.contains(item.getType()); + } + + public boolean isPickaxe(ItemStack item) + { + if (item == null) + return false; + + if (pickSet.isEmpty()) + { + pickSet.add(Material.WOOD_PICKAXE); + pickSet.add(Material.STONE_PICKAXE); + pickSet.add(Material.IRON_PICKAXE); + pickSet.add(Material.GOLD_PICKAXE); + pickSet.add(Material.DIAMOND_PICKAXE); + } + + return pickSet.contains(item.getType()); + } + + public boolean isDiamond(ItemStack item) + { + if (item == null) + return false; + + if (diamondSet.isEmpty()) + { + diamondSet.add(Material.DIAMOND_SWORD); + diamondSet.add(Material.DIAMOND_AXE); + diamondSet.add(Material.DIAMOND_SPADE); + diamondSet.add(Material.DIAMOND_HOE); + } + + return diamondSet.contains(item.getType()); + } + + public static boolean isGold(ItemStack item) + { + if (item == null) + return false; + + if (goldSet.isEmpty()) + { + goldSet.add(Material.GOLD_SWORD); + goldSet.add(Material.GOLD_AXE); + } + + return goldSet.contains(item.getType()); + } + + public static boolean isBow(ItemStack item) + { + if (item == null) + return false; + + return item.getType() == Material.BOW; + } + + public static boolean isWeapon(ItemStack item) + { + return isAxe(item) || isSword(item); + } + + public static boolean isMat(ItemStack item, Material mat) + { + if (item == null) + return false; + + return item.getType() == mat; + } + + public static boolean isRepairable(ItemStack item) + { + return (item.getType().getMaxDurability() > 0); + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java new file mode 100644 index 000000000..40b59e1a7 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java @@ -0,0 +1,246 @@ +package mineplex.core.common.util; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.InventoryAction; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; + +public class UtilInv +{ + @SuppressWarnings("deprecation") + public static boolean insert(Player player, ItemStack stack) + { + //CHECK IF FIT + + //Insert + player.getInventory().addItem(stack); + player.updateInventory(); + return true; + } + + public static boolean contains(Player player, Material item, byte data, int required) + { + for (int i : player.getInventory().all(item).keySet()) + { + if (required <= 0) + return true; + + ItemStack stack = player.getInventory().getItem(i); + + if (stack != null && stack.getAmount() > 0 && (stack.getData() == null || stack.getData().getData() == data)) + { + required -= stack.getAmount(); + } + } + + if (required <= 0) + { + return true; + } + + return false; + } + + @SuppressWarnings("deprecation") + public static boolean remove(Player player, Material item, byte data, int toRemove) + { + if (!contains(player, item, data, toRemove)) + return false; + + for (int i : player.getInventory().all(item).keySet()) + { + if (toRemove <= 0) + continue; + + ItemStack stack = player.getInventory().getItem(i); + + if (stack.getData() == null || stack.getData().getData() == data) + { + int foundAmount = stack.getAmount(); + + if (toRemove >= foundAmount) + { + toRemove -= foundAmount; + player.getInventory().setItem(i, null); + } + + else + { + stack.setAmount(foundAmount - toRemove); + player.getInventory().setItem(i, stack); + toRemove = 0; + } + } + } + + player.updateInventory(); + return true; + } + + public static void Clear(Player player) + { + PlayerInventory inv = player.getInventory(); + + inv.clear(); + inv.clear(inv.getSize() + 0); + inv.clear(inv.getSize() + 1); + inv.clear(inv.getSize() + 2); + inv.clear(inv.getSize() + 3); + + player.saveData(); + } + + public static void drop(Player player, boolean clear) + { + for (ItemStack cur : player.getInventory().getContents()) + { + if (cur == null) + continue; + + if (cur.getType() == Material.AIR) + continue; + + player.getWorld().dropItemNaturally(player.getLocation(), cur); + } + + for (ItemStack cur : player.getInventory().getArmorContents()) + { + if (cur == null) + continue; + + if (cur.getType() == Material.AIR) + continue; + + player.getWorld().dropItemNaturally(player.getLocation(), cur); + } + + if (clear) + Clear(player); + } + + @SuppressWarnings("deprecation") + public static void Update(Entity player) + { + if (!(player instanceof Player)) + return; + + ((Player)player).updateInventory(); + } + + public static int removeAll(Player player, Material type, byte data) + { + HashSet remove = new HashSet(); + int count = 0; + + for (ItemStack item : player.getInventory().getContents()) + if (item != null) + if (item.getType() == type) + if (data == -1 || item.getData() == null || (item.getData() != null && item.getData().getData() == data)) + { + count += item.getAmount(); + remove.add(item); + } + + for (ItemStack item : remove) + player.getInventory().remove(item); + + return count; + } + + public static byte GetData(ItemStack stack) + { + if (stack == null) + return (byte)0; + + if (stack.getData() == null) + return (byte)0; + + return stack.getData().getData(); + } + + public static boolean IsItem(ItemStack item, Material type, byte data) + { + return IsItem(item, type.getId(), data); + } + + public static boolean IsItem(ItemStack item, int id, byte data) + { + if (item == null) + return false; + + if (item.getTypeId() != id) + return false; + + if (data != -1 && GetData(item) != data) + return false; + + return true; + } + + public static void DisallowMovementOf(InventoryClickEvent event, String name, Material type, byte data, boolean inform) + { + /* + System.out.println("Inv Type: " + event.getInventory().getType()); + System.out.println("Click: " + event.getClick()); + System.out.println("Action: " + event.getAction()); + + System.out.println("Slot: " + event.getSlot()); + System.out.println("Slot Raw: " + event.getRawSlot()); + System.out.println("Slot Type: " + event.getSlotType()); + + System.out.println("Cursor: " + event.getCursor()); + System.out.println("Current: " + event.getCurrentItem()); + + System.out.println("View Type: " + event.getView().getType()); + System.out.println("View Top Type: " + event.getView().getTopInventory().getType()); + System.out.println("HotBar Button: " + event.getHotbarButton()); + */ + + //Do what you want in Crafting Inv + if (event.getInventory().getType() == InventoryType.CRAFTING) + return; + + //Hotbar Swap + if (event.getAction() == InventoryAction.HOTBAR_SWAP || + event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD) + { + boolean match = false; + + if (IsItem(event.getCurrentItem(), type, data)) + match = true; + + if (IsItem(event.getWhoClicked().getInventory().getItem(event.getHotbarButton()), type, data)) + match = true; + + if (!match) + return; + + //Inform + UtilPlayer.message(event.getWhoClicked(), F.main("Inventory", "You cannot hotbar swap " + F.item(name) + ".")); + event.setCancelled(true); + } + //Other + else + { + if (event.getCurrentItem() == null) + return; + + IsItem(event.getCurrentItem(), type, data); + + //Type + if (!IsItem(event.getCurrentItem(), type, data)) + return; + //Inform + UtilPlayer.message(event.getWhoClicked(), F.main("Inventory", "You cannot move " + F.item(name) + ".")); + event.setCancelled(true); + } + } + + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilMath.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilMath.java new file mode 100644 index 000000000..34bcd9e04 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilMath.java @@ -0,0 +1,63 @@ +package mineplex.core.common.util; + +import java.text.DecimalFormat; +import java.util.Random; + +import org.bukkit.Location; +import org.bukkit.entity.Entity; +import org.bukkit.util.Vector; + +public class UtilMath +{ + public static double trim(int degree, double d) + { + String format = "#.#"; + + for (int i=1 ; i messageList) + { + message(client, messageList, false); + } + + public static void message(Entity client, String message) + { + message(client, message, false); + } + + public static void message(Entity client, LinkedList messageList, boolean wiki) + { + for (String curMessage : messageList) + { + message(client, curMessage, wiki); + } + } + + public static void message(Entity client, String message, boolean wiki) + { + if (client == null) + return; + + if (!(client instanceof Player)) + return; + + /* + if (wiki) + message = UtilWiki.link(message); + */ + + ((Player)client).sendMessage(message); + } + + public static Player searchExact(String name) + { + for (Player cur : UtilServer.getPlayers()) + if (cur.getName().equalsIgnoreCase(name)) + return cur; + + return null; + } + + public static String searchCollection(Player caller, String player, Collection coll, String collName, boolean inform) + { + LinkedList matchList = new LinkedList(); + + for (String cur : coll) + { + if (cur.equalsIgnoreCase(player)) + return cur; + + if (cur.toLowerCase().contains(player.toLowerCase())) + matchList.add(cur); + } + + //No / Non-Unique + if (matchList.size() != 1) + { + if (!inform) + return null; + + //Inform + message(caller, F.main(collName + " Search", "" + + C.mCount + matchList.size() + + C.mBody + " matches for [" + + C.mElem + player + + C.mBody + "].")); + + if (matchList.size() > 0) + { + String matchString = ""; + for (String cur : matchList) + matchString += cur + " "; + + message(caller, F.main(collName + " Search", "" + + C.mBody + " Matches [" + + C.mElem + matchString + + C.mBody + "].")); + } + + return null; + } + + return matchList.get(0); + } + + public static Player searchOnline(Player caller, String player, boolean inform) + { + LinkedList matchList = new LinkedList(); + + for (Player cur : UtilServer.getPlayers()) + { + if (cur.getName().equalsIgnoreCase(player)) + return cur; + + if (cur.getName().toLowerCase().contains(player.toLowerCase())) + matchList.add(cur); + } + + //No / Non-Unique + if (matchList.size() != 1) + { + if (!inform) + return null; + + //Inform + message(caller, F.main("Online Player Search", "" + + C.mCount + matchList.size() + + C.mBody + " matches for [" + + C.mElem + player + + C.mBody + "].")); + + if (matchList.size() > 0) + { + String matchString = ""; + for (Player cur : matchList) + matchString += F.elem(cur.getName()) + ", "; + if (matchString.length() > 1) + matchString = matchString.substring(0 , matchString.length() - 2); + + message(caller, F.main("Online Player Search", "" + + C.mBody + "Matches [" + + C.mElem + matchString + + C.mBody + "].")); + } + + return null; + } + + return matchList.get(0); + } + + public static void searchOffline(List matches, final Callback callback, final Player caller, final String player, final boolean inform) + { + //No / Non-Unique + if (matches.size() != 1) + { + if (!inform || !caller.isOnline()) + { + callback.run(null); + return; + } + + //Inform + message(caller, F.main("Offline Player Search", "" + + C.mCount + matches.size() + + C.mBody + " matches for [" + + C.mElem + player + + C.mBody + "].")); + + if (matches.size() > 0) + { + String matchString = ""; + for (String cur : matches) + matchString += cur + " "; + if (matchString.length() > 1) + matchString = matchString.substring(0 , matchString.length() - 2); + + message(caller, F.main("Offline Player Search", "" + + C.mBody + "Matches [" + + C.mElem + matchString + + C.mBody + "].")); + } + + callback.run(null); + return; + } + + callback.run(matches.get(0)); + } + + public static LinkedList matchOnline(Player caller, String players, boolean inform) + { + LinkedList matchList = new LinkedList(); + + String failList = ""; + + for (String cur : players.split(",")) + { + Player match = searchOnline(caller, cur, inform); + + if (match != null) + matchList.add(match); + + else + failList += cur + " " ; + } + + if (inform && failList.length() > 0) + { + failList = failList.substring(0, failList.length() - 1); + message(caller, F.main("Online Player(s) Search", "" + + C.mBody + "Invalid [" + + C.mElem + failList + + C.mBody + "].")); + } + + return matchList; + } + + public static LinkedList getNearby(Location loc, double maxDist) + { + LinkedList nearbyMap = new LinkedList(); + + for (Player cur : loc.getWorld().getPlayers()) + { + if (cur.getGameMode() == GameMode.CREATIVE) + continue; + + if (cur.isDead()) + continue; + + double dist = loc.toVector().subtract(cur.getLocation().toVector()).length(); + + if (dist > maxDist) + continue; + + for (int i=0 ; i ignore) + { + Player best = null; + double bestDist = 0; + + for (Player cur : loc.getWorld().getPlayers()) + { + if (cur.getGameMode() == GameMode.CREATIVE) + continue; + + if (cur.isDead()) + continue; + + if (ignore != null && ignore.contains(cur)) + continue; + + double dist = UtilMath.offset(cur.getLocation(), loc); + + if (best == null || dist < bestDist) + { + best = cur; + bestDist = dist; + } + } + + return best; + } + + public static void kick(Player player, String module, String message) + { + kick(player,module,message, true); + } + + public static void kick(Player player, String module, String message, boolean log) + { + if (player == null) + return; + + String out = ChatColor.RED + module + + ChatColor.WHITE + " - " + + ChatColor.YELLOW + message; + player.kickPlayer(out); + + //Log + if (log) + System.out.println("Kicked Client [" + player.getName() + "] for [" + module + " - " + message + "]"); + } + + public static HashMap getInRadius(Location loc, double dR) + { + HashMap players = new HashMap(); + + for (Player cur : loc.getWorld().getPlayers()) + { + if (cur.getGameMode() == GameMode.CREATIVE) + continue; + + double offset = UtilMath.offset(loc, cur.getLocation()); + + if (offset < dR) + players.put(cur, 1 - (offset/dR)); + } + + return players; + } + + public static void health(Player player, int mod) + { + if (player.isDead()) + return; + + double health = player.getHealth() + mod; + + if (health < 0) + health = 0; + + if (health > 20) + health = 20; + + player.setHealth(health); + } + + public static void hunger(Player player, int mod) + { + if (player.isDead()) + return; + + int hunger = player.getFoodLevel() + mod; + + if (hunger < 0) + hunger = 0; + + if (hunger > 20) + hunger = 20; + + player.setFoodLevel(hunger); + } + + public static boolean isOnline(String name) + { + return (searchExact(name) != null); + } + + public static String safeNameLength(String name) + { + if (name.length() > 16) + name = name.substring(0, 16); + + return name; + } + + + /* + public void setListName(Player player, CoreClient client) + { + StringBuilder playerNameBuilder = new StringBuilder(); + + String prefixChar = "*"; + + if (client.NAC().IsUsing()) playerNameBuilder.append(ChatColor.GREEN + prefixChar); + else playerNameBuilder.append(ChatColor.DARK_GRAY + prefixChar); + + if (client.Rank().Has(Rank.OWNER, false)) playerNameBuilder.append(ChatColor.AQUA + prefixChar + ChatColor.RED); + else if (client.Rank().Has(Rank.MODERATOR, false)) playerNameBuilder.append(ChatColor.AQUA + prefixChar + ChatColor.GOLD); + else if (client.Rank().Has(Rank.DIAMOND, false)) playerNameBuilder.append(ChatColor.AQUA + prefixChar + ChatColor.WHITE); + else if (client.Rank().Has(Rank.EMERALD, false)) playerNameBuilder.append(ChatColor.GREEN + prefixChar + ChatColor.WHITE); + else if (client.Donor().HasDonated()) playerNameBuilder.append(ChatColor.YELLOW + prefixChar + ChatColor.WHITE); + else playerNameBuilder.append(ChatColor.DARK_GRAY + prefixChar + ChatColor.WHITE); + + playerNameBuilder.append(player.getName()); + + String playerName = playerNameBuilder.toString(); + + if (playerNameBuilder.length() > 16) + { + playerName = playerNameBuilder.substring(0, 16); + } + + player.setPlayerListName(playerName); + } + */ +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java new file mode 100644 index 000000000..0042f85c2 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java @@ -0,0 +1,51 @@ +package mineplex.core.common.util; + +import org.bukkit.Bukkit; +import org.bukkit.Server; +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +public class UtilServer +{ + public static Player[] getPlayers() + { + return getServer().getOnlinePlayers(); + } + + public static Server getServer() + { + return Bukkit.getServer(); + } + + public static void broadcast(String message) + { + for (Player cur : getPlayers()) + UtilPlayer.message(cur, message); + } + + public static void broadcastSpecial(String event, String message) + { + for (Player cur : getPlayers()) + { + UtilPlayer.message(cur, "§b§l" + event); + UtilPlayer.message(cur, message); + cur.playSound(cur.getLocation(), Sound.ORB_PICKUP, 2f, 0f); + cur.playSound(cur.getLocation(), Sound.ORB_PICKUP, 2f, 0f); + } + } + + public static void broadcast(String sender, String message) + { + broadcast("§f§l" + sender + " " + "§b" + message); + } + + public static void broadcastMagic(String sender, String message) + { + broadcast("§2§k" + message); + } + + public static double getFilledPercent() + { + return (double)getPlayers().length / (double)UtilServer.getServer().getMaxPlayers(); + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilSound.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilSound.java new file mode 100644 index 000000000..bd3ad5c73 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilSound.java @@ -0,0 +1,92 @@ +package mineplex.core.common.util; + +import org.bukkit.Note; + +public class UtilSound +{ + public static float GetPitch(Note note) + { + int o = note.getOctave(); + switch (note.getTone()) { + case F: + if (note.isSharped()) { + switch (o) { + case 0: return 0.5f; + case 1: return 1f; + case 2: return 2f; + } + } else { + switch (o) { + case 0: return 0.943874f; + case 1: return 1.887749f; + } + } + break; + case G: + if (note.isSharped()) { + switch (o) { + case 0: return 0.561231f; + case 1: return 1.122462f; + } + } else { + switch (o) { + case 0: return 0.529732f; + case 1: return 1.059463f; + } + } + break; + case A: + if (note.isSharped()) { + switch (o) { + case 0: return 0.629961f; + case 1: return 1.259921f; + } + } else { + switch (o) { + case 0: return 0.594604f; + case 1: return 1.189207f; + } + } + break; + case B: + switch (o) { + case 0: return 0.667420f; + case 1: return 1.334840f; + } + break; + case C: + if (note.isSharped()) { + switch (o) { + case 0: return 0.749154f; + case 1: return 1.498307f; + } + } else { + switch (o) { + case 0: return 0.707107f; + case 1: return 1.414214f; + } + } + break; + + case D: + if (note.isSharped()) { + switch (o) { + case 0: return 0.840896f; + case 1: return 1.681793f; + } + } else { + switch (o) { + case 0: return 0.793701f; + case 1: return 1.587401f; + } + } + break; + case E: + switch (o) { + case 0: return 0.890899f; + case 1: return 1.781797f; + } + } + return -1f; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilSystem.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilSystem.java new file mode 100644 index 000000000..36141923f --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilSystem.java @@ -0,0 +1,12 @@ +package mineplex.core.common.util; + +public class UtilSystem +{ + public static void PrintStackTrace() + { + for (StackTraceElement trace : Thread.currentThread().getStackTrace()) + { + System.out.println(trace.toString()); + } + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java new file mode 100644 index 000000000..b30163dc6 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java @@ -0,0 +1,416 @@ +package mineplex.core.common.util; + +import java.util.HashMap; + +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; + +public class UtilText +{ + public enum TextAlign + { + LEFT, + RIGHT, + CENTER + } + + public static HashMap alphabet = new HashMap(); + + public static void MakeText(String string, Location loc, BlockFace face, int id, byte data, TextAlign align) + { + if (alphabet.isEmpty()) + PopulateAlphabet(); + + Block block = loc.getBlock(); + + //Get Width + int width = 0; + for (char c : string.toLowerCase().toCharArray()) + { + int[][] letter = alphabet.get(c); + + if (letter == null) + continue; + + width += letter[0].length+1; + } + + //Shift Blocks + if (align == TextAlign.CENTER || align == TextAlign.RIGHT) + { + int divisor = 1; + if (align == TextAlign.CENTER) + divisor = 2; + + block = block.getRelative(face, (-1 * width/divisor) + 1); + } + + //Clean + Block other = loc.getBlock(); + for (int y=0 ; y<5 ; y++) + { + if (align == TextAlign.CENTER) + for (int i=-48 ; i<=48 ; i++) + if (other.getRelative(face, i).getTypeId() != 0) + MapUtil.QuickChangeBlockAt(other.getRelative(face, i).getLocation(), 0, (byte)0); + + if (align == TextAlign.LEFT) + for (int i=0 ; i<=96 ; i++) + if (other.getRelative(face, i).getTypeId() != 0) + MapUtil.QuickChangeBlockAt(other.getRelative(face, i).getLocation(), 0, (byte)0); + + if (align == TextAlign.RIGHT) + for (int i=-96 ; i<=0 ; i++) + if (other.getRelative(face, i).getTypeId() != 0) + MapUtil.QuickChangeBlockAt(other.getRelative(face, i).getLocation(), 0, (byte)0); + + other = other.getRelative(BlockFace.DOWN); + } + + //Make Blocks + for (char c : string.toLowerCase().toCharArray()) + { + int[][] letter = alphabet.get(c); + + if (letter == null) + continue; + + for (int x=0 ; x required; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilWorld.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilWorld.java new file mode 100644 index 000000000..717534c66 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilWorld.java @@ -0,0 +1,114 @@ +package mineplex.core.common.util; + + +import org.bukkit.Chunk; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.World.Environment; + +public class UtilWorld +{ + public static World getWorld(String world) + { + return UtilServer.getServer().getWorld(world); + } + + public static String chunkToStr(Chunk chunk) + { + if (chunk == null) + return ""; + + return chunk.getWorld().getName() + "," + chunk.getX() + "," + chunk.getZ(); + } + + public static String chunkToStrClean(Chunk chunk) + { + if (chunk == null) + return ""; + + return "(" + chunk.getX() + "," + chunk.getZ() + ")"; + } + + public static Chunk strToChunk(String string) + { + try + { + String[] tokens = string.split(","); + + return getWorld(tokens[0]).getChunkAt(Integer.parseInt(tokens[1]), Integer.parseInt(tokens[2])); + } + catch (Exception e) + { + return null; + } + } + + public static String locToStr(Location loc) + { + if (loc == null) + return ""; + + return loc.getWorld().getName() + "," + + UtilMath.trim(1, loc.getX()) + "," + + UtilMath.trim(1, loc.getY()) + "," + + UtilMath.trim(1, loc.getZ()); + } + + public static String locToStrClean(Location loc) + { + if (loc == null) + return "Null"; + + return "(" + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ() + ")"; + } + + public static Location strToLoc(String string) + { + if (string.length() == 0) + return null; + + String[] tokens = string.split(","); + + try + { + for (World cur : UtilServer.getServer().getWorlds()) + { + if (cur.getName().equalsIgnoreCase(tokens[0])) + { + return new Location(cur, Double.parseDouble(tokens[1]), Double.parseDouble(tokens[2]), Double.parseDouble(tokens[3])); + } + } + } + catch (Exception e) + { + return null; + } + + return null; + } + + public static Location locMerge(Location a, Location b) + { + a.setX(b.getX()); + a.setY(b.getY()); + a.setZ(b.getZ()); + return a; + } + + public static String envToStr(Environment env) + { + if (env == Environment.NORMAL) return "Overworld"; + if (env == Environment.NETHER) return "Nether"; + if (env == Environment.THE_END) return "The End"; + return "Unknown"; + } + + public static World getWorldType(Environment env) + { + for (World cur : UtilServer.getServer().getWorlds()) + if (cur.getEnvironment() == env) + return cur; + + return null; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/WorldChunkLoader.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/WorldChunkLoader.java new file mode 100644 index 000000000..e10bb097d --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/WorldChunkLoader.java @@ -0,0 +1,63 @@ +package mineplex.core.common.util; + +import java.util.Iterator; + + +import org.bukkit.Bukkit; + +public class WorldChunkLoader implements Runnable +{ + private static WorldChunkLoader _worldChunkLoader = null; + + private NautHashMap _worldRunnableMap = new NautHashMap(); + + private long _loadPassStart; + private long _maxPassTime = 25; + + private WorldChunkLoader() + { + Bukkit.getScheduler().scheduleSyncRepeatingTask(Bukkit.getPluginManager().getPlugins()[0], this, 0, 1L); + } + + public static void AddWorld(WorldLoadInfo worldInfo, Runnable runnable) + { + if (_worldChunkLoader == null) + { + _worldChunkLoader = new WorldChunkLoader(); + } + + _worldChunkLoader._worldRunnableMap.put(worldInfo, runnable); + } + + @Override + public void run() + { + _loadPassStart = System.currentTimeMillis(); + + Iterator worldInfoIterator = _worldRunnableMap.keySet().iterator(); + + while (worldInfoIterator.hasNext()) + { + WorldLoadInfo worldInfo = worldInfoIterator.next(); + System.out.println("Loading chunks for " + worldInfo.GetWorld().getName()); + + while (worldInfo.CurrentChunkX <= worldInfo.GetMaxChunkX()) + { + while (worldInfo.CurrentChunkZ <= worldInfo.GetMaxChunkZ()) + { + if (System.currentTimeMillis() - _loadPassStart >= _maxPassTime) + return; + + worldInfo.GetWorld().loadChunk(worldInfo.CurrentChunkX, worldInfo.CurrentChunkZ); + worldInfo.CurrentChunkZ++; + } + + worldInfo.CurrentChunkZ = worldInfo.GetMinChunkZ(); + worldInfo.CurrentChunkX++; + } + + _worldRunnableMap.get(worldInfo).run(); + worldInfoIterator.remove(); + } + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/WorldLoadInfo.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/WorldLoadInfo.java new file mode 100644 index 000000000..0cf9d88df --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/WorldLoadInfo.java @@ -0,0 +1,52 @@ +package mineplex.core.common.util; + +import org.bukkit.World; + +public class WorldLoadInfo +{ + private World _world; + private int _minChunkX; + private int _minChunkZ; + private int _maxChunkX; + private int _maxChunkZ; + + public int CurrentChunkX; + public int CurrentChunkZ; + + public WorldLoadInfo(World world, int minChunkX, int minChunkZ, int maxChunkX, int maxChunkZ) + { + _world = world; + _minChunkX = minChunkX; + _minChunkZ = minChunkZ; + _maxChunkX = maxChunkX; + _maxChunkZ = maxChunkZ; + + CurrentChunkX = minChunkX; + CurrentChunkZ = minChunkZ; + } + + public World GetWorld() + { + return _world; + } + + public int GetMinChunkX() + { + return _minChunkX; + } + + public int GetMinChunkZ() + { + return _minChunkZ; + } + + public int GetMaxChunkX() + { + return _maxChunkX; + } + + public int GetMaxChunkZ() + { + return _maxChunkZ; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/WorldUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/WorldUtil.java new file mode 100644 index 000000000..32e96c439 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/WorldUtil.java @@ -0,0 +1,113 @@ +package mineplex.core.common.util; + +import java.io.File; + +import net.minecraft.server.v1_6_R2.ConvertProgressUpdater; +import net.minecraft.server.v1_6_R2.Convertable; +import net.minecraft.server.v1_6_R2.EntityTracker; +import net.minecraft.server.v1_6_R2.EnumGamemode; +import net.minecraft.server.v1_6_R2.IWorldAccess; +import net.minecraft.server.v1_6_R2.ServerNBTManager; +import net.minecraft.server.v1_6_R2.WorldLoaderServer; +import net.minecraft.server.v1_6_R2.WorldManager; +import net.minecraft.server.v1_6_R2.WorldServer; +import net.minecraft.server.v1_6_R2.WorldSettings; +import net.minecraft.server.v1_6_R2.WorldType; + +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.WorldCreator; +import org.bukkit.craftbukkit.v1_6_R2.CraftServer; +import org.bukkit.event.world.WorldInitEvent; +import org.bukkit.event.world.WorldLoadEvent; +import org.bukkit.generator.ChunkGenerator; + +public class WorldUtil +{ + public static World LoadWorld(WorldCreator creator) + { + CraftServer server = (CraftServer)Bukkit.getServer(); + if (creator == null) + { + throw new IllegalArgumentException("Creator may not be null"); + } + + String name = creator.name(); + System.out.println("Loading world '" + name + "'"); + ChunkGenerator generator = creator.generator(); + File folder = new File(server.getWorldContainer(), name); + World world = server.getWorld(name); + WorldType type = WorldType.getType(creator.type().getName()); + boolean generateStructures = creator.generateStructures(); + + if (world != null) + { + return world; + } + + if ((folder.exists()) && (!folder.isDirectory())) + { + throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder"); + } + + if (generator == null) + { + generator = server.getGenerator(name); + } + + Convertable converter = new WorldLoaderServer(server.getWorldContainer()); + if (converter.isConvertable(name)) + { + server.getLogger().info("Converting world '" + name + "'"); + converter.convert(name, new ConvertProgressUpdater(server.getServer())); + } + + int dimension = 10 + server.getServer().worlds.size(); + boolean used = false; + do + { + for (WorldServer worldServer : server.getServer().worlds) + { + used = worldServer.dimension == dimension; + if (used) + { + dimension++; + break; + } + } + } while(used); + boolean hardcore = false; + + WorldServer internal = new WorldServer(server.getServer(), new ServerNBTManager(server.getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGamemode.a(server.getDefaultGameMode().getValue()), generateStructures, hardcore, type), server.getServer().methodProfiler, server.getServer().getLogger(), creator.environment(), generator); + + boolean containsWorld = false; + for (World otherWorld : server.getWorlds()) + { + if (otherWorld.getName().equalsIgnoreCase(name.toLowerCase())) + { + containsWorld = true; + break; + } + } + + if (!containsWorld) + return null; + + internal.worldMaps = server.getServer().worlds.get(0).worldMaps; + internal.tracker = new EntityTracker(internal); // CraftBukkit + internal.addIWorldAccess((IWorldAccess) new WorldManager(server.getServer(), internal)); + internal.difficulty = 1; + internal.setSpawnFlags(true, true); + server.getServer().worlds.add(internal); + + if (generator != null) + { + internal.getWorld().getPopulators().addAll(generator.getDefaultPopulators(internal.getWorld())); + } + + server.getPluginManager().callEvent(new WorldInitEvent(internal.getWorld())); + server.getPluginManager().callEvent(new WorldLoadEvent(internal.getWorld())); + + return internal.getWorld(); + } +} diff --git a/Plugins/Mineplex.Core/.classpath b/Plugins/Mineplex.Core/.classpath new file mode 100644 index 000000000..e80dd773c --- /dev/null +++ b/Plugins/Mineplex.Core/.classpath @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/Plugins/Mineplex.Core/.project b/Plugins/Mineplex.Core/.project new file mode 100644 index 000000000..330f3ea33 --- /dev/null +++ b/Plugins/Mineplex.Core/.project @@ -0,0 +1,17 @@ + + + Mineplex.Core + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Mineplex.Core/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.Core/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7341ab168 --- /dev/null +++ b/Plugins/Mineplex.Core/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/MiniClientPlugin.class b/Plugins/Mineplex.Core/bin/mineplex/core/MiniClientPlugin.class new file mode 100644 index 000000000..338518d94 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/MiniClientPlugin.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/MiniPlugin.class b/Plugins/Mineplex.Core/bin/mineplex/core/MiniPlugin.class new file mode 100644 index 000000000..b136aecc8 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/MiniPlugin.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/account/CoreClient.class b/Plugins/Mineplex.Core/bin/mineplex/core/account/CoreClient.class new file mode 100644 index 000000000..6e694b579 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/account/CoreClient.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/account/CoreClientManager$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/account/CoreClientManager$1.class new file mode 100644 index 000000000..93817ccbf Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/account/CoreClientManager$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/account/CoreClientManager.class b/Plugins/Mineplex.Core/bin/mineplex/core/account/CoreClientManager.class new file mode 100644 index 000000000..e7189b2de Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/account/CoreClientManager.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/account/event/AsyncClientLoadEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/account/event/AsyncClientLoadEvent.class new file mode 100644 index 000000000..cf2c18d31 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/account/event/AsyncClientLoadEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/account/event/ClientUnloadEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/account/event/ClientUnloadEvent.class new file mode 100644 index 000000000..9fcfefd89 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/account/event/ClientUnloadEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/account/event/ClientWebRequestEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/account/event/ClientWebRequestEvent.class new file mode 100644 index 000000000..e45281c4b Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/account/event/ClientWebRequestEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/account/event/ClientWebResponseEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/account/event/ClientWebResponseEvent.class new file mode 100644 index 000000000..0a70328ae Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/account/event/ClientWebResponseEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/account/event/GetClientEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/account/event/GetClientEvent.class new file mode 100644 index 000000000..84e3bdacd Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/account/event/GetClientEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/AccountRepository.class b/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/AccountRepository.class new file mode 100644 index 000000000..847de0eb0 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/AccountRepository.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/token/AccountToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/token/AccountToken.class new file mode 100644 index 000000000..73df4dcc9 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/token/AccountToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/token/ClientToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/token/ClientToken.class new file mode 100644 index 000000000..cedfcc718 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/token/ClientToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/token/LoginToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/token/LoginToken.class new file mode 100644 index 000000000..3c0a3b4d1 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/token/LoginToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/token/Rank.class b/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/token/Rank.class new file mode 100644 index 000000000..875b68e63 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/token/Rank.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/token/RankUpdateToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/token/RankUpdateToken.class new file mode 100644 index 000000000..df8d3a917 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/account/repository/token/RankUpdateToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/antistack/AntiStack.class b/Plugins/Mineplex.Core/bin/mineplex/core/antistack/AntiStack.class new file mode 100644 index 000000000..0f7591b91 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/antistack/AntiStack.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/arena/Region.class b/Plugins/Mineplex.Core/bin/mineplex/core/arena/Region.class new file mode 100644 index 000000000..c229a3c15 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/arena/Region.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/blockrestore/BlockRestore.class b/Plugins/Mineplex.Core/bin/mineplex/core/blockrestore/BlockRestore.class new file mode 100644 index 000000000..0b20aafe2 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/blockrestore/BlockRestore.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/blockrestore/BlockRestoreData.class b/Plugins/Mineplex.Core/bin/mineplex/core/blockrestore/BlockRestoreData.class new file mode 100644 index 000000000..bde18e726 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/blockrestore/BlockRestoreData.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/command/CommandBase.class b/Plugins/Mineplex.Core/bin/mineplex/core/command/CommandBase.class new file mode 100644 index 000000000..0a62a8687 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/command/CommandBase.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/command/CommandCenter.class b/Plugins/Mineplex.Core/bin/mineplex/core/command/CommandCenter.class new file mode 100644 index 000000000..705f5a7e5 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/command/CommandCenter.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/command/ICommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/command/ICommand.class new file mode 100644 index 000000000..6866de928 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/command/ICommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/command/MultiCommandBase.class b/Plugins/Mineplex.Core/bin/mineplex/core/command/MultiCommandBase.class new file mode 100644 index 000000000..cebe302d1 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/command/MultiCommandBase.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/creature/Creature.class b/Plugins/Mineplex.Core/bin/mineplex/core/creature/Creature.class new file mode 100644 index 000000000..11ce2cd70 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/creature/Creature.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/creature/command/HelpCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/creature/command/HelpCommand.class new file mode 100644 index 000000000..66b107305 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/creature/command/HelpCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/creature/command/KillCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/creature/command/KillCommand.class new file mode 100644 index 000000000..b05e11f3a Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/creature/command/KillCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/creature/command/MobCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/creature/command/MobCommand.class new file mode 100644 index 000000000..e6780bdd8 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/creature/command/MobCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/creature/event/CreatureKillEntitiesEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/creature/event/CreatureKillEntitiesEvent.class new file mode 100644 index 000000000..d84b43505 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/creature/event/CreatureKillEntitiesEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/creature/event/CreatureSpawnCustomEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/creature/event/CreatureSpawnCustomEvent.class new file mode 100644 index 000000000..1f7916cb7 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/creature/event/CreatureSpawnCustomEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/DisguiseFactory.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/DisguiseFactory.class new file mode 100644 index 000000000..3b761e47f Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/DisguiseFactory.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/DisguiseManager$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/DisguiseManager$1.class new file mode 100644 index 000000000..7f671bad1 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/DisguiseManager$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/DisguiseManager.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/DisguiseManager.class new file mode 100644 index 000000000..87b7c0415 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/DisguiseManager.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/DisguisePacketTracker.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/DisguisePacketTracker.class new file mode 100644 index 000000000..199853ed3 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/DisguisePacketTracker.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/DisguiseType.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/DisguiseType.class new file mode 100644 index 000000000..9ad3c3ba4 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/DisguiseType.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseAgeable.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseAgeable.class new file mode 100644 index 000000000..c77a5a646 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseAgeable.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseAmbient.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseAmbient.class new file mode 100644 index 000000000..15b4f2d3e Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseAmbient.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseAnimal.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseAnimal.class new file mode 100644 index 000000000..4dfded6b3 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseAnimal.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseBase.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseBase.class new file mode 100644 index 000000000..91f4a6585 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseBase.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseBat.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseBat.class new file mode 100644 index 000000000..0105dff83 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseBat.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseBlaze.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseBlaze.class new file mode 100644 index 000000000..7b38e73ae Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseBlaze.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseChicken.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseChicken.class new file mode 100644 index 000000000..471369111 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseChicken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseCreature.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseCreature.class new file mode 100644 index 000000000..644e76504 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseCreature.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseCreeper.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseCreeper.class new file mode 100644 index 000000000..138027742 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseCreeper.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseEnderman.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseEnderman.class new file mode 100644 index 000000000..a5ccd1e08 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseEnderman.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseGolem.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseGolem.class new file mode 100644 index 000000000..dd48fa264 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseGolem.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseHuman.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseHuman.class new file mode 100644 index 000000000..1d9859ab7 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseHuman.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseInsentient.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseInsentient.class new file mode 100644 index 000000000..00d134d8f Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseInsentient.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseIronGolem.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseIronGolem.class new file mode 100644 index 000000000..9cdb8bd9c Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseIronGolem.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseLiving.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseLiving.class new file mode 100644 index 000000000..946ea927f Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseLiving.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseMonster.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseMonster.class new file mode 100644 index 000000000..dc2f4f2ef Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseMonster.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguisePigZombie.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguisePigZombie.class new file mode 100644 index 000000000..a2f27f323 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguisePigZombie.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguisePlayer.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguisePlayer.class new file mode 100644 index 000000000..faac1054e Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguisePlayer.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseSkeleton.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseSkeleton.class new file mode 100644 index 000000000..ec90c2681 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseSkeleton.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseSlime.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseSlime.class new file mode 100644 index 000000000..285f9bfb4 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseSlime.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseSnowman.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseSnowman.class new file mode 100644 index 000000000..58ee896d6 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseSnowman.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseSpider.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseSpider.class new file mode 100644 index 000000000..3a3b384be Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseSpider.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseZombie.class b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseZombie.class new file mode 100644 index 000000000..f49745a3c Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/disguise/disguises/DisguiseZombie.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/donation/DonationManager$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/donation/DonationManager$1.class new file mode 100644 index 000000000..004bd7f25 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/donation/DonationManager$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/donation/DonationManager$2.class b/Plugins/Mineplex.Core/bin/mineplex/core/donation/DonationManager$2.class new file mode 100644 index 000000000..2cc747e63 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/donation/DonationManager$2.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/donation/DonationManager$3.class b/Plugins/Mineplex.Core/bin/mineplex/core/donation/DonationManager$3.class new file mode 100644 index 000000000..89f70ec0f Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/donation/DonationManager$3.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/donation/DonationManager.class b/Plugins/Mineplex.Core/bin/mineplex/core/donation/DonationManager.class new file mode 100644 index 000000000..2f3f0a34c Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/donation/DonationManager.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/donation/Donor.class b/Plugins/Mineplex.Core/bin/mineplex/core/donation/Donor.class new file mode 100644 index 000000000..7ce3d5e48 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/donation/Donor.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/DonationRepository.class b/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/DonationRepository.class new file mode 100644 index 000000000..9bdbe78dd Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/DonationRepository.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/GameSalesPackageToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/GameSalesPackageToken.class new file mode 100644 index 000000000..c82fdc3c4 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/GameSalesPackageToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/token/DonorToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/token/DonorToken.class new file mode 100644 index 000000000..54bd9350e Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/token/DonorToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/token/DonorTokenWrapper.class b/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/token/DonorTokenWrapper.class new file mode 100644 index 000000000..190ffc835 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/token/DonorTokenWrapper.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/token/PlayerUpdateToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/token/PlayerUpdateToken.class new file mode 100644 index 000000000..f8e66aa02 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/token/PlayerUpdateToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/token/PurchaseToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/token/PurchaseToken.class new file mode 100644 index 000000000..b3bebdeeb Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/token/PurchaseToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/token/UnknownPurchaseToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/token/UnknownPurchaseToken.class new file mode 100644 index 000000000..55afc5142 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/donation/repository/token/UnknownPurchaseToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/energy/ClientEnergy.class b/Plugins/Mineplex.Core/bin/mineplex/core/energy/ClientEnergy.class new file mode 100644 index 000000000..8ebbfe0f0 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/energy/ClientEnergy.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/energy/Energy.class b/Plugins/Mineplex.Core/bin/mineplex/core/energy/Energy.class new file mode 100644 index 000000000..3af4e00f6 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/energy/Energy.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/energy/event/EnergyEvent$EnergyChangeReason.class b/Plugins/Mineplex.Core/bin/mineplex/core/energy/event/EnergyEvent$EnergyChangeReason.class new file mode 100644 index 000000000..21b205358 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/energy/event/EnergyEvent$EnergyChangeReason.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/energy/event/EnergyEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/energy/event/EnergyEvent.class new file mode 100644 index 000000000..e85038243 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/energy/event/EnergyEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/enjin/Enjin.class b/Plugins/Mineplex.Core/bin/mineplex/core/enjin/Enjin.class new file mode 100644 index 000000000..ea9328480 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/enjin/Enjin.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/explosion/Explosion$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/explosion/Explosion$1.class new file mode 100644 index 000000000..3c30a1f25 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/explosion/Explosion$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/explosion/Explosion.class b/Plugins/Mineplex.Core/bin/mineplex/core/explosion/Explosion.class new file mode 100644 index 000000000..43eff9a93 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/explosion/Explosion.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/explosion/ExplosionEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/explosion/ExplosionEvent.class new file mode 100644 index 000000000..77366507d Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/explosion/ExplosionEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/fakeEntity/FakeEntity.class b/Plugins/Mineplex.Core/bin/mineplex/core/fakeEntity/FakeEntity.class new file mode 100644 index 000000000..c4543a3a0 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/fakeEntity/FakeEntity.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/fakeEntity/FakeEntityManager.class b/Plugins/Mineplex.Core/bin/mineplex/core/fakeEntity/FakeEntityManager.class new file mode 100644 index 000000000..2de1bc66f Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/fakeEntity/FakeEntityManager.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/fakeEntity/FakeFallingBlock.class b/Plugins/Mineplex.Core/bin/mineplex/core/fakeEntity/FakeFallingBlock.class new file mode 100644 index 000000000..46a4fbfad Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/fakeEntity/FakeFallingBlock.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/fakeEntity/FakeItemDrop.class b/Plugins/Mineplex.Core/bin/mineplex/core/fakeEntity/FakeItemDrop.class new file mode 100644 index 000000000..165268a43 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/fakeEntity/FakeItemDrop.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/fakeEntity/FakePlayer.class b/Plugins/Mineplex.Core/bin/mineplex/core/fakeEntity/FakePlayer.class new file mode 100644 index 000000000..490d21695 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/fakeEntity/FakePlayer.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/itemstack/ItemStackFactory$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/itemstack/ItemStackFactory$1.class new file mode 100644 index 000000000..6dfa57bab Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/itemstack/ItemStackFactory$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/itemstack/ItemStackFactory.class b/Plugins/Mineplex.Core/bin/mineplex/core/itemstack/ItemStackFactory.class new file mode 100644 index 000000000..d4fc1f9e2 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/itemstack/ItemStackFactory.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/message/ClientMessage.class b/Plugins/Mineplex.Core/bin/mineplex/core/message/ClientMessage.class new file mode 100644 index 000000000..39294c404 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/message/ClientMessage.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/message/Commands/AdminCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/message/Commands/AdminCommand.class new file mode 100644 index 000000000..6e2820ef3 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/message/Commands/AdminCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/message/Commands/MessageAdminCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/message/Commands/MessageAdminCommand.class new file mode 100644 index 000000000..729f596ee Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/message/Commands/MessageAdminCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/message/Commands/MessageCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/message/Commands/MessageCommand.class new file mode 100644 index 000000000..178ab4574 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/message/Commands/MessageCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/message/Commands/ResendAdminCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/message/Commands/ResendAdminCommand.class new file mode 100644 index 000000000..abffa5e3d Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/message/Commands/ResendAdminCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/message/Commands/ResendCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/message/Commands/ResendCommand.class new file mode 100644 index 000000000..3af7a1cc8 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/message/Commands/ResendCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/message/MessageManager.class b/Plugins/Mineplex.Core/bin/mineplex/core/message/MessageManager.class new file mode 100644 index 000000000..fb773ee39 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/message/MessageManager.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/movement/ClientMovement.class b/Plugins/Mineplex.Core/bin/mineplex/core/movement/ClientMovement.class new file mode 100644 index 000000000..28455ca52 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/movement/ClientMovement.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/movement/Movement.class b/Plugins/Mineplex.Core/bin/mineplex/core/movement/Movement.class new file mode 100644 index 000000000..edfcefae3 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/movement/Movement.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/AddCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/AddCommand.class new file mode 100644 index 000000000..2864e6f0a Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/AddCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/ClearCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/ClearCommand.class new file mode 100644 index 000000000..07a831637 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/ClearCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/DeleteCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/DeleteCommand.class new file mode 100644 index 000000000..cab4c943f Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/DeleteCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/HomeCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/HomeCommand.class new file mode 100644 index 000000000..877059e77 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/HomeCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/NpcCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/NpcCommand.class new file mode 100644 index 000000000..fe5fba036 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/NpcCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/ReattachCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/ReattachCommand.class new file mode 100644 index 000000000..109e7c116 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/npc/Commands/ReattachCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/npc/NpcEntry.class b/Plugins/Mineplex.Core/bin/mineplex/core/npc/NpcEntry.class new file mode 100644 index 000000000..0a97e024e Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/npc/NpcEntry.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/npc/NpcManager$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/npc/NpcManager$1.class new file mode 100644 index 000000000..403199e36 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/npc/NpcManager$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/npc/NpcManager$2.class b/Plugins/Mineplex.Core/bin/mineplex/core/npc/NpcManager$2.class new file mode 100644 index 000000000..5ae43e2ce Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/npc/NpcManager$2.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/npc/NpcManager.class b/Plugins/Mineplex.Core/bin/mineplex/core/npc/NpcManager.class new file mode 100644 index 000000000..d35ea81e8 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/npc/NpcManager.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/packethandler/IPacketRunnable.class b/Plugins/Mineplex.Core/bin/mineplex/core/packethandler/IPacketRunnable.class new file mode 100644 index 000000000..2a900fa44 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/packethandler/IPacketRunnable.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/packethandler/PacketArrayList.class b/Plugins/Mineplex.Core/bin/mineplex/core/packethandler/PacketArrayList.class new file mode 100644 index 000000000..f03475dc8 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/packethandler/PacketArrayList.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/packethandler/PacketHandler.class b/Plugins/Mineplex.Core/bin/mineplex/core/packethandler/PacketHandler.class new file mode 100644 index 000000000..0846e2d41 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/packethandler/PacketHandler.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/Pet.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/Pet.class new file mode 100644 index 000000000..4c584c689 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/Pet.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetClient.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetClient.class new file mode 100644 index 000000000..924250e27 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetClient.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetExtra.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetExtra.class new file mode 100644 index 000000000..32dc1d7ab Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetExtra.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetFactory.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetFactory.class new file mode 100644 index 000000000..973771bcd Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetFactory.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetManager$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetManager$1.class new file mode 100644 index 000000000..9e421316b Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetManager$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetManager.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetManager.class new file mode 100644 index 000000000..9bf5abe0d Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetManager.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetShop.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetShop.class new file mode 100644 index 000000000..6d42e4d77 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/PetShop.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/event/PetSpawnEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/event/PetSpawnEvent.class new file mode 100644 index 000000000..e044b1348 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/event/PetSpawnEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/PetRepository$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/PetRepository$1.class new file mode 100644 index 000000000..9fa6cb3cb Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/PetRepository$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/PetRepository$2.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/PetRepository$2.class new file mode 100644 index 000000000..c311ad2cf Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/PetRepository$2.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/PetRepository.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/PetRepository.class new file mode 100644 index 000000000..94a517316 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/PetRepository.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/ClientPetToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/ClientPetToken.class new file mode 100644 index 000000000..7d6bc3172 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/ClientPetToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/ClientPetTokenWrapper.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/ClientPetTokenWrapper.class new file mode 100644 index 000000000..c8dc01371 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/ClientPetTokenWrapper.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/PetChangeToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/PetChangeToken.class new file mode 100644 index 000000000..d348cd7c0 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/PetChangeToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/PetExtraToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/PetExtraToken.class new file mode 100644 index 000000000..83ad8c747 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/PetExtraToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/PetSalesToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/PetSalesToken.class new file mode 100644 index 000000000..982195561 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/PetSalesToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/PetToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/PetToken.class new file mode 100644 index 000000000..94bffad7d Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/repository/token/PetToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/CloseButton.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/CloseButton.class new file mode 100644 index 000000000..324025cee Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/CloseButton.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetButton.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetButton.class new file mode 100644 index 000000000..7d29ce0f6 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetButton.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetExtraButton.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetExtraButton.class new file mode 100644 index 000000000..6dcc84694 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetExtraButton.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetPage$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetPage$1.class new file mode 100644 index 000000000..ecbc3f870 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetPage$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetPage$2.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetPage$2.class new file mode 100644 index 000000000..6d22de769 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetPage$2.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetPage.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetPage.class new file mode 100644 index 000000000..c2ca84290 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetPage.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetTagPage.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetTagPage.class new file mode 100644 index 000000000..5df58cb7e Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/PetTagPage.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/SelectTagButton.class b/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/SelectTagButton.class new file mode 100644 index 000000000..16ee19575 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/pet/ui/SelectTagButton.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/portal/Portal$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/portal/Portal$1.class new file mode 100644 index 000000000..ac1842556 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/portal/Portal$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/portal/Portal.class b/Plugins/Mineplex.Core/bin/mineplex/core/portal/Portal.class new file mode 100644 index 000000000..8914a0dfe Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/portal/Portal.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/portal/commands/CreateCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/portal/commands/CreateCommand.class new file mode 100644 index 000000000..4670cb73d Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/portal/commands/CreateCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/portal/commands/PortalCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/portal/commands/PortalCommand.class new file mode 100644 index 000000000..f59de2b02 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/portal/commands/PortalCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/portal/commands/ToggleCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/portal/commands/ToggleCommand.class new file mode 100644 index 000000000..02c6cb18c Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/portal/commands/ToggleCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/projectile/IThrown.class b/Plugins/Mineplex.Core/bin/mineplex/core/projectile/IThrown.class new file mode 100644 index 000000000..a03278705 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/projectile/IThrown.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/projectile/ProjectileManager.class b/Plugins/Mineplex.Core/bin/mineplex/core/projectile/ProjectileManager.class new file mode 100644 index 000000000..c0640ff08 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/projectile/ProjectileManager.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/projectile/ProjectileUser.class b/Plugins/Mineplex.Core/bin/mineplex/core/projectile/ProjectileUser.class new file mode 100644 index 000000000..8861c47e2 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/projectile/ProjectileUser.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/Category.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Category.class new file mode 100644 index 000000000..5edef76e8 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Category.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/Command/PunishCommand$1$1$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Command/PunishCommand$1$1$1.class new file mode 100644 index 000000000..814d648d5 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Command/PunishCommand$1$1$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/Command/PunishCommand$1$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Command/PunishCommand$1$1.class new file mode 100644 index 000000000..6531dbc1d Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Command/PunishCommand$1$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/Command/PunishCommand$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Command/PunishCommand$1.class new file mode 100644 index 000000000..033d18dd0 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Command/PunishCommand$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/Command/PunishCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Command/PunishCommand.class new file mode 100644 index 000000000..6e5d29765 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Command/PunishCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/Punish$1$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Punish$1$1.class new file mode 100644 index 000000000..a6c13064d Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Punish$1$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/Punish$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Punish$1.class new file mode 100644 index 000000000..f9d8ebbc2 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Punish$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/Punish.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Punish.class new file mode 100644 index 000000000..648c0a137 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Punish.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishChatEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishChatEvent.class new file mode 100644 index 000000000..fea75abe2 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishChatEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishClient.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishClient.class new file mode 100644 index 000000000..09b293cff Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishClient.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishRepository$1$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishRepository$1$1.class new file mode 100644 index 000000000..645b5a325 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishRepository$1$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishRepository$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishRepository$1.class new file mode 100644 index 000000000..4edaa171b Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishRepository$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishRepository.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishRepository.class new file mode 100644 index 000000000..af6800d98 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishRepository.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishTrackUtil.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishTrackUtil.class new file mode 100644 index 000000000..57a187f3f Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishTrackUtil.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/Punishment.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Punishment.class new file mode 100644 index 000000000..6e5f2538c Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Punishment.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishmentResponse.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishmentResponse.class new file mode 100644 index 000000000..8caade08f Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishmentResponse.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishmentSentence.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishmentSentence.class new file mode 100644 index 000000000..e7228238b Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishmentSentence.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishmentSorter.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishmentSorter.class new file mode 100644 index 000000000..8fcf9f7a5 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/PunishmentSorter.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/Tokens/InfractionToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Tokens/InfractionToken.class new file mode 100644 index 000000000..2d516fd4b Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Tokens/InfractionToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/Tokens/PunishClientToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Tokens/PunishClientToken.class new file mode 100644 index 000000000..c115bee0b Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Tokens/PunishClientToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/Tokens/PunishToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Tokens/PunishToken.class new file mode 100644 index 000000000..a5fd66c71 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Tokens/PunishToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/Tokens/PunishmentToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Tokens/PunishmentToken.class new file mode 100644 index 000000000..aef7690ef Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Tokens/PunishmentToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/Tokens/RemovePunishToken.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Tokens/RemovePunishToken.class new file mode 100644 index 000000000..26394e3cf Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/Tokens/RemovePunishToken.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/UI/PunishButton.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/UI/PunishButton.class new file mode 100644 index 000000000..ed6747d10 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/UI/PunishButton.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/UI/PunishPage$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/UI/PunishPage$1.class new file mode 100644 index 000000000..1ccee96c2 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/UI/PunishPage$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/UI/PunishPage.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/UI/PunishPage.class new file mode 100644 index 000000000..695160c45 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/UI/PunishPage.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/punish/UI/RemovePunishmentButton.class b/Plugins/Mineplex.Core/bin/mineplex/core/punish/UI/RemovePunishmentButton.class new file mode 100644 index 000000000..b3e1cd30b Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/punish/UI/RemovePunishmentButton.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/recharge/Recharge.class b/Plugins/Mineplex.Core/bin/mineplex/core/recharge/Recharge.class new file mode 100644 index 000000000..2fe90dd24 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/recharge/Recharge.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/recharge/RechargeEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/recharge/RechargeEvent.class new file mode 100644 index 000000000..bce6acf7d Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/recharge/RechargeEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/scoreboard/EasyScoreboard.class b/Plugins/Mineplex.Core/bin/mineplex/core/scoreboard/EasyScoreboard.class new file mode 100644 index 000000000..7614ea50c Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/scoreboard/EasyScoreboard.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/IPurchaseRepository.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/IPurchaseRepository.class new file mode 100644 index 000000000..a1369bdae Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/IPurchaseRepository.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/Server.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/Server.class new file mode 100644 index 000000000..8474bc6c5 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/Server.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/ServerBroadcaster$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/ServerBroadcaster$1.class new file mode 100644 index 000000000..099e78704 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/ServerBroadcaster$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/ServerBroadcaster.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/ServerBroadcaster.class new file mode 100644 index 000000000..e3ba9b0c8 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/ServerBroadcaster.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/ServerListener.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/ServerListener.class new file mode 100644 index 000000000..c6bfc4f5b Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/ServerListener.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/ServerTalker.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/ServerTalker.class new file mode 100644 index 000000000..2f0b4e9f7 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/ServerTalker.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/event/GameReadyEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/event/GameReadyEvent.class new file mode 100644 index 000000000..326c7f578 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/event/GameReadyEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/event/PlayerGameAssignmentEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/event/PlayerGameAssignmentEvent.class new file mode 100644 index 000000000..ecdfc1f10 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/event/PlayerGameAssignmentEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/event/PlayerGameRequestEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/event/PlayerGameRequestEvent.class new file mode 100644 index 000000000..c7f84e9bc Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/event/PlayerGameRequestEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/event/PlayerServerAssignmentEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/event/PlayerServerAssignmentEvent.class new file mode 100644 index 000000000..baacd1213 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/event/PlayerServerAssignmentEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/event/PlayerVoteEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/event/PlayerVoteEvent.class new file mode 100644 index 000000000..45c80875e Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/event/PlayerVoteEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/event/ServerReadyEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/event/ServerReadyEvent.class new file mode 100644 index 000000000..9699fc614 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/event/ServerReadyEvent.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/GameReadyPacket.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/GameReadyPacket.class new file mode 100644 index 000000000..ec404ae04 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/GameReadyPacket.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/IPacketHandler.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/IPacketHandler.class new file mode 100644 index 000000000..9e539fd47 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/IPacketHandler.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/Packet.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/Packet.class new file mode 100644 index 000000000..a40f903af Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/Packet.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/PacketType.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/PacketType.class new file mode 100644 index 000000000..7b2fe4aed Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/PacketType.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/PlayerGameAssignmentPacket.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/PlayerGameAssignmentPacket.class new file mode 100644 index 000000000..b962ca3be Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/PlayerGameAssignmentPacket.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/PlayerGameRequestPacket.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/PlayerGameRequestPacket.class new file mode 100644 index 000000000..39db257a5 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/PlayerGameRequestPacket.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/PlayerServerAssignmentPacket.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/PlayerServerAssignmentPacket.class new file mode 100644 index 000000000..f9be287d7 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/PlayerServerAssignmentPacket.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/PlayerVotePacket.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/PlayerVotePacket.class new file mode 100644 index 000000000..94cd9d08f Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/PlayerVotePacket.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/ServerReadyPacket.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/ServerReadyPacket.class new file mode 100644 index 000000000..342fab55f Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/packet/ServerReadyPacket.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/AsyncJsonWebCall$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/AsyncJsonWebCall$1.class new file mode 100644 index 000000000..b7a32b26a Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/AsyncJsonWebCall$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/AsyncJsonWebCall$2.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/AsyncJsonWebCall$2.class new file mode 100644 index 000000000..05b6dc7d8 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/AsyncJsonWebCall$2.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/AsyncJsonWebCall$3.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/AsyncJsonWebCall$3.class new file mode 100644 index 000000000..fd664140e Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/AsyncJsonWebCall$3.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/AsyncJsonWebCall$4.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/AsyncJsonWebCall$4.class new file mode 100644 index 000000000..ed3d278d9 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/AsyncJsonWebCall$4.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/AsyncJsonWebCall.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/AsyncJsonWebCall.class new file mode 100644 index 000000000..44c4b4f15 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/AsyncJsonWebCall.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/JsonWebCall.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/JsonWebCall.class new file mode 100644 index 000000000..a05efc87b Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/remotecall/JsonWebCall.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/server/util/TransactionResponse.class b/Plugins/Mineplex.Core/bin/mineplex/core/server/util/TransactionResponse.class new file mode 100644 index 000000000..060de724d Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/server/util/TransactionResponse.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/ShopBase.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/ShopBase.class new file mode 100644 index 000000000..bc6738f08 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/ShopBase.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/IButton.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/IButton.class new file mode 100644 index 000000000..9ed51ee76 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/IButton.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/ICurrencyPackage.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/ICurrencyPackage.class new file mode 100644 index 000000000..12975614a Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/ICurrencyPackage.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/IDisplayPackage.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/IDisplayPackage.class new file mode 100644 index 000000000..b1e28bcd3 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/IDisplayPackage.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/IPackage.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/IPackage.class new file mode 100644 index 000000000..b65a3c0c4 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/IPackage.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/ISalesPackage.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/ISalesPackage.class new file mode 100644 index 000000000..44097987d Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/ISalesPackage.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/ItemPackage.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/ItemPackage.class new file mode 100644 index 000000000..a575b3c8d Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/ItemPackage.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/SalesPackageBase.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/SalesPackageBase.class new file mode 100644 index 000000000..eabff0634 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/SalesPackageBase.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/ShopItem.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/ShopItem.class new file mode 100644 index 000000000..1804cbfc2 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/item/ShopItem.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/AnvilContainer.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/AnvilContainer.class new file mode 100644 index 000000000..3617bb33a Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/AnvilContainer.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$1.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$1.class new file mode 100644 index 000000000..d93effab0 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$1.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$2.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$2.class new file mode 100644 index 000000000..934d66fa9 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$2.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$3.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$3.class new file mode 100644 index 000000000..b820311d3 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$3.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$4.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$4.class new file mode 100644 index 000000000..8e1aead44 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$4.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$5.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$5.class new file mode 100644 index 000000000..94ea3588f Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$5.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$6.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$6.class new file mode 100644 index 000000000..b0123b2da Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage$6.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage.class new file mode 100644 index 000000000..700e69177 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ConfirmationPage.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ShopPageBase.class b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ShopPageBase.class new file mode 100644 index 000000000..43e20c79e Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/shop/page/ShopPageBase.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/spawn/Spawn.class b/Plugins/Mineplex.Core/bin/mineplex/core/spawn/Spawn.class new file mode 100644 index 000000000..814f7958e Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/spawn/Spawn.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/spawn/command/AddCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/spawn/command/AddCommand.class new file mode 100644 index 000000000..0ae5c7ecb Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/spawn/command/AddCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/spawn/command/ClearCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/spawn/command/ClearCommand.class new file mode 100644 index 000000000..ee04c2ee2 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/spawn/command/ClearCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/spawn/command/SpawnCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/spawn/command/SpawnCommand.class new file mode 100644 index 000000000..9b2cd2cbc Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/spawn/command/SpawnCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/teleport/Teleport.class b/Plugins/Mineplex.Core/bin/mineplex/core/teleport/Teleport.class new file mode 100644 index 000000000..2b6a13bec Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/teleport/Teleport.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/teleport/Teleporter.class b/Plugins/Mineplex.Core/bin/mineplex/core/teleport/Teleporter.class new file mode 100644 index 000000000..145289552 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/teleport/Teleporter.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/teleport/command/AllCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/teleport/command/AllCommand.class new file mode 100644 index 000000000..c6a34fc71 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/teleport/command/AllCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/teleport/command/BackCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/teleport/command/BackCommand.class new file mode 100644 index 000000000..9e5deb1c5 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/teleport/command/BackCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/teleport/command/HereCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/teleport/command/HereCommand.class new file mode 100644 index 000000000..c8dc6db80 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/teleport/command/HereCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/teleport/command/SpawnCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/teleport/command/SpawnCommand.class new file mode 100644 index 000000000..e16d2fc73 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/teleport/command/SpawnCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/teleport/command/TeleportCommand.class b/Plugins/Mineplex.Core/bin/mineplex/core/teleport/command/TeleportCommand.class new file mode 100644 index 000000000..a869b554b Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/teleport/command/TeleportCommand.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/updater/UpdateType.class b/Plugins/Mineplex.Core/bin/mineplex/core/updater/UpdateType.class new file mode 100644 index 000000000..cc42d1ac3 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/updater/UpdateType.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/updater/Updater.class b/Plugins/Mineplex.Core/bin/mineplex/core/updater/Updater.class new file mode 100644 index 000000000..ec5dcd636 Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/updater/Updater.class differ diff --git a/Plugins/Mineplex.Core/bin/mineplex/core/updater/event/UpdateEvent.class b/Plugins/Mineplex.Core/bin/mineplex/core/updater/event/UpdateEvent.class new file mode 100644 index 000000000..fcaa3e3fb Binary files /dev/null and b/Plugins/Mineplex.Core/bin/mineplex/core/updater/event/UpdateEvent.class differ diff --git a/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java b/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java new file mode 100644 index 000000000..0de3292ca --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java @@ -0,0 +1,49 @@ +package mineplex.core; + +import mineplex.core.account.event.ClientUnloadEvent; +import mineplex.core.common.util.NautHashMap; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + +public abstract class MiniClientPlugin extends MiniPlugin +{ + private NautHashMap _clientData = new NautHashMap(); + + public MiniClientPlugin(String moduleName, JavaPlugin plugin) + { + super(moduleName, plugin); + } + + @EventHandler + public void UnloadPlayer(ClientUnloadEvent event) + { + _clientData.remove(event.GetName()); + } + + public DataType Get(String name) + { + if (!_clientData.containsKey(name)) + _clientData.put(name, AddPlayer(name)); + + return _clientData.get(name); + } + + public DataType Get(Player player) + { + return Get(player.getName()); + } + + protected void Set(Player player, DataType data) + { + Set(player.getName(), data); + } + + protected void Set(String name, DataType data) + { + _clientData.put(name, data); + } + + protected abstract DataType AddPlayer(String player); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java b/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java new file mode 100644 index 000000000..f595fcbd0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java @@ -0,0 +1,96 @@ +package mineplex.core; + +import org.bukkit.event.Listener; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitScheduler; + +import mineplex.core.command.CommandCenter; +import mineplex.core.command.ICommand; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; + +public abstract class MiniPlugin implements Listener +{ + protected String _moduleName = "Default"; + + protected JavaPlugin _plugin; + + protected NautHashMap _commands; + + public MiniPlugin(String moduleName, JavaPlugin plugin) + { + _moduleName = moduleName; + _plugin = plugin; + + _commands = new NautHashMap(); + + onEnable(); + + RegisterEvents(this); + } + + public PluginManager GetPluginManager() + { + return _plugin.getServer().getPluginManager(); + } + + public BukkitScheduler GetScheduler() + { + return _plugin.getServer().getScheduler(); + } + + public JavaPlugin GetPlugin() + { + return _plugin; + } + + public void RegisterEvents(Listener listener) + { + _plugin.getServer().getPluginManager().registerEvents(listener, _plugin); + } + + public final void onEnable() + { + long epoch = System.currentTimeMillis(); + Log("Initializing..."); + Enable(); + AddCommands(); + Log("Enabled in " + UtilTime.convertString(System.currentTimeMillis() - epoch, 1, TimeUnit.FIT) + "."); + } + + public final void onDisable() + { + Disable(); + + Log("Disabled."); + } + + public void Enable() { } + + public void Disable() { } + + public void AddCommands() { } + + public final String GetName() + { + return _moduleName; + } + + public final void AddCommand(ICommand command) + { + CommandCenter.Instance.AddCommand(command); + } + + public final void RemoveCommand(ICommand command) + { + CommandCenter.Instance.RemoveCommand(command); + } + + protected void Log(String message) + { + System.out.println(F.main(_moduleName, message)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java new file mode 100644 index 000000000..021ffab7c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java @@ -0,0 +1,77 @@ +package mineplex.core.account; + +import mineplex.core.common.Rank; + +import org.bukkit.entity.Player; + +public class CoreClient +{ + private int _accountId; + private String _name; + private Player _player; + private Rank _rank; + + private boolean _filterChat; + + public CoreClient(Player player) + { + _player = player; + _name = player.getName(); + } + + public CoreClient(String name) + { + _name = name; + } + + public String GetPlayerName() + { + return _name; + } + + public Player GetPlayer() + { + return _player; + } + + public void SetPlayer(Player player) + { + _player = player; + } + + public int GetAccountId() + { + return _accountId; + } + + public void Delete() + { + _name = null; + _player = null; + } + + public void SetAccountId(int accountId) + { + _accountId = accountId; + } + + public void SetFilterChat(Boolean filterChat) + { + _filterChat = filterChat; + } + + public boolean GetFilterChat() + { + return _filterChat; + } + + public Rank GetRank() + { + return _rank; + } + + public void SetRank(Rank rank) + { + _rank = rank; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java new file mode 100644 index 000000000..a1143d7a8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -0,0 +1,278 @@ +package mineplex.core.account; + +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map.Entry; + +import mineplex.core.account.event.AsyncClientLoadEvent; +import mineplex.core.account.event.ClientUnloadEvent; +import mineplex.core.account.event.ClientWebResponseEvent; +import mineplex.core.account.repository.AccountRepository; +import mineplex.core.account.repository.token.ClientToken; +import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.TimeSpan; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.libs.com.google.gson.Gson; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result; +import org.bukkit.event.player.PlayerKickEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class CoreClientManager implements Listener +{ + private static CoreClientManager _instance; + + private JavaPlugin _plugin; + private AccountRepository _repository; + private HashSet _allClients; + private HashMap _clientList; + private HashSet _dontRemoveList; + private NautHashMap> _cacheList; + + private Object _clientLock = new Object(); + + protected CoreClientManager(JavaPlugin plugin, String webServer) + { + _instance = this; + + _plugin = plugin; + _repository = new AccountRepository(webServer); + _allClients = new HashSet(); + _clientList = new HashMap(); + _dontRemoveList = new HashSet(); + _cacheList = new NautHashMap>(); + + for (String clientName : _repository.GetAllClientNames()) + { + _allClients.add(clientName); + } + + _plugin.getServer().getPluginManager().registerEvents(this, _plugin); + } + + public static CoreClientManager Initialize(JavaPlugin plugin, String webServer) + { + if (_instance == null) + { + _instance = new CoreClientManager(plugin, webServer); + } + + return _instance; + } + + public CoreClient Add(String name) + { + CoreClient newClient = null; + + synchronized (this) + { + if (_cacheList.containsKey(name.toLowerCase())) + { + newClient = _cacheList.get(name.toLowerCase()).getKey(); + _cacheList.remove(name.toLowerCase()); + } + } + + if (newClient == null) + { + newClient = new CoreClient(name); + } + + CoreClient oldClient = null; + + synchronized(_clientLock) + { + oldClient = _clientList.put(name.toLowerCase(), newClient); + } + + if (oldClient != null) + { + oldClient.Delete(); + } + + return newClient; + } + + public CoreClient Add(Player player) + { + CoreClient newClient = new CoreClient(player); + CoreClient oldClient = null; + + synchronized(_clientLock) + { + oldClient = _clientList.put(player.getName().toLowerCase(), newClient); + } + + if (oldClient != null) + { + oldClient.Delete(); + } + + return newClient; + } + + public void Del(String name) + { + CoreClient removedClient = null; + + synchronized(_clientLock) + { + removedClient = _clientList.remove(name.toLowerCase()); + } + synchronized (this) + { + _cacheList.put(name, new AbstractMap.SimpleEntry(removedClient, System.currentTimeMillis() + TimeSpan.MINUTE)); + } + } + + public CoreClient Get(String name) + { + synchronized(_clientLock) + { + return _clientList.get(name.toLowerCase()); + } + } + + public CoreClient Get(Player player) + { + synchronized(_clientLock) + { + return _clientList.get(player.getName().toLowerCase()); + } + } + + public HashSet GetAll() + { + return _allClients; + } + + @EventHandler(priority = EventPriority.LOWEST) + public void AsyncLogin(AsyncPlayerPreLoginEvent event) + { + try + { + LoadClient(Add(event.getName()), event.getAddress().getHostAddress()); + } + catch(Exception exception) + { + System.out.println("Error logging '" + event.getName() + "' in."); + + System.out.println(exception.getMessage()); + + for (StackTraceElement element : exception.getStackTrace()) + { + System.out.println(element); + } + + event.disallow(Result.KICK_OTHER, "Error retrieving information from web, please retry in a minute."); + } + } + + private void LoadClient(CoreClient client, String ipAddress) + { + ClientToken token = null; + Gson gson = new Gson(); + + String response = _repository.GetClient(client.GetPlayerName(), ipAddress); + token = gson.fromJson(response, ClientToken.class); + + client.SetAccountId(token.AccountId); + client.SetFilterChat(token.FilterChat); + client.SetRank(Rank.valueOf(token.Rank)); + + Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response)); + Bukkit.getServer().getPluginManager().callEvent(new AsyncClientLoadEvent(token, client)); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void Login(PlayerLoginEvent event) + { + CoreClient client = Get(event.getPlayer().getName()); + client.SetPlayer(event.getPlayer()); + + // Reserved Slot Check + if (Bukkit.getOnlinePlayers().length >= Bukkit.getServer().getMaxPlayers()) + { + if (client.GetRank().Has(event.getPlayer(), Rank.HELPER, false)) + { + event.allow(); + event.setResult(PlayerLoginEvent.Result.ALLOWED); + return; + } + + event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Server Full > Donate for Ultra"); + } + } + + @EventHandler + public void Kick(PlayerKickEvent event) + { + if (event.getReason().equalsIgnoreCase("You logged in from another location")) + { + _dontRemoveList.add(event.getPlayer().getName().toLowerCase()); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void Quit(PlayerQuitEvent event) + { + if (!_dontRemoveList.contains(event.getPlayer().getName().toLowerCase())) + { + Del(event.getPlayer().getName().toLowerCase()); + } + + _dontRemoveList.remove(event.getPlayer().getName().toLowerCase()); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void ClearCache(UpdateEvent event) + { + if (event.getType() == UpdateType.SLOW) + { + synchronized (this) + { + Iterator cacheIterator = _cacheList.keySet().iterator(); + + while (cacheIterator.hasNext()) + { + String name = cacheIterator.next(); + + if (System.currentTimeMillis() >= _cacheList.get(name).getValue()) + { + cacheIterator.remove(); + _plugin.getServer().getPluginManager().callEvent(new ClientUnloadEvent(name)); + } + } + } + } + } + + public void SaveRank(final String name, Rank rank, boolean perm) + { + _repository.SaveRank(new Callback() + { + public void run(Rank newRank) + { + if (_plugin.getServer().getPlayer(name) != null) + { + CoreClient client = Get(name); + + client.SetRank(newRank); + } + } + }, name, rank, perm); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/event/AsyncClientLoadEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/account/event/AsyncClientLoadEvent.java new file mode 100644 index 000000000..681d19ff3 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/event/AsyncClientLoadEvent.java @@ -0,0 +1,41 @@ +package mineplex.core.account.event; + +import mineplex.core.account.CoreClient; +import mineplex.core.account.repository.token.ClientToken; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class AsyncClientLoadEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private ClientToken _token; + private CoreClient _client; + + public AsyncClientLoadEvent(ClientToken token, CoreClient client) + { + _token = token; + _client = client; + } + + public CoreClient GetClient() + { + return _client; + } + + public ClientToken GetClientToken() + { + return _token; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/event/ClientUnloadEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/account/event/ClientUnloadEvent.java new file mode 100644 index 000000000..972b1f612 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/event/ClientUnloadEvent.java @@ -0,0 +1,31 @@ +package mineplex.core.account.event; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ClientUnloadEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private String _name; + + public ClientUnloadEvent(String name) + { + _name = name; + } + + public String GetName() + { + return _name; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/event/ClientWebRequestEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/account/event/ClientWebRequestEvent.java new file mode 100644 index 000000000..888bd1e9b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/event/ClientWebRequestEvent.java @@ -0,0 +1,32 @@ +package mineplex.core.account.event; + +import org.bukkit.craftbukkit.libs.com.google.gson.stream.JsonWriter; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ClientWebRequestEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private JsonWriter _writer; + + public ClientWebRequestEvent(JsonWriter writer) + { + _writer = writer; + } + + public JsonWriter GetJsonWriter() + { + return _writer; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/event/ClientWebResponseEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/account/event/ClientWebResponseEvent.java new file mode 100644 index 000000000..291b3961c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/event/ClientWebResponseEvent.java @@ -0,0 +1,31 @@ +package mineplex.core.account.event; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ClientWebResponseEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private String _response; + + public ClientWebResponseEvent(String response) + { + _response = response; + } + + public String GetResponse() + { + return _response; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/event/GetClientEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/account/event/GetClientEvent.java new file mode 100644 index 000000000..26cc2463a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/event/GetClientEvent.java @@ -0,0 +1,57 @@ +package mineplex.core.account.event; + +import mineplex.core.account.CoreClient; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class GetClientEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private String _name; + + private CoreClient _client; + + public GetClientEvent(String name) + { + _name = name; + } + + public GetClientEvent(Player player) + { + _name = player.getName(); + } + + public CoreClient GetClient() + { + return _client; + } + + public void SetClient(CoreClient client) + { + _client = client; + } + + public void SetName(String name) + { + _name = name; + } + + public String GetName() + { + return _name; + } + + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java new file mode 100644 index 000000000..0d0768686 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java @@ -0,0 +1,45 @@ +package mineplex.core.account.repository; + +import java.util.List; + +import mineplex.core.account.repository.token.LoginToken; +import mineplex.core.account.repository.token.RankUpdateToken; +import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; +import mineplex.core.server.remotecall.AsyncJsonWebCall; +import mineplex.core.server.remotecall.JsonWebCall; + +public class AccountRepository +{ + private String _webAddress; + + public AccountRepository(String webAddress) + { + _webAddress = webAddress; + } + + @SuppressWarnings("unchecked") + public List GetAllClientNames() + { + return new JsonWebCall(_webAddress + "PlayerAccount/GetAccountNames").Execute(List.class); + } + + public String GetClient(String name, String ipAddress) + { + LoginToken token = new LoginToken(); + token.Name = name; + token.IpAddress = ipAddress; + + return new JsonWebCall(_webAddress + "PlayerAccount/Login").ExecuteReturnStream(token); + } + + public void SaveRank(Callback callback, String name, Rank rank, boolean perm) + { + RankUpdateToken token = new RankUpdateToken(); + token.Name = name; + token.Rank = rank.toString(); + token.Perm = perm; + + new AsyncJsonWebCall(_webAddress + "PlayerAccount/RankUpdate").Execute(Rank.class, callback, token); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/token/AccountToken.java b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/token/AccountToken.java new file mode 100644 index 000000000..89c8ab4e1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/token/AccountToken.java @@ -0,0 +1,24 @@ +package mineplex.core.account.repository.token; + +import java.util.HashSet; +import java.util.List; + + +public class AccountToken +{ + public int AccountId; + public String Name; + public Rank Rank; + + public int LoginCount; + public long LastLogin; + public long TotalPlayingTime; + public HashSet IpAdddresses = new HashSet(); + + public boolean Banned; + public String Reason; + + public int BlueGems; + public int GreenGems; + public List SalesPackageIds; +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/token/ClientToken.java b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/token/ClientToken.java new file mode 100644 index 000000000..56d60e6a0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/token/ClientToken.java @@ -0,0 +1,12 @@ +package mineplex.core.account.repository.token; + +public class ClientToken +{ + public int AccountId; + public String Name; + public String Rank; + public int EconomyBalance; + + public AccountToken AccountToken; + public Boolean FilterChat; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/token/LoginToken.java b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/token/LoginToken.java new file mode 100644 index 000000000..df9c5e1a7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/token/LoginToken.java @@ -0,0 +1,8 @@ +package mineplex.core.account.repository.token; + +public class LoginToken +{ + public String Name; + public String IpAddress = "0.0.0.0"; + public String MacAddress = "00-00-00-00-00-00-00-00"; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/token/Rank.java b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/token/Rank.java new file mode 100644 index 000000000..a2e891a31 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/token/Rank.java @@ -0,0 +1,8 @@ +package mineplex.core.account.repository.token; + +public class Rank +{ + public int RankId; + + public String Name; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/token/RankUpdateToken.java b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/token/RankUpdateToken.java new file mode 100644 index 000000000..82e91908c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/token/RankUpdateToken.java @@ -0,0 +1,8 @@ +package mineplex.core.account.repository.token; + +public class RankUpdateToken +{ + public String Name; + public String Rank; + public boolean Perm; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antistack/AntiStack.java b/Plugins/Mineplex.Core/src/mineplex/core/antistack/AntiStack.java new file mode 100644 index 000000000..3a939b047 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antistack/AntiStack.java @@ -0,0 +1,80 @@ +package mineplex.core.antistack; + +import mineplex.core.MiniPlugin; + +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; +import org.bukkit.entity.Item; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.inventory.InventoryPickupItemEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class AntiStack extends MiniPlugin +{ + public AntiStack(JavaPlugin plugin) + { + super("AntiStack", plugin); + } + + @EventHandler (priority=EventPriority.HIGHEST) + public void ItemSpawn(ItemSpawnEvent event) + { + if (event.isCancelled()) + return; + + Item item = event.getEntity(); + + //ItemName() + if (item.getLocation().getY() < -10) + return; + + //Get Name + String name = ((CraftItemStack)item.getItemStack()).getHandle().getName(); + + //Append UID + name += ":" + item.getUniqueId(); + + //Set Name + ((CraftItemStack)item.getItemStack()).getHandle().c(name); + } + + @EventHandler (priority=EventPriority.HIGHEST) + public void PlayerPickup(PlayerPickupItemEvent event) + { + if (event.isCancelled()) + return; + + Item item = event.getItem(); + + //Get Name + String name = ((CraftItemStack)item.getItemStack()).getHandle().getName(); + + //Remove UID + if (name.contains(":")) + name = name.substring(0, name.indexOf(":" + item.getUniqueId())); + + //Set Name + ((CraftItemStack)item.getItemStack()).getHandle().c(name); + } + + @EventHandler + public void HopperPickup(InventoryPickupItemEvent event) + { + if (event.isCancelled()) + return; + + Item item = event.getItem(); + + //Get Name + String name = ((CraftItemStack)item.getItemStack()).getHandle().getName(); + + //Remove UID + if (name.contains(":")) + name = name.substring(0, name.indexOf(":" + item.getUniqueId())); + + //Set Name + ((CraftItemStack)item.getItemStack()).getHandle().c(name); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/arena/Region.java b/Plugins/Mineplex.Core/src/mineplex/core/arena/Region.java new file mode 100644 index 000000000..0ac43c6cc --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/arena/Region.java @@ -0,0 +1,163 @@ +package mineplex.core.arena; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.util.Vector; + +public class Region +{ + private String _name; + private transient Vector _pointOne; + private transient Vector _pointTwo; + + private List _owners; + + private Boolean _blockPassage = false; + private Boolean _blockChange = true; + + private int _priority; + + private int _minX; + private int _minY; + private int _minZ; + + private int _maxX; + private int _maxY; + private int _maxZ; + + public Region(String name, Vector pointOne, Vector pointTwo) + { + _name = name; + _pointOne = pointOne; + _pointTwo = pointTwo; + _priority = 0; + _owners = new ArrayList(); + + UpdateMinMax(); + } + + public Vector GetMaximumPoint() + { + return new Vector(_maxX, _maxY, _maxZ); + } + + public void AdjustRegion(Vector vector) + { + _minX += vector.getBlockX(); + _minY += vector.getBlockY(); + _minZ += vector.getBlockZ(); + + _maxX += vector.getBlockX(); + _maxY += vector.getBlockY(); + _maxZ += vector.getBlockZ(); + } + + public Vector GetMinimumPoint() + { + return new Vector(_minX, _minY, _minZ); + } + + public Vector GetMidPoint() + { + return new Vector((_maxX - _minX)/2 + _minX, (_maxY - _minY)/2 + _minY, (_maxZ - _minZ)/2 + _minZ); + } + + public void SetPriority(int priority) + { + _priority = priority; + } + + public int GetPriority() + { + return _priority; + } + + public Boolean Contains(Vector v) + { + return v.getBlockX() >= _minX && v.getBlockX() <= _maxX + && v.getBlockY() >= _minY && v.getBlockY() <= _maxY + && v.getBlockZ() >= _minZ && v.getBlockZ() <= _maxZ; + } + + public void AddOwner(String name) + { + if (!_owners.contains(name.toLowerCase())) + { + _owners.add(name.toLowerCase()); + } + } + + public void RemoveOwner(String name) + { + _owners.remove(name.toLowerCase()); + } + + public void SetOwners(List owners) + { + _owners = owners; + + for (String ownerName : _owners) + { + ownerName = ownerName.toLowerCase(); + } + } + + public void SetEnter(Boolean canEnter) + { + _blockPassage = !canEnter; + } + + public void SetChangeBlocks(Boolean canChangeBlocks) + { + _blockChange = !canChangeBlocks; + } + + public Boolean CanEnter(String playerName) + { + if (_blockPassage) + { + if (!_owners.contains(playerName.toLowerCase())) + { + return false; + } + } + + return true; + } + + public Boolean CanChangeBlocks(String playerName) + { + if (_blockChange) + { + if (!_owners.contains(playerName.toLowerCase())) + { + return false; + } + } + + return true; + } + + public String GetName() + { + return _name; + } + + private void UpdateMinMax() + { + _minX = Math.min(_pointOne.getBlockX(), _pointTwo.getBlockX()); + _minY = Math.min(_pointOne.getBlockY(), _pointTwo.getBlockY()); + _minZ = Math.min(_pointOne.getBlockZ(), _pointTwo.getBlockZ()); + + _maxX = Math.max(_pointOne.getBlockX(), _pointTwo.getBlockX()); + _maxY = Math.max(_pointOne.getBlockY(), _pointTwo.getBlockY()); + _maxZ = Math.max(_pointOne.getBlockZ(), _pointTwo.getBlockZ()); + } + + @Override + public String toString() + { + return "Maximum point: " + GetMaximumPoint() + " Minimum point: " + GetMinimumPoint(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java new file mode 100644 index 000000000..0d4e63c6a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java @@ -0,0 +1,156 @@ +package mineplex.core.blockrestore; + +import java.util.ArrayList; +import java.util.HashMap; + +import mineplex.core.MiniPlugin; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilBlock; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPistonExtendEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class BlockRestore extends MiniPlugin +{ + private HashMap _blocks = new HashMap(); + + public BlockRestore(JavaPlugin plugin) + { + super("Block Restore", plugin); + } + + @EventHandler(priority=EventPriority.LOW) + public void BlockBreak(BlockBreakEvent event) + { + if (Contains(event.getBlock())) + event.setCancelled(true); + } + + @EventHandler(priority=EventPriority.LOW) + public void BlockPlace(BlockPlaceEvent event) + { + if (Contains(event.getBlockPlaced())) + event.setCancelled(true); + } + + @EventHandler(priority=EventPriority.LOW) + public void Piston(BlockPistonExtendEvent event) + { + if (event.isCancelled()) + return; + + Block push = event.getBlock(); + for (int i=0 ; i<13 ; i++) + { + push = push.getRelative(event.getDirection()); + + if (push.getType() == Material.AIR) + return; + + if (Contains(push)) + { + push.getWorld().playEffect(push.getLocation(), Effect.STEP_SOUND, push.getTypeId()); + event.setCancelled(true); + return; + } + } + } + + @EventHandler + public void ExpireBlocks(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + ArrayList toRemove = new ArrayList(); + + for (BlockRestoreData cur : _blocks.values()) + if (cur.expire()) + toRemove.add(cur._block); + + //Remove Handled + for (Block cur : toRemove) + _blocks.remove(cur); + } + + public void Restore(Block block) + { + if (!Contains(block)) + return; + + _blocks.remove(block).restore(); + } + + public void Add(Block block, int toID, byte toData, long expireTime) + { + if (!Contains(block)) GetBlocks().put(block, new BlockRestoreData(block, toID, toData, expireTime, 0)); + else GetData(block).update(toID, toData, expireTime); + } + + public void Snow(Block block, byte heightAdd, byte heightMax, long expireTime, long meltDelay, int heightJumps) + { + //Fill Above + if (((block.getTypeId() == 78 && block.getData() >= (byte)7) || block.getTypeId() == 80) && GetData(block) != null) + { + GetData(block).update(78, heightAdd, expireTime, meltDelay); + + if (heightJumps > 0) Snow(block.getRelative(BlockFace.UP), heightAdd, heightMax, expireTime, meltDelay, heightJumps-1); + if (heightJumps == -1) Snow(block.getRelative(BlockFace.UP), heightAdd, heightMax, expireTime, meltDelay, -1); + + return; + } + + //Not Grounded + if (!UtilBlock.solid(block.getRelative(BlockFace.DOWN)) && block.getRelative(BlockFace.DOWN).getTypeId() != 78) + return; + + //Not on Solid Snow + if (block.getRelative(BlockFace.DOWN).getTypeId() == 78 && block.getRelative(BlockFace.DOWN).getData() < (byte)7) + return; + + //No Snow on Ice + if (block.getRelative(BlockFace.DOWN).getTypeId() == 79) + return; + + //Not Buildable + if (!UtilBlock.airFoliage(block) && block.getTypeId() != 78) + return; + + //Limit Build Height + if (block.getTypeId() == 78) + if (block.getData() >= (byte)heightMax) + heightAdd = 0; + + //Snow + if (!Contains(block)) GetBlocks().put(block, new BlockRestoreData(block, 78, (byte)Math.max(0, heightAdd-1), expireTime, meltDelay)); + else GetData(block).update(78, heightAdd, expireTime, meltDelay); + } + + public boolean Contains(Block block) + { + if (GetBlocks().containsKey(block)) + return true; + return false; + } + + public BlockRestoreData GetData(Block block) + { + if (_blocks.containsKey(block)) + return _blocks.get(block); + return null; + } + + public HashMap GetBlocks() + { + return _blocks; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestoreData.java b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestoreData.java new file mode 100644 index 000000000..02b88d8ca --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestoreData.java @@ -0,0 +1,155 @@ +package mineplex.core.blockrestore; + +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; + +public class BlockRestoreData +{ + protected Block _block; + + protected int _fromID; + protected byte _fromData; + + protected int _toID; + protected byte _toData; + + protected long _expireDelay; + protected long _epoch; + + protected long _meltDelay = 0; + protected long _meltLast = 0; + + public BlockRestoreData(Block block, int toID, byte toData, long expireDelay, long meltDelay) + { + _block = block; + + _fromID = block.getTypeId(); + _fromData = block.getData(); + + _toID = toID; + _toData = toData; + + _expireDelay = expireDelay; + _epoch = System.currentTimeMillis(); + + _meltDelay = meltDelay; + _meltLast = System.currentTimeMillis(); + + //Set + set(); + } + + public boolean expire() + { + if (System.currentTimeMillis() - _epoch < _expireDelay) + return false; + + //Try to Melt + if (melt()) + return false; + + //Restore + restore(); + return true; + } + + public boolean melt() + { + if (_block.getTypeId() != 78 && _block.getTypeId() != 80) + return false; + + if (_block.getRelative(BlockFace.UP).getTypeId() == 78 || _block.getRelative(BlockFace.UP).getTypeId() == 80) + { + _meltLast = System.currentTimeMillis(); + return true; + } + + if (System.currentTimeMillis() - _meltLast < _meltDelay) + return true; + + //Return to Cover + if (_block.getTypeId() == 80) + _block.setTypeIdAndData(78, (byte)7, false); + + byte data = _block.getData(); + if (data <= 0) return false; + + _block.setData((byte)(_block.getData() - 1)); + _meltLast = System.currentTimeMillis(); + return true; + } + + public void update(int toIDIn, byte toDataIn) + { + _toID = toIDIn; + _toData = toDataIn; + + //Set + set(); + } + + public void update(int toID, byte addData, long expireTime) + { + //Snow Data + if (toID == 78) + { + if (_toID == 78) _toData = (byte)Math.min(7, _toData + addData); + else _toData = addData; + } + + _toID = toID; + + //Set + set(); + + //Reset Time + _expireDelay = expireTime; + _epoch = System.currentTimeMillis(); + } + + public void update(int toID, byte addData, long expireTime, long meltDelay) + { + //Snow Data + if (toID == 78) + { + if (_toID == 78) _toData = (byte)Math.min(7, _toData + addData); + else _toData = addData; + } + + _toID = toID; + + //Set + set(); + + //Reset Time + _expireDelay = expireTime; + _epoch = System.currentTimeMillis(); + + //Melt Delay + if (_meltDelay < meltDelay) + _meltDelay = (_meltDelay + meltDelay)/2; + } + + public void set() + { + if (_toID == 78 && _toData == (byte)7) + _block.setTypeIdAndData(80, (byte)0, true); + else + _block.setTypeIdAndData(_toID, _toData, true); + } + + public void restore() + { + _block.setTypeIdAndData(_fromID, _fromData, true); + } + + public void setFromId(int i) + { + _fromID = i; + } + + public void setFromData(byte i) + { + _fromData = i; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/command/CommandBase.java b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandBase.java new file mode 100644 index 000000000..0bf928b03 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandBase.java @@ -0,0 +1,45 @@ +package mineplex.core.command; + +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.Rank; + +public abstract class CommandBase implements ICommand +{ + private Rank _requiredRank; + private List _aliases; + + protected PluginType Plugin; + protected String AliasUsed; + protected CommandCenter CommandCenter; + + public CommandBase(PluginType plugin, Rank requiredRank, String...aliases) + { + Plugin = plugin; + _requiredRank = requiredRank; + _aliases = Arrays.asList(aliases); + } + + public Collection Aliases() + { + return _aliases; + } + + public void SetAliasUsed(String alias) + { + AliasUsed = alias; + } + + public Rank GetRequiredRank() + { + return _requiredRank; + } + + public void SetCommandCenter(CommandCenter commandCenter) + { + CommandCenter = commandCenter; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java new file mode 100644 index 000000000..b225080a0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java @@ -0,0 +1,78 @@ +package mineplex.core.command; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.NautHashMap; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class CommandCenter implements Listener +{ + public static CommandCenter Instance; + + protected JavaPlugin Plugin; + protected CoreClientManager ClientManager; + protected NautHashMap Commands; + + public static void Initialize(JavaPlugin plugin, CoreClientManager clientManager) + { + if (Instance == null) + Instance = new CommandCenter(plugin, clientManager); + } + + public CoreClientManager GetClientManager() + { + return ClientManager; + } + + private CommandCenter(JavaPlugin instance, CoreClientManager manager) + { + Plugin = instance; + ClientManager = manager; + Commands = new NautHashMap(); + Plugin.getServer().getPluginManager().registerEvents(this, Plugin); + } + + @EventHandler + public void OnPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) + { + String commandName = event.getMessage().substring(1); + String[] args = null; + + if (commandName.contains(" ")) + { + commandName = commandName.split(" ")[0]; + args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" "); + } + + ICommand command = Commands.get(commandName); + + if (command != null && ClientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), command.GetRequiredRank(), true)) + { + command.SetAliasUsed(commandName); + command.Execute(event.getPlayer(), args); + + event.setCancelled(true); + } + } + + public void AddCommand(ICommand command) + { + for (String commandRoot : command.Aliases()) + { + Commands.put(commandRoot, command); + command.SetCommandCenter(this); + } + } + + public void RemoveCommand(ICommand command) + { + for (String commandRoot : command.Aliases()) + { + Commands.remove(commandRoot); + command.SetCommandCenter(null); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/command/ICommand.java b/Plugins/Mineplex.Core/src/mineplex/core/command/ICommand.java new file mode 100644 index 000000000..48ebe363e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/command/ICommand.java @@ -0,0 +1,19 @@ +package mineplex.core.command; + +import java.util.Collection; + +import mineplex.core.common.Rank; + +import org.bukkit.entity.Player; + +public interface ICommand +{ + void SetCommandCenter(CommandCenter commandCenter); + void Execute(Player caller, String[] args); + + Collection Aliases(); + + void SetAliasUsed(String name); + + Rank GetRequiredRank(); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/command/MultiCommandBase.java b/Plugins/Mineplex.Core/src/mineplex/core/command/MultiCommandBase.java new file mode 100644 index 000000000..48736d577 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/command/MultiCommandBase.java @@ -0,0 +1,64 @@ +package mineplex.core.command; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.Rank; +import mineplex.core.common.util.NautHashMap; + +import org.bukkit.entity.Player; + +public abstract class MultiCommandBase extends CommandBase +{ + protected NautHashMap Commands; + + public MultiCommandBase(PluginType plugin, Rank rank, String...aliases) + { + super(plugin, rank, aliases); + + Commands = new NautHashMap(); + } + + public void AddCommand(ICommand command) + { + for (String commandRoot : command.Aliases()) + { + Commands.put(commandRoot, command); + command.SetCommandCenter(CommandCenter); + } + } + @Override + public void Execute(Player caller, String[] args) + { + String commandName = null; + String[] newArgs = null; + + if (args != null && args.length > 0) + { + commandName = args[0]; + + if (args.length > 1) + { + newArgs = new String[args.length - 1]; + + for (int i = 0 ; i < newArgs.length; i++) + { + newArgs[i] = args[i+1]; + } + } + } + + ICommand command = Commands.get(commandName); + + if (command != null && CommandCenter.ClientManager.Get(caller).GetRank().Has(caller, command.GetRequiredRank(), true)) + { + command.SetAliasUsed(commandName); + + command.Execute(caller, newArgs); + } + else + { + Help(caller, args); + } + } + + protected abstract void Help(Player caller, String[] args); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/creature/Creature.java b/Plugins/Mineplex.Core/src/mineplex/core/creature/Creature.java new file mode 100644 index 000000000..5dd2fddee --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/creature/Creature.java @@ -0,0 +1,277 @@ +package mineplex.core.creature; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; + +import mineplex.core.MiniPlugin; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.creature.command.MobCommand; +import mineplex.core.creature.event.CreatureSpawnCustomEvent; +import mineplex.core.itemstack.ItemStackFactory; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.*; +import org.bukkit.entity.Skeleton.SkeletonType; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class Creature extends MiniPlugin +{ + private boolean _spawnForce = false; + + public Creature(JavaPlugin plugin) + { + super("Creature", plugin); + } + + @Override + public void AddCommands() + { + AddCommand(new MobCommand(this)); + } + + public Entity SpawnEntity(Location location, EntityType entityType) + { + _spawnForce = true; + Entity entity = location.getWorld().spawnEntity(location, entityType); + _spawnForce = false; + + return entity; + } + + @EventHandler + public void Spawn(CreatureSpawnEvent event) + { + if (event.getEntity() instanceof LivingEntity) + ((LivingEntity)event.getEntity()).setCanPickupItems(false); + + if (_spawnForce) + return; + + //Useless Laggy Squids + if (event.getEntityType() == EntityType.SQUID) + { + event.setCancelled(true); + return; + } + + CreatureSpawnCustomEvent customEvent = new CreatureSpawnCustomEvent(event.getLocation()); + + _plugin.getServer().getPluginManager().callEvent(customEvent); + + if (customEvent.isCancelled()) + { + event.setCancelled(true); + return; + } + } + + @EventHandler + public void Death(EntityDeathEvent event) + { + event.setDroppedExp(0); + List drops = event.getDrops(); + + + if (event.getEntityType() == EntityType.PLAYER) + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 1)); + else + drops.clear(); + + //Animals + if (event.getEntityType() == EntityType.CHICKEN) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.RAW_CHICKEN, 1)); + drops.add(ItemStackFactory.Instance.CreateStack(Material.FEATHER, 2 + UtilMath.r(5))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 1)); + } + + else if (event.getEntityType() == EntityType.COW) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.RAW_BEEF, 1 + UtilMath.r(4))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.LEATHER, 2 + UtilMath.r(3))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 3 + UtilMath.r(4))); + } + + if (event.getEntityType() == EntityType.MUSHROOM_COW) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.RAW_BEEF, 1 + UtilMath.r(4))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.RED_MUSHROOM, 2 + UtilMath.r(3))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 3 + UtilMath.r(4))); + } + + else if (event.getEntityType() == EntityType.OCELOT) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.RAW_BEEF, 1 + UtilMath.r(2))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.RAW_FISH, 2 + UtilMath.r(7))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 1 + UtilMath.r(2))); + } + + else if (event.getEntityType() == EntityType.PIG) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.PORK, 1 + UtilMath.r(2))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 2 + UtilMath.r(2))); + } + + else if (event.getEntityType() == EntityType.SHEEP) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.RAW_BEEF, 1 + UtilMath.r(3))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.WOOL, 1 + UtilMath.r(4))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 2 + UtilMath.r(3))); + } + + else if (event.getEntityType() == EntityType.VILLAGER) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 2 + UtilMath.r(3))); + } + + //Monsters + else if (event.getEntityType() == EntityType.BLAZE) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.BLAZE_ROD, 1)); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 6 + UtilMath.r(7))); + } + + else if (event.getEntityType() == EntityType.CAVE_SPIDER) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.WEB, 2 + UtilMath.r(3))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.SPIDER_EYE, 1)); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 6 + UtilMath.r(7))); + } + + else if (event.getEntityType() == EntityType.CREEPER) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.COAL, 6 + UtilMath.r(13))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 12 + UtilMath.r(13))); + } + + else if (event.getEntityType() == EntityType.ENDERMAN) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.ENDER_PEARL, 1)); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 12 + UtilMath.r(13))); + } + + else if (event.getEntityType() == EntityType.GHAST) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.GHAST_TEAR, 1)); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 36 + UtilMath.r(37))); + for (int i=0 ; i < 5 + UtilMath.r(11) ; i++) + drops.add(ItemStackFactory.Instance.CreateStack(Material.EMERALD, 1)); + } + + else if (event.getEntityType() == EntityType.IRON_GOLEM) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.IRON_INGOT, 2 + UtilMath.r(3))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 12 + UtilMath.r(13))); + } + + else if (event.getEntityType() == EntityType.MAGMA_CUBE) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.MAGMA_CREAM, 1)); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 1 + UtilMath.r(2))); + } + + else if (event.getEntityType() == EntityType.PIG_ZOMBIE) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.GRILLED_PORK, 1 + UtilMath.r(2))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.ROTTEN_FLESH, 1 + UtilMath.r(2))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 2 + UtilMath.r(2))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.ARROW, 1 + UtilMath.r(12))); + if (UtilMath.r(100) > 90) drops.add(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, 1)); + } + + else if (event.getEntityType() == EntityType.SILVERFISH) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 1 + UtilMath.r(2))); + } + + else if (event.getEntityType() == EntityType.SKELETON) + { + if (((Skeleton)event.getEntity()).getSkeletonType() == SkeletonType.NORMAL) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.ARROW, 4 + UtilMath.r(5))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 12 + UtilMath.r(13))); + } + else + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.ARROW, 4 + UtilMath.r(10))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 12 + UtilMath.r(26))); + } + + } + + else if (event.getEntityType() == EntityType.SLIME) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 1 + UtilMath.r(2))); + } + + else if (event.getEntityType() == EntityType.SPIDER) + { + drops.add(ItemStackFactory.Instance.CreateStack(Material.WEB, 2 + UtilMath.r(3))); + drops.add(ItemStackFactory.Instance.CreateStack(Material.SPIDER_EYE, 1)); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 6 + UtilMath.r(7))); + } + + else if (event.getEntityType() == EntityType.ZOMBIE) + { + event.getDrops().add(ItemStackFactory.Instance.CreateStack(Material.ROTTEN_FLESH, 1)); + drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 6 + UtilMath.r(7))); + } + } + + @EventHandler + public void CustomCreeperExplode(EntityExplodeEvent event) + { + if (!(event.getEntity() instanceof Creeper)) + return; + + HashMap players = UtilPlayer.getInRadius(event.getEntity().getLocation(), 8d); + for (Player cur : players.keySet()) + { + Vector vec = UtilAlg.getTrajectory(event.getEntity().getLocation(), cur.getLocation()); + UtilAction.velocity(cur, vec, 1 + 3 * players.get(cur), false, 0, 1 + 1 * (players.get(cur)), 3, true); + } + } + + public void SetForce(boolean force) + { + _spawnForce = force; + } + + public void AddEntityName(LivingEntity ent, String name) + { + if (ent == null) + return; + + UtilEnt.GetEntityNames().put(ent, name); + } + + @EventHandler + public void UpdateEntityNames(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + HashSet remove = new HashSet(); + + for (Entity ent : UtilEnt.GetEntityNames().keySet()) + if (ent.isDead() || !ent.isValid()) + remove.add(ent); + + for (Entity ent : remove) + UtilEnt.GetEntityNames().remove(ent); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/creature/command/HelpCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/HelpCommand.java new file mode 100644 index 000000000..6a7e25e34 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/HelpCommand.java @@ -0,0 +1,26 @@ +package mineplex.core.creature.command; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.creature.Creature; + +public class HelpCommand extends CommandBase +{ + public HelpCommand(Creature plugin) + { + super(plugin, Rank.ADMIN, "help"); + } + + @Override + public void Execute(Player caller, String[] args) + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Commands List;")); + UtilPlayer.message(caller, F.help("/mob", "List Entities", Rank.MODERATOR)); + UtilPlayer.message(caller, F.help("/mob kill ", "Remove Entities of Type", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/mob (# baby lock angry s# )", "Create", Rank.ADMIN)); + UtilPlayer.message(caller, F.desc("Professions", "Butcher, Blacksmith, Farmer, Librarian, Priest")); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/creature/command/KillCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/KillCommand.java new file mode 100644 index 000000000..a040503f8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/KillCommand.java @@ -0,0 +1,73 @@ +package mineplex.core.creature.command; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.World; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.creature.Creature; +import mineplex.core.creature.event.CreatureKillEntitiesEvent; + +public class KillCommand extends CommandBase +{ + public KillCommand(Creature plugin) + { + super(plugin, Rank.ADMIN, "kill", "k"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args == null || args.length == 0) + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Missing Entity Type Parameter.")); + return; + } + + EntityType type = UtilEnt.searchEntity(caller, args[0], true); + + if (type == null && !args[0].equalsIgnoreCase("all")) + return; + + int count = 0; + List killList = new ArrayList(); + + for (World world : UtilServer.getServer().getWorlds()) + { + for (Entity ent : world.getEntities()) + { + if (ent.getType() == EntityType.PLAYER) + continue; + + if (type == null || ent.getType() == type) + { + killList.add(ent); + } + } + } + + CreatureKillEntitiesEvent event = new CreatureKillEntitiesEvent(killList); + Plugin.GetPlugin().getServer().getPluginManager().callEvent(event); + + for (Entity entity : event.GetEntities()) + { + entity.remove(); + count++; + } + + String target = "ALL"; + if (type != null) + target = UtilEnt.getName(type); + + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Killed " + target + ". " + count + " Removed.")); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java new file mode 100644 index 000000000..6fa540dba --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java @@ -0,0 +1,251 @@ +package mineplex.core.creature.command; + +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.World; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity; +import org.bukkit.entity.Ageable; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.entity.Skeleton.SkeletonType; +import org.bukkit.entity.Slime; +import org.bukkit.entity.Villager; +import org.bukkit.entity.Villager.Profession; +import org.bukkit.entity.Wolf; +import org.bukkit.entity.Zombie; + +import mineplex.core.command.MultiCommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.creature.Creature; + +public class MobCommand extends MultiCommandBase +{ + public MobCommand(Creature plugin) + { + super(plugin, Rank.MODERATOR, "mob"); + + AddCommand(new KillCommand(Plugin)); + } + + @Override + protected void Help(Player caller, String[] args) + { + if (args == null) + { + HashMap entMap = new HashMap(); + + int count = 0; + for (World world : UtilServer.getServer().getWorlds()) + { + for (Entity ent : world.getEntities()) + { + if (!entMap.containsKey(ent.getType())) + entMap.put(ent.getType(), 0); + + entMap.put(ent.getType(), 1 + entMap.get(ent.getType())); + count++; + } + } + + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Listing Entities:")); + for (EntityType cur : entMap.keySet()) + { + UtilPlayer.message(caller, F.desc(UtilEnt.getName(cur), entMap.get(cur)+"")); + } + + UtilPlayer.message(caller, F.desc("Total", count+"")); + } + else + { + EntityType type = UtilEnt.searchEntity(caller, args[0], true); + + if (type == null) + return; + + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Spawning Creature(s);")); + + //Store Args + HashSet argSet = new HashSet(); + for (int i = 1 ; i < args.length ; i++) + if (args[i].length() > 0) + argSet.add(args[i]); + + + //Search Count + int count = 1; + HashSet argHandle = new HashSet(); + for (String arg : argSet) + { + try + { + int newCount = Integer.parseInt(arg); + + if (newCount <= 0) + continue; + + //Set Count + count = newCount; + UtilPlayer.message(caller, F.desc("Amount", count+"")); + + //Flag Arg + argHandle.add(arg); + break; + } + catch (Exception e) + { + //None + } + } + for (String arg : argHandle) + argSet.remove(arg); + + //Spawn + HashSet entSet = new HashSet(); + for (int i = 0 ; i < count ; i++) + { + entSet.add(Plugin.SpawnEntity(caller.getTargetBlock(null, 0).getLocation().add(0.5, 1, 0.5), type)); + } + + //Search Vars + for (String arg : argSet) + { + if (arg.length() == 0) + continue; + + //Baby + else if (arg.equalsIgnoreCase("baby") || arg.equalsIgnoreCase("b")) + { + for (Entity ent : entSet) + { + if (ent instanceof Ageable) + ((Ageable)ent).setBaby(); + else if (ent instanceof Zombie) + ((Zombie)ent).setBaby(true); + } + + UtilPlayer.message(caller, F.desc("Baby", "True")); + argHandle.add(arg); + } + + //Lock + else if (arg.equalsIgnoreCase("age") || arg.equalsIgnoreCase("lock")) + { + for (Entity ent : entSet) + if (ent instanceof Ageable) + { + ((Ageable)ent).setAgeLock(true); + UtilPlayer.message(caller, F.desc("Age", "False")); + } + + argHandle.add(arg); + } + + //Angry + else if (arg.equalsIgnoreCase("angry") || arg.equalsIgnoreCase("a")) + { + for (Entity ent : entSet) + if (ent instanceof Wolf) + ((Wolf)ent).setAngry(true); + + for (Entity ent : entSet) + if (ent instanceof Skeleton) + ((Skeleton)ent).setSkeletonType(SkeletonType.WITHER); + + UtilPlayer.message(caller, F.desc("Angry", "True")); + argHandle.add(arg); + } + + //Profession + else if (arg.toLowerCase().charAt(0) == 'p') + { + try + { + String prof = arg.substring(1, arg.length()); + + Profession profession = null; + for (Profession cur : Profession.values()) + if (cur.name().toLowerCase().contains(prof.toLowerCase())) + profession = cur; + + UtilPlayer.message(caller, F.desc("Profession", profession.name())); + + for (Entity ent : entSet) + if (ent instanceof Villager) + ((Villager)ent).setProfession(profession); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.desc("Profession", "Invalid [" + arg + "] on " + type.name())); + } + argHandle.add(arg); + } + + //Size + else if (arg.toLowerCase().charAt(0) == 's') + { + try + { + String size = arg.substring(1, arg.length()); + + UtilPlayer.message(caller, F.desc("Size", Integer.parseInt(size)+"")); + + for (Entity ent : entSet) + if (ent instanceof Slime) + ((Slime)ent).setSize(Integer.parseInt(size)); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.desc("Size", "Invalid [" + arg + "] on " + type.name())); + } + argHandle.add(arg); + } + + else if (arg.toLowerCase().charAt(0) == 'n' && arg.length() > 1) + { + try + { + String name = ""; + + for (char c : arg.substring(1, arg.length()).toCharArray()) + { + if (c != '_') + name += c; + else + name += " "; + } + + for (Entity ent : entSet) + { + if (ent instanceof CraftLivingEntity) + { + CraftLivingEntity cEnt = (CraftLivingEntity)ent; + cEnt.setCustomName(name); + cEnt.setCustomNameVisible(true); + } + } + } + catch (Exception e) + { + UtilPlayer.message(caller, F.desc("Size", "Invalid [" + arg + "] on " + type.name())); + } + argHandle.add(arg); + } + } + for (String arg : argHandle) + argSet.remove(arg); + + for (String arg : argSet) + UtilPlayer.message(caller, F.desc("Unhandled", arg)); + + //Inform + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Spawned " + count + " " + UtilEnt.getName(type) + ".")); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/creature/event/CreatureKillEntitiesEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/creature/event/CreatureKillEntitiesEvent.java new file mode 100644 index 000000000..fbffc75b5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/creature/event/CreatureKillEntitiesEvent.java @@ -0,0 +1,48 @@ +package mineplex.core.creature.event; + +import java.util.List; + +import org.bukkit.entity.Entity; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class CreatureKillEntitiesEvent extends Event implements Cancellable +{ + private static final HandlerList handlers = new HandlerList(); + private boolean _cancelled = false; + + private List _entities; + + public CreatureKillEntitiesEvent(List entities) + { + _entities = entities; + } + + public List GetEntities() + { + return _entities; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean cancel) + { + _cancelled = cancel; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/creature/event/CreatureSpawnCustomEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/creature/event/CreatureSpawnCustomEvent.java new file mode 100644 index 000000000..95b19fbc7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/creature/event/CreatureSpawnCustomEvent.java @@ -0,0 +1,46 @@ +package mineplex.core.creature.event; + +import org.bukkit.Location; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class CreatureSpawnCustomEvent extends Event implements Cancellable +{ + private static final HandlerList handlers = new HandlerList(); + private boolean _cancelled = false; + + private Location _location; + + public CreatureSpawnCustomEvent(Location location) + { + _location = location; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean cancel) + { + _cancelled = cancel; + } + + public Location GetLocation() + { + return _location; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseFactory.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseFactory.java new file mode 100644 index 000000000..069d4606a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseFactory.java @@ -0,0 +1,13 @@ +package mineplex.core.disguise; + +import org.bukkit.entity.Entity; + +import mineplex.core.disguise.disguises.*; + +public class DisguiseFactory +{ + protected DisguiseZombie DisguiseZombie(Entity entity) + { + return new DisguiseZombie(entity); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java new file mode 100644 index 000000000..f47d3ac52 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java @@ -0,0 +1,336 @@ +package mineplex.core.disguise; + +import java.lang.reflect.Field; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map.Entry; + +import net.minecraft.server.v1_6_R2.ChunkAddEntityEvent; +import net.minecraft.server.v1_6_R2.EntityPlayer; +import net.minecraft.server.v1_6_R2.Packet; +import net.minecraft.server.v1_6_R2.Packet20NamedEntitySpawn; +import net.minecraft.server.v1_6_R2.Packet24MobSpawn; +import net.minecraft.server.v1_6_R2.Packet28EntityVelocity; +import net.minecraft.server.v1_6_R2.Packet29DestroyEntity; +import net.minecraft.server.v1_6_R2.Packet31RelEntityMove; +import net.minecraft.server.v1_6_R2.Packet40EntityMetadata; +import net.minecraft.server.v1_6_R2.Packet62NamedSoundEffect; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.world.ChunkUnloadEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilMath; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.packethandler.IPacketRunnable; +import mineplex.core.packethandler.PacketArrayList; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class DisguiseManager extends MiniPlugin implements IPacketRunnable +{ + private NautHashMap _spawnPacketMap = new NautHashMap(); + private NautHashMap _movePacketMap = new NautHashMap(); + private NautHashMap _moveTempMap = new NautHashMap(); + private NautHashMap _entityDisguiseMap = new NautHashMap(); + private NautHashMap _addTempList = new NautHashMap(); + private HashSet _delTempList = new HashSet(); + + private Field _soundB; + private Field _soundC; + private Field _soundD; + + private int _tickCount = 0; + + public DisguiseManager(JavaPlugin plugin, PacketHandler packetHandler) + { + super("Disguise Manager", plugin); + + packetHandler.AddPacketRunnable(this); + + try + { + _soundB = Packet62NamedSoundEffect.class.getDeclaredField("b"); + _soundB.setAccessible(true); + _soundC = Packet62NamedSoundEffect.class.getDeclaredField("c"); + _soundC.setAccessible(true); + _soundD = Packet62NamedSoundEffect.class.getDeclaredField("d"); + _soundD.setAccessible(true); + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (NoSuchFieldException e) + { + e.printStackTrace(); + } + catch (SecurityException e) + { + e.printStackTrace(); + } + } + + public void Disguise(DisguiseBase disguise) + { + for (Player player : Bukkit.getOnlinePlayers()) + { + if (disguise.GetEntity() == ((CraftPlayer)player).getHandle()) + continue; + + EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle(); + entityPlayer.playerConnection.sendPacket(new Packet29DestroyEntity(disguise.GetEntityId())); + entityPlayer.playerConnection.sendPacket(disguise.GetSpawnPacket()); + } + + _spawnPacketMap.put(disguise.GetEntityId(), disguise); + } + + public void Undisguise(LivingEntity entity) + { + if (!_spawnPacketMap.containsKey(entity.getEntityId())) + return; + + for (Player player : Bukkit.getOnlinePlayers()) + { + if (entity == player) + continue; + + EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle(); + entityPlayer.playerConnection.sendPacket(new Packet29DestroyEntity(entity.getEntityId())); + + if (entity instanceof Player) + { + player.showPlayer((Player)entity); + } + else + { + entityPlayer.playerConnection.sendPacket(new Packet24MobSpawn(((CraftLivingEntity)entity).getHandle())); + } + } + + _spawnPacketMap.remove(entity.getEntityId()); + _movePacketMap.remove(entity.getEntityId()); + _moveTempMap.remove(entity.getEntityId()); + } + + @EventHandler + public void ChunkUnload(ChunkUnloadEvent event) + { + for (Entity entity : event.getChunk().getEntities()) + { + Iterator> spawnPacketMapIterator = _spawnPacketMap.entrySet().iterator(); + while (spawnPacketMapIterator.hasNext()) + { + Entry entry = spawnPacketMapIterator.next(); + + if (entity.getEntityId() == entry.getValue().GetEntityId()) + { + _entityDisguiseMap.put(entity.getUniqueId().toString(), entry.getValue()); + spawnPacketMapIterator.remove(); + } + } + } + } + + @EventHandler + public void ChunkAddEntity(ChunkAddEntityEvent event) + { + DisguiseBase disguise = _entityDisguiseMap.get(event.GetEntity().getUniqueId().toString()); + + if (disguise != null) + { + disguise.UpdateEntity(((CraftLivingEntity)event.GetEntity()).getHandle()); + _spawnPacketMap.put(event.GetEntity().getEntityId(), disguise); + _entityDisguiseMap.remove(event.GetEntity().getUniqueId().toString()); + } + } + + @EventHandler + public void TeleportDisguises(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + _tickCount++; + + _tickCount %= 20; + + for (Player player : Bukkit.getOnlinePlayers()) + { + for (Player otherPlayer : Bukkit.getOnlinePlayers()) + { + if (otherPlayer.getLocation().subtract(0, .5, 0).getBlock().getTypeId() == 0) + { + if (_moveTempMap.containsKey(otherPlayer.getEntityId())) + { + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(_moveTempMap.get(otherPlayer.getEntityId())); + System.out.println("Sending buffer packet for (" + otherPlayer.getEntityId() + ") at " + _tickCount + " ticks"); + } + + System.out.println("Player in the air."); + //((CraftPlayer)player).getHandle().playerConnection.sendPacket(new Packet34EntityTeleport(((CraftPlayer)otherPlayer).getHandle())); + } + } + } + + for (Player otherPlayer : Bukkit.getOnlinePlayers()) + { + if (_moveTempMap.containsKey(otherPlayer.getEntityId())) + { + _moveTempMap.remove(otherPlayer.getEntityId()); + System.out.println("Cleared buffer packet for (" + otherPlayer.getEntityId() + ") at " + _tickCount + " ticks"); + } + } + } + + @EventHandler + public void PlayerQuit(PlayerQuitEvent event) + { + Undisguise(event.getPlayer()); + } + + @Override + public boolean run(Packet packet, Player owner, PacketArrayList packetList) + { + if (packet instanceof Packet20NamedEntitySpawn) + { + int entityId = ((Packet20NamedEntitySpawn)packet).a; + + if (_spawnPacketMap.containsKey(entityId)) + { + packetList.forceAdd(_spawnPacketMap.get(entityId).GetSpawnPacket()); + return false; + } + } + else if (packet instanceof Packet24MobSpawn) + { + int entityId = ((Packet24MobSpawn)packet).a; + + if (_spawnPacketMap.containsKey(entityId)) + { + packetList.forceAdd(_spawnPacketMap.get(entityId).GetSpawnPacket()); + return false; + } + } + else if (packet instanceof Packet40EntityMetadata) + { + int entityId = ((Packet40EntityMetadata)packet).a; + + if (_spawnPacketMap.containsKey(entityId) && owner.getEntityId() != entityId) + { + packetList.forceAdd(_spawnPacketMap.get(entityId).GetMetaDataPacket()); + return false; + } + } + if (packet instanceof Packet31RelEntityMove) + { + final Packet31RelEntityMove movePacket = (Packet31RelEntityMove)packet; + + // Only for viewers + if (movePacket.a == owner.getEntityId()) + return true; + + if (movePacket.b + movePacket.c + movePacket.d == 0) + { + _movePacketMap.remove(movePacket.a); + return true; + } + + final Packet28EntityVelocity velocityPacket = new Packet28EntityVelocity(); + velocityPacket.a = movePacket.a; + velocityPacket.b = movePacket.b * 100; + velocityPacket.c = movePacket.c * 100; + velocityPacket.d = movePacket.d * 100; + + packetList.forceAdd(velocityPacket); + + boolean goingUp = false; + int lastX = velocityPacket.b; + int lastY = velocityPacket.c; + int lastZ = velocityPacket.d; + + if (_movePacketMap.containsKey(movePacket.a)) + { + Packet28EntityVelocity lastVelocityPacket = _movePacketMap.get(movePacket.a); + + lastX = lastVelocityPacket.b; + lastY = lastVelocityPacket.c; + lastZ = lastVelocityPacket.d; + } + + if (lastY < velocityPacket.c) + goingUp = true; + + _movePacketMap.put(movePacket.a, velocityPacket); + + velocityPacket.b = lastX == 0 ? 0 : velocityPacket.b * (velocityPacket.b / lastX); + velocityPacket.c = lastY == 0 ? 0 : velocityPacket.c * (velocityPacket.c / lastY); + velocityPacket.d = lastZ == 0 ? 0 : velocityPacket.d * (velocityPacket.d / lastZ); + + if (goingUp) + { + Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable() + { + public void run() + { + if (!_moveTempMap.containsKey(movePacket.a)) + { + _moveTempMap.put(movePacket.a, velocityPacket); + System.out.println("Added buffer velocity packet for (" + movePacket.a + ") : (" + velocityPacket.b + ", " + velocityPacket.c + ", " + velocityPacket.d + ") at " + _tickCount + " ticks"); + } + } + }); + } + } + else if (packet instanceof Packet62NamedSoundEffect) + { + try + { + int x = (int) _soundB.get((Packet62NamedSoundEffect)packet) / 8; + int y = (int) _soundC.get((Packet62NamedSoundEffect)packet) / 8; + int z = (int) _soundD.get((Packet62NamedSoundEffect)packet) / 8; + + for (DisguiseBase disguise : _spawnPacketMap.values()) + { + if (!(disguise instanceof DisguisePlayer)) + continue; + + if (UtilMath.offset(new Vector(disguise.GetEntity().locX, disguise.GetEntity().locY, disguise.GetEntity().locZ), new Vector(x, y, z)) <= 2) + { + return false; + } + } + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + } + + return true; + } + + public void PrepAddDisguise(Player caller, EntityType entityType) + { + _addTempList.put(caller.getName(), entityType); + } + + public void PrepRemoveDisguise(Player caller) + { + _delTempList.add(caller.getName()); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguisePacketTracker.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguisePacketTracker.java new file mode 100644 index 000000000..25dc0103b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguisePacketTracker.java @@ -0,0 +1,20 @@ +package mineplex.core.disguise; + +import mineplex.core.packethandler.PacketArrayList; +import net.minecraft.server.v1_6_R2.Packet; + +import org.bukkit.entity.Player; + +public class DisguisePacketTracker +{ + public Packet Packet; + public Player Owner; + public PacketArrayList PacketList; + + public DisguisePacketTracker(Packet packet, Player owner, PacketArrayList packetList) + { + Packet = packet; + Owner = owner; + PacketList = packetList; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseType.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseType.java new file mode 100644 index 000000000..313ab0b89 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseType.java @@ -0,0 +1,20 @@ +package mineplex.core.disguise; + +public enum DisguiseType +{ + Zombie, + PigZombie, + Cow, + Pig, + Horse, + Wolf, + Ocelot, + Sheep, + Chicken, + Slime, + Blaze, + IronGolem, + Skeleton, + WitherSkeleton, + Wither +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAgeable.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAgeable.java new file mode 100644 index 000000000..3f17454fd --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAgeable.java @@ -0,0 +1,9 @@ +package mineplex.core.disguise.disguises; + +public abstract class DisguiseAgeable extends DisguiseCreature +{ + public DisguiseAgeable(org.bukkit.entity.Entity entity) + { + super(entity); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAmbient.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAmbient.java new file mode 100644 index 000000000..547787e0d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAmbient.java @@ -0,0 +1,9 @@ +package mineplex.core.disguise.disguises; + +public abstract class DisguiseAmbient extends DisguiseInsentient +{ + public DisguiseAmbient(org.bukkit.entity.Entity entity) + { + super(entity); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAnimal.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAnimal.java new file mode 100644 index 000000000..75c0b2770 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAnimal.java @@ -0,0 +1,9 @@ +package mineplex.core.disguise.disguises; + +public abstract class DisguiseAnimal extends DisguiseAgeable +{ + public DisguiseAnimal(org.bukkit.entity.Entity entity) + { + super(entity); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java new file mode 100644 index 000000000..d797d84d6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java @@ -0,0 +1,52 @@ +package mineplex.core.disguise.disguises; + +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity; + +import net.minecraft.server.v1_6_R2.DataWatcher; +import net.minecraft.server.v1_6_R2.Entity; +import net.minecraft.server.v1_6_R2.Packet; +import net.minecraft.server.v1_6_R2.Packet40EntityMetadata; + +public abstract class DisguiseBase +{ + protected Entity Entity; + protected DataWatcher DataWatcher; + + public DisguiseBase(org.bukkit.entity.Entity entity) + { + Entity = ((CraftEntity)entity).getHandle(); + DataWatcher = new DataWatcher(); + + DataWatcher.a(0, Byte.valueOf((byte)0)); + DataWatcher.a(1, Short.valueOf((short)300)); + } + + public void UpdateDataWatcher() + { + DataWatcher.watch(0, Entity.getDataWatcher().getByte(0)); + DataWatcher.watch(1, Entity.getDataWatcher().getShort(1)); + } + + public abstract Packet GetSpawnPacket(); + + public Packet GetMetaDataPacket() + { + UpdateDataWatcher(); + return new Packet40EntityMetadata(Entity.id, DataWatcher, true); + } + + public void UpdateEntity(Entity entity) + { + Entity = entity; + } + + public Entity GetEntity() + { + return Entity; + } + + public int GetEntityId() + { + return Entity.id; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBat.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBat.java new file mode 100644 index 000000000..17d6bcfea --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBat.java @@ -0,0 +1,18 @@ +package mineplex.core.disguise.disguises; + +import net.minecraft.server.v1_6_R2.Packet; + +public class DisguiseBat extends DisguiseAmbient +{ + public DisguiseBat(org.bukkit.entity.Entity entity) + { + super(entity); + } + + @Override + public Packet GetSpawnPacket() + { + // TODO Auto-generated method stub + return null; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlaze.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlaze.java new file mode 100644 index 000000000..d3e50d624 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlaze.java @@ -0,0 +1,34 @@ +package mineplex.core.disguise.disguises; + +public class DisguiseBlaze extends DisguiseMonster +{ + public DisguiseBlaze(org.bukkit.entity.Entity entity) + { + super(entity); + + DataWatcher.a(16, new Byte((byte)0)); + } + + @Override + protected int GetEntityTypeId() + { + return 61; + } + + public boolean bT() + { + return (DataWatcher.getByte(16) & 0x01) != 0; + } + + public void a(boolean flag) + { + byte b0 = DataWatcher.getByte(16); + + if (flag) + b0 = (byte)(b0 | 0x1); + else + b0 = (byte)(b0 | 0xFFFFFFFE); + + DataWatcher.watch(16, Byte.valueOf(b0)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseChicken.java new file mode 100644 index 000000000..66e4d3c0f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseChicken.java @@ -0,0 +1,15 @@ +package mineplex.core.disguise.disguises; + +public class DisguiseChicken extends DisguiseAnimal +{ + public DisguiseChicken(org.bukkit.entity.Entity entity) + { + super(entity); + } + + @Override + protected int GetEntityTypeId() + { + return 93; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java new file mode 100644 index 000000000..1af332b57 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java @@ -0,0 +1,144 @@ +package mineplex.core.disguise.disguises; + +import java.lang.reflect.Field; + +import net.minecraft.server.v1_6_R2.EnumEntitySize; +import net.minecraft.server.v1_6_R2.MathHelper; +import net.minecraft.server.v1_6_R2.Packet; +import net.minecraft.server.v1_6_R2.Packet24MobSpawn; + +public abstract class DisguiseCreature extends DisguiseInsentient +{ + private static Field _spawnDataWatcherField; + private static Field _spawnListField; + + public DisguiseCreature(org.bukkit.entity.Entity entity) + { + super(entity); + + SetSpawnDataWatcherField(); + SetSpawnListField(); + } + + protected abstract int GetEntityTypeId(); + + public Packet GetSpawnPacket() + { + Packet24MobSpawn packet = new Packet24MobSpawn(); + packet.a = Entity.id; + packet.b = (byte) GetEntityTypeId(); + packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX); + packet.d = (int)MathHelper.floor(Entity.locY * 32.0D); + packet.e = (int)EnumEntitySize.SIZE_2.a(Entity.locZ); + packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); + packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F)); + packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); + + double var2 = 3.9D; + double var4 = 0; + double var6 = 0; + double var8 = 0; + + if (var4 < -var2) + { + var4 = -var2; + } + + if (var6 < -var2) + { + var6 = -var2; + } + + if (var8 < -var2) + { + var8 = -var2; + } + + if (var4 > var2) + { + var4 = var2; + } + + if (var6 > var2) + { + var6 = var2; + } + + if (var8 > var2) + { + var8 = var2; + } + + packet.f = (int)(var4 * 8000.0D); + packet.g = (int)(var6 * 8000.0D); + packet.h = (int)(var8 * 8000.0D); + + try + { + _spawnDataWatcherField.set(packet, DataWatcher); + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + + try + { + _spawnListField.set(packet, DataWatcher.b()); + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + + return packet; + } + + private void SetSpawnListField() + { + if (_spawnListField == null) + { + try + { + _spawnListField = Packet24MobSpawn.class.getDeclaredField("u"); + _spawnListField.setAccessible(true); + } + catch (NoSuchFieldException e) + { + e.printStackTrace(); + } + catch (SecurityException e) + { + e.printStackTrace(); + } + } + } + + private void SetSpawnDataWatcherField() + { + if (_spawnDataWatcherField == null) + { + try + { + _spawnDataWatcherField = Packet24MobSpawn.class.getDeclaredField("t"); + _spawnDataWatcherField.setAccessible(true); + } + catch (NoSuchFieldException e) + { + e.printStackTrace(); + } + catch (SecurityException e) + { + e.printStackTrace(); + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreeper.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreeper.java new file mode 100644 index 000000000..3666a6aeb --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreeper.java @@ -0,0 +1,38 @@ +package mineplex.core.disguise.disguises; + +public class DisguiseCreeper extends DisguiseMonster +{ + public DisguiseCreeper(org.bukkit.entity.Entity entity) + { + super(entity); + + DataWatcher.a(16, Byte.valueOf((byte)-1)); + DataWatcher.a(17, Byte.valueOf((byte)0)); + } + + @Override + protected int GetEntityTypeId() + { + return 50; + } + + public boolean IsPowered() + { + return DataWatcher.getByte(17) == 1; + } + + public void SetPowered(boolean powered) + { + DataWatcher.watch(17, Byte.valueOf((byte)(powered ? 1 : 0))); + } + + public int bV() + { + return DataWatcher.getByte(16); + } + + public void a(int i) + { + DataWatcher.watch(16, Byte.valueOf((byte)i)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java new file mode 100644 index 000000000..a50568756 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java @@ -0,0 +1,49 @@ +package mineplex.core.disguise.disguises; + +public class DisguiseEnderman extends DisguiseMonster +{ + public DisguiseEnderman(org.bukkit.entity.Entity entity) + { + super(entity); + + DataWatcher.a(16, new Byte((byte)0)); + DataWatcher.a(17, new Byte((byte)0)); + DataWatcher.a(18, new Byte((byte)0)); + } + + public void SetCarriedId(int i) + { + DataWatcher.watch(16, Byte.valueOf((byte)(i & 0xFF))); + } + + public int GetCarriedId() + { + return DataWatcher.getByte(16); + } + + public void SetCarriedData(int i) + { + DataWatcher.watch(17, Byte.valueOf((byte)(i & 0xFF))); + } + + public int GetCarriedData() + { + return DataWatcher.getByte(17); + } + + public boolean bX() + { + return DataWatcher.getByte(18) > 0; + } + + public void a(boolean flag) + { + DataWatcher.watch(18, Byte.valueOf((byte)(flag ? 1 : 0))); + } + + @Override + protected int GetEntityTypeId() + { + return 58; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseGolem.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseGolem.java new file mode 100644 index 000000000..65e0ce28f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseGolem.java @@ -0,0 +1,9 @@ +package mineplex.core.disguise.disguises; + +public abstract class DisguiseGolem extends DisguiseCreature +{ + public DisguiseGolem(org.bukkit.entity.Entity entity) + { + super(entity); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseHuman.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseHuman.java new file mode 100644 index 000000000..e265d8ca0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseHuman.java @@ -0,0 +1,13 @@ +package mineplex.core.disguise.disguises; + +public abstract class DisguiseHuman extends DisguiseLiving +{ + public DisguiseHuman(org.bukkit.entity.Entity entity) + { + super(entity); + + DataWatcher.a(16, Byte.valueOf((byte)0)); + DataWatcher.a(17, Float.valueOf(0.0F)); + DataWatcher.a(18, Integer.valueOf(0)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java new file mode 100644 index 000000000..d16473133 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java @@ -0,0 +1,32 @@ +package mineplex.core.disguise.disguises; + +public abstract class DisguiseInsentient extends DisguiseLiving +{ + public DisguiseInsentient(org.bukkit.entity.Entity entity) + { + super(entity); + + DataWatcher.a(11, Byte.valueOf((byte)0)); + DataWatcher.a(10, ""); + } + + public void SetName(String name) + { + DataWatcher.watch(10, name); + } + + public boolean HasCustomName() + { + return DataWatcher.getString(10).length() > 0; + } + + public void SetCustomNameVisible(boolean visible) + { + DataWatcher.watch(11, Byte.valueOf((byte)(visible ? 1 : 0))); + } + + public boolean GetCustomNameVisible() + { + return DataWatcher.getByte(11) == 1; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseIronGolem.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseIronGolem.java new file mode 100644 index 000000000..0e849767c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseIronGolem.java @@ -0,0 +1,32 @@ +package mineplex.core.disguise.disguises; + +public class DisguiseIronGolem extends DisguiseGolem +{ + public DisguiseIronGolem(org.bukkit.entity.Entity entity) + { + super(entity); + + DataWatcher.a(16, Byte.valueOf((byte)0)); + } + + @Override + protected int GetEntityTypeId() + { + return 99; + } + + public boolean bW() + { + return (DataWatcher.getByte(16) & 0x1) != 0; + } + + public void setPlayerCreated(boolean flag) + { + byte b0 = DataWatcher.getByte(16); + + if (flag) + DataWatcher.watch(16, Byte.valueOf((byte)(b0 | 0x1))); + else + DataWatcher.watch(16, Byte.valueOf((byte)(b0 & 0xFFFFFFFE))); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseLiving.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseLiving.java new file mode 100644 index 000000000..42f8695ba --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseLiving.java @@ -0,0 +1,24 @@ +package mineplex.core.disguise.disguises; + +public abstract class DisguiseLiving extends DisguiseBase +{ + public DisguiseLiving(org.bukkit.entity.Entity entity) + { + super(entity); + + DataWatcher.a(6, Float.valueOf(1.0F)); + DataWatcher.a(7, Integer.valueOf(0)); + DataWatcher.a(8, Byte.valueOf((byte)0)); + DataWatcher.a(9, Byte.valueOf((byte)0)); + } + + public void UpdateDataWatcher() + { + super.UpdateDataWatcher(); + + DataWatcher.watch(6, Entity.getDataWatcher().getFloat(6)); + DataWatcher.watch(7, Entity.getDataWatcher().getInt(7)); + DataWatcher.watch(8, Entity.getDataWatcher().getByte(8)); + DataWatcher.watch(9, Entity.getDataWatcher().getByte(9)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMonster.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMonster.java new file mode 100644 index 000000000..35a4974a7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMonster.java @@ -0,0 +1,9 @@ +package mineplex.core.disguise.disguises; + +public abstract class DisguiseMonster extends DisguiseCreature +{ + public DisguiseMonster(org.bukkit.entity.Entity entity) + { + super(entity); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePigZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePigZombie.java new file mode 100644 index 000000000..a98b272de --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePigZombie.java @@ -0,0 +1,15 @@ +package mineplex.core.disguise.disguises; + +public class DisguisePigZombie extends DisguiseZombie +{ + public DisguisePigZombie(org.bukkit.entity.Entity entity) + { + super(entity); + } + + @Override + public int GetEntityTypeId() + { + return 57; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java new file mode 100644 index 000000000..fa1b3c3ad --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java @@ -0,0 +1,76 @@ +package mineplex.core.disguise.disguises; + +import java.lang.reflect.Field; + +import net.minecraft.server.v1_6_R2.MathHelper; +import net.minecraft.server.v1_6_R2.Packet; +import net.minecraft.server.v1_6_R2.Packet20NamedEntitySpawn; + +public class DisguisePlayer extends DisguiseHuman +{ + private static Field _spawnDataWatcherField; + + private String _name; + + public DisguisePlayer(org.bukkit.entity.Entity entity, String name) + { + super(entity); + + if (name.length() > 16) + { + name = name.substring(0, 16); + } + + _name = name; + + SetSpawnDataWatcherField(); + } + + @Override + public Packet GetSpawnPacket() + { + Packet20NamedEntitySpawn packet = new Packet20NamedEntitySpawn(); + packet.a = Entity.id; + packet.b = _name; + packet.c = MathHelper.floor(Entity.locX * 32.0D); + packet.d = MathHelper.floor(Entity.locY * 32.0D); + packet.e = MathHelper.floor(Entity.locZ * 32.0D); + packet.f = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); + packet.g = (byte) ((int) (Entity.pitch * 256.0F / 360.0F)); + + try + { + _spawnDataWatcherField.set(packet, DataWatcher); + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + + return packet; + } + + private void SetSpawnDataWatcherField() + { + if (_spawnDataWatcherField == null) + { + try + { + _spawnDataWatcherField = Packet20NamedEntitySpawn.class.getDeclaredField("i"); + _spawnDataWatcherField.setAccessible(true); + } + catch (NoSuchFieldException e) + { + e.printStackTrace(); + } + catch (SecurityException e) + { + e.printStackTrace(); + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSkeleton.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSkeleton.java new file mode 100644 index 000000000..81fe8d11b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSkeleton.java @@ -0,0 +1,29 @@ +package mineplex.core.disguise.disguises; + +import org.bukkit.entity.Skeleton.SkeletonType; + +public class DisguiseSkeleton extends DisguiseMonster +{ + public DisguiseSkeleton(org.bukkit.entity.Entity entity) + { + super(entity); + + DataWatcher.a(13, Byte.valueOf((byte)0)); + } + + @Override + protected int GetEntityTypeId() + { + return 51; + } + + public void SetSkeletonType(SkeletonType skeletonType) + { + DataWatcher.watch(13, Byte.valueOf((byte)skeletonType.getId())); + } + + public int GetSkeletonType() + { + return DataWatcher.getByte(13); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java new file mode 100644 index 000000000..14f57e58a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java @@ -0,0 +1,154 @@ +package mineplex.core.disguise.disguises; + +import java.lang.reflect.Field; + +import net.minecraft.server.v1_6_R2.EnumEntitySize; +import net.minecraft.server.v1_6_R2.MathHelper; +import net.minecraft.server.v1_6_R2.Packet; +import net.minecraft.server.v1_6_R2.Packet24MobSpawn; + +public class DisguiseSlime extends DisguiseInsentient +{ + private static Field _spawnDataWatcherField; + private static Field _spawnListField; + + public DisguiseSlime(org.bukkit.entity.Entity entity) + { + super(entity); + + DataWatcher.a(16, new Byte((byte)1)); + + SetSpawnDataWatcherField(); + SetSpawnListField(); + } + + public void SetSize(int i) + { + DataWatcher.watch(16, new Byte((byte)i)); + } + + public int GetSize() + { + return DataWatcher.getByte(16); + } + + public Packet GetSpawnPacket() + { + Packet24MobSpawn packet = new Packet24MobSpawn(); + packet.a = Entity.id; + packet.b = (byte) 55; + packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX); + packet.d = (int)MathHelper.floor(Entity.locY * 32.0D); + packet.e = (int)EnumEntitySize.SIZE_2.a(Entity.locZ); + packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); + packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F)); + packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); + + double var2 = 3.9D; + double var4 = 0; + double var6 = 0; + double var8 = 0; + + if (var4 < -var2) + { + var4 = -var2; + } + + if (var6 < -var2) + { + var6 = -var2; + } + + if (var8 < -var2) + { + var8 = -var2; + } + + if (var4 > var2) + { + var4 = var2; + } + + if (var6 > var2) + { + var6 = var2; + } + + if (var8 > var2) + { + var8 = var2; + } + + packet.f = (int)(var4 * 8000.0D); + packet.g = (int)(var6 * 8000.0D); + packet.h = (int)(var8 * 8000.0D); + + try + { + _spawnDataWatcherField.set(packet, DataWatcher); + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + + try + { + _spawnListField.set(packet, DataWatcher.b()); + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + + return packet; + } + + private void SetSpawnListField() + { + if (_spawnListField == null) + { + try + { + _spawnListField = Packet24MobSpawn.class.getDeclaredField("u"); + _spawnListField.setAccessible(true); + } + catch (NoSuchFieldException e) + { + e.printStackTrace(); + } + catch (SecurityException e) + { + e.printStackTrace(); + } + } + } + + private void SetSpawnDataWatcherField() + { + if (_spawnDataWatcherField == null) + { + try + { + _spawnDataWatcherField = Packet24MobSpawn.class.getDeclaredField("t"); + _spawnDataWatcherField.setAccessible(true); + } + catch (NoSuchFieldException e) + { + e.printStackTrace(); + } + catch (SecurityException e) + { + e.printStackTrace(); + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSnowman.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSnowman.java new file mode 100644 index 000000000..2238a6923 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSnowman.java @@ -0,0 +1,15 @@ +package mineplex.core.disguise.disguises; + +public class DisguiseSnowman extends DisguiseGolem +{ + public DisguiseSnowman(org.bukkit.entity.Entity entity) + { + super(entity); + } + + @Override + protected int GetEntityTypeId() + { + return 97; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSpider.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSpider.java new file mode 100644 index 000000000..aaf23c1eb --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSpider.java @@ -0,0 +1,34 @@ +package mineplex.core.disguise.disguises; + +public class DisguiseSpider extends DisguiseMonster +{ + public DisguiseSpider(org.bukkit.entity.Entity entity) + { + super(entity); + + DataWatcher.a(16, new Byte((byte)0)); + } + + public boolean bT() + { + return (DataWatcher.getByte(16) & 0x01) != 0; + } + + public void a(boolean flag) + { + byte b0 = DataWatcher.getByte(16); + + if (flag) + b0 = (byte)(b0 | 0x1); + else + b0 = (byte)(b0 & 0xFFFFFFFE); + + DataWatcher.watch(16, Byte.valueOf(b0)); + } + + @Override + protected int GetEntityTypeId() + { + return 52; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseZombie.java new file mode 100644 index 000000000..bdc49a6f7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseZombie.java @@ -0,0 +1,41 @@ +package mineplex.core.disguise.disguises; + +import org.bukkit.entity.Entity; + +public class DisguiseZombie extends DisguiseMonster +{ + public DisguiseZombie(Entity entity) + { + super(entity); + + DataWatcher.a(12, Byte.valueOf((byte)0)); + DataWatcher.a(13, Byte.valueOf((byte)0)); + DataWatcher.a(14, Byte.valueOf((byte)0)); + } + + @Override + protected int GetEntityTypeId() + { + return 54; + } + + public boolean IsBaby() + { + return DataWatcher.getByte(12) == 1; + } + + public void SetBaby(boolean baby) + { + DataWatcher.watch(12, Byte.valueOf((byte)(baby ? 1 : 0))); + } + + public boolean IsVillager() + { + return DataWatcher.getByte(13) == 1; + } + + public void SetVillager(boolean villager) + { + DataWatcher.watch(13, Byte.valueOf((byte)(villager ? 1 : 0))); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java new file mode 100644 index 000000000..5dde74ff1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java @@ -0,0 +1,138 @@ +package mineplex.core.donation; + +import mineplex.core.account.event.ClientUnloadEvent; +import mineplex.core.account.event.ClientWebResponseEvent; +import mineplex.core.common.CurrencyType; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.donation.repository.DonationRepository; +import mineplex.core.donation.repository.token.DonorTokenWrapper; +import mineplex.core.donation.repository.token.PlayerUpdateToken; +import mineplex.core.server.util.TransactionResponse; + +import org.bukkit.craftbukkit.libs.com.google.gson.Gson; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; + +public class DonationManager implements Listener +{ + private JavaPlugin _plugin; + private DonationRepository _repository; + + private NautHashMap _donors; + + private Object _donorLock = new Object(); + + public DonationManager(JavaPlugin plugin, String webAddress) + { + _plugin = plugin; + _repository = new DonationRepository(webAddress); + + _donors = new NautHashMap(); + + _plugin.getServer().getPluginManager().registerEvents(this, _plugin); + } + + @EventHandler + public void OnClientWebResponse(ClientWebResponseEvent event) + { + DonorTokenWrapper token = new Gson().fromJson(event.GetResponse(), DonorTokenWrapper.class); + LoadDonor(token); + } + + @EventHandler + public void UnloadDonor(ClientUnloadEvent event) + { + synchronized (_donorLock) + { + _donors.remove(event.GetName()); + } + } + + private void LoadDonor(DonorTokenWrapper token) + { + synchronized (_donorLock) + { + _donors.put(token.Name, new Donor(token.DonorToken)); + } + } + + public Donor Get(String name) + { + synchronized (_donorLock) + { + return _donors.get(name); + } + } + + public void PurchaseUnknownSalesPackage(final Callback callback, final String name, final String packageName, final int gemCost, boolean oneTimePurchase) + { + Donor donor = Get(name); + + if (donor != null) + { + if (oneTimePurchase && donor.OwnsUnknownPackage(packageName)) + { + callback.run(TransactionResponse.AlreadyOwns); + return; + } + } + + _repository.PurchaseUnknownSalesPackage(new Callback() + { + public void run(TransactionResponse response) + { + if (response == TransactionResponse.Success) + { + Donor donor = Get(name); + + if (donor != null) + { + donor.AddUnknownSalesPackagesOwned(packageName); + donor.DeductCost(gemCost, CurrencyType.Gems); + } + } + + callback.run(response); + } + }, name, packageName, gemCost); + } + + public void PurchaseKnownSalesPackage(final Callback callback, final String name, final int salesPackageId) + { + _repository.PurchaseKnownSalesPackage(new Callback() + { + public void run(TransactionResponse response) + { + if (response == TransactionResponse.Success) + { + Donor donor = Get(name); + + if (donor != null) + { + donor.AddSalesPackagesOwned(salesPackageId); + } + } + + callback.run(response); + } + }, name, salesPackageId); + } + + public void RewardGems(final String name, final int greenGems) + { + _repository.PlayerUpdate(new Callback() + { + public void run(PlayerUpdateToken token) + { + Donor donor = Get(name); + + if (donor != null) + { + donor.AddGems(greenGems); + } + } + }, name, greenGems); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/Donor.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/Donor.java new file mode 100644 index 000000000..d72609522 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/Donor.java @@ -0,0 +1,107 @@ +package mineplex.core.donation; + +import java.util.ArrayList; +import java.util.List; + +import mineplex.core.common.CurrencyType; +import mineplex.core.donation.repository.token.DonorToken; + +public class Donor +{ + private int _gems; + private boolean _donated; + private List _salesPackagesOwned; + private List _unknownSalesPackagesOwned; + + private boolean _update = true; + + public Donor(DonorToken token) + { + _gems = token.Gems; + _donated = token.Donated; + + _salesPackagesOwned = token.SalesPackages; + _unknownSalesPackagesOwned = token.UnknownSalesPackages; + + if (_salesPackagesOwned == null) + { + _salesPackagesOwned = new ArrayList(); + } + + if (_unknownSalesPackagesOwned == null) + { + _unknownSalesPackagesOwned = new ArrayList(); + } + } + + public int GetGems() + { + return _gems; + } + + public List GetSalesPackagesOwned() + { + return _salesPackagesOwned; + } + + public boolean Owns(Integer salesPackageId) + { + return salesPackageId == -1 || _salesPackagesOwned.contains(salesPackageId); + } + + public void AddSalesPackagesOwned(int salesPackageId) + { + _salesPackagesOwned.add(salesPackageId); + } + + public boolean HasDonated() + { + return _donated; + } + + public void DeductCost(int cost, CurrencyType currencyType) + { + switch (currencyType) + { + case Gems: + _gems -= cost; + _update = true; + break; + default: + break; + } + } + + public int GetBalance(CurrencyType currencyType) + { + switch (currencyType) + { + case Gems: + return _gems; + case Tokens: + return 0; + default: + return 0; + } + } + + public void AddGems(int gems) + { + _gems += gems; + } + + public boolean OwnsUnknownPackage(String packageName) + { + return _unknownSalesPackagesOwned.contains(packageName); + } + + public boolean Updated() + { + return _update; + } + + public void AddUnknownSalesPackagesOwned(String packageName) + { + _unknownSalesPackagesOwned.add(packageName); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java new file mode 100644 index 000000000..4c667b0d5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java @@ -0,0 +1,47 @@ +package mineplex.core.donation.repository; + +import mineplex.core.common.util.Callback; +import mineplex.core.donation.repository.token.PlayerUpdateToken; +import mineplex.core.donation.repository.token.PurchaseToken; +import mineplex.core.donation.repository.token.UnknownPurchaseToken; +import mineplex.core.server.remotecall.AsyncJsonWebCall; +import mineplex.core.server.util.TransactionResponse; + +public class DonationRepository +{ + private String _webAddress; + + public DonationRepository(String webAddress) + { + _webAddress = webAddress; + } + + public void PurchaseKnownSalesPackage(Callback callback, String name, int salesPackageId) + { + PurchaseToken token = new PurchaseToken(); + token.AccountName = name; + token.UsingCredits = false; + token.SalesPackageId = salesPackageId; + + new AsyncJsonWebCall(_webAddress + "PlayerAccount/PurchaseKnownSalesPackage").Execute(TransactionResponse.class, callback, token); + } + + public void PurchaseUnknownSalesPackage(Callback callback, String name, String packageName, int gemCost) + { + UnknownPurchaseToken token = new UnknownPurchaseToken(); + token.AccountName = name; + token.SalesPackageName = packageName; + token.Cost = gemCost; + token.Premium = false; + + new AsyncJsonWebCall(_webAddress + "PlayerAccount/PurchaseUnknownSalesPackage").Execute(TransactionResponse.class, callback, token); + } + + public void PlayerUpdate(Callback callback, String name, int greenGems) + { + PlayerUpdateToken token = new PlayerUpdateToken(); + token.Name = name; + token.Gems = greenGems; + new AsyncJsonWebCall(_webAddress + "PlayerAccount/PlayerUpdate").Execute(PlayerUpdateToken.class, callback, token); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/GameSalesPackageToken.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/GameSalesPackageToken.java new file mode 100644 index 000000000..8a4b6a6b8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/GameSalesPackageToken.java @@ -0,0 +1,8 @@ +package mineplex.core.donation.repository; + +public class GameSalesPackageToken +{ + public Integer GameSalesPackageId; + public Integer Gems; + public boolean Free; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/token/DonorToken.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/token/DonorToken.java new file mode 100644 index 000000000..bf533f531 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/token/DonorToken.java @@ -0,0 +1,11 @@ +package mineplex.core.donation.repository.token; + +import java.util.List; + +public class DonorToken +{ + public int Gems; + public boolean Donated; + public List SalesPackages; + public List UnknownSalesPackages; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/token/DonorTokenWrapper.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/token/DonorTokenWrapper.java new file mode 100644 index 000000000..0e7bb9367 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/token/DonorTokenWrapper.java @@ -0,0 +1,7 @@ +package mineplex.core.donation.repository.token; + +public class DonorTokenWrapper +{ + public String Name; + public DonorToken DonorToken; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/token/PlayerUpdateToken.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/token/PlayerUpdateToken.java new file mode 100644 index 000000000..91bf6d010 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/token/PlayerUpdateToken.java @@ -0,0 +1,8 @@ +package mineplex.core.donation.repository.token; + +public class PlayerUpdateToken +{ + public String Name; + public int Gems; + public boolean FilterChat; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/token/PurchaseToken.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/token/PurchaseToken.java new file mode 100644 index 000000000..13b6c4409 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/token/PurchaseToken.java @@ -0,0 +1,8 @@ +package mineplex.core.donation.repository.token; + +public class PurchaseToken +{ + public String AccountName; + public boolean UsingCredits; + public int SalesPackageId; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/token/UnknownPurchaseToken.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/token/UnknownPurchaseToken.java new file mode 100644 index 000000000..b38753f79 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/token/UnknownPurchaseToken.java @@ -0,0 +1,9 @@ +package mineplex.core.donation.repository.token; + +public class UnknownPurchaseToken +{ + public String AccountName; + public String SalesPackageName; + public int Cost; + public boolean Premium; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/energy/ClientEnergy.java b/Plugins/Mineplex.Core/src/mineplex/core/energy/ClientEnergy.java new file mode 100644 index 000000000..c8467e9b2 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/energy/ClientEnergy.java @@ -0,0 +1,32 @@ +package mineplex.core.energy; + +import java.util.HashMap; + +public class ClientEnergy +{ + public double Energy; + public long LastEnergy; + + public HashMap MaxEnergyMods = new HashMap(); + public HashMap SwingEnergyMods = new HashMap(); + + public int EnergyBonus() + { + int bonus = 0; + + for (int i : MaxEnergyMods.values()) + bonus += i; + + return bonus; + } + + public int SwingEnergy() + { + int mod = 0; + + for (int i : SwingEnergyMods.values()) + mod += i; + + return Math.max(0, 4 + mod); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/energy/Energy.java b/Plugins/Mineplex.Core/src/mineplex/core/energy/Energy.java new file mode 100644 index 000000000..87b916a84 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/energy/Energy.java @@ -0,0 +1,194 @@ +package mineplex.core.energy; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.player.PlayerExpChangeEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.MiniClientPlugin; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.energy.event.EnergyEvent; +import mineplex.core.energy.event.EnergyEvent.EnergyChangeReason; + +public class Energy extends MiniClientPlugin +{ + private double _baseEnergy = 180; + + public Energy(JavaPlugin plugin) + { + super("Energy", plugin); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : UtilServer.getPlayers()) + UpdateEnergy(cur); + } + + public void UpdateEnergy(Player cur) + { + if (cur.isDead()) + return; + + //Get Exp Attribs + double energy = 0.4; + + //Sprint Reduce + if (cur.isSprinting()) + { + Get(cur).LastEnergy = System.currentTimeMillis(); + energy -= 0.2; + } + + //Modify Energy + EnergyEvent energyEvent = new EnergyEvent(cur, energy, EnergyChangeReason.Recharge); + _plugin.getServer().getPluginManager().callEvent(energyEvent); + + if (energyEvent.isCancelled()) + { + System.out.println("Cancelled recharge event."); + return; + } + + //Update Players Exp + ModifyEnergy(cur, energyEvent.GetTotalAmount()); + } + + public void ModifyEnergy(Player player, double energy) + { + ClientEnergy client = Get(player); + + if (energy > 0) + { + client.Energy = Math.min(GetMax(player), client.Energy + energy); + } + else + { + client.Energy = Math.max(0, client.Energy + energy); + } + + //Record Drain + if (energy < 0) + { + client.LastEnergy = System.currentTimeMillis(); + } + + player.setExp(Math.min(0.999f, ((float)client.Energy/(float)GetMax(player)))); + } + + public double GetMax(Player player) + { + return _baseEnergy + Get(player).EnergyBonus(); + } + + public double GetCurrent(Player player) + { + return Get(player).Energy; + } + + @EventHandler + public void HandleRespawn(PlayerRespawnEvent event) + { + Get(event.getPlayer()).Energy = 0; + } + + @EventHandler + public void HandleJoin(PlayerJoinEvent event) + { + Get(event.getPlayer()).Energy = 0; + } + + public boolean Use(Player player, String ability, double amount, boolean use, boolean inform) + { + ClientEnergy client = Get(player); + + if (client.Energy < amount) + { + if (inform) + UtilPlayer.message(player, F.main(_moduleName, "You are too exhausted to use " + F.skill(ability) + ".")); + + return false; + } + else + { + if (!use) + return true; + + ModifyEnergy(player, -amount); + + return true; + } + } + + @EventHandler + public void handleExp(PlayerExpChangeEvent event) + { + event.setAmount(0); + } + + @Override + protected ClientEnergy AddPlayer(String player) + { + return new ClientEnergy(); + } + + public void AddEnergyMaxMod(Player player, String reason, int amount) + { + Get(player).MaxEnergyMods.put(reason, amount); + } + + public void RemoveEnergyMaxMod(Player player, String reason) + { + Get(player).MaxEnergyMods.remove(reason); + } + + public void AddEnergySwingMod(Player player, String reason, int amount) + { + Get(player).SwingEnergyMods.put(reason, amount); + } + + public void RemoveEnergySwingMod(Player player, String reason) + { + Get(player).SwingEnergyMods.remove(reason); + } + + @EventHandler + public void WeaponSwing(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.L)) + return; + + Player player = event.getPlayer(); + + if (!UtilGear.isWeapon(player.getItemInHand())) + return; + + if (player.hasPotionEffect(PotionEffectType.FAST_DIGGING)) + return; + + ModifyEnergy(player, -Get(player).SwingEnergy()); + } + + @EventHandler + public void ShootBow(EntityShootBowEvent event) + { + if (event.getEntity() instanceof Player) + ModifyEnergy((Player)event.getEntity(), -10); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/energy/event/EnergyEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/energy/event/EnergyEvent.java new file mode 100644 index 000000000..f9cdd77a4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/energy/event/EnergyEvent.java @@ -0,0 +1,77 @@ +package mineplex.core.energy.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class EnergyEvent extends Event implements Cancellable +{ + public enum EnergyChangeReason + { + Recharge, + Use + } + + private static final HandlerList handlers = new HandlerList(); + private boolean _cancelled = false; + + private Player _player; + private double _amount; + private double _mods; + private EnergyChangeReason _reason; + + public EnergyEvent(Player player, double amount, EnergyChangeReason reason) + { + _player = player; + _amount = amount; + _reason = reason; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean cancel) + { + _cancelled = cancel; + } + + public Player GetPlayer() + { + return _player; + } + + public double GetAmount() + { + return _amount; + } + + public void AddMod(double mod) + { + _mods += mod; + } + + public double GetTotalAmount() + { + return _amount + _mods; + } + + public EnergyChangeReason GetReason() + { + return _reason; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/enjin/Enjin.java b/Plugins/Mineplex.Core/src/mineplex/core/enjin/Enjin.java new file mode 100644 index 000000000..a373cfbcc --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/enjin/Enjin.java @@ -0,0 +1,96 @@ +package mineplex.core.enjin; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.server.ServerCommandEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.punish.Category; +import mineplex.core.punish.Punish; + +public class Enjin extends MiniPlugin +{ + private CoreClientManager _clientManager; + private DonationManager _donationManager; + private Punish _punish; + + public Enjin(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Punish punish) + { + super("Enjin", plugin); + + _clientManager = clientManager; + _donationManager = donationManager; + _punish = punish; + } + + @EventHandler + public void ServerCommand(ServerCommandEvent event) + { + String label = event.getCommand(); + String[] args = null; + + if (label.contains(" ")) + { + label = label.split(" ")[0]; + args = event.getCommand().substring(event.getCommand().indexOf(' ') + 1).split(" "); + } + + if (label.equalsIgnoreCase("enjin")) + { + if (args.length == 3 && args[0].equalsIgnoreCase("gem")) + { + String name = args[1]; + int amount = Integer.parseInt(args[2]); + + _donationManager.RewardGems(name, amount); + } + else if (args.length == 4 && args[0].equalsIgnoreCase("rank")) + { + String name = args[1]; + String rank = args[2]; + boolean perm = Boolean.parseBoolean(args[3]); + + _clientManager.SaveRank(name, mineplex.core.common.Rank.valueOf(rank), perm); + } + else if (args.length >= 3 && args[0].equalsIgnoreCase("purchase")) + { + String name = args[1]; + + String packageName = args[2]; + + for (int i = 3; i < args.length; i++) + { + packageName += " " + args[i]; + } + + _donationManager.PurchaseUnknownSalesPackage(null, name, packageName, 0, false); + } + else if (args.length >= 3 && args[0].equalsIgnoreCase("unban")) + { + String name = args[1]; + String reason = args[2]; + + for (int i = 3; i < args.length; i++) + { + reason += " " + args[i]; + } + + _punish.RemoveBan(name, reason); + } + else if (args.length >= 3 && args[0].equalsIgnoreCase("ban")) + { + String name = args[1]; + String reason = args[2]; + + for (int i = 3; i < args.length; i++) + { + reason += " " + args[i]; + } + + _punish.AddPunishment(name, Category.Other, reason, null, 3, true, -1); + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java b/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java new file mode 100644 index 000000000..a9b24d1ca --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java @@ -0,0 +1,274 @@ +package mineplex.core.explosion; + +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map.Entry; + +import mineplex.core.MiniPlugin; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.ExplosionPrimeEvent; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class Explosion extends MiniPlugin +{ + private boolean _regenerateGround = false; + private boolean _temporaryDebris = true; + private boolean _enableDebris = false; + private HashSet _explosionBlocks = new HashSet(); + + private BlockRestore _blockRestore; + + public Explosion(JavaPlugin plugin, BlockRestore blockRestore) + { + super("Block Restore", plugin); + + _blockRestore = blockRestore; + } + + @EventHandler + public void ExplosionPrime(ExplosionPrimeEvent event) + { + if (event.getRadius() >= 5) + return; + + for (Block block : UtilBlock.getInRadius(event.getEntity().getLocation(), (double) event.getRadius()).keySet()) + if (block.isLiquid()) + block.setTypeId(0); + } + + @EventHandler + public void ExplosionEntity(EntityExplodeEvent event) + { + if (event.isCancelled()) + return; + + try + { + if (event.getEntityType() == EntityType.CREEPER) + event.blockList().clear(); + + if (event.getEntityType() == EntityType.WITHER_SKULL) + event.blockList().clear(); + } + catch(Exception e) + { + //Nothing + } + + if (event.blockList().isEmpty()) + return; + + //Event for Block awareness + ExplosionEvent explodeEvent = new ExplosionEvent(event.blockList()); + _plugin.getServer().getPluginManager().callEvent(explodeEvent); + + event.setYield(0f); + + //Save + final HashMap> blocks = new HashMap>(); + + for (Block cur : event.blockList()) + { + if (cur.getTypeId() == 0 || cur.isLiquid()) + continue; + + if (cur.getType() == Material.CHEST || + cur.getType() == Material.IRON_ORE || + cur.getType() == Material.COAL_ORE || + cur.getType() == Material.GOLD_ORE || + cur.getType() == Material.DIAMOND_ORE) + { + cur.breakNaturally(); + continue; + } + + blocks.put(cur, new AbstractMap.SimpleEntry(cur.getTypeId(), cur.getData())); + + if (!_regenerateGround) + { + if (cur.getTypeId() != 98 || cur.getData() != 0) + cur.setTypeId(0); + } + + else + { + int heightDiff = cur.getLocation().getBlockY() - event.getEntity().getLocation().getBlockY(); + _blockRestore.Add(cur, 0, (byte)0, (long) (20000 + (heightDiff*3000) + Math.random()*2900)); + } + + } + + event.blockList().clear(); + + //DELAY + + final Entity fEnt = event.getEntity(); + final Location fLoc = event.getLocation(); + _plugin.getServer().getScheduler().runTaskLater(_plugin, new Runnable() + { + public void run() + { + //Launch + for (Block cur : blocks.keySet()) + { + if (blocks.get(cur).getKey() == 98) + if (blocks.get(cur).getValue() == 0) + continue; + + //TNT + if (blocks.get(cur).getKey() == 46) + { + TNTPrimed ent = cur.getWorld().spawn(cur.getLocation().add(0.5, 0.5, 0.5), TNTPrimed.class); + Vector vec = UtilAlg.getTrajectory(fEnt, ent); + if (vec.getY() < 0) vec.setY(vec.getY() * -1); + + UtilAction.velocity(ent, vec, 1, false, 0, 0.6, 10, false); + + ent.setFuseTicks(10); + } + //Other + else + { + //XXX ANTILAG + double chance = 0.2 + (double)_explosionBlocks.size()/(double)120; + if (Math.random() > Math.min(0.85, chance)) + { + FallingBlock fall = cur.getWorld().spawnFallingBlock(cur.getLocation().add(0.5, 0.5, 0.5), blocks.get(cur).getKey(), blocks.get(cur).getValue()); + + Vector vec = UtilAlg.getTrajectory(fEnt, fall); + if (vec.getY() < 0) vec.setY(vec.getY() * -1); + + UtilAction.velocity(fall, vec, 0.5 + 0.25*Math.random(), false, 0, 0.4 + 0.20*Math.random(), 10, false); + + _explosionBlocks.add(fall); + } + } + } + + //Items + /** + for (Item item : event.getEntity().getWorld().getEntitiesByClass(Item.class)) + if (UtilMath.offset(item, event.getEntity()) < 5) + { + Vector vec = UtilAlg.getTrajectory(event.getEntity(), item); + if (vec.getY() < 0) vec.setY(vec.getY() * -1); + + UtilAction.velocity(item, vec, 1, false, 0, 0.6, 10, false); + } + **/ + + //Crack + for (Block cur : UtilBlock.getInRadius(fLoc, 4d).keySet()) + if (cur.getTypeId() == 98) + if (cur.getData() == 0) + cur.setTypeIdAndData(98, (byte)2, true); + } + }, 1); + } + + @EventHandler + public void ExplosionBlockUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + //Clean Archived Games + Iterator fallingIterator = _explosionBlocks.iterator(); + + while (fallingIterator.hasNext()) + { + FallingBlock cur = fallingIterator.next(); + + if (!cur.isValid() || cur.getTicksLived() > 400) + { + fallingIterator.remove(); + + //Expire + if (cur.getTicksLived() > 400) + { + cur.remove(); + return; + } + + Block block = cur.getLocation().getBlock(); + block.setTypeIdAndData(0, (byte)0, true); + + //Block Replace + if (_enableDebris) + { + if (_temporaryDebris) + { + _blockRestore.Add(block, cur.getBlockId(), cur.getBlockData(), 10000); + } + else + { + block.setTypeIdAndData(cur.getBlockId(), cur.getBlockData(), true); + } + } + else + { + cur.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, cur.getBlockId()); + } + + cur.remove(); + } + } + } + + @EventHandler + public void ExplosionItemSpawn(ItemSpawnEvent event) + { + for (FallingBlock block : _explosionBlocks) + if (UtilMath.offset(event.getEntity().getLocation(), block.getLocation()) < 1) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOW) + public void ExplosionBlocks(EntityExplodeEvent event) + { + if (event.getEntity() == null) + event.blockList().clear(); + } + + public void SetRegenerate(boolean regenerate) + { + _regenerateGround = regenerate; + } + + public void SetDebris(boolean debris) + { + _enableDebris = debris; + } + + public void SetTemporaryDebris(boolean enabled) + { + _temporaryDebris = enabled; + } + + public HashSet GetExplosionBlocks() + { + return _explosionBlocks; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/explosion/ExplosionEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/explosion/ExplosionEvent.java new file mode 100644 index 000000000..fcab9124f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/explosion/ExplosionEvent.java @@ -0,0 +1,34 @@ +package mineplex.core.explosion; + +import java.util.Collection; + +import org.bukkit.block.Block; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ExplosionEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Collection _blocks; + + public ExplosionEvent(Collection blocks) + { + _blocks = blocks; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public Collection GetBlocks() + { + return _blocks; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeEntity.java b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeEntity.java new file mode 100644 index 000000000..1a70225b3 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeEntity.java @@ -0,0 +1,317 @@ +package mineplex.core.fakeEntity; + +import java.lang.reflect.Field; + +import net.minecraft.server.v1_6_R2.BlockCloth; +import net.minecraft.server.v1_6_R2.DataWatcher; +import net.minecraft.server.v1_6_R2.EnumEntitySize; +import net.minecraft.server.v1_6_R2.MathHelper; +import net.minecraft.server.v1_6_R2.Packet; +import net.minecraft.server.v1_6_R2.Packet24MobSpawn; +import net.minecraft.server.v1_6_R2.Packet29DestroyEntity; +import net.minecraft.server.v1_6_R2.Packet39AttachEntity; +import net.minecraft.server.v1_6_R2.Packet40EntityMetadata; + +import org.bukkit.Location; +import org.bukkit.entity.EntityType; + +public class FakeEntity +{ + private static int _entityIdCounter = 50000; + + private int _entityId; + private Location _location; + private EntityType _entityType; + + private static Field _spawnDataWatcherField; + private static Field _spawnListField; + + public FakeEntity(EntityType entityType, Location location) + { + _entityId = _entityIdCounter++; + _entityType = entityType; + _location = location; + + SetSpawnDataWatcherField(); + SetSpawnListField(); + } + + public int GetEntityId() + { + return _entityId; + } + + public EntityType GetEntityType() + { + return _entityType; + } + + public void SetLocation(Location location) + { + _location = location; + } + + public Location GetLocation() + { + return _location; + } + + public Packet Spawn() + { + return Spawn(_entityId); + } + + public Packet Destroy() + { + Packet29DestroyEntity packet = new Packet29DestroyEntity(); + packet.a = new int[] { GetEntityId() }; + + return packet; + } + + public Packet Spawn(int id) + { + Packet24MobSpawn packet = new Packet24MobSpawn(); + packet.a = id; + packet.b = (byte) _entityType.getTypeId(); + packet.c = (int)EnumEntitySize.SIZE_2.a(_location.getX()); + packet.d = (int)MathHelper.floor(_location.getY() * 32.0D); + packet.e = (int)EnumEntitySize.SIZE_2.a(_location.getZ()); + packet.i = (byte) ((int) (_location.getYaw() * 256.0F / 360.0F)); + packet.j = (byte) ((int) (_location.getPitch() * 256.0F / 360.0F)); + packet.k = (byte) ((int) (_location.getYaw() * 256.0F / 360.0F)); + + double var2 = 3.9D; + double var4 = 0; + double var6 = 0; + double var8 = 0; + + if (var4 < -var2) + { + var4 = -var2; + } + + if (var6 < -var2) + { + var6 = -var2; + } + + if (var8 < -var2) + { + var8 = -var2; + } + + if (var4 > var2) + { + var4 = var2; + } + + if (var6 > var2) + { + var6 = var2; + } + + if (var8 > var2) + { + var8 = var2; + } + + packet.f = (int)(var4 * 8000.0D); + packet.g = (int)(var6 * 8000.0D); + packet.h = (int)(var8 * 8000.0D); + + DataWatcher dataWatcher = new DataWatcher(); + + UpdateDataWatcher(dataWatcher); + + try + { + _spawnDataWatcherField.set(packet, dataWatcher); + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + + try + { + _spawnListField.set(packet, dataWatcher.b()); + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + + return packet; + } + + public Packet Hide() + { + return Hide(_entityId); + } + + public Packet Hide(int entityId) + { + DataWatcher dataWatcher = new DataWatcher(); + + UpdateDataWatcher(dataWatcher); + + dataWatcher.watch(0, Byte.valueOf((byte) 32)); + + return new Packet40EntityMetadata(entityId, dataWatcher, false); + } + + public Packet Show() + { + DataWatcher dataWatcher = new DataWatcher(); + + UpdateDataWatcher(dataWatcher); + + return new Packet40EntityMetadata(_entityId, dataWatcher, true); + } + + public Packet SetVehicle(int vehicleId) + { + Packet39AttachEntity vehiclePacket = new Packet39AttachEntity(); + vehiclePacket.a = 0; + vehiclePacket.b = _entityId; + vehiclePacket.c = vehicleId; + + return vehiclePacket; + } + + public Packet SetPassenger(int passengerId) + { + return SetPassenger(passengerId, _entityId); + } + + public Packet SetPassenger(int passengerId, int entityId) + { + Packet39AttachEntity vehiclePacket = new Packet39AttachEntity(); + vehiclePacket.a = 0; + vehiclePacket.b = passengerId; + vehiclePacket.c = entityId; + + return vehiclePacket; + } + + protected void UpdateDataWatcher(DataWatcher dataWatcher) + { + dataWatcher.a(0, Byte.valueOf((byte) 0)); + dataWatcher.a(1, Short.valueOf((short)300)); + dataWatcher.a(6, Float.valueOf(4.0F)); + dataWatcher.a(7, Integer.valueOf(0)); + dataWatcher.a(8, Byte.valueOf((byte)0)); + dataWatcher.a(9, Byte.valueOf((byte) 0)); + dataWatcher.a(10, " "); + dataWatcher.a(11, Byte.valueOf((byte)0)); + + switch (_entityType) + { + case BAT: + case BLAZE: + case PIG: + case SHEEP: + case IRON_GOLEM: + case GHAST: + dataWatcher.a(16, new Byte((byte) 0)); + break; + case CREEPER: + dataWatcher.a(16, Byte.valueOf((byte) -1)); + dataWatcher.a(17, Byte.valueOf((byte) 0)); + break; + case ENDERMAN: + dataWatcher.a(16, new Byte((byte) 0)); + dataWatcher.a(17, new Byte((byte) 0)); + dataWatcher.a(18, new Byte((byte) 0)); + break; + case PLAYER: + dataWatcher.a(16, Byte.valueOf((byte) 0)); + dataWatcher.a(17, Byte.valueOf((byte) 0)); + break; + case OCELOT: + case SPIDER: + dataWatcher.a(16, new Byte((byte) 0)); + break; + case WOLF: + dataWatcher.a(18, new Integer(20)); + dataWatcher.a(19, new Byte((byte) 0)); + dataWatcher.a(20, new Byte((byte) BlockCloth.j_(1))); + case SKELETON: + dataWatcher.a(13, new Byte((byte) 0)); + break; + case SLIME: + dataWatcher.a(16, new Byte((byte) 1)); + break; + case WITCH: + dataWatcher.a(21, Byte.valueOf((byte) 0)); + break; + case WITHER: + dataWatcher.a(16, new Integer(100)); + dataWatcher.a(17, new Integer(0)); + dataWatcher.a(18, new Integer(0)); + dataWatcher.a(19, new Integer(0)); + dataWatcher.a(20, new Integer(0)); + break; + case ZOMBIE: + dataWatcher.a(13, Byte.valueOf((byte) 0)); + dataWatcher.a(14, Byte.valueOf((byte) 0)); + break; + default: + break; + + } + } + + private void SetSpawnListField() + { + if (_spawnListField == null) + { + try + { + _spawnListField = Packet24MobSpawn.class.getDeclaredField("u"); + _spawnListField.setAccessible(true); + } + catch (NoSuchFieldException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + catch (SecurityException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + private void SetSpawnDataWatcherField() + { + if (_spawnDataWatcherField == null) + { + try + { + _spawnDataWatcherField = Packet24MobSpawn.class.getDeclaredField("t"); + _spawnDataWatcherField.setAccessible(true); + } + catch (NoSuchFieldException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + catch (SecurityException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeEntityManager.java b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeEntityManager.java new file mode 100644 index 000000000..ee8e95f81 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeEntityManager.java @@ -0,0 +1,115 @@ +package mineplex.core.fakeEntity; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.server.v1_6_R2.Packet; + +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.packethandler.PacketHandler; + +public class FakeEntityManager extends MiniPlugin +{ + public static FakeEntityManager Instance; + + private PacketHandler _packetHandler; + + private NautHashMap> _playerFakeEntityMap; + + public FakeEntityManager(JavaPlugin plugin) + { + super("Fake Entity Manager", plugin); + + _playerFakeEntityMap = new NautHashMap>(); + } + + public static void Initialize(JavaPlugin plugin) + { + Instance = new FakeEntityManager(plugin); + } + + public void AddFakeEntity(FakeEntity entity, String name) + { + if (!_playerFakeEntityMap.containsKey(name)) + { + _playerFakeEntityMap.put(name, new ArrayList()); + } + + _playerFakeEntityMap.get(name).add(entity); + } + + public void ClearFakes(String name) + { + _playerFakeEntityMap.remove(name); + } + + public void ClearFakeFor(FakeEntity entity, String name) + { + if (!_playerFakeEntityMap.containsKey(name)) + { + _playerFakeEntityMap.put(name, new ArrayList()); + } + + _playerFakeEntityMap.get(name).remove(entity); + } + + public List GetFakesFor(String name) + { + if (!_playerFakeEntityMap.containsKey(name)) + { + _playerFakeEntityMap.put(name, new ArrayList()); + } + + return _playerFakeEntityMap.get(name); + } + + public void SetPacketHandler(PacketHandler packetHandler) + { + _packetHandler = packetHandler; + } + + public void RemoveForward(Player viewer) + { + _packetHandler.RemoveForward(viewer); + } + + public void ForwardMovement(Player viewer, Player traveller, int entityId) + { + _packetHandler.ForwardMovement(viewer, traveller.getEntityId(), entityId); + } + + public void BlockMovement(Player otherPlayer, int entityId) + { + _packetHandler.BlockMovement(otherPlayer, entityId); + } + + public void FakePassenger(Player viewer, int entityId, Packet attachPacket) + { + _packetHandler.FakePassenger(viewer, entityId, attachPacket); + } + + public void RemoveFakePassenger(Player viewer, int entityId) + { + _packetHandler.RemoveFakePassenger(viewer, entityId); + } + + public void FakeVehicle(Player viewer, int entityId, Packet attachPacket) + { + _packetHandler.FakeVehicle(viewer, entityId, attachPacket); + } + + public void RemoveFakeVehicle(Player viewer, int entityId) + { + _packetHandler.RemoveFakeVehicle(viewer, entityId); + } + + public void SendPacketTo(Packet packet, Player player) + { + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeFallingBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeFallingBlock.java new file mode 100644 index 000000000..0ebc0cb1f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeFallingBlock.java @@ -0,0 +1,79 @@ +package mineplex.core.fakeEntity; + +import net.minecraft.server.v1_6_R2.EnumEntitySize; +import net.minecraft.server.v1_6_R2.MathHelper; +import net.minecraft.server.v1_6_R2.Packet; +import net.minecraft.server.v1_6_R2.Packet23VehicleSpawn; + +import org.bukkit.Location; +import org.bukkit.entity.EntityType; + +public class FakeFallingBlock extends FakeEntity +{ + private int _materialId; + private byte _data; + + public FakeFallingBlock(int materialId, byte data, Location location) + { + super(EntityType.FALLING_BLOCK, location); + + _materialId = materialId; + _data = data; + } + + public Packet Spawn(int id) + { + Packet23VehicleSpawn packet = new Packet23VehicleSpawn(); + packet.a = id; + packet.b = (int)EnumEntitySize.SIZE_2.a(GetLocation().getX()); + packet.c = (int)MathHelper.floor(GetLocation().getY() * 32.0D); + packet.d = (int)EnumEntitySize.SIZE_2.a(GetLocation().getZ()); + + double var4 = 0; + double var6 = .045; + double var8 = 0; + double var10 = 3.9D; + + if (var4 < -var10) + { + var4 = -var10; + } + + if (var6 < -var10) + { + var6 = -var10; + } + + if (var8 < -var10) + { + var8 = -var10; + } + + if (var4 > var10) + { + var4 = var10; + } + + if (var6 > var10) + { + var6 = var10; + } + + if (var8 > var10) + { + var8 = var10; + } + + packet.e = (int)(var4 * 8000.0D); + packet.f = (int)(var6 * 8000.0D); + packet.g = (int)(var8 * 8000.0D); + packet.h = 0; + packet.i = 0; + packet.j = 70; + packet.k = _materialId | _data << 16; + + System.out.println("Creating fake falling block with entityId " + GetEntityId()); + + return packet; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeItemDrop.java b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeItemDrop.java new file mode 100644 index 000000000..9691607ba --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeItemDrop.java @@ -0,0 +1,85 @@ +package mineplex.core.fakeEntity; + +import net.minecraft.server.v1_6_R2.DataWatcher; +import net.minecraft.server.v1_6_R2.ItemStack; +import net.minecraft.server.v1_6_R2.MathHelper; +import net.minecraft.server.v1_6_R2.Packet; +import net.minecraft.server.v1_6_R2.Packet23VehicleSpawn; + +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +public class FakeItemDrop extends FakeEntity +{ + private ItemStack _itemStack; + + public FakeItemDrop(org.bukkit.inventory.ItemStack itemStack, Location location) + { + super(EntityType.DROPPED_ITEM, location); + + _itemStack = CraftItemStack.asNMSCopy(itemStack); + } + + public Packet Spawn() + { + Packet23VehicleSpawn packet = new Packet23VehicleSpawn(); + packet.a = GetEntityId(); + packet.b = MathHelper.floor(GetLocation().getX() * 32.0D); + packet.c = MathHelper.floor(GetLocation().getY() * 32.0D); + packet.d = MathHelper.floor(GetLocation().getZ() * 32.0D); + packet.h = MathHelper.d(GetLocation().getYaw() * 256.0F / 360.0F); + packet.i = MathHelper.d(GetLocation().getPitch() * 256.0F / 360.0F); + packet.j = 2; + packet.k = 1; + + double d0 = 0; + double d1 = 0; + double d2 = 0; + double d3 = 3.9D; + + if (d0 < -d3) { + d0 = -d3; + } + + if (d1 < -d3) { + d1 = -d3; + } + + if (d2 < -d3) { + d2 = -d3; + } + + if (d0 > d3) { + d0 = d3; + } + + if (d1 > d3) { + d1 = d3; + } + + if (d2 > d3) { + d2 = d3; + } + + packet.e = (int) (d0 * 8000.0D); + packet.f = (int) (d1 * 8000.0D); + packet.g = (int) (d2 * 8000.0D); + + return packet; + } + + protected void UpdateDataWatcher(DataWatcher dataWatcher) + { + dataWatcher.a(0, Byte.valueOf((byte) 0)); + dataWatcher.a(1, Short.valueOf((short)300)); + dataWatcher.a(8, Integer.valueOf(0)); + dataWatcher.a(9, Byte.valueOf((byte) 0)); + dataWatcher.a(10, new net.minecraft.server.v1_6_R2.ItemStack(_itemStack.getItem(), _itemStack.count)); + } + + public void SetItemStack(org.bukkit.inventory.ItemStack itemStack) + { + _itemStack = CraftItemStack.asNMSCopy(itemStack); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakePlayer.java new file mode 100644 index 000000000..d1a851892 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakePlayer.java @@ -0,0 +1,75 @@ +package mineplex.core.fakeEntity; + +import java.lang.reflect.Field; + +import net.minecraft.server.v1_6_R2.DataWatcher; +import net.minecraft.server.v1_6_R2.MathHelper; +import net.minecraft.server.v1_6_R2.Packet; +import net.minecraft.server.v1_6_R2.Packet20NamedEntitySpawn; + +import org.bukkit.Location; +import org.bukkit.entity.EntityType; + +public class FakePlayer extends FakeEntity +{ + private String _name; + + private static Field _spawnDataWatcherField; + + public FakePlayer(String name, Location location) + { + super(EntityType.PLAYER, location); + + _name = name; + + if (_spawnDataWatcherField == null) + { + try + { + _spawnDataWatcherField = Packet20NamedEntitySpawn.class.getDeclaredField("i"); + _spawnDataWatcherField.setAccessible(true); + } + catch (NoSuchFieldException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + catch (SecurityException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + public Packet Spawn(int id) + { + Packet20NamedEntitySpawn packet = new Packet20NamedEntitySpawn(); + packet.a = id; + packet.b = _name; + packet.c = MathHelper.floor(GetLocation().getX() * 32.0D); + packet.d = MathHelper.floor(GetLocation().getY() * 32.0D); + packet.e = MathHelper.floor(GetLocation().getZ() * 32.0D); + packet.f = (byte) ((int) (GetLocation().getYaw() * 256.0F / 360.0F)); + packet.g = (byte) ((int) (GetLocation().getPitch() * 256.0F / 360.0F)); + + DataWatcher dataWatcher = new DataWatcher(); + + UpdateDataWatcher(dataWatcher); + + try + { + _spawnDataWatcherField.set(packet, dataWatcher); + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + + return packet; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java new file mode 100644 index 000000000..96454360c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java @@ -0,0 +1,954 @@ +package mineplex.core.itemstack; + +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map.Entry; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Monster; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.inventory.FurnaceSmeltEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.PrepareItemCraftEvent; +import org.bukkit.event.inventory.InventoryType.SlotType; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.CraftingInventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.plugin.java.JavaPlugin; + +public class ItemStackFactory extends MiniPlugin +{ + public static ItemStackFactory Instance; + + private HashMap>> _names; + private HashMap> _lores; + + private String _nameFormat = "§r" + C.mItem; + + private HashSet _statListeners = new HashSet(); + + private boolean _customNames = false; + + protected ItemStackFactory(JavaPlugin plugin, boolean customNames) + { + super("ItemStack Factory", plugin); + + AddDefault(); + + if (customNames) + SetCustom(); + } + + public static void Initialize(JavaPlugin plugin, boolean customNames) + { + Instance = new ItemStackFactory(plugin, customNames); + } + + public void AddStatListener(Listener listener) + { + _statListeners.add(listener); + RegisterEvents(listener); + } + + private void SetCustom() + { + Add(0, (byte)0, "Unarmed", false); + + Add(Material.DIAMOND_SWORD, (byte)0, ChatColor.GOLD + "Diamond Sword", new String[] + { + C.cGray + "Damage: " + C.cYellow + "6", + "" + }, true); + + Add(Material.IRON_SWORD, (byte)0, "Iron Sword", new String[] + { + C.cGray + "Damage: " + C.cYellow + "6", + "" + }, true); + + Add(Material.GOLD_SWORD, (byte)0, ChatColor.GOLD + "Power Sword", new String[] + { + C.cGray + "Damage: " + C.cYellow + "7", + "" + }, true); + + Add(Material.DIAMOND_AXE, (byte)0, ChatColor.GOLD + "Diamond Axe", new String[] + { + C.cGray + "Damage: " + C.cYellow + "6", + "" + }, true); + + Add(Material.IRON_AXE, (byte)0, "Iron Axe", new String[] + { + C.cGray + "Damage: " + C.cYellow + "6", + "" + }, true); + + Add(Material.GOLD_AXE, (byte)0, ChatColor.GOLD + "Power Axe", new String[] + { + C.cGray + "Damage: " + C.cYellow + "7", + "" + }, true); + + Add(Material.RECORD_5, (byte)0, "50,000 Coin Token", true); + + Add(Material.IRON_HELMET, (byte)0, "Knights Helm", true); + Add(Material.IRON_CHESTPLATE, (byte)0, "Knights Chestplate", true); + Add(Material.IRON_LEGGINGS, (byte)0, "Knights Leggings", true); + Add(Material.IRON_BOOTS, (byte)0, "Knights Boots", true); + + Add(Material.CHAINMAIL_HELMET, (byte)0, "Rangers Cap", true); + Add(Material.CHAINMAIL_CHESTPLATE, (byte)0, "Rangers Vest", true); + Add(Material.CHAINMAIL_LEGGINGS, (byte)0, "Rangers Leggings", true); + Add(Material.CHAINMAIL_BOOTS, (byte)0, "Rangers Boots", true); + + Add(Material.LEATHER_HELMET, (byte)0, "Assassins Cap", true); + Add(Material.LEATHER_CHESTPLATE, (byte)0, "Assassins Vest", true); + Add(Material.LEATHER_LEGGINGS, (byte)0, "Assassins Chaps", true); + Add(Material.LEATHER_BOOTS, (byte)0, "Assassins Boots", true); + + Add(Material.DIAMOND_HELMET, (byte)0, "Brutes Helm", true); + Add(Material.DIAMOND_CHESTPLATE, (byte)0, "Brutes Chestplate", true); + Add(Material.DIAMOND_LEGGINGS, (byte)0, "Brutes Leggings", true); + Add(Material.DIAMOND_BOOTS, (byte)0, "Brutes Boots", true); + + Add(Material.GOLD_HELMET, (byte)0, "Mages Helm", true); + Add(Material.GOLD_CHESTPLATE, (byte)0, "Mages Chestplate", true); + Add(Material.GOLD_LEGGINGS, (byte)0, "Mages Leggings", true); + Add(Material.GOLD_BOOTS, (byte)0, "Mages Boots", true); + + Add(Material.ENDER_CHEST, (byte)0, "Class Unlock Shop", true); + Add(Material.ENCHANTMENT_TABLE, (byte)0, "Class Setup Table", true); + Add(Material.BREWING_STAND, (byte)0, "TNT Generator", true); + Add(Material.BEACON, (byte)0, "Clan Outpost", true); + + Add(Material.GOLD_NUGGET, (byte)0, ChatColor.YELLOW + "Power Charge", true); + + + //CONSUMABLE ITEMS + Add(Material.MUSHROOM_SOUP, (byte)0, ChatColor.YELLOW + "Mushroom Soup", new String[] + { + C.cGray + "Right-Click: " + C.cYellow + "Consume", + C.cGray + " " + "Regeneration I for 4 Seconds", + C.cGray + " " + "4 Food", + "" + }, true); + + //THROWABLES + Add(Material.POTION, (byte)0, ChatColor.YELLOW + "Water Bottle", new String[] + { + C.cGray + "Left-Click: " + C.cYellow + "Throw", + C.cGray + " " + "Douses Players", + C.cGray + " " + "Douses Fires", + "", + C.cGray + "Right-Click: " + C.cYellow + "Drink", + C.cGray + " " + "Douse Self", + C.cGray + " " + "Fire Resistance I for 4 Seconds" + }, true); + + Add(Material.SLIME_BALL, (byte)0, ChatColor.YELLOW + "Poison Ball", new String[] + { + C.cGray + "Left-Click: " + C.cYellow + "Throw", + C.cGray + " " + "Poison I for 6 Seconds", + C.cGray + " " + "Returns to Thrower" + }, true); + + Add(Material.ENDER_PEARL, (byte)0, ChatColor.YELLOW + "Ender Pearl", new String[] + { + C.cGray + "Left-Click: " + C.cYellow + "Throw", + C.cGray + " " + "Ride Ender Pearl", + "", + C.cGray + "Right-Click: " + C.cYellow + "Consume", + C.cGray + " " + "Removes Negative Effects", + C.cGray + " " + "4 Food" + }, true); + + Add(Material.NOTE_BLOCK, (byte)0, ChatColor.YELLOW + "Proximity Incendiary", new String[] + { + C.cGray + "Left-Click: " + C.cYellow + "Throw", + C.cGray + " " + "Activates after 4 Seconds", + C.cGray + " " + "Detonates on player proximity;", + C.cGray + " " + "30 Fires spew out", + C.cGray + " " + "Fires ignite for 3 Seconds", + C.cGray + " " + "Fires remains for 15 Seconds" + }, true); + + Add(Material.REDSTONE_LAMP_ON, (byte)0, ChatColor.YELLOW + "Proximity Zapper", new String[] + { + C.cGray + "Left-Click: " + C.cYellow + "Throw", + C.cGray + " " + "Activates after 4 Seconds", + C.cGray + " " + "Detonates on player proximity;", + C.cGray + " " + "Lightning strikes the Zapper", + C.cGray + " " + "Silence for 6 seconds", + C.cGray + " " + "Shock for 6 seconds", + C.cGray + " " + "Slow IV for 6 seconds" + }, true); + + Add(Material.COMMAND, (byte)0, ChatColor.YELLOW + "Proximity Explosive", new String[] + { + C.cGray + "Left-Click: " + C.cYellow + "Throw", + C.cGray + " " + "Activates after 4 Seconds", + C.cGray + " " + "Detonates on player proximity;", + C.cGray + " " + "8 Range", + C.cGray + " " + "Strong Knockback" + }, true); + + //TOOLS + Add(Material.SHEARS, (byte)0, ChatColor.YELLOW + "Scanner VR-9000", new String[] + { + C.cGray + "Right-Click: " + C.cYellow + "Scan Player", + C.cGray + " " + "100 Blocks Range", + C.cGray + " " + "Shows Targets Skills", + "" + }, true); + } + + private void Add(Material mat, byte data, String name, boolean special) + { + Add(mat.getId(), data, name, null, special); + } + + private void Add(int id, byte data, String name, boolean special) + { + Add(id, data, name, null, special); + } + + private void Add(Material mat, byte data, String name, String[] lore, boolean special) + { + Add(mat.getId(), data, name, lore, special); + } + + private void Add(int id, byte data, String name, String[] lore, boolean special) + { + if (!_names.containsKey(id)) + _names.put(id, new HashMap>()); + + _names.get(id).put(data, new AbstractMap.SimpleEntry(name, special)); + + if (lore == null) + return; + + if (!_lores.containsKey(id)) + _lores.put(id, new HashMap()); + + _lores.get(id).put(data, lore); + } + + private void AddDefault() + { + _names = new HashMap>>(); + _lores = new HashMap>(); + + for (int id=0 ; id<10000 ; id++) + { + Material mat = Material.getMaterial(id); + + if (mat == null) + continue; + + //Add Item + HashMap> variants = new HashMap>(); + _names.put(id, variants); + + for (byte data=0 ; data<50 ; data++) + { + try + { + //Get Name + ItemStack stack = new ItemStack(id, 1, data); + String name = CraftItemStack.asNMSCopy(stack).getName(); + + if (name.length() == 0) + name = Clean(mat.toString()); + + //No Duplicates + for (Entry cur : variants.values()) + if (cur.getKey().equals(name)) + continue; + + variants.put(data, new AbstractMap.SimpleEntry(name, (mat.getMaxStackSize() == 1))); + + //System.out.println("Added: " + name + " " + id + ":" + data); + } + catch (Exception e) + { + //System.out.println("Failed: " + mat.name() + " " + id + ":" + data); + } + } + } + } + + private String Clean(String string) + { + String out = ""; + String[] words = string.split("_"); + + for (String word : words) + { + if (word.length() < 1) + return "Unknown"; + + out += word.charAt(0) + word.substring(1, word.length()).toLowerCase() + " "; + } + + return out.substring(0, out.length() - 1); + } + + public String GetItemStackName(ItemStack stack) + { + return ((CraftItemStack)stack).getHandle().getName(); + } + + public String GetName(ItemStack stack, boolean formatted) + { + if (stack == null) + return "Unarmed"; + + if (stack.getData() != null) + return GetName(stack.getTypeId(), stack.getData().getData(), formatted); + else + return GetName(stack.getTypeId(), (byte)0, formatted); + } + + public String GetName(Block block, boolean formatted) + { + return GetName(block.getTypeId(), block.getData(), formatted); + } + + public String GetName(Material mat, byte data, boolean formatted) + { + return GetName(mat.getId(), data, formatted); + } + + public String GetName(int id, byte data, boolean formatted) + { + String out = ""; + if (formatted) + out = _nameFormat; + + if (!_names.containsKey(id)) + return out + "Unknown"; + + if (!_names.get(id).containsKey(data)) + + if (_names.get(id).containsKey(0)) + return out + _names.get(id).get(0).getKey(); + + else + return out + "Unknown"; + + return out + _names.get(id).get(data).getKey(); + } + + public boolean IsSpecial(ItemStack stack) + { + if (stack == null) + return false; + + if (stack.getData() != null) + return IsSpecial(stack.getTypeId(), stack.getData().getData()); + else + return IsSpecial(stack.getTypeId(), (byte)0); + } + + public boolean IsSpecial(Material mat, byte data) + { + return IsSpecial(mat.getId(), data); + } + + public boolean IsSpecial(int id, byte data) + { + if (!_names.containsKey(id)) + return false; + + if (!_names.get(id).containsKey(data)) + if (_names.get(id).containsKey(0)) + return _names.get(id).get(0).getValue(); + else + return false; + + return _names.get(id).get(data).getValue(); + } + + public void StatsArmorRename(ItemStack item, int damage) + { + if (item == null) + return; + + if (item.getMaxStackSize() > 1) + return; + + damage += GetLoreVar(item, "Damage Tanked", 0); + + SetLoreVar(item, "Damage Tanked", "" + damage); + + if (damage >= 10000) item.addEnchantment(Enchantment.DURABILITY, 1); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void StatsBowShoot(BlockBreakEvent event) + { + if (event.isCancelled()) + return; + + ItemStack item = event.getPlayer().getItemInHand(); + + if (item == null) + return; + + if (item.getMaxStackSize() > 1) + return; + + int blocks = 1 + GetLoreVar(item, "Blocks Mined", 0); + SetLoreVar(item, "Blocks Mined", blocks+""); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void StatsKillMob(EntityDeathEvent event) + { + if (!(event.getEntity() instanceof Monster)) + return; + + Monster ent = (Monster)event.getEntity(); + + if (ent.getKiller() == null) + return; + + if (ent.getKiller().isBlocking()) + return; + + ItemStack item = ent.getKiller().getItemInHand(); + + if (item == null) + return; + + if (item.getMaxStackSize() > 1) + return; + + int kills = 1 + GetLoreVar(item, "Monster Kills", 0); + + SetLoreVar(item, "Monster Kills", "" + kills); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void StatsBowShoot(EntityShootBowEvent event) + { + if (event.isCancelled()) + return; + + int shots = 1 + GetLoreVar(event.getBow(), "Arrows Shot", 0); + + SetLoreVar(event.getBow(), "Arrows Shot", "" + shots); + + int hits = GetLoreVar(event.getBow(), "Arrows Hit", 0); + + double acc = UtilMath.trim(1, ((double)hits/(double)shots)*100); + + SetLoreVar(event.getBow(), "Accuracy", acc + "%"); + } + + @EventHandler + public void RenameSpawn(ItemSpawnEvent event) + { + if (!_customNames) + return; + + if (event.isCancelled()) + return; + + //Ignore Named Items + String color = ChatColor.getLastColors(GetItemStackName(event.getEntity().getItemStack())); + if (color != null && color.length() >= 2 && color.charAt(1) != 'f') + return; + + int id = event.getEntity().getItemStack().getTypeId(); + byte data = 0; + if (event.getEntity().getItemStack().getData() != null) + data = event.getEntity().getItemStack().getData().getData(); + + ((CraftItemStack)event.getEntity().getItemStack()).getHandle().c(GetName(id, data, true)); + } + + @EventHandler + public void RenameArrow(PlayerPickupItemEvent event) + { + if (!_customNames) + return; + + if (event.isCancelled()) + return; + + ItemStack stack = event.getItem().getItemStack(); + + if (stack.getType() != Material.ARROW) + return; + + //Ignore Named Items + String color = ChatColor.getLastColors(GetItemStackName(stack)); + if (color != null && color.length() >= 2 && color.charAt(1) != 'f') + return; + + //Data + byte data = 0; + if (stack.getData() != null) + data= stack.getData().getData(); + + //Remove + event.setCancelled(true); + event.getItem().remove(); + + //Fletched + if (data == 1) + return; + + event.getPlayer().getInventory().addItem(CreateStack(stack.getTypeId(), data, stack.getAmount())); + } + + @EventHandler + public void RenameSmelt(FurnaceSmeltEvent event) + { + if (!_customNames) + return; + + ItemStack stack = event.getResult(); + + byte data = 0; + if (stack.getData() != null) + data= stack.getData().getData(); + + ItemStack result = CreateStack(stack.getTypeId(), data, stack.getAmount()); + + event.setResult(result); + } + + @EventHandler + public void RenameCraft(PrepareItemCraftEvent event) + { + if (!_customNames) + return; + + ItemStack stack = event.getInventory().getResult(); + + byte data = 0; + if (stack.getData() != null) + data= stack.getData().getData(); + + String crafter = null; + if (event.getViewers().size() == 1 && stack.getMaxStackSize() == 1) + crafter = event.getViewers().get(0).getName() + " Crafting"; + + ItemStack result = CreateStack(stack.getTypeId(), data, stack.getAmount(), null, new String[] {}, crafter); + + event.getInventory().setResult(result); + } + + @EventHandler + public void RenameCraftAlg(InventoryClickEvent event) + { + if (!_customNames) + return; + + if (!event.isShiftClick()) + return; + + if (event.getSlotType() != SlotType.RESULT) + return; + + if (!(event.getInventory() instanceof CraftingInventory)) + return; + + CraftingInventory inv = (CraftingInventory)event.getInventory(); + + int make = 64; + + //Find Lowest Amount + for (ItemStack item : inv.getMatrix()) + if (item != null && item.getType() != Material.AIR) + if (item.getAmount() < make) + make = item.getAmount(); + + make = make-1; + + //Lower Amounts + for (int i=0 ; i make) + inv.getMatrix()[i].setAmount(inv.getMatrix()[i].getAmount() - make); + else + inv.getMatrix()[i].setAmount(1); + } + + //Get Result Data + int id = event.getCurrentItem().getTypeId(); + byte data = 0; + if (event.getCurrentItem().getData() != null) + data = event.getCurrentItem().getData().getData(); + int amount = event.getCurrentItem().getAmount(); + + //Crafter + String crafter = null; + if (event.getViewers().size() == 1 && event.getCurrentItem().getMaxStackSize() == 1) + crafter = event.getViewers().get(0).getName() + " Crafting"; + + //Give Result + for (int i=0 ; i lore) + { + return CreateStack(type.getId(), data, amount, (short)0, name, lore, null); + } + + public ItemStack CreateStack(int id, byte data, int amount, String name, List lore) + { + return CreateStack(id, data, amount, (short)0, name, lore, null); + } + + public ItemStack CreateStack(Material type, byte data, int amount, String name, String[] lore) + { + return CreateStack(type.getId(), data, amount, (short)0, name, ArrayToList(lore), null); + } + + public ItemStack CreateStack(int id, byte data, int amount, String name, String[] lore) + { + return CreateStack(id, data, amount, (short)0, name, ArrayToList(lore), null); + } + + public ItemStack CreateStack(Material type, byte data, int amount, short damage, String name, String[] lore) + { + return CreateStack(type.getId(), data, amount, damage, name, ArrayToList(lore), null); + } + + public ItemStack CreateStack(int id, byte data, int amount, short damage, String name, String[] lore) + { + return CreateStack(id, data, amount, damage, name, ArrayToList(lore), null); + } + + public ItemStack CreateStack(Material type, byte data, int amount, short damage, String name, List lore) + { + return CreateStack(type.getId(), data, amount, damage, name, lore, null); + } + + //XXX + public ItemStack CreateStack(Material type, byte data, int amount, String name, List lore, String owner) + { + return CreateStack(type.getId(), data, amount, (short)0, name, lore, owner); + } + + public ItemStack CreateStack(int id, byte data, int amount, String name, List lore, String owner) + { + return CreateStack(id, data, amount, (short)0, name, lore, owner); + } + + public ItemStack CreateStack(Material type, byte data, int amount, String name, String[] lore, String owner) + { + return CreateStack(type.getId(), data, amount, (short)0, name, ArrayToList(lore), owner); + } + + public ItemStack CreateStack(int id, byte data, int amount, String name, String[] lore, String owner) + { + return CreateStack(id, data, amount, (short)0, name, ArrayToList(lore), owner); + } + + public ItemStack CreateStack(Material type, byte data, int amount, short damage, String name, String[] lore, String owner) + { + return CreateStack(type.getId(), data, amount, damage, name, ArrayToList(lore), owner); + } + + public ItemStack CreateStack(int id, byte data, int amount, short damage, String name, String[] lore, String owner) + { + return CreateStack(id, data, amount, damage, name, ArrayToList(lore), owner); + } + + public ItemStack CreateStack(Material type, byte data, int amount, short damage, String name, List lore, String owner) + { + return CreateStack(type.getId(), data, amount, damage, name, lore, owner); + } + + //XXX Owner Variant End + + @SuppressWarnings("deprecation") + public ItemStack CreateStack(int id, byte data, int amount, short damage, String name, List lore, String owner) + { + ItemStack stack; + if (data == 0) + stack = new ItemStack(id, amount, damage); + else + stack = new ItemStack(id, amount, damage, data); + + ItemMeta itemMeta = stack.getItemMeta(); + + if (itemMeta == null) + return null; + + boolean setMeta = false; + + //Set Name + if (name != null) + { + itemMeta.setDisplayName(name); + setMeta = true; + } + else if (_customNames) + { + itemMeta.setDisplayName(GetName(stack, true)); + setMeta = true; + } + + //Default Lore + if (_lores != null && _lores.containsKey(id) && _lores.get(id).containsKey(data) && lore == null) + { + itemMeta.setLore(ArrayToList(_lores.get(id).get(data))); + setMeta = true; + } + + //Owner Lore + if (owner != null) + { + String[] tokens = owner.split(" "); + + String[] ownerLore = new String[tokens.length + 2]; + + ownerLore[0] = C.cGray + "Owner: " + C.cAqua + tokens[0]; + + if (ownerLore.length >= 3) + ownerLore[1] = C.cGray + "Source: " + C.cAqua + tokens[1]; + + ownerLore[ownerLore.length - 2] = C.cGray + "Created: " + C.cAqua + UtilTime.date(); + + ownerLore[ownerLore.length - 1] = ""; + + if (itemMeta.getLore() != null) itemMeta.setLore(CombineLore(itemMeta.getLore(), ArrayToList(ownerLore))); + else itemMeta.setLore(ArrayToList(ownerLore)); + + setMeta = true; + } + + //Set Lore + if (lore != null) + { + if (itemMeta.getLore() != null) itemMeta.setLore(CombineLore(itemMeta.getLore(), lore)); + else itemMeta.setLore(lore); + + setMeta = true; + } + + if (setMeta) + stack.setItemMeta(itemMeta); + + return stack; + } + + private List CombineLore(List A, List B) + { + for (String b : B) + A.add(b); + + return A; + } + + public List ArrayToList(String[] array) + { + if (array.length == 0) + return null; + + List list = new ArrayList(); + + for (String cur : array) + list.add(cur); + + return list; + } + + public String GetLoreVar(ItemStack stack, String var) + { + if (stack == null) + return null; + + ItemMeta meta = stack.getItemMeta(); + + if (meta == null) + return null; + + if (meta.getLore() == null) + return null; + + for (String cur : meta.getLore()) + if (cur.contains(var)) + { + int index = var.split(" ").length; + + String[] tokens = cur.split(" "); + + String out = ""; + for (int i=index ; i 0) + out = out.substring(0, out.length()-1); + + return out; + } + + return null; + } + + public int GetLoreVar(ItemStack stack, String var, int empty) + { + if (stack == null) + return empty; + + ItemMeta meta = stack.getItemMeta(); + + if (meta == null) + return 0; + + if (meta.getLore() == null) + return 0; + + for (String cur : meta.getLore()) + if (cur.contains(var)) + { + String[] tokens = cur.split(" "); + + try + { + return Integer.parseInt(tokens[tokens.length - 1]); + } + catch (Exception e) + { + return empty; + } + + } + + return 0; + } + + public void SetLoreVar(ItemStack stack, String var, String value) + { + if (stack == null) + return; + + ItemMeta meta = stack.getItemMeta(); + + if (meta == null) + return; + + ArrayList newLore = new ArrayList(); + + boolean inserted = false; + + if (meta.getLore() != null) + for (String lore : meta.getLore()) + { + if (!lore.contains(var)) + { + newLore.add(lore); + } + else + { + newLore.add(C.cGray + var + ":" + C.cGreen + " " + value); + inserted = true; + } + } + + if (!inserted) + newLore.add(C.cGray + var + ":" + C.cGreen + " " + value); + + meta.setLore(newLore); + + stack.setItemMeta(meta); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/ClientMessage.java b/Plugins/Mineplex.Core/src/mineplex/core/message/ClientMessage.java new file mode 100644 index 000000000..323e59347 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/ClientMessage.java @@ -0,0 +1,7 @@ +package mineplex.core.message; + +public class ClientMessage +{ + public String LastTo; + public String LastAdminTo; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/AdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/AdminCommand.java new file mode 100644 index 000000000..dc3917cdf --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/AdminCommand.java @@ -0,0 +1,65 @@ +package mineplex.core.message.Commands; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.message.MessageManager; + +public class AdminCommand extends CommandBase +{ + public AdminCommand(MessageManager plugin) + { + super(plugin, Rank.ALL, "a","admin"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args == null) + { + Plugin.Help(caller); + } + else + { + if (args.length == 0) + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Message argument missing.")); + return; + } + + //Parse Message + String message = F.combine(args, 0, null, false); + + //Inform + UtilPlayer.message(caller, F.rank(Plugin.GetClientManager().Get(caller).GetRank()) + " " + caller.getName() + " " + C.cPurple + message); + + //Send + boolean staff = false; + for (Player to : UtilServer.getPlayers()) + { + if (Plugin.GetClientManager().Get(to).GetRank().Has(Rank.HELPER)) + { + if (!to.equals(caller)) + UtilPlayer.message(to, F.rank(Plugin.GetClientManager().Get(caller).GetRank()) + " " + caller.getName() + " " + C.cPurple + message); + + staff = true; + + //Sound + to.playSound(to.getLocation(), Sound.NOTE_PLING, 0.5f, 2f); + } + } + + if (!staff) + UtilPlayer.message(caller, F.main(Plugin.GetName(), "There are no Staff Members online.")); + + //Log XXX + //Logger().logChat("Staff Chat", from, staff, message); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/MessageAdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/MessageAdminCommand.java new file mode 100644 index 000000000..6e2990a0c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/MessageAdminCommand.java @@ -0,0 +1,54 @@ +package mineplex.core.message.Commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.message.MessageManager; + +public class MessageAdminCommand extends CommandBase +{ + public MessageAdminCommand(MessageManager plugin) + { + super(plugin, Rank.ALL, "ma"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args == null) + { + Plugin.Help(caller); + } + else + { + if (!Plugin.GetClientManager().Get(caller).GetRank().Has(caller, Rank.HELPER, true)) + return; + + if (args.length == 0) + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Player argument missing.")); + return; + } + + //Parse To + Player to = UtilPlayer.searchOnline(caller, args[0], true); + if (to == null) + return; + + //Parse Message + if (args.length < 2) + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Message argument missing.")); + return; + } + + String message = F.combine(args, 1, null, false); + + //Send + Plugin.DoMessageAdmin(caller, to, message); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/MessageCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/MessageCommand.java new file mode 100644 index 000000000..11cba0416 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/MessageCommand.java @@ -0,0 +1,53 @@ +package mineplex.core.message.Commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.message.MessageManager; + +public class MessageCommand extends CommandBase +{ + public MessageCommand(MessageManager plugin) + { + super(plugin, Rank.ALL, "m","msg","message","tell","t"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args == null) + { + Plugin.Help(caller); + } + else + { + if (args.length == 0) + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Player argument missing.")); + return; + } + + //Parse To + Player to = UtilPlayer.searchOnline(caller, args[0], true); + if (to == null) + return; + + //Parse Message + String message = "Beep!"; + if (args.length > 1) + { + message = F.combine(args, 1, null, false); + } + else + { + message = Plugin.GetRandomMessage(); + } + + //Send! + Plugin.DoMessage(caller, to, message); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/ResendAdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/ResendAdminCommand.java new file mode 100644 index 000000000..3b7ce415b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/ResendAdminCommand.java @@ -0,0 +1,57 @@ +package mineplex.core.message.Commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.message.MessageManager; + +public class ResendAdminCommand extends CommandBase +{ + public ResendAdminCommand(MessageManager plugin) + { + super(plugin, Rank.ALL, "ra"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args == null) + { + Plugin.Help(caller); + } + else + { + if (!Plugin.GetClientManager().Get(caller).GetRank().Has(caller, Rank.HELPER, true)) + return; + + //Get To + if (Plugin.Get(caller).LastAdminTo == null) + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), "You have not admin messaged anyone recently.")); + return; + } + + Player to = UtilPlayer.searchOnline(caller, Plugin.Get(caller).LastAdminTo, false); + if (to == null) + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), F.name(Plugin.Get(caller).LastAdminTo) + " is no longer online.")); + return; + } + + //Parse Message + if (args.length < 1) + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Message argument missing.")); + return; + } + + String message = F.combine(args, 0, null, false); + + //Send + Plugin.DoMessageAdmin(caller, to, message); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/ResendCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/ResendCommand.java new file mode 100644 index 000000000..eb1aedcac --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/ResendCommand.java @@ -0,0 +1,56 @@ +package mineplex.core.message.Commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.message.MessageManager; + +public class ResendCommand extends CommandBase +{ + public ResendCommand(MessageManager plugin) + { + super(plugin, Rank.ALL, "r"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args == null) + { + Plugin.Help(caller); + } + else + { + //Get To + if (Plugin.Get(caller).LastTo == null) + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), "You have not messaged anyone recently.")); + return; + } + + Player to = UtilPlayer.searchOnline(caller, Plugin.Get(caller).LastTo, false); + if (to == null) + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), F.name(Plugin.Get(caller).LastTo) + " is no longer online.")); + return; + } + + //Parse Message + String message = "Beep!"; + if (args.length > 0) + { + message = F.combine(args, 0, null, false); + } + else + { + message = Plugin.GetRandomMessage(); + } + + //Send + Plugin.DoMessage(caller, to, message); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java new file mode 100644 index 000000000..5aad0228d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java @@ -0,0 +1,206 @@ +package mineplex.core.message; + +import java.util.LinkedList; + +import org.bukkit.ChatColor; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.message.Commands.*; + +public class MessageManager extends MiniClientPlugin +{ + private LinkedList _randomMessage; + + private CoreClientManager _clientManager; + + public MessageManager(JavaPlugin plugin, CoreClientManager clientManager) + { + super("Message", plugin); + + _clientManager = clientManager; + } + + //Module Functions + @Override + public void Enable() + { + _randomMessage = new LinkedList(); + _randomMessage.clear(); + _randomMessage.add("Hello, do you have any wild boars for purchase?"); + _randomMessage.add("There's a snake in my boot!"); + _randomMessage.add("Somebody's poisoned the waterhole!"); + _randomMessage.add("MORE ORBZ MORE ORBZ MORE ORBZ MORE ORBZ!"); + _randomMessage.add("Senwom is bad. Kill it with Wood Pickaxes!"); + _randomMessage.add("grrgo_ does the vote rolls"); + _randomMessage.add("Chiss is a chiss and chiss chiss."); + _randomMessage.add("*_*"); + _randomMessage.add("#swag"); + _randomMessage.add("Not on my hand."); + _randomMessage.add("Everything went better then I thought."); + _randomMessage.add("HAVE A CHICKEN!"); + _randomMessage.add("follow me, i have xrays"); + _randomMessage.add("I'm making a java"); + _randomMessage.add("close your eyes to sleep"); + _randomMessage.add("I crashed because my internet ran out."); + _randomMessage.add("I saw morgan freeman on a breaking bad ad on a bus."); + _randomMessage.add("Where is the volume control?"); + _randomMessage.add("You're worms must be worse than useless."); + _randomMessage.add("meow"); + _randomMessage.add("7"); + _randomMessage.add("7 cats meow meow meow meow meow meow meow"); + _randomMessage.add("I'm half bi, half straight"); + } + + + public void AddCommands() + { + AddCommand(new MessageCommand(this)); + AddCommand(new ResendCommand(this)); + + AddCommand(new MessageAdminCommand(this)); + AddCommand(new ResendAdminCommand(this)); + + + AddCommand(new AdminCommand(this)); + } + + public void Help(Player caller, String message) + { + UtilPlayer.message(caller, F.main(_moduleName, "Commands List:")); + UtilPlayer.message(caller, F.help("/npc add ", "Right click mob to attach npc.", Rank.OWNER)); + UtilPlayer.message(caller, F.help("/npc del ", "Right click npc to delete", Rank.OWNER)); + UtilPlayer.message(caller, F.help("/npc clear", "Removes all npcs", Rank.OWNER)); + UtilPlayer.message(caller, F.help("/npc home", " Teleport npcs to home locations.", Rank.OWNER)); + UtilPlayer.message(caller, F.help("/npc reattach", "Attempt to reattach npcs to entities.", Rank.OWNER)); + + if (message != null) + UtilPlayer.message(caller, F.main(_moduleName, ChatColor.RED + message)); + } + + public void Help(Player caller) + { + Help(caller, null); + } + /* + @Override + public void commands() + { + AddCommand("m"); + AddCommand("msg"); + AddCommand("message"); + AddCommand("tell"); + AddCommand("t"); + AddCommand("r"); + AddCommand("a"); + AddCommand("ma"); + AddCommand("ra"); + } + +/* XXX Incorporate this + PunishChatEvent event = new PunishChatEvent(caller); + + GetPlugin().getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + return; +*/ + + public void DoMessage(Player from, Player to, String message) + { + //Inform + UtilPlayer.message(from, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message); + + //Save + Get(from).LastTo = to.getName(); + + //Chiss + if (to.getName().equals("Chiss")) + { + UtilPlayer.message(from, C.cPurple + "Chiss is often AFK or minimized, due to plugin development."); + UtilPlayer.message(from, C.cPurple + "Please be patient if he does not reply instantly."); + } + + //Defek + if (to.getName().equals("defek7")) + { + UtilPlayer.message(from, C.cPurple + "defek7 is often AFK or minimized, due to plugin development."); + UtilPlayer.message(from, C.cPurple + "Please be patient if he does not reply instantly."); + } + + //Log + //Logger().logChat("Private Message", from, to.getName(), message); + + //Ignored XXX + //if (Get(to).Ignore().IsIgnored(from.getName())) + // return; + + //Sound + from.playSound(to.getLocation(), Sound.NOTE_PIANO, 1f, 1f); + to.playSound(to.getLocation(), Sound.NOTE_PIANO, 2f, 2f); + + //Send + UtilPlayer.message(to, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message); + } + + public void DoMessageAdmin(Player from, Player to, String message) + { + //Inform + UtilPlayer.message(from, C.cPurple + "-> " + F.rank(_clientManager.Get(to).GetRank()) + " " + to.getName() + " " + C.cPurple + message); + + //Inform Admins + for (Player staff : UtilServer.getPlayers()) + if (!to.equals(staff)) + if (!from.equals(staff)) + if (_clientManager.Get(staff).GetRank().Has(Rank.HELPER)) + UtilPlayer.message(staff, F.rank(_clientManager.Get(from).GetRank()) + " " + from.getName() + + C.cPurple + " -> " + F.rank(_clientManager.Get(to).GetRank()) + " " + to.getName() + " " + C.cPurple + message); + + //Save + Get(from).LastAdminTo = to.getName(); + + //Send + UtilPlayer.message(to, C.cPurple + "<- " + F.rank(_clientManager.Get(from).GetRank()) + " " + from.getName() + " " + C.cPurple + message); + + //Sound + from.playSound(to.getLocation(), Sound.NOTE_PIANO, 1f, 1f); + to.playSound(to.getLocation(), Sound.NOTE_PIANO, 2f, 2f); + + //Log XXX + //Logger().logChat("Staff Message", from, to.getName(), message); + } + + @Override + protected ClientMessage AddPlayer(String player) + { + Set(player, new ClientMessage()); + return Get(player); + } + + public LinkedList GetRandomMessages() + { + return _randomMessage; + } + + public String GetRandomMessage() + { + if (_randomMessage.isEmpty()) + return "meow"; + + return _randomMessage.get(UtilMath.r(_randomMessage.size())); + } + + public CoreClientManager GetClientManager() + { + return _clientManager; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/movement/ClientMovement.java b/Plugins/Mineplex.Core/src/mineplex/core/movement/ClientMovement.java new file mode 100644 index 000000000..ab3c71f33 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/movement/ClientMovement.java @@ -0,0 +1,10 @@ +package mineplex.core.movement; + +import org.bukkit.Location; + +public class ClientMovement +{ + public long LastGrounded = 0; + public long LastMovement = 0; + public Location LastLocation; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java b/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java new file mode 100644 index 000000000..73271a739 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java @@ -0,0 +1,47 @@ +package mineplex.core.movement; + +import mineplex.core.MiniClientPlugin; +import mineplex.core.common.util.UtilMath; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + +public class Movement extends MiniClientPlugin +{ + public Movement(JavaPlugin plugin) + { + super("Movement", plugin); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() == UpdateType.TICK) + { + for (Player cur : GetPlugin().getServer().getOnlinePlayers()) + { + ClientMovement player = Get(cur); + + if (player.LastLocation != null) + if (UtilMath.offset(player.LastLocation, cur.getLocation()) > 0) + player.LastMovement = System.currentTimeMillis(); + + player.LastLocation = cur.getLocation(); + + //Save Grounded + if (((CraftPlayer)cur).getHandle().onGround) + player.LastGrounded = System.currentTimeMillis(); + } + } + } + + @Override + protected ClientMovement AddPlayer(String player) + { + return new ClientMovement(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/AddCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/AddCommand.java new file mode 100644 index 000000000..1270fc2e5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/AddCommand.java @@ -0,0 +1,89 @@ +package mineplex.core.npc.Commands; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnum; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.npc.NpcManager; + +public class AddCommand extends CommandBase +{ + public AddCommand(NpcManager plugin) + { + super(plugin, Rank.OWNER, "add"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args == null) + { + Plugin.Help(caller); + } + else + { + try + { + int radius = Integer.parseInt(args[0]); + String mobName = null; + + if (args.length > 1) + { + mobName = args[1]; + + if (args.length > 2) + { + for (int i = 2; i < args.length; i++) + { + mobName += " " + args[i]; + } + } + + while (mobName.indexOf('(') != -1) + { + int startIndex = mobName.indexOf('('); + + if (mobName.indexOf(')') == -1) + break; + + int endIndex = mobName.indexOf(')'); + + if (endIndex < startIndex) + break; + + String originalText = mobName.substring(startIndex, endIndex + 1); + String colorString = mobName.substring(startIndex + 1, endIndex); + + ChatColor color = UtilEnum.fromString(ChatColor.class, colorString); + + mobName = mobName.replace(originalText, color + ""); + } + } + + /* + if (mobName.indexOf('_') != -1) + { + String[] mobParts = mobName.split("_"); + mobName = mobParts[0]; + mobSecondLine = mobParts[1]; + } + */ + + Plugin.SetNpcInfo(caller, radius, mobName, caller.getLocation()); + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Location set, now right click entity.")); + } + catch(NumberFormatException exception) + { + Plugin.Help(caller, "Invalid radius."); + } + catch(IllegalArgumentException exception) + { + Plugin.Help(caller, "Invalid color."); + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/ClearCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/ClearCommand.java new file mode 100644 index 000000000..d0551d725 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/ClearCommand.java @@ -0,0 +1,31 @@ +package mineplex.core.npc.Commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.npc.NpcManager; + +public class ClearCommand extends CommandBase +{ + public ClearCommand(NpcManager plugin) + { + super(plugin, Rank.OWNER, "clear"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args != null) + { + Plugin.Help(caller); + } + else + { + Plugin.ClearNpcs(); + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Cleared npcs.")); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/DeleteCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/DeleteCommand.java new file mode 100644 index 000000000..5116bbcae --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/DeleteCommand.java @@ -0,0 +1,31 @@ +package mineplex.core.npc.Commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.npc.NpcManager; + +public class DeleteCommand extends CommandBase +{ + public DeleteCommand(NpcManager plugin) + { + super(plugin, Rank.OWNER, "del"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args != null) + { + Plugin.Help(caller); + } + else + { + Plugin.PrepDeleteNpc(caller); + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Now right click npc.")); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/HomeCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/HomeCommand.java new file mode 100644 index 000000000..40e0120b6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/HomeCommand.java @@ -0,0 +1,31 @@ +package mineplex.core.npc.Commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.npc.NpcManager; + +public class HomeCommand extends CommandBase +{ + public HomeCommand(NpcManager plugin) + { + super(plugin, Rank.OWNER, "home"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args != null) + { + Plugin.Help(caller); + } + else + { + Plugin.TeleportNpcsHome(); + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Npcs teleported to home locations.")); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/NpcCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/NpcCommand.java new file mode 100644 index 000000000..bce52ea3e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/NpcCommand.java @@ -0,0 +1,27 @@ +package mineplex.core.npc.Commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.MultiCommandBase; +import mineplex.core.common.Rank; +import mineplex.core.npc.NpcManager; + +public class NpcCommand extends MultiCommandBase +{ + public NpcCommand(NpcManager plugin) + { + super(plugin, Rank.OWNER, "npc"); + + AddCommand(new AddCommand(plugin)); + AddCommand(new DeleteCommand(plugin)); + AddCommand(new ClearCommand(plugin)); + AddCommand(new HomeCommand(plugin)); + AddCommand(new ReattachCommand(plugin)); + } + + @Override + protected void Help(Player caller, String args[]) + { + Plugin.Help(caller); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/ReattachCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/ReattachCommand.java new file mode 100644 index 000000000..6e188343e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/Commands/ReattachCommand.java @@ -0,0 +1,31 @@ +package mineplex.core.npc.Commands; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.npc.NpcManager; + +import org.bukkit.entity.Player; + +public class ReattachCommand extends CommandBase +{ + public ReattachCommand(NpcManager plugin) + { + super(plugin, Rank.OWNER, "reattach"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args != null) + { + Plugin.Help(caller); + } + else + { + Plugin.ReattachNpcs(); + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Npcs reattached.")); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcEntry.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcEntry.java new file mode 100644 index 000000000..dd57e12cc --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcEntry.java @@ -0,0 +1,53 @@ +package mineplex.core.npc; + +import net.minecraft.server.v1_6_R2.EntityCreature; + +import org.bukkit.entity.Entity; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftCreature; +import org.bukkit.Location; + +public class NpcEntry +{ + public String Name; + public Entity Entity; + public int Radius; + public Location Location; + + private boolean _returning = false; + + public NpcEntry(String name, Entity entity, int radius, Location location) + { + Name = name; + Entity = entity; + Radius = radius; + Location = location; + } + + public void ReturnToPost() + { + EntityCreature ec = ((CraftCreature)Entity).getHandle(); + ec.getNavigation().a(Location.getX(), Location.getY(), Location.getZ(), .8f); + + _returning = true; + } + + public boolean IsInRadius() + { + Location entityLocation = Entity.getLocation(); + return Math.abs(entityLocation.getBlockX() - Location.getBlockX()) + Math.abs(entityLocation.getBlockY() - Location.getBlockY()) + Math.abs(entityLocation.getBlockZ() - Location.getBlockZ()) <= Radius; + } + + public boolean Returning() + { + return _returning; + } + + public void ClearGoals() + { + _returning = false; + + Location entityLocation = Entity.getLocation(); + EntityCreature ec = ((CraftCreature)Entity).getHandle(); + ec.getNavigation().a(entityLocation.getX(), entityLocation.getY(), entityLocation.getZ(), .8f); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java new file mode 100644 index 000000000..3baac0a00 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java @@ -0,0 +1,517 @@ +package mineplex.core.npc; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.HashSet; +import java.util.Iterator; +import java.util.UUID; + +import net.minecraft.server.v1_6_R2.EntityAgeable; +import net.minecraft.server.v1_6_R2.EntityInsentient; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.World.Environment; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftAgeable; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.world.ChunkLoadEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.creature.Creature; +import mineplex.core.creature.event.CreatureKillEntitiesEvent; +import mineplex.core.npc.Commands.NpcCommand; + +public class NpcManager extends MiniPlugin +{ + private Creature _creature; + private NautHashMap _npcs; + private NautHashMap _failedAttempts; + + private NautHashMap _addTempList; + private HashSet _delTempList; + + + public NpcManager(JavaPlugin plugin, Creature creature) + { + super("NpcManager", plugin); + + _creature = creature; + _npcs = new NautHashMap(); + _failedAttempts = new NautHashMap(); + _addTempList = new NautHashMap(); + _delTempList = new HashSet(); + + _plugin.getServer().getScheduler().scheduleSyncRepeatingTask(_plugin, new Runnable() + { + public void run() + { + UpdateNpcLocations(); + } + }, 0L, 20L); + + _plugin.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() + { + public void run() + { + ReattachNpcs(); + } + }, 100L); + + _plugin.getServer().getPluginManager().registerEvents(this, _plugin); + + LoadNpcs(); + } + + public void AddCommands() + { + AddCommand(new NpcCommand(this)); + } + + public void Help(Player caller, String message) + { + UtilPlayer.message(caller, F.main(_moduleName, "Commands List:")); + UtilPlayer.message(caller, F.help("/npc add ", "Right click mob to attach npc.", Rank.OWNER)); + UtilPlayer.message(caller, F.help("/npc del ", "Right click npc to delete", Rank.OWNER)); + UtilPlayer.message(caller, F.help("/npc clear", "Removes all npcs", Rank.OWNER)); + UtilPlayer.message(caller, F.help("/npc home", " Teleport npcs to home locations.", Rank.OWNER)); + UtilPlayer.message(caller, F.help("/npc reattach", "Attempt to reattach npcs to entities.", Rank.OWNER)); + + if (message != null) + UtilPlayer.message(caller, F.main(_moduleName, ChatColor.RED + message)); + } + + public void Help(Player caller) + { + Help(caller, null); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void OnEntityDamage(EntityDamageEvent event) + { + if (_npcs.containsKey(event.getEntity().getUniqueId().toString())) + { + event.setCancelled(true); + return; + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void OnCreatureKillEntities(CreatureKillEntitiesEvent event) + { + Iterator entityIterator = event.GetEntities().iterator(); + + while (entityIterator.hasNext()) + { + if (_npcs.containsKey(entityIterator.next().getUniqueId().toString())) + { + entityIterator.remove(); + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void OnEntityTarget(EntityTargetEvent event) + { + if (_npcs.containsKey(event.getEntity().getUniqueId().toString())) + { + event.setCancelled(true); + return; + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void OnEntityCombust(EntityCombustEvent event) + { + if (_npcs.containsKey(event.getEntity().getUniqueId().toString())) + { + event.setCancelled(true); + return; + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void OnChunkLoad(ChunkLoadEvent event) + { + for (Entity entity : event.getChunk().getEntities()) + { + if (_npcs.containsKey(entity.getUniqueId().toString())) + { + _npcs.get(entity.getUniqueId().toString()).Name = ((LivingEntity)entity).getCustomName(); + _npcs.get(entity.getUniqueId().toString()).Entity = entity; + + if (_npcs.get(entity.getUniqueId().toString()).Radius == 0 && entity instanceof CraftCreature) + { + UtilEnt.Vegetate((org.bukkit.entity.Creature)entity); + } + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onPlayerInteractEntity(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() instanceof LivingEntity) + { + if (_addTempList.containsKey(event.getPlayer().getName())) + { + if (event.getRightClicked().getType() == EntityType.PLAYER) + { + event.getPlayer().sendMessage(F.main(GetName(), "Failed to add npc. Can't attach to player.")); + } + else + { + LivingEntity npc = ((LivingEntity)event.getRightClicked()); + + if (_addTempList.get(event.getPlayer().getName()).Name != null) + { + npc.setCustomName(_addTempList.get(event.getPlayer().getName()).Name); + npc.setCustomNameVisible(true); + } + + npc.getEquipment().setArmorContents(event.getPlayer().getInventory().getArmorContents()); + npc.getEquipment().setItemInHand(event.getPlayer().getItemInHand()); + npc.setCanPickupItems(false); + ((EntityInsentient)((CraftLivingEntity)npc).getHandle()).persistent = true; + + if (npc instanceof Creature) + { + ((org.bukkit.entity.Creature)npc).setTarget(null); + } + + AddNpc(npc, _addTempList.get(event.getPlayer().getName()), true); + event.getPlayer().sendMessage(F.main(GetName(), "Added npc")); + } + + _addTempList.remove(event.getPlayer().getName()); + } + else if (_delTempList.contains(event.getPlayer().getName())) + { + if (DeleteNpc(event.getRightClicked())) + { + event.getPlayer().sendMessage(F.main(GetName(), "Deleted npc.")); + } + else + { + event.getPlayer().sendMessage(F.main(GetName(), "Failed to delete npc. That one isn't in the list.")); + } + + _delTempList.remove(event.getPlayer().getName()); + } + + if (_npcs.containsKey(event.getRightClicked().getUniqueId().toString())) + { + event.setCancelled(true); + return; + } + } + } + + public void SetNpcInfo(Player admin, int radius, String name, Location location) + { + _addTempList.put(admin.getName(), new NpcEntry(name, null, radius, location)); + } + + public Entity AddNpc(EntityType entityType, int radius, String name, Location location) + { + LivingEntity entity = (LivingEntity) _creature.SpawnEntity(location, entityType); + + entity.setCustomName(name); + entity.setCustomNameVisible(true); + + entity.setCanPickupItems(false); + entity.setRemoveWhenFarAway(false); + ((EntityInsentient)((CraftLivingEntity)entity).getHandle()).persistent = true; + + if (((CraftLivingEntity)entity).getHandle() instanceof EntityAgeable) + { + ((CraftAgeable)entity).getHandle().ageLocked = true; + } + + if (entity instanceof Creature) + { + ((org.bukkit.entity.Creature)entity).setTarget(null); + } + + return AddNpc(entity, new NpcEntry(name, null, radius, location), true); + } + + public Entity AddNpc(LivingEntity entity, NpcEntry entry, boolean save) + { + entry.Entity = entity; + _npcs.put(entity.getUniqueId().toString(), entry); + + if (entry.Radius == 0 && entity instanceof CraftCreature) + { + UtilEnt.Vegetate((org.bukkit.entity.Creature)entry.Entity); + } + + if (save) + SaveNpcs(); + + return entity; + } + + public boolean DeleteNpc(Entity entity) + { + if (entity instanceof LivingEntity) + { + if (_npcs.containsKey(entity.getUniqueId().toString())) + { + entity.remove(); + _npcs.remove(entity.getUniqueId().toString()); + + return true; + } + } + + return false; + } + + public void PrepDeleteNpc(Player admin) + { + _delTempList.add(admin.getName()); + } + + public void ClearNpcs() + { + Iterator npcIterator = _npcs.keySet().iterator(); + + while (npcIterator.hasNext()) + { + String id = npcIterator.next(); + + if (_npcs.get(id).Entity != null) + _npcs.get(id).Entity.remove(); + + npcIterator.remove(); + } + + SaveNpcs(); + } + + private void UpdateNpcLocations() + { + for (NpcEntry npc : _npcs.values()) + { + if (npc.Entity == null) + { + continue; + } + + npc.Entity.setTicksLived(1); + ((EntityInsentient)((CraftLivingEntity)npc.Entity).getHandle()).persistent = true; + + if (!IsNpcChunkLoaded(npc.Entity) || !(npc.Entity instanceof CraftCreature)) + { + continue; + } + + if (!npc.Entity.isDead() && npc.Entity.isValid()) + { + String uuid = npc.Entity.getUniqueId().toString(); + + ((LivingEntity)npc.Entity).getEquipment().getArmorContents()[3].setDurability((short)0); + + if (!_failedAttempts.containsKey(uuid)) + _failedAttempts.put(uuid, 0); + + if (_failedAttempts.get(uuid) >= 10) + { + npc.Entity.teleport(npc.Location); + _failedAttempts.put(uuid, 0); + } + else if (!npc.IsInRadius()) + { + npc.ReturnToPost(); + _failedAttempts.put(uuid, _failedAttempts.get(uuid) + 1); + } + else + { + if (npc.Returning()) + { + npc.ClearGoals(); + } + + _failedAttempts.put(uuid, 0); + } + } + } + } + + public void TeleportNpcsHome() + { + for (NpcEntry npc : _npcs.values()) + { + if (npc.Entity == null) + { + continue; + } + + if (!IsNpcChunkLoaded(npc.Entity)) + { + continue; + } + + if (!npc.Entity.isDead() && npc.Entity.isValid()) + { + npc.Entity.teleport(npc.Location); + _failedAttempts.put(npc.Entity.getUniqueId().toString(), 0); + } + } + } + + public void ReattachNpcs() + { + for (Entity entity : UtilWorld.getWorldType(Environment.NORMAL).getEntities()) + { + if (_npcs.containsKey(entity.getUniqueId().toString())) + { + _npcs.get(entity.getUniqueId().toString()).Name = ((LivingEntity)entity).getCustomName(); + _npcs.get(entity.getUniqueId().toString()).Entity = entity; + } + } + } + + public boolean IsNpcChunkLoaded(Entity entity) + { + return entity.getWorld().isChunkLoaded(entity.getLocation().getBlockX() >> 4, entity.getLocation().getBlockZ() >> 4); + } + + public void LoadNpcs() + { + FileInputStream fstream = null; + BufferedReader br = null; + + try + { + File npcFile = new File("npcs.dat"); + + if (npcFile.exists()) + { + fstream = new FileInputStream(npcFile); + br = new BufferedReader(new InputStreamReader(fstream)); + + String line = br.readLine(); + + while (line != null) + { + UUID uuid = UUID.fromString(line.split(" ")[0]); + String location = line.split(" ")[1]; + Integer radius = Integer.parseInt(line.split(" ")[2]); + + _npcs.put(uuid.toString(), new NpcEntry(null, null, radius, UtilWorld.strToLoc(location))); + + line = br.readLine(); + } + } + } + catch (Exception e) + { + System.out.println(F.main(GetName(), "Error parsing npc file.")); + } + finally + { + if (br != null) + { + try + { + br.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + public void SaveNpcs() + { + FileWriter fstream = null; + BufferedWriter out = null; + + try + { + fstream = new FileWriter("npcs.dat"); + out = new BufferedWriter(fstream); + + for (String key : _npcs.keySet()) + { + out.write(key + " " + UtilWorld.locToStr(_npcs.get(key).Location) + " " + _npcs.get(key).Radius); + out.newLine(); + } + + out.close(); + } + catch (Exception e) + { + System.err.println("Npc Save Error: " + e.getMessage()); + } + finally + { + if (out != null) + { + try + { + out.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + public NpcEntry GetNpcByUUID(UUID uniqueId) + { + return _npcs.get(uniqueId.toString()); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/IPacketRunnable.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/IPacketRunnable.java new file mode 100644 index 000000000..b7e600af8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/IPacketRunnable.java @@ -0,0 +1,10 @@ +package mineplex.core.packethandler; + +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_6_R2.Packet; + +public interface IPacketRunnable +{ + boolean run(Packet packet, Player owner, PacketArrayList packetList); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketArrayList.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketArrayList.java new file mode 100644 index 000000000..9b42ac316 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketArrayList.java @@ -0,0 +1,159 @@ +package mineplex.core.packethandler; + +import java.lang.reflect.Field; +import java.util.ArrayList; + +import net.minecraft.server.v1_6_R2.Packet; +import net.minecraft.server.v1_6_R2.Packet28EntityVelocity; +import net.minecraft.server.v1_6_R2.Packet31RelEntityMove; +import net.minecraft.server.v1_6_R2.Packet33RelEntityMoveLook; +import net.minecraft.server.v1_6_R2.Packet34EntityTeleport; +import net.minecraft.server.v1_6_R2.Packet40EntityMetadata; + +import org.bukkit.entity.Player; + +public class PacketArrayList extends ArrayList +{ + private static final long serialVersionUID = 1L; + private Player _owner; + private PacketHandler _handler; + private Field _packet40Metadata; + + public PacketArrayList(Player owner, PacketHandler handler) + { + _owner = owner; + _handler = handler; + + try + { + _packet40Metadata = Packet40EntityMetadata.class.getDeclaredField("b"); + } + catch (NoSuchFieldException e) + { + e.printStackTrace(); + } + catch (SecurityException e) + { + e.printStackTrace(); + } + + _packet40Metadata.setAccessible(true); + } + + @Override + public boolean add(Packet o) + { + /* + else if (o instanceof Packet201PlayerInfo) + { + if (!_handler.IsTracked((Packet201PlayerInfo)o)) + return false; + //if (( && _packetHandler.IsPlayerTracked(((Packet201PlayerInfo)o).a) ) + //{ + // return false; + //} + } + else if (o instanceof Packet40EntityMetadata) + { + List objects = null; + try + { + objects = (List)_packet40Metadata.get(((Packet40EntityMetadata)o)); + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + System.out.println("Packet40EntityMetadata for " + ((Packet40EntityMetadata)o).a); + + if (objects != null) + { + for (WatchableObject watched : objects) + { + System.out.println("a(" + watched.a() + ", " + watched.b() + ") " + GetDataType(watched.c())); + } + } + + System.out.println("End Packet40EntityMetadata"); + } + */ + if (o instanceof Packet34EntityTeleport) + { + Packet34EntityTeleport packet = (Packet34EntityTeleport)o; + + if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a)) + { + return super.add(new Packet34EntityTeleport(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d, packet.e, packet.f)); + } + else if (_handler.IsBlocked(_owner, packet.a)) + return false; + } + else if (o instanceof Packet28EntityVelocity) + { + Packet28EntityVelocity packet = (Packet28EntityVelocity)o; + + //System.out.println("Packet28EntityVelocity (" + packet.b / 8000.0D + ", " + packet.c / 8000.0D + ", " + packet.d / 8000.0D + ")"); + + if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a)) + { + // Occasional velocity sent for player in MK jacks up karts so don't process this. + return false; + } + else if (_handler.IsBlocked(_owner, packet.a)) + return false; + } + else if (o instanceof Packet31RelEntityMove) + { + Packet31RelEntityMove packet = (Packet31RelEntityMove)o; + + //System.out.println("Packet31RelEntityMove (" + packet.b + ", " + packet.c + ", " + packet.d + ")"); + + if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a)) + { + return super.add(new Packet31RelEntityMove(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d)); + } + else if (_handler.IsBlocked(_owner, packet.a)) + return false; + } + else if (o instanceof Packet33RelEntityMoveLook) + { + Packet33RelEntityMoveLook packet = (Packet33RelEntityMoveLook)o; + + //System.out.println("Packet33RelEntityMoveLook (" + packet.b + ", " + packet.c + ", " + packet.d + ")"); + + if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a)) + { + return super.add(new Packet33RelEntityMoveLook(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d, packet.e, packet.f)); + } + else if (_handler.IsBlocked(_owner, packet.a)) + return false; + } + /* + else if (!(o instanceof Packet206SetScoreboardObjective) && !(o instanceof Packet207SetScoreboardScore) && !(o instanceof Packet208SetScoreboardDisplayObjective) && !(o instanceof Packet56MapChunkBulk) && !(o instanceof Packet0KeepAlive) && !(o instanceof Packet4UpdateTime) && !(o instanceof Packet43SetExperience) && !(o instanceof Packet35EntityHeadRotation) && !(o instanceof Packet32EntityLook)) + { + System.out.println(o.getClass()); + } + */ + + if (_handler.FireRunnables(o, _owner, this)) + { + return forceAdd(o); + } + + return true; + } + + public boolean forceAdd(Packet packet) + { + return super.add(packet); + } + + public void Deactivate() + { + _owner = null; + _packet40Metadata = null; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java new file mode 100644 index 000000000..efe4b775c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java @@ -0,0 +1,293 @@ +package mineplex.core.packethandler; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.logging.Level; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.NautHashMap; +import net.minecraft.server.v1_6_R2.NetworkManager; +import net.minecraft.server.v1_6_R2.Packet; + +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; + +@SuppressWarnings( { "rawtypes", "unchecked" } ) +public class PacketHandler extends MiniPlugin +{ + private Field syncField; + private Field highField; + + private NautHashMap> _forwardMap; + private NautHashMap> _blockMap; + private NautHashMap> _fakeVehicleMap; + private NautHashMap> _fakePassengerMap; + private ArrayList _packetRunnables; + + public PacketHandler(JavaPlugin plugin) + { + super("PacketHandler", plugin); + + _forwardMap = new NautHashMap>(); + _blockMap = new NautHashMap>(); + _fakeVehicleMap = new NautHashMap>(); + _fakePassengerMap = new NautHashMap>(); + _packetRunnables = new ArrayList(); + + try + { + this.syncField = NetworkManager.class.getDeclaredField("h"); + this.syncField.setAccessible(true); + this.highField = NetworkManager.class.getDeclaredField("highPriorityQueue"); + this.highField.setAccessible(true); + } + catch (final Exception e) + { + System.out.println("Error initializing " + GetName() + " NetworkManager fields..."); + } + } + + public String GetDataType(int c) + { + switch (c) + { + case 0: + return "Byte"; + case 1: + return "Short"; + case 2: + return "Integer"; + case 3: + return "Float"; + case 4: + return "String"; + case 5: + return "ItemStack"; + case 6: + return "ChunkCoordinates"; + } + + return "Say what?"; + } + + public void AddPacketRunnable(IPacketRunnable runnable) + { + _packetRunnables.add(runnable); + } + + public void RemovePacketRunnable(IPacketRunnable runnable) + { + _packetRunnables.remove(runnable); + } + + public Packet GetFakeAttached(Player owner, int a) + { + return _fakeVehicleMap.get(owner.getName()).get(a); + } + + public boolean IsFakeAttached(Player owner, int a) + { + return _fakeVehicleMap.containsKey(owner.getName()) && _fakeVehicleMap.get(owner.getName()).containsKey(a); + } + public Packet GetFakePassenger(Player owner, int a) + { + return _fakePassengerMap.get(owner.getName()).get(a); + } + + public boolean IsFakePassenger(Player owner, int a) + { + return _fakePassengerMap.containsKey(owner.getName()) && _fakePassengerMap.get(owner.getName()).containsKey(a); + } + + public boolean IsBlocked(Player owner, int a) + { + return _blockMap.containsKey(owner.getName()) && _blockMap.get(owner.getName()).contains(a); + } + + public int GetForwardId(Player owner, int a) + { + return _forwardMap.get(owner.getName()).get(a); + } + + public boolean IsForwarded(Player owner, int a) + { + return _forwardMap.get(owner.getName()).containsKey(a); + } + + public boolean IsForwarding(Player owner) + { + return _forwardMap.containsKey(owner.getName()); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onPlayerJoin(PlayerJoinEvent event) + { + in(event.getPlayer()); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onPlayerQuit(PlayerQuitEvent event) + { + out(event.getPlayer()); + } + + public void in(Player player) + { + try + { + this.nom(this.getManager(player), Collections.synchronizedList(new PacketArrayList(player, this))); + + } + catch (final Exception e) + { + // new TagAPIException("[TagAPI] Failed to inject into networkmanager for " + player.getName(), e).printStackTrace(); + } + } + + public void out(Player player) + { + try + { + this.nom(this.getManager(player), Collections.synchronizedList(new ArrayList()), true); + } + catch (final Exception e) + { + this._plugin.getLogger().log(Level.WARNING, "Failed to restore " + player.getName() + ". Could be a problem.", e); + } + } + + public void shutdown() + { + for (final Player player : this._plugin.getServer().getOnlinePlayers()) + { + if (player != null) + { + this.out(player); + } + } + } + + private NetworkManager getManager(Player player) + { + return (NetworkManager) ((CraftPlayer) player).getHandle().playerConnection.networkManager; + } + + private void nom(NetworkManager nm, List list) throws IllegalArgumentException, IllegalAccessException + { + this.nom(nm, list, false); + } + + private void nom(NetworkManager nm, List list, boolean onlyIfOldIsHacked) throws IllegalArgumentException, IllegalAccessException + { + final List old = (List) this.highField.get(nm); + boolean copy = true; + + if (onlyIfOldIsHacked) + { + if (!(old instanceof PacketArrayList)) + { + return; + } + else + { + copy = false; + ((PacketArrayList)old).Deactivate(); + } + } + + synchronized (this.syncField.get(nm)) + { + if (copy) + { + for (final Object object : old) + { + list.add(object); + } + } + + this.highField.set(nm, list); + } + } + + public void ForwardMovement(Player viewer, int travellerId, int entityId) + { + if (!_forwardMap.containsKey(viewer.getName())) + { + _forwardMap.put(viewer.getName(), new NautHashMap()); + } + + _forwardMap.get(viewer.getName()).put(travellerId, entityId); + } + + public void BlockMovement(Player otherPlayer, int entityId) + { + if (!_blockMap.containsKey(otherPlayer.getName())) + { + _blockMap.put(otherPlayer.getName(), new HashSet()); + } + + _blockMap.get(otherPlayer.getName()).add(entityId); + } + + public void FakeVehicle(Player viewer, int entityId, Packet packet) + { + if (!_fakeVehicleMap.containsKey(viewer.getName())) + { + _fakeVehicleMap.put(viewer.getName(), new NautHashMap()); + } + + _fakeVehicleMap.get(viewer.getName()).put(entityId, packet); + } + + public void RemoveFakeVehicle(Player viewer, int entityId) + { + if (_fakeVehicleMap.containsKey(viewer.getName())) + { + _fakeVehicleMap.get(viewer.getName()).remove(entityId); + } + } + + public void FakePassenger(Player viewer, int entityId, Packet packet) + { + if (!_fakePassengerMap.containsKey(viewer.getName())) + { + _fakePassengerMap.put(viewer.getName(), new NautHashMap()); + } + + _fakePassengerMap.get(viewer.getName()).put(entityId, packet); + } + + public void RemoveFakePassenger(Player viewer, int entityId) + { + if (_fakePassengerMap.containsKey(viewer.getName())) + { + _fakePassengerMap.get(viewer.getName()).remove(entityId); + } + } + + public void RemoveForward(Player viewer) + { + _forwardMap.remove(viewer.getName()); + } + + public boolean FireRunnables(Packet o, Player owner, PacketArrayList packetList) + { + boolean addOriginal = true; + + for (IPacketRunnable packetRunnable : _packetRunnables) + { + if (!packetRunnable.run(o, owner, packetList)) + addOriginal = false; + } + + return addOriginal; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java new file mode 100644 index 000000000..f46270451 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java @@ -0,0 +1,48 @@ +package mineplex.core.pet; + +import mineplex.core.common.CurrencyType; +import mineplex.core.pet.repository.token.PetSalesToken; +import mineplex.core.shop.item.SalesPackageBase; +import mineplex.core.shop.item.ShopItem; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +public class Pet extends SalesPackageBase +{ + private String _name; + private EntityType _petType; + + public Pet(String name, EntityType petType, int cost) + { + super(name, Material.MONSTER_EGG, (byte)petType.getTypeId(), new String[] { "Right click the ground with me!" }); + + _name = name; + _petType = petType; + CurrencyCostMap.put(CurrencyType.Gems, cost); + + KnownPackage = false; + } + + public EntityType GetPetType() + { + return _petType; + } + + public void Update(PetSalesToken petToken) + { + _name = petToken.Name; + } + + public String GetPetName() + { + return _name; + } + + @Override + public void Sold(Player player, CurrencyType currencyType) + { + player.getInventory().addItem(new ShopItem(Material.MONSTER_EGG, (byte)GetPetType().getTypeId(), GetPetName(), new String[] { }, 1, false, false)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetClient.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetClient.java new file mode 100644 index 000000000..5aa25843a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetClient.java @@ -0,0 +1,43 @@ +package mineplex.core.pet; + +import org.bukkit.entity.EntityType; + +import mineplex.core.common.util.NautHashMap; +import mineplex.core.pet.repository.token.ClientPetToken; +import mineplex.core.pet.repository.token.PetToken; + +public class PetClient +{ + private NautHashMap _pets; + private int _petNameTagCount; + + public void Load(ClientPetToken token) + { + _pets = new NautHashMap(); + + for (PetToken petToken : token.Pets) + { + if (petToken.PetName == null) + petToken.PetName = Enum.valueOf(EntityType.class, petToken.PetType).getName(); + + _pets.put(Enum.valueOf(EntityType.class, petToken.PetType), petToken.PetName); + } + + _petNameTagCount = Math.max(0, token.PetNameTagCount); + } + + public NautHashMap GetPets() + { + return _pets; + } + + public Integer GetPetNameTagCount() + { + return _petNameTagCount; + } + + public void SetPetNameTagCount(int count) + { + _petNameTagCount = count; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetExtra.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetExtra.java new file mode 100644 index 000000000..3be984ed4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetExtra.java @@ -0,0 +1,49 @@ +package mineplex.core.pet; + +import mineplex.core.common.CurrencyType; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.pet.repository.token.PetExtraToken; +import mineplex.core.shop.item.SalesPackageBase; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class PetExtra extends SalesPackageBase +{ + private String _name; + private Material _material; + + public PetExtra(String name, Material material, int cost) + { + super(name, material, (byte)0, new String[] { ChatColor.RESET + "" + ChatColor.GRAY + "Right-click pet to apply nametag" }); + + _name = name; + _material = material; + CurrencyCostMap.put(CurrencyType.Gems, cost); + + KnownPackage = false; + OneTimePurchaseOnly = false; + } + + public void Update(PetExtraToken token) + { + + } + + public String GetName() + { + return _name; + } + + public Material GetMaterial() + { + return _material; + } + + @Override + public void Sold(Player player, CurrencyType currencyType) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NAME_TAG, (byte)0, 1, GetName(), GetDescription())); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java new file mode 100644 index 000000000..416629ba0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java @@ -0,0 +1,99 @@ +package mineplex.core.pet; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import mineplex.core.common.util.NautHashMap; +import mineplex.core.pet.repository.PetRepository; +import mineplex.core.pet.repository.token.PetExtraToken; +import mineplex.core.pet.repository.token.PetSalesToken; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; + +public class PetFactory +{ + private PetRepository _repository; + private NautHashMap _pets; + private NautHashMap _petExtras; + + public PetFactory(PetRepository repository) + { + _repository = repository; + _pets = new NautHashMap(); + _petExtras = new NautHashMap(); + + CreatePets(); + CreatePetExtras(); + } + + private void CreatePets() + { + _pets.put(EntityType.PIG, new Pet("Pig", EntityType.PIG, 3000)); + _pets.put(EntityType.SHEEP, new Pet("Sheep", EntityType.SHEEP, 3000)); + _pets.put(EntityType.COW, new Pet("Cow", EntityType.COW, 3000)); + _pets.put(EntityType.CHICKEN, new Pet("Chicken", EntityType.CHICKEN, 4000)); + _pets.put(EntityType.WOLF, new Pet("Dog", EntityType.WOLF, 5000)); + _pets.put(EntityType.OCELOT, new Pet("Cat", EntityType.OCELOT, 5000)); + _pets.put(EntityType.MUSHROOM_COW, new Pet("Mooshroom", EntityType.MUSHROOM_COW, 3000)); + + List petTokens = new ArrayList(); + + for (Pet pet : _pets.values()) + { + PetSalesToken petToken = new PetSalesToken(); + petToken.Name = pet.GetPetName(); + petToken.PetType = pet.GetPetType().toString(); + + petTokens.add(petToken); + } + + for (PetSalesToken petToken : _repository.GetPets(petTokens)) + { + if (_pets.containsKey(EntityType.valueOf(petToken.PetType))) + { + _pets.get(EntityType.valueOf(petToken.PetType)).Update(petToken); + } + } + } + + private void CreatePetExtras() + { + _petExtras.put(Material.SIGN, new PetExtra("Name Tag", Material.NAME_TAG, 1000)); + + List petExtraTokens = new ArrayList(); + + for (PetExtra petExtra : _petExtras.values()) + { + PetExtraToken petToken = new PetExtraToken(); + petToken.Name = petExtra.GetName(); + petToken.Material = petExtra.GetMaterial().toString(); + + petExtraTokens.add(petToken); + } + + for (PetExtraToken token : _repository.GetPetExtras(petExtraTokens)) + { + if (_petExtras.containsKey(Material.valueOf(token.Material))) + { + _petExtras.get(Material.valueOf(token.Material)).Update(token); + } + } + } + + public Collection GetPets() + { + return _pets.values(); + } + + public Collection GetPetExtras() + { + return _petExtras.values(); + } + + public Collection GetPetExtraBySalesId(int salesId) + { + return _petExtras.values(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java new file mode 100644 index 000000000..e23135af1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -0,0 +1,376 @@ +package mineplex.core.pet; + +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.Iterator; +import java.util.Map.Entry; + +import mineplex.core.MiniClientPlugin; +import mineplex.core.pet.event.PetSpawnEvent; +import mineplex.core.pet.repository.PetRepository; +import mineplex.core.pet.repository.token.ClientPetTokenWrapper; +import mineplex.core.pet.ui.PetTagPage; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.page.AnvilContainer; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.account.CoreClientManager; +import mineplex.core.account.event.ClientWebResponseEvent; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilInv; +import mineplex.core.donation.DonationManager; +import mineplex.core.itemstack.ItemStackFactory; +import net.minecraft.server.v1_6_R2.EntityCreature; +import net.minecraft.server.v1_6_R2.EntityHuman; +import net.minecraft.server.v1_6_R2.EntityInsentient; +import net.minecraft.server.v1_6_R2.EntityPlayer; +import net.minecraft.server.v1_6_R2.Item; +import net.minecraft.server.v1_6_R2.Navigation; +import net.minecraft.server.v1_6_R2.Packet100OpenWindow; +import net.minecraft.server.v1_6_R2.Packet103SetSlot; +import net.minecraft.server.v1_6_R2.PathfinderGoalLookAtPlayer; +import net.minecraft.server.v1_6_R2.PathfinderGoalRandomLookaround; +import net.minecraft.server.v1_6_R2.PathfinderGoalSelector; + + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.libs.com.google.gson.Gson; +import org.bukkit.craftbukkit.v1_6_R2.CraftWorld; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Ageable; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.plugin.java.JavaPlugin; + +public class PetManager extends MiniClientPlugin +{ + private CoreClientManager _clientManager; + private DonationManager _donationManager; + private mineplex.core.creature.Creature _creatureModule; + private PetRepository _repository; + private PetFactory _petFactory; + + private NautHashMap _activePetOwners; + private NautHashMap _failedAttempts; + + private PetShop _petShop; + + private Field _goalSelector; + private Field _targetSelector; + + public PetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, mineplex.core.creature.Creature creatureModule, String webAddress) + { + super("Pet Manager", plugin); + + _clientManager = clientManager; + _donationManager = donationManager; + _creatureModule = creatureModule; + _repository = new PetRepository(webAddress); + _petFactory = new PetFactory(_repository); + _petShop = new PetShop(this, clientManager, donationManager); + + _activePetOwners = new NautHashMap(); + _failedAttempts = new NautHashMap(); + } + + public void AddPetOwner(Player player, EntityType entityType, Location location) + { + if (_activePetOwners.containsKey(player.getName())) + { + if (_activePetOwners.get(player.getName()).getType() != entityType) + { + RemovePet(player, true, true); + } + else + return; + } + + Creature pet = (Creature)_creatureModule.SpawnEntity(location, entityType); + pet.setCustomNameVisible(true); + pet.setCustomName(Get(player).GetPets().get(entityType)); + + _activePetOwners.put(player.getName(), pet); + _failedAttempts.put(player.getName(), 0); + + if (pet instanceof Ageable) + { + ((Ageable)pet).setBaby(); + ((Ageable)pet).setAgeLock(true); + } + + ClearPetGoals(pet); + + player.setItemInHand(null); + } + + public Creature GetPet(Player player) + { + return _activePetOwners.get(player.getName()); + } + + public void RemovePet(final Player player, boolean returnPetEgg, boolean removeOwner) + { + if (_activePetOwners.containsKey(player.getName())) + { + final Creature pet = _activePetOwners.get(player.getName()); + pet.remove(); + + if (returnPetEgg) + { + _plugin.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() + { + public void run() + { + ItemStack petEgg = new ItemStack(Material.MONSTER_EGG, 1, (byte)pet.getType().getTypeId()); + ItemMeta meta = petEgg.getItemMeta(); + meta.setDisplayName(pet.getCustomName()); + meta.setLore(Arrays.asList(ChatColor.WHITE + "Right-click block to place")); + + petEgg.setItemMeta(meta); + player.getInventory().addItem(petEgg); + } + }); + } + + if (removeOwner) + { + _activePetOwners.remove(player.getName()); + } + } + } + + @EventHandler + public void TryToAddPetOwner(PlayerInteractEvent event) + { + if (event.hasItem() && event.getItem().getType() == Material.MONSTER_EGG && event.getAction() == Action.RIGHT_CLICK_BLOCK) + { + if (Get(event.getPlayer()).GetPets().containsKey(EntityType.fromId(event.getItem().getData().getData()))) + { + PetSpawnEvent petSpawnEvent = new PetSpawnEvent(event.getPlayer(), EntityType.fromId(event.getItem().getData().getData()), event.getClickedBlock().getLocation().add(.5, 1, .5)); + _plugin.getServer().getPluginManager().callEvent(petSpawnEvent); + + if (!petSpawnEvent.isCancelled()) + AddPetOwner(event.getPlayer(), EntityType.fromId(event.getItem().getData().getData()), event.getClickedBlock().getLocation().add(.5, 1, .5)); + } + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onPlayerInteractEntity(PlayerInteractEntityEvent event) + { + if (_activePetOwners.containsKey(event.getPlayer().getName()) && _activePetOwners.get(event.getPlayer().getName()) == event.getRightClicked()) + { + if (event.getPlayer().getItemInHand() != null && event.getPlayer().getItemInHand().getType() == Material.NAME_TAG) + { + PetTagPage petTagPage = new PetTagPage(this, _petShop, _clientManager, _donationManager, "Repairing", event.getPlayer()); + EntityPlayer entityPlayer = ((CraftPlayer)event.getPlayer()).getHandle(); + int containerCounter = entityPlayer.nextContainerCounter(); + entityPlayer.playerConnection.sendPacket(new Packet100OpenWindow(containerCounter, 8, "Repairing", 9, true)); + entityPlayer.activeContainer = new AnvilContainer(entityPlayer.inventory, petTagPage.getInventory()); + entityPlayer.activeContainer.windowId = containerCounter; + entityPlayer.activeContainer.addSlotListener(entityPlayer); + entityPlayer.playerConnection.sendPacket(new Packet103SetSlot(containerCounter, 0, new net.minecraft.server.v1_6_R2.ItemStack(Item.NAME_TAG))); + + _petShop.SetCurrentPageForPlayer(event.getPlayer(), petTagPage); + event.setCancelled(true); + } + else + RemovePet(event.getPlayer(), true, true); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onPlayerInventoryClick(InventoryClickEvent event) + { + for (Pet pet : _petFactory.GetPets()) + { + UtilInv.DisallowMovementOf(event, "Pet Manager", Material.MONSTER_EGG, pet.GetDisplayData(), true); + } + + UtilInv.DisallowMovementOf(event, "Pet Manager", Material.NAME_TAG, (byte)0, true); + } + + @EventHandler + public void onPlayerQuit(PlayerQuitEvent event) + { + RemovePet(event.getPlayer(), false, true); + } + + @EventHandler + public void onEntityTarget(EntityTargetEvent event) + { + if (event.getEntity() instanceof Creature && _activePetOwners.containsValue((Creature)event.getEntity())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void onEntityDamage(EntityDamageEvent event) + { + if (event.getEntity() instanceof Creature && _activePetOwners.containsValue((Creature)event.getEntity())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + int xDiff; + int yDiff; + int zDiff; + + Iterator ownerIterator = _activePetOwners.keySet().iterator(); + + while (ownerIterator.hasNext()) + { + String playerName = ownerIterator.next(); + Player owner = Bukkit.getPlayer(playerName); + + Creature pet = _activePetOwners.get(playerName); + Location petSpot = pet.getLocation(); + Location ownerSpot = owner.getLocation(); + xDiff = Math.abs(petSpot.getBlockX() - ownerSpot.getBlockX()); + yDiff = Math.abs(petSpot.getBlockY() - ownerSpot.getBlockY()); + zDiff = Math.abs(petSpot.getBlockZ() - ownerSpot.getBlockZ()); + + if ((xDiff + yDiff + zDiff) > 4) + { + EntityCreature ec = ((CraftCreature) pet).getHandle(); + Navigation nav = ec.getNavigation(); + + int xIndex = -1; + int zIndex = -1; + Block targetBlock = ownerSpot.getBlock().getRelative(xIndex, -1, zIndex); + while (targetBlock.isEmpty() || targetBlock.isLiquid()) + { + if (xIndex < 2) + xIndex++; + else if (zIndex < 2) + { + xIndex = -1; + zIndex++; + } + else + return; + + targetBlock = ownerSpot.getBlock().getRelative(xIndex, -1, zIndex); + } + + if (_failedAttempts.get(playerName) > 4) + { + RemovePet(owner, true, false); + ownerIterator.remove(); + } + else if (!nav.a(targetBlock.getX(), targetBlock.getY() + 1, targetBlock.getZ(), 1.5f)) + { + if (pet.getFallDistance() == 0) + { + _failedAttempts.put(playerName, _failedAttempts.get(playerName) + 1); + } + } + else + { + _failedAttempts.put(playerName, 0); + } + } + } + } + + private void ClearPetGoals(Creature pet) + { + try + { + _goalSelector = EntityInsentient.class.getDeclaredField("goalSelector"); + _goalSelector.setAccessible(true); + _targetSelector = EntityInsentient.class.getDeclaredField("targetSelector"); + _targetSelector.setAccessible(true); + + EntityCreature creature = ((CraftCreature)pet).getHandle(); + + PathfinderGoalSelector goalSelector = new PathfinderGoalSelector(((CraftWorld)pet.getWorld()).getHandle().methodProfiler); + + goalSelector.a(0, new PathfinderGoalLookAtPlayer(creature, EntityHuman.class, 6.0F)); + goalSelector.a(1, new PathfinderGoalRandomLookaround(creature)); + + _goalSelector.set(creature, goalSelector); + _targetSelector.set(creature, new PathfinderGoalSelector(((CraftWorld)pet.getWorld()).getHandle().methodProfiler)); + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + catch (NoSuchFieldException e) + { + e.printStackTrace(); + } + catch (SecurityException e) + { + e.printStackTrace(); + } + } + + @EventHandler + public void OnClientWebResponse(ClientWebResponseEvent event) + { + ClientPetTokenWrapper token = new Gson().fromJson(event.GetResponse(), ClientPetTokenWrapper.class); + + Get(token.Name).Load(token.DonorToken); + } + + @EventHandler(priority = EventPriority.HIGH) + public void GivePetItems(PlayerJoinEvent event) + { + for (Entry pet : Get(event.getPlayer()).GetPets().entrySet()) + { + event.getPlayer().getInventory().addItem(new ShopItem(Material.MONSTER_EGG, (byte)pet.getKey().getTypeId(), pet.getValue(), new String[] { ChatColor.WHITE + "Right-click block to place" }, 1, false, false)); + } + + int playerTagCount = Get(event.getPlayer()).GetPetNameTagCount(); + + if (playerTagCount > 0) + event.getPlayer().getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NAME_TAG, (byte)0, playerTagCount, "Name Tag", new String[] { ChatColor.RESET + "" + ChatColor.GRAY + "Right-click pet to apply nametag" })); + } + + @Override + protected PetClient AddPlayer(String player) + { + return new PetClient(); + } + + public PetFactory GetFactory() + { + return _petFactory; + } + + public PetRepository GetRepository() + { + return _repository; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetShop.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetShop.java new file mode 100644 index 000000000..ae0df29c4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetShop.java @@ -0,0 +1,45 @@ +package mineplex.core.pet; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.messaging.PluginMessageListener; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.CurrencyType; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.ui.PetPage; +import mineplex.core.pet.ui.PetTagPage; +import mineplex.core.shop.ShopBase; +import mineplex.core.shop.page.ShopPageBase; + +public class PetShop extends ShopBase implements PluginMessageListener +{ + public PetShop(PetManager plugin, CoreClientManager manager, DonationManager donationManager) + { + super(plugin, manager, donationManager, "Pet Keeper", CurrencyType.Gems); + + plugin.GetPlugin().getServer().getMessenger().registerIncomingPluginChannel(plugin.GetPlugin(), "MC|ItemName", this); + } + + @Override + protected ShopPageBase> BuildPagesFor(Player player) + { + return new PetPage(Plugin, this, ClientManager, DonationManager, " Pets", player); + } + + @Override + public void onPluginMessageReceived(String channel, Player player, byte[] message) + { + if (!channel.equalsIgnoreCase("MC|ItemName")) + return; + + if (PlayerPageMap.containsKey(player.getName()) && PlayerPageMap.get(player.getName()) instanceof PetTagPage) + { + if (message != null && message.length >= 1) + { + String tagName = new String(message); + + ((PetTagPage)PlayerPageMap.get(player.getName())).SetTagName(tagName); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/event/PetSpawnEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/event/PetSpawnEvent.java new file mode 100644 index 000000000..cbd0d2c32 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/event/PetSpawnEvent.java @@ -0,0 +1,62 @@ +package mineplex.core.pet.event; + +import org.bukkit.Location; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class PetSpawnEvent extends Event implements Cancellable +{ + private static final HandlerList handlers = new HandlerList(); + private boolean _cancelled = false; + + private Player _player; + private EntityType _entityType; + private Location _location; + + public PetSpawnEvent(Player player, EntityType entityType, Location location) + { + _player = player; + _entityType = entityType; + _location = location; + } + + public Player GetPlayer() + { + return _player; + } + + public EntityType GetEntityType() + { + return _entityType; + } + + public Location GetLocation() + { + return _location; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean cancel) + { + _cancelled = cancel; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java new file mode 100644 index 000000000..344f4f165 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java @@ -0,0 +1,56 @@ +package mineplex.core.pet.repository; + +import java.util.List; + +import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; + +import mineplex.core.pet.repository.token.PetChangeToken; +import mineplex.core.pet.repository.token.PetExtraToken; +import mineplex.core.pet.repository.token.PetSalesToken; +import mineplex.core.server.remotecall.AsyncJsonWebCall; +import mineplex.core.server.remotecall.JsonWebCall; + +public class PetRepository +{ + private String _webAddress; + + public PetRepository(String webAddress) + { + _webAddress = webAddress; + } + + public List GetPets(List petTokens) + { + return new JsonWebCall(_webAddress + "Pets/GetPets").Execute(new TypeToken>(){}.getType(), petTokens); + } + + public void AddPet(PetChangeToken token) + { + new AsyncJsonWebCall(_webAddress + "Pets/AddPet").Execute(token); + } + + public void RemovePet(PetChangeToken token) + { + new AsyncJsonWebCall(_webAddress + "Pets/RemovePet").Execute(token); + } + + public List GetPetExtras(List petExtraTokens) + { + return new JsonWebCall(_webAddress + "Pets/GetPetExtras").Execute(new TypeToken>(){}.getType(), petExtraTokens); + } + + public void UpdatePet(PetChangeToken token) + { + new AsyncJsonWebCall(_webAddress + "Pets/UpdatePet").Execute(token); + } + + public void AddPetNameTag(String name) + { + new AsyncJsonWebCall(_webAddress + "Pets/AddPetNameTag").Execute(name); + } + + public void RemovePetNameTag(String name) + { + new AsyncJsonWebCall(_webAddress + "Pets/RemovePetNameTag").Execute(name); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/ClientPetToken.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/ClientPetToken.java new file mode 100644 index 000000000..5f45ac822 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/ClientPetToken.java @@ -0,0 +1,9 @@ +package mineplex.core.pet.repository.token; + +import java.util.List; + +public class ClientPetToken +{ + public List Pets; + public int PetNameTagCount; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/ClientPetTokenWrapper.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/ClientPetTokenWrapper.java new file mode 100644 index 000000000..3c8a0b274 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/ClientPetTokenWrapper.java @@ -0,0 +1,7 @@ +package mineplex.core.pet.repository.token; + +public class ClientPetTokenWrapper +{ + public String Name; + public ClientPetToken DonorToken; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/PetChangeToken.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/PetChangeToken.java new file mode 100644 index 000000000..e42a5e61e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/PetChangeToken.java @@ -0,0 +1,8 @@ +package mineplex.core.pet.repository.token; + +public class PetChangeToken +{ + public String Name; + public String PetName; + public String PetType; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/PetExtraToken.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/PetExtraToken.java new file mode 100644 index 000000000..c40324f0a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/PetExtraToken.java @@ -0,0 +1,8 @@ +package mineplex.core.pet.repository.token; + +public class PetExtraToken +{ + public String Name; + + public String Material; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/PetSalesToken.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/PetSalesToken.java new file mode 100644 index 000000000..e427ac8ed --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/PetSalesToken.java @@ -0,0 +1,8 @@ +package mineplex.core.pet.repository.token; + +public class PetSalesToken +{ + public String Name; + + public String PetType; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/PetToken.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/PetToken.java new file mode 100644 index 000000000..fecdcde0f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/token/PetToken.java @@ -0,0 +1,7 @@ +package mineplex.core.pet.repository.token; + +public class PetToken +{ + public String PetName; + public String PetType; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/CloseButton.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/CloseButton.java new file mode 100644 index 000000000..8404f687d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/CloseButton.java @@ -0,0 +1,14 @@ +package mineplex.core.pet.ui; + +import org.bukkit.entity.Player; + +import mineplex.core.shop.item.IButton; + +public class CloseButton implements IButton +{ + @Override + public void Clicked(Player player) + { + player.closeInventory(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetButton.java new file mode 100644 index 000000000..1de0cd518 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetButton.java @@ -0,0 +1,24 @@ +package mineplex.core.pet.ui; + +import org.bukkit.entity.Player; + +import mineplex.core.pet.Pet; +import mineplex.core.shop.item.IButton; + +public class PetButton implements IButton +{ + private Pet _pet; + private PetPage _page; + + public PetButton(Pet pet, PetPage page) + { + _pet = pet; + _page = page; + } + + @Override + public void Clicked(Player player) + { + _page.PurchasePet(player, _pet); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetExtraButton.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetExtraButton.java new file mode 100644 index 000000000..3d44e0bf5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetExtraButton.java @@ -0,0 +1,24 @@ +package mineplex.core.pet.ui; + +import org.bukkit.entity.Player; + +import mineplex.core.pet.PetExtra; +import mineplex.core.shop.item.IButton; + +public class PetExtraButton implements IButton +{ + private PetExtra _petExtra; + private PetPage _petPage; + + public PetExtraButton(PetExtra petExtra, PetPage petPage) + { + _petExtra = petExtra; + _petPage = petPage; + } + + @Override + public void Clicked(Player player) + { + _petPage.PurchasePetExtra(player, _petExtra); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetPage.java new file mode 100644 index 000000000..6b8588aea --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetPage.java @@ -0,0 +1,117 @@ +package mineplex.core.pet.ui; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.CurrencyType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.donation.DonationManager; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.pet.Pet; +import mineplex.core.pet.PetExtra; +import mineplex.core.pet.PetManager; +import mineplex.core.pet.PetShop; +import mineplex.core.pet.repository.token.PetChangeToken; +import mineplex.core.pet.repository.token.PetToken; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.page.ConfirmationPage; +import mineplex.core.shop.page.ShopPageBase; + +public class PetPage extends ShopPageBase +{ + public PetPage(PetManager plugin, PetShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + + BuildPage(); + } + + protected void BuildPage() + { + int slot = 19; + for (Pet pet : Plugin.GetFactory().GetPets()) + { + List itemLore = new ArrayList(); + + itemLore.add(C.cYellow + pet.GetCost(CurrencyType.Gems) + " Gems"); + itemLore.add(C.cBlack); + + if (DonationManager.Get(Player.getName()).OwnsUnknownPackage("Pet " + pet.GetPetName())) + { + itemLore.add(C.cRed + "You already own this pet!"); + getInventory().setItem(slot, new ShopItem(Material.MONSTER_EGG, (byte)pet.GetPetType().getTypeId(), pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).getHandle()); + } + else + { + AddButton(slot, new ShopItem(Material.MONSTER_EGG, (byte)pet.GetPetType().getTypeId(), pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new PetButton(pet, this)); + } + + slot++; + } + + slot = 40; + for (PetExtra petExtra : Plugin.GetFactory().GetPetExtras()) + { + List itemLore = new ArrayList(); + + itemLore.add(C.cYellow + petExtra.GetCost(CurrencyType.Gems) + " Gems"); + itemLore.add(C.cBlack); + + if (Plugin.Get(Player.getName()).GetPets().size() == 0) + { + itemLore.add(C.cRed + "You don't own a pet!"); + getInventory().setItem(slot, new ShopItem(petExtra.GetMaterial(), (byte)0, petExtra.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).getHandle()); + } + else + { + AddButton(slot, new ShopItem(petExtra.GetMaterial(), (byte)0, petExtra.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new PetExtraButton(petExtra, this)); + } + + slot++; + } + } + + public void PurchasePet(final Player player, final Pet pet) + { + Shop.OpenPageForPlayer(player, new ConfirmationPage(Plugin, Shop, ClientManager, DonationManager, new Runnable() + { + public void run() + { + PetChangeToken token = new PetChangeToken(); + token.Name = player.getName(); + token.PetType = pet.GetPetType().toString(); + token.PetName = ""; + + PetToken petToken = new PetToken(); + petToken.PetType = token.PetType; + + Plugin.GetRepository().AddPet(token); + Plugin.Get(player).GetPets().put(pet.GetPetType(), token.PetName); + + Plugin.GetRepository().AddPetNameTag(player.getName()); + Plugin.Get(player).SetPetNameTagCount(Plugin.Get(player).GetPetNameTagCount() + 1); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NAME_TAG, (byte)0, 1, "Name Tag", new String[] { ChatColor.RESET + "" + ChatColor.GRAY + "Right-click pet to apply nametag" })); + player.sendMessage(F.main("Pet Shop", "Right click pet to enter name and apply tag.")); + } + }, this, pet, CurrencyType.Gems, player)); + } + + public void PurchasePetExtra(final Player player, PetExtra petExtra) + { + Shop.OpenPageForPlayer(player, new ConfirmationPage(Plugin, Shop, ClientManager, DonationManager, new Runnable() + { + public void run() + { + Plugin.GetRepository().AddPetNameTag(player.getName()); + Plugin.Get(player.getName()).SetPetNameTagCount(Plugin.Get(player.getName()).GetPetNameTagCount() + 1); + player.sendMessage(F.main("Pet Shop", "Right click pet to enter name and apply tag.")); + } + }, this, petExtra, CurrencyType.Gems, player)); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetTagPage.java new file mode 100644 index 000000000..e6731b890 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetTagPage.java @@ -0,0 +1,86 @@ +package mineplex.core.pet.ui; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.PetClient; +import mineplex.core.pet.PetManager; +import mineplex.core.pet.PetShop; +import mineplex.core.pet.repository.token.PetChangeToken; +import mineplex.core.shop.page.ShopPageBase; +import net.minecraft.server.v1_6_R2.Item; +import net.minecraft.server.v1_6_R2.ItemStack; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Player; + +public class PetTagPage extends ShopPageBase +{ + private String _tagName = "Pet Tag"; + + public PetTagPage(PetManager plugin, PetShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player, 3); + + BuildPage(); + } + + @Override + protected void BuildPage() + { + inventory.setItem(0, new ItemStack(Item.NAME_TAG)); + + ButtonMap.put(0, new CloseButton()); + ButtonMap.put(1, new CloseButton()); + ButtonMap.put(2, new SelectTagButton(this)); + } + + public void SelectTag() + { + if (ChatColor.stripColor(_tagName).length() > 16) + { + UtilPlayer.message(Player, F.main(Plugin.GetName(), ChatColor.RED + "Pet name cannot be longer than 16 characters.")); + PlayDenySound(Player); + + Player.closeInventory(); + Shop.ResetPlayer(Player); + + return; + } + + UtilInv.remove(Player, Material.NAME_TAG, (byte)0, 1); + + Creature pet = Plugin.GetPet(Player); + + if (pet != null) + { + pet.setCustomNameVisible(true); + pet.setCustomName(_tagName); + } + + PetClient petClient = Plugin.Get(Player); + + petClient.GetPets().put(pet.getType(), _tagName); + petClient.SetPetNameTagCount(petClient.GetPetNameTagCount() - 1); + + PetChangeToken token = new PetChangeToken(); + token.Name = Player.getName(); + token.PetName = _tagName; + token.PetType = pet.getType().toString(); + + Plugin.GetRepository().UpdatePet(token); + Plugin.GetRepository().RemovePetNameTag(Player.getName()); + + Player.closeInventory(); + Shop.ResetPlayer(Player); + } + + public void SetTagName(String tagName) + { + _tagName = tagName; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/SelectTagButton.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/SelectTagButton.java new file mode 100644 index 000000000..a20b63a58 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/SelectTagButton.java @@ -0,0 +1,21 @@ +package mineplex.core.pet.ui; + +import org.bukkit.entity.Player; + +import mineplex.core.shop.item.IButton; + +public class SelectTagButton implements IButton +{ + private PetTagPage _page; + + public SelectTagButton(PetTagPage page) + { + _page = page; + } + + @Override + public void Clicked(Player player) + { + _page.SelectTag(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java new file mode 100644 index 000000000..0571f93f1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java @@ -0,0 +1,310 @@ +package mineplex.core.portal; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.AbstractMap; +import java.util.HashSet; +import java.util.Map.Entry; + + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import mineplex.core.MiniPlugin; +import mineplex.core.arena.Region; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.portal.commands.PortalCommand; + +public class Portal extends MiniPlugin +{ + private NautHashMap _portalServerMap = new NautHashMap(); + private NautHashMap> _portalSetupMap = new NautHashMap>(); + private HashSet _connectingPlayers = new HashSet(); + + public Portal(JavaPlugin plugin) + { + super("Portal", plugin); + + Bukkit.getMessenger().registerOutgoingPluginChannel(GetPlugin(), "BungeeCord"); + + LoadPortals(); + } + + public void AddCommands() + { + AddCommand(new PortalCommand(this)); + } + + @EventHandler + public void OnPlayerMove(PlayerMoveEvent event) + { + for (Region region : _portalServerMap.keySet()) + { + if (region.Contains(event.getTo().toVector())) + { + SendPlayerToServer(event.getPlayer(), _portalServerMap.get(region)); + break; + } + } + } + + @EventHandler + public void OnPlayerInteract(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (player.isOp() && _portalSetupMap.containsKey(player.getName())) + { + if (player.getItemInHand() != null && player.getItemInHand().getType() == Material.BLAZE_ROD) + { + if (event.getAction() == Action.LEFT_CLICK_BLOCK) + { + _portalSetupMap.put(player.getName(), new AbstractMap.SimpleEntry(event.getClickedBlock().getLocation(), null)); + player.sendMessage(F.main(GetName(), "Set first point.")); + } + else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) + { + _portalSetupMap.get(player.getName()).setValue(event.getClickedBlock().getLocation()); + player.sendMessage(F.main(GetName(), "Set second point.")); + } + + event.setCancelled(true); + } + } + } + + public void SendPlayerToServer(final Player player, String serverName) + { + if (_connectingPlayers.contains(player.getName())) + return; + + ByteArrayOutputStream b = new ByteArrayOutputStream(); + DataOutputStream out = new DataOutputStream(b); + + try + { + out.writeUTF("Connect"); + out.writeUTF(serverName); + } + catch (IOException e) + { + // Can never happen + } + finally + { + try + { + out.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + player.sendPluginMessage(GetPlugin(), "BungeeCord", b.toByteArray()); + _connectingPlayers.add(player.getName()); + + GetScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable() + { + public void run() + { + _connectingPlayers.remove(player.getName()); + } + }, 20L); + } + + public void Help(Player caller, String message) + { + UtilPlayer.message(caller, F.main(_moduleName, "Commands List:")); + UtilPlayer.message(caller, F.help("/portal toggle", "Turn off and on Portal mode.", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/portal create ", "Creates portal to name server.", Rank.OWNER)); + + if (message != null) + UtilPlayer.message(caller, F.main(_moduleName, ChatColor.RED + message)); + } + + public void Help(Player caller) + { + Help(caller, null); + } + + public void LoadPortals() + { + FileInputStream fstream = null; + BufferedReader br = null; + + try + { + File portalsFile = new File("portals.dat"); + + if (portalsFile.exists()) + { + fstream = new FileInputStream(portalsFile); + br = new BufferedReader(new InputStreamReader(fstream)); + + String line = br.readLine(); + + while (line != null) + { + Region region = ParseRegion(line); + + _portalServerMap.put(region, region.GetName()); + + line = br.readLine(); + } + } + } + catch (Exception e) + { + System.out.println(F.main(GetName(), "Error parsing portals file.")); + } + finally + { + if (br != null) + { + try + { + br.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + public void SavePortals() + { + FileWriter fstream = null; + BufferedWriter out = null; + + try + { + fstream = new FileWriter("portals.dat"); + out = new BufferedWriter(fstream); + + for (Region region : _portalServerMap.keySet()) + { + out.write(region.GetMinimumPoint().getBlockX() + " " + region.GetMinimumPoint().getBlockY() + " " + region.GetMinimumPoint().getBlockZ() + ", " + region.GetMaximumPoint().getBlockX() + " " + region.GetMaximumPoint().getBlockY() + " " + region.GetMaximumPoint().getBlockZ() + ", " + region.GetName()); + out.newLine(); + } + + out.close(); + } + catch (Exception e) + { + System.err.println("Portals Save Error: " + e.getMessage()); + } + finally + { + if (out != null) + { + try + { + out.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + private Region ParseRegion(String value) + { + String [] parts = value.split(","); + + Vector pointOne = ParseVector(parts[0].trim()); + Vector pointTwo = ParseVector(parts[1].trim()); + + return new Region(parts.length == 3 ? parts[2].trim() : "Null", pointOne, pointTwo); + } + + private Vector ParseVector(String vectorString) + { + Vector vector = new Vector(); + + String [] parts = vectorString.split(" "); + + vector.setX(Double.parseDouble(parts[0])); + vector.setY(Double.parseDouble(parts[1])); + vector.setZ(Double.parseDouble(parts[2])); + + return vector; + } + + public void ToggleSetupAdmin(Player caller) + { + if (_portalSetupMap.containsKey(caller.getName())) + { + _portalSetupMap.remove(caller.getName()); + caller.sendMessage(F.main(GetName(), "Disabled Portal Setup.")); + } + else + { + _portalSetupMap.put(caller.getName(), new AbstractMap.SimpleEntry(null, null)); + caller.sendMessage(F.main(GetName(), "Enabled Portal Setup.")); + } + } + + public boolean IsAdminPortalValid(Player caller) + { + return _portalSetupMap.containsKey(caller.getName()) && _portalSetupMap.get(caller.getName()).getKey() != null && _portalSetupMap.get(caller.getName()).getValue() != null; + } + + public void CreatePortal(Player caller, String name) + { + Vector first = _portalSetupMap.get(caller.getName()).getKey().toVector(); + Vector second = _portalSetupMap.get(caller.getName()).getValue().toVector(); + + _portalServerMap.put(new Region(name, first, second), name); + caller.sendMessage(F.main(GetName(), "Created '" + name + "' portal at (" + first.toString() + ") and (" + second.toString() + ".")); + SavePortals(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/commands/CreateCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/commands/CreateCommand.java new file mode 100644 index 000000000..18757786a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/commands/CreateCommand.java @@ -0,0 +1,37 @@ +package mineplex.core.portal.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.portal.Portal; + +public class CreateCommand extends CommandBase +{ + public CreateCommand(Portal plugin) + { + super(plugin, Rank.ADMIN, "create"); + } + + @Override + public void Execute(final Player caller, String[] args) + { + if (args == null) + { + Plugin.Help(caller); + } + else + { + if (!Plugin.IsAdminPortalValid(caller)) + { + Plugin.Help(caller, "You don't have two points set. Use Blaze rod to set them."); + } + else + { + String serverName = args[0]; + + Plugin.CreatePortal(caller, serverName); + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/commands/PortalCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/commands/PortalCommand.java new file mode 100644 index 000000000..22864f2f4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/commands/PortalCommand.java @@ -0,0 +1,24 @@ +package mineplex.core.portal.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.MultiCommandBase; +import mineplex.core.common.Rank; +import mineplex.core.portal.Portal; + +public class PortalCommand extends MultiCommandBase +{ + public PortalCommand(Portal plugin) + { + super(plugin, Rank.ADMIN, "portal"); + + AddCommand(new CreateCommand(plugin)); + AddCommand(new ToggleCommand(plugin)); + } + + @Override + protected void Help(Player caller, String[] args) + { + Plugin.Help(caller); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/commands/ToggleCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/commands/ToggleCommand.java new file mode 100644 index 000000000..0334403ea --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/commands/ToggleCommand.java @@ -0,0 +1,21 @@ +package mineplex.core.portal.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.portal.Portal; + +public class ToggleCommand extends CommandBase +{ + public ToggleCommand(Portal plugin) + { + super(plugin, Rank.ADMIN, "toggle"); + } + + @Override + public void Execute(final Player caller, String[] args) + { + Plugin.ToggleSetupAdmin(caller); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/IThrown.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/IThrown.java new file mode 100644 index 000000000..92bb0ddd0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/IThrown.java @@ -0,0 +1,12 @@ +package mineplex.core.projectile; + + +import org.bukkit.block.Block; +import org.bukkit.entity.LivingEntity; + +public interface IThrown +{ + public void Collide(LivingEntity target, Block block, ProjectileUser data); + public void Idle(ProjectileUser data); + public void Expire(ProjectileUser data); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java new file mode 100644 index 000000000..f0616c88c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java @@ -0,0 +1,97 @@ +package mineplex.core.projectile; + +import java.util.HashSet; +import java.util.WeakHashMap; + +import mineplex.core.MiniPlugin; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; + +import org.bukkit.Effect; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.inventory.InventoryPickupItemEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class ProjectileManager extends MiniPlugin +{ + private WeakHashMap _thrown = new WeakHashMap(); + + public ProjectileManager(JavaPlugin plugin) + { + super("Throw", plugin); + } + + public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, + long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, double hitboxMult) + { + _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, + expireTime, hitPlayer, hitBlock, idle, false, + null, 1f, 1f, null, 0, null, hitboxMult)); + } + + public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, + long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, double hitboxMult) + { + _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, + expireTime, hitPlayer, hitBlock, idle, pickup, + null, 1f, 1f, null, 0, null, hitboxMult)); + } + + public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, + long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, + Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate , double hitboxMult) + { + _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, + expireTime, hitPlayer, hitBlock, idle, false, + sound, soundVolume, soundPitch, effect, effectData, effectRate, hitboxMult)); + } + + @EventHandler + public void Update(UpdateEvent event) + { + //Collisions + if (event.getType() == UpdateType.TICK) + { + HashSet remove = new HashSet(); + + for (Entity cur : _thrown.keySet()) + if (_thrown.get(cur).Collision()) + remove.add(cur); + else if (cur.isDead() || !cur.isValid()) + remove.add(cur); + + for (Entity cur : remove) + _thrown.remove(cur); + } + + //Effects + for (ProjectileUser cur : _thrown.values()) + cur.Effect(event); + } + + @EventHandler(priority=EventPriority.LOW) + public void Pickup(PlayerPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (_thrown.containsKey(event.getItem())) + if (!_thrown.get(event.getItem()).CanPickup(event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler(priority=EventPriority.LOW) + public void HopperPickup(InventoryPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (_thrown.containsKey(event.getItem())) + event.setCancelled(true); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java new file mode 100644 index 000000000..97c9d863b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java @@ -0,0 +1,180 @@ +package mineplex.core.projectile; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; + +import org.bukkit.Effect; +import org.bukkit.GameMode; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_6_R2.CraftWorld; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; + +public class ProjectileUser +{ + public ProjectileManager Throw; + + private Entity _thrown; + private LivingEntity _thrower; + private IThrown _callback; + + private long _expireTime; + private boolean _hitPlayer = false; + private boolean _hitBlock = false; + private boolean _idle = false; + private boolean _pickup = false; + + private Sound _sound = null; + private float _soundVolume = 1f; + private float _soundPitch = 1f; + private Effect _effect = null; + private int _effectData = 0; + private UpdateType _effectRate = UpdateType.TICK; + + private double _hitboxMult = 1; + + public ProjectileUser(ProjectileManager throwInput, Entity thrown, LivingEntity thrower, IThrown callback, + long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, + Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate, + double hitboxMult) + { + Throw = throwInput; + + _thrown = thrown; + _thrower = thrower; + _callback = callback; + + _expireTime = expireTime; + _hitPlayer = hitPlayer; + _hitBlock = hitBlock; + _idle = idle; + _pickup = pickup; + + _sound = sound; + _soundVolume = soundVolume; + _soundPitch = soundPitch; + _effect = effect; + _effectData = effectData; + _effectRate = effectRate; + + _hitboxMult = hitboxMult; + } + + public void Effect(UpdateEvent event) + { + if (event.getType() != _effectRate) + return; + + if (_sound != null) + _thrown.getWorld().playSound(_thrown.getLocation(), _sound, _soundVolume, _soundPitch); + + if (_effect != null) + _thrown.getWorld().playEffect(_thrown.getLocation(), _effect, _effectData); + + } + + public boolean Collision() + { + if (_expireTime != -1 && System.currentTimeMillis() > _expireTime) + { + _callback.Expire(this); + return true; + } + + + //Check Hit Player + if (_hitPlayer) + { + for (Object entity : ((CraftWorld)_thrown.getWorld()).getHandle().entityList) + { + if (entity instanceof net.minecraft.server.v1_6_R2.Entity) + { + Entity bukkitEntity = ((net.minecraft.server.v1_6_R2.Entity) entity).getBukkitEntity(); + + if (bukkitEntity instanceof LivingEntity) + { + LivingEntity ent = (LivingEntity)bukkitEntity; + + //Avoid Self + if (ent.equals(_thrower)) + continue; + + if (ent instanceof Player) + if (((Player)ent).getGameMode() == GameMode.CREATIVE) + continue; + + //Hit Player + if (UtilEnt.hitBox(_thrown.getLocation(), ent, _hitboxMult)) + { + _callback.Collide(ent, null, this); + return true; + } + } + } + } + } + + try + { + //Check Hit Block + if (_hitBlock) + { + Block block = _thrown.getLocation().add(_thrown.getVelocity().normalize().multiply(0.6)).getBlock(); + if (!UtilBlock.airFoliage(block)) + { + _callback.Collide(null, block, this); + return true; + } + } + + + //Idle + if (_idle) + { + if (_thrown.getVelocity().length() < 0.2 && + !UtilBlock.airFoliage(_thrown.getLocation().getBlock().getRelative(BlockFace.DOWN))) + { + _callback.Idle(this); + return true; + } + } + } + catch (Exception ex) + { + if (_hitBlock) + { + return true; + } + + if (_idle) + { + return true; + } + } + + return false; + } + + public LivingEntity GetThrower() + { + return _thrower; + } + + public Entity GetThrown() + { + return _thrown; + } + + public boolean CanPickup(LivingEntity thrower) + { + if (!thrower.equals(_thrower)) + return false; + + return _pickup; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Category.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Category.java new file mode 100644 index 000000000..1e6a6c567 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Category.java @@ -0,0 +1,23 @@ +package mineplex.core.punish; + +public enum Category +{ + ChatOffense, + Advertisement, + Exploiting, + Hacking, + Other; + + public static boolean contains(String s) + { + try + { + Category.valueOf(s); + return true; + } + catch (Exception e) + { + return false; + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java new file mode 100644 index 000000000..964a1b2fa --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java @@ -0,0 +1,92 @@ +package mineplex.core.punish.Command; + +import java.util.Iterator; +import java.util.List; + + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.punish.Punish; +import mineplex.core.punish.Tokens.PunishClientToken; +import mineplex.core.punish.UI.PunishPage; + +public class PunishCommand extends CommandBase +{ + public PunishCommand(Punish plugin) + { + super(plugin, Rank.MODERATOR, "punish", "p"); + } + + @Override + public void Execute(final Player caller, String[] args) + { + if (args == null || args.length < 2) + { + Plugin.Help(caller); + } + else + { + final String playerName = args[0]; + String reason = args[1]; + + for (int i = 2; i < args.length; i++) + { + reason += " " + args[i]; + } + + final String finalReason = reason; + + Plugin.GetRepository().MatchPlayerName(new Callback>() + { + public void run(List matches) + { + boolean matchedExact = false; + + for (String match : matches) + { + if (match.equalsIgnoreCase(playerName)) + { + matchedExact = true; + } + } + + if (matchedExact) + { + for (Iterator matchIterator = matches.iterator(); matchIterator.hasNext();) + { + if (!matchIterator.next().equalsIgnoreCase(playerName)) + { + matchIterator.remove(); + } + } + } + + UtilPlayer.searchOffline(matches, new Callback() + { + public void run(final String target) + { + if (target == null) + { + return; + } + + Plugin.GetRepository().LoadPunishClient(target, new Callback() + { + public void run(PunishClientToken clientToken) + { + Plugin.LoadClient(clientToken); + new PunishPage(Plugin, caller, target, finalReason); + } + }); + + } + }, caller, playerName, true); + } + }, playerName); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java new file mode 100644 index 000000000..a1628e54a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java @@ -0,0 +1,287 @@ +package mineplex.core.punish; + +import java.util.HashMap; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.event.ClientWebRequestEvent; +import mineplex.core.account.event.ClientWebResponseEvent; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.punish.Command.*; +import mineplex.core.punish.Tokens.PunishClientToken; +import mineplex.core.punish.Tokens.PunishmentToken; + +import org.bukkit.craftbukkit.libs.com.google.gson.Gson; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result; +import org.bukkit.plugin.java.JavaPlugin; + +public class Punish extends MiniPlugin +{ + private HashMap _punishClients; + private PunishRepository _repository; + + public Punish(JavaPlugin plugin, String webServerAddress) + { + super("Punish", plugin); + + _punishClients = new HashMap(); + _repository = new PunishRepository(webServerAddress); + } + + public PunishRepository GetRepository() + { + return _repository; + } + + @Override + public void AddCommands() + { + AddCommand(new PunishCommand(this)); + } + + @EventHandler + public void OnClientWebRequest(ClientWebRequestEvent event) + { + /* + try + { + // TODO Parse infractions/punishments here + // event.GetJsonWriter().beginObject(); + // event.GetJsonWriter().name("Punish"); + // event.GetJsonWriter().value("true"); + // event.GetJsonWriter().endObject(); + } + catch (IOException e) + { + e.printStackTrace(); + } + */ + } + + @EventHandler + public void OnClientWebResponse(ClientWebResponseEvent event) + { + /* + JsonReader reader = null; + + try + { + while (reader.hasNext()) + { + if (reader.nextName().equalsIgnoreCase("Punish")) + { + reader.beginObject(); + + // TODO Parse infractions/punishments here + // PunishClient client = new PunishClient(); + // client.AddInfraction(token.Category, new Infraction(token.Reason, token.Admin, token.Time)); + // client.AddPunishment(token.Category, new Punishment(token.PunishmentSentence, token.Reason, token.Admin, token.Hours, token.Time)); + // _punishClients.put(event.GetClient().GetPlayerName(), client); + + break; + } + + reader.endObject(); + } + } + catch (IOException e) + { + e.printStackTrace(); + } + finally + { + if (reader != null) + { + try + { + reader.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + */ + + PunishClientToken token = new Gson().fromJson(event.GetResponse(), PunishClientToken.class); + LoadClient(token); + } + + @EventHandler + public void PlayerQuit(PlayerQuitEvent event) + { + _punishClients.remove(event.getPlayer().getName().toLowerCase()); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void PlayerLogin(AsyncPlayerPreLoginEvent event) + { + if (_punishClients.containsKey(event.getName().toLowerCase())) + { + PunishClient client = GetClient(event.getName()); + + if (client.IsBanned()) + { + Punishment punishment = client.GetPunishment(PunishmentSentence.Ban); + String time = F.time(UtilTime.convertString((long)(punishment.GetHours() * 3600000), 0, TimeUnit.FIT)); + + if (punishment.GetHours() == -1) + time = C.cRed + "Permanent"; + + String reason = C.consoleHead + F.main(GetName(), punishment.GetAdmin() + " banned you because of '" + F.elem(punishment.GetReason()) + "' for " + time); + + event.disallow(Result.KICK_BANNED, reason); + } + } + + /* + for (String alias : client.Acc().GetAliasIP()) + { + if (Clients().Get(alias).Ban().IsBanned()) + { + String reason = C.consoleHead + "Alias Banned" + + C.consoleFill + " - " + + C.consoleBody + client.Ban().GetBan().RemainingString() + + C.consoleFill + " - " + + C.consoleBody + client.Ban().Reason(); + + event.disallow(Result.KICK_BANNED, reason); + return; + } + } + + for (String alias : client.Acc().GetAliasMAC()) + { + if (Clients().Get(alias).Ban().IsBanned()) + { + String reason = C.consoleHead + "Alias Banned" + + C.consoleFill + " - " + + C.consoleBody + client.Ban().GetBan().RemainingString() + + C.consoleFill + " - " + + C.consoleBody + client.Ban().Reason(); + + event.disallow(Result.KICK_BANNED, reason); + return; + } + } + */ + } + + @EventHandler(priority = EventPriority.LOWEST) + public void PunishChatEvent(AsyncPlayerChatEvent event) + { + PunishClient client = GetClient(event.getPlayer().getName()); + + if (client != null && client.IsMuted()) + { + event.getPlayer().sendMessage(F.main(GetName(), "Shh, you're muted for " + C.cGreen + UtilTime.convertString(client.GetPunishment(PunishmentSentence.Mute).GetRemaining(), 1, TimeUnit.FIT) + ".")); + event.setCancelled(true); + } + } + + public void Help(Player caller) + { + UtilPlayer.message(caller, F.main(_moduleName, "Commands List:")); + UtilPlayer.message(caller, F.help("/punish", " ", Rank.MODERATOR)); + } + + public void AddPunishment(final String playerName, final Category category, final String reason, final Player caller, final int severity, boolean ban, long duration) + { + if (!_punishClients.containsKey(playerName.toLowerCase())) + { + _punishClients.put(playerName.toLowerCase(), new PunishClient()); + } + + final PunishmentSentence sentence = !ban ? PunishmentSentence.Mute : PunishmentSentence.Ban; + + final long finalDuration = duration; + + _repository.Punish(new Callback() + { + public void run(String result) + { + PunishmentResponse banResult = PunishmentResponse.valueOf(result); + + if (banResult == PunishmentResponse.AccountDoesNotExist) + { + if (caller != null) + caller.sendMessage(F.main(GetName(), "Account with name " + F.elem(playerName) + " does not exist.")); + } + else if (banResult == PunishmentResponse.InsufficientPrivileges) + { + if (caller != null) + caller.sendMessage(F.main(GetName(), "You have insufficient rights to punish " + F.elem(playerName) + ".")); + } + else if (banResult == PunishmentResponse.Punished) + { + String durationString = F.time(UtilTime.convertString(finalDuration < 0 ? -1 : (long)(finalDuration * 3600000), 1, TimeUnit.FIT)); + + if (sentence == PunishmentSentence.Ban) + { + + UtilPlayer.kick(UtilPlayer.searchOnline(null, playerName, false), GetName(), caller == null ? "Mineplex" : caller.getName() + " banned you because of " + F.elem(reason) + " for " + + durationString + "."); + + UtilServer.broadcast(F.main(GetName(), F.elem(caller == null ? "Mineplex" : caller.getName()) + " banned " + F.elem(playerName) + " because of " + F.elem(reason) + " for " + durationString + ".")); + } + else + { + UtilServer.broadcast(F.main(GetName(), F.elem(caller == null ? "Mineplex" : caller.getName()) + " muted " + F.elem(playerName) + " because of " + F.elem(reason) + " for " + + durationString + ".")); + + _repository.LoadPunishClient(playerName, new Callback() + { + public void run(PunishClientToken token) + { + LoadClient(token); + } + }); + } + } + } + }, playerName, category.toString(), sentence, reason, duration, caller == null ? "Mineplex" : caller.getName(), severity, System.currentTimeMillis()); + } + + public void LoadClient(PunishClientToken token) + { + PunishClient client = new PunishClient(); + + for (PunishmentToken punishment : token.Punishments) + { + client.AddPunishment(Category.valueOf(punishment.Category), new Punishment(punishment.PunishmentId, PunishmentSentence.valueOf(punishment.Sentence), Category.valueOf(punishment.Category), punishment.Reason, punishment.Admin, punishment.Duration, punishment.Severity, punishment.Time, punishment.Active, punishment.Removed, punishment.RemoveAdmin, punishment.RemoveReason)); + } + + _punishClients.put(token.Name.toLowerCase(), client); + } + + public PunishClient GetClient(String name) + { + synchronized (this) + { + return _punishClients.get(name.toLowerCase()); + } + } + + public void RemovePunishment(int punishmentId, String target, final Player admin, String reason, Callback callback) + { + _repository.RemovePunishment(callback, punishmentId, target, reason, admin.getName()); + } + + public void RemoveBan(String name, String reason) + { + _repository.RemoveBan(name, reason); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishChatEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishChatEvent.java new file mode 100644 index 000000000..fddf50a0d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishChatEvent.java @@ -0,0 +1,45 @@ +package mineplex.core.punish; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class PunishChatEvent extends Event implements Cancellable +{ + private static final HandlerList handlers = new HandlerList(); + private boolean _cancelled = false; + private Player _player; + + public PunishChatEvent(Player player) + { + _player = player; + } + + public Player GetPlayer() + { + return _player; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean cancel) + { + _cancelled = cancel; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishClient.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishClient.java new file mode 100644 index 000000000..332df7a9f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishClient.java @@ -0,0 +1,82 @@ +package mineplex.core.punish; + +import java.util.ArrayList; +import java.util.List; + +import mineplex.core.common.util.NautHashMap; + + +public class PunishClient +{ + private NautHashMap> _punishments; + + public PunishClient() + { + _punishments = new NautHashMap>(); + } + + public void AddPunishment(Category category, Punishment punishment) + { + if (!_punishments.containsKey(category)) + _punishments.put(category, new ArrayList()); + + _punishments.get(category).add(punishment); + } + + public boolean IsBanned() + { + for (List punishments : _punishments.values()) + { + for (Punishment punishment : punishments) + { + if (punishment.IsBanned()) + { + return true; + } + } + } + + return false; + } + + public boolean IsMuted() + { + for (List punishments : _punishments.values()) + { + for (Punishment punishment : punishments) + { + if (punishment.IsMuted()) + { + return true; + } + } + } + + return false; + } + + public Punishment GetPunishment(PunishmentSentence sentence) + { + for (List punishments : _punishments.values()) + { + for (Punishment punishment : punishments) + { + if (sentence == PunishmentSentence.Ban && punishment.IsBanned()) + { + return punishment; + } + else if (sentence == PunishmentSentence.Mute && punishment.IsMuted()) + { + return punishment; + } + } + } + + return null; + } + + public NautHashMap> GetPunishments() + { + return _punishments; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishRepository.java new file mode 100644 index 000000000..50ce7761f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishRepository.java @@ -0,0 +1,76 @@ +package mineplex.core.punish; + +import java.util.List; + +import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; + +import mineplex.core.common.util.Callback; +import mineplex.core.punish.Tokens.PunishClientToken; +import mineplex.core.punish.Tokens.PunishToken; +import mineplex.core.punish.Tokens.RemovePunishToken; +import mineplex.core.server.remotecall.AsyncJsonWebCall; +import mineplex.core.server.remotecall.JsonWebCall; + +public class PunishRepository +{ + private String _webAddress; + + public PunishRepository(String webServerAddress) + { + _webAddress = webServerAddress; + } + + public void Punish(Callback callback, String target, String category, PunishmentSentence punishment, String reason, double duration, String admin, int severity, long time) + { + PunishToken token = new PunishToken(); + token.Target = target; + token.Category = category; + token.Sentence = punishment.toString(); + token.Reason = reason; + token.Duration = duration; + token.Admin = admin; + token.Time = time; + token.Severity = severity; + + new AsyncJsonWebCall(_webAddress + "PlayerAccount/Punish").Execute(String.class, callback, token); + } + + public void RemovePunishment(Callback callback, int id, String target, String reason, String admin) + { + RemovePunishToken token = new RemovePunishToken(); + token.PunishmentId = id; + token.Target = target; + token.Reason = reason; + token.Admin = admin; + + new AsyncJsonWebCall(_webAddress + "PlayerAccount/RemovePunishment").Execute(String.class, callback, token); + } + + public void LoadPunishClient(String target, Callback callback) + { + new AsyncJsonWebCall(_webAddress + "PlayerAccount/GetPunishClient").Execute(PunishClientToken.class, callback, target); + } + + public void MatchPlayerName(final Callback> callback, final String userName) + { + Thread asyncThread = new Thread(new Runnable() + { + public void run() + { + List tokenList = new JsonWebCall(_webAddress + "PlayerAccount/GetMatches").Execute(new TypeToken>(){}.getType(), userName); + callback.run(tokenList); + } + }); + + asyncThread.start(); + } + + public void RemoveBan(String name, String reason) + { + RemovePunishToken token = new RemovePunishToken(); + token.Target = name; + token.Reason = reason; + + new JsonWebCall(_webAddress + "PlayerAccount/RemoveBan").Execute(String.class, token); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishTrackUtil.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishTrackUtil.java new file mode 100644 index 000000000..b113c5d8a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishTrackUtil.java @@ -0,0 +1,63 @@ +package mineplex.core.punish; + +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map.Entry; + +import mineplex.core.common.util.TimeSpan; + +public class PunishTrackUtil +{ + public static long GetPunishTime(PunishClient client, Category category, int severity) + { + int severityLimitOne = -1; + int severityLimitTwo = -1; + double algMod = 2; + + switch (category) + { + case ChatOffense: + severityLimitOne = 24; + severityLimitOne = 72; + algMod = -2; + break; + case Advertisement: + severityLimitOne = 48; + severityLimitOne = 168; + algMod = -1; + break; + case Exploiting: + severityLimitOne = 48; + severityLimitOne = 168; + algMod = 0; + break; + case Hacking: + severityLimitOne = -1; + severityLimitOne = -1; + algMod = 1; + break; + default: + break; + } + + List> punishments = new ArrayList>(); + + if (client.GetPunishments().containsKey(category)) + { + for (Punishment punishment : client.GetPunishments().get(category)) + { + punishments.add(new AbstractMap.SimpleEntry(category, punishment)); + } + } + + Collections.sort(punishments, new PunishmentSorter()); + + long timeOfLastInfraction = Math.min(punishments.size() > 0 ? (System.currentTimeMillis() - punishments.get(0).getValue().GetTime()) / TimeSpan.DAY : 180, 180); + + long punishTime = (long) (Math.pow(2, algMod + ((severity - 1) * 2)) * 24) + (180 - timeOfLastInfraction) / 3; + + return severity < 3 ? Math.min(punishTime, severity == 1 ? severityLimitOne == -1 ? punishTime : severityLimitOne : severityLimitTwo == -1 ? punishTime : severityLimitTwo) : punishTime; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punishment.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punishment.java new file mode 100644 index 000000000..55c39696b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punishment.java @@ -0,0 +1,117 @@ +package mineplex.core.punish; + +import mineplex.core.common.util.TimeSpan; + +public class Punishment +{ + private int _id; + private PunishmentSentence _punishmentType; + private Category _category; + private String _reason; + private String _admin; + private double _hours; + private int _severity; + private long _time; + private boolean _active; + private boolean _removed; + private String _removeAdmin; + private String _removeReason; + + public Punishment(int id, PunishmentSentence punishmentType, Category category, String reason, String admin, double hours, int severity, long time, boolean active, boolean removed, String removeAdmin, String removeReason) + { + _id = id; + _punishmentType = punishmentType; + _category = category; + _reason = reason; + _admin = admin; + _hours = hours; + _severity = severity; + _time = time; + _active = active; + _removed = removed; + _removeAdmin = removeAdmin; + _removeReason = removeReason; + } + + public int GetPunishmentId() + { + return _id; + } + + public PunishmentSentence GetPunishmentType() + { + return _punishmentType; + } + + public Category GetCategory() + { + return _category; + } + + public String GetReason() + { + return _reason; + } + + public String GetAdmin() + { + return _admin; + } + + public double GetHours() + { + return _hours; + } + + public int GetSeverity() + { + return _severity; + } + + public long GetTime() + { + return _time; + } + + public boolean GetActive() + { + return _active; + } + + public boolean GetRemoved() + { + return _removed; + } + + public void Remove(String admin, String reason) + { + _removed = true; + _removeAdmin = admin; + _removeReason = reason; + } + + public String GetRemoveReason() + { + return _removeReason; + } + + public boolean IsBanned() + { + return _punishmentType == PunishmentSentence.Ban && (GetRemaining() > 0 || _hours < 0) && _active; + } + + public boolean IsMuted() + { + return _punishmentType == PunishmentSentence.Mute && (GetRemaining() > 0 || _hours < 0) && _active; + } + + public long GetRemaining() + { + return _hours < 0 ? -1 : (long) ((_time + (TimeSpan.HOUR * _hours)) - System.currentTimeMillis()); + } + + public String GetRemoveAdmin() + { + return _removeAdmin; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishmentResponse.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishmentResponse.java new file mode 100644 index 000000000..7df56fd76 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishmentResponse.java @@ -0,0 +1,10 @@ +package mineplex.core.punish; + +public enum PunishmentResponse +{ + Punished, + PunishmentRemoved, + AccountDoesNotExist, + InsufficientPrivileges, + NotPunished +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishmentSentence.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishmentSentence.java new file mode 100644 index 000000000..c4c40afd9 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishmentSentence.java @@ -0,0 +1,7 @@ +package mineplex.core.punish; + +public enum PunishmentSentence +{ + Ban, + Mute +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishmentSorter.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishmentSorter.java new file mode 100644 index 000000000..370e6b353 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishmentSorter.java @@ -0,0 +1,18 @@ +package mineplex.core.punish; + +import java.util.Comparator; +import java.util.Map.Entry; + +public class PunishmentSorter implements Comparator> +{ + public int compare(Entry a, Entry b) + { + if (a.getValue().GetTime() > b.getValue().GetTime()) + return -1; + + if (a.getValue().GetTime() == b.getValue().GetTime()) + return 0; + + return 1; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Tokens/InfractionToken.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Tokens/InfractionToken.java new file mode 100644 index 000000000..5c57756d7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Tokens/InfractionToken.java @@ -0,0 +1,12 @@ +package mineplex.core.punish.Tokens; + +public class InfractionToken +{ + public int InfractionId; + public String Category; + public String Reason; + public int Severity; + public String Admin; + public long Time; + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Tokens/PunishClientToken.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Tokens/PunishClientToken.java new file mode 100644 index 000000000..875409afd --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Tokens/PunishClientToken.java @@ -0,0 +1,9 @@ +package mineplex.core.punish.Tokens; + +import java.util.List; + +public class PunishClientToken +{ + public String Name; + public List Punishments; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Tokens/PunishToken.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Tokens/PunishToken.java new file mode 100644 index 000000000..70d4fd08b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Tokens/PunishToken.java @@ -0,0 +1,13 @@ +package mineplex.core.punish.Tokens; + +public class PunishToken +{ + public String Target; + public String Category; + public String Reason; + public String Admin; + public long Time; + public double Duration; + public String Sentence; + public int Severity; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Tokens/PunishmentToken.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Tokens/PunishmentToken.java new file mode 100644 index 000000000..3bacf97f8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Tokens/PunishmentToken.java @@ -0,0 +1,17 @@ +package mineplex.core.punish.Tokens; + +public class PunishmentToken +{ + public int PunishmentId; + public String Admin; + public long Time; + public String Sentence; + public String Category; + public String Reason; + public int Severity; + public long Duration; + public boolean Removed; + public String RemoveAdmin; + public String RemoveReason; + public boolean Active; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Tokens/RemovePunishToken.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Tokens/RemovePunishToken.java new file mode 100644 index 000000000..0c2b4018f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Tokens/RemovePunishToken.java @@ -0,0 +1,9 @@ +package mineplex.core.punish.Tokens; + +public class RemovePunishToken +{ + public int PunishmentId; + public String Target; + public String Reason; + public String Admin; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishButton.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishButton.java new file mode 100644 index 000000000..4df043969 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishButton.java @@ -0,0 +1,30 @@ +package mineplex.core.punish.UI; + +import org.bukkit.entity.Player; + +import mineplex.core.punish.Category; +import mineplex.core.shop.item.IButton; + +public class PunishButton implements IButton +{ + private PunishPage _punishPage; + private Category _category; + private int _severity; + private boolean _ban; + private long _time; + + public PunishButton(PunishPage punishPage, Category category, int severity, boolean ban, long time) + { + _punishPage = punishPage; + _category = category; + _severity = severity; + _ban = ban; + _time = time; + } + + @Override + public void Clicked(Player player) + { + _punishPage.AddInfraction(_category, _severity, _ban, _time); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java new file mode 100644 index 000000000..90ed4b3b8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java @@ -0,0 +1,277 @@ +package mineplex.core.punish.UI; + +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map.Entry; + +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.punish.Category; +import mineplex.core.punish.Punish; +import mineplex.core.punish.PunishClient; +import mineplex.core.punish.PunishTrackUtil; +import mineplex.core.punish.Punishment; +import mineplex.core.punish.PunishmentResponse; +import mineplex.core.punish.PunishmentSorter; +import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ShopItem; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftInventoryCustom; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.inventory.ItemStack; + +public class PunishPage extends CraftInventoryCustom implements Listener +{ + private Punish _plugin; + private NautHashMap _buttonMap; + private Player _player; + private String _target; + private String _reason; + private ShopItem _chatOffenseButton; + private ShopItem _advertisingButton; + private ShopItem _exploitingButton; + private ShopItem _hackingButton; + private ShopItem _otherButton; + + public PunishPage(Punish plugin, Player player, String target, String reason) + { + super(null, 54, " Punish"); + + _plugin = plugin; + _buttonMap = new NautHashMap(); + + _player = player; + _target = target; + _reason = reason; + + BuildPage(); + + _player.openInventory(this); + _plugin.RegisterEvents(this); + } + + private void BuildPage() + { + // Player head + getInventory().setItem(4, new ShopItem(Material.SKULL_ITEM, (byte)3, _target, new String[] { ChatColor.RESET + _reason }, 1, false, true).getHandle()); + + PunishClient client = _plugin.GetClient(_target); + + int chatOffenseCount = 0; + int advertisingCount = 0; + int exploitingCount = 0; + int hackingCount = 0; + int otherCount = 0; + + List> punishments = new ArrayList>(); + + for (Category category : client.GetPunishments().keySet()) + { + for (Punishment punishment : client.GetPunishments().get(category)) + { + punishments.add(new AbstractMap.SimpleEntry(category, punishment)); + } + + switch (category) + { + case ChatOffense: + chatOffenseCount = client.GetPunishments().get(category).size(); + break; + case Advertisement: + advertisingCount = client.GetPunishments().get(category).size(); + break; + case Exploiting: + exploitingCount = client.GetPunishments().get(category).size(); + break; + case Hacking: + hackingCount = client.GetPunishments().get(category).size(); + break; + case Other: + otherCount = client.GetPunishments().get(category).size(); + break; + default: + break; + + } + } + + String examplePrefix = ChatColor.RESET + "" + ChatColor.GRAY; + + _chatOffenseButton = new ShopItem(Material.BOOK_AND_QUILL, (byte)0, "Chat Offense", new String[] { ChatColor.RESET + "Past offenses : " + ChatColor.YELLOW + chatOffenseCount, examplePrefix + "Verbal Abuse, Spam, Harassment, Trolling, etc" }, 1, false, true); + _advertisingButton = new ShopItem(Material.SIGN, (byte)0, "Advertising", new String[] { ChatColor.RESET + "Past offenses : " + ChatColor.YELLOW + advertisingCount, examplePrefix + "Broadcasting another server ip." }, 1, false, true); + _exploitingButton = new ShopItem(Material.HOPPER, (byte)0, "Gameplay Offense", new String[] { ChatColor.RESET + "Past offenses : " + ChatColor.YELLOW + exploitingCount, examplePrefix + "Commmand/Map/Class/Skill exploits, etc" }, 1, false, true); + _hackingButton = new ShopItem(Material.IRON_SWORD, (byte)0, "Hacking", new String[] { ChatColor.RESET + "Past offenses : " + ChatColor.YELLOW + hackingCount, examplePrefix + "X-ray, Forcefield, Speed, Fly, Inventory Hacks, etc" }, 1, false, true); + _otherButton = new ShopItem(Material.BEACON, (byte)0, "Other", new String[] { ChatColor.RESET + "Past offenses : " + ChatColor.YELLOW + otherCount, examplePrefix + "Permanent punishments for unique cases." }, 1, false, true); + + getInventory().setItem(9, _chatOffenseButton.getHandle()); + getInventory().setItem(11, _advertisingButton.getHandle()); + getInventory().setItem(13, _exploitingButton.getHandle()); + getInventory().setItem(15, _hackingButton.getHandle()); + getInventory().setItem(17, _otherButton.getHandle()); + + long punishTime = PunishTrackUtil.GetPunishTime(_plugin.GetClient(_target), Category.ChatOffense, 1); + AddButton(18, new ShopItem(Material.INK_SACK, (byte)2, "Severity 1", new String[] { ChatColor.RESET + "Mute Duration: " + ChatColor.YELLOW + F.time(UtilTime.convertString(punishTime * 3600000, 1, TimeUnit.FIT)), examplePrefix + "Spamming LOL LOLO LOLOL", examplePrefix + "F U Bob after bob tnt'd his base", examplePrefix + "Harassing admin to revoke a punishment" }, 1, false, true), new PunishButton(this, Category.ChatOffense, 1, false, punishTime)); + punishTime = PunishTrackUtil.GetPunishTime(_plugin.GetClient(_target), Category.ChatOffense, 2); + AddButton(27, new ShopItem(Material.INK_SACK, (byte)11, "Severity 2", new String[] { ChatColor.RESET + "Mute Duration: " + ChatColor.YELLOW + F.time(UtilTime.convertString(punishTime * 3600000, 1, TimeUnit.FIT)), examplePrefix + "Spamming 'I LIKE CATS I LIKE CATS I LIKE CATS' 10 times.", examplePrefix + "General rudeness between players.", examplePrefix + "'go fucking cry, you baby'.", examplePrefix + "Does not necessarily require swearing.", examplePrefix + "Shit admins are shit" }, 1, false, true), new PunishButton(this, Category.ChatOffense, 2, false, punishTime)); + punishTime = PunishTrackUtil.GetPunishTime(_plugin.GetClient(_target), Category.ChatOffense, 3); + AddButton(36, new ShopItem(Material.INK_SACK, (byte)1, "Severity 3", new String[] { ChatColor.RESET + "Mute Duration: " + ChatColor.YELLOW + F.time(UtilTime.convertString(punishTime * 3600000, 1, TimeUnit.FIT)), examplePrefix + "Spam bot", examplePrefix + "Severe abuse between players, back and forth argument in chat.", examplePrefix + "'fuck off, you admins are fucking awful', 'you should go and fucking die'" }, 1, false, true), new PunishButton(this, Category.ChatOffense, 3, false, punishTime)); + + punishTime = PunishTrackUtil.GetPunishTime(_plugin.GetClient(_target), Category.Advertisement, 1); + AddButton(20, new ShopItem(Material.INK_SACK, (byte)2, "Severity 1", new String[] { ChatColor.RESET + "Mute Duration: " + ChatColor.YELLOW + F.time(UtilTime.convertString(punishTime * 3600000, 1, TimeUnit.FIT)), examplePrefix + "Talking about another server, though asked not to." }, 1, false, true), new PunishButton(this, Category.Advertisement, 1, false, punishTime)); + punishTime = PunishTrackUtil.GetPunishTime(_plugin.GetClient(_target), Category.Advertisement, 2); + AddButton(29, new ShopItem(Material.INK_SACK, (byte)11, "Severity 2", new String[] { ChatColor.RESET + "Mute Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Joining and asking other players to come check out another server." }, 1, false, true), new PunishButton(this, Category.Advertisement, 2, false, -1)); + AddButton(38, new ShopItem(Material.INK_SACK, (byte)1, "Severity 3", new String[] { ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Joining the server and spamming 'www.crapexampleserver.com'"}, 1, false, true), new PunishButton(this, Category.Advertisement, 3, true, -1)); + + punishTime = PunishTrackUtil.GetPunishTime(_plugin.GetClient(_target), Category.Exploiting, 1); + AddButton(22, new ShopItem(Material.INK_SACK, (byte)2, "Severity 1", new String[] { ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + F.time(UtilTime.convertString(punishTime * 3600000, 1, TimeUnit.FIT)), examplePrefix + "Hearing about a new exploit, and trying it out once.", examplePrefix + "For example, a command to start a world event." }, 1, false, true), new PunishButton(this, Category.Exploiting, 1, true, punishTime)); + AddButton(31, new ShopItem(Material.INK_SACK, (byte)11, "Severity 2", new String[] { ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Something like... abusing a ban command.", examplePrefix + "Intentionally ruining experience for others via exploit." }, 1, false, true), new PunishButton(this, Category.Exploiting, 2, true, -1)); + AddButton(40, new ShopItem(Material.INK_SACK, (byte)1, "Severity 3", new String[] { ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Ruins map economy completely by exploiting a dupe bug.", examplePrefix + "Crashing server via exploit." }, 1, false, true), new PunishButton(this, Category.Exploiting, 3, true, -1)); + + AddButton(24, new ShopItem(Material.INK_SACK, (byte)2, "Severity 1", new String[] { ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Using XRay on server" }, 1, false, true), new PunishButton(this, Category.Hacking, 1, true, -1)); + AddButton(33, new ShopItem(Material.INK_SACK, (byte)11, "Severity 2", new String[] { ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Fly Hacks, Derp, Nuker, Speed." }, 1, false, true), new PunishButton(this, Category.Hacking, 2, true, -1)); + AddButton(42, new ShopItem(Material.INK_SACK, (byte)1, "Severity 3", new String[] { ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Forcefield Hacks, V/No-Clip, Impersonating accounts, etc" }, 1, false, true), new PunishButton(this, Category.Hacking, 3, true, -1)); + + AddButton(26, new ShopItem(Material.REDSTONE_BLOCK, (byte)0, "Permanent Ban", new String[] { ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Better have a good reason for using this." }, 1, false, true), new PunishButton(this, Category.Other, 1, true, -1)); + AddButton(35, new ShopItem(Material.EMERALD_BLOCK, (byte)0, "Permanent Mute", new String[] { ChatColor.RESET + "Mute Duration: " + ChatColor.YELLOW + "PERMANENT", examplePrefix + "Better have a good reason for using this." }, 1, false, true), new PunishButton(this, Category.Other, 1, false, -1)); + + Collections.sort(punishments, new PunishmentSorter()); + + int slot = 45; + + for (Entry punishmentEntry : punishments) + { + if (slot >= 54) + break; + + ShopItem button = null; + + switch (punishmentEntry.getKey()) + { + case ChatOffense: + button = _chatOffenseButton.clone(); + break; + case Advertisement: + button = _advertisingButton.clone(); + break; + case Exploiting: + button = _exploitingButton.clone(); + break; + case Hacking: + button = _hackingButton.clone(); + break; + case Other: + button = _otherButton.clone(); + break; + default: + break; + } + + Punishment punishment = punishmentEntry.getValue(); + + button.SetLore(new String[] + { + ChatColor.RESET + "Punishment Type: " + ChatColor.YELLOW + punishment.GetCategory().toString(), + ChatColor.RESET + "Severity: " + ChatColor.YELLOW + punishment.GetSeverity(), + ChatColor.RESET + "Reason: " + ChatColor.YELLOW + punishment.GetReason(), + ChatColor.RESET + "Admin: " + ChatColor.YELLOW + punishment.GetAdmin(), + ChatColor.RESET + "Date of Ban: " + ChatColor.YELLOW + UtilTime.when(punishment.GetTime()), + ChatColor.RESET + "Ban Duration: " + (punishment.GetCategory() == Category.Other ? ChatColor.RED + "PERMANENT" : (ChatColor.RED + "" + F.time(UtilTime.convertString((long)(punishment.GetHours() * 3600000), 1, TimeUnit.FIT)))), + ChatColor.RESET + "Expires In: " + ChatColor.RED + (punishment.GetCategory() == Category.Other ? "NEVER" : (punishment.GetRemaining() > 0 ? F.time(UtilTime.convertString((long)(punishment.GetRemaining()), 1, TimeUnit.FIT)) : ChatColor.GREEN + "EXPIRED")), + ChatColor.RESET + "Removed by: " + (punishment.GetRemoved() ? ChatColor.GREEN + punishment.GetRemoveAdmin() : ChatColor.RED + "Not Removed"), + ChatColor.RESET + "Remove Reason: " + (punishment.GetRemoved() ? ChatColor.GREEN + punishment.GetRemoveReason() : ChatColor.RED + "Not Removed"), + }); + + if ((punishment.GetHours() == -1 || punishment.GetRemaining() > 0) && !punishment.GetRemoved() && punishment.GetActive()) + { + button.addUnsafeEnchantment(Enchantment.DURABILITY, 1); + AddButton(slot, button, new RemovePunishmentButton(this, punishment, button)); + } + else + { + getInventory().setItem(slot, button.getHandle()); + } + + slot++; + } + } + + @EventHandler + public void OnInventoryClick(InventoryClickEvent event) + { + if (inventory.getName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getWhoClicked() == _player) + { + if (_buttonMap.containsKey(event.getRawSlot())) + { + if (event.getWhoClicked() instanceof Player) + { + _buttonMap.get(event.getRawSlot()).Clicked((Player)event.getWhoClicked()); + } + } + + event.setCancelled(true); + } + } + + @EventHandler + public void OnInventoryClose(InventoryCloseEvent event) + { + if (inventory.getName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getPlayer() == _player) + { + ClosePunish(); + } + } + + private void AddButton(int slot, ShopItem item, IButton button) + { + getInventory().setItem(slot, item.getHandle()); + _buttonMap.put(slot, button); + } + + public void AddInfraction(Category category, int severity, boolean ban, long punishTime) + { + _plugin.AddPunishment(_target, category, _reason, _player, severity, ban, punishTime); + _player.closeInventory(); + ClosePunish(); + } + + private void ClosePunish() + { + HandlerList.unregisterAll(this); + } + + public void RemovePunishment(final Punishment punishment, final ItemStack item) + { + _plugin.RemovePunishment(punishment.GetPunishmentId(), _target, _player, _reason, new Callback() + { + @Override + public void run(String result) + { + PunishmentResponse punishResponse = PunishmentResponse.valueOf(result); + + if (punishResponse != PunishmentResponse.PunishmentRemoved) + { + _player.sendMessage(F.main(_plugin.GetName(), "There was a problem removing the punishment.")); + } + else + { + punishment.Remove(_player.getName(), _reason); + _player.closeInventory(); + ClosePunish(); + } + } + }); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/RemovePunishmentButton.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/RemovePunishmentButton.java new file mode 100644 index 000000000..e87da4aae --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/RemovePunishmentButton.java @@ -0,0 +1,26 @@ +package mineplex.core.punish.UI; + +import org.bukkit.entity.Player; + +import mineplex.core.punish.Punishment; +import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ShopItem; + +public class RemovePunishmentButton implements IButton +{ + private PunishPage _punishPage; + private Punishment _punishment; + private ShopItem _item; + + public RemovePunishmentButton(PunishPage punishPage, Punishment punishment, ShopItem item) + { + _punishPage = punishPage; + _punishment = punishment; + _item = item; + } + + public void Clicked(Player player) + { + _punishPage.RemovePunishment(_punishment, _item); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java b/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java new file mode 100644 index 000000000..2280882b5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java @@ -0,0 +1,150 @@ +package mineplex.core.recharge; + +import java.util.HashSet; +import java.util.LinkedList; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; + +public class Recharge extends MiniPlugin +{ + public static Recharge Instance; + + public HashSet informSet = new HashSet(); + public NautHashMap> _recharge = new NautHashMap>(); + + protected Recharge(JavaPlugin plugin) + { + super("Recharge", plugin); + } + + public static void Initialize(JavaPlugin plugin) + { + Instance = new Recharge(plugin); + } + + @EventHandler + public void PlayerDeath(PlayerDeathEvent event) + { + Get(event.getEntity().getName()).clear(); + } + + public NautHashMap Get(String name) + { + if (!_recharge.containsKey(name)) + _recharge.put(name, new NautHashMap()); + + return _recharge.get(name); + } + + public NautHashMap Get(Player player) + { + return Get(player.getName()); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + recharge(); + } + + public void recharge() + { + for (Player cur : UtilServer.getPlayers()) + { + LinkedList rechargeList = new LinkedList(); + + //Check Recharged + for (String ability : Get(cur).keySet()) + { + if (System.currentTimeMillis() > Get(cur).get(ability)) + rechargeList.add(ability); + } + + //Inform Recharge + for (String ability : rechargeList) + { + Get(cur).remove(ability); + + if (informSet.contains(ability)) + UtilPlayer.message(cur, F.main("Recharge", "You can use " + F.skill(ability) + ".")); + } + } + } + public boolean use(Player player, String ability, long recharge, boolean inform) + { + return use(player, ability, ability, recharge, inform); + } + + public boolean use(Player player, String ability, String abilityFull, long recharge, boolean inform) + { + if (recharge == 0) + return true; + + //Ensure Expirey + recharge(); + + //Lodge Recharge Msg + if (inform) + informSet.add(ability); + + //Recharging + if (Get(player).containsKey(ability)) + { + if (inform) + { + UtilPlayer.message(player, F.main("Recharge", "You cannot use " + F.skill(abilityFull) + " for " + + F.time(UtilTime.convertString((Get(player).get(ability)-System.currentTimeMillis()), 1, TimeUnit.FIT)) + ".")); + } + + return false; + } + + //Insert + UseRecharge(player, ability, recharge); + + return true; + } + + public void useForce(Player player, String ability, long recharge) + { + UseRecharge(player, ability, recharge); + } + + public boolean usable(Player player, String ability) + { + if (!Get(player).containsKey(ability)) + return true; + + return (System.currentTimeMillis() > Get(player).get(ability)); + } + + public void UseRecharge(Player player, String ability, long recharge) + { + //Event + RechargeEvent rechargeEvent = new RechargeEvent(player, ability, recharge); + UtilServer.getServer().getPluginManager().callEvent(rechargeEvent); + + Get(player).put(ability, System.currentTimeMillis()+rechargeEvent.GetRecharge()); + } + + public void Reset(Player player) + { + _recharge.put(player.getName(), new NautHashMap()); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/recharge/RechargeEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/recharge/RechargeEvent.java new file mode 100644 index 000000000..330016dd0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/recharge/RechargeEvent.java @@ -0,0 +1,51 @@ +package mineplex.core.recharge; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class RechargeEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private String _ability; + private long _recharge; + + public RechargeEvent(Player player, String ability, long recharge) + { + _player = player; + _ability = ability; + _recharge = recharge; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public Player GetPlayer() + { + return _player; + } + + public String GetAbility() + { + return _ability; + } + + public long GetRecharge() + { + return _recharge; + } + + public void SetRecharge(long time) + { + _recharge = time; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/EasyScoreboard.java b/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/EasyScoreboard.java new file mode 100644 index 000000000..d9ed231cf --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/EasyScoreboard.java @@ -0,0 +1,13 @@ +package mineplex.core.scoreboard; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; + +public class EasyScoreboard extends MiniPlugin +{ + public EasyScoreboard(JavaPlugin plugin) + { + super("EasyScoreboard", plugin); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/IPurchaseRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/server/IPurchaseRepository.java new file mode 100644 index 000000000..af643544d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/IPurchaseRepository.java @@ -0,0 +1,8 @@ +package mineplex.core.server; + +import mineplex.core.common.util.Callback; + +public interface IPurchaseRepository +{ + void PurchaseSalesPackage(Callback callback, String name, boolean usingCredits, int salesPackageId); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/Server.java b/Plugins/Mineplex.Core/src/mineplex/core/server/Server.java new file mode 100644 index 000000000..b6c16fa4e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/Server.java @@ -0,0 +1,7 @@ +package mineplex.core.server; + +public class Server +{ + public String Address; + public int Port; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/ServerBroadcaster.java b/Plugins/Mineplex.Core/src/mineplex/core/server/ServerBroadcaster.java new file mode 100644 index 000000000..8f82fb999 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/ServerBroadcaster.java @@ -0,0 +1,212 @@ +package mineplex.core.server; + +import java.io.DataOutputStream; +import java.io.IOException; +import java.net.Socket; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; + +import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; + +import mineplex.core.server.packet.Packet; +import mineplex.core.server.remotecall.JsonWebCall; + +public class ServerBroadcaster extends Thread +{ + private static Object _queueLock = new Object(); + private static Object _serverMapLock = new Object(); + + private HashSet _serverMap = new HashSet(); + private List _queue = new ArrayList(); + + private String _webAddress; + private boolean _running = true; + private boolean _retrievingServers = false; + + private long _updateInterval = 15000; + private long _lastUpdate; + + private boolean _debug = false; + + public ServerBroadcaster(String webAddress) + { + _webAddress = webAddress; + } + + public void QueuePacket(Packet packet) + { + synchronized(_queueLock) + { + _queue.add(packet); + } + } + + @Override + public void run() + { + while (_running) + { + if (!HasPackets() || !HasServers()) + { + try + { + Thread.sleep(25); + } + catch (InterruptedException e) + { + e.printStackTrace(); + } + + if (System.currentTimeMillis() - _lastUpdate > _updateInterval) + { + RetrieveActiveServers(); + } + + continue; + } + + Packet packet = null; + + synchronized(_queueLock) + { + packet = _queue.remove(0); + } + + synchronized(_serverMapLock) + { + for (String server : _serverMap) + { + Socket socket = null; + DataOutputStream dataOutput = null; + + try + { + socket = new Socket(server.split(":")[0], Integer.parseInt(server.split(":")[1])); + dataOutput = new DataOutputStream(socket.getOutputStream()); + + packet.Write(dataOutput); + dataOutput.flush(); + + if (_debug) + System.out.println("Sent packet to : " + socket.getInetAddress().getHostAddress() + ":" + socket.getPort()); + } + catch (Exception ex) + { + System.out.println("ServerTalker.run Exception(" + server + ") : " + ex.getMessage()); + } + finally + { + try + { + if (dataOutput != null) + dataOutput.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + + try + { + if (socket != null) + socket.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + } + } + + public boolean HasPackets() + { + synchronized(_queueLock) + { + return _queue.size() != 0; + } + } + + public boolean HasServers() + { + synchronized(_serverMapLock) + { + return _serverMap.size() != 0; + } + } + + public void PrintPackets() + { + System.out.println("Listing Packets:"); + + synchronized(_queueLock) + { + if (_queue.isEmpty()) + { + System.out.println("Packet queue empty!"); + } + else + { + for (Packet packet : _queue) + { + System.out.println(packet.getClass()); + } + } + } + } + + public void PrintServers() + { + System.out.println("Listing Servers:"); + + if (_retrievingServers) + { + System.out.println("Retrieving servers. Please check again in a few seconds."); + } + + synchronized(_serverMapLock) + { + if (_serverMap.isEmpty()) + { + System.out.println("Server list empty!"); + } + else + { + for (String server : _serverMap) + { + System.out.println(server); + } + } + } + } + + private void RetrieveActiveServers() + { + if (_debug) + System.out.println("Updating servers..."); + + List servers = new JsonWebCall(_webAddress + "Servers/GetServers").Execute(new TypeToken>(){}.getType(), null); + + synchronized(_serverMapLock) + { + _serverMap.clear(); + + if (servers.size() > 0) + { + for (String server : servers) + { + _serverMap.add(server); + } + } + else + { + System.out.println("No servers registered at '" + _webAddress + "'!"); + } + } + + _lastUpdate = System.currentTimeMillis(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/ServerListener.java b/Plugins/Mineplex.Core/src/mineplex/core/server/ServerListener.java new file mode 100644 index 000000000..93e3373ae --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/ServerListener.java @@ -0,0 +1,146 @@ +package mineplex.core.server; + +import java.io.DataInputStream; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.ServerSocket; +import java.net.Socket; + +import mineplex.core.server.packet.IPacketHandler; +import mineplex.core.server.packet.PacketType; +import mineplex.core.server.remotecall.JsonWebCall; + +import org.bukkit.Bukkit; +import org.bukkit.plugin.PluginManager; + +public class ServerListener extends Thread +{ + private IPacketHandler _packetHandler; + private final String _host; + private final int _port; + + private String _webServer; + + private ServerSocket server; + + private boolean running = true; + + public ServerListener(IPacketHandler packetHandler, String webserver, String host, int port) + { + _packetHandler = packetHandler; + _webServer = webserver; + + _host = host; + _port = port; + + Initialize(); + + System.out.println("Initialized ServerListener"); + + new JsonWebCall(_webServer + "Servers/RegisterServer").Execute(host + ":" + port); + + System.out.println("Finished with constructor"); + } + + public ServerListener(String webserver, String host, int port) + { + this(null, webserver, host, port); + } + + private void Initialize() + { + try + { + server = new ServerSocket(); + server.bind(new InetSocketAddress(_host, _port)); + System.out.println("Listening to " + _host + ":" + _port); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + + public void Shutdown() + { + running = false; + + if (server == null) + return; + + try + { + server.close(); + } + catch (Exception ex) + { + System.out.println("ServerListener.Shutdown Exception : " + ex.getMessage()); + } + + new JsonWebCall(_webServer + "Servers/RemoveServer").Execute(_host + ":" + _port); + } + + @Override + public void run() + { + while (running) + { + Socket socket = null; + DataInputStream dataInput = null; + + try + { + socket = server.accept(); + socket.setSoTimeout(5000); + dataInput = new DataInputStream(socket.getInputStream()); + + if (_packetHandler != null) + { + _packetHandler.HandlePacketEvent(PacketType.GetPacketEventById(dataInput.readShort(), dataInput), socket); + } + else + { + PluginManager pluginManager = Bukkit.getPluginManager(); + + if (pluginManager != null) + Bukkit.getPluginManager().callEvent(PacketType.GetPacketEventById(dataInput.readShort(), dataInput)); + } + System.out.println("received packet"); + } + catch (Exception ex) + { + System.out.println("ServerListener.run Exception : " + ex.getMessage()); + try + { + throw ex; + } catch (Exception e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + finally + { + try + { + if (dataInput != null) + dataInput.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + + try + { + if (socket != null) + socket.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/ServerTalker.java b/Plugins/Mineplex.Core/src/mineplex/core/server/ServerTalker.java new file mode 100644 index 000000000..6082b8051 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/ServerTalker.java @@ -0,0 +1,141 @@ +package mineplex.core.server; + +import java.io.DataOutputStream; +import java.io.IOException; +import java.net.Socket; +import java.util.ArrayList; +import java.util.List; + +import mineplex.core.server.packet.Packet; + +public class ServerTalker extends Thread +{ + private static Object _queueLock = new Object(); + + private List _queue = new ArrayList(); + + private String _serverAddress; + private boolean _running = true; + + private boolean _debug = false; + + public ServerTalker(String serverAddress) + { + _serverAddress = serverAddress; + } + + public void QueuePacket(Packet packet) + { + synchronized(_queueLock) + { + _queue.add(packet); + } + } + + @Override + public void run() + { + while (_running) + { + if (!HasPackets()) + { + try + { + Thread.sleep(25); + } + catch (InterruptedException e) + { + e.printStackTrace(); + } + + continue; + } + + Packet packet = null; + + synchronized(_queueLock) + { + packet = _queue.remove(0); + } + + Socket socket = null; + DataOutputStream dataOutput = null; + + try + { + socket = new Socket(_serverAddress.split(":")[0], Integer.parseInt(_serverAddress.split(":")[1])); + dataOutput = new DataOutputStream(socket.getOutputStream()); + + packet.Write(dataOutput); + dataOutput.flush(); + + if (_debug) + System.out.println("Sent packet to : " + socket.getInetAddress().getHostAddress() + ":" + socket.getPort()); + } + catch (Exception ex) + { + System.out.println("ServerTalker.run Exception(" + _serverAddress + ") : " + ex.getMessage()); + _queue.add(packet); + + try + { + Thread.sleep(15000); + } + catch (InterruptedException e) + { + e.printStackTrace(); + } + } + finally + { + try + { + if (dataOutput != null) + dataOutput.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + + try + { + if (socket != null) + socket.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + public boolean HasPackets() + { + synchronized(_queueLock) + { + return _queue.size() != 0; + } + } + + public void PrintPackets() + { + System.out.println("Listing Packets:"); + + synchronized(_queueLock) + { + if (_queue.isEmpty()) + { + System.out.println("Packet queue empty!"); + } + else + { + for (Packet packet : _queue) + { + System.out.println(packet.getClass()); + } + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/event/GameReadyEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/server/event/GameReadyEvent.java new file mode 100644 index 000000000..1c59fce43 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/event/GameReadyEvent.java @@ -0,0 +1,32 @@ +package mineplex.core.server.event; + +import java.util.List; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class GameReadyEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private List _players; + + public GameReadyEvent(List players) + { + _players = players; + } + + public List GetPlayers() + { + return _players; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/event/PlayerGameAssignmentEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/server/event/PlayerGameAssignmentEvent.java new file mode 100644 index 000000000..e14fa70e5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/event/PlayerGameAssignmentEvent.java @@ -0,0 +1,30 @@ +package mineplex.core.server.event; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class PlayerGameAssignmentEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private String _playerName; + + public PlayerGameAssignmentEvent(String playerName) + { + _playerName = playerName; + } + + public String GetPlayerName() + { + return _playerName; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/event/PlayerGameRequestEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/server/event/PlayerGameRequestEvent.java new file mode 100644 index 000000000..efa247998 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/event/PlayerGameRequestEvent.java @@ -0,0 +1,30 @@ +package mineplex.core.server.event; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class PlayerGameRequestEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private String _playerName; + + public PlayerGameRequestEvent(String playerName) + { + _playerName = playerName; + } + + public String GetPlayerName() + { + return _playerName; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/event/PlayerServerAssignmentEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/server/event/PlayerServerAssignmentEvent.java new file mode 100644 index 000000000..7b95663f5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/event/PlayerServerAssignmentEvent.java @@ -0,0 +1,37 @@ +package mineplex.core.server.event; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class PlayerServerAssignmentEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private String _playerName; + private String _serverName; + + public PlayerServerAssignmentEvent(String playerName, String serverName) + { + _playerName = playerName; + _serverName = serverName; + } + + public String GetPlayerName() + { + return _playerName; + } + + public String GetServerName() + { + return _serverName; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/event/PlayerVoteEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/server/event/PlayerVoteEvent.java new file mode 100644 index 000000000..1dccb0f7e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/event/PlayerVoteEvent.java @@ -0,0 +1,37 @@ +package mineplex.core.server.event; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class PlayerVoteEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private String _playerName; + private int _pointsReceived; + + public PlayerVoteEvent(String playerName, int pointsReceived) + { + _playerName = playerName; + _pointsReceived = pointsReceived; + } + + public String GetPlayerName() + { + return _playerName; + } + + public int GetPointsReceived() + { + return _pointsReceived; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/event/ServerReadyEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/server/event/ServerReadyEvent.java new file mode 100644 index 000000000..e76d2b172 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/event/ServerReadyEvent.java @@ -0,0 +1,30 @@ +package mineplex.core.server.event; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ServerReadyEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private String _serverPath; + + public ServerReadyEvent(String serverName) + { + _serverPath = serverName; + } + + public String GetServerPath() + { + return _serverPath; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/packet/GameReadyPacket.java b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/GameReadyPacket.java new file mode 100644 index 000000000..c4de24728 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/GameReadyPacket.java @@ -0,0 +1,57 @@ +package mineplex.core.server.packet; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import mineplex.core.server.event.GameReadyEvent; + +import org.bukkit.event.Event; + +public class GameReadyPacket extends Packet +{ + private List _players; + + public GameReadyPacket() { } + + public GameReadyPacket(List players) + { + _players = players; + } + + public void ParseStream(DataInputStream dataInput) throws IOException + { + int playerCount = dataInput.readShort(); + + if (_players == null) + _players = new ArrayList(); + + for (int i = 0; i < playerCount; i++) + { + _players.add(readString(dataInput, 16)); + } + } + + public void Write(DataOutputStream dataOutput) throws IOException + { + dataOutput.writeShort(73); + dataOutput.writeShort(_players.size()); + + for (int i = 0; i < _players.size(); i++) + { + writeString(_players.get(i), dataOutput); + } + } + + public Event GetEvent() + { + return new GameReadyEvent(_players); + } + + public List GetPlayers() + { + return _players; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/packet/IPacketHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/IPacketHandler.java new file mode 100644 index 000000000..e86223c9e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/IPacketHandler.java @@ -0,0 +1,10 @@ +package mineplex.core.server.packet; + +import java.net.Socket; + +import org.bukkit.event.Event; + +public interface IPacketHandler +{ + void HandlePacketEvent(Event packetEvent, Socket socket); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/packet/Packet.java b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/Packet.java new file mode 100644 index 000000000..39fe9b2d0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/Packet.java @@ -0,0 +1,47 @@ +package mineplex.core.server.packet; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +import org.bukkit.event.Event; + +public abstract class Packet +{ + public abstract void ParseStream(DataInputStream inputStream) throws IOException; + + public abstract void Write(DataOutputStream dataOutput) throws IOException; + + public abstract Event GetEvent(); + + protected String readString(DataInputStream dataInputStream, int maxLength) throws IOException + { + short length = dataInputStream.readShort(); + + if (length > maxLength) + { + throw new IOException("Received string length longer than maximum allowed (" + length + " > " + maxLength + ")"); + } + else if (length < 0) + { + throw new IOException("Received string length is less than zero! Weird string!"); + } + else + { + StringBuilder stringBuilder = new StringBuilder(); + + for (int i = 0; i < length; i++) + { + stringBuilder.append(dataInputStream.readChar()); + } + + return stringBuilder.toString(); + } + } + + protected void writeString(String string, DataOutputStream dataOutputStream) throws IOException + { + dataOutputStream.writeShort(string.length()); + dataOutputStream.writeChars(string); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/packet/PacketType.java b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/PacketType.java new file mode 100644 index 000000000..86d758294 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/PacketType.java @@ -0,0 +1,68 @@ +package mineplex.core.server.packet; + +import java.io.DataInputStream; + +import mineplex.core.common.util.NautHashMap; + +import org.bukkit.event.Event; + +public enum PacketType +{ + ServerReady((short)61, ServerReadyPacket.class), + PlayerGameRequest((short)71, PlayerGameRequestPacket.class), + PlayerServerAssignment((short)72, PlayerServerAssignmentPacket.class), + GameReady((short)73, GameReadyPacket.class), + PlayerVote((short)81, PlayerVotePacket.class); + + private short _packetId; + private Class _packetClass; + + private static NautHashMap _typeMapping; + + private PacketType(short id, Class packetClass) + { + _packetId = id; + _packetClass = packetClass; + } + + public short GetPacketId() + { + return _packetId; + } + + public Class GetPacketClass() + { + return _packetClass; + } + + public static Event GetPacketEventById(short id, DataInputStream dataInputStream) throws Exception + { + if (_typeMapping == null) + { + InitializeMapping(); + } + + if (!_typeMapping.containsKey(id)) + { + throw new Exception("Invalid packet id"); + } + + Class packetClass = _typeMapping.get(id).GetPacketClass(); + + Packet newPacket = (Packet) packetClass.newInstance(); + + newPacket.ParseStream(dataInputStream); + + return newPacket.GetEvent(); + } + + private static void InitializeMapping() + { + _typeMapping = new NautHashMap(); + + for (PacketType packetType : values()) + { + _typeMapping.put(packetType.GetPacketId(), packetType); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/packet/PlayerGameAssignmentPacket.java b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/PlayerGameAssignmentPacket.java new file mode 100644 index 000000000..7593ecccd --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/PlayerGameAssignmentPacket.java @@ -0,0 +1,42 @@ +package mineplex.core.server.packet; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +import org.bukkit.event.Event; + +import mineplex.core.server.event.PlayerGameAssignmentEvent; + +public class PlayerGameAssignmentPacket extends Packet +{ + private String _playerName; + + public PlayerGameAssignmentPacket() { } + + public PlayerGameAssignmentPacket(String playerName) + { + _playerName = playerName; + } + + public void ParseStream(DataInputStream dataInput) throws IOException + { + _playerName = readString(dataInput, 16); + } + + public void Write(DataOutputStream dataOutput) throws IOException + { + dataOutput.writeShort(71); + writeString(_playerName, dataOutput); + } + + public Event GetEvent() + { + return new PlayerGameAssignmentEvent(_playerName); + } + + public String GetPlayerName() + { + return _playerName; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/packet/PlayerGameRequestPacket.java b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/PlayerGameRequestPacket.java new file mode 100644 index 000000000..5938282fc --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/PlayerGameRequestPacket.java @@ -0,0 +1,42 @@ +package mineplex.core.server.packet; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +import org.bukkit.event.Event; + +import mineplex.core.server.event.PlayerGameRequestEvent; + +public class PlayerGameRequestPacket extends Packet +{ + private String _playerName; + + public PlayerGameRequestPacket() { } + + public PlayerGameRequestPacket(String playerName) + { + _playerName = playerName; + } + + public void ParseStream(DataInputStream dataInput) throws IOException + { + _playerName = readString(dataInput, 16); + } + + public void Write(DataOutputStream dataOutput) throws IOException + { + dataOutput.writeShort(71); + writeString(_playerName, dataOutput); + } + + public Event GetEvent() + { + return new PlayerGameRequestEvent(_playerName); + } + + public String GetPlayerName() + { + return _playerName; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/packet/PlayerServerAssignmentPacket.java b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/PlayerServerAssignmentPacket.java new file mode 100644 index 000000000..0e88d8b55 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/PlayerServerAssignmentPacket.java @@ -0,0 +1,44 @@ +package mineplex.core.server.packet; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +import mineplex.core.server.event.PlayerServerAssignmentEvent; + +import org.bukkit.event.Event; + +public class PlayerServerAssignmentPacket extends Packet +{ + private String _playerName; + private String _serverName; + + public PlayerServerAssignmentPacket() { } + + public PlayerServerAssignmentPacket(String playerName, String serverName) + { + _playerName = playerName; + _serverName = serverName; + } + + @Override + public void ParseStream(DataInputStream inputStream) throws IOException + { + _playerName = readString(inputStream, 16); + _serverName = readString(inputStream, 16); + } + + public void Write(DataOutputStream dataOutput) throws IOException + { + dataOutput.writeShort(72); + writeString(_playerName, dataOutput); + writeString(_serverName, dataOutput); + } + + @Override + public Event GetEvent() + { + return new PlayerServerAssignmentEvent(_playerName, _serverName); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/packet/PlayerVotePacket.java b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/PlayerVotePacket.java new file mode 100644 index 000000000..908d7ed52 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/PlayerVotePacket.java @@ -0,0 +1,51 @@ +package mineplex.core.server.packet; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +import mineplex.core.server.event.PlayerVoteEvent; + +import org.bukkit.event.Event; + +public class PlayerVotePacket extends Packet +{ + private String _playerName; + private int _points; + + public PlayerVotePacket() { } + + public PlayerVotePacket(String playerName, int points) + { + _playerName = playerName; + _points = points; + } + + public void ParseStream(DataInputStream dataInput) throws IOException + { + _playerName = readString(dataInput, 16); + _points = dataInput.readInt(); + } + + public void Write(DataOutputStream dataOutput) throws IOException + { + dataOutput.writeShort(81); + writeString(_playerName, dataOutput); + dataOutput.writeInt(_points); + } + + public String GetPlayerName() + { + return _playerName; + } + + public int GetPointReward() + { + return _points; + } + + public Event GetEvent() + { + return new PlayerVoteEvent(_playerName, _points); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/packet/ServerReadyPacket.java b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/ServerReadyPacket.java new file mode 100644 index 000000000..1b55b767e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/packet/ServerReadyPacket.java @@ -0,0 +1,41 @@ +package mineplex.core.server.packet; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +import mineplex.core.server.event.ServerReadyEvent; + +import org.bukkit.event.Event; + +public class ServerReadyPacket extends Packet +{ + private String _serverPath; + + public ServerReadyPacket() { } + + public ServerReadyPacket(String serverPath) + { + _serverPath = serverPath; + } + + @Override + public void ParseStream(DataInputStream inputStream) throws IOException + { + _serverPath = readString(inputStream, 21); + } + + @Override + public void Write(DataOutputStream dataOutput) throws IOException + { + dataOutput.writeShort(61); + writeString(_serverPath, dataOutput); + } + + @Override + public Event GetEvent() + { + return new ServerReadyEvent(_serverPath); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/remotecall/AsyncJsonWebCall.java b/Plugins/Mineplex.Core/src/mineplex/core/server/remotecall/AsyncJsonWebCall.java new file mode 100644 index 000000000..3c2676c69 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/remotecall/AsyncJsonWebCall.java @@ -0,0 +1,63 @@ +package mineplex.core.server.remotecall; + +import mineplex.core.common.util.Callback; + +public class AsyncJsonWebCall extends JsonWebCall +{ + public AsyncJsonWebCall(String url) + { + super(url); + } + + public void Execute() + { + Thread asyncThread = new Thread(new Runnable() + { + public void run() + { + AsyncJsonWebCall.super.Execute(); + } + }); + + asyncThread.start(); + } + + public void Execute(final Object argument) + { + Thread asyncThread = new Thread(new Runnable() + { + public void run() + { + AsyncJsonWebCall.super.Execute(argument); + } + }); + + asyncThread.start(); + } + + public void Execute(final Class callbackClass, final Callback callback) + { + Thread asyncThread = new Thread(new Runnable() + { + public void run() + { + AsyncJsonWebCall.super.Execute(callbackClass, callback); + } + }); + + asyncThread.start(); + } + + public void Execute(final Class callbackClass, final Callback callback, final Object argument) + { + Thread asyncThread = new Thread(new Runnable() + { + public void run() + { + AsyncJsonWebCall.super.Execute(callbackClass, callback, argument); + } + }); + + asyncThread.start(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/remotecall/JsonWebCall.java b/Plugins/Mineplex.Core/src/mineplex/core/server/remotecall/JsonWebCall.java new file mode 100644 index 000000000..412f7e7f4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/remotecall/JsonWebCall.java @@ -0,0 +1,356 @@ +package mineplex.core.server.remotecall; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.Type; + +import mineplex.core.common.util.Callback; + +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.conn.scheme.PlainSocketFactory; +import org.apache.http.conn.scheme.Scheme; +import org.apache.http.conn.scheme.SchemeRegistry; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.conn.PoolingClientConnectionManager; +import org.apache.http.message.BasicHeader; +import org.apache.http.protocol.HTTP; +import org.bukkit.craftbukkit.libs.com.google.gson.Gson; + +public class JsonWebCall +{ + private String _url; + private PoolingClientConnectionManager _connectionManager; + + public JsonWebCall(String url) + { + _url = url; + + SchemeRegistry schemeRegistry = new SchemeRegistry(); + schemeRegistry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory())); + + _connectionManager = new PoolingClientConnectionManager(schemeRegistry); + _connectionManager.setMaxTotal(200); + _connectionManager.setDefaultMaxPerRoute(20); + } + + public String ExecuteReturnStream(Object argument) + { + HttpClient httpClient = new DefaultHttpClient(_connectionManager); + InputStream in = null; + String result = null; + + try + { + HttpResponse response; + + Gson gson = new Gson(); + HttpPost request = new HttpPost(_url); + + if (argument != null) + { + StringEntity params = new StringEntity(gson.toJson(argument)); + params.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); + request.setEntity(params); + } + + response = httpClient.execute(request); + + if (response != null) + { + in = response.getEntity().getContent(); + result = convertStreamToString(in); + } + } + catch (Exception ex) + { + System.out.println("Error executing JsonWebCall: \n" + ex.getMessage()); + System.out.println("Result: \n" + result); + + for (StackTraceElement trace : ex.getStackTrace()) + { + System.out.println(trace); + } + } + finally + { + httpClient.getConnectionManager().shutdown(); + + if (in != null) + { + try + { + in.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + + return result; + } + + public void Execute() + { + Execute((Object)null); + } + + public void Execute(Object argument) + { + HttpClient httpClient = new DefaultHttpClient(_connectionManager); + InputStream in = null; + + try + { + Gson gson = new Gson(); + HttpPost request = new HttpPost(_url); + + if (argument != null) + { + StringEntity params = new StringEntity(gson.toJson(argument)); + params.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); + request.setEntity(params); + } + + httpClient.execute(request); + } + catch (Exception ex) + { + System.out.println("JsonWebCall.Execute() Error:\n" + ex.getMessage()); + + for (StackTraceElement trace : ex.getStackTrace()) + { + System.out.println(trace); + } + } + finally + { + httpClient.getConnectionManager().shutdown(); + + if (in != null) + { + try + { + in.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + public T Execute(Class returnClass) + { + return Execute(returnClass, (Object)null); + } + + public T Execute(Type returnType, Object argument) + { + HttpClient httpClient = new DefaultHttpClient(_connectionManager); + InputStream in = null; + T returnData = null; + String result = null; + + try + { + HttpResponse response; + + Gson gson = new Gson(); + HttpPost request = new HttpPost(_url); + + if (argument != null) + { + StringEntity params = new StringEntity(gson.toJson(argument)); + params.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); + request.setEntity(params); + } + + response = httpClient.execute(request); + + if (response != null) + { + in = response.getEntity().getContent(); + + result = convertStreamToString(in); + returnData = new Gson().fromJson(result, returnType); + } + } + catch (Exception ex) + { + System.out.println("Error executing JsonWebCall: \n" + ex.getMessage()); + System.out.println("Result: \n" + result); + + for (StackTraceElement trace : ex.getStackTrace()) + { + System.out.println(trace); + } + } + finally + { + httpClient.getConnectionManager().shutdown(); + + if (in != null) + { + try + { + in.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + + return returnData; + } + + public T Execute(Class returnClass, Object argument) + { + HttpClient httpClient = new DefaultHttpClient(_connectionManager); + InputStream in = null; + T returnData = null; + String result = null; + + try + { + HttpResponse response; + + Gson gson = new Gson(); + HttpPost request = new HttpPost(_url); + + if (argument != null) + { + StringEntity params = new StringEntity(gson.toJson(argument)); + params.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); + request.setEntity(params); + } + + response = httpClient.execute(request); + + if (response != null) + { + in = response.getEntity().getContent(); + + result = convertStreamToString(in); + returnData = new Gson().fromJson(result, returnClass); + } + } + catch (Exception ex) + { + System.out.println("Error executing JsonWebCall: \n" + ex.getMessage()); + System.out.println("Result: \n" + result); + + for (StackTraceElement trace : ex.getStackTrace()) + { + System.out.println(trace); + } + } + finally + { + httpClient.getConnectionManager().shutdown(); + + if (in != null) + { + try + { + in.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + + return returnData; + } + + public void Execute(Class callbackClass, Callback callback) + { + Execute(callbackClass, callback, (Object)null); + } + + public void Execute(Class callbackClass, Callback callback, Object argument) + { + HttpClient httpClient = new DefaultHttpClient(_connectionManager); + InputStream in = null; + String result = null; + + try + { + HttpResponse response; + + Gson gson = new Gson(); + HttpPost request = new HttpPost(_url); + + if (argument != null) + { + StringEntity params = new StringEntity(gson.toJson(argument)); + params.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); + request.setEntity(params); + } + + response = httpClient.execute(request); + + if (response != null && callback != null) + { + in = response.getEntity().getContent(); + + result = convertStreamToString(in); + callback.run(new Gson().fromJson(result, callbackClass)); + } + } + catch (Exception ex) + { + System.out.println("Error executing JsonWebCall: \n" + ex.getMessage()); + System.out.println("Result: \n" + result); + } + finally + { + httpClient.getConnectionManager().shutdown(); + + if (in != null) + { + try + { + in.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + protected String convertStreamToString(InputStream is) + { + BufferedReader reader = new BufferedReader(new InputStreamReader(is)); + StringBuilder sb = new StringBuilder(); + + String line = null; + try { + while ((line = reader.readLine()) != null) { + sb.append(line + "\n"); + } + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return sb.toString(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/util/TransactionResponse.java b/Plugins/Mineplex.Core/src/mineplex/core/server/util/TransactionResponse.java new file mode 100644 index 000000000..8df90ac98 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/util/TransactionResponse.java @@ -0,0 +1,9 @@ +package mineplex.core.server.util; + +public enum TransactionResponse +{ + InsufficientFunds, + Success, + Failed, + AlreadyOwns, +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java new file mode 100644 index 000000000..acfa324ae --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java @@ -0,0 +1,172 @@ +package mineplex.core.shop; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.ChatColor; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.CurrencyType; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.page.ShopPageBase; + +public abstract class ShopBase implements Listener +{ + private NautHashMap _errorThrottling; + private NautHashMap _purchaseBlock; + + private List _availableCurrencyTypes; + + protected PluginType Plugin; + protected CoreClientManager ClientManager; + protected DonationManager DonationManager; + protected String Name; + protected NautHashMap>> PlayerPageMap; + + public ShopBase(PluginType plugin, CoreClientManager clientManager, DonationManager donationManager, String name, CurrencyType...currencyTypes) + { + Plugin = plugin; + ClientManager = clientManager; + DonationManager = donationManager; + Name = name; + + PlayerPageMap = new NautHashMap>>(); + _errorThrottling = new NautHashMap(); + _purchaseBlock = new NautHashMap(); + + _availableCurrencyTypes = new ArrayList(); + _availableCurrencyTypes.addAll(Arrays.asList(currencyTypes)); + + Plugin.RegisterEvents(this); + } + + public List GetAvailableCurrencyTypes() + { + return _availableCurrencyTypes; + } + + @EventHandler(priority = EventPriority.LOWEST) + public void OnPlayerInteractEntity(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() instanceof LivingEntity) + { + LivingEntity rightClicked = (LivingEntity)event.getRightClicked(); + + if (rightClicked.isCustomNameVisible() && rightClicked.getCustomName() != null && ChatColor.stripColor(rightClicked.getCustomName()).equalsIgnoreCase(ChatColor.stripColor(Name))) + { + OpenShopForPlayer(event.getPlayer()); + if (!PlayerPageMap.containsKey(event.getPlayer().getName())) + { + PlayerPageMap.put(event.getPlayer().getName(), BuildPagesFor(event.getPlayer())); + } + + OpenPageForPlayer(event.getPlayer(), GetOpeningPageForPlayer(event.getPlayer())); + + event.setCancelled(true); + } + } + } + + protected ShopPageBase> GetOpeningPageForPlayer(Player player) + { + return PlayerPageMap.get(player.getName()); + } + + @EventHandler + public void OnInventoryClick(InventoryClickEvent event) + { + if (PlayerPageMap.containsKey(event.getWhoClicked().getName()) && PlayerPageMap.get(event.getWhoClicked().getName()).getName().equalsIgnoreCase(event.getInventory().getName())) + { + PlayerPageMap.get(event.getWhoClicked().getName()).PlayerClicked(event); + event.setCancelled(true); + } + } + + @EventHandler + public void OnInventoryClose(InventoryCloseEvent event) + { + if (PlayerPageMap.containsKey(event.getPlayer().getName()) && PlayerPageMap.get(event.getPlayer().getName()).getTitle().equalsIgnoreCase(event.getInventory().getTitle())) + { + PlayerPageMap.get(event.getPlayer().getName()).PlayerClosed(); + PlayerPageMap.get(event.getPlayer().getName()).Dispose(); + CloseShopForPlayer((Player)event.getPlayer()); + + PlayerPageMap.remove(event.getPlayer().getName()); + } + } + + protected void OpenShopForPlayer(Player player) { } + + protected void CloseShopForPlayer(Player player) { } + + public void ResetPlayer(Player player) + { + PlayerPageMap.remove(player.getName()); + } + + @EventHandler + public void OnPlayerQuit(PlayerQuitEvent event) + { + if (PlayerPageMap.containsKey(event.getPlayer().getName())) + { + PlayerPageMap.get(event.getPlayer().getName()).PlayerClosed(); + PlayerPageMap.get(event.getPlayer().getName()).Dispose(); + + event.getPlayer().closeInventory(); + CloseShopForPlayer(event.getPlayer()); + + PlayerPageMap.remove(event.getPlayer().getName()); + } + } + + public void OpenPageForPlayer(Player player, ShopPageBase> page) + { + if (PlayerPageMap.containsKey(player.getName())) + { + PlayerPageMap.get(player.getName()).PlayerClosed(); + } + + SetCurrentPageForPlayer(player, page); + + player.closeInventory(); + + player.openInventory(page); + } + + public void SetCurrentPageForPlayer(Player player, ShopPageBase> page) + { + PlayerPageMap.put(player.getName(), page); + } + + public void AddPlayerProcessError(Player player) + { + if (_errorThrottling.containsKey(player.getName()) && (System.currentTimeMillis() - _errorThrottling.get(player.getName()) <= 5000)) + _purchaseBlock.put(player.getName(), System.currentTimeMillis()); + + _errorThrottling.put(player.getName(), System.currentTimeMillis()); + } + + public boolean CanPlayerAttemptPurchase(Player player) + { + return !_purchaseBlock.containsKey(player.getName()) || (System.currentTimeMillis() - _purchaseBlock.get(player.getName()) > 10000); + } + + public NautHashMap>> GetPageMap() + { + return PlayerPageMap; + } + + protected abstract ShopPageBase> BuildPagesFor(Player player); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/IButton.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/IButton.java new file mode 100644 index 000000000..706c2c26d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/IButton.java @@ -0,0 +1,8 @@ +package mineplex.core.shop.item; + +import org.bukkit.entity.Player; + +public interface IButton +{ + public void Clicked(Player player); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ICurrencyPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ICurrencyPackage.java new file mode 100644 index 000000000..4dc987a37 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ICurrencyPackage.java @@ -0,0 +1,12 @@ +package mineplex.core.shop.item; + +import mineplex.core.common.CurrencyType; +import mineplex.core.donation.repository.GameSalesPackageToken; + +public interface ICurrencyPackage +{ + int GetSalesPackageId(); + int GetCost(CurrencyType currencytype); + boolean IsFree(); + void Update(GameSalesPackageToken token); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/IDisplayPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/IDisplayPackage.java new file mode 100644 index 000000000..48e1a5f0a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/IDisplayPackage.java @@ -0,0 +1,11 @@ +package mineplex.core.shop.item; + +import org.bukkit.Material; + +public interface IDisplayPackage +{ + String GetName(); + String[] GetDescription(); + Material GetDisplayMaterial(); + byte GetDisplayData(); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/IPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/IPackage.java new file mode 100644 index 000000000..514324aaf --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/IPackage.java @@ -0,0 +1,7 @@ +package mineplex.core.shop.item; + +public interface IPackage +{ + int GetSalesPackageId(); + boolean IsFree(); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ISalesPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ISalesPackage.java new file mode 100644 index 000000000..f0460b6a1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ISalesPackage.java @@ -0,0 +1,22 @@ +package mineplex.core.shop.item; + +import java.util.List; + +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClient; +import net.minecraft.server.v1_6_R2.IInventory; + +public interface ISalesPackage +{ + String GetName(); + int GetGemCost(); + boolean CanFitIn(CoreClient player); + List AddToCategory(IInventory inventory, int slot); + void DeliverTo(Player player); + void PurchaseBy(CoreClient player); + int ReturnFrom(CoreClient player); + void DeliverTo(Player player, int slot); + int GetSalesPackageId(); + boolean IsFree(); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ItemPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ItemPackage.java new file mode 100644 index 000000000..4f94e67bd --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ItemPackage.java @@ -0,0 +1,167 @@ +package mineplex.core.shop.item; + +import java.util.Arrays; +import java.util.List; + +import mineplex.core.account.CoreClient; +import mineplex.core.common.util.InventoryUtil; +import net.minecraft.server.v1_6_R2.IInventory; + +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftInventory; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class ItemPackage implements ISalesPackage +{ + private ShopItem _shopItem; + private boolean _restrictToHotbar; + private int _gemCost; + private boolean _free; + private int _salesPackageId; + + public ItemPackage(ShopItem shopItem, int gemCost, boolean isFree, int salesPackageId) + { + this(shopItem, true, gemCost, isFree, salesPackageId); + } + + public ItemPackage(ShopItem shopItem, boolean restrictToHotbar, int gemCost, boolean isFree, int salesPackageId) + { + _shopItem = shopItem; + _restrictToHotbar = restrictToHotbar; + _gemCost = gemCost; + _free = isFree; + _salesPackageId = salesPackageId; + } + + @Override + public String GetName() + { + return _shopItem.GetName(); + } + + @Override + public int GetSalesPackageId() + { + return _salesPackageId; + } + + public int GetGemCost() + { + return _gemCost; + } + + @Override + public boolean IsFree() + { + return _free; + } + + @Override + public boolean CanFitIn(CoreClient player) + { + if (_shopItem.IsLocked() && !IsFree()) + return false; + + for (ItemStack itemStack : player.GetPlayer().getInventory()) + { + if (itemStack != null && itemStack.getType() == _shopItem.getType() && (itemStack.getAmount() + _shopItem.getAmount()) <= (itemStack.getType() == Material.ARROW ? itemStack.getMaxStackSize() : 1)) + { + return true; + } + } + + if (_gemCost == 0) + return true; + + if (InventoryUtil.first((CraftInventory)player.GetPlayer().getInventory(), _restrictToHotbar ? 9 : player.GetPlayer().getInventory().getSize(), null, true) == -1) + return false; + else + return true; + } + + @Override + public void DeliverTo(Player player) + { + ShopItem shopItem = _shopItem.clone(); + shopItem.SetDeliverySettings(); + + if (shopItem.getType() == Material.ARROW) + { + // int firstEmpty = player.getInventory().firstEmpty(); + + player.getInventory().addItem(shopItem); + + /* TODO default item? + if (player.getInventory().firstEmpty() != firstEmpty) + { + player.PutDefaultItem(player.getInventory().getItem(firstEmpty), firstEmpty); + } + + for (Entry entry : player.getInventory().all(Material.ARROW).entrySet()) + { + player.PutDefaultItem(entry.getValue().clone(), entry.getKey()); + } + */ + } + else + { + int emptySlot = player.getInventory().firstEmpty(); + + player.getInventory().setItem(emptySlot, shopItem); + // TODO default ? player.PutDefaultItem(shopItem.clone(), emptySlot); + } + } + + @Override + public void DeliverTo(Player player, int slot) + { + ShopItem shopItem = _shopItem.clone(); + shopItem.SetDeliverySettings(); + + player.getInventory().setItem(slot, shopItem); + // TODO default? player.PutDefaultItem(shopItem.clone(), slot); + } + + @Override + public void PurchaseBy(CoreClient player) + { + DeliverTo(player.GetPlayer()); + } + + @Override + public int ReturnFrom(CoreClient player) + { + if (_shopItem.IsDisplay()) + return 0; + + ShopItem shopItem = _shopItem.clone(); + shopItem.SetDeliverySettings(); + + int count = 0; + + count = InventoryUtil.GetCountOfObjectsRemoved((CraftInventory)player.GetPlayer().getInventory(), 9, (ItemStack)shopItem); + + /* TODO default + for (int i=0; i < 9; i++) + { + player.Class().PutDefaultItem(player.Class().GetInventory().getItem(i), i); + } + */ + + return count; + } + + @Override + public List AddToCategory(IInventory inventory, int slot) + { + inventory.setItem(slot, _shopItem.getHandle()); + + return Arrays.asList(slot); + } + + public ShopItem GetItem() + { + return _shopItem; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java new file mode 100644 index 000000000..9259f3fce --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java @@ -0,0 +1,105 @@ +package mineplex.core.shop.item; + + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.common.CurrencyType; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.donation.repository.GameSalesPackageToken; + +public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPackage +{ + private Material _displayMaterial; + private byte _displayData; + + private String _name; + private String[] _description; + + protected int SalesPackageId; + protected boolean Free; + protected NautHashMap CurrencyCostMap; + protected boolean KnownPackage = true; + protected boolean OneTimePurchaseOnly = true; + + public SalesPackageBase(String name, Material material, String...description) + { + this(name, material, (byte)0, description); + } + + public SalesPackageBase(String name, Material material, byte displayData, String...description) + { + CurrencyCostMap = new NautHashMap(); + + _name = name; + _description = description; + _displayMaterial = material; + _displayData = displayData; + } + + public abstract void Sold(Player player, CurrencyType currencyType); + + @Override + public String GetName() + { + return _name; + } + + @Override + public String[] GetDescription() + { + return _description; + } + + @Override + public int GetCost(CurrencyType currencyType) + { + return CurrencyCostMap.containsKey(currencyType) ? CurrencyCostMap.get(currencyType) : 0; + } + + @Override + public int GetSalesPackageId() + { + return SalesPackageId; + } + + @Override + public boolean IsFree() + { + return Free; + } + + @Override + public Material GetDisplayMaterial() + { + return _displayMaterial; + } + + @Override + public byte GetDisplayData() + { + return _displayData; + } + + @Override + public void Update(GameSalesPackageToken token) + { + SalesPackageId = token.GameSalesPackageId; + Free = token.Free; + + if (token.Gems > 0) + { + CurrencyCostMap.put(CurrencyType.Gems, token.Gems); + } + } + + public boolean IsKnown() + { + return KnownPackage; + } + + public boolean OneTimePurchase() + { + return OneTimePurchaseOnly; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java new file mode 100644 index 000000000..86c927457 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java @@ -0,0 +1,175 @@ +package mineplex.core.shop.item; + +import net.minecraft.server.v1_6_R2.NBTTagList; +import net.minecraft.server.v1_6_R2.NBTTagString; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; +import org.bukkit.inventory.ItemStack; + +public class ShopItem extends CraftItemStack +{ + protected String _name; + private String _deliveryName; + protected String[] _lore; + private int _deliveryAmount; + private boolean _locked; + private boolean _displayItem; + + public ShopItem(ItemStack itemStack, String name, String deliveryName, int deliveryAmount, boolean locked, boolean displayItem) + { + super(itemStack); + + _name = name; + _deliveryName = deliveryName; + _displayItem = displayItem; + _deliveryAmount = deliveryAmount; + + getHandle().tag = ((CraftItemStack)itemStack).getHandle().tag; + + UpdateVisual(true); + getHandle().tag.set("AttributeModifiers", new NBTTagList()); + } + + public ShopItem(Material type, String name, int deliveryAmount, boolean locked) + { + this(type, name, null, deliveryAmount, locked); + } + + public ShopItem(Material type, String name, String[] lore, int deliveryAmount, boolean locked) + { + this(type, name, lore, deliveryAmount, locked, false); + } + + public ShopItem(Material type, String name, String[] lore, int deliveryAmount, boolean locked, boolean displayItem) + { + this(type, (byte)0, name, null, lore, deliveryAmount, locked, displayItem); + } + + public ShopItem(Material type, byte data, String name, String[] lore, int deliveryAmount, boolean locked, boolean displayItem) + { + this(type, data, name, null, lore, deliveryAmount, locked, displayItem); + } + + public ShopItem(Material type, byte data, String name, String deliveryName, String[] lore, int deliveryAmount, boolean locked, boolean displayItem) + { + super(type.getId(), Math.max(deliveryAmount, 1), data, null); + + _name = name; + _deliveryName = deliveryName; + _lore = lore; + _displayItem = displayItem; + _deliveryAmount = deliveryAmount; + _locked = locked; + + UpdateVisual(false); + + // Fix for temp save junk(fixes problem when disconnecting and trying to return) + if (getHandle().tag != null) + getHandle().tag.setName("tag"); + + getHandle().tag.setByte("Count", (byte)Math.max(deliveryAmount, 1)); + getHandle().tag.set("AttributeModifiers", new NBTTagList()); + } + + public boolean IsLocked() + { + return _locked; + } + + public void SetDeliverySettings() + { + setAmount(_deliveryAmount); + + //Delivery Name + if (_deliveryName != null) + this.getHandle().c(_deliveryName); + } + + public ShopItem clone() + { + return new ShopItem(super.clone(), _name, _deliveryName, _deliveryAmount, _locked, _displayItem); + } + + @Override + public boolean equals(Object obj) + { + if (!super.equals(obj)) + { + return false; + } + + net.minecraft.server.v1_6_R2.ItemStack original = ((CraftItemStack)this).getHandle(); + net.minecraft.server.v1_6_R2.ItemStack comparison = ((CraftItemStack)obj).getHandle(); + + return original.tag == null || original.tag.equals(comparison.tag); + } + + protected void UpdateVisual(boolean clone) + { + if (!clone) + { + if (_locked && !_displayItem) + { + this.getHandle().c(ChatColor.RED + "§l" + _name); + } + else + { + this.getHandle().c(ChatColor.GREEN + "§l" + _name); + } + } + + NBTTagList lore = new NBTTagList("Lore"); + + if (_lore != null) + { + for (String line : _lore) + { + if (line != null && !line.isEmpty()) + lore.add(new NBTTagString("Test", line)); + } + } + + getHandle().tag.getCompound("display").set("Lore", lore); + } + + public boolean IsDisplay() + { + return _displayItem; + } + + public void SetLocked(boolean owns) + { + _locked = owns; + UpdateVisual(false); + } + + public String GetName() + { + return _name; + } + + public void SetName(String name) + { + _name = name; + } + + public void SetLore(String[] string) + { + _lore = string; + + NBTTagList lore = new NBTTagList("Lore"); + + if (_lore != null) + { + for (String line : _lore) + { + if (line != null && !line.isEmpty()) + lore.add(new NBTTagString("Test", line)); + } + } + + getHandle().tag.getCompound("display").set("Lore", lore); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/AnvilContainer.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/AnvilContainer.java new file mode 100644 index 000000000..9d67d8a6e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/AnvilContainer.java @@ -0,0 +1,72 @@ +package mineplex.core.shop.page; + +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftInventory; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftInventoryDoubleChest; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftInventoryPlayer; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftInventoryView; + +import net.minecraft.server.v1_6_R2.Container; +import net.minecraft.server.v1_6_R2.EntityHuman; +import net.minecraft.server.v1_6_R2.IInventory; +import net.minecraft.server.v1_6_R2.InventoryLargeChest; +import net.minecraft.server.v1_6_R2.PlayerInventory; +import net.minecraft.server.v1_6_R2.Slot; + +public class AnvilContainer extends Container +{ + public IInventory _container; + private CraftInventoryView _bukkitEntity = null; + private PlayerInventory _playerInventory; + + public AnvilContainer(PlayerInventory playerInventory, IInventory anvilInventory) + { + _playerInventory = playerInventory; + _container = anvilInventory; + + a(new Slot(anvilInventory, 0, 27, 47)); + a(new Slot(anvilInventory, 1, 76, 47)); + a(new Slot(anvilInventory, 2, 134, 47)); + + for (int l = 0; l < 3; l++) + { + for (int i1 = 0; i1 < 9; i1++) + { + a(new Slot(playerInventory, i1 + l * 9 + 9, 8 + i1 * 18, 84 + l * 18)); + } + } + + for (int l = 0; l < 9; l++) + a(new Slot(playerInventory, l, 8 + l * 18, 142)); + } + + @Override + public CraftInventoryView getBukkitView() + { + if (_bukkitEntity != null) + return _bukkitEntity; + + CraftInventory inventory; + if ((_container instanceof PlayerInventory)) + { + inventory = new CraftInventoryPlayer((PlayerInventory)_container); + } + else + { + if ((_container instanceof InventoryLargeChest)) + inventory = new CraftInventoryDoubleChest((InventoryLargeChest)_container); + else + inventory = new CraftInventory(_container); + } + + _bukkitEntity = new CraftInventoryView(_playerInventory.player.getBukkitEntity(), inventory, this); + + return _bukkitEntity; + } + + @Override + public boolean a(EntityHuman arg0) + { + return true; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java new file mode 100644 index 000000000..a3a636124 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java @@ -0,0 +1,275 @@ +package mineplex.core.shop.page; + +import mineplex.core.MiniPlugin; +import mineplex.core.server.util.TransactionResponse; +import mineplex.core.shop.ShopBase; +import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ISalesPackage; +import mineplex.core.shop.item.ItemPackage; +import mineplex.core.shop.item.SalesPackageBase; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.page.ShopPageBase; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.CurrencyType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; + + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +public class ConfirmationPage> extends ShopPageBase implements Runnable +{ + private Runnable _runnable; + private ShopPageBase _returnPage; + private SalesPackageBase _salesItem; + private int _okSquareSlotStart; + private boolean _processing; + private int _progressCount; + private ShopItem _progressItem; + private int _taskId; + + public ConfirmationPage(PluginType plugin, ShopType shop, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager, Runnable runnable, ShopPageBase returnPage, SalesPackageBase salesItem, CurrencyType currencyType, Player player) + { + super(plugin, shop, clientManager, donationManager, " Confirmation", player); + + _runnable = runnable; + _returnPage = returnPage; + _salesItem = salesItem; + SelectedCurrency = currencyType; + _progressItem = new ShopItem(Material.LAPIS_BLOCK, (byte)11, ChatColor.BLUE + "Processing", null, 1, false, true); + _okSquareSlotStart = 27; + + if (Shop.CanPlayerAttemptPurchase(player)) + { + BuildPage(); + } + else + { + BuildErrorPage(new String[] { ChatColor.RED + "You have attempted too many invalid transactions.", ChatColor.RED + "Please wait 10 seconds before retrying." }); + _taskId = plugin.GetScheduler().scheduleSyncRepeatingTask(plugin.GetPlugin(), this, 2L, 2L); + } + } + + protected void BuildPage() + { + this.getInventory().setItem(22, new ShopItem(_salesItem.GetDisplayMaterial(), (byte)0, _salesItem.GetName(), _salesItem.GetDescription(), 1, false, true).getHandle()); + + IButton okClicked = new IButton() + { + @Override + public void Clicked(Player player) + { + OkClicked(player); + } + }; + + IButton cancelClicked = new IButton() + { + @Override + public void Clicked(Player player) + { + CancelClicked(player); + } + }; + + BuildSquareAt(_okSquareSlotStart, new ShopItem(Material.EMERALD_BLOCK, (byte)0, ChatColor.GREEN + "OK", null, 1, false, true), okClicked); + BuildSquareAt(_okSquareSlotStart + 6, new ShopItem(Material.REDSTONE_BLOCK, (byte)0, ChatColor.RED + "CANCEL", null, 1, false, true), cancelClicked); + + this.getInventory().setItem(4, new ShopItem(SelectedCurrency.GetDisplayMaterial(), (byte)0, SelectedCurrency.toString(), new String[] { C.cGray + _salesItem.GetCost(SelectedCurrency) + " " + SelectedCurrency.toString() + " will be deducted from your account balance." }, 1, false, true).getHandle()); + } + + protected void OkClicked(Player player) + { + ProcessTransaction(); + } + + protected void CancelClicked(Player player) + { + if (_returnPage != null) + Shop.OpenPageForPlayer(player, _returnPage); + else + player.closeInventory(); + + Plugin.GetScheduler().cancelTask(_taskId); + } + + private void BuildSquareAt(int slot, ShopItem item, IButton button) + { + BuildSquareAt(slot, item, new ItemPackage(item, 0, false, -1), button); + } + + private void BuildSquareAt(int slot, ShopItem item, ISalesPackage middleItem, IButton button) + { + AddButton(slot, item, button); + AddButton(slot + 1, item, button); + AddButton(slot + 2, item, button); + + slot += 9; + + AddButton(slot, item, button); + AddButton(slot + 1, item, button); + AddButton(slot + 2, item, button); + + slot += 9; + + AddButton(slot, item, button); + AddButton(slot + 1, item, button); + AddButton(slot + 2, item, button); + } + + private void ProcessTransaction() + { + for (int i=_okSquareSlotStart; i < 54; i++) + { + clear(i); + } + + _processing = true; + + if (_salesItem.IsKnown()) + { + DonationManager.PurchaseKnownSalesPackage(new Callback () + { + public void run(TransactionResponse response) + { + ShowResultsPage(response); + } + }, Player.getName(), _salesItem.GetSalesPackageId()); + } + else + { + DonationManager.PurchaseUnknownSalesPackage(new Callback () + { + public void run(TransactionResponse response) + { + ShowResultsPage(response); + } + }, Player.getName(), _salesItem.GetName(), _salesItem.GetCost(SelectedCurrency), _salesItem.OneTimePurchase()); + } + + _taskId = Plugin.GetScheduler().scheduleSyncRepeatingTask(Plugin.GetPlugin(), this, 2L, 2L); + } + + private void ShowResultsPage(TransactionResponse response) + { + _processing = false; + + switch (response) + { + case Failed: + BuildErrorPage(ChatColor.RED + "There was an error processing your request."); + Shop.AddPlayerProcessError(Player); + break; + case AlreadyOwns: + BuildErrorPage(ChatColor.RED + "You already own this package."); + Shop.AddPlayerProcessError(Player); + break; + case InsufficientFunds: + BuildErrorPage(ChatColor.RED + "Your account has insufficient funds."); + Shop.AddPlayerProcessError(Player); + break; + case Success: + _salesItem.Sold(Player, SelectedCurrency); + + BuildSuccessPage("Your purchase was successful."); + + if (_runnable != null) + _runnable.run(); + + break; + default: + break; + } + + _progressCount = 0; + } + + private void BuildErrorPage(String...message) + { + IButton returnButton = new IButton() + { + @Override + public void Clicked(Player player) + { + CancelClicked(player); + } + }; + + ShopItem item = new ShopItem(Material.REDSTONE_BLOCK, (byte)0, ChatColor.RED + "" + ChatColor.UNDERLINE + "ERROR", message, 1, false, true); + for (int i = 0; i < this.getSize(); i++) + { + AddButton(i, item, returnButton); + } + + Player.playSound(Player.getLocation(), Sound.BLAZE_DEATH, 1, .1f); + } + + private void BuildSuccessPage(String message) + { + IButton returnButton = new IButton() + { + @Override + public void Clicked(Player player) + { + CancelClicked(player); + } + }; + + ShopItem item = new ShopItem(Material.EMERALD_BLOCK, (byte)0, ChatColor.GREEN + message, null, 1, false, true); + for (int i = 0; i < this.getSize(); i++) + { + AddButton(i, item, returnButton); + } + + Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1, .9f); + } + + @Override + public void PlayerClosed() + { + super.PlayerClosed(); + + Plugin.GetScheduler().cancelTask(_taskId); + + if (_returnPage != null) + Shop.SetCurrentPageForPlayer(Player, _returnPage); + } + + @Override + public void run() + { + if (_processing) + { + if (_progressCount == 9) + { + for (int i=45; i < 54; i++) + { + clear(i); + } + + _progressCount = 0; + } + + setItem(45 + _progressCount, _progressItem); + } + else + { + if (_progressCount >= 20) + { + if (_returnPage != null) + Shop.OpenPageForPlayer(Player, _returnPage); + else + { + Player.closeInventory(); + } + + Plugin.GetScheduler().cancelTask(_taskId); + } + } + + _progressCount++; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java new file mode 100644 index 000000000..c41b53200 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java @@ -0,0 +1,149 @@ +package mineplex.core.shop.page; + +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftInventoryCustom; +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.CurrencyType; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.ShopBase; +import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ShopItem; + +public abstract class ShopPageBase> extends CraftInventoryCustom implements Listener +{ + protected PluginType Plugin; + protected CoreClientManager ClientManager; + protected DonationManager DonationManager; + protected ShopType Shop; + protected Player Player; + protected CoreClient Client; + protected CurrencyType SelectedCurrency; + protected NautHashMap ButtonMap; + protected boolean ShowCurrency = false; + + protected int CurrencySlot = 4; + + public ShopPageBase(PluginType plugin, ShopType shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + this(plugin, shop, clientManager, donationManager, name, player, 54); + } + + public ShopPageBase(PluginType plugin, ShopType shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, int slots) + { + super(null, slots, name); + + Plugin = plugin; + ClientManager = clientManager; + DonationManager = donationManager; + Shop = shop; + Player = player; + ButtonMap = new NautHashMap(); + + Client = ClientManager.Get(player); + + if (shop.GetAvailableCurrencyTypes().size() > 0) + { + SelectedCurrency = shop.GetAvailableCurrencyTypes().get(0); + } + } + + protected void ChangeCurrency(Player player) + { + PlayAcceptSound(player); + + int currentIndex = Shop.GetAvailableCurrencyTypes().indexOf(SelectedCurrency); + + if (currentIndex + 1 < Shop.GetAvailableCurrencyTypes().size()) + { + SelectedCurrency = Shop.GetAvailableCurrencyTypes().get(currentIndex + 1); + } + else + { + SelectedCurrency = Shop.GetAvailableCurrencyTypes().get(0); + } + } + + protected abstract void BuildPage(); + + protected void AddItem(int slot, ShopItem item) + { + if (slot > inventory.getSize() - 1) + { + // Magic slot conversion + int playerSlot = slot >= (inventory.getSize() + 27) ? slot - (inventory.getSize() + 27) : slot - (inventory.getSize() - 9); + Player.getInventory().setItem(playerSlot, item); + } + else + { + getInventory().setItem(slot, item.getHandle()); + } + } + + protected void AddButton(int slot, ShopItem item, IButton button) + { + AddItem(slot, item); + + ButtonMap.put(slot, button); + } + + protected void RemoveButton(int slot) + { + getInventory().setItem(slot, null); + ButtonMap.remove(slot); + } + + public void PlayerClicked(InventoryClickEvent event) + { + if (ButtonMap.containsKey(event.getRawSlot())) + { + ButtonMap.get(event.getRawSlot()).Clicked(Player); + } + else if (event.getRawSlot() != -999) + { + if (event.getInventory() == inventory && (inventory.getSize() <= event.getSlot() || inventory.getItem(event.getSlot()) != null)) + { + PlayDenySound(Player); + } + else if (event.getInventory() == Player.getInventory() && Player.getInventory().getItem(event.getSlot()) != null) + { + PlayDenySound(Player); + } + } + } + + public void PlayerOpened() + { + + } + + public void PlayerClosed() + { + this.inventory.onClose((CraftPlayer)Player); + } + + public void PlayAcceptSound(Player player) + { + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, .6f); + } + + public void PlayDenySound(Player player) + { + player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f); + } + + public void Dispose() + { + Player = null; + Client = null; + Shop = null; + Plugin = null; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/spawn/Spawn.java b/Plugins/Mineplex.Core/src/mineplex/core/spawn/Spawn.java new file mode 100644 index 000000000..491c982d9 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/spawn/Spawn.java @@ -0,0 +1,221 @@ +package mineplex.core.spawn; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.spawn.command.SpawnCommand; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class Spawn extends MiniPlugin +{ + public ArrayList spawnList; + + public Spawn(JavaPlugin plugin) + { + super("Spawn", plugin); + + ReadSpawns(); + } + + @Override + public void AddCommands() + { + AddCommand(new SpawnCommand(this)); + } + + public Location getSpawn() + { + if (spawnList.isEmpty()) + return UtilServer.getServer().getWorld("world").getSpawnLocation(); + + return spawnList.get(UtilMath.r(spawnList.size())); + } + + public void AddSpawn(Player player) + { + //Set Spawn Point + Location loc = player.getLocation(); + + //Set World Spawn + player.getWorld().setSpawnLocation((int)loc.getX(), (int)loc.getY(), (int)loc.getZ()); + + //Add Spawn + spawnList.add(loc); + + //Save + WriteSpawns(); + + //Inform + UtilPlayer.message(player, F.main(_moduleName, "You added a Spawn Node.")); + + //Log + Log("Added Spawn [" + UtilWorld.locToStr(loc) + "] by [" + player.getName() + "]."); + } + + public void ClearSpawn(Player player) + { + //Add Spawn + spawnList.clear(); + + //Save + WriteSpawns(); + + //Inform + UtilPlayer.message(player, F.main(_moduleName, "You cleared all Spawn Nodes.")); + + //Log + Log("Cleared Spawn [ALL] by [" + player.getName() + "]."); + } + + @EventHandler + public void handleRespawn(PlayerRespawnEvent event) + { + event.setRespawnLocation(getSpawn()); + } + + private void ReadSpawns() + { + spawnList = new ArrayList(); + + FileInputStream fstream = null; + DataInputStream in = null; + BufferedReader br = null; + + if (!new File("data/spawns.dat").exists()) + return; + + try + { + fstream = new FileInputStream("data/spawns.dat"); + in = new DataInputStream(fstream); + br = new BufferedReader(new InputStreamReader(in)); + String strLine = br.readLine(); + + while (strLine != null) + { + System.out.println(strLine); + try + { + Location spawn = UtilWorld.strToLoc(strLine); + spawnList.add(spawn); + } + catch (Exception e) + { + + } + + strLine = br.readLine(); + } + } + catch (Exception e) + { + System.err.println("Spawn Read Error: " + e.getMessage()); + e.printStackTrace(); + } + finally + { + if (br != null) + { + try + { + br.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (in != null) + { + try + { + in.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + private void WriteSpawns() + { + FileWriter fstream = null; + BufferedWriter out = null; + + try + { + fstream = new FileWriter("data/spawns.dat"); + out = new BufferedWriter(fstream); + + for (Location loc : spawnList) + { + out.write(UtilWorld.locToStr(loc) + "\n"); + } + + out.close(); + } + catch (Exception e) + { + System.err.println("Spawn Write Error: " + e.getMessage()); + } + finally + { + if (out != null) + { + try + { + out.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/spawn/command/AddCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/spawn/command/AddCommand.java new file mode 100644 index 000000000..22f17ba3c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/spawn/command/AddCommand.java @@ -0,0 +1,21 @@ +package mineplex.core.spawn.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.spawn.Spawn; + +public class AddCommand extends CommandBase +{ + public AddCommand(Spawn plugin) + { + super(plugin, Rank.ADMIN, "add", "a"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.AddSpawn(caller); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/spawn/command/ClearCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/spawn/command/ClearCommand.java new file mode 100644 index 000000000..f7438dc89 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/spawn/command/ClearCommand.java @@ -0,0 +1,21 @@ +package mineplex.core.spawn.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.spawn.Spawn; + +public class ClearCommand extends CommandBase +{ + public ClearCommand(Spawn plugin) + { + super(plugin, Rank.ADMIN, "clear"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.ClearSpawn(caller); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/spawn/command/SpawnCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/spawn/command/SpawnCommand.java new file mode 100644 index 000000000..25d3575a1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/spawn/command/SpawnCommand.java @@ -0,0 +1,25 @@ +package mineplex.core.spawn.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.spawn.Spawn; + +public class SpawnCommand extends CommandBase +{ + public SpawnCommand(Spawn plugin) + { + super(plugin, Rank.ADMIN, "spawn"); + } + + @Override + public void Execute(Player caller, String[] args) + { + UtilPlayer.message(caller, F.main("Spawn", "Commands List:")); + UtilPlayer.message(caller, F.help("/spawn add", "Add Location as Spawn", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/spawn clear", "Remove All Spawns", Rank.ADMIN)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java b/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java new file mode 100644 index 000000000..8083547af --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java @@ -0,0 +1,220 @@ +package mineplex.core.teleport; + +import java.util.LinkedList; + +import mineplex.core.MiniPlugin; +import mineplex.core.spawn.Spawn; +import mineplex.core.teleport.command.TeleportCommand; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.account.CoreClientManager; +import mineplex.core.account.event.ClientUnloadEvent; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class Teleport extends MiniPlugin +{ + private CoreClientManager _clientManager; + private Spawn _spawn; + + private LinkedList teleportList = new LinkedList(); + private NautHashMap> _tpHistory = new NautHashMap>(); + + public Teleport(JavaPlugin plugin, CoreClientManager clientManager, Spawn spawn) + { + super("Teleport", plugin); + + _spawn = spawn; + } + + @Override + public void AddCommands() + { + AddCommand(new TeleportCommand(this)); + } + + @EventHandler + public void UnloadHistory(ClientUnloadEvent event) + { + _tpHistory.remove(event.GetName()); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (teleportList.isEmpty()) + return; + + teleportList.removeFirst().doTeleport(); + } + + public void playerToPlayer(Player caller, String from, String to) + { + LinkedList listA = new LinkedList(); + + //ALL + if (from.equals("%ALL%") && _clientManager.Get(caller).GetRank().Has(caller, Rank.OWNER, false)) + for (Player cur : UtilServer.getPlayers()) + listA.add(cur); + //Normal + else + listA = UtilPlayer.matchOnline(caller, from, true); + + //To + Player pB = UtilPlayer.searchOnline(caller, to, true); + + if (listA.isEmpty() || pB == null) + return; + + if (listA.size() == 1) + { + Player pA = listA.getFirst(); + + String mA = null; + String mB = null; + + //Inform + if (pA.equals(caller)) + { + mA = F.main("Teleport", "You teleported to " + F.elem(pB.getName()) + "."); + } + else if (pB.equals(caller)) + { + mA = F.main("Teleport", F.elem(caller.getName()) + " teleported you to themself."); + mB = F.main("Teleport", "You teleported " + F.elem(pA.getName()) + " to yourself."); + } + else + { + mA = F.main("Teleport", F.elem(caller.getName()) + " teleported you to " + F.elem(pB.getName()) + "."); + mB = F.main("Teleport", "You teleported " + F.elem(pA.getName()) + " to " + F.elem(pB.getName()) + "."); + } + + //Register + Add(pA, pB.getLocation(), mA, true, caller, mB, + pA.getName() + " teleported to " + pB.getName() + " via " + caller.getName()); + return; + } + + boolean first = true; + for (Player pA : listA) + { + String mA = null; + String mB = null; + + //Inform + if (pA.equals(caller)) + { + mA = F.main("Teleport", "You teleported to " + F.elem(pB.getName()) + "."); + } + else if (pB.equals(caller)) + { + mA = F.main("Teleport", F.elem(caller.getName()) + " teleported you to themself."); + mB = F.main("Teleport", "You teleported " + F.elem(listA.size() + " Players") + " to yourself."); + } + else + { + mA = F.main("Teleport", F.elem(caller.getName()) + " teleported you to " + F.elem(pB.getName()) + "."); + mB = F.main("Teleport", "You teleported " + F.elem(listA.size() + " Players") + " to " + F.elem(pB.getName()) + "."); + } + + //Register + if (first) + Add(pA, pB.getLocation(), mA, true, caller, mB, pA.getName() + " teleported to " + pB.getName() + " via " + caller.getName()); + + else + Add(pA, pB.getLocation(), mA, true, caller, null, pA.getName() + " teleported to " + pB.getName() + " via " + caller.getName()); + + first = false; + } + } + + public void playerToLoc(Player caller, String target, String sX, String sY, String sZ) + { + playerToLoc(caller, target, caller.getWorld().getName(), sX, sY, sZ); + } + + public void playerToLoc(Player caller, String target, String world, String sX, String sY, String sZ) + { + Player player = UtilPlayer.searchOnline(caller, target, true); + + if (player == null) + return; + + try + { + int x = Integer.parseInt(sX); + int y = Integer.parseInt(sY); + int z = Integer.parseInt(sZ); + + Location loc = new Location(Bukkit.getWorld(world),x,y,z); + + //Inform + String mA = null; + if (caller == player) mA = F.main("Teleport", "You teleported to " + UtilWorld.locToStrClean(loc) + "."); + else mA = F.main("Teleport", F.elem(caller.getName()) + " teleported you to " + UtilWorld.locToStrClean(loc) + "."); + + //Register + Add(player, loc, mA, true, caller, null, player.getName() + " teleported to " + UtilWorld.locToStrClean(loc) + " via " + caller.getName()); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main("Teleport", "Invalid Location [" + sX + "," + sY + "," + sZ + "].")); + return; + } + } + + public void playerToSpawn(Player caller, String target) + { + Player player = UtilPlayer.searchOnline(caller, target, true); + + if (player == null) + return; + + String mA = F.main("Teleport", F.elem(caller.getName()) + " teleported you to " + F.elem("Spawn") + "."); + String mB = F.main("Teleport", "You teleported " + F.count(player.getName()) + " to " + F.elem("Spawn") + "."); + Add(player, _spawn.getSpawn(), mA, true, caller, mB, player.getName() + " teleported to Spawn via " + caller.getName() + "."); + } + + public void Add(Player pA, Location loc, String mA, boolean record, Player pB, String mB, String log) + { + teleportList.addLast(new Teleporter(this, pA, pB, mA, mB, loc, record, log)); + } + + public void TP(Player player, Location getLocation) + { + TP(player, getLocation, true); + } + + public void TP(Player player, Location getLocation, boolean dettach) + { + if (dettach) + { + player.eject(); + player.leaveVehicle(); + } + + player.setFallDistance(0); + player.setVelocity(new Vector(0,0,0)); + + player.teleport(getLocation); + } + + public LinkedList GetTPHistory(Player player) + { + return _tpHistory.get(player.getName()); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleporter.java b/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleporter.java new file mode 100644 index 000000000..03728e2d3 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleporter.java @@ -0,0 +1,62 @@ +package mineplex.core.teleport; + +import mineplex.core.common.util.UtilPlayer; + +import org.bukkit.Location; +import org.bukkit.entity.Player; + +public class Teleporter +{ + private Player _pA; + private Location _loc; + private String _mA; + + private Player _pB; + private String _mB; + + private Teleport _tp; + + public Teleporter(Teleport teleport, Player pA, Player pB, String mA, String mB, Location loc, boolean record, String log) + { + this._tp = teleport; + this._pA = pA; + this._pB = pB; + this._mA = mA; + this._mB = mB; + this._loc = loc; + } + + public void doTeleport() + { + if (_loc == null) + return; + + //Different Worlds + /* + if (!_pA.getWorld().getName().equals(_loc.getWorld().getName())) + { + if (_pB == null) + return; + + _tp.UtilPlayer.message(_pB, F.main("Teleport", F.elem(_pA.getName()) + " is not in teleport destinations world.")); + return; + } + */ + + //Player A + if (_pA != null) + { + + //Teleport + _tp.TP(_pA, _loc); + + //Inform + if (_mA != null) + UtilPlayer.message(_pA, _mA); + } + + //Player B + if (_pB != null && _mB != null) + UtilPlayer.message(_pB, _mB); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/AllCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/AllCommand.java new file mode 100644 index 000000000..80c37e1e3 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/AllCommand.java @@ -0,0 +1,21 @@ +package mineplex.core.teleport.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.teleport.Teleport; + +public class AllCommand extends CommandBase +{ + public AllCommand(Teleport plugin) + { + super(plugin, Rank.OWNER, "all"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.playerToPlayer(caller, "%ALL%", caller.getName()); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/BackCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/BackCommand.java new file mode 100644 index 000000000..4b198fb39 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/BackCommand.java @@ -0,0 +1,70 @@ +package mineplex.core.teleport.command; + +import org.bukkit.Location; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.teleport.Teleport; + +public class BackCommand extends CommandBase +{ + public BackCommand(Teleport plugin) + { + super(plugin, Rank.MODERATOR, "back", "b"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 0) + Back(caller, caller.getName(), "1"); + else if (args.length == 1) + Back(caller, args[0], "1"); + else + Back(caller, args[0], args[1]); + } + + private void Back(Player caller, String target, String amountString) + { + int amount = 1; + try + { + amount = Integer.parseInt(amountString); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main("Teleport", "Invalid Amount [" + amountString + "]. Defaulting to [1].")); + } + + + Player player = UtilPlayer.searchOnline(caller, target, true); + + if (player == null) + return; + + Location loc = null; + int back = 0; + for (int i = 0 ; i < amount ; i++) + { + if (Plugin.GetTPHistory(player).isEmpty()) + break; + + loc = Plugin.GetTPHistory(player).removeFirst(); + back++; + } + + if (loc == null) + { + UtilPlayer.message(caller, F.main("Teleport", player.getName() + " has no teleport history.")); + return; + } + + //Register + String mA = F.main("Teleport", F.elem(caller.getName()) + " undid your last " + F.count(""+back) + " teleport(s)."); + String mB = F.main("Teleport", "You undid the last " + F.count(""+back) + " teleport(s) for " + F.elem(player.getName()) + "."); + Plugin.Add(player, loc, mA, false, caller, mB, "Undid last " + back + " teleports for " + player.getName() + " via " + caller.getName()); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/HereCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/HereCommand.java new file mode 100644 index 000000000..e2b40d74a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/HereCommand.java @@ -0,0 +1,24 @@ +package mineplex.core.teleport.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.teleport.Teleport; + +public class HereCommand extends CommandBase +{ + public HereCommand(Teleport plugin) + { + super(plugin, Rank.MODERATOR, "here", "h"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 1) + Plugin.playerToPlayer(caller, args[0], caller.getName()); + else if (args.length == 2) + Plugin.playerToPlayer(caller, args[0], args[1]); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/SpawnCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/SpawnCommand.java new file mode 100644 index 000000000..ff046f1d2 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/SpawnCommand.java @@ -0,0 +1,24 @@ +package mineplex.core.teleport.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.teleport.Teleport; + +public class SpawnCommand extends CommandBase +{ + public SpawnCommand(Teleport plugin) + { + super(plugin, Rank.ADMIN, "spawn", "s"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 0) + Plugin.playerToSpawn(caller, caller.getName()); + else + Plugin.playerToSpawn(caller, args[0]); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/TeleportCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/TeleportCommand.java new file mode 100644 index 000000000..67610ee59 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/TeleportCommand.java @@ -0,0 +1,52 @@ +package mineplex.core.teleport.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.MultiCommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.teleport.Teleport; + +public class TeleportCommand extends MultiCommandBase +{ + public TeleportCommand(Teleport plugin) + { + super(plugin, Rank.MODERATOR, "tp", "teleport"); + } + + @Override + protected void Help(Player caller, String[] args) + { + //Caller to Player + if (args.length == 1 && CommandCenter.GetClientManager().Get(caller).GetRank().Has(caller, Rank.MODERATOR, true)) + Plugin.playerToPlayer(caller, caller.getName(), args[0]); + + //Player to Player + else if (args.length == 2 && CommandCenter.GetClientManager().Get(caller).GetRank().Has(caller, Rank.ADMIN, true)) + Plugin.playerToPlayer(caller, args[0], args[1]); + + //Caller to Loc + else if (args.length == 3 && CommandCenter.GetClientManager().Get(caller).GetRank().Has(caller, Rank.ADMIN, true)) + Plugin.playerToLoc(caller, caller.getName(), args[0], args[1], args[2]); + + //Player to world + else if (args.length == 5) + Plugin.playerToLoc(caller, args[0], args[1], args[2], args[3], args[4]); + + //Player to Loc + else if (args.length == 4 && CommandCenter.GetClientManager().Get(caller).GetRank().Has(caller, Rank.ADMIN, true)) + Plugin.playerToLoc(caller, args[0], args[1], args[2], args[3]); + else + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Commands List:")); + UtilPlayer.message(caller, F.help("/tp ", "Teleport to Player", Rank.MODERATOR)); + UtilPlayer.message(caller, F.help("/tp b(ack) (amount) (player)", "Undo Teleports", Rank.MODERATOR)); + UtilPlayer.message(caller, F.help("/tp here ", "Teleport Player to Self", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/tp ", "Teleport Player to Player", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/tp ", "Teleport to Location", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/tp spawn", "Teleport to Spawn", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/tp all", "Teleport All to Self", Rank.OWNER)); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/updater/UpdateType.java b/Plugins/Mineplex.Core/src/mineplex/core/updater/UpdateType.java new file mode 100644 index 000000000..6e7e1f098 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/updater/UpdateType.java @@ -0,0 +1,42 @@ +package mineplex.core.updater; + +import mineplex.core.common.util.UtilTime; + +public enum UpdateType +{ + MIN_64(3840000), + MIN_32(1920000), + MIN_16(960000), + MIN_08(480000), + MIN_04(240000), + MIN_02(120000), + MIN_01(60000), + SLOWEST(32000), + SLOWER(16000), + SLOW(4000), + SEC(1000), + FAST(500), + FASTER(250), + FASTEST(125), + TICK(49); + + private long _time; + private long _last; + + UpdateType(long time) + { + _time = time; + _last = System.currentTimeMillis(); + } + + public boolean Elapsed() + { + if (UtilTime.elapsed(_last, _time)) + { + _last = System.currentTimeMillis(); + return true; + } + + return false; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/updater/Updater.java b/Plugins/Mineplex.Core/src/mineplex/core/updater/Updater.java new file mode 100644 index 000000000..1fc6b1133 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/updater/Updater.java @@ -0,0 +1,28 @@ +package mineplex.core.updater; + +import mineplex.core.updater.event.UpdateEvent; + +import org.bukkit.plugin.java.JavaPlugin; + +public class Updater implements Runnable +{ + private JavaPlugin _plugin; + + public Updater(JavaPlugin plugin) + { + _plugin = plugin; + _plugin.getServer().getScheduler().scheduleSyncRepeatingTask(_plugin, this, 0L, 1L); + } + + @Override + public void run() + { + for (UpdateType updateType : UpdateType.values()) + { + if (updateType.Elapsed()) + { + _plugin.getServer().getPluginManager().callEvent(new UpdateEvent(updateType)); + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/updater/event/UpdateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/updater/event/UpdateEvent.java new file mode 100644 index 000000000..59400f196 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/updater/event/UpdateEvent.java @@ -0,0 +1,32 @@ +package mineplex.core.updater.event; + +import mineplex.core.updater.UpdateType; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class UpdateEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private UpdateType _type; + + public UpdateEvent(UpdateType example) + { + _type = example; + } + + public UpdateType getType() + { + return _type; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/.classpath b/Plugins/Mineplex.Hub/.classpath new file mode 100644 index 000000000..3028e8700 --- /dev/null +++ b/Plugins/Mineplex.Hub/.classpath @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/Plugins/Mineplex.Hub/.externalToolBuilders/Hub Builder.launch b/Plugins/Mineplex.Hub/.externalToolBuilders/Hub Builder.launch new file mode 100644 index 000000000..3ccc01405 --- /dev/null +++ b/Plugins/Mineplex.Hub/.externalToolBuilders/Hub Builder.launch @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/Plugins/Mineplex.Hub/.project b/Plugins/Mineplex.Hub/.project new file mode 100644 index 000000000..3230745dd --- /dev/null +++ b/Plugins/Mineplex.Hub/.project @@ -0,0 +1,26 @@ + + + Mineplex.Hub + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + + + LaunchConfigHandle + <project>/.externalToolBuilders/Hub Builder.launch + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Mineplex.Hub/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.Hub/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7341ab168 --- /dev/null +++ b/Plugins/Mineplex.Hub/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/Hub.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/Hub.class new file mode 100644 index 000000000..15ccd5338 Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/Hub.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/HubClient.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/HubClient.class new file mode 100644 index 000000000..1ea19d92a Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/HubClient.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/HubManager.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/HubManager.class new file mode 100644 index 000000000..e75526502 Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/HubManager.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/Stacker$1.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/Stacker$1.class new file mode 100644 index 000000000..2cfb2763c Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/Stacker$1.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/Stacker.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/Stacker.class new file mode 100644 index 000000000..a9094c5e1 Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/Stacker.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/TextCreator.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/TextCreator.class new file mode 100644 index 000000000..52d277549 Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/TextCreator.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ServerInfo.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ServerInfo.class new file mode 100644 index 000000000..f5ffe2984 Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ServerInfo.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ServerManager.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ServerManager.class new file mode 100644 index 000000000..a8d95b12e Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ServerManager.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ServerSorter.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ServerSorter.class new file mode 100644 index 000000000..795cf8d38 Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ServerSorter.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/AddServerCommand.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/AddServerCommand.class new file mode 100644 index 000000000..a2de6bb89 Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/AddServerCommand.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/CreateCommand.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/CreateCommand.class new file mode 100644 index 000000000..17bc490cc Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/CreateCommand.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/DeleteCommand.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/DeleteCommand.class new file mode 100644 index 000000000..e1875c558 Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/DeleteCommand.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/ListNpcsCommand.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/ListNpcsCommand.class new file mode 100644 index 000000000..e1cc5bc8f Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/ListNpcsCommand.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/ListOfflineCommand.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/ListOfflineCommand.class new file mode 100644 index 000000000..615bb463a Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/ListOfflineCommand.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/ListServersCommand.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/ListServersCommand.class new file mode 100644 index 000000000..c1e806359 Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/ListServersCommand.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/RemoveServerCommand.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/RemoveServerCommand.class new file mode 100644 index 000000000..478ad3c81 Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/RemoveServerCommand.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/ServerNpcCommand.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/ServerNpcCommand.class new file mode 100644 index 000000000..be7788130 Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/command/ServerNpcCommand.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ui/JoinServerButton.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ui/JoinServerButton.class new file mode 100644 index 000000000..381651c73 Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ui/JoinServerButton.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ui/ServerNpcPage.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ui/ServerNpcPage.class new file mode 100644 index 000000000..9c5824c47 Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ui/ServerNpcPage.class differ diff --git a/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ui/ServerNpcShop.class b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ui/ServerNpcShop.class new file mode 100644 index 000000000..11b90be45 Binary files /dev/null and b/Plugins/Mineplex.Hub/bin/mineplex/hub/server/ui/ServerNpcShop.class differ diff --git a/Plugins/Mineplex.Hub/plugin.yml b/Plugins/Mineplex.Hub/plugin.yml new file mode 100644 index 000000000..9f010adb1 --- /dev/null +++ b/Plugins/Mineplex.Hub/plugin.yml @@ -0,0 +1,3 @@ +name: Hub +main: mineplex.hub.Hub +version: 0.1 \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java new file mode 100644 index 000000000..de7cf69c8 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -0,0 +1,98 @@ +package mineplex.hub; + +import me.chiss.Core.MemoryFix.MemoryFix; +import mineplex.core.account.CoreClientManager; +import mineplex.core.command.CommandCenter; +import mineplex.core.creature.Creature; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.enjin.Enjin; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.message.MessageManager; +import mineplex.core.npc.NpcManager; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.pet.PetManager; +import mineplex.core.portal.Portal; +import mineplex.core.punish.Punish; +import mineplex.core.recharge.Recharge; +import mineplex.core.teleport.Teleport; +import mineplex.core.updater.Updater; +import mineplex.hub.server.ServerManager; +import nautilus.minecraft.core.INautilusPlugin; + +import org.bukkit.Server; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; + +public class Hub extends JavaPlugin implements INautilusPlugin +{ + private String WEB_CONFIG = "webServer"; + + @Override + public void onEnable() + { + getConfig().addDefault(WEB_CONFIG, "http://api.mineplex.com/"); + getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); + saveConfig(); + + //Core Modules + CoreClientManager clientManager = CoreClientManager.Initialize(this, GetWebServerAddress()); + DonationManager donationManager = new DonationManager(this, GetWebServerAddress()); + + //Static Modules + CommandCenter.Initialize(this, clientManager); + ItemStackFactory.Initialize(this, false); + Recharge.Initialize(this); + + //Other Modules + Punish punish = new Punish(this, GetWebServerAddress()); + Creature creature = new Creature(this); + new MessageManager(this, clientManager); + new NpcManager(this, creature); + new PetManager(this, clientManager, donationManager, creature, GetWebServerAddress()); + + //Main Modules + new HubManager(this, clientManager, donationManager); + new Stacker(this); + new Enjin(this, clientManager, donationManager, punish); + new ServerManager(this, clientManager, donationManager, new Portal(this)); + new MemoryFix(this); + new DisguiseManager(this, new PacketHandler(this)); + new Teleport(this, new Spawn(this)); + + //Updates + getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); + } + + @Override + public void onDisable() + { + + } + + @Override + public JavaPlugin GetPlugin() + { + return this; + } + + @Override + public String GetWebServerAddress() + { + String webServerAddress = getConfig().getString(WEB_CONFIG); + + return webServerAddress; + } + + @Override + public Server GetRealServer() + { + return getServer(); + } + + @Override + public PluginManager GetPluginManager() + { + return GetRealServer().getPluginManager(); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java new file mode 100644 index 000000000..876bdb71f --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java @@ -0,0 +1,134 @@ +package mineplex.hub; + +public class HubClient +{ + public String ScoreboardString = " Hello, I am a big friendly cat!"; + public int ScoreboardIndex = 0; + + public String NewsString = " Bridges v2.0 is coming soon! New gameplay, new kits, new maps!"; + public int NewsIndex = 0; + + public String PurchaseString = " Purchase Ultra Rank at mineplex.com to unlock all game benefits!"; + public int PurchaseIndex = 0; + + public String UltraString = " Thank you for your support!"; + public int UltraIndex = 0; + + public String StaffString = "None"; + public int StaffIndex = 0; + + public String BestPig = "0-Nobody"; + + public int DisplayLength = 16; + + private int _lastGemCount = 0; + + public HubClient(String name) + { + ScoreboardString = " Welcome " + name + ", to the Mineplex Network!"; + } + + public void SetLastGemCount(int gems) + { + _lastGemCount = gems; + } + + public int GetLastGemCount() + { + return _lastGemCount; + } + + public String GetScoreboardText() + { + if (ScoreboardString.length() <= DisplayLength) + return ScoreboardString; + + String display = ScoreboardString.substring(ScoreboardIndex, Math.min(ScoreboardIndex+DisplayLength, ScoreboardString.length())); + + if (display.length() < DisplayLength && ScoreboardString.length() > DisplayLength) + { + int add = DisplayLength - display.length(); + display += ScoreboardString.substring(0, add); + } + + ScoreboardIndex = (ScoreboardIndex + 1) % ScoreboardString.length(); + + return display; + } + + public String GetPurchaseText(boolean increment) + { + if (PurchaseString.length() <= DisplayLength) + return PurchaseString; + + if (increment) + PurchaseIndex = (PurchaseIndex + 1) % PurchaseString.length(); + + String display = PurchaseString.substring(PurchaseIndex, Math.min(PurchaseIndex+DisplayLength, PurchaseString.length())); + + if (display.length() < DisplayLength && PurchaseString.length() > DisplayLength) + { + int add = DisplayLength - display.length(); + display += PurchaseString.substring(0, add); + } + + return display; + } + + public String GetUltraText(boolean increment) + { + if (UltraString.length() <= DisplayLength) + return UltraString; + + if (increment) + UltraIndex = (UltraIndex + 1) % UltraString.length(); + + String display = UltraString.substring(UltraIndex, Math.min(UltraIndex+DisplayLength, UltraString.length())); + + if (display.length() < DisplayLength) + { + int add = DisplayLength - display.length(); + display += UltraString.substring(0, add); + } + + return display; + } + + public String GetStaffText(boolean increment) + { + if (StaffString.length() <= DisplayLength) + return StaffString; + + if (increment) + StaffIndex = (StaffIndex + 1) % StaffString.length(); + + String display = StaffString.substring(StaffIndex, Math.min(StaffIndex+DisplayLength, StaffString.length())); + + if (display.length() < DisplayLength && StaffString.length() > DisplayLength) + { + int add = DisplayLength - display.length(); + display += StaffString.substring(0, add); + } + + return display; + } + + public String GetNewsText(boolean increment) + { + if (NewsString.length() <= DisplayLength) + return NewsString; + + if (increment) + NewsIndex = (NewsIndex + 1) % NewsString.length(); + + String display = NewsString.substring(NewsIndex, Math.min(NewsIndex+DisplayLength, NewsString.length())); + + if (display.length() < DisplayLength && NewsString.length() > DisplayLength) + { + int add = DisplayLength - display.length(); + display += NewsString.substring(0, add); + } + + return display; + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java new file mode 100644 index 000000000..2d1fe8da5 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -0,0 +1,417 @@ +package mineplex.hub; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Effect; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scoreboard.DisplaySlot; +import org.bukkit.scoreboard.Objective; +import org.bukkit.scoreboard.Scoreboard; + +import mineplex.core.MiniClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.donation.DonationManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class HubManager extends MiniClientPlugin +{ + private CoreClientManager _clientManager; + private DonationManager _donationManager; + + private Location _spawn; + private int _scoreboardTick = 0; + + private String _pigStacker = "0 - Nobody"; + + public HubManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager) + { + super("Hub Manager", plugin); + + _clientManager = clientManager; + _donationManager = donationManager; + + _spawn = new Location(UtilWorld.getWorld("world"), 0, 74, 0); + + new TextCreator(this); + } + + @EventHandler + public void PlayerRespawn(PlayerRespawnEvent event) + { + event.setRespawnLocation(GetRandomSpawn()); + } + + @EventHandler(priority = EventPriority.LOW) + public void PlayerJoin(PlayerJoinEvent event) + { + final Player player = event.getPlayer(); + + //Survival + player.setGameMode(GameMode.SURVIVAL); + + //Public Message + event.setJoinMessage(null); + + //Teleport + player.teleport(GetRandomSpawn()); + + //Allow Double Jump + player.setAllowFlight(true); + + UtilInv.Clear(player); + + //Scoreboard + Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard(); + player.setScoreboard(board); + + //Objective + Objective obj = board.registerNewObjective(C.Bold + "Player Data", "dummy"); + obj.setDisplaySlot(DisplaySlot.SIDEBAR); + + for (Rank rank : Rank.values()) + { + if (rank != Rank.ALL) + board.registerNewTeam(rank.Name).setPrefix(rank.Color + C.Bold + rank.Name + ChatColor.RESET + " "); + else + board.registerNewTeam(rank.Name).setPrefix(""); + } + + for (Player otherPlayer : Bukkit.getOnlinePlayers()) + { + //Add Other to Self + board.getTeam(_clientManager.Get(otherPlayer).GetRank().Name).addPlayer(otherPlayer); + + //Add Self to Other + otherPlayer.getScoreboard().getTeam(_clientManager.Get(player).GetRank().Name).addPlayer(player); + } + } + + @EventHandler + public void PlayerQuit(PlayerQuitEvent event) + { + event.setQuitMessage(null); + + event.getPlayer().leaveVehicle(); + event.getPlayer().eject(); + + for (Player player : UtilServer.getPlayers()) + player.getScoreboard().resetScores(event.getPlayer()); + } + + @EventHandler + public void PlayerChat(AsyncPlayerChatEvent event) + { + if (event.isCancelled()) + return; + + event.setCancelled(true); + + Player player = event.getPlayer(); + + Rank rank = GetClients().Get(player).GetRank(); + + String rankStr = ""; + if (rank != Rank.ALL) + rankStr = rank.Color + C.Bold + GetClients().Get(player).GetRank().Name.toUpperCase() + " "; + + for (Player other : UtilServer.getPlayers()) + { + UtilPlayer.message(other, rankStr + C.cYellow + player.getName() + " " + C.cWhite + event.getMessage()); + } + } + + @EventHandler + public void Damage(EntityDamageEvent event) + { + if (event.getEntity() instanceof Player && event.getCause() == DamageCause.VOID) + event.getEntity().teleport(GetRandomSpawn()); + + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOW) + public void ItemPickup(PlayerPickupItemEvent event) + { + if (event.getPlayer().getGameMode() == GameMode.CREATIVE) + return; + + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOW) + public void ItemDrop(PlayerDropItemEvent event) + { + if (event.getPlayer().getGameMode() == GameMode.CREATIVE) + return; + + event.setCancelled(true); + } + + @EventHandler + public void BlockBreak(BlockBreakEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void LeaveDecay(LeavesDecayEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void BlockPlace(BlockPlaceEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void FlightHop(PlayerToggleFlightEvent event) + { + Player player = event.getPlayer(); + + if (player.getGameMode() == GameMode.CREATIVE) + return; + + event.setCancelled(true); + player.setFlying(false); + + //Disable Flight + player.setAllowFlight(false); + + //Velocity + UtilAction.velocity(player, 1.4, 0.2, 1, true); + + //Sound + player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); + } + + @EventHandler + public void FlightUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (player.getGameMode() == GameMode.CREATIVE) + continue; + + if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + player.setAllowFlight(true); + } + } + + + @EventHandler + public void FoodHealthUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + for (Player player : UtilServer.getPlayers()) + { + player.setHealth(20); + player.setFoodLevel(20); + } + } + + @EventHandler + public void UpdateWeather(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + World world = UtilWorld.getWorld("world"); + world.setTime(6000); + world.setStorm(false); + } + + @EventHandler + public void UpdateScoreboard(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + _scoreboardTick = (_scoreboardTick + 1)%3; + + if (_scoreboardTick != 0) + return; + + int bestPig = 0; + for (Player player : UtilServer.getPlayers()) + { + if (player.getVehicle() != null) + continue; + + int count = 0; + + Entity ent = player; + while (ent.getPassenger() != null) + { + ent = ent.getPassenger(); + count++; + } + + if (count > bestPig) + { + _pigStacker = player.getName(); + bestPig = count; + } + } + if (bestPig == 0) + { + _pigStacker = "0 - Nobody"; + } + else + { + _pigStacker = bestPig + " - " + _pigStacker; + + if (_pigStacker.length() > 16) + _pigStacker = _pigStacker.substring(0, 16); + } + + for (Player player : UtilServer.getPlayers()) + { + //Objective + Objective obj = player.getScoreboard().getObjective(DisplaySlot.SIDEBAR); + + //Title + obj.setDisplayName(C.cWhite + C.Bold + Get(player).GetScoreboardText()); + + int line = 15; + + obj.getScore(Bukkit.getOfflinePlayer(C.cGreen + C.Bold + "Gems")).setScore(line--); + + // Remove Old + player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player.getName()).GetLastGemCount() + "")); + // Add New + obj.getScore(Bukkit.getOfflinePlayer(GetDonation().Get(player.getName()).GetGems() + "")).setScore(line--); + + Get(player.getName()).SetLastGemCount(GetDonation().Get(player.getName()).GetGems()); + + //Space + obj.getScore(Bukkit.getOfflinePlayer(" ")).setScore(line--); + + /* + //News + obj.getScore(Bukkit.getOfflinePlayer(C.cGray + C.Bold + "Latest News")).setScore(line--); + player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player).GetNewsText(false))); + obj.getScore(Bukkit.getOfflinePlayer(Get(player).GetNewsText(true))).setScore(line--); + */ + + //Stacker + obj.getScore(Bukkit.getOfflinePlayer(C.cGray + C.Bold + "Pig Stacker")).setScore(line--); + player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player).BestPig)); + Get(player).BestPig = _pigStacker; + obj.getScore(Bukkit.getOfflinePlayer(Get(player).BestPig)).setScore(line--); + + //Space + obj.getScore(Bukkit.getOfflinePlayer(" ")).setScore(line--); + + //Display Rank + if (GetClients().Get(player).GetRank().Has(Rank.ULTRA)) + { + obj.getScore(Bukkit.getOfflinePlayer(C.cPurple + C.Bold + "Ultra Rank")).setScore(line--); + + player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player).GetUltraText(false))); + obj.getScore(Bukkit.getOfflinePlayer(Get(player).GetUltraText(true))).setScore(line--); + } + else + { + obj.getScore(Bukkit.getOfflinePlayer(C.cRed + C.Bold + "No Rank")).setScore(line--); + + player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player).GetPurchaseText(false))); + obj.getScore(Bukkit.getOfflinePlayer(Get(player).GetPurchaseText(true))).setScore(line--); + } + + //Space + obj.getScore(Bukkit.getOfflinePlayer(" ")).setScore(line--); + + //Display Staff + obj.getScore(Bukkit.getOfflinePlayer(C.cGold + C.Bold + "Online Staff")).setScore(line--); + String staff = ""; + for (Player other : UtilServer.getPlayers()) + { + Rank rank = GetClients().Get(other).GetRank(); + + if (!rank.Has(Rank.HELPER)) + continue; + + staff += other.getName() + " "; + } + if (staff.length() == 0) + staff = "None"; + + player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player).GetStaffText(false))); + Get(player).StaffString = staff; + obj.getScore(Bukkit.getOfflinePlayer(Get(player).GetStaffText(true))).setScore(line--); + + //Space + obj.getScore(Bukkit.getOfflinePlayer(" ")).setScore(line--); + + //Website + obj.getScore(Bukkit.getOfflinePlayer(C.cYellow + C.Bold + "Website")).setScore(line--); + obj.getScore(Bukkit.getOfflinePlayer("www.mineplex.com")).setScore(line--); + obj.getScore(Bukkit.getOfflinePlayer("----------------")).setScore(line--); + + } + } + + @Override + protected HubClient AddPlayer(String player) + { + return new HubClient(player); + } + + public CoreClientManager GetClients() + { + return _clientManager; + } + + public DonationManager GetDonation() + { + return _donationManager; + } + + public Location GetRandomSpawn() + { + return GetSpawn().add(12 - UtilMath.r(24), 0, 12 - UtilMath.r(24)); + } + + public Location GetSpawn() + { + return _spawn.clone(); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Stacker.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Stacker.java new file mode 100644 index 000000000..378feeb68 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Stacker.java @@ -0,0 +1,249 @@ +package mineplex.hub; + +import java.util.HashSet; + +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Pig; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileManager; +import mineplex.core.projectile.ProjectileUser; + +public class Stacker extends MiniPlugin implements IThrown +{ + private ProjectileManager _projectileManager; + + private HashSet _disabled = new HashSet(); + private HashSet _tempStackShift = new HashSet(); + + public Stacker(JavaPlugin plugin) + { + super("Stacker", plugin); + + _projectileManager = new ProjectileManager(plugin); + } + + @EventHandler + public void ToggleInvolvement(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (UtilGear.isMat(player.getItemInHand(), Material.GRILLED_PORK)) + { + _disabled.add(player.getName()); + UtilPlayer.message(player, F.main("Stacker", "You are no longer stackable... boring...")); + + player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.PORK, (byte)0, 1, C.cGreen + "Enable Pig Stacker")); + UtilInv.Update(player); + + event.setCancelled(true); + } + else if (UtilGear.isMat(player.getItemInHand(), Material.PORK)) + { + _disabled.remove(player.getName()); + UtilPlayer.message(player, F.main("Stacker", "You are back in the pig games! Squeeeee!")); + + player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.GRILLED_PORK, (byte)0, 1, C.cRed + "Disable Pig Stacker")); + UtilInv.Update(player); + + event.setCancelled(true); + } + } + + @EventHandler + public void PlayerJoin(PlayerJoinEvent event) + { + event.getPlayer().getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.GRILLED_PORK, (byte)0, 1, C.cRed + "Disable Pig Stacker")); + } + + @EventHandler + public void PlayerQuit(PlayerQuitEvent event) + { + _disabled.remove(event.getPlayer().getName()); + _tempStackShift.remove(event.getPlayer()); + } + + @EventHandler + public void CreatePig(PlayerDropItemEvent event) + { + if (!event.getPlayer().getName().equals("Chiss")) + return; + + if (event.getItemDrop().getItemStack().getTypeId() == 320) + { + event.setCancelled(true); + event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), Pig.class); + } + } + + @EventHandler + public void GrabEntity(PlayerInteractEntityEvent event) + { + if (event.isCancelled()) + return; + + Player stacker = event.getPlayer(); + + if (stacker.getGameMode() != GameMode.SURVIVAL) + return; + + if (_disabled.contains(stacker.getName())) + { + UtilPlayer.message(stacker, F.main("Stacker", "You are not playing stacker.")); + return; + } + + if (stacker.getVehicle() != null || _tempStackShift.contains(stacker)) + { + UtilPlayer.message(stacker, F.main("Stacker", "You cannot stack while stacked...")); + return; + } + + Entity stackee = event.getRightClicked(); + if (stackee == null) + return; + + if (stackee instanceof Player && ((Player)stackee).getGameMode() != GameMode.SURVIVAL) + return; + + if (stackee instanceof Player && _disabled.contains(((Player)stackee).getName())) + { + UtilPlayer.message(stacker, F.main("Stacker", F.name(UtilEnt.getName(stackee)) + " is not playing stacker.")); + return; + } + + if (stackee instanceof LivingEntity) + { + if (((LivingEntity)stackee).isCustomNameVisible()) + { + UtilPlayer.message(stacker, F.main("Stacker", "You cannot stack this entity.")); + return; + } + } + + while (stackee.getVehicle() != null) + stackee = stackee.getVehicle(); + + if (stackee.equals(stacker)) + return; + + Entity top = stacker; + while (top.getPassenger() != null) + top = top.getPassenger(); + + top.setPassenger(stackee); + + UtilPlayer.message(stacker, F.main("Stacker", "You stacked " + F.name(UtilEnt.getName(stackee) + "."))); + UtilPlayer.message(stackee, F.main("Stacker", "You were stacked by " + F.name(stacker.getName() + "."))); + UtilPlayer.message(stackee, F.main("Stacker", "Push " + F.skill("Crouch") + " to escape!")); + + event.setCancelled(true); + } + + @EventHandler + public void ThrowEntity(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.L)) + return; + + Player thrower = event.getPlayer(); + + if (thrower.getVehicle() != null) + return; + + Entity throwee = thrower.getPassenger(); + if (throwee == null) + return; + + thrower.eject(); + + Entity throweeStack = throwee.getPassenger(); + if (throweeStack != null) + { + throwee.eject(); + throweeStack.leaveVehicle(); + + final Entity fThrower = thrower; + final Entity fThroweeStack = throweeStack; + + _tempStackShift.add(throweeStack); + + GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable() + { + public void run() + { + fThrower.setPassenger(fThroweeStack); + _tempStackShift.remove(fThroweeStack); + } + }, 2); + } + + UtilPlayer.message(thrower, F.main("Stacker", "You threw " + F.name(UtilEnt.getName(throwee)))); + UtilPlayer.message(throwee, F.main("Stacker", "You were thrown by " + F.name(thrower.getName()))); + + UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.8, false, 0, 0.3, 2, false); + + _projectileManager.AddThrow(throwee, thrower, this, -1, true, false, true, false, 2.4d); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (target == null) + return; + + //Velocity + UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.GetThrown(), target), 1, true, 0.8, 0, 10, true); + + Entity rider = target.getPassenger(); + while (rider != null) + { + rider.leaveVehicle(); + rider.setVelocity(new Vector(0.25 - Math.random()/2, Math.random()/2, 0.25 - Math.random()/2)); + rider = rider.getPassenger(); + } + + UtilPlayer.message(target, F.main("Stacker", F.name(UtilEnt.getName(data.GetThrower())) + " hit you with " + F.name(UtilEnt.getName(data.GetThrown())))); + + //Effect + data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT, 1f, 1f); + } + + @Override + public void Idle(ProjectileUser data) + { + + } + + @Override + public void Expire(ProjectileUser data) + { + + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/TextCreator.java b/Plugins/Mineplex.Hub/src/mineplex/hub/TextCreator.java new file mode 100644 index 000000000..2ac14179e --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/TextCreator.java @@ -0,0 +1,94 @@ +package mineplex.hub; + +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilText.TextAlign; + +import org.bukkit.Location; +import org.bukkit.block.BlockFace; + +public class TextCreator +{ + public HubManager Manager; + + Location locComp; + Location locArcade; + Location locSurvival; + Location locOther; + + BlockFace faceComp = BlockFace.SOUTH; + BlockFace faceArcade = BlockFace.WEST; + BlockFace faceSurvival = BlockFace.NORTH; + BlockFace faceOther = BlockFace.EAST; + + + public TextCreator(HubManager manager) + { + Manager = manager; + + locComp = manager.GetSpawn().add(40, 10, 0); + locArcade = manager.GetSpawn().add(0, 10, 40); + locSurvival = manager.GetSpawn().add(-40, 10, 0); + locOther = manager.GetSpawn().add(0, 10, -40); + + CreateText(); + } + + public void CreateText() + { + //Comp + UtilText.MakeText("COMPETITIVE", locComp, faceComp, 159, (byte)14, TextAlign.CENTER); + UtilText.MakeText("COMPETITIVE", locComp.clone().add(1, 0, 0), faceComp, 159, (byte)15, TextAlign.CENTER); + + UtilText.MakeText("DOMINATION", locComp.clone().add(16, 14, 0), faceComp, 159, (byte)1, TextAlign.CENTER); + UtilText.MakeText("DOMINATION", locComp.clone().add(16, 14, 0), faceComp, 159, (byte)15, TextAlign.CENTER); + + /* + UtilText.MakeText("DEATHMATCH", locComp.clone().add(16, 21, 0), faceComp, 159, (byte)4, TextAlign.CENTER); + UtilText.MakeText("DEATHMATCH", locComp.clone().add(16, 21, 0), faceComp, 159, (byte)15, TextAlign.CENTER); + + UtilText.MakeText("CAPTURE THE PIG", locComp.clone().add(16, 28, 0), faceComp, 159, (byte)4, TextAlign.CENTER); + UtilText.MakeText("CAPTURE THE PIG", locComp.clone().add(16, 28, 0), faceComp, 159, (byte)15, TextAlign.CENTER); + */ + + //Arcade + UtilText.MakeText("ARCADE", locArcade, faceArcade, 159, (byte)14, TextAlign.CENTER); + UtilText.MakeText("ARCADE", locArcade.clone().add(0, 0, 1), faceArcade, 159, (byte)15, TextAlign.CENTER); + + //Arcade Minigames + UtilText.MakeText("MINIGAMES ", locArcade.clone().add(0, 12, 15), faceArcade, 159, (byte)4, TextAlign.RIGHT); + UtilText.MakeText("MINIGAMES ", locArcade.clone().add(0, 12, 16), faceArcade, 159, (byte)15, TextAlign.RIGHT); + + UtilText.MakeText("super spleef ", locArcade.clone().add(0, 26, 30), faceArcade, 159, (byte)5, TextAlign.RIGHT); + UtilText.MakeText("one in the quiver ", locArcade.clone().add(0, 32, 30), faceArcade, 159, (byte)5, TextAlign.RIGHT); + UtilText.MakeText("dragon ", locArcade.clone().add(0, 38, 30), faceArcade, 159, (byte)5, TextAlign.RIGHT); + //UtilText.MakeText("mineware ", locArcade.clone().add(0, 44, 30), faceArcade, 159, (byte)5, TextAlign.RIGHT); + //UtilText.MakeText("arctic brawl ", locArcade.clone().add(0, 50, 30), faceArcade, 159, (byte)5, TextAlign.RIGHT); + + //Aracde Megagames + UtilText.MakeText(" MEGAGAMES", locArcade.clone().add(0, 12, 15), faceArcade, 159, (byte)4, TextAlign.LEFT); + UtilText.MakeText(" MEGAGAMES", locArcade.clone().add(0, 12, 16), faceArcade, 159, (byte)15, TextAlign.LEFT); + + UtilText.MakeText(" castle siege", locArcade.clone().add(0, 26, 30), faceArcade, 159, (byte)5, TextAlign.LEFT); + UtilText.MakeText(" zombie survival", locArcade.clone().add(0, 32, 30), faceArcade, 159, (byte)5, TextAlign.LEFT); + //UtilText.MakeText(" snow fight", locArcade.clone().add(0, 38, 30), faceArcade, 159, (byte)5, TextAlign.LEFT); + + + //Survival + UtilText.MakeText("SURVIVAL", locSurvival, faceSurvival, 159, (byte)14, TextAlign.CENTER); + UtilText.MakeText("SURVIVAL", locSurvival.clone().add(-1, 0, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER); + + UtilText.MakeText("THE BRIDGES", locSurvival.clone().add(-15, 14, 0), faceSurvival, 159, (byte)4, TextAlign.CENTER); + UtilText.MakeText("THE BRIDGES", locSurvival.clone().add(-16, 14, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER); + + //UtilText.MakeText("HUNGER GAMES", locSurvival.clone().add(-15, 21, 0), faceSurvival, 159, (byte)4, TextAlign.CENTER); + //UtilText.MakeText("HUNGER GAMES", locSurvival.clone().add(-16, 21, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER); + + + //Other + UtilText.MakeText("CLASSICS", locOther, faceOther, 159, (byte)14, TextAlign.CENTER); + UtilText.MakeText("CLASSICS", locOther.add(0, 0, -1), faceOther, 159, (byte)15, TextAlign.CENTER); + + UtilText.MakeText("MINEKART", locOther.clone().add(0, 14, -15), faceOther, 159, (byte)4, TextAlign.CENTER); + UtilText.MakeText("MINEKART", locOther.clone().add(0, 14, -16), faceOther, 159, (byte)15, TextAlign.CENTER); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java new file mode 100644 index 000000000..4787f1378 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java @@ -0,0 +1,9 @@ +package mineplex.hub.server; + +public class ServerInfo +{ + public String Name; + public String MOTD = "Retrieving status"; + public int CurrentPlayers = 0; + public int MaxPlayers = 0; +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java new file mode 100644 index 000000000..ee5c77503 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -0,0 +1,440 @@ +package mineplex.hub.server; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.plugin.messaging.PluginMessageListener; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.donation.DonationManager; +import mineplex.core.portal.Portal; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.hub.server.command.ServerNpcCommand; +import mineplex.hub.server.ui.ServerNpcShop; + +public class ServerManager extends MiniPlugin implements PluginMessageListener +{ + private CoreClientManager _clientManager; + private DonationManager _donationManager; + private Portal _portal; + + private NautHashMap> _serverNpcMap = new NautHashMap>(); + private NautHashMap _serverNpcShopMap = new NautHashMap(); + private NautHashMap _serverInfoMap = new NautHashMap(); + private NautHashMap _serverUpdate = new NautHashMap(); + + private boolean _update = true; + private boolean _loading = false; + + public ServerManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Portal portal) + { + super("Server Manager", plugin); + + _clientManager = clientManager; + _donationManager = donationManager; + _portal = portal; + + plugin.getServer().getMessenger().registerOutgoingPluginChannel(plugin, "BungeeCord"); + plugin.getServer().getMessenger().registerOutgoingPluginChannel(plugin, "BungeeSigns"); + plugin.getServer().getMessenger().registerIncomingPluginChannel(plugin, "BungeeSigns", this); + + LoadServers(); + } + + public void AddCommands() + { + AddCommand(new ServerNpcCommand(this)); + } + + public void AddServer(String serverNpcName, String serverName) + { + ServerInfo serverInfo = new ServerInfo(); + serverInfo.Name = serverName; + + _serverNpcMap.get(serverNpcName).add(serverInfo); + + if (!_serverInfoMap.containsKey(serverName)) + { + _serverInfoMap.put(serverName, serverInfo); + _serverUpdate.put(serverName, System.currentTimeMillis()); + } + + SaveServers(); + } + + public void RemoveServer(String serverName) + { + for (String key : _serverNpcMap.keySet()) + { + _serverNpcMap.get(key).remove(serverName); + } + + _serverInfoMap.remove(serverName); + } + + public void AddServerNpc(String serverNpcName) + { + _serverNpcMap.put(serverNpcName, new ArrayList()); + _serverNpcShopMap.put(serverNpcName, new ServerNpcShop(this, _clientManager, _donationManager, serverNpcName)); + } + + public void RemoveServerNpc(String serverNpcName) + { + List mappedServers = _serverNpcMap.remove(serverNpcName); + _serverNpcShopMap.remove(serverNpcName); + + if (mappedServers != null) + { + for (ServerInfo mappedServer : mappedServers) + { + boolean isMappedElseWhere = false; + + for (String key : _serverNpcMap.keySet()) + { + for (ServerInfo value : _serverNpcMap.get(key)) + { + if (value.Name.equalsIgnoreCase(mappedServer.Name)) + { + isMappedElseWhere = true; + break; + } + } + + if (isMappedElseWhere) + break; + } + + if (!isMappedElseWhere) + _serverInfoMap.remove(mappedServer.Name); + } + } + } + + public List GetServerList(String serverNpcName) + { + return _serverNpcMap.get(serverNpcName); + } + + public Set GetAllServers() + { + return _serverInfoMap.keySet(); + } + + public ServerInfo GetServerInfo(String serverName) + { + return _serverInfoMap.get(serverName); + } + + public boolean HasServerNpc(String serverNpcName) + { + return _serverNpcMap.containsKey(serverNpcName); + } + + @Override + public void onPluginMessageReceived(String channel, Player player, byte[] message) + { + if (!channel.equalsIgnoreCase("BungeeSigns")) + return; + + DataInputStream in = null; + String serverName = null; + String motd = null; + int players = 0; + int maxPlayers = 0; + + try + { + in = new DataInputStream(new ByteArrayInputStream(message)); + serverName = in.readUTF(); + motd = in.readUTF(); + players = in.readInt(); + maxPlayers = in.readInt(); + + if (_serverInfoMap.containsKey(serverName)) + { + ServerInfo serverInfo = _serverInfoMap.get(serverName); + serverInfo.MOTD = motd; + serverInfo.CurrentPlayers = players; + serverInfo.MaxPlayers = maxPlayers; + + _serverUpdate.put(serverName, System.currentTimeMillis()); + } + } + catch (IOException e) + { + e.printStackTrace(); + } + finally + { + try + { + in.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + + @EventHandler + public void UpdateServers(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + _update = !_update; + + if (!_update) + { + for (ServerNpcShop shop : _serverNpcShopMap.values()) + { + shop.UpdatePages(); + } + + return; + } + + if (Bukkit.getServer().getOnlinePlayers().length > 0) + { + for (String serverName : _serverInfoMap.keySet()) + { + ByteArrayOutputStream b = new ByteArrayOutputStream(); + DataOutputStream out = new DataOutputStream(b); + + try + { + out.writeUTF(serverName); + } + catch (IOException e) + { + e.printStackTrace(); + } + + Bukkit.getServer().getOnlinePlayers()[0].sendPluginMessage(GetPlugin(), "BungeeSigns", b.toByteArray()); + + if (_serverUpdate.get(serverName) != -1L && System.currentTimeMillis() - _serverUpdate.get(serverName) > 5000) + { + ServerInfo serverInfo = _serverInfoMap.get(serverName); + serverInfo.MOTD = ChatColor.DARK_RED + "OFFLINE"; + serverInfo.CurrentPlayers = 0; + serverInfo.MaxPlayers = 0; + + _serverUpdate.put(serverName, -1L); + } + } + } + } + + public void Help(Player caller, String message) + { + UtilPlayer.message(caller, F.main(_moduleName, "Commands List:")); + UtilPlayer.message(caller, F.help("/servernpc create ", " is name of npc.", Rank.OWNER)); + UtilPlayer.message(caller, F.help("/servernpc delete ", " is name of npc.", Rank.OWNER)); + UtilPlayer.message(caller, F.help("/servernpc addserver | ", "Adds server.", Rank.OWNER)); + UtilPlayer.message(caller, F.help("/servernpc removeserver ", "Removes server.", Rank.OWNER)); + UtilPlayer.message(caller, F.help("/servernpc listnpcs", "Lists all server npcs.", Rank.OWNER)); + UtilPlayer.message(caller, F.help("/servernpc listservers ", "Lists all servers.", Rank.OWNER)); + UtilPlayer.message(caller, F.help("/servernpc listoffline", "Shows all servers offline.", Rank.OWNER)); + + if (message != null) + UtilPlayer.message(caller, F.main(_moduleName, ChatColor.RED + message)); + } + + public void Help(Player caller) + { + Help(caller, null); + } + + public void SelectServer(org.bukkit.entity.Player player, String serverName) + { + player.leaveVehicle(); + player.eject(); + + _portal.SendPlayerToServer(player, serverName); + } + + public void ListServerNpcs(Player caller) + { + UtilPlayer.message(caller, F.main(GetName(), "Listing Server Npcs:")); + + for (String serverNpc : _serverNpcMap.keySet()) + { + UtilPlayer.message(caller, F.main(GetName(), C.cYellow + serverNpc)); + } + } + + public void ListServers(Player caller, String serverNpcName) + { + UtilPlayer.message(caller, F.main(GetName(), "Listing Servers for '" + serverNpcName + "':")); + + for (ServerInfo serverNpc : _serverNpcMap.get(serverNpcName)) + { + UtilPlayer.message(caller, F.main(GetName(), C.cYellow + serverNpc.Name + C.cWhite + " - " + serverNpc.MOTD + " " + serverNpc.CurrentPlayers + "/" + serverNpc.MaxPlayers)); + } + } + + public void ListOfflineServers(Player caller) + { + UtilPlayer.message(caller, F.main(GetName(), "Listing Offline Servers:")); + + for (ServerInfo serverNpc : _serverInfoMap.values()) + { + if (serverNpc.MOTD.equalsIgnoreCase(ChatColor.DARK_RED + "OFFLINE")) + { + UtilPlayer.message(caller, F.main(GetName(), C.cYellow + serverNpc.Name + C.cWhite + " - " + F.time(UtilTime.convertString(System.currentTimeMillis() - _serverUpdate.get(serverNpc.Name), 0, TimeUnit.FIT)))); + } + } + } + + public void SaveServers() + { + if (_loading) + return; + + FileWriter fstream = null; + BufferedWriter out = null; + + try + { + fstream = new FileWriter("ServerManager.dat"); + out = new BufferedWriter(fstream); + + for (String key : _serverNpcMap.keySet()) + { + System.out.println("Saving serverinfos for " + key); + for (ServerInfo serverInfo : _serverNpcMap.get(key)) + { + out.write(key + " | " + serverInfo.Name); + out.newLine(); + } + } + + out.close(); + } + catch (Exception e) + { + System.err.println("ServerManager Save Error: " + e.getMessage()); + } + finally + { + if (out != null) + { + try + { + out.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + public void LoadServers() + { + _loading = true; + + FileInputStream fstream = null; + BufferedReader br = null; + + try + { + File npcFile = new File("ServerManager.dat"); + + if (npcFile.exists()) + { + fstream = new FileInputStream(npcFile); + br = new BufferedReader(new InputStreamReader(fstream)); + + String line = br.readLine(); + + while (line != null) + { + String serverNpcName = line.substring(0, line.indexOf('|')).trim(); + String server = line.substring(line.indexOf('|') + 1).trim(); + + if (!HasServerNpc(serverNpcName)) + { + AddServerNpc(serverNpcName); + } + + AddServer(serverNpcName, server); + + line = br.readLine(); + } + } + } + catch (Exception e) + { + System.out.println("ServerManager - Error parsing servers file : " + e.getMessage()); + } + finally + { + if (br != null) + { + try + { + br.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + _loading = false; + } + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerSorter.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerSorter.java new file mode 100644 index 000000000..952994173 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerSorter.java @@ -0,0 +1,26 @@ +package mineplex.hub.server; + +import java.util.Comparator; + +public class ServerSorter implements Comparator +{ + public int compare(ServerInfo a, ServerInfo b) + { + if ((a.MOTD.contains("Recruiting") || a.MOTD.contains("Waiting") || a.MOTD.contains("Cup")) && !b.MOTD.contains("Recruiting") && !b.MOTD.contains("Waiting") && !b.MOTD.contains("Cup")) + return -1; + + if ((b.MOTD.contains("Recruiting") || b.MOTD.contains("Waiting") || b.MOTD.contains("Cup")) && !a.MOTD.contains("Recruiting") && !a.MOTD.contains("Waiting") && !a.MOTD.contains("Cup")) + return 1; + + if (a.CurrentPlayers > b.CurrentPlayers) + return -1; + + if (b.CurrentPlayers > a.CurrentPlayers) + return 1; + + if (Integer.parseInt(a.Name.split("-")[1]) < Integer.parseInt(b.Name.split("-")[1])) + return -1; + + return 1; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/AddServerCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/AddServerCommand.java new file mode 100644 index 000000000..60d92bb0a --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/AddServerCommand.java @@ -0,0 +1,55 @@ +package mineplex.hub.server.command; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.hub.server.ServerManager; + +public class AddServerCommand extends CommandBase +{ + public AddServerCommand(ServerManager plugin) + { + super(plugin, Rank.OWNER, "addserver"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 2) + { + Plugin.Help(caller, "Invalid arguments"); + return; + } + + String argsCombined = args[0]; + String serverNpcName = ""; + String serverName = ""; + + for (int i = 1; i < args.length; i++) + { + argsCombined += " " + args[i]; + } + + if (!argsCombined.contains("|")) + { + Plugin.Help(caller, "Invalid arguments"); + } + + serverNpcName = argsCombined.substring(0, argsCombined.indexOf("|")).trim(); + serverName = argsCombined.substring(argsCombined.indexOf("|") + 1).trim(); + + if (!Plugin.HasServerNpc(serverNpcName)) + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), ChatColor.RED + "That ServerNpc doesn't exist.")); + } + else + { + Plugin.AddServer(serverNpcName, serverName); + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Added '" + serverName + "' to '" + serverNpcName + "' server list.")); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/CreateCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/CreateCommand.java new file mode 100644 index 000000000..8af27e232 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/CreateCommand.java @@ -0,0 +1,45 @@ +package mineplex.hub.server.command; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.hub.server.ServerManager; + +public class CreateCommand extends CommandBase +{ + public CreateCommand(ServerManager plugin) + { + super(plugin, Rank.OWNER, "create"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args == null || args.length == 0) + { + Plugin.Help(caller, "Invalid name for servernpc"); + return; + } + + String serverNpcName = args[0]; + + for (int i = 1; i < args.length; i++) + { + serverNpcName += " " + args[i]; + } + + if (Plugin.HasServerNpc(serverNpcName)) + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), ChatColor.RED + "That ServerNpc already exists.")); + } + else + { + Plugin.AddServerNpc(serverNpcName); + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Created '" + serverNpcName + "' server npc.")); + } + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/DeleteCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/DeleteCommand.java new file mode 100644 index 000000000..fd0957df4 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/DeleteCommand.java @@ -0,0 +1,38 @@ +package mineplex.hub.server.command; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.hub.server.ServerManager; + +public class DeleteCommand extends CommandBase +{ + public DeleteCommand(ServerManager plugin) + { + super(plugin, Rank.OWNER, "delete"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length != 1) + { + Plugin.Help(caller, "Invalid name for servernpc"); + return; + } + + if (!Plugin.HasServerNpc(args[0])) + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), ChatColor.RED + "That ServerNpc doesn't exist.")); + } + else + { + Plugin.RemoveServerNpc(args[0]); + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Removed '" + args[0] + "' server npc.")); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/ListNpcsCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/ListNpcsCommand.java new file mode 100644 index 000000000..e8771f3ec --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/ListNpcsCommand.java @@ -0,0 +1,27 @@ +package mineplex.hub.server.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.hub.server.ServerManager; + +public class ListNpcsCommand extends CommandBase +{ + public ListNpcsCommand(ServerManager plugin) + { + super(plugin, Rank.OWNER, "listnpcs"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args != null) + { + Plugin.Help(caller, "Invalid arguments"); + return; + } + + Plugin.ListServerNpcs(caller); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/ListOfflineCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/ListOfflineCommand.java new file mode 100644 index 000000000..4a6c97bbc --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/ListOfflineCommand.java @@ -0,0 +1,27 @@ +package mineplex.hub.server.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.hub.server.ServerManager; + +public class ListOfflineCommand extends CommandBase +{ + public ListOfflineCommand(ServerManager plugin) + { + super(plugin, Rank.OWNER, "listoffline"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args != null) + { + Plugin.Help(caller, "Invalid arguments"); + return; + } + + Plugin.ListOfflineServers(caller); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/ListServersCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/ListServersCommand.java new file mode 100644 index 000000000..38ef65f9b --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/ListServersCommand.java @@ -0,0 +1,34 @@ +package mineplex.hub.server.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.hub.server.ServerManager; + +public class ListServersCommand extends CommandBase +{ + public ListServersCommand(ServerManager plugin) + { + super(plugin, Rank.OWNER, "listservers"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args == null || args.length < 1) + { + Plugin.Help(caller, "Invalid arguments"); + return; + } + + String serverNpcName = args[0]; + + for (int i = 1; i < args.length; i++) + { + serverNpcName += " " + args[i]; + } + + Plugin.ListServers(caller, serverNpcName); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/RemoveServerCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/RemoveServerCommand.java new file mode 100644 index 000000000..1dda890cc --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/RemoveServerCommand.java @@ -0,0 +1,30 @@ +package mineplex.hub.server.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.hub.server.ServerManager; + +public class RemoveServerCommand extends CommandBase +{ + public RemoveServerCommand(ServerManager plugin) + { + super(plugin, Rank.OWNER, "removeserver"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length != 1) + { + Plugin.Help(caller, "Invalid arguments"); + return; + } + + Plugin.RemoveServer(args[0]); + UtilPlayer.message(caller, F.main(Plugin.GetName(), "Removed '" + args[0] + "' from server list.")); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/ServerNpcCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/ServerNpcCommand.java new file mode 100644 index 000000000..ae69c4d6a --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/command/ServerNpcCommand.java @@ -0,0 +1,29 @@ +package mineplex.hub.server.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.MultiCommandBase; +import mineplex.core.common.Rank; +import mineplex.hub.server.ServerManager; + +public class ServerNpcCommand extends MultiCommandBase +{ + public ServerNpcCommand(ServerManager plugin) + { + super(plugin, Rank.OWNER, "servernpc"); + + AddCommand(new CreateCommand(plugin)); + AddCommand(new DeleteCommand(plugin)); + AddCommand(new AddServerCommand(plugin)); + AddCommand(new RemoveServerCommand(plugin)); + AddCommand(new ListNpcsCommand(plugin)); + AddCommand(new ListServersCommand(plugin)); + AddCommand(new ListOfflineCommand(plugin)); + } + + @Override + protected void Help(Player caller, String args[]) + { + Plugin.Help(caller); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/JoinServerButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/JoinServerButton.java new file mode 100644 index 000000000..96a134aeb --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/JoinServerButton.java @@ -0,0 +1,23 @@ +package mineplex.hub.server.ui; + +import org.bukkit.entity.Player; + +import mineplex.core.shop.item.IButton; + +public class JoinServerButton implements IButton +{ + private ServerNpcPage _page; + private String _serverName; + + public JoinServerButton(ServerNpcPage page, String serverName) + { + _page = page; + _serverName = serverName; + } + + @Override + public void Clicked(Player player) + { + _page.SelectServer(player, _serverName); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java new file mode 100644 index 000000000..65b8d59c9 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java @@ -0,0 +1,121 @@ +package mineplex.hub.server.ui; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.page.ShopPageBase; +import mineplex.hub.server.ServerInfo; +import mineplex.hub.server.ServerManager; +import mineplex.hub.server.ServerSorter; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class ServerNpcPage extends ShopPageBase +{ + private String _serverNpcKey; + + public ServerNpcPage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, String serverNpcKey) + { + super(plugin, shop, clientManager, donationManager, name, player, 54); + + _serverNpcKey = serverNpcKey; + + BuildPage(); + } + + @Override + protected void BuildPage() + { + List serverList = Plugin.GetServerList(_serverNpcKey); + Collections.sort(serverList, new ServerSorter()); + + int slot = 9; + int greenCount = 0; + int yellowCount = 0; + + for (ServerInfo serverInfo : serverList) + { + Material status = Material.REDSTONE_BLOCK; + List lore = new ArrayList(); + + if ((serverInfo.MOTD.contains("Recruiting") || serverInfo.MOTD.contains("Waiting") || serverInfo.MOTD.contains("Cup")) && slot < 15) + { + slot += 2; + status = Material.EMERALD_BLOCK; + lore.add(ChatColor.RESET + serverInfo.MOTD); + lore.add(ChatColor.RESET + "" + serverInfo.CurrentPlayers + "/" + serverInfo.MaxPlayers); + lore.add(ChatColor.RESET + ""); + + if (serverInfo.CurrentPlayers >= serverInfo.MaxPlayers) + { + if (!Client.GetRank().Has(Rank.ULTRA)) + lore.add(ChatColor.RESET + "" + ChatColor.YELLOW + "Get Ultra to join full servers!"); + else + lore.add(ChatColor.RESET + "" + ChatColor.GREEN + "Click to join!"); + } + else + lore.add(ChatColor.RESET + "" + ChatColor.GREEN + "Click to join!"); + + greenCount++; + } + else if (serverInfo.MOTD.contains("In")) + { + if (slot <= 15) + slot = 27; + else + slot++; + + status = Material.GOLD_BLOCK; + lore.add(ChatColor.RESET + serverInfo.MOTD); + lore.add(ChatColor.RESET + "" + serverInfo.CurrentPlayers + "/" + serverInfo.MaxPlayers); + lore.add(ChatColor.RESET + ""); + + if (serverInfo.CurrentPlayers >= serverInfo.MaxPlayers) + { + if (!Client.GetRank().Has(Rank.ULTRA)) + lore.add(ChatColor.RESET + "" + ChatColor.YELLOW + "Get Ultra to spectate full servers!"); + else + lore.add(ChatColor.RESET + "" + ChatColor.GREEN + "Click to spectate!"); + } + else + lore.add(ChatColor.RESET + "" + ChatColor.GREEN + "Click to spectate!"); + + yellowCount++; + } + else + continue; + + AddButton(slot, new ShopItem(status, ChatColor.UNDERLINE + "" + ChatColor.BOLD + "" + ChatColor.WHITE + "Server " + serverInfo.Name.substring(serverInfo.Name.indexOf('-') + 1), lore.toArray(new String[lore.size()]), Math.max(1, serverInfo.CurrentPlayers), false), new JoinServerButton(this, serverInfo.Name)); + } + + while (greenCount < 3) + { + setItem(9 + ((greenCount + 1) * 2), null); + greenCount++; + } + + while (yellowCount < 18) + { + setItem(yellowCount + 27, null); + yellowCount++; + } + } + + public void Update() + { + ButtonMap.clear(); + BuildPage(); + } + + public void SelectServer(Player player, String serverName) + { + Plugin.SelectServer(player, serverName); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java new file mode 100644 index 000000000..421ba2482 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java @@ -0,0 +1,34 @@ +package mineplex.hub.server.ui; + +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.ShopBase; +import mineplex.core.shop.page.ShopPageBase; +import mineplex.hub.server.ServerManager; + +public class ServerNpcShop extends ShopBase +{ + public ServerNpcShop(ServerManager plugin, CoreClientManager clientManager, DonationManager donationManager, String name) + { + super(plugin, clientManager, donationManager, name); + } + + @Override + protected ShopPageBase> BuildPagesFor(Player player) + { + return new ServerNpcPage(Plugin, this, ClientManager, DonationManager, Name, player, Name); + } + + public void UpdatePages() + { + for (ShopPageBase> page : PlayerPageMap.values()) + { + if (page instanceof ServerNpcPage) + { + ((ServerNpcPage)page).Update(); + } + } + } +} diff --git a/Plugins/Mineplex.Minecraft.BungeeSigns/.classpath b/Plugins/Mineplex.Minecraft.BungeeSigns/.classpath new file mode 100644 index 000000000..211cf1dd3 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.BungeeSigns/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Plugins/Mineplex.Minecraft.BungeeSigns/.project b/Plugins/Mineplex.Minecraft.BungeeSigns/.project new file mode 100644 index 000000000..a25174830 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.BungeeSigns/.project @@ -0,0 +1,17 @@ + + + Mineplex.Minecraft.BungeeSigns + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Mineplex.Minecraft.BungeeSigns/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.Minecraft.BungeeSigns/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7341ab168 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.BungeeSigns/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Mineplex.Minecraft.BungeeSigns/bin/mineplex/minecraft/BungeeSigns/BungeeSigns.class b/Plugins/Mineplex.Minecraft.BungeeSigns/bin/mineplex/minecraft/BungeeSigns/BungeeSigns.class new file mode 100644 index 000000000..c63fabcf2 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.BungeeSigns/bin/mineplex/minecraft/BungeeSigns/BungeeSigns.class differ diff --git a/Plugins/Mineplex.Minecraft.BungeeSigns/bin/mineplex/minecraft/BungeeSigns/ServerInfo.class b/Plugins/Mineplex.Minecraft.BungeeSigns/bin/mineplex/minecraft/BungeeSigns/ServerInfo.class new file mode 100644 index 000000000..821be58dd Binary files /dev/null and b/Plugins/Mineplex.Minecraft.BungeeSigns/bin/mineplex/minecraft/BungeeSigns/ServerInfo.class differ diff --git a/Plugins/Mineplex.Minecraft.BungeeSigns/plugin.yml b/Plugins/Mineplex.Minecraft.BungeeSigns/plugin.yml new file mode 100644 index 000000000..d57374303 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.BungeeSigns/plugin.yml @@ -0,0 +1,4 @@ +name: BungeeSigns +main: mineplex.minecraft.BungeeSigns.BungeeSigns +version: 1 +author: defek7 diff --git a/Plugins/Mineplex.Minecraft.BungeeSigns/src/mineplex/minecraft/BungeeSigns/BungeeSigns.java b/Plugins/Mineplex.Minecraft.BungeeSigns/src/mineplex/minecraft/BungeeSigns/BungeeSigns.java new file mode 100644 index 000000000..b0c24427b --- /dev/null +++ b/Plugins/Mineplex.Minecraft.BungeeSigns/src/mineplex/minecraft/BungeeSigns/BungeeSigns.java @@ -0,0 +1,378 @@ +package mineplex.minecraft.BungeeSigns; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.HashMap; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.block.Sign; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.SignChangeEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.plugin.messaging.PluginMessageListener; + +public class BungeeSigns extends JavaPlugin implements Listener, PluginMessageListener, Runnable +{ + private HashMap _signs = new HashMap(); + private HashMap _signUpdate = new HashMap(); + + @Override + public void onEnable() + { + LoadSigns(); + + getServer().getPluginManager().registerEvents(this, this); + getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord"); + getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeSigns"); + getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeSigns", this); + getServer().getScheduler().scheduleSyncRepeatingTask(this, this, 0L, 40L); + } + + public void onDisable() + { + _signs.clear(); + } + + @EventHandler + public void PlayerBreakSign(BlockBreakEvent event) + { + if (event.isCancelled()) + return; + + if ((event.getBlock().getType() == Material.WALL_SIGN || event.getBlock().getType() == Material.SIGN_POST)) + { + String serverName = ChatColor.stripColor(((Sign)event.getBlock().getState()).getLine(1)); + + if (_signs.containsKey(serverName)) + { + _signs.remove(serverName); + SaveSigns(); + } + } + } + + @EventHandler + public void PlayerClickSign(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getClickedBlock() != null && (event.getClickedBlock().getType() == Material.WALL_SIGN || event.getClickedBlock().getType() == Material.SIGN_POST) && _signs.containsKey(ChatColor.stripColor(((Sign)event.getClickedBlock().getState()).getLine(1)))) + { + String serverName = ChatColor.stripColor(((Sign)event.getClickedBlock().getState()).getLine(1)); + + if (_signUpdate.containsKey(serverName) && _signUpdate.get(serverName) == -1L) + { + event.getPlayer().sendMessage(ChatColor.BLUE + "BungeeSigns" + ChatColor.GRAY + "> " + ChatColor.RED + "That server is offline."); + return; + } + + ByteArrayOutputStream b = new ByteArrayOutputStream(); + DataOutputStream out = new DataOutputStream(b); + + try + { + out.writeUTF("Connect"); + out.writeUTF(serverName); + } + catch (IOException e) + { + // Can never happen + } + finally + { + try + { + out.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + event.getPlayer().sendPluginMessage(this, "BungeeCord", b.toByteArray()); + } + } + + @EventHandler + public void PlayerPlaceSign(SignChangeEvent event) + { + if (event.isCancelled() || !event.getPlayer().isOp()) + return; + + if (event.getBlock().getType() == Material.WALL_SIGN || event.getBlock().getType() == Material.SIGN_POST) + { + if (event.getLine(0).equalsIgnoreCase("[BungeeSigns]")) + { + if (_signs.containsKey(event.getLine(1)) && _signs.get(event.getLine(1)) != event.getBlock().getLocation()) + { + _signs.get(event.getLine(1)).getBlock().setType(Material.AIR); + } + + _signs.put(event.getLine(1), event.getBlock().getLocation()); + SaveSigns(); + } + } + } + + @Override + public void onPluginMessageReceived(String channel, Player player, byte[] message) + { + if (!channel.equalsIgnoreCase("BungeeSigns")) + return; + + DataInputStream in = null; + String serverName = null; + String motd = null; + int players = 0; + int maxPlayers = 0; + + try + { + in = new DataInputStream(new ByteArrayInputStream(message)); + serverName = in.readUTF(); + motd = in.readUTF(); + players = in.readInt(); + maxPlayers = in.readInt(); + + if (_signs.containsKey(serverName)) + { + Block block = _signs.get(serverName).getBlock(); + + if (block != null && block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN_POST) + { + Sign sign = (Sign)block.getState(); + + sign.setLine(0, ChatColor.UNDERLINE + "Click to Join!"); + sign.setLine(1, ChatColor.BOLD + serverName); + sign.setLine(2, motd); + sign.setLine(3, players + "/" + maxPlayers); + sign.update(true); + } + + _signUpdate.put(serverName, System.currentTimeMillis()); + } + } + catch (IOException e) + { + e.printStackTrace(); + } + finally + { + try + { + in.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + + public void run() + { + if (getServer().getOnlinePlayers().length > 0) + { + for (String serverName : _signs.keySet()) + { + if (!_signUpdate.containsKey(serverName)) + { + _signUpdate.put(serverName, System.currentTimeMillis()); + } + + ByteArrayOutputStream b = new ByteArrayOutputStream(); + DataOutputStream out = new DataOutputStream(b); + + try + { + out.writeUTF(serverName); + } + catch (IOException e) + { + e.printStackTrace(); + } + + getServer().getOnlinePlayers()[0].sendPluginMessage(this, "BungeeSigns", b.toByteArray()); + + if (_signUpdate.get(serverName) != -1L && System.currentTimeMillis() - _signUpdate.get(serverName) > 5000) + { + Block block = _signs.get(serverName).getBlock(); + + if (block != null && block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN_POST) + { + Sign sign = (Sign)block.getState(); + + sign.setLine(0, ChatColor.UNDERLINE + "" + ChatColor.DARK_RED + "Don't touch me!"); + sign.setLine(1, ChatColor.BOLD + serverName); + sign.setLine(2, ChatColor.DARK_RED + "OFFLINE"); + sign.setLine(3, "?/?"); + sign.update(true); + } + + _signUpdate.put(serverName, -1L); + } + } + } + } + + public void SaveSigns() + { + FileWriter fstream = null; + BufferedWriter out = null; + + try + { + fstream = new FileWriter("BungeeSigns.dat"); + out = new BufferedWriter(fstream); + + for (String key : _signs.keySet()) + { + out.write(key + " " + locToStr(_signs.get(key))); + out.newLine(); + } + + out.close(); + } + catch (Exception e) + { + System.err.println("BungeeSigns Save Error: " + e.getMessage()); + } + finally + { + if (out != null) + { + try + { + out.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + public void LoadSigns() + { + FileInputStream fstream = null; + BufferedReader br = null; + + try + { + File npcFile = new File("BungeeSigns.dat"); + + if (npcFile.exists()) + { + fstream = new FileInputStream(npcFile); + br = new BufferedReader(new InputStreamReader(fstream)); + + String line = br.readLine(); + + while (line != null) + { + String name = line.split(" ")[0]; + String location = line.split(" ")[1]; + + _signs.put(name, strToLoc(location)); + + line = br.readLine(); + } + } + } + catch (Exception e) + { + System.out.println("BungeeSigns Error parsing npc file : " + e.getMessage()); + } + finally + { + if (br != null) + { + try + { + br.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + public String locToStr(Location loc) + { + if (loc == null) + return ""; + + return loc.getWorld().getName() + "," + loc.getX() + "," + loc.getY() + "," + loc.getZ(); + } + + public Location strToLoc(String string) + { + if (string.length() == 0) + return null; + + String[] tokens = string.split(","); + + try + { + for (World world : getServer().getWorlds()) + { + if (world.getName().equalsIgnoreCase(tokens[0])) + { + return new Location(world, Double.parseDouble(tokens[1]), Double.parseDouble(tokens[2]), Double.parseDouble(tokens[3])); + } + } + } + catch (Exception e) + { + return null; + } + + return null; + } +} diff --git a/Plugins/Mineplex.Minecraft.BungeeSigns/src/mineplex/minecraft/BungeeSigns/ServerInfo.java b/Plugins/Mineplex.Minecraft.BungeeSigns/src/mineplex/minecraft/BungeeSigns/ServerInfo.java new file mode 100644 index 000000000..0af9b7920 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.BungeeSigns/src/mineplex/minecraft/BungeeSigns/ServerInfo.java @@ -0,0 +1,17 @@ +package mineplex.minecraft.BungeeSigns; + +import org.bukkit.Location; + +public class ServerInfo +{ + public String BungeeName; + public String DisplayName; + public Location Location; + + public ServerInfo(String bungeeName, String displayName, Location location) + { + BungeeName = bungeeName; + DisplayName = displayName; + Location = location; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/.classpath b/Plugins/Mineplex.Minecraft.Game.ClassCombat/.classpath new file mode 100644 index 000000000..9a8b522e3 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/.classpath @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/.externalToolBuilders/ClassCombat.launch b/Plugins/Mineplex.Minecraft.Game.ClassCombat/.externalToolBuilders/ClassCombat.launch new file mode 100644 index 000000000..d9371da79 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/.externalToolBuilders/ClassCombat.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/.project b/Plugins/Mineplex.Minecraft.Game.ClassCombat/.project new file mode 100644 index 000000000..21323ed3c --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/.project @@ -0,0 +1,27 @@ + + + Mineplex.Minecraft.Game.ClassCombat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + auto,full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/ClassCombat.launch + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.Minecraft.Game.ClassCombat/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7341ab168 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/ClassManager.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/ClassManager.class new file mode 100644 index 000000000..8c175b2ca Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/ClassManager.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/ClassRestore.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/ClassRestore.class new file mode 100644 index 000000000..a7aa1fc55 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/ClassRestore.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/ClientClass.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/ClientClass.class new file mode 100644 index 000000000..024f5dc28 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/ClientClass.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/IClassFactory.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/IClassFactory.class new file mode 100644 index 000000000..694927416 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/IClassFactory.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/IPvpClass$ClassType.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/IPvpClass$ClassType.class new file mode 100644 index 000000000..7e5205068 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/IPvpClass$ClassType.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/IPvpClass.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/IPvpClass.class new file mode 100644 index 000000000..50df1d210 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/IPvpClass.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/PvpClass.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/PvpClass.class new file mode 100644 index 000000000..dea54b0da Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/PvpClass.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/event/ClassSetupEvent$SetupType.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/event/ClassSetupEvent$SetupType.class new file mode 100644 index 000000000..33682f0e4 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/event/ClassSetupEvent$SetupType.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/event/ClassSetupEvent.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/event/ClassSetupEvent.class new file mode 100644 index 000000000..2582c1547 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/event/ClassSetupEvent.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/ClassRepository$1.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/ClassRepository$1.class new file mode 100644 index 000000000..d296dbbee Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/ClassRepository$1.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/ClassRepository.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/ClassRepository.class new file mode 100644 index 000000000..7db931bc6 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/ClassRepository.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/token/ClassToken.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/token/ClassToken.class new file mode 100644 index 000000000..4562c19f4 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/token/ClassToken.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/token/ClientClassToken.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/token/ClientClassToken.class new file mode 100644 index 000000000..59452b93a Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/token/ClientClassToken.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/token/ClientClassTokenWrapper.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/token/ClientClassTokenWrapper.class new file mode 100644 index 000000000..a843c139c Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/token/ClientClassTokenWrapper.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/token/CustomBuildToken.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/token/CustomBuildToken.class new file mode 100644 index 000000000..ce03ba5c3 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/token/CustomBuildToken.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/token/SlotToken.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/token/SlotToken.class new file mode 100644 index 000000000..0ea34db09 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Class/repository/token/SlotToken.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Condition/SkillConditionEffect.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Condition/SkillConditionEffect.class new file mode 100644 index 000000000..31957dd2d Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Condition/SkillConditionEffect.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Condition/SkillConditionManager.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Condition/SkillConditionManager.class new file mode 100644 index 000000000..9541f9cd6 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Condition/SkillConditionManager.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Assassin.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Assassin.class new file mode 100644 index 000000000..c6814809f Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Assassin.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/BackStab.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/BackStab.class new file mode 100644 index 000000000..158c0631b Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/BackStab.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.class new file mode 100644 index 000000000..90f40d901 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Evade.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Evade.class new file mode 100644 index 000000000..d92565e58 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Evade.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Flash.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Flash.class new file mode 100644 index 000000000..204472c1c Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Flash.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Leap.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Leap.class new file mode 100644 index 000000000..5db6f0de2 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Leap.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/MarkedForDeath.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/MarkedForDeath.class new file mode 100644 index 000000000..02decc55a Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/MarkedForDeath.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.class new file mode 100644 index 000000000..183d97dcd Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/RepeatedStrikes.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/RepeatedStrikes.class new file mode 100644 index 000000000..bf38d1905 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/RepeatedStrikes.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/ShockingStrikes.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/ShockingStrikes.class new file mode 100644 index 000000000..60ce68947 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/ShockingStrikes.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/SilencingArrow.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/SilencingArrow.class new file mode 100644 index 000000000..0e4045acd Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/SilencingArrow.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/SmokeBomb.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/SmokeBomb.class new file mode 100644 index 000000000..c10589ea0 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/SmokeBomb.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Stealth.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Stealth.class new file mode 100644 index 000000000..732e2fcac Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/Stealth.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/ToxicArrow.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/ToxicArrow.class new file mode 100644 index 000000000..28e4296b8 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/ToxicArrow.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/WoundingStrikes.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/WoundingStrikes.class new file mode 100644 index 000000000..43db32873 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Assassin/WoundingStrikes.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.class new file mode 100644 index 000000000..8a3571d81 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Bloodlust.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Bloodlust.class new file mode 100644 index 000000000..6ce2a13f7 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Bloodlust.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Brute.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Brute.class new file mode 100644 index 000000000..8796637af Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Brute.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Colossus.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Colossus.class new file mode 100644 index 000000000..39f799b2e Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Colossus.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/CripplingBlow.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/CripplingBlow.class new file mode 100644 index 000000000..4fd01b297 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/CripplingBlow.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/DwarfToss.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/DwarfToss.class new file mode 100644 index 000000000..2b29270aa Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/DwarfToss.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.class new file mode 100644 index 000000000..72517feb1 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java.orig b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java.orig new file mode 100644 index 000000000..3eaab1e04 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java.orig @@ -0,0 +1,215 @@ +package mineplex.minecraft.game.classcombat.Skill.Brute; + +import java.util.WeakHashMap; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent; + +public class FleshHook extends SkillActive implements IThrown +{ + private WeakHashMap _charge = new WeakHashMap(); + private WeakHashMap _chargeLast = new WeakHashMap(); + + public FleshHook(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Hold Block to charge Flesh Hook.", + "Release Block to release it.", + "", + "If Flesh Hook hits a player, it", + "deals up to 12 damage, and rips them", + "towards you with high velocity.", + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 20 + (5 per 20% Strength)"; + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Start Charge + _charge.put(player, 0); + _chargeLast.put(player, System.currentTimeMillis()); + } + + @EventHandler + public void ChargeRelease(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + //Not Charging + if (!_charge.containsKey(cur)) + continue; + + //Level + int level = GetLevel(cur); + if (level == 0) return; + + //Add Charge + if (cur.isBlocking()) + { + //Max Charge + if (_charge.get(cur) >= 4) + continue; + + //Charge Interval + if (!UtilTime.elapsed(_chargeLast.get(cur), 400)) + continue; + + //Energy + if (!Factory.Energy().use(cur, GetName(), 5, true, false)) + continue; + + //Increase Charge + _charge.put(cur, _charge.get(cur) + 1); + _chargeLast.put(cur, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), GetName() + ": " + F.elem("+" + (_charge.get(cur) * 25) + "% Strength"))); + + //Effect + for (int i=_charge.get(cur) ; i>0 ; i--) + cur.playEffect(cur.getLocation(), Effect.CLICK2, 0); + } + + //Release Charge + else + { + double base = 0.8; + + //Action + Item item = cur.getWorld().dropItem(cur.getEyeLocation().add(cur.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(131)); + UtilAction.velocity(item, cur.getLocation().getDirection(), + base + (_charge.remove(cur) * (0.25*base)), false, 0, 0.2, 20, false); + + Factory.Projectile().AddThrow(item, cur, this, -1, true, true, true, + Sound.FIRE_IGNITE, 1.4f, 0.8f, null, 0, UpdateType.TICK, 1.5d); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + + //Effect + item.getWorld().playSound(item.getLocation(), Sound.IRONGOLEM_THROW, 2f, 0.8f); + + } + } + } + + @Override + public void Reset(Player player) + { + _charge.remove(player); + _chargeLast.remove(player); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + //Remove + double velocity = data.GetThrown().getVelocity().length(); + data.GetThrown().remove(); + + if (!(data.GetThrower() instanceof Player)) + return; + + Player player = (Player)data.GetThrower(); + + //Level + int level = GetLevel(player); + if (level == 0) return; + + if (target == null) + return; + + //Pull + UtilAction.velocity(target, + UtilAlg.getTrajectory(target.getLocation(), player.getLocation()), + 2, false, 0, 0.8, 1.5, true); + + //Condition + Factory.Condition().Factory().Falling(GetName(), target, player, 10, false, true); + + //Damage Event + Factory.Damage().NewDamageEvent(target, player, null, + DamageCause.CUSTOM, velocity * 8, false, true, false, + player.getName(), GetName()); + + + //Event + if (target != null) + UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(player, GetName(), ClassType.Brute, target)); + + //Inform + UtilPlayer.message(target, F.main(GetClassType().name(), F.name(player.getName()) + " pulled you with " + F.skill(GetName(level)) + ".")); + } + + @Override + public void Idle(ProjectileUser data) + { + //Remove + data.GetThrown().remove(); + } + + @Override + public void Expire(ProjectileUser data) + { + //Remove + data.GetThrown().remove(); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Intimidation.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Intimidation.class new file mode 100644 index 000000000..015aadab4 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Intimidation.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Overwhelm.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Overwhelm.class new file mode 100644 index 000000000..557722b87 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Overwhelm.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Rampage.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Rampage.class new file mode 100644 index 000000000..04a344098 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Rampage.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/SeismicSlam.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/SeismicSlam.class new file mode 100644 index 000000000..49f530bac Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/SeismicSlam.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Stampede.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Stampede.class new file mode 100644 index 000000000..9540cd274 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Stampede.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Takedown.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Takedown.class new file mode 100644 index 000000000..b36358cfe Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Brute/Takedown.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/BreakFall.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/BreakFall.class new file mode 100644 index 000000000..ab900ac3d Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/BreakFall.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Fitness.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Fitness.class new file mode 100644 index 000000000..6f746e7e9 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Fitness.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Pistol.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Pistol.class new file mode 100644 index 000000000..25beed93d Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Pistol.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/QuickRecovery.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/QuickRecovery.class new file mode 100644 index 000000000..002ae0dd8 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/QuickRecovery.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Rations.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Rations.class new file mode 100644 index 000000000..d7a2c73dc Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Rations.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Recharge.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Recharge.class new file mode 100644 index 000000000..e9169c5ad Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Recharge.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Resistance.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Resistance.class new file mode 100644 index 000000000..825376cd8 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Resistance.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Stamina.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Stamina.class new file mode 100644 index 000000000..2a29a02e2 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Stamina.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Swim.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Swim.class new file mode 100644 index 000000000..66f7d3477 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Global/Swim.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/ISkill$SkillType.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/ISkill$SkillType.class new file mode 100644 index 000000000..914d423ff Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/ISkill$SkillType.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/ISkill.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/ISkill.class new file mode 100644 index 000000000..1c2bd0645 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/ISkill.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/ISkillFactory.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/ISkillFactory.class new file mode 100644 index 000000000..62f0b78f7 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/ISkillFactory.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/BullsCharge.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/BullsCharge.class new file mode 100644 index 000000000..48ba29122 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/BullsCharge.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Cleave.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Cleave.class new file mode 100644 index 000000000..1590b60d2 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Cleave.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.class new file mode 100644 index 000000000..dd1c9e306 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Deflection.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Deflection.class new file mode 100644 index 000000000..23aefa723 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Deflection.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Fortitude.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Fortitude.class new file mode 100644 index 000000000..e268476bb Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Fortitude.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/HiltSmash.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/HiltSmash.class new file mode 100644 index 000000000..6bbf95f45 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/HiltSmash.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/HoldPosition.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/HoldPosition.class new file mode 100644 index 000000000..552242dfd Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/HoldPosition.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Knight.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Knight.class new file mode 100644 index 000000000..92685eeb1 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Knight.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/LevelField.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/LevelField.class new file mode 100644 index 000000000..cb323bf71 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/LevelField.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/PowerChop.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/PowerChop.class new file mode 100644 index 000000000..626350ced Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/PowerChop.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Riposte.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Riposte.class new file mode 100644 index 000000000..b84ade58c Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Riposte.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Swordsmanship.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Swordsmanship.class new file mode 100644 index 000000000..1e8abb60a Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Swordsmanship.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Vengeance.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Vengeance.class new file mode 100644 index 000000000..5f30703ca Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Knight/Vengeance.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/ArcticArmor.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/ArcticArmor.class new file mode 100644 index 000000000..31245a87f Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/ArcticArmor.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Blizzard.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Blizzard.class new file mode 100644 index 000000000..c716ce0a6 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Blizzard.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/FireBlast.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/FireBlast.class new file mode 100644 index 000000000..d0b813cc6 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/FireBlast.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Fissure.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Fissure.class new file mode 100644 index 000000000..63b82f97b Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Fissure.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/FissureData.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/FissureData.class new file mode 100644 index 000000000..69caf7292 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/FissureData.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.class new file mode 100644 index 000000000..59eef05b1 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.class new file mode 100644 index 000000000..4f064af54 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Immolate.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Immolate.class new file mode 100644 index 000000000..d4747a936 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Immolate.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Inferno.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Inferno.class new file mode 100644 index 000000000..f5327e79f Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Inferno.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/LifeBonds.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/LifeBonds.class new file mode 100644 index 000000000..cd500f411 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/LifeBonds.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.class new file mode 100644 index 000000000..c4d06ba9f Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Mage.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Mage.class new file mode 100644 index 000000000..7da35885f Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Mage.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/MagmaBlade.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/MagmaBlade.class new file mode 100644 index 000000000..65fe8a2c9 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/MagmaBlade.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Magnetize.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Magnetize.class new file mode 100644 index 000000000..d4921c854 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Magnetize.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/NullBlade.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/NullBlade.class new file mode 100644 index 000000000..e135e973b Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/NullBlade.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/RootingAxe.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/RootingAxe.class new file mode 100644 index 000000000..725223131 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/RootingAxe.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.class new file mode 100644 index 000000000..db9261703 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Void.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Void.class new file mode 100644 index 000000000..c2a768cd4 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Mage/Void.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Agility.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Agility.class new file mode 100644 index 000000000..e635776bb Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Agility.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/BarbedArrows.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/BarbedArrows.class new file mode 100644 index 000000000..ce9b4cd90 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/BarbedArrows.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Barrage.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Barrage.class new file mode 100644 index 000000000..cd6b69c1c Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Barrage.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Disengage.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Disengage.class new file mode 100644 index 000000000..bede4d9c1 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Disengage.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Fletcher.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Fletcher.class new file mode 100644 index 000000000..43bfbcf19 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Fletcher.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/HealingShot.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/HealingShot.class new file mode 100644 index 000000000..7ae66c828 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/HealingShot.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/HeavyArrows.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/HeavyArrows.class new file mode 100644 index 000000000..be2102bfe Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/HeavyArrows.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.class new file mode 100644 index 000000000..528fc88a1 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Longshot.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Longshot.class new file mode 100644 index 000000000..7c9449778 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Longshot.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.class new file mode 100644 index 000000000..4366b23b7 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Overcharge.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Overcharge.class new file mode 100644 index 000000000..aa13af99b Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Overcharge.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/PinDown.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/PinDown.class new file mode 100644 index 000000000..231060ef7 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/PinDown.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Ranger.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Ranger.class new file mode 100644 index 000000000..da4ce3fdf Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Ranger.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/RopedArrow.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/RopedArrow.class new file mode 100644 index 000000000..971ef6c3a Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/RopedArrow.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Shadowmeld.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Shadowmeld.class new file mode 100644 index 000000000..8a907d098 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Shadowmeld.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.class new file mode 100644 index 000000000..b7e09f950 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/VitalitySpores.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/VitalitySpores.class new file mode 100644 index 000000000..4641bc08b Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/VitalitySpores.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsFury.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsFury.class new file mode 100644 index 000000000..152876a37 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsFury.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsPounce.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsPounce.class new file mode 100644 index 000000000..7db02a0c0 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsPounce.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/ChickenForm.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/ChickenForm.class new file mode 100644 index 000000000..cbfb698f1 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/ChickenForm.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/Flap.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/Flap.class new file mode 100644 index 000000000..9973ce682 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/Flap.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/Flap.java.orig b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/Flap.java.orig new file mode 100644 index 000000000..4dbe9748a --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/Flap.java.orig @@ -0,0 +1,262 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Chicken; + +import java.util.HashMap; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Flap extends SkillActive +{ + private HashMap _active = new HashMap(); + private HashMap _damaged = new HashMap(); + + private long _damageDisableTime = 6000; + + private double _flap = 0.5; + private double _min = 0.3; + private double _max = 0.7; + + private FlapGrab _grab = null; + + private int _tick = 0; + + public Flap(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + _grab = new FlapGrab(this); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + //Wings Damaged + if (_damaged.containsKey(player)) + { + long damageTime = _damaged.get(player); + + if (!UtilTime.elapsed(damageTime, _damageDisableTime)) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " for " + + F.time(UtilTime.MakeStr(_damageDisableTime - (System.currentTimeMillis() - damageTime))) + ".")); + + return false; + } + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Initial Flap + Vector vel = player.getLocation().getDirection(); + vel.multiply(_flap + ((_flap/10d) * level)); + vel.add(new Vector(0,0.1,0)); + + //Clutch Penalty + if (player.getVehicle() != null) + vel.multiply(0.5 + (level * 0.05)); + + _active.put(player, vel); + + //Apply Velocity + player.setVelocity(vel); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, 1f, 1f); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + return; + + if (event.GetDamageePlayer() == null) + return; + + if (!GetUsers().containsKey(event.GetDamageePlayer())) + return; + + event.AddMod(UtilEnt.getName(event.GetDamagerEntity(true)), "Chicken Weakness", 10, false); + + _damaged.put(event.GetDamageePlayer(), System.currentTimeMillis()); + } + + @EventHandler + public void Glide(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + _tick = (_tick + 1)%12; + + for (Player cur : GetUsers()) + { + if (!_active.containsKey(cur)) + { + GetGrab().Release(cur); + continue; + } + + if (!cur.isBlocking()) + { + _active.remove(cur); + continue; + } + + //Level + int level = GetLevel(cur); + if (level == 0) + { + _active.remove(cur); + continue; + } + + //Clutch Penalty + if (cur.getVehicle() != null) + { + //Energy + if (!Factory.Energy().use(cur, "Glide", 1.2 - (0.02 * level), true, true)) + { + _active.remove(cur); + continue; + } + } + else + { + //Energy + if (!Factory.Energy().use(cur, "Glide", 0.6 - (0.02 * level), true, true)) + { + _active.remove(cur); + continue; + } + } + + //Target to apply velocity to + Entity target = cur; + if (cur.getVehicle() != null) + target = cur.getVehicle(); + + //Get Velocity + Vector vel = _active.get(cur); + + if (UtilEnt.isGrounded(target) && vel.getY() < 0) + { + _active.remove(cur); + continue; + } + + //Turn + double speed = vel.length(); + Vector turn = cur.getLocation().getDirection(); + turn.subtract(UtilAlg.Normalize(UtilAlg.Clone(vel))); + turn.multiply(0.1); + vel.add(turn); + UtilAlg.Normalize(vel).multiply(speed); + + //Gravity + vel.setX(vel.getX() * (1 - (vel.getY() / 6))); + vel.setZ(vel.getZ() * (1 - (vel.getY() / 6))); + if (vel.getY() > 0) vel.setY(vel.getY() * (1 - (vel.getY() / 6))); + + //Air Friction + vel.multiply(0.998); + + double minSpeed = _min + ((_min/10d) * level); + double maxSpeed = _max + ((_max/10d) * level); + + //Speed Min + if (vel.length() < minSpeed) + vel.normalize().multiply(minSpeed); + + //Speed Max + if (vel.length() > maxSpeed) + vel.normalize().multiply(maxSpeed); + + //Apply Velocity + target.setVelocity(vel); + + //Fall Dist + target.setFallDistance(0f); + + //Hit Others (only if not carrying) + if (cur.equals(target)) + { + for (Player other : UtilPlayer.getNearby(cur.getLocation(), 2)) + { + if (other.equals(cur)) + continue; + + if (!Factory.Relation().CanHurt(cur, other)) + continue; + + _grab.Grab(cur, other); + + if (vel.getY() < 0.1) + vel.setY(0.1); + } + } + + //Sound + if (_tick == 0) + cur.getWorld().playSound(cur.getLocation(), Sound.BAT_TAKEOFF, 0.4f, 1f); + } + } + + @EventHandler + public void DamageRelease(CustomDamageEvent event) + { + GetGrab().DamageRelease(event); + } + + public FlapGrab GetGrab() + { + return _grab; + } + + @Override + public void Reset(Player player) + { + _grab.Reset(player); + + _active.remove(player); + _damaged.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/FlapGrab.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/FlapGrab.class new file mode 100644 index 000000000..06046d359 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/FlapGrab.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Creeper/CreeperForm.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Creeper/CreeperForm.class new file mode 100644 index 000000000..e98564ab6 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Creeper/CreeperForm.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/FormBase.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/FormBase.class new file mode 100644 index 000000000..b36568091 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/FormBase.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/GolemForm.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/GolemForm.class new file mode 100644 index 000000000..77324b154 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/GolemForm.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticPull.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticPull.class new file mode 100644 index 000000000..9a89c47ed Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticPull.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticPull.java.orig b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticPull.java.orig new file mode 100644 index 000000000..c03db462e --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticPull.java.orig @@ -0,0 +1,142 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Golem; + +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class MagneticPull extends SkillActive +{ + private HashSet _active = new HashSet(); + + public MagneticPull(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + } + + @Override + public String GetEnergyString() + { + return "Energy: 16 per Second"; + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + _active.add(player); + + player.getWorld().playSound(player.getLocation(), Sound.IRONGOLEM_DEATH, 0.6f, 0.6f); + } + + + @EventHandler + public void Energy(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + if (!cur.isBlocking()) + { + _active.remove(cur); + continue; + } + + //Level + int level = GetLevel(cur); + if (level == 0) + { + _active.remove(cur); + continue; + } + + if (!Factory.Energy().use(cur, GetName(), 2 - (level * 0.1), true, true)) + { + _active.remove(cur); + continue; + } + + //Effect + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, 42); + + //Pull + for (int i=0 ; i<=4 + (2*level) ; i++) + Pull(cur, cur.getEyeLocation().add(cur.getLocation().getDirection().multiply(i))); + } + } + + public void Pull(Player player, Location loc) + { + for (Entity other : player.getWorld().getEntities()) + { + if (!(other instanceof LivingEntity) && !(other instanceof Item)) + continue; + + if (player.equals(other)) + continue; + + if (UtilMath.offset(player, other) < 2 || UtilMath.offset(loc, other.getLocation()) > 2 + ((GetLevel(player) * 0.5))) + continue; + + if (other instanceof Player) + { + if (!Factory.Relation().CanHurt(player, (Player)other)) + continue; + } + + UtilAction.velocity(other, UtilAlg.getTrajectory2d(other, player), + 0.2, false, 0, 0, 1, true); + } + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticRepel.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticRepel.class new file mode 100644 index 000000000..b53f19a34 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticRepel.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Needler.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Needler.class new file mode 100644 index 000000000..5a4ba6a6d Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Needler.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Needler.java.orig b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Needler.java.orig new file mode 100644 index 000000000..539bfb439 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Needler.java.orig @@ -0,0 +1,211 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Spider; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Needler extends SkillActive +{ + private HashMap _stored = new HashMap(); + private HashMap _fired = new HashMap(); + + private HashSet _arrows = new HashSet(); + + private boolean _tick = false; + + public Needler(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + return true; + } + + @Override + public void Skill(Player player, int level) + { + + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + _tick = !_tick; + + if (_tick) + return; + + for (Player cur : GetUsers()) + { + if (!cur.isBlocking()) + continue; + + //Level + int level = GetLevel(cur); + if (level == 0) + continue; + //Water + if (cur.getLocation().getBlock().isLiquid()) + { + UtilPlayer.message(cur, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in liquids.")); + continue; + } + + //Use Charge + if (!UseCharge(cur)) + continue; + + //Use Energy + Factory.Energy().use(cur, GetName(), 3 - (0.2 * level), true, false); + + Arrow arrow = cur.getWorld().spawnArrow(cur.getEyeLocation().add(cur.getLocation().getDirection()), + cur.getLocation().getDirection(), 1.6f + (level * 0.4f), 2); + arrow.setShooter(cur); + _arrows.add(arrow); + + //Set Fired + _fired.put(cur, System.currentTimeMillis()); + + //Sound + cur.getWorld().playSound(cur.getLocation(), Sound.SPIDER_IDLE, 0.8f, 2f); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void Damage(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Projectile projectile = event.GetProjectile(); + if (projectile == null) return; + + if (!_arrows.remove(projectile)) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + event.SetCancelled(GetName()); + + //Damage Event + Factory.Damage().NewDamageEvent(damagee, damager, null, + DamageCause.THORNS, 2, true, true, false, + damager.getName(), GetName()); + + Factory.Condition().Factory().Poison(GetName(), damagee, damager, 2, 0, false, true); + } + + public boolean UseCharge(Player player) + { + if (!_stored.containsKey(player)) + return false; + + int charges = _stored.get(player); + + if (charges <= 0) + return false; + + _stored.put(player, charges-1); + player.setLevel(charges-1); + + return true; + } + + @EventHandler + public void Recharge(UpdateEvent event) + { + for (Player cur : GetUsers()) + if (!_stored.containsKey(cur)) + { + _stored.put(cur, 0); + } + else + { + //Dont recharge while firing + if (_fired.containsKey(cur)) + if (!UtilTime.elapsed(_fired.get(cur), 1000 - (GetLevel(cur) * 50))) + continue; + + int charges = _stored.get(cur); + + if (charges >= 3 + (1 * GetLevel(cur))) + continue; + + if (!Recharge.Instance.use(cur, GetName() + " Recharge", 100 - (GetLevel(cur) * 10), false)) + continue; + + charges += 1; + + _stored.put(cur, charges); + + cur.setLevel(charges); + } + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Arrow arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid() || arrow.getTicksLived() > 300) + { + arrowIterator.remove(); + arrow.remove(); + } + } + } + + @Override + public void Reset(Player player) + { + _stored.remove(player); + _fired.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Pounce.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Pounce.class new file mode 100644 index 000000000..c4ec3881c Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Pounce.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/SpiderForm.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/SpiderForm.class new file mode 100644 index 000000000..349fc854a Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/SpiderForm.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/SpinWeb.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/SpinWeb.class new file mode 100644 index 000000000..07e806bda Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/SpinWeb.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/Construction.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/Construction.class new file mode 100644 index 000000000..6466f350e Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/Construction.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/Propel.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/Propel.class new file mode 100644 index 000000000..592460459 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/Propel.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/SquidForm.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/SquidForm.class new file mode 100644 index 000000000..f859b361c Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/SquidForm.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Wolf/WolfForm.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Wolf/WolfForm.class new file mode 100644 index 000000000..2bb5b039c Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Wolf/WolfForm.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Polysmash.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Polysmash.class new file mode 100644 index 000000000..4dfb987a5 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Polysmash.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Shifter.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Shifter.class new file mode 100644 index 000000000..ebb67054d Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/Shifter.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/TreeShift$1.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/TreeShift$1.class new file mode 100644 index 000000000..14c1cb0a1 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/TreeShift$1.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/TreeShift.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/TreeShift.class new file mode 100644 index 000000000..aed9e6cd5 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/TreeShift.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/TreeShiftBlock.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/TreeShiftBlock.class new file mode 100644 index 000000000..6ec45603d Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Shifter/TreeShiftBlock.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Skill.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Skill.class new file mode 100644 index 000000000..a6fa2d8cc Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/Skill.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/SkillActive.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/SkillActive.class new file mode 100644 index 000000000..9e3a6743e Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/SkillActive.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/SkillFactory.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/SkillFactory.class new file mode 100644 index 000000000..9b52eebc2 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/SkillFactory.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/event/SkillEvent.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/event/SkillEvent.class new file mode 100644 index 000000000..59a280883 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/event/SkillEvent.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/event/SkillTriggerEvent.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/event/SkillTriggerEvent.class new file mode 100644 index 000000000..0187db5e9 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/event/SkillTriggerEvent.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/repository/SkillRepository$1.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/repository/SkillRepository$1.class new file mode 100644 index 000000000..ff7b5b6b9 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/repository/SkillRepository$1.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/repository/SkillRepository.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/repository/SkillRepository.class new file mode 100644 index 000000000..eade0db4c Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/repository/SkillRepository.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/repository/token/SkillToken.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/repository/token/SkillToken.class new file mode 100644 index 000000000..3e26c309f Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/Skill/repository/token/SkillToken.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Consume/Apple.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Consume/Apple.class new file mode 100644 index 000000000..20babde46 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Consume/Apple.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Consume/Soup.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Consume/Soup.class new file mode 100644 index 000000000..46dd36d0c Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Consume/Soup.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/IItem.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/IItem.class new file mode 100644 index 000000000..2e4b9b360 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/IItem.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/IItemFactory.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/IItemFactory.class new file mode 100644 index 000000000..11ddfb82d Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/IItemFactory.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Item.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Item.class new file mode 100644 index 000000000..17a31d692 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Item.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/ItemFactory.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/ItemFactory.class new file mode 100644 index 000000000..dfaf45471 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/ItemFactory.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/ItemUsable.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/ItemUsable.class new file mode 100644 index 000000000..f9056ada6 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/ItemUsable.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/Pistol.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/Pistol.class new file mode 100644 index 000000000..52faefa66 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/Pistol.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/PoisonBall.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/PoisonBall.class new file mode 100644 index 000000000..34e5ba61d Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/PoisonBall.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.class new file mode 100644 index 000000000..855513397 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.class new file mode 100644 index 000000000..bd68b29f1 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.class new file mode 100644 index 000000000..0d6c2d45a Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/Web.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/Web.class new file mode 100644 index 000000000..f6f09bc90 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Throwable/Web.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Tools/Scanner.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Tools/Scanner.class new file mode 100644 index 000000000..62b28d2f3 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/Tools/Scanner.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/repository/ItemRepository$1.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/repository/ItemRepository$1.class new file mode 100644 index 000000000..2384fea1a Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/repository/ItemRepository$1.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/repository/ItemRepository.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/repository/ItemRepository.class new file mode 100644 index 000000000..e91347add Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/repository/ItemRepository.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/repository/ItemToken.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/repository/ItemToken.class new file mode 100644 index 000000000..6202f62f0 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/item/repository/ItemToken.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/itempack/ItemPack.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/itempack/ItemPack.class new file mode 100644 index 000000000..9402c9cac Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/itempack/ItemPack.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/itempack/ItemPackFactory.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/itempack/ItemPackFactory.class new file mode 100644 index 000000000..56969f617 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/itempack/ItemPackFactory.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/ClassCombatCustomBuildShop.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/ClassCombatCustomBuildShop.class new file mode 100644 index 000000000..1a197d060 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/ClassCombatCustomBuildShop.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/ClassCombatPurchaseShop.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/ClassCombatPurchaseShop.class new file mode 100644 index 000000000..479563331 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/ClassCombatPurchaseShop.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.class new file mode 100644 index 000000000..1d1fb3a54 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/ClassShopManager.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/ClassShopManager.class new file mode 100644 index 000000000..b7c0b4028 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/ClassShopManager.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/DeleteCustomBuildButton.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/DeleteCustomBuildButton.class new file mode 100644 index 000000000..f839b7ebb Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/DeleteCustomBuildButton.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/EditAndDontSaveCustomBuildButton.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/EditAndDontSaveCustomBuildButton.class new file mode 100644 index 000000000..04c5edea1 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/EditAndDontSaveCustomBuildButton.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/EditAndSaveCustomBuildButton.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/EditAndSaveCustomBuildButton.class new file mode 100644 index 000000000..e51c2cd92 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/EditAndSaveCustomBuildButton.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/PurchaseSkillButton.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/PurchaseSkillButton.class new file mode 100644 index 000000000..f895c33ec Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/PurchaseSkillButton.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/SelectClassButton.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/SelectClassButton.class new file mode 100644 index 000000000..96631e23b Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/SelectClassButton.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/SelectCustomBuildButton.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/SelectCustomBuildButton.class new file mode 100644 index 000000000..c51d11210 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/SelectCustomBuildButton.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/SelectSkillButton.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/SelectSkillButton.class new file mode 100644 index 000000000..3cc2f49b2 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/button/SelectSkillButton.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/page/ArmorPage.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/page/ArmorPage.class new file mode 100644 index 000000000..4ff3af57a Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/page/ArmorPage.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/page/CustomBuildPage.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/page/CustomBuildPage.class new file mode 100644 index 000000000..e52dcaf39 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/page/CustomBuildPage.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/page/SkillPage$1.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/page/SkillPage$1.class new file mode 100644 index 000000000..d9da08951 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/page/SkillPage$1.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/page/SkillPage.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/page/SkillPage.class new file mode 100644 index 000000000..e3ca4e516 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/page/SkillPage.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.class b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.class new file mode 100644 index 000000000..0e3e3a591 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.ClassCombat/bin/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java new file mode 100644 index 000000000..4625a6cef --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java @@ -0,0 +1,193 @@ +package mineplex.minecraft.game.classcombat.Class; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.Class.repository.ClassRepository; +import mineplex.minecraft.game.classcombat.Class.repository.token.ClassToken; +import mineplex.minecraft.game.classcombat.Class.repository.token.ClientClassTokenWrapper; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.core.MiniClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.account.event.ClientWebResponseEvent; +import mineplex.core.donation.DonationManager; +import mineplex.core.donation.repository.GameSalesPackageToken; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; + +import org.bukkit.Material; +import org.bukkit.craftbukkit.libs.com.google.gson.Gson; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + +public class ClassManager extends MiniClientPlugin implements IClassFactory +{ + private CoreClientManager _clientManager; + private DonationManager _donationManager; + private SkillFactory _skillFactory; + private ClassRepository _repository; + private HashMap _classes; + private HashMap _classSalesPackageIdMap; + + private ClassRestore _classRestore; + + private Object _clientLock = new Object(); + + public ClassManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, SkillFactory skillFactory, String webAddress) + { + super("Class Manager", plugin); + + _plugin = plugin; + _clientManager = clientManager; + _donationManager = donationManager; + _skillFactory = skillFactory; + _repository = new ClassRepository(webAddress); + _classes = new HashMap(); + _classSalesPackageIdMap = new HashMap(); + + PopulateClasses(); + } + + @EventHandler + public void OnClientWebResponse(ClientWebResponseEvent event) + { + ClientClassTokenWrapper token = new Gson().fromJson(event.GetResponse(), ClientClassTokenWrapper.class); + LoadClassBuilds(token); + } + + private void LoadClassBuilds(ClientClassTokenWrapper token) + { + synchronized (_clientLock) + { + Set(token.Name, new ClientClass(this, _skillFactory, _clientManager.Get(token.Name), _donationManager.Get(token.Name), token.DonorToken)); + } + } + + public ClientClass Get(String name) + { + synchronized (_clientLock) + { + return super.Get(name); + } + } + + private void PopulateClasses() + { + _classes.clear(); + AddClass(new PvpClass(this, -1, ClassType.Knight, + new String[] { "Trained in the arts of melee combat.", "Able to stand his ground against foes."}, + Material.IRON_HELMET, Material.IRON_CHESTPLATE, Material.IRON_LEGGINGS, Material.IRON_BOOTS, + null)); + + AddClass(new PvpClass(this, -1, ClassType.Ranger, + new String[] { "Mastery with a Bow and Arrow.", "Adept in Wilderness Survival" }, + Material.CHAINMAIL_HELMET, Material.CHAINMAIL_CHESTPLATE, Material.CHAINMAIL_LEGGINGS, Material.CHAINMAIL_BOOTS, + null)); + + AddClass(new PvpClass(this, 3, ClassType.Brute, + new String[] { "Uses pure strength to dominate.", "Great at crowd control."}, + Material.DIAMOND_HELMET, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_LEGGINGS, Material.DIAMOND_BOOTS, + null)); + + AddClass(new PvpClass(this, 4, ClassType.Mage, + new String[] { "Trained in the ancient arts.", "Able to adapt to many roles in combat."}, + Material.GOLD_HELMET, Material.GOLD_CHESTPLATE, Material.GOLD_LEGGINGS, Material.GOLD_BOOTS, + null)); + + AddClass(new PvpClass(this, 5, ClassType.Assassin, + new String[] { "Extremely nimble and smart.", "Excels at ambushing and takedowns.", "", "Permanent Speed II" }, + Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS, + null)); + + /* + AddClass(new PvpClass(this, 6, ClassType.Shapeshifter, + new String[] { "Able to transform into various creatures." }, + Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS, + Color.fromRGB(20, 100, 0))); + */ + + List classTokens = new ArrayList(); + + for (IPvpClass pvpClass : _classes.values()) + { + ClassToken classToken = new ClassToken(); + classToken.Name = pvpClass.GetName(); + classToken.SalesPackage = new GameSalesPackageToken(); + classToken.SalesPackage.Gems = pvpClass.GetCost(); + + classTokens.add(classToken); + } + + for (ClassToken classToken : _repository.GetClasses(classTokens)) + { + if (_classes.containsKey(classToken.Name)) + { + _classes.get(classToken.Name).Update(classToken); + _classSalesPackageIdMap.put(classToken.SalesPackage.GameSalesPackageId, _classes.get(classToken.Name)); + } + } + } + + public IPvpClass GetClass(String className) + { + return _classes.get(className); + } + + public IPvpClass GetClass(int id) + { + return _classSalesPackageIdMap.get(id); + } + + public Collection GetAllClasses() + { + return _classes.values(); + } + + public void AddClass(PvpClass newClass) + { + _classes.put(newClass.GetName(), newClass); + } + + @Override + public Collection GetGameClasses() + { + return _classes.values(); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (IPvpClass cur : _classes.values()) + cur.checkEquip(); + } + + public SkillFactory GetSkillFactory() + { + return _skillFactory; + } + + public ClassRestore GetRestore() + { + if (_classRestore == null) + _classRestore = new ClassRestore(_plugin, this, _skillFactory); + + return _classRestore; + } + + @Override + protected ClientClass AddPlayer(String player) + { + return new ClientClass(this, _skillFactory, _clientManager.Get(player), _donationManager.Get(player), null); + } + + public ClassRepository GetRepository() + { + return _repository; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassRestore.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassRestore.java new file mode 100644 index 000000000..b9cb1f08a --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassRestore.java @@ -0,0 +1,258 @@ +package mineplex.minecraft.game.classcombat.Class; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.F; +import mineplex.minecraft.game.classcombat.Skill.ISkill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result; +import org.bukkit.plugin.java.JavaPlugin; + +public class ClassRestore extends MiniPlugin +{ + private ClassManager _classManager; + private SkillFactory _skillFactory; + private boolean _active = false; + private String _folder = "data/classbuilds/"; + + private HashMap>> _skills = new HashMap>>(); + + public ClassRestore(JavaPlugin plugin, ClassManager classManager, SkillFactory skillFactory) + { + super("Class Restore", plugin); + + _classManager = classManager; + _skillFactory = skillFactory; + + File file = new File(_folder); + file.mkdirs(); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void Join(AsyncPlayerPreLoginEvent event) + { + if (!_active) + return; + + if (event.getLoginResult() != Result.ALLOWED) + return; + + ReadBuilds(event.getName()); + } + + @EventHandler + public void Quit(PlayerQuitEvent event) + { + if (!_active) + return; + + WriteBuilds(event.getPlayer().getName()); + } + + public Collection GetBuild(String name, IPvpClass gameClass) + { + if (!_active) + return null; + + if (!_skills.containsKey(name)) + return null; + + if (!_skills.get(name).containsKey(gameClass)) + return null; + + return _skills.get(name).get(gameClass); + } + + public void SaveBuild(String name, IPvpClass gameClass, Collection skills) + { + if (!_active) + return; + + if (!_skills.containsKey(name)) + _skills.put(name, new HashMap>()); + + //Replace Old + _skills.get(name).put(gameClass, new ArrayList()); + + //Insert Skills + for (ISkill skill : skills) + _skills.get(name).get(gameClass).add(skill); + } + + public boolean IsActive() + { + return _active; + } + + public void Activate() + { + _active = true; + } + + /* FORMAT + * + * Assassin 5 Bulls Charge + * + */ + + public void WriteBuilds(String player) + { + if (!_skills.containsKey(player)) + return; + + System.out.println("Writing Build: " + player); + + FileWriter fstream = null; + BufferedWriter out = null; + + try + { + fstream = new FileWriter(_folder + player + ".dat"); + out = new BufferedWriter(fstream); + + HashMap> builds = _skills.get(player); + + for (IPvpClass gameClass : builds.keySet()) + for (ISkill skill : builds.get(gameClass)) + out.write(gameClass.GetName() + " " + skill.GetName() + "\n"); + } + catch (Exception e) + { + System.err.println("Build Write Error: " + e.getMessage()); + } + finally + { + if (out != null) + { + try + { + out.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + public void ReadBuilds(String player) + { + System.out.println("Reading Build: " + player); + + FileInputStream fstream = null; + DataInputStream in = null; + BufferedReader br = null; + + try + { + File f = new File(_folder + player + ".dat"); + + if (!f.exists()) + return; + + if (!_skills.containsKey(player)) + _skills.put(player, new HashMap>()); + + fstream = new FileInputStream(f); + in = new DataInputStream(fstream); + br = new BufferedReader(new InputStreamReader(in)); + String strLine; + + while ((strLine = br.readLine()) != null) + { + String[] tokens = strLine.split(" "); + + if (tokens.length < 3) + continue; + + try + { + //Class + IPvpClass gameClass = _classManager.GetClass(tokens[0]); + + if (!_skills.get(player).containsKey(gameClass)) + _skills.get(player).put(gameClass, new ArrayList()); + + ISkill skill = _skillFactory.GetSkill(F.combine(tokens, 2, null, false)); + + _skills.get(player).get(gameClass).add(skill); + } + catch (Exception e) + { + System.err.println("Build Parse Error: " + e.getMessage()); + } + } + } + catch (Exception e) + { + System.err.println("Build Read Error: " + e.getMessage()); + } + finally + { + if (br != null) + { + try + { + br.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (in != null) + { + try + { + in.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java new file mode 100644 index 000000000..c143b51e3 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java @@ -0,0 +1,517 @@ +package mineplex.minecraft.game.classcombat.Class; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map.Entry; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.donation.Donor; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.Class.repository.token.ClientClassToken; +import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; +import mineplex.minecraft.game.classcombat.Class.repository.token.SlotToken; +import mineplex.minecraft.game.classcombat.Skill.ISkill; +import mineplex.minecraft.game.classcombat.Skill.ISkill.SkillType; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class ClientClass +{ + private ClassManager _classFactory; + private SkillFactory _skillFactory; + private CoreClient _client; + private Donor _donor; + + private IPvpClass _gameClass; + private NautHashMap _skillMap = new NautHashMap(); + + private IPvpClass _lastClass; + private NautHashMap _lastItems = new NautHashMap(); + private ItemStack[] _lastArmor = new ItemStack[4]; + private NautHashMap _lastSkillMap = new NautHashMap(); + + private NautHashMap> _customBuilds; + private NautHashMap _activeCustomBuilds; + + private CustomBuildToken _savingCustomBuild; + + public ClientClass(ClassManager classFactory, SkillFactory skillFactory, CoreClient client, Donor donor, ClientClassToken token) + { + _classFactory = classFactory; + _skillFactory = skillFactory; + _client = client; + _donor = donor; + + Load(token); + } + + public void Load(ClientClassToken token) + { + _customBuilds = new NautHashMap>(); + _activeCustomBuilds = new NautHashMap(); + + for (IPvpClass pvpClass : _classFactory.GetAllClasses()) + { + _customBuilds.put(pvpClass, new HashMap()); + } + + for (CustomBuildToken buildToken : token.CustomBuilds) + { + IPvpClass pvpClass = _classFactory.GetClass(buildToken.PvpClassId); + + ISkill swordSkill = _skillFactory.GetSkillBySalesPackageId(buildToken.SwordSkillId); + ISkill axeSkill = _skillFactory.GetSkillBySalesPackageId(buildToken.AxeSkillId); + ISkill bowSkill = _skillFactory.GetSkillBySalesPackageId(buildToken.BowSkillId); + ISkill classPassiveASkill = _skillFactory.GetSkillBySalesPackageId(buildToken.ClassPassiveASkillId); + ISkill classPassiveBSkill = _skillFactory.GetSkillBySalesPackageId(buildToken.ClassPassiveBSkillId); + ISkill globalPassive = _skillFactory.GetSkillBySalesPackageId(buildToken.GlobalPassiveSkillId); + + if (!ValidSkill(buildToken.SwordSkillId, swordSkill, SkillType.Sword)) + continue; + + if (!ValidSkill(buildToken.AxeSkillId, axeSkill, SkillType.Axe)) + continue; + + if (!ValidSkill(buildToken.BowSkillId, bowSkill, SkillType.Bow)) + continue; + + if (!ValidSkill(buildToken.ClassPassiveASkillId, classPassiveASkill, SkillType.PassiveA)) + continue; + + if (!ValidSkill(buildToken.ClassPassiveBSkillId, classPassiveBSkill, SkillType.PassiveB)) + continue; + + if (!ValidSkill(buildToken.GlobalPassiveSkillId, globalPassive, SkillType.GlobalPassive)) + continue; + + _customBuilds.get(pvpClass).put(buildToken.CustomBuildNumber, buildToken); + } + } + + public NautHashMap GetDefaultItems() + { + return _lastItems; + } + + public void SetDefaultHead(ItemStack armor) + { + _lastArmor[3] = armor; + } + + public void SetDefaultChest(ItemStack armor) + { + _lastArmor[2] = armor; + } + + public void SetDefaultLegs(ItemStack armor) + { + _lastArmor[1] = armor; + } + + public void SetDefaultFeet(ItemStack armor) + { + _lastArmor[0] = armor; + } + + public void SaveActiveCustomBuild() + { + if (GetGameClass() == null) + return; + + _savingCustomBuild.PvpClassId = GetGameClass().GetSalesPackageId(); + _savingCustomBuild.PlayerName = _client.GetPlayerName(); + + ISkill swordSkill = GetSkillByType(SkillType.Sword); + + if (swordSkill != null) + _savingCustomBuild.SwordSkillId = swordSkill.GetSalesPackageId(); + else + _savingCustomBuild.SwordSkillId = -1; + + ISkill axeSkill = GetSkillByType(SkillType.Axe); + + if (axeSkill != null) + _savingCustomBuild.AxeSkillId = axeSkill.GetSalesPackageId(); + else + _savingCustomBuild.AxeSkillId = -1; + + ISkill bowSkill = GetSkillByType(SkillType.Bow); + + if (bowSkill != null) + _savingCustomBuild.BowSkillId = bowSkill.GetSalesPackageId(); + else + _savingCustomBuild.BowSkillId = -1; + + ISkill passiveASkill = GetSkillByType(SkillType.PassiveA); + + if (passiveASkill != null) + _savingCustomBuild.ClassPassiveASkillId = passiveASkill.GetSalesPackageId(); + else + _savingCustomBuild.ClassPassiveASkillId = -1; + + + ISkill passiveBSkill = GetSkillByType(SkillType.PassiveB); + + if (passiveBSkill != null) + _savingCustomBuild.ClassPassiveBSkillId = passiveBSkill.GetSalesPackageId(); + else + _savingCustomBuild.ClassPassiveBSkillId = -1; + + ISkill globalPassiveSkill = GetSkillByType(SkillType.GlobalPassive); + + if (globalPassiveSkill != null) + _savingCustomBuild.GlobalPassiveSkillId = globalPassiveSkill.GetSalesPackageId(); + else + _savingCustomBuild.GlobalPassiveSkillId = -1; + + _savingCustomBuild.Slots = new ArrayList(9); + + _classFactory.GetRepository().SaveCustomBuild(_savingCustomBuild); + _savingCustomBuild = null; + } + + public void SetSavingCustomBuild(IPvpClass pvpClass, CustomBuildToken customBuild) + { + _savingCustomBuild = customBuild; + _customBuilds.get(pvpClass).put(_savingCustomBuild.CustomBuildNumber, _savingCustomBuild); + } + + public void SetActiveCustomBuild(IPvpClass pvpClass, CustomBuildToken customBuild) + { + customBuild.Active = true; + _activeCustomBuilds.put(pvpClass, customBuild); + } + + public CustomBuildToken GetActiveCustomBuild(IPvpClass pvpClass) + { + return _activeCustomBuilds.get(pvpClass); + } + + public CustomBuildToken GetSavingCustomBuild() + { + return _savingCustomBuild; + } + + public boolean IsSavingCustomBuild() + { + return _savingCustomBuild != null; + } + + public HashMap GetCustomBuilds(IPvpClass pvpClass) + { + return _customBuilds.get(pvpClass); + } + + public void EquipCustomBuild(CustomBuildToken customBuild) + { + EquipCustomBuild(customBuild, true); + } + + public void EquipCustomBuild(CustomBuildToken customBuild, boolean notify) + { + _lastClass = _classFactory.GetClass(customBuild.PvpClassId); + + if (_lastClass == null) + return; + + _lastSkillMap.remove(SkillType.Class); + + SetDefaultHead(ItemStackFactory.Instance.CreateStack(_lastClass.GetHead())); + SetDefaultChest(ItemStackFactory.Instance.CreateStack(_lastClass.GetChestplate())); + SetDefaultLegs(ItemStackFactory.Instance.CreateStack(_lastClass.GetLeggings())); + SetDefaultFeet(ItemStackFactory.Instance.CreateStack(_lastClass.GetBoots())); + + if (customBuild.SwordSkillId != -1) + _lastSkillMap.put(SkillType.Sword, _skillFactory.GetSkillBySalesPackageId(customBuild.SwordSkillId)); + else + _lastSkillMap.remove(SkillType.Sword); + + if (customBuild.AxeSkillId != -1) + _lastSkillMap.put(SkillType.Axe, _skillFactory.GetSkillBySalesPackageId(customBuild.AxeSkillId)); + else + _lastSkillMap.remove(SkillType.Axe); + + if (customBuild.BowSkillId != -1) + _lastSkillMap.put(SkillType.Bow, _skillFactory.GetSkillBySalesPackageId(customBuild.BowSkillId)); + else + _lastSkillMap.remove(SkillType.Bow); + + if (customBuild.ClassPassiveASkillId != -1) + _lastSkillMap.put(SkillType.PassiveA, _skillFactory.GetSkillBySalesPackageId(customBuild.ClassPassiveASkillId)); + else + _lastSkillMap.remove(SkillType.PassiveA); + + if (customBuild.ClassPassiveBSkillId != -1) + _lastSkillMap.put(SkillType.PassiveB, _skillFactory.GetSkillBySalesPackageId(customBuild.ClassPassiveBSkillId)); + else + _lastSkillMap.remove(SkillType.PassiveB); + + if (customBuild.GlobalPassiveSkillId != -1) + _lastSkillMap.put(SkillType.GlobalPassive, _skillFactory.GetSkillBySalesPackageId(customBuild.GlobalPassiveSkillId)); + else + _lastSkillMap.remove(SkillType.GlobalPassive); + + ResetToDefaults(true, false); + + if (notify) + { + ListSkills(_client.GetPlayer()); + _client.GetPlayer().getWorld().playSound(_client.GetPlayer().getLocation(), Sound.LEVEL_UP, 1f, 1f); + + _client.GetPlayer().sendMessage(F.main("Class", "You equipped " + F.skill(customBuild.Name) + ".")); + } + } + + public void ListSkills(Player caller) + { + UtilPlayer.message(caller, F.main("Skill", "Listing Class Skills:")); + + for (SkillType type : SkillType.values()) + if (caller.isOp() || type != SkillType.Class) + if (_skillMap.containsKey(type)) + UtilPlayer.message(caller, F.desc(type.toString(), _skillMap.get(type).GetName())); + } + + public void ResetSkills(Player player) + { + for (ISkill skill : GetSkills()) + { + skill.Reset(player); + } + } + + public void ResetToDefaults(boolean equipItems, boolean equipDefaultArmor) + { + if (_lastClass == null) + { + _lastClass = _classFactory.GetClass("Knight"); + + _lastArmor[3] = ItemStackFactory.Instance.CreateStack(_lastClass.GetHead()); + _lastArmor[2] = ItemStackFactory.Instance.CreateStack(_lastClass.GetChestplate()); + _lastArmor[1] = ItemStackFactory.Instance.CreateStack(_lastClass.GetLeggings()); + _lastArmor[0] = ItemStackFactory.Instance.CreateStack(_lastClass.GetBoots()); + + for (ISkill skill : _lastClass.GetDefaultSkills().keySet()) + { + if (skill.GetSkillType() != SkillType.Class) + _lastSkillMap.put(skill.GetSkillType(), skill); + } + } + + SetGameClass(_lastClass); + + if (equipDefaultArmor) + { + if (_lastArmor[3] != null) + _client.GetPlayer().getInventory().setHelmet(_lastArmor[3].clone()); + + if (_lastArmor[2] != null) + _client.GetPlayer().getInventory().setChestplate(_lastArmor[2].clone()); + + if (_lastArmor[1] != null) + _client.GetPlayer().getInventory().setLeggings(_lastArmor[1].clone()); + + if (_lastArmor[0] != null) + _client.GetPlayer().getInventory().setBoots(_lastArmor[0].clone()); + } + + if (equipItems) + { + PutDefaultItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), 0); + PutDefaultItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), 1); + + for (int i = 2; i < 9; i++) + { + PutDefaultItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), i); + } + + if (_gameClass.GetType() == ClassType.Assassin || _gameClass.GetType() == ClassType.Ranger) + { + PutDefaultItem(ItemStackFactory.Instance.CreateStack(Material.BOW), 2); + PutDefaultItem( ItemStackFactory.Instance.CreateStack(Material.ARROW, _gameClass.GetType() == ClassType.Assassin ? 16 : 32), 3); + } + else + { + if (_gameClass.GetType() != ClassType.Mage) + { + PutDefaultItem(ItemStackFactory.Instance.CreateStack(Material.POTION), 8); + } + else + { + PutDefaultItem(ItemStackFactory.Instance.CreateStack(Material.WEB, 2), 8); + } + } + + _client.GetPlayer().getInventory().clear(); + + for (Entry defaultItem : GetDefaultItems().entrySet()) + { + _client.GetPlayer().getInventory().setItem(defaultItem.getKey(), defaultItem.getValue()); + } + } + + ClearSkills(); + + for (ISkill cur : _gameClass.GetDefaultSkills().keySet()) + { + if (cur.GetSkillType() == SkillType.Class) + AddSkill(cur); + } + + for (ISkill skill : _lastSkillMap.values()) + AddSkill(skill); + } + + public void ClearSkills() + { + if (_skillMap != null) + for (ISkill skill : _skillMap.values()) + skill.RemoveUser(_client.GetPlayer()); + + _skillMap.clear(); + } + + public void ClearDefaultSkills() + { + _lastSkillMap = new NautHashMap(); + } + + public void SetGameClass(IPvpClass gameClass) + { + ClearSkills(); + + _gameClass = gameClass; + + if (_gameClass == null) + return; + + //Load Saved + if (_classFactory.GetRestore().IsActive()) + { + Collection skills = _classFactory.GetRestore().GetBuild(_client.GetPlayerName(), gameClass); + + if (skills != null) + { + for (ISkill skill : skills) + AddSkill(skill); + + //Inform + UtilPlayer.message(_client.GetPlayer(), F.main("Class", "Armor Class: " + F.oo(_gameClass.GetName(), true))); + return; + } + } + + for (ISkill cur : gameClass.GetDefaultSkills().keySet()) + { + if (cur.GetSkillType() == SkillType.Class) + AddSkill(cur); + } + + //Inform + UtilPlayer.message(_client.GetPlayer(), F.main("Class", "Armor Class: " + F.oo(_gameClass.GetName(), true))); + + } + + public IPvpClass GetGameClass() + { + return _gameClass; + } + + public boolean IsGameClass(ClassType type) + { + if (GetGameClass() == null) + return false; + + return GetGameClass().GetType() == type; + } + + public Collection GetSkills() + { + if (_skillMap == null) + _skillMap = new NautHashMap(); + + return _skillMap.values(); + } + + public Collection GetDefaultSkills() + { + return _lastSkillMap.values(); + } + + public ISkill GetSkillByType(SkillType skillType) + { + if (_skillMap == null) + _skillMap = new NautHashMap(); + + if (_skillMap.containsKey(skillType)) + return _skillMap.get(skillType); + + return null; + } + + public void AddSkill(ISkill skill) + { + if (_skillMap == null) + _skillMap = new NautHashMap(); + + if (_skillMap.get(skill.GetSkillType()) != null) + _skillMap.get(skill.GetSkillType()).RemoveUser(_client.GetPlayer()); + + _skillMap.put(skill.GetSkillType(), skill); + _lastSkillMap.put(skill.GetSkillType(), skill); + + skill.AddUser(_client.GetPlayer()); + + //Save + if (_classFactory.GetRestore().IsActive()) + _classFactory.GetRestore().SaveBuild(_client.GetPlayerName(), _gameClass, GetSkills()); + } + + public void RemoveSkill(ISkill skill) + { + if (skill == null) + return; + + if (_skillMap == null) + return; + + _skillMap.remove(skill.GetSkillType()); + + skill.RemoveUser(_client.GetPlayer()); + } + + public ItemStack[] GetDefaultArmor() + { + return _lastArmor; + } + + public void PutDefaultItem(ItemStack value, Integer key) + { + _lastItems.put(key, value); + } + + public void ClearDefaults() + { + _lastItems.clear(); + _lastArmor = new ItemStack[4]; + _lastSkillMap.clear(); + } + + private boolean ValidSkill(int skillId, ISkill skill, SkillType expectedType) + { + if (skillId != -1 && (skill == null || skill.GetSkillType() != expectedType || (!skill.IsFree() && !_donor.Owns(skillId) && !_client.GetRank().Has(Rank.ULTRA) && _donor.OwnsUnknownPackage("Competitive ULTRA")))) + return false; + + return true; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/IClassFactory.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/IClassFactory.java new file mode 100644 index 000000000..d6ab7b30a --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/IClassFactory.java @@ -0,0 +1,8 @@ +package mineplex.minecraft.game.classcombat.Class; + +import java.util.Collection; + +public interface IClassFactory +{ + Collection GetGameClasses(); +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/IPvpClass.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/IPvpClass.java new file mode 100644 index 000000000..f01858360 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/IPvpClass.java @@ -0,0 +1,41 @@ +package mineplex.minecraft.game.classcombat.Class; + +import java.util.HashMap; +import java.util.HashSet; + +import mineplex.minecraft.game.classcombat.Class.repository.token.ClassToken; +import mineplex.minecraft.game.classcombat.Skill.ISkill; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public interface IPvpClass +{ + public enum ClassType + { + Global, + Knight, + Ranger, + Assassin, + Mage, + Brute, + Shifter + } + + int GetSalesPackageId(); + String GetName(); + ClassType GetType(); + Material GetHead(); + Material GetChestplate(); + Material GetLeggings(); + Material GetBoots(); + HashSet GetSkills(); + HashMap GetDefaultSkills(); + + void checkEquip(); + Integer GetCost(); + boolean IsFree(); + void Update(ClassToken classToken); + String[] GetDesc(); + void ApplyArmor(Player caller); +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java new file mode 100644 index 000000000..295581f34 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java @@ -0,0 +1,306 @@ +package mineplex.minecraft.game.classcombat.Class; + +import java.util.HashMap; +import java.util.HashSet; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.minecraft.game.classcombat.Class.repository.token.ClassToken; +import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; +import mineplex.minecraft.game.classcombat.Skill.ISkill; + +import org.bukkit.Bukkit; +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; +import org.bukkit.inventory.meta.LeatherArmorMeta; + +public class PvpClass implements IPvpClass +{ + private ClassType _type; + private int _salesPackageId; + private String[] _desc; + private int _cost; + private boolean _free; + + private Material _head; + private Material _chest; + private Material _legs; + private Material _boots; + + private Color _leatherColor = null; + + private HashSet _skillSet; + private HashMap _skillDefault; + + private ClassManager _classes; + + public PvpClass(ClassManager classes, int salesPackageId, ClassType type, String[] desc, Material head, Material chest, Material legs, Material boots, Color leatherColor) + { + _classes = classes; + _salesPackageId = salesPackageId; + _cost = 5000; + _desc = desc; + + _type = type; + + _head = head; + _chest = chest; + _legs = legs; + _boots = boots; + + _skillSet = new HashSet(); + _skillSet.addAll(_classes.GetSkillFactory().GetSkillsFor(this)); + _skillSet.addAll(_classes.GetSkillFactory().GetGlobalSkills()); + + _skillDefault = _classes.GetSkillFactory().GetDefaultSkillsFor(this); + + _leatherColor = leatherColor; + } + + @Override + public String GetName() + { + return _type.name(); + } + + @Override + public ClassType GetType() + { + return _type; + } + + @Override + public Material GetHead() + { + return _head; + } + + @Override + public Material GetChestplate() + { + return _chest; + } + + @Override + public Material GetLeggings() + { + return _legs; + } + + @Override + public Material GetBoots() + { + return _boots; + } + + @Override + public HashSet GetSkills() + { + return _skillSet; + } + + @Override + public HashMap GetDefaultSkills() + { + return _skillDefault; + } + + public void checkEquip() + { + for (Player cur : Bukkit.getOnlinePlayers()) + { + ClientClass client = _classes.Get(cur); + + //Check Unequip + if (client.GetGameClass() != null) + if (client.GetGameClass().GetType() == _type) + { + PlayerInventory inv = cur.getInventory(); + + //Helm + if (_head != null) + if (!UtilGear.isMat(inv.getHelmet(), _head)) + { + Unequip(cur); + continue; + } + + //Chest + if (_chest != null) + if (!UtilGear.isMat(inv.getChestplate(), _chest)) + { + Unequip(cur); + continue; + } + + //Legs + if (_legs != null) + if (!UtilGear.isMat(inv.getLeggings(), _legs)) + { + Unequip(cur); + continue; + } + + //Boots + if (_boots != null) + if (!UtilGear.isMat(inv.getBoots(), _boots)) + { + Unequip(cur); + continue; + } + + if (_leatherColor != null) + { + if (!((LeatherArmorMeta)inv.getHelmet().getItemMeta()).getColor().equals(_leatherColor) || + !((LeatherArmorMeta)inv.getChestplate().getItemMeta()).getColor().equals(_leatherColor)|| + !((LeatherArmorMeta)inv.getLeggings().getItemMeta()).getColor().equals(_leatherColor) || + !((LeatherArmorMeta)inv.getBoots().getItemMeta()).getColor().equals(_leatherColor)) + { + Unequip(cur); + continue; + } + } + } + + //Check Equip + if (client.GetGameClass() == null || client.GetGameClass().GetType() == null || + (_leatherColor != null && client.GetGameClass().GetType() != this.GetType())) + { + PlayerInventory inv = cur.getInventory(); + + //Helm + if (_head != null) + if (!UtilGear.isMat(inv.getHelmet(), _head)) + continue; + + //Chest + if (_chest != null) + if (!UtilGear.isMat(inv.getChestplate(), _chest)) + continue; + + //Legs + if (_legs != null) + if (!UtilGear.isMat(inv.getLeggings(), _legs)) + continue; + + //Boots + if (_boots != null) + if (!UtilGear.isMat(inv.getBoots(), _boots)) + continue; + + if (_leatherColor != null) + { + if (!((LeatherArmorMeta)inv.getHelmet().getItemMeta()).getColor().equals(_leatherColor) || + !((LeatherArmorMeta)inv.getChestplate().getItemMeta()).getColor().equals(_leatherColor)|| + !((LeatherArmorMeta)inv.getLeggings().getItemMeta()).getColor().equals(_leatherColor) || + !((LeatherArmorMeta)inv.getBoots().getItemMeta()).getColor().equals(_leatherColor)) + continue; + } + + Equip(cur); + } + } + } + + public void Equip(Player player) + { + ClientClass client = _classes.Get(player); + + CustomBuildToken customBuild = client.GetActiveCustomBuild(this); + + if (customBuild != null) + { + client.EquipCustomBuild(customBuild); + } + else + { + client.SetGameClass(this); + } + + //Ensure Sneak Removed + player.setSneaking(false); + } + + public void Unequip(Player player) + { + _classes.Get(player).SetGameClass(null); + + UtilPlayer.message(player, F.main("Class", "Armor Class: " + F.oo("None", false))); + } + + @Override + public int GetSalesPackageId() + { + return _salesPackageId; + } + + @Override + public Integer GetCost() + { + return _cost; + } + + @Override + public String[] GetDesc() + { + return _desc; + } + + @Override + public boolean IsFree() + { + return _free; + } + + @Override + public void Update(ClassToken classToken) + { + _salesPackageId = classToken.SalesPackage.GameSalesPackageId; + _cost = classToken.SalesPackage.Gems; + _free = classToken.SalesPackage.Free; + } + + @Override + public void ApplyArmor(Player caller) + { + ItemStack head = ItemStackFactory.Instance.CreateStack(GetHead(), 1); + ItemStack chest = ItemStackFactory.Instance.CreateStack(GetChestplate(), 1); + ItemStack legs = ItemStackFactory.Instance.CreateStack(GetLeggings(), 1); + ItemStack boots = ItemStackFactory.Instance.CreateStack(GetBoots(), 1); + + if (_leatherColor != null) + { + LeatherArmorMeta meta; + + //Head + meta = (LeatherArmorMeta)head.getItemMeta(); + meta.setColor(_leatherColor); + head.setItemMeta(meta); + + //Chest + meta = (LeatherArmorMeta)chest.getItemMeta(); + meta.setColor(_leatherColor); + chest.setItemMeta(meta); + + //Legs + meta = (LeatherArmorMeta)legs.getItemMeta(); + meta.setColor(_leatherColor); + legs.setItemMeta(meta); + + //Boots + meta = (LeatherArmorMeta)boots.getItemMeta(); + meta.setColor(_leatherColor); + boots.setItemMeta(meta); + } + + caller.getInventory().setHelmet(head); + caller.getInventory().setChestplate(chest); + caller.getInventory().setLeggings(legs); + caller.getInventory().setBoots(boots); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/event/ClassSetupEvent.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/event/ClassSetupEvent.java new file mode 100644 index 000000000..ed5d5e828 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/event/ClassSetupEvent.java @@ -0,0 +1,94 @@ +package mineplex.minecraft.game.classcombat.Class.event; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ClassSetupEvent extends Event +{ + public enum SetupType + { + OpenMain, + + ApplyDefaultBuilt, + + OpenCustomBuilds, + + ApplyCustomBuild, + SaveEditCustomBuild, + EditCustomBuild, + DeleteCustomBuild, + + Close + } + + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private SetupType _actionType; + private ClassType _classType; + private int _position = 0; //0 = Null, 1-5 = Slot + private CustomBuildToken _classBuild; + + private boolean _cancelled = false; + + public ClassSetupEvent(Player player, SetupType type, ClassType classType, int position, CustomBuildToken build) + { + _player = player; + + _actionType = type; + _classType = classType; + + _position = position; + + _classBuild = build; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public SetupType GetType() + { + return _actionType; + } + + public int GetPosition() + { + return _position; + } + + public Player GetPlayer() + { + return _player; + } + + public ClassType GetClassType() + { + return _classType; + } + + public CustomBuildToken GetBuild() + { + return _classBuild; + } + + public void SetCancelled(boolean cancel) + { + _cancelled = cancel; + } + + public boolean IsCancelled() + { + return _cancelled; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/ClassRepository.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/ClassRepository.java new file mode 100644 index 000000000..2a80b70ae --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/ClassRepository.java @@ -0,0 +1,30 @@ +package mineplex.minecraft.game.classcombat.Class.repository; + +import java.util.List; + +import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; + +import mineplex.core.server.remotecall.AsyncJsonWebCall; +import mineplex.core.server.remotecall.JsonWebCall; +import mineplex.minecraft.game.classcombat.Class.repository.token.ClassToken; +import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; + +public class ClassRepository +{ + private String _webAddress; + + public ClassRepository(String webAddress) + { + _webAddress = webAddress; + } + + public List GetClasses(List pvpClasses) + { + return new JsonWebCall(_webAddress + "Dominate/GetClasses").Execute(new TypeToken>(){}.getType(), pvpClasses); + } + + public void SaveCustomBuild(CustomBuildToken token) + { + new AsyncJsonWebCall(_webAddress + "PlayerAccount/SaveCustomBuild").Execute(token); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/token/ClassToken.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/token/ClassToken.java new file mode 100644 index 000000000..d5ed28bc9 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/token/ClassToken.java @@ -0,0 +1,12 @@ +package mineplex.minecraft.game.classcombat.Class.repository.token; + +import mineplex.core.donation.repository.GameSalesPackageToken; + +public class ClassToken +{ + public int PvpClassId; + + public String Name; + + public GameSalesPackageToken SalesPackage; +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/token/ClientClassToken.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/token/ClientClassToken.java new file mode 100644 index 000000000..4fd876785 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/token/ClientClassToken.java @@ -0,0 +1,8 @@ +package mineplex.minecraft.game.classcombat.Class.repository.token; + +import java.util.List; + +public class ClientClassToken +{ + public List CustomBuilds; +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/token/ClientClassTokenWrapper.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/token/ClientClassTokenWrapper.java new file mode 100644 index 000000000..5e83a168a --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/token/ClientClassTokenWrapper.java @@ -0,0 +1,7 @@ +package mineplex.minecraft.game.classcombat.Class.repository.token; + +public class ClientClassTokenWrapper +{ + public String Name; + public ClientClassToken DonorToken; +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/token/CustomBuildToken.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/token/CustomBuildToken.java new file mode 100644 index 000000000..60114f89d --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/token/CustomBuildToken.java @@ -0,0 +1,57 @@ +package mineplex.minecraft.game.classcombat.Class.repository.token; + +import java.util.List; + +public class CustomBuildToken +{ + public int CustomBuildId; + + public String PlayerName; + public String Name; + public boolean Active; + + public Integer CustomBuildNumber = 0; + + public int PvpClassId = -1; + + public int SwordSkillId = -1; + + public int AxeSkillId = -1; + + public int BowSkillId = -1; + + public int ClassPassiveASkillId = -1; + public int ClassPassiveBSkillId = -1; + + public int GlobalPassiveSkillId = -1; + + public List Slots; + + public void printInfo() + { + System.out.println("CustomBuildId : " + CustomBuildId); + System.out.println("PlayerName : " + PlayerName); + System.out.println("Name : " + Name); + System.out.println("Active : " + Active); + + System.out.println("CustomBuildNumber : " + CustomBuildNumber); + + System.out.println("PvpClassId : " + PvpClassId); + + System.out.println("SwordSkillId : " + SwordSkillId); + + System.out.println("AxeSkillId : " + AxeSkillId); + + System.out.println("BowSkillId : " + BowSkillId); + + System.out.println("ClassPassiveASkillId : " + ClassPassiveASkillId); + System.out.println("ClassPassiveBSkillId : " + ClassPassiveBSkillId); + + System.out.println("GlobalPassiveSkillId : " + GlobalPassiveSkillId); + + for (SlotToken token : Slots) + { + token.printInfo(); + } + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/token/SlotToken.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/token/SlotToken.java new file mode 100644 index 000000000..4b12a38ff --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/token/SlotToken.java @@ -0,0 +1,13 @@ +package mineplex.minecraft.game.classcombat.Class.repository.token; + +public class SlotToken +{ + public String Material; + public int Amount; + + public void printInfo() + { + System.out.println("Material : " + Material); + System.out.println("Amount : " + Amount); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Condition/SkillConditionEffect.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Condition/SkillConditionEffect.java new file mode 100644 index 000000000..12c4e566e --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Condition/SkillConditionEffect.java @@ -0,0 +1,29 @@ +package mineplex.minecraft.game.classcombat.Condition; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; +import mineplex.minecraft.game.core.condition.ConditionEffect; +import mineplex.minecraft.game.core.condition.ConditionManager; + +public class SkillConditionEffect extends ConditionEffect +{ + public SkillConditionEffect(ConditionManager manager) + { + super(manager); + } + + @EventHandler(priority = EventPriority.LOW) + public void Silence(SkillTriggerEvent event) + { + if (event.IsCancelled()) + return; + + if (!Manager.IsSilenced(event.GetPlayer(), event.GetSkillName())) + return; + + //Set Damage + event.SetCancelled(true); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Condition/SkillConditionManager.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Condition/SkillConditionManager.java new file mode 100644 index 000000000..cb28d8ce1 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Condition/SkillConditionManager.java @@ -0,0 +1,22 @@ +package mineplex.minecraft.game.classcombat.Condition; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.minecraft.game.core.condition.ConditionEffect; +import mineplex.minecraft.game.core.condition.ConditionManager; + +public class SkillConditionManager extends ConditionManager +{ + public SkillConditionManager(JavaPlugin plugin) + { + super(plugin); + } + + public ConditionEffect Effect() + { + if (Effect == null) + Effect = new SkillConditionEffect(this); + + return Effect; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Assassin.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Assassin.java new file mode 100644 index 000000000..90468fb1e --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Assassin.java @@ -0,0 +1,97 @@ +package mineplex.minecraft.game.classcombat.Skill.Assassin; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.inventory.PlayerInventory; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Assassin extends Skill +{ + public Assassin(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Permanent Speed II.", + "Fall damage reduced by 1." + }); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() == UpdateType.FAST) + for (Player cur : GetUsers()) + Factory.Condition().Factory().Speed(GetName(), cur, cur, 1.9, 1, false, false, false); + + if (event.getType() == UpdateType.SLOWER) + for (Player cur : GetUsers()) + { + PlayerInventory inv = cur.getInventory(); + + if (inv.getHelmet() != null && inv.getHelmet().getDurability() > 0) + inv.getHelmet().setDurability((short) (inv.getHelmet().getDurability()-1)); + + if (inv.getChestplate() != null && inv.getChestplate().getDurability() > 0) + inv.getChestplate().setDurability((short) (inv.getChestplate().getDurability()-1)); + + if (inv.getLeggings() != null && inv.getLeggings().getDurability() > 0) + inv.getLeggings().setDurability((short) (inv.getLeggings().getDurability()-1)); + + if (inv.getBoots() != null && inv.getBoots().getDurability() > 0) + inv.getBoots().setDurability((short) (inv.getBoots().getDurability()-1)); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void AttackDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + int level = GetLevel(damager); + if (level == 0) return; + + event.SetKnockback(false); + event.AddMod(damager.getName(), "Assassin Class", 1, false); + } + + @EventHandler(priority = EventPriority.HIGH) + public void FallDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.FALL) + return; + + Player player = event.GetDamageePlayer(); + if (player == null) return; + + int level = GetLevel(player); + if (level == 0) return; + + event.AddMod(null, GetName(), -1, false); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/BackStab.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/BackStab.java new file mode 100644 index 000000000..0b7d40318 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/BackStab.java @@ -0,0 +1,98 @@ +package mineplex.minecraft.game.classcombat.Skill.Assassin; + +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class BackStab extends Skill +{ + public BackStab(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Attacks from behind opponents", + "deals 4 additional damage." + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 10"; + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + int level = GetLevel(damager); + if (level == 0) return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + Vector look = damagee.getLocation().getDirection(); + look.setY(0); + look.normalize(); + + Vector from = damager.getLocation().toVector().subtract(damagee.getLocation().toVector()); + from.setY(0); + from.normalize(); + + Vector check = new Vector(look.getX() * -1, 0, look.getZ() * -1); + if (check.subtract(from).length() < 0.8) + { + if (!Factory.Energy().Use(damager, GetName(), 10, true, false)) + return; + + //Damage + event.AddMod(damager.getName(), GetName(), 1 + level, true); + + //Effect + damagee.getWorld().playSound(damagee.getLocation(), Sound.HURT, 1f, 2f); + return; + } + + /* + check = new Vector(look.getZ() * -1, 0, look.getX()); + if (check.subtract(from).length() < 0.7) + { + //Damage + event.AddMod(damager.getName(), "Sidestab", level * 1, true); + return; + } + + check = new Vector(look.getZ(), 0, look.getX() * -1); + if (check.subtract(from).length() < 0.7) + { + //Damage + event.AddMod(damager.getName(), "Sidestab", level * 1, true); + return; + }*/ + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.java new file mode 100644 index 000000000..cff971316 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.java @@ -0,0 +1,214 @@ +package mineplex.minecraft.game.classcombat.Skill.Assassin; + +import java.util.HashMap; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.block.Action; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Blink extends SkillActive +{ + private HashMap _loc = new HashMap(); + private HashMap _blinkTime = new HashMap(); + + public Blink(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Instantly teleport forwards 15 Blocks.", + "Cannot be used while Slowed.", + "", + "Using again within 5 seconds De-Blinks,", + "returning you to your original location.", + "Can be used while Slowed." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.hasPotionEffect(PotionEffectType.SLOW)) + { + UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill(GetName()) + " while Slowed.")); + return false; + } + + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + //Mastery + if (_loc.containsKey(player) && _blinkTime.containsKey(player)) + if (!UtilTime.elapsed(_blinkTime.get(player), 5000)) + { + Deblink(player, level); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Smoke Trail + Block lastSmoke = player.getLocation().getBlock(); + + double maxRange = 15; + double curRange = 0; + while (curRange <= maxRange) + { + Location newTarget = player.getLocation().add(new Vector(0,0.2,0)).add(player.getLocation().getDirection().multiply(curRange)); + + if (!UtilBlock.airFoliage(newTarget.getBlock()) || !UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP))) + break; + + //Lock Players + for (Player cur : player.getWorld().getPlayers()) + { + if (cur.equals(player)) + continue; + + if (UtilMath.offset(newTarget, cur.getLocation()) > 1) + continue; + + //Action + Location target = cur.getLocation().add(player.getLocation().subtract(cur.getLocation()).toVector().normalize()); + player.teleport(UtilWorld.locMerge(player.getLocation(), target)); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName()) + ".")); + + //Effect + player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); + return; + } + + //Progress Forwards + curRange += 0.2; + + //Smoke Trail + if (!lastSmoke.equals(newTarget.getBlock())) + lastSmoke.getWorld().playEffect(lastSmoke.getLocation(), Effect.SMOKE, 4); + + lastSmoke = newTarget.getBlock(); + } + + //Modify Range + curRange -= 0.4; + if (curRange < 0) + curRange = 0; + + //Destination + Location loc = player.getLocation().add(player.getLocation().getDirection().multiply(curRange).add(new Vector(0, 0.4, 0))); + _loc.put(player, player.getLocation()); + + //Condition Indicators + Factory.Condition().SetIndicatorVisibility(player, false); + + //Action + if (curRange > 0) + { + player.leaveVehicle(); + player.teleport(loc); + } + + //Condition Indicators + Factory.Condition().SetIndicatorVisibility(player, true); + + player.setFallDistance(0); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName()) + ".")); + + //Effect + player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); + + //Record + _blinkTime.put(player, System.currentTimeMillis()); + } + + public void Deblink(Player player, int level) + { + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill("De-Blink") + ".")); + + //Smoke Trail + Block lastSmoke = player.getLocation().getBlock(); + + double curRange = 0; + + Location target = _loc.remove(player); + + boolean done = false; + while (!done) + { + Vector vec = UtilAlg.getTrajectory(player.getLocation(), + new Location(player.getWorld(), target.getX(), target.getY(), target.getZ())); + + Location newTarget = player.getLocation().add(vec.multiply(curRange)); + + //Progress Forwards + curRange += 0.2; + + //Smoke Trail + if (!lastSmoke.equals(newTarget.getBlock())) + lastSmoke.getWorld().playEffect(lastSmoke.getLocation(), Effect.SMOKE, 4); + + lastSmoke = newTarget.getBlock(); + + if (UtilMath.offset(newTarget, target) < 0.4) + done = true; + + if (curRange > 24) + done = true; + + if (curRange > 24) + done = true; + } + + Factory.Teleport().TP(player, target); + + player.setFallDistance(0); + + //Effect + player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); + } + + @Override + public void Reset(Player player) + { + _loc.remove(player); + _blinkTime.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Evade.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Evade.java new file mode 100644 index 000000000..9d1090ab4 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Evade.java @@ -0,0 +1,209 @@ +package mineplex.minecraft.game.classcombat.Skill.Assassin; + +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Evade extends SkillActive +{ + private HashSet _active = new HashSet(); + + public Evade(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Block attacks to evade them and", + "teleport behind the attacker.", + "Crouch and Evade to teleport backwards." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + return true; + } + + @Override + public void Skill(Player player, int level) + { + _active.add(player); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared to " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Energy(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + if (!cur.isBlocking()) + { + _active.remove(cur); + continue; + } + + if (!Factory.Energy().Use(cur, GetName(), 1.2, true, true)) + { + _active.remove(cur); + } + } + } + + @EventHandler(priority = EventPriority.LOW) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + //Damagee + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + //Blocking + if (!damagee.isBlocking()) + return; + + //Active + if (!_active.contains(damagee)) + return; + + //Damager + LivingEntity damager = event.GetDamagerEntity(false); + if (damager == null) return; + + //Level + int level = GetLevel(damagee); + if (level == 0) return; + + if (!mineplex.core.recharge.Recharge.Instance.use(damagee, GetName(), 500, false)) + return; + + //Cancel + event.SetCancelled(GetName()); + + //Effect + for (int i=0 ; i<3 ; i++) + damagee.getWorld().playEffect(damagee.getLocation(), Effect.SMOKE, 5); + + //Location + Location target = null; + if (damagee.isSneaking()) target = FindLocationBack(damager, damagee); + else target = FindLocationBehind(damager, damagee); + if (target == null) + return; + + //Action + Factory.Teleport().TP(damagee, target); + + //Cloak + if (damagee.isSneaking()) + Factory.Condition().Factory().Cloak(GetName(), damagee, damagee, 0.1, false, false); + + //Invul/Cloak + Factory.Condition().Factory().Invulnerable(GetName(), damagee, damagee, 0.5, false, false); + + //Inform + UtilPlayer.message(damagee, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + UtilPlayer.message(damager, F.main(GetClassType().name(), F.name(damagee.getName()) +" used " + F.skill(GetName(level)) + ".")); + } + + private Location FindLocationBehind(LivingEntity damager, Player damagee) + { + double curMult = 0; + double maxMult = 1.5; + + double rate = 0.1; + + Location lastValid = damager.getLocation(); + + while (curMult <= maxMult) + { + Vector vec = UtilAlg.getTrajectory(damager, damagee).multiply(curMult); + Location loc = damager.getLocation().subtract(vec); + + if (!UtilBlock.airFoliage(loc.getBlock()) || !UtilBlock.airFoliage(loc.getBlock().getRelative(BlockFace.UP))) + return lastValid; + + lastValid = loc; + + curMult += rate; + } + + return lastValid; + } + + private Location FindLocationBack(LivingEntity damager, Player damagee) + { + double curMult = 0; + double maxMult = 3; + + double rate = 0.1; + + Location lastValid = damagee.getLocation(); + + while (curMult <= maxMult) + { + Vector vec = UtilAlg.getTrajectory(damager, damagee).multiply(curMult); + Location loc = damagee.getLocation().add(vec); + + if (!UtilBlock.airFoliage(loc.getBlock()) || !UtilBlock.airFoliage(loc.getBlock().getRelative(BlockFace.UP))) + return lastValid; + + lastValid = loc; + + curMult += rate; + } + + return lastValid; + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Flash.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Flash.java new file mode 100644 index 000000000..006615694 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Flash.java @@ -0,0 +1,165 @@ +package mineplex.minecraft.game.classcombat.Skill.Assassin; + +import java.util.HashMap; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Flash extends SkillActive +{ + private HashMap _flash = new HashMap(); + + public Flash(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Teleport forwards 6 Blocks.", + "Store up to 3 Flash Charges.", + "Cannot be used while Slowed." + }); + } + + @Override + public String GetRechargeString() + { + return "Recharge: 8 Seconds per Charge"; + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.hasPotionEffect(PotionEffectType.SLOW)) + { + UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill(GetName()) + " while Slowed.")); + return false; + } + + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + //No Flash + if (!_flash.containsKey(player) || _flash.get(player) == 0) + { + UtilPlayer.message(player, F.main("Skill", "You have no " + F.skill(GetName() + " Charges") + ".")); + return false; + } + + return true; + } + + @EventHandler + public void Recharge(UpdateEvent event) + { + for (Player cur : GetUsers()) + if (!_flash.containsKey(cur)) + { + _flash.put(cur, 0); + } + else + { + int charges = _flash.get(cur); + + if (charges >= 3) + continue; + + if (!mineplex.core.recharge.Recharge.Instance.use(cur, "Flash Recharge", 8000, false)) + continue; + + _flash.put(cur, charges + 1); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), "Flash Charges: " + F.elem((charges + 1)+""))); + } + } + + @Override + public void Skill(Player player, int level) + { + //Use Recharge + mineplex.core.recharge.Recharge.Instance.use(player, "Flash Recharge", 8000, false); + + _flash.put(player, _flash.get(player) - 1); + + //Smoke Trail + Block lastSmoke = player.getLocation().getBlock(); + + double maxRange = 6; + double curRange = 0; + while (curRange <= maxRange) + { + Location newTarget = player.getLocation().add(new Vector(0,0.2,0)).add(player.getLocation().getDirection().multiply(curRange)); + + if (!UtilBlock.airFoliage(newTarget.getBlock()) || + !UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP))) + break; + + //Progress Forwards + curRange += 0.2; + + //Smoke Trail + if (!lastSmoke.equals(newTarget.getBlock())) + lastSmoke.getWorld().playEffect(lastSmoke.getLocation(), Effect.SMOKE, 4); + + lastSmoke = newTarget.getBlock(); + } + + //Modify Range + curRange -= 0.4; + if (curRange < 0) + curRange = 0; + + //Destination + Location loc = player.getLocation().add(player.getLocation().getDirection().multiply(curRange).add(new Vector(0, 0.4, 0))); + + if (curRange > 0) + Factory.Teleport().TP(player, loc); + + player.setFallDistance(0); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "Flash Charges: " + F.elem(_flash.get(player)+""))); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.WITHER_SHOOT, 0.4f, 1.2f); + player.getWorld().playSound(player.getLocation(), Sound.SILVERFISH_KILL, 1f, 1.6f); + + } + + @Override + public void Reset(Player player) + { + _flash.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Leap.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Leap.java new file mode 100644 index 000000000..0385452b8 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Leap.java @@ -0,0 +1,188 @@ +package mineplex.minecraft.game.classcombat.Skill.Assassin; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.block.Action; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Leap extends SkillActive +{ + public Leap(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Take a great leap forwards.", + "", + "Wall Kick by using Leap with your", + "back against a wall. This uses no", + "Energy or Recharge.", + "", + "Cannot be used while Slowed." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + if (UtilTime.elapsed(Factory.Movement().Get(player).LastGrounded, 8000)) + { + UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill(GetName()) + " while airborne.")); + } + + if (player.hasPotionEffect(PotionEffectType.SLOW)) + { + UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill(GetName()) + " while Slowed.")); + return false; + } + + //Wall Kick + if (WallJump(player, level)) + return false; + + return true; + } + + public void DoLeap(Player player, int level, boolean wallkick) + { + //Action + if (!wallkick) + UtilAction.velocity(player, 1.2, 0.2, 1, true); + else + { + Vector vec = player.getLocation().getDirection(); + vec.setY(0); + UtilAction.velocity(player, vec, 0.7, false, 0, 0.7, 2, true); + } + + //Inform + if (!wallkick) + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + else + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill("Wall Kick") + ".")); + + //Effect + player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 80); + player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, 2f, 1.2f); + } + + @Override + public void Skill(Player player, int level) + { + DoLeap(player, level, false); + } + + public boolean WallJump(Player player, int level) + { + if (level == 0) return false; + + //Recharge & Energy + if (!mineplex.core.recharge.Recharge.Instance.use(player, "Wall Kick", 500, false)) + return false; + + //Direction + Vector vec = player.getLocation().getDirection(); + + //Logic + boolean xPos = true; + boolean zPos = true; + + if (vec.getX() < 0) xPos = false; + if (vec.getZ() < 0) zPos = false; + + for (int y=0 ; y<=0 ; y++) + { + for (int x=-1 ; x<=1 ; x++) + { + for (int z=-1 ; z<=1 ; z++) + { + if (x == 0 && z == 0) + continue; + + if ( (xPos && x > 0) || + (zPos && z > 0) || + (!xPos && x < 0) || + (!zPos && z < 0)) + continue; + + if (UtilBlock.airFoliage(player.getLocation().getBlock().getRelative(x, y, z))) + continue; + + Block forward = null; + + //Forward Down + if (Math.abs(vec.getX()) > Math.abs(vec.getZ())) + { + if (xPos) forward = player.getLocation().getBlock().getRelative(1, 0, 0); + else forward = player.getLocation().getBlock().getRelative(-1, 0, 0); + } + else + { + if (zPos) forward = player.getLocation().getBlock().getRelative(0, 0, 1); + else forward = player.getLocation().getBlock().getRelative(0, 0, -1); + } + + if (!UtilBlock.airFoliage(forward)) + continue; + + //Forward Up + if (Math.abs(vec.getX()) > Math.abs(vec.getZ())) + { + if (xPos) forward = player.getLocation().getBlock().getRelative(1, 1, 0); + else forward = player.getLocation().getBlock().getRelative(-1, 1, 0); + } + else + { + if (zPos) forward = player.getLocation().getBlock().getRelative(0, 1, 1); + else forward = player.getLocation().getBlock().getRelative(0, 1, -1); + } + + if (!UtilBlock.airFoliage(forward)) + continue; + + DoLeap(player, level, true); + + return true; + } + } + } + + return false; + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/MarkedForDeath.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/MarkedForDeath.java new file mode 100644 index 000000000..c837e9ad1 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/MarkedForDeath.java @@ -0,0 +1,168 @@ +package mineplex.minecraft.game.classcombat.Skill.Assassin; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class MarkedForDeath extends SkillActive +{ + private HashSet _arrows = new HashSet(); + private HashSet _poison = new HashSet(); + + public MarkedForDeath(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Your next arrow will mark players,", + "giving them Vulnerability 2 for up", + "to 10 seconds. Duration is lower for", + "uncharged arrows." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + _poison.add(player); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f); + } + + @EventHandler + public void ShootBow(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + if (!(event.getProjectile() instanceof Arrow)) + return; + + Player player = (Player)event.getEntity(); + + if (!_poison.remove(player)) + return; + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(GetLevel(player))) + ".")); + + _arrows.add(event.getProjectile()); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Projectile projectile = event.GetProjectile(); + if (projectile == null) return; + + //Not Pin Down Arrow + if (!_arrows.contains((Entity)projectile)) + return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + //Level + int level = GetLevel(damager); + if (level == 0) return; + + //Effect + damagee.getWorld().playSound(damagee.getLocation(), Sound.BREATH, 2.5f, 2.0f); + + //Inform + UtilPlayer.message(event.GetDamageePlayer(), F.main(GetClassType().name(), F.name(damager.getName()) +" hit you with " + F.skill(GetName(level)) + ".")); + UtilPlayer.message(damager, F.main(GetClassType().name(), "You hit " + F.name(UtilEnt.getName(damagee)) +" with " + F.skill(GetName(level)) + ".")); + + double duration = 10; + if (projectile.getVelocity().length() < 2.5d) + { + duration = 4 + (6 *(projectile.getVelocity().length() / 2.5d)); + } + + //Vuln + Factory.Condition().Factory().Vulnerable(GetName(), damagee, damager, duration, 3, true, true, true); + + //Damage + event.AddMod(damager.getName(), GetName(), 0, true); + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + HashSet remove = new HashSet(); + + for (Entity cur : _arrows) + if (cur.isDead()) + remove.add(cur); + + for (Entity cur : remove) + _arrows.remove(cur); + } + + @Override + public void Reset(Player player) + { + _poison.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.java new file mode 100644 index 000000000..d13b82559 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.java @@ -0,0 +1,201 @@ +package mineplex.minecraft.game.classcombat.Skill.Assassin; + +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Sound; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryPickupItemEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Recall extends Skill +{ + private HashMap _items = new HashMap(); + private HashMap _time = new HashMap(); + private HashMap _informed = new HashMap(); + + public Recall(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Place a recall marker on the ground.", + "Use recall again within 20 seconds", + "to return to original location." + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 80"; + } + + @Override + public String GetRechargeString() + { + return "Recharge: 1 Minute"; + } + + @EventHandler + public void Crouch(PlayerDropItemEvent event) + { + Player player = event.getPlayer(); + + int level = GetLevel(player); + if (level == 0) return; + + if (!UtilGear.isWeapon(event.getItemDrop().getItemStack())) + return; + + event.setCancelled(true); + + //Mark + if (!_items.containsKey(player)) + { + //Check Energy - DO NOT USE YET + if (!Factory.Energy().Use(player, GetName(level), 80, false, true)) + return; + + //Use Recharge + if (!Recharge.Instance.use(player, GetName(), GetName(level), 60000, true)) + return; + + //Use Energy + Factory.Energy().Use(player, GetName(level), 80, true, true); + + //Item + Item item = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(2261)); + item.setVelocity(new Vector(0, -1, 0)); + + //Save + _items.put(player, item); + _time.put(player, System.currentTimeMillis() + 20000); + _informed.put(player, 20000L); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); + + //Effect + player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 133); + + } + //Return + else + { + //Effect + player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 133); + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f); + + //Return + Item item = _items.remove(player); + Factory.Teleport().TP(player, item.getLocation()); + item.remove(); + + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + + //Effect + player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 133); + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f); + + Reset(player); + + } + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + HashSet expired = new HashSet(); + + for (Player cur : _time.keySet()) + { + if (System.currentTimeMillis() > _time.get(cur)) + expired.add(cur); + else + { + long time = (_time.get(cur) - System.currentTimeMillis()); + if (time < _informed.get(cur)) + { + UtilPlayer.message(cur, F.main(GetClassType().name(), + "Recall Time: " + F.time(UtilTime.convertString(_informed.get(cur), 0, TimeUnit.FIT)))); + _informed.put(cur, _informed.get(cur) - 5000); + } + } + } + + + for (Player cur : expired) + { + _time.remove(cur); + _informed.remove(cur); + + Item item = _items.remove(cur); + if (item != null) + { + item.getWorld().playEffect(item.getLocation(), Effect.STEP_SOUND, 133); + item.remove(); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), + "Recall Time: " + C.cRed + "Expired")); + } + } + } + + @EventHandler + public void ItemPickup(PlayerPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (_items.containsValue(event.getItem())) + event.setCancelled(true); + } + + @EventHandler + public void HopperPickup(InventoryPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (_items.containsValue(event.getItem())) + event.setCancelled(true); + } + + @Override + public void Reset(Player player) + { + if (_items.containsKey(player)) + _items.get(player).remove(); + + _items.remove(player); + _time.remove(player); + _informed.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/RepeatedStrikes.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/RepeatedStrikes.java new file mode 100644 index 000000000..5161359e1 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/RepeatedStrikes.java @@ -0,0 +1,91 @@ +package mineplex.minecraft.game.classcombat.Skill.Assassin; + +import java.util.HashSet; +import java.util.WeakHashMap; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class RepeatedStrikes extends Skill +{ + private WeakHashMap _repeat = new WeakHashMap(); + private WeakHashMap _last = new WeakHashMap(); + + public RepeatedStrikes(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Each time you attack, your damage", + "increases by 1. You can get up to", + "3 bonus damage.", + "", + "Not attacking for 2 seconds clears", + "your bonus damage." + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + //Damager + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + int level = GetLevel(damager); + if (level == 0) return; + + if (!_repeat.containsKey(damager)) + _repeat.put(damager, 0); + + //Damage + event.AddMod(damager.getName(), GetName(), _repeat.get(damager), true); + + //Increase Repeat + _repeat.put(damager, Math.min(3, _repeat.get(damager) + 1)); + _last.put(damager, System.currentTimeMillis()); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + HashSet remove = new HashSet(); + + for (Player cur : _repeat.keySet()) + if (UtilTime.elapsed(_last.get(cur), 2000)) + remove.add(cur); + + for (Player cur : remove) + { + _repeat.remove(cur); + _last.remove(cur); + } + } + + @Override + public void Reset(Player player) + { + _repeat.remove(player); + _last.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/ShockingStrikes.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/ShockingStrikes.java new file mode 100644 index 000000000..8932a33fc --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/ShockingStrikes.java @@ -0,0 +1,63 @@ +package mineplex.minecraft.game.classcombat.Skill.Assassin; + +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.common.util.UtilGear; +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class ShockingStrikes extends Skill +{ + public ShockingStrikes(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Your attacks shock targets for", + "1 second, giving them Slow I and", + "Screen-Shake." + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!UtilGear.isWeapon(damager.getItemInHand())) + return; + + int level = GetLevel(damager); + if (level == 0) return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + //Confuse + Factory.Condition().Factory().Shock(GetName(), damagee, damager, 1, true, true); + Factory.Condition().Factory().Slow(GetName(), damagee, damager, 1, 0, true, true, false, true); + + //Damage + event.AddMod(damager.getName(), GetName(), 0, true); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SilencingArrow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SilencingArrow.java new file mode 100644 index 000000000..19c020ee5 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SilencingArrow.java @@ -0,0 +1,159 @@ +package mineplex.minecraft.game.classcombat.Skill.Assassin; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class SilencingArrow extends SkillActive +{ + private HashSet _arrows = new HashSet(); + private HashSet _silence = new HashSet(); + + public SilencingArrow(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Your next arrow will silence", + "target for 16 seconds." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + _silence.add(player); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f); + } + + @EventHandler + public void ShootBow(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + if (!(event.getProjectile() instanceof Arrow)) + return; + + Player player = (Player)event.getEntity(); + + if (!_silence.remove(player)) + return; + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(GetName(GetLevel(player))) + ".")); + + _arrows.add(event.getProjectile()); + } + + @EventHandler(priority = EventPriority.LOW) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Projectile projectile = event.GetProjectile(); + if (projectile == null) return; + + if (!_arrows.contains((Entity)projectile)) + return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + //Level + int level = GetLevel(damager); + if (level == 0) return; + + //Confuse + double confuseDur = 16; + Factory.Condition().Factory().Silence(GetName(), damagee, damager, confuseDur, true, true); + + //Effect + damagee.getWorld().playSound(damagee.getLocation(), Sound.BREATH, 2.5f, 2.0f); + + //Inform + UtilPlayer.message(event.GetDamageePlayer(), F.main(GetClassType().name(), F.name(damager.getName()) +" hit you with " + F.skill(GetName(level)) + ".")); + UtilPlayer.message(damager, F.main(GetClassType().name(), "You hit " + F.name(UtilEnt.getName(damagee)) +" with " + F.skill(GetName(level)) + ".")); + + //Damage + event.AddMod(damager.getName(), GetName(), 0, true); + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + HashSet remove = new HashSet(); + + for (Entity cur : _arrows) + if (cur.isDead()) + remove.add(cur); + + for (Entity cur : remove) + _arrows.remove(cur); + } + + @Override + public void Reset(Player player) + { + _silence.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SmokeBomb.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SmokeBomb.java new file mode 100644 index 000000000..1be251849 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SmokeBomb.java @@ -0,0 +1,152 @@ +package mineplex.minecraft.game.classcombat.Skill.Assassin; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.condition.Condition; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +import org.bukkit.Effect; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +public class SmokeBomb extends Skill +{ + public SmokeBomb(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Drop Axe/Sword to Use.", + "", + "Create a blast of smoke, turning", + "you Invisible for 8 seconds. You ", + "also receive Vulnerability 4 for", + "6 seconds.", + "", + "You leave a trail of smoke while", + "you are Invisible." + }); + } + + @Override + public String GetRechargeString() + { + return "Recharge: 1 Minute"; + } + + @EventHandler + public void Use(PlayerDropItemEvent event) + { + Player player = event.getPlayer(); + + int level = GetLevel(player); + if (level == 0) return; + + if (!UtilGear.isWeapon(event.getItemDrop().getItemStack())) + return; + + event.setCancelled(true); + + if (!Recharge.Instance.use(player, GetName(), GetName(level), 120000 - (level * 30000), true)) + return; + + //Action + Factory.Condition().Factory().Cloak(GetName(), player, player, 8, false, true); + Factory.Condition().Factory().Vulnerable(GetName(), player, player, 6, 3, false, true, true); + + //Effect + //Factory.Explosion().SetDamage(false); + //player.getWorld().createExplosion(player.getLocation(), 5f, false); + //Factory.Explosion().SetDamage(true); + + for (int i=0 ; i<3 ; i++) + { + player.getWorld().playSound(player.getLocation(), Sound.FIZZ, 2f, 0.5f); + player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 80); + } + + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + } + + @EventHandler(priority = EventPriority.HIGH) + public void EndDamagee(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + if (GetLevel(damagee) == 0) + return; + + //End + Factory.Condition().EndCondition(damagee, null, GetName()); + } + + @EventHandler(priority = EventPriority.HIGH) + public void EndDamager(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + if (GetLevel(damager) == 0) + return; + + //End + Factory.Condition().EndCondition(damager, null, GetName()); + } + + @EventHandler + public void EndInteract(PlayerInteractEvent event) + { + if (GetLevel(event.getPlayer()) == 0) + return; + + Factory.Condition().EndCondition(event.getPlayer(), null, GetName()); + } + + @EventHandler + public void Smoke(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : GetUsers()) + { + Condition cond = Factory.Condition().GetActiveCondition(cur, ConditionType.CLOAK); + if (cond == null) continue; + + if (!cond.GetReason().equals(GetName())) + continue; + + //Smoke + cur.getWorld().playEffect(cur.getLocation(), Effect.SMOKE, 4); + } + } + + @Override + public void Reset(Player player) + { + //Remove Condition + Factory.Condition().EndCondition(player, null, GetName()); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Stealth.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Stealth.java new file mode 100644 index 000000000..0324cbe70 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Stealth.java @@ -0,0 +1,229 @@ +package mineplex.minecraft.game.classcombat.Skill.Assassin; + +import java.util.HashSet; + +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.potion.PotionEffectType; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; + +public class Stealth extends Skill +{ + private HashSet _active = new HashSet(); + + public Stealth(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Drop Axe/Sword to Toggle", + "", + "Move stealthily, becoming completely", + "Invisible. However, you also receive", + "Slow 3.", + "", + "Stealth ends if you an enemy comes", + "within 3 Blocks of you, or you attack.", + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 16 per Second"; + } + + @EventHandler + public void Crouch(PlayerDropItemEvent event) + { + Player player = event.getPlayer(); + + if (GetLevel(player) == 0) + return; + + if (!UtilGear.isWeapon(event.getItemDrop().getItemStack())) + return; + + event.setCancelled(true); + + //Check Allowed + SkillTriggerEvent trigger = new SkillTriggerEvent(player, GetName(), GetClassType()); + UtilServer.getServer().getPluginManager().callEvent(trigger); + if (trigger.IsCancelled()) + return; + + if (!_active.remove(player)) + { + if (player.hasPotionEffect(PotionEffectType.SLOW)) + { + UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill(GetName()) + " while Slowed.")); + return; + } + + if (!UtilTime.elapsed(Factory.Combat().Get(player).LastCombat, 4000)) + { + UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill(GetName()) + " while in Combat.")); + return; + } + + Add(player); + } + else + { + Remove(player, player); + } + } + + public void Add(Player player) + { + _active.add(player); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "Stealth: " + F.oo("Enabled", true))); + + //Conditions + Factory.Condition().Factory().Cloak(GetName(), player, player, 120000, false, true); + Factory.Condition().Factory().Slow(GetName(), player, player, 120000, 2, false, false, false, true); + Factory.Condition().Factory().Vulnerable(GetName(), player, player, 120000, 3, false, true, true); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.BREATH, 0.5f, 0.5f); + } + + public void Remove(Player player, LivingEntity source) + { + _active.remove(player); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "Stealth: " + F.oo("Disabled", false))); + + //Conditions + Factory.Condition().EndCondition(player, null, GetName()); + } + + @EventHandler + public void EndProx(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : GetUsers()) + { + int level = GetLevel(cur); + if (level == 0) continue; + + //Proximity Decloak + if (_active.contains(cur)) + for (Player other : cur.getWorld().getPlayers()) + { + if (other.equals(cur)) + continue; + + if (UtilMath.offset(cur, other) > 3) + continue; + + if (!Factory.Relation().CanHurt(cur, other)) + continue; + + Remove(cur, other); + break; + } + } + } + + @EventHandler + public void EndInteract(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!_active.contains(player)) + return; + + Remove(player, player); + } + + @EventHandler(priority = EventPriority.HIGH) + public void EndDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee != null) return; + { + if (_active.contains(damagee)) + { + Remove(damagee, event.GetDamagerEntity(true)); + } + } + + Player damager = event.GetDamagerPlayer(true); + if (damager != null) return; + { + if (_active.contains(damager)) + { + Remove(damager, event.GetDamagerEntity(true)); + } + } + } + + @EventHandler + public void Energy(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + //Level + if (GetLevel(cur) == 0) + { + Remove(cur, null); + continue; + } + + //Silence + if (Factory.Condition().IsSilenced(cur, null)) + { + Remove(cur, null); + continue; + } + + if (!Factory.Energy().Use(cur, GetName(), 0.75, true, false)) + { + Remove(cur, null); + continue; + } + } + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + Factory.Condition().EndCondition(player, ConditionType.CLOAK, GetName()); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/ToxicArrow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/ToxicArrow.java new file mode 100644 index 000000000..c72bda119 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/ToxicArrow.java @@ -0,0 +1,159 @@ +package mineplex.minecraft.game.classcombat.Skill.Assassin; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class ToxicArrow extends SkillActive +{ + private HashSet _arrows = new HashSet(); + private HashSet _poison = new HashSet(); + + public ToxicArrow(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Your next arrow will give Confusion", + "to target for 20 seconds." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + _poison.add(player); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f); + } + + @EventHandler + public void ShootBow(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + if (!(event.getProjectile() instanceof Arrow)) + return; + + Player player = (Player)event.getEntity(); + + if (!_poison.remove(player)) + return; + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(GetName(GetLevel(player))) + ".")); + + _arrows.add(event.getProjectile()); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Projectile projectile = event.GetProjectile(); + if (projectile == null) return; + + if (!_arrows.contains((Entity)projectile)) + return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + //Level + int level = GetLevel(damager); + if (level == 0) return; + + //Confuse + double confuseDur = 20; + Factory.Condition().Factory().Confuse(GetName(), damagee, damager, confuseDur, 0, true, true, true); + + //Effect + damagee.getWorld().playSound(damagee.getLocation(), Sound.BREATH, 2.5f, 2.0f); + + //Inform + UtilPlayer.message(event.GetDamageePlayer(), F.main(GetClassType().name(), F.name(damager.getName()) +" hit you with " + F.skill(GetName(level)) + ".")); + UtilPlayer.message(damager, F.main(GetClassType().name(), "You hit " + F.name(UtilEnt.getName(damagee)) +" with " + F.skill(GetName(level)) + ".")); + + //Damage + event.AddMod(damager.getName(), GetName(), 0, true); + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + HashSet remove = new HashSet(); + + for (Entity cur : _arrows) + if (cur.isDead()) + remove.add(cur); + + for (Entity cur : remove) + _arrows.remove(cur); + } + + @Override + public void Reset(Player player) + { + _poison.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/WoundingStrikes.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/WoundingStrikes.java new file mode 100644 index 000000000..293b0b201 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/WoundingStrikes.java @@ -0,0 +1,159 @@ +package mineplex.minecraft.game.classcombat.Skill.Assassin; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Map.Entry; + +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class WoundingStrikes extends Skill +{ + private NautHashMap>> _active = new NautHashMap>>(); + private NautHashMap> _last = new NautHashMap>(); + + + public WoundingStrikes(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Your axe attacks deal 4 less damage, but", + "do an addition 1 damage per second for", + "6 seconds. Damage over time can stack", + "up to 3 times." + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + int level = GetLevel(damager); + if (level == 0) return; + + if (!UtilGear.isAxe(damager.getItemInHand())) + return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + //Damage + event.AddMod(damager.getName(), GetName(), -4, true); + + //Add Wound + int ticks = 6; + + if (!_active.containsKey(damagee)) + _active.put(damagee, new NautHashMap>()); + + if (!_active.get(damagee).containsKey(damager)) + _active.get(damagee).put(damager, new ArrayList()); + + _active.get(damagee).get(damager).add(ticks); + + while (_active.get(damagee).get(damager).size() > 3) + _active.get(damagee).get(damager).remove(0); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator>>> damageeIterator = _active.entrySet().iterator(); + + while (damageeIterator.hasNext()) + { + Entry>> damageeEntrySet = damageeIterator.next(); + LivingEntity damagee = damageeEntrySet.getKey(); + NautHashMap> damagers = damageeEntrySet.getValue(); + + //First + if (!_last.containsKey(damagee)) + _last.put(damagee, new NautHashMap()); + + Iterator>> damagerIterator = damagers.entrySet().iterator(); + + while (damagerIterator.hasNext()) + { + Entry> damagerEntrySet = damagerIterator.next(); + Player damager = damagerEntrySet.getKey(); + ArrayList damagerTicks = damagerEntrySet.getValue(); + + //First + if (!_last.get(damagee).containsKey(damager)) + { + _last.get(damagee).put(damager, System.currentTimeMillis()); + continue; + } + + //Delay + if (!UtilTime.elapsed(_last.get(damagee).get(damager), 1000)) + continue; + + _last.get(damagee).put(damager, System.currentTimeMillis()); + + //Expire + while (!damagerTicks.isEmpty() && damagerTicks.get(0) <= 0) + { + damagerTicks.remove(0); + } + + //Decrement + for (int i=0 ; i < damagerTicks.size() ; i++) + { + int ticks = damagerTicks.get(i); + damagerTicks.set(i, ticks-1); + } + + //Damage + int stacks = damagerTicks.size(); + + if (stacks == 0) + { + damagerIterator.remove(); + + if (damagers.isEmpty()) + { + damageeIterator.remove(); + } + } + else + { + Factory.Damage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, stacks, false, true, false, null, null); + } + } + } + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + _last.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java new file mode 100644 index 000000000..1203a2a9c --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java @@ -0,0 +1,326 @@ +package mineplex.minecraft.game.classcombat.Skill.Brute; + +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent; + +public class BlockToss extends mineplex.minecraft.game.classcombat.Skill.Skill implements IThrown +{ + private HashMap _holding = new HashMap(); + private HashMap _charge = new HashMap(); + private HashSet _charged = new HashSet(); + private HashMap _falling = new HashMap(); + + public BlockToss(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Hold Block to pick up a block,", + "Release Block to throw it, dealing", + "up to 12 damage.", + "", + "You must hold the block for", + "1 second for full throw power.", + "", + "You can only pick up Stone, Dirt,", + "Cobblestone, Sand, Gravel or Snow." + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 40"; + } + + @EventHandler + public void Grab(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + return; + + if (!UtilGear.isSword(player.getItemInHand())) + return; + + if (_holding.containsKey(player)) + return; + + //Level + int level = GetLevel(player); + if (level == 0) return; + + Block grab = event.getClickedBlock(); + + int id = event.getClickedBlock().getTypeId(); + + if ( + id != 1 && + id != 2 && + id != 3 && + id != 12 && + id != 13 && + id != 80) + return; + + //Door + if (grab.getRelative(BlockFace.UP).getTypeId() == 64 || grab.getRelative(BlockFace.UP).getTypeId() == 71) + { + UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block.")); + return; + } + + //TrapDoor + if ( grab.getRelative(BlockFace.NORTH).getType() == Material.TRAP_DOOR || + grab.getRelative(BlockFace.SOUTH).getType() == Material.TRAP_DOOR || + grab.getRelative(BlockFace.EAST).getType() == Material.TRAP_DOOR || + grab.getRelative(BlockFace.WEST).getType() == Material.TRAP_DOOR) + { + UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block.")); + return; + } + + //Energy + if (!Factory.Energy().Use(player, GetName(level), 40, true, true)) + return; + + //Block to Item + FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), (byte)0); + Factory.BlockRestore().Add(event.getClickedBlock(), 0, (byte)0, 10000); + + //Condition Indicators + Factory.Condition().SetIndicatorVisibility(player, false); + + //Action + player.eject(); + player.setPassenger(block); + _holding.put(player, block); + _falling.put(block, player); + _charge.put(player, System.currentTimeMillis()); + + //Effect + player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, block.getMaterial().getId()); + } + + @EventHandler + public void Throw(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet voidSet = new HashSet(); + HashSet throwSet = new HashSet(); + + for (Player cur : _holding.keySet()) + { + if (cur.getPassenger() == null) + { + voidSet.add(cur); + continue; + } + + if (_holding.get(cur).getVehicle() == null) + { + voidSet.add(cur); + continue; + } + + if (!_holding.get(cur).getVehicle().equals(cur)) + { + voidSet.add(cur); + continue; + } + + //Throw + if (!cur.isBlocking()) + throwSet.add(cur); + + //Charged Tick + if (!_charged.contains(cur)) + if (System.currentTimeMillis() - _charge.get(cur) > 1000) + { + _charged.add(cur); + cur.playEffect(cur.getLocation(), Effect.CLICK1, 0); + } + } + + for (Player cur : voidSet) + { + FallingBlock block = _holding.remove(cur); + _charge.remove(cur); + _charged.remove(cur); + block.remove(); + } + + for (Player cur : throwSet) + { + FallingBlock block = _holding.remove(cur); + _charged.remove(cur); + long charge = System.currentTimeMillis() - _charge.remove(cur); + + //Throw + cur.eject(); + double mult = 1; + if (charge < 1000) + mult = mult * (charge/1000d); + + //Condition Indicators + Factory.Condition().SetIndicatorVisibility(cur, true); + + //Action + UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0, 0, 1, true); + Factory.Projectile().AddThrow(block, cur, this, -1, true, true, true, + null, 0, 0, null, 0, UpdateType.FASTEST, 2d); + + //Boost + UtilAction.velocity(cur, cur.getLocation().getDirection().multiply(-1), 0.4, false, 0, 0, 1, false); + + //Event + UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(cur, GetName(), ClassType.Brute)); + } + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (target == null) + return; + + //Damage Event + Factory.Damage().NewDamageEvent(target, data.GetThrower(), null, + DamageCause.CUSTOM, 2 + (data.GetThrown().getVelocity().length() * 10), true, true, false, + UtilEnt.getName(data.GetThrower()), GetName()); + + //Block to Item + if (data.GetThrown() instanceof FallingBlock) + { + FallingBlock thrown = (FallingBlock) data.GetThrown(); + + FallingBlock newThrown = data.GetThrown().getWorld().spawnFallingBlock(data.GetThrown().getLocation(), thrown.getMaterial(), (byte)0); + + //Remove Old + _falling.remove(thrown); + thrown.remove(); + + //Add New + if (data.GetThrower() instanceof Player) + _falling.put(newThrown, (Player)data.GetThrower()); + } + } + + @Override + public void Idle(ProjectileUser data) + { + + } + + @Override + public void Expire(ProjectileUser data) + { + + } + + @EventHandler + public void CreateBlock(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet fallen = new HashSet(); + + for (FallingBlock cur : _falling.keySet()) + { + if (cur.isDead() || !cur.isValid()) + fallen.add(cur); + } + + for (FallingBlock cur : fallen) + { + _falling.remove(cur); + Block block = cur.getLocation().getBlock(); + + int id = block.getTypeId(); + if ( + id != 1 && + id != 2 && + id != 3 && + id != 4 && + id != 12 && + id != 13 && + id != 80) + continue; + + block.setTypeIdAndData(0, (byte)0, false); + + //Block Replace + Factory.BlockRestore().Add(block, cur.getBlockId(), (byte)0, 10000); + + //Effect + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + } + } + + @EventHandler + public void ItemSpawn(ItemSpawnEvent event) + { + int id = event.getEntity().getItemStack().getTypeId(); + + if ( + id != 1 && + id != 2 && + id != 3 && + id != 4 && + id != 12 && + id != 13 && + id != 80) + return; + + for (FallingBlock block : _falling.keySet()) + if (UtilMath.offset(event.getEntity().getLocation(), block.getLocation()) < 1) + event.setCancelled(true); + } + + @Override + public void Reset(Player player) + { + if (_holding.containsKey(player)) + { + player.eject(); + } + + _holding.remove(player); + _charge.remove(player); + _charged.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Bloodlust.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Bloodlust.java new file mode 100644 index 000000000..581c8c055 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Bloodlust.java @@ -0,0 +1,121 @@ +package mineplex.minecraft.game.classcombat.Skill.Brute; + +import java.util.WeakHashMap; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; + +public class Bloodlust extends Skill +{ + private WeakHashMap _time = new WeakHashMap(); + private WeakHashMap _str = new WeakHashMap(); + + public Bloodlust(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "When an enemy dies within 12 blocks,", + "you go into a Bloodlust, receiving", + "Speed 1 and Strength 1 for 8 seconds.", + "", + "Bloodlust can stack up to 3 times,", + "boosting the level of Speed and Strength." + }); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void PlayerDeath(CombatDeathEvent event) + { + if (!(event.GetEvent().getEntity() instanceof Player)) + return; + + for (Player cur : UtilServer.getPlayers()) + { + if (Expire(cur)) + continue; + + if (!Factory.Relation().CanHurt(cur, (Player)event.GetEvent().getEntity())) + continue; + + //Level + int level = GetLevel(cur); + if (level == 0) continue; + + //Offset + double distance = 12; + if (UtilMath.offset(event.GetEvent().getEntity().getLocation(), cur.getLocation()) > distance) + continue; + + //Strength + int str = 0; + if (_str.containsKey(cur)) + str = _str.get(cur) + 1; + str = Math.min(str, 3); + _str.put(cur, str); + + //Time + double dur = 8; + _time.put(cur, (System.currentTimeMillis() + (long)(dur*1000))); + + //Condition + Factory.Condition().Factory().Speed(GetName(), cur, event.GetEvent().getEntity(), dur, str, false, true, true); + Factory.Condition().Factory().Strength(GetName(), cur, event.GetEvent().getEntity(), dur, str, false, true, true); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), "You entered " + F.skill(GetName(level)) + " at " + F.elem("Level " + (str+1)) + ".")); + + //Effect + cur.getWorld().playSound(cur.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 2f, 0.6f); + } + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : GetUsers()) + Expire(cur); + } + + public boolean Expire(Player player) + { + if (!_time.containsKey(player)) + return false; + + if (System.currentTimeMillis() > _time.get(player)) + { + int str = _str.remove(player); + UtilPlayer.message(player, F.main(GetClassType().name(), "Your " + F.skill(GetName(GetLevel(player))) + + " has ended at " + F.elem("Level " + (str+1)) + ".")); + _time.remove(player); + + return true; + } + + return false; + } + + @Override + public void Reset(Player player) + { + _time.remove(player); + _str.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Brute.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Brute.java new file mode 100644 index 000000000..ad8336cde --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Brute.java @@ -0,0 +1,59 @@ +package mineplex.minecraft.game.classcombat.Skill.Brute; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityShootBowEvent; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Brute extends Skill +{ + public Brute(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "You take 8 more damage from enemy attacks", + "to counter the strenght of Diamond Armor.", + "", + "25% reduction in Arrow Velocity." + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + int level = GetLevel(damagee); + if (level == 0) return; + + //Damage + event.AddMod(damagee.getName(), GetName(), 0, false); + event.SetBrute(); + } + + @EventHandler + public void BowShoot(EntityShootBowEvent event) + { + if (GetLevel(event.getEntity()) == 0) + return; + + event.getProjectile().setVelocity(event.getProjectile().getVelocity().multiply(0.75)); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Colossus.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Colossus.java new file mode 100644 index 000000000..6e14f64d5 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Colossus.java @@ -0,0 +1,47 @@ +package mineplex.minecraft.game.classcombat.Skill.Brute; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Colossus extends Skill +{ + public Colossus(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "You are so huge that you do not", + "take any knockback from attacks." + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + int level = GetLevel(damagee); + if (level == 0) return; + + //Damage + event.AddMod(damagee.getName(), GetName(), 0, false); + event.SetKnockback(false); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/CripplingBlow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/CripplingBlow.java new file mode 100644 index 000000000..ebb807dd5 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/CripplingBlow.java @@ -0,0 +1,71 @@ +package mineplex.minecraft.game.classcombat.Skill.Brute; + +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilServer; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent; + +public class CripplingBlow extends Skill +{ + public CripplingBlow(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Your powerflow axe blows give", + "targets Slow 2 for 2 seconds,", + "as well as no knockback." + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + //Damager + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + //Maul + if (!UtilGear.isAxe(damager.getItemInHand())) + return; + + //Level + int level = GetLevel(damager); + if (level == 0) return; + + //Stun + Factory.Condition().Factory().Slow(GetName(), damagee, damager, 2, 1, false, true, true, true); + + //Damage + event.AddMod(damager.getName(), GetName(), 0, true); + event.SetKnockback(false); + + //Event + UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(damager, GetName(), ClassType.Brute, damagee)); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/DwarfToss.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/DwarfToss.java new file mode 100644 index 000000000..1f799d1a0 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/DwarfToss.java @@ -0,0 +1,360 @@ +package mineplex.minecraft.game.classcombat.Skill.Brute; + +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.EntityEffect; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEntityEvent; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent; +import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; + +public class DwarfToss extends SkillActive +{ + private long _chargeTime = 4000; + private HashSet _used = new HashSet(); + private HashMap _holding = new HashMap(); + private HashMap _charge = new HashMap(); + private HashSet _charged = new HashSet(); + + public DwarfToss(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Hold Block to pick up target player.", + "Release Block to throw them.", + "", + "You must hold the player for", + "4 seconds for full throw power.", + "", + "Players you are holding cannot harm", + "you, or be harmed by others." + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 20 + 12 per Second"; + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (_used.contains(player)) + return false; + + return true; + } + + @Override + public void Skill(Player player, int level) + { + UtilPlayer.message(player, F.main(GetClassType().name(), "You failed " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Miss(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + _used.clear(); + } + + public boolean CanUse(Player player) + { + int level = GetLevel(player); + if (level == 0) return false; + + //Check Material + if (player.getItemInHand() != null) + if (!_itemSet.contains(player.getItemInHand().getType())) + return false; + + //Check Allowed + SkillTriggerEvent trigger = new SkillTriggerEvent(player, GetName(), GetClassType()); + UtilServer.getServer().getPluginManager().callEvent(trigger); + if (trigger.IsCancelled()) + return false; + + //Check Energy/Recharge + if (!EnergyRechargeCheck(player, level)) + return false; + + //Allow + return true; + } + + @EventHandler + public void Grab(PlayerInteractEntityEvent event) + { + if (event.isCancelled()) + return; + + Player player = event.getPlayer(); + + //Level + int level = GetLevel(player); + if (level == 0) return; + + //Set Used + _used.add(player); + + if (!CanUse(player)) + return; + + if (!(event.getRightClicked() instanceof LivingEntity)) + return; + + LivingEntity target = (LivingEntity)event.getRightClicked(); + + if (target instanceof Player) + { + if (((Player)target).getGameMode() != GameMode.SURVIVAL) + { + UtilPlayer.message(player, F.main(GetClassType().name(), F.name(((Player)target).getName()) + " is not attackable.")); + return; + } + } + + //Distance + if (UtilMath.offset(player.getLocation(), target.getLocation()) > 3) + { + UtilPlayer.message(player, F.main(GetClassType().name(), F.name(UtilEnt.getName(target)) + " is too far away.")); + return; + } + + //Hold Loop + if (_holding.containsKey(target)) + if (_holding.get(target).equals(player)) + if (target instanceof Player) + { + UtilPlayer.message(player, F.main(GetClassType().name(), F.name(((Player)target).getName()) + " is already holding you.")); + return; + } + + if (_holding.containsValue(target)) + { + UtilPlayer.message(player, F.main(GetClassType().name(), F.name(UtilEnt.getName(target)) + " is already being held.")); + return; + } + + //Obstruct Check + if (target instanceof Player) + for (int i = 0 ; i < 10 ; i++) + { + Block block = player.getWorld().getBlockAt(player.getEyeLocation() + .add((target.getEyeLocation().toVector().subtract(player.getEyeLocation().toVector())).multiply(i/10d))); + + if (!UtilBlock.airFoliage(block)) + { + UtilPlayer.message(player, F.main(GetClassType().name(), F.name(((Player)target).getName()) + " is obstructed by blocks.")); + return; + } + } + + //Condition Indicators + Factory.Condition().SetIndicatorVisibility(player, false); + + //Action + target.leaveVehicle(); + player.eject(); + player.setPassenger(target); + _holding.put(player, target); + _charge.put(player, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You picked up " + F.name(UtilEnt.getName(target)) + " with " + F.skill(GetName(level)) + ".")); + UtilPlayer.message(target, F.main(GetClassType().name(), F.name(player.getName()) + " grabbed you with " + F.skill(GetName(level)) + ".")); + + //Event + UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(player, GetName(), ClassType.Brute, target)); + + //Effect + target.playEffect(EntityEffect.HURT); + } + + + @EventHandler(priority = EventPriority.LOWEST) + public void DamageePassenger(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + if (!_holding.containsValue(damagee)) + return; + + event.SetCancelled(GetName()); + } + + @EventHandler(priority = EventPriority.LOW) + public void DamagerPassenger(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + LivingEntity damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + if (!_holding.containsKey(damagee)) + return; + + if (!_holding.get(damagee).equals(damager)) + return; + + //Inform + UtilPlayer.message(damager, F.main(GetClassType().name(), "You cannot attack " + F.name(damagee.getName()) + ".")); + + event.SetCancelled(GetName()); + } + + @EventHandler + public void ThrowExpire(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet voidSet = new HashSet(); + HashSet throwSet = new HashSet(); + + for (Player cur : _holding.keySet()) + { + if (cur.getPassenger() == null) + { + voidSet.add(cur); + continue; + } + + if (_holding.get(cur).getVehicle() == null) + { + voidSet.add(cur); + continue; + } + + if (!_holding.get(cur).getVehicle().equals(cur)) + { + voidSet.add(cur); + continue; + } + + //Charged Tick + if (!_charged.contains(cur)) + if (System.currentTimeMillis() - _charge.get(cur) > _chargeTime) + { + _charged.add(cur); + cur.playEffect(cur.getLocation(), Effect.CLICK1, 0); + } + + //Use Energy + if (cur.isBlocking() && !UtilTime.elapsed(_charge.get(cur), 10000)) + Factory.Energy().ModifyEnergy(cur, -0.6); + + //Flag to Throw + else + throwSet.add(cur); + } + + for (Player cur : voidSet) + { + LivingEntity target = _holding.remove(cur); + _charge.remove(cur); + _charged.remove(cur); + int level = GetLevel(cur); + + UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(UtilEnt.getName(target)) + " escaped your " + F.skill(GetName(level)) + ".")); + } + + for (Player cur : throwSet) + { + LivingEntity target = _holding.remove(cur); + long charge = _charge.remove(cur); + int level = GetLevel(cur); + _charged.remove(cur); + + //Throw + cur.eject(); + double mult = 1.5; + if (charge < _chargeTime) + mult = mult * (charge/_chargeTime); + UtilAction.velocity(target, cur.getLocation().getDirection(), mult, false, 0, 0.2, 1.2, true); + + //Condition Indicators + Factory.Condition().SetIndicatorVisibility(cur, true); + + //Condition + Factory.Condition().Factory().Falling(GetName(), target, cur, 10, false, true); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), "You threw " + F.name(UtilEnt.getName(target)) + " with " + F.skill(GetName(level)) + ".")); + UtilPlayer.message(target, F.main(GetClassType().name(), F.name(cur.getName()) + " threw you with " + F.skill(GetName(level)) + ".")); + + //Effect + target.playEffect(EntityEffect.HURT); + } + } + + @Override + public void Reset(Player player) + { + if (_holding.containsKey(player)) + { + player.eject(); + } + + for (Player cur : _holding.keySet()) + { + if (_holding.get(cur).equals(player)) + { + cur.eject(); + _holding.remove(cur); + _charge.remove(cur); + } + } + + _holding.remove(player); + _charge.remove(player); + _charged.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java new file mode 100644 index 000000000..c8139373d --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java @@ -0,0 +1,215 @@ +package mineplex.minecraft.game.classcombat.Skill.Brute; + +import java.util.WeakHashMap; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent; + +public class FleshHook extends SkillActive implements IThrown +{ + private WeakHashMap _charge = new WeakHashMap(); + private WeakHashMap _chargeLast = new WeakHashMap(); + + public FleshHook(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Hold Block to charge Flesh Hook.", + "Release Block to release it.", + "", + "If Flesh Hook hits a player, it", + "deals up to 12 damage, and rips them", + "towards you with high velocity.", + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 20 + (5 per 20% Strength)"; + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Start Charge + _charge.put(player, 0); + _chargeLast.put(player, System.currentTimeMillis()); + } + + @EventHandler + public void ChargeRelease(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + //Not Charging + if (!_charge.containsKey(cur)) + continue; + + //Level + int level = GetLevel(cur); + if (level == 0) return; + + //Add Charge + if (cur.isBlocking()) + { + //Max Charge + if (_charge.get(cur) >= 4) + continue; + + //Charge Interval + if (!UtilTime.elapsed(_chargeLast.get(cur), 400)) + continue; + + //Energy + if (!Factory.Energy().Use(cur, GetName(), 5, true, false)) + continue; + + //Increase Charge + _charge.put(cur, _charge.get(cur) + 1); + _chargeLast.put(cur, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), GetName() + ": " + F.elem("+" + (_charge.get(cur) * 25) + "% Strength"))); + + //Effect + for (int i=_charge.get(cur) ; i>0 ; i--) + cur.playEffect(cur.getLocation(), Effect.CLICK2, 0); + } + + //Release Charge + else + { + double base = 0.8; + + //Action + Item item = cur.getWorld().dropItem(cur.getEyeLocation().add(cur.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(131)); + UtilAction.velocity(item, cur.getLocation().getDirection(), + base + (_charge.remove(cur) * (0.25*base)), false, 0, 0.2, 20, false); + + Factory.Projectile().AddThrow(item, cur, this, -1, true, true, true, + Sound.FIRE_IGNITE, 1.4f, 0.8f, null, 0, UpdateType.TICK, 1.5d); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + + //Effect + item.getWorld().playSound(item.getLocation(), Sound.IRONGOLEM_THROW, 2f, 0.8f); + + } + } + } + + @Override + public void Reset(Player player) + { + _charge.remove(player); + _chargeLast.remove(player); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + //Remove + double velocity = data.GetThrown().getVelocity().length(); + data.GetThrown().remove(); + + if (!(data.GetThrower() instanceof Player)) + return; + + Player player = (Player)data.GetThrower(); + + //Level + int level = GetLevel(player); + if (level == 0) return; + + if (target == null) + return; + + //Pull + UtilAction.velocity(target, + UtilAlg.getTrajectory(target.getLocation(), player.getLocation()), + 2, false, 0, 0.8, 1.5, true); + + //Condition + Factory.Condition().Factory().Falling(GetName(), target, player, 10, false, true); + + //Damage Event + Factory.Damage().NewDamageEvent(target, player, null, + DamageCause.CUSTOM, velocity * 8, false, true, false, + player.getName(), GetName()); + + + //Event + if (target != null) + UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(player, GetName(), ClassType.Brute, target)); + + //Inform + UtilPlayer.message(target, F.main(GetClassType().name(), F.name(player.getName()) + " pulled you with " + F.skill(GetName(level)) + ".")); + } + + @Override + public void Idle(ProjectileUser data) + { + //Remove + data.GetThrown().remove(); + } + + @Override + public void Expire(ProjectileUser data) + { + //Remove + data.GetThrown().remove(); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java.orig b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java.orig new file mode 100644 index 000000000..3eaab1e04 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java.orig @@ -0,0 +1,215 @@ +package mineplex.minecraft.game.classcombat.Skill.Brute; + +import java.util.WeakHashMap; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent; + +public class FleshHook extends SkillActive implements IThrown +{ + private WeakHashMap _charge = new WeakHashMap(); + private WeakHashMap _chargeLast = new WeakHashMap(); + + public FleshHook(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Hold Block to charge Flesh Hook.", + "Release Block to release it.", + "", + "If Flesh Hook hits a player, it", + "deals up to 12 damage, and rips them", + "towards you with high velocity.", + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 20 + (5 per 20% Strength)"; + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Start Charge + _charge.put(player, 0); + _chargeLast.put(player, System.currentTimeMillis()); + } + + @EventHandler + public void ChargeRelease(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + //Not Charging + if (!_charge.containsKey(cur)) + continue; + + //Level + int level = GetLevel(cur); + if (level == 0) return; + + //Add Charge + if (cur.isBlocking()) + { + //Max Charge + if (_charge.get(cur) >= 4) + continue; + + //Charge Interval + if (!UtilTime.elapsed(_chargeLast.get(cur), 400)) + continue; + + //Energy + if (!Factory.Energy().use(cur, GetName(), 5, true, false)) + continue; + + //Increase Charge + _charge.put(cur, _charge.get(cur) + 1); + _chargeLast.put(cur, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), GetName() + ": " + F.elem("+" + (_charge.get(cur) * 25) + "% Strength"))); + + //Effect + for (int i=_charge.get(cur) ; i>0 ; i--) + cur.playEffect(cur.getLocation(), Effect.CLICK2, 0); + } + + //Release Charge + else + { + double base = 0.8; + + //Action + Item item = cur.getWorld().dropItem(cur.getEyeLocation().add(cur.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(131)); + UtilAction.velocity(item, cur.getLocation().getDirection(), + base + (_charge.remove(cur) * (0.25*base)), false, 0, 0.2, 20, false); + + Factory.Projectile().AddThrow(item, cur, this, -1, true, true, true, + Sound.FIRE_IGNITE, 1.4f, 0.8f, null, 0, UpdateType.TICK, 1.5d); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + + //Effect + item.getWorld().playSound(item.getLocation(), Sound.IRONGOLEM_THROW, 2f, 0.8f); + + } + } + } + + @Override + public void Reset(Player player) + { + _charge.remove(player); + _chargeLast.remove(player); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + //Remove + double velocity = data.GetThrown().getVelocity().length(); + data.GetThrown().remove(); + + if (!(data.GetThrower() instanceof Player)) + return; + + Player player = (Player)data.GetThrower(); + + //Level + int level = GetLevel(player); + if (level == 0) return; + + if (target == null) + return; + + //Pull + UtilAction.velocity(target, + UtilAlg.getTrajectory(target.getLocation(), player.getLocation()), + 2, false, 0, 0.8, 1.5, true); + + //Condition + Factory.Condition().Factory().Falling(GetName(), target, player, 10, false, true); + + //Damage Event + Factory.Damage().NewDamageEvent(target, player, null, + DamageCause.CUSTOM, velocity * 8, false, true, false, + player.getName(), GetName()); + + + //Event + if (target != null) + UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(player, GetName(), ClassType.Brute, target)); + + //Inform + UtilPlayer.message(target, F.main(GetClassType().name(), F.name(player.getName()) + " pulled you with " + F.skill(GetName(level)) + ".")); + } + + @Override + public void Idle(ProjectileUser data) + { + //Remove + data.GetThrown().remove(); + } + + @Override + public void Expire(ProjectileUser data) + { + //Remove + data.GetThrown().remove(); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Intimidation.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Intimidation.java new file mode 100644 index 000000000..5e0a23734 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Intimidation.java @@ -0,0 +1,62 @@ +package mineplex.minecraft.game.classcombat.Skill.Brute; + +import java.util.HashMap; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Intimidation extends Skill +{ + public Intimidation(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "You intimidate nearby enemies;", + "Enemies within 8 blocks receive Slow 1.", + "Enemies within 4 blocks receive Slow 2.", + "Enemies within 2 blocks receive Slow 3." + }); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + int level = GetLevel(cur); + if (level == 0) continue; + + HashMap targets = UtilPlayer.getInRadius(cur.getLocation(), 2d * level); + for (Player other : targets.keySet()) + if (!other.equals(cur)) + if (Factory.Relation().CanHurt(cur, other)) + if (GetLevel(other) < level) + { + double dist = targets.get(other); + int mult = 0; + if (dist <= 2) mult = 2; + else if (dist <= 4) mult = 1; + + Factory.Condition().Factory().Slow(GetName(), other, cur, 0.9, mult, false, true, false, true); + } + } + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Overwhelm.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Overwhelm.java new file mode 100644 index 000000000..7022671c6 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Overwhelm.java @@ -0,0 +1,65 @@ +package mineplex.minecraft.game.classcombat.Skill.Brute; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +public class Overwhelm extends Skill +{ + public Overwhelm(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "You deal 1 bonus damage for every", + "2 more health you have than your", + "target. You can deal a maximum of", + "3 bonus damage." + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + //Damager + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + double diff = (damager.getHealth() - damagee.getHealth())/2; + + if (diff <= 0) + return; + + //Level + int level = GetLevel(damager); + if (level == 0) return; + + diff = Math.min(diff, 3); + + //Damage + event.AddMod(damager.getName(), GetName(), diff, true); + } + + @Override + public void Reset(Player player) + { + + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Rampage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Rampage.java new file mode 100644 index 000000000..058415754 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Rampage.java @@ -0,0 +1,166 @@ +package mineplex.minecraft.game.classcombat.Skill.Brute; + +import java.util.HashSet; +import java.util.WeakHashMap; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Rampage extends SkillActive +{ + private WeakHashMap _rampageStart = new WeakHashMap(); + private WeakHashMap _rampageCharge = new WeakHashMap(); + private WeakHashMap _rampageBonus = new WeakHashMap(); + + public Rampage(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Go into a rampage", + "* Slow I for 6 + 2pL seconds", + "* +1 Damage per 2 seconds you've been in Rampage", + "Rampage ends;", + "* If you don't attack/get attacked for 2 + 1pL seconds", + "* After 6 + 2pL seconds" + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + _rampageStart.put(player, System.currentTimeMillis()); + _rampageCharge.put(player, System.currentTimeMillis()); + _rampageBonus.put(player, 0); + + //Slow + Factory.Condition().Factory().Slow(GetName(), player, player, 6 + (level * 2), 0, false, true, false, true); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 2f, 0.5f); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + if (!_rampageBonus.containsKey(damager)) + return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + //Damage + event.AddMod(damager.getName(), GetName(), _rampageBonus.get(damager), true); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + HashSet remove = new HashSet(); + + for (Player cur : _rampageStart.keySet()) + { + int level = GetLevel(cur); + if (level == 0) + { + remove.add(cur); + continue; + } + + //Not Damaged + if (UtilTime.elapsed(Factory.Combat().Get(cur).LastCombat, 2000 + (1000 * level))) + { + if (_rampageStart.get(cur) != null && UtilTime.elapsed(_rampageStart.get(cur), 2000 + (1000 * level))) + { + remove.add(cur); + continue; + } + } + + //Rampage Over + if (UtilTime.elapsed(_rampageStart.get(cur), 6000 + (level * 2000))) + { + remove.add(cur); + continue; + } + + //Level Up + if (UtilTime.elapsed(_rampageCharge.get(cur), 2000)) + { + _rampageCharge.put(cur, System.currentTimeMillis()); + _rampageBonus.put(cur, _rampageBonus.get(cur) + 1); + UtilPlayer.message(cur, F.main(GetClassType().name(), GetName() + ": " + F.elem("+" + _rampageBonus.get(cur) + " Damage"))); + + //Effect + cur.getWorld().playSound(cur.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 0.5f, 0.5f + (_rampageBonus.get(cur) * 0.1f)); + } + } + + for (Player cur : remove) + { + _rampageStart.remove(cur); + _rampageCharge.remove(cur); + _rampageBonus.remove(cur); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), "Your " + F.skill(GetName()) + " has ended.")); + } + } + + @Override + public void Reset(Player player) + { + _rampageStart.remove(player); + _rampageCharge.remove(player); + _rampageBonus.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/SeismicSlam.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/SeismicSlam.java new file mode 100644 index 000000000..93981fceb --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/SeismicSlam.java @@ -0,0 +1,174 @@ +package mineplex.minecraft.game.classcombat.Skill.Brute; + +import java.util.HashMap; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent; + +public class SeismicSlam extends SkillActive +{ + private HashMap _live = new HashMap(); + private HashMap _height = new HashMap(); + + public SeismicSlam(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Jump up and slam back into the ground.", + "Players within 6 Blocks take up to", + "6 damage and are thrown into the air.", + "", + "You receive Slow 2 for 6 seconds." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + Vector vec = player.getLocation().getDirection(); + if (vec.getY() < 0) + vec.setY(vec.getY() * -1); + + UtilAction.velocity(player, vec, 0.6, false, 0, 0.6, 0.6, true); + + //Record + _live.put(player, System.currentTimeMillis()); + _height.put(player, player.getLocation().getY()); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + } + + @EventHandler + public void Slam(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : GetUsers()) + { + if (!UtilEnt.isGrounded(player)) + continue; + + if (!_live.containsKey(player)) + continue; + + int level = GetLevel(player); + if (level == 0) continue; + + if (!UtilTime.elapsed(_live.get(player), 1000)) + continue; + + _live.remove(player); + + //Bonus + double mult = 1; + if (_height.containsKey(player)) + { + mult += (_height.remove(player) - player.getLocation().getY()) / 20; + mult = Math.min(mult, 2); + UtilPlayer.message(player, F.main(GetClassType().name(), + GetName() + ": " + F.elem(((int)((mult) * 100)) + "% Effectiveness"))); + } + + + //Action + int damage = 6; + double range = (6) * mult; + HashMap targets = UtilEnt.getInRadius(player.getLocation(), range); + for (LivingEntity cur : targets.keySet()) + { + if (cur.equals(player)) + continue; + + if (!UtilEnt.isGrounded(player)) + continue; + + //Damage Event + Factory.Damage().NewDamageEvent(cur, player, null, + DamageCause.CUSTOM, damage * targets.get(cur) + 0.5, false, true, false, + player.getName(), GetName()); + + //Velocity + UtilAction.velocity(cur, + UtilAlg.getTrajectory2d(player.getLocation().toVector(), cur.getLocation().toVector()), + 1.8 * targets.get(cur) * mult, true, 0, 0.4 + 1.0 * targets.get(cur) * mult, 1.6 * mult, true); + + //Condition + Factory.Condition().Factory().Falling(GetName(), cur, player, 10, false, true); + + //Inform + if (cur instanceof Player) + UtilPlayer.message((Player)cur, F.main(GetClassType().name(), F.name(player.getName()) +" hit you with " + F.skill(GetName(level)) + ".")); + } + + //Slow + Factory.Condition().Factory().Slow(GetName(), player, player, 6, 1, false, true, false, true); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f); + for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet()) + if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur)) + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId()); + + //Event + UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(player, GetName(), ClassType.Brute, targets.keySet())); + } + } + + @Override + public void Reset(Player player) + { + _live.remove(player); + _height.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Stampede.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Stampede.java new file mode 100644 index 000000000..bbd6f4438 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Stampede.java @@ -0,0 +1,166 @@ +package mineplex.minecraft.game.classcombat.Skill.Brute; + +import java.util.WeakHashMap; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent; + +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.potion.PotionEffectType; + +public class Stampede extends Skill +{ + private WeakHashMap _sprintTime = new WeakHashMap(); + private WeakHashMap _sprintStr = new WeakHashMap(); + + public Stampede(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "You slowly build up speed as you", + "sprint. You gain a level of Speed", + "for every 3 seconds, up to a max", + "of Speed 3.", + "", + "Attacking during stampede deals", + "2 bonus damage per speed level,", + "as well as large knockback." + }); + } + + @EventHandler + public void Skill(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + for (Player cur : GetUsers()) + { + int level = GetLevel(cur); + if (level == 0) continue; + + //Active - Check for Disable + if (_sprintTime.containsKey(cur)) + { + //Stopped + if (!cur.isSprinting()) + { + _sprintTime.remove(cur); + _sprintStr.remove(cur); + cur.removePotionEffect(PotionEffectType.SPEED); + continue; + } + + long time = _sprintTime.get(cur); + int str = _sprintStr.get(cur); + + //Apply Speed + if (str > 0) + Factory.Condition().Factory().Speed(GetName(), cur, cur, 1.9, str-1, false, true, true); + + //Upgrade Speed + if (!UtilTime.elapsed(time, 3000)) + continue; + + _sprintTime.put(cur, System.currentTimeMillis()); + + if (str < 3) + { + _sprintStr.put(cur, str+1); + + //Effect + cur.getWorld().playSound(cur.getLocation(), Sound.ZOMBIE_IDLE, 2f, 0.2f * str+1); + } + + //Event + UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(cur, GetName(), ClassType.Brute)); + } + else if (cur.isSprinting()) + { + //Start Timer + if (!_sprintTime.containsKey(cur)) + { + _sprintTime.put(cur, System.currentTimeMillis()); + _sprintStr.put(cur, 0); + } + } + } + } + + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!_sprintStr.containsKey(damager)) + return; + + if (_sprintStr.get(damager) == 0) + return; + + int level = GetLevel(damager); + if (level == 0) return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + //Remove + _sprintTime.remove(damager); + int str = _sprintStr.remove(damager); + damager.removePotionEffect(PotionEffectType.SPEED); + + //Damage + event.AddMod(damager.getName(), GetName(), str * 2, true); + event.SetKnockback(false); + + //Velocity + if (UtilEnt.isGrounded(damagee)) + UtilAction.velocity(damagee, UtilAlg.getTrajectory2d(damager, damagee), 3, true, 0, 0.8, 1, true); + else + UtilAction.velocity(damagee, UtilAlg.getTrajectory2d(damager, damagee), 1.5, true, 0, 0.8, 1, true); + + //Inform + UtilPlayer.message(damager, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + UtilPlayer.message(damagee, F.main(GetClassType().name(), F.name(damager.getName()) + " hit you with " + F.skill(GetName(level)) + ".")); + + //Effect + damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_WOOD, 1f, 0.4f * str); + + //Event + UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(damager, GetName(), ClassType.Brute, damagee)); + } + + @Override + public void Reset(Player player) + { + _sprintTime.remove(player); + _sprintStr.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Takedown.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Takedown.java new file mode 100644 index 000000000..681d7a256 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Takedown.java @@ -0,0 +1,187 @@ +package mineplex.minecraft.game.classcombat.Skill.Brute; + +import java.util.HashMap; + +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Takedown extends SkillActive +{ + private HashMap _live = new HashMap(); + + public Takedown(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Hurl yourself towards an opponent.", + "If you collide with them, you " + C.cWhite + "both", + "take 10 damage and receive Slow 4", + "for 6 seconds." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + if (UtilEnt.isGrounded(player)) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " while grounded.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + Vector vec = player.getLocation().getDirection(); + + UtilAction.velocity(player, vec, 1.2, false, 0, 0.2, 0.4, false); + + //Record + _live.put(player, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + } + + @EventHandler + public void End(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + //End + for (Player player : GetUsers()) + { + if (!UtilEnt.isGrounded(player)) + continue; + + if (!_live.containsKey(player)) + continue; + + int level = GetLevel(player); + if (level == 0) continue; + + if (!UtilTime.elapsed(_live.get(player), 1000)) + continue; + + _live.remove(player); + } + + //Collide + for (Player player : GetUsers()) + if (_live.containsKey(player)) + for (Player other : player.getWorld().getPlayers()) + if (other.getGameMode() == GameMode.SURVIVAL) + if (!other.equals(player)) + if (Factory.Relation().CanHurt(player, other)) + if (UtilMath.offset(player, other) < 2) + { + DoTakeDown(player, other); + _live.remove(player); + return; + } + + } + + /** + @EventHandler(priority = EventPriority.LOW) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + int level = GetLevel(damager); + if (level == 0) return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + if (UtilMath.offset(damager, damagee) > 3) + return; + + if (_live.remove(damager) == null) + return; + + event.SetCancelled("Takedown Cancel"); + + DoTakeDown(damager, damagee); + } + **/ + + public void DoTakeDown(Player damager, LivingEntity damagee) + { + int level = GetLevel(damager); + int damage = 10; + + //Damage Event + Factory.Damage().NewDamageEvent(damager, damagee, null, + DamageCause.CUSTOM, damage, false, true, false, + damager.getName(), GetName() + " Recoil"); + + //Damage Event + Factory.Damage().NewDamageEvent(damagee, damager, null, + DamageCause.CUSTOM, damage, false, true, false, + damager.getName(), GetName()); + + //Conditions + Factory.Condition().Factory().Slow(GetName(), damagee, damager, 6, 3, false, true, true, true); + Factory.Condition().Factory().Slow(GetName(), damager, damager, 6, 3, false, true, true, true); + + //Inform + UtilPlayer.message(damager, F.main(GetClassType().name(), "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName(level)) + ".")); + UtilPlayer.message(damagee, F.main(GetClassType().name(), F.name(damager.getName()) + " hit you with " + F.skill(GetName(level)) + ".")); + } + + @Override + public void Reset(Player player) + { + _live.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/BreakFall.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/BreakFall.java new file mode 100644 index 000000000..b2850321e --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/BreakFall.java @@ -0,0 +1,49 @@ +package mineplex.minecraft.game.classcombat.Skill.Global; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class BreakFall extends Skill +{ + public BreakFall(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "You roll when you hit the ground;", + "Fall damage is reduced by 2.", + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.FALL) + return; + + Player player = event.GetDamageePlayer(); + if (player == null) return; + + int level = GetLevel(player); + if (level == 0) return; + + event.AddMod(null, GetName(), -2, false); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Fitness.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Fitness.java new file mode 100644 index 000000000..283a0588e --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Fitness.java @@ -0,0 +1,33 @@ +package mineplex.minecraft.game.classcombat.Skill.Global; + +import org.bukkit.entity.Player; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Fitness extends Skill +{ + public Fitness(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "You are extremely fit;", + "Maximum Energy is increased by 60 (33%)." + }); + } + + @Override + public void OnPlayerAdd(Player player) + { + Factory.Energy().AddEnergyMaxMod(player, GetName(), 60); + } + + @Override + public void Reset(Player player) + { + Factory.Energy().RemoveEnergyMaxMod(player, GetName()); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Pistol.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Pistol.java new file mode 100644 index 000000000..28d3b0f24 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Pistol.java @@ -0,0 +1,203 @@ +package mineplex.minecraft.game.classcombat.Skill.Global; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.block.Action; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Pistol extends SkillActive +{ + public Pistol(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Pew Pew" + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + //Use Gunpowder + if (!UtilInv.remove(player, Material.MELON_SEEDS, (byte)0, 1)) + { + UtilPlayer.message(player, F.main("Skill", "You need " + F.item("Pistol Ammo") + " to use " + F.skill(GetName()) + ".")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + double sharpness = 0.1; + + double travel = 0; + double maxTravel = 100; + + double hitBox = 0.5; + + //Effect + player.getWorld().playEffect(player.getEyeLocation().add(player.getLocation().getDirection()), Effect.SMOKE, 4); + player.getWorld().playSound(player.getEyeLocation(), Sound.EXPLODE, 0.6f, 2f); + + while (travel < maxTravel) + { + Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(travel)); + for (Entity ent : player.getWorld().getEntities()) + { + if (!(ent instanceof LivingEntity)) + continue; + + LivingEntity cur = (LivingEntity)ent; + + if (cur.equals(player)) + continue; + + if (cur instanceof Player) + { + if (UtilMath.offset(loc, ((Player)cur).getEyeLocation()) < 0.3) + { + rifleHit(cur, player, true); + player.getWorld().playSound(loc, Sound.BLAZE_HIT, 0.4f, 2f); + return; + } + else if (UtilMath.offset2d(loc, cur.getLocation()) < hitBox) + { + if (loc.getY() > cur.getLocation().getY() && loc.getY() < cur.getEyeLocation().getY()) + { + rifleHit(cur, player, false); + player.getWorld().playSound(loc, Sound.BLAZE_HIT, 0.4f, 2f); + return; + } + } + } + else + { + if (UtilMath.offset(loc, cur.getEyeLocation()) < 0.3) + { + rifleHit(cur, player, true); + player.getWorld().playSound(loc, Sound.BLAZE_HIT, 0.4f, 2f); + return; + } + else if (UtilMath.offset2d(loc, cur.getLocation()) < hitBox) + { + if (loc.getY() > cur.getLocation().getY() && loc.getY() < cur.getLocation().getY() + 1) + { + rifleHit(cur, player, false); + player.getWorld().playSound(loc, Sound.BLAZE_HIT, 0.4f, 2f); + return; + } + } + } + + if (UtilMath.offset2d(loc, cur.getLocation()) < hitBox) + { + if (loc.getY() > cur.getLocation().getY() && loc.getY() < cur.getEyeLocation().getY()) + { + rifleHit(cur, player, false); + player.getWorld().playSound(loc, Sound.BLAZE_HIT, 0.4f, 2f); + return; + } + } + } + + if (UtilBlock.solid(loc.getBlock())) + { + loc.getBlock().getWorld().playEffect(loc, Effect.STEP_SOUND, loc.getBlock().getTypeId()); + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_HIT, 0.4f, 2f); + return; + } + + travel += sharpness; + } + } + + public void rifleHit(LivingEntity hit, Player attacker, boolean headshot) + { + /* + int damage = 12; + if (headshot) + { + if (hit instanceof Player) + { + Player damagee = (Player)hit; + if (Factory.Clans().CUtil().canHurt(damagee, attacker)) + { + if (damagee.getInventory().getHelmet() == null) + { + //Damage + damage = 500; + damagee.getWorld().playEffect(damagee.getEyeLocation(), Effect.STEP_SOUND, 55); + + //Inform + UtilServer.broadcast(F.main("Item", F.name(((Player)hit).getName()) + " was headshotted by " + F.name(attacker.getName()) + " with " + F.item("Rifle") + ".")); + } + else + { + int id = 55; + if (damagee.getInventory().getHelmet().getType() == Material.IRON_HELMET) id = 42; + if (damagee.getInventory().getHelmet().getType() == Material.GOLD_HELMET) id = 41; + if (damagee.getInventory().getHelmet().getType() == Material.DIAMOND_HELMET) id = 57; + if (damagee.getInventory().getHelmet().getType() == Material.CHAINMAIL_HELMET) id = 4; + if (damagee.getInventory().getHelmet().getType() == Material.LEATHER_HELMET) id = 17; + damagee.getWorld().playEffect(damagee.getEyeLocation(), Effect.STEP_SOUND, id); + + Item item = damagee.getWorld().dropItemNaturally(damagee.getEyeLocation(), damagee.getInventory().getHelmet()); + item.setPickupDelay(60); + damagee.getInventory().setHelmet(null); + } + } + } + else + { + hit.getWorld().playEffect(hit.getEyeLocation(), Effect.STEP_SOUND, 55); + damage = 500; + } + } + + if (damage > 0) + return; + //UtilPlayer.Damage(hit, attacker, damage, GetName(), true, true, false); + */ + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/QuickRecovery.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/QuickRecovery.java new file mode 100644 index 000000000..bd5572095 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/QuickRecovery.java @@ -0,0 +1,41 @@ +package mineplex.minecraft.game.classcombat.Skill.Global; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent; + +public class QuickRecovery extends Skill +{ + public QuickRecovery(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "You are adept at recovering from Slow.", + "Slow durations on you are 50% shorter", + "and level is decreased by 1." + }); + } + + @EventHandler + public void Resist(ConditionApplyEvent event) + { + if (event.GetCondition().GetType() != ConditionType.SLOW) + return; + + event.GetCondition().ModifyTicks((int) (event.GetCondition().GetTicksTotal() * -0.5)); + event.GetCondition().ModifyMult(-1); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Rations.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Rations.java new file mode 100644 index 000000000..5d79f1ba4 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Rations.java @@ -0,0 +1,56 @@ +package mineplex.minecraft.game.classcombat.Skill.Global; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Rations extends Skill +{ + public Rations(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "After not moving for 3 seconds,", + "you snack on rations, slowly", + "replenishing your hunger." + }); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Player cur : UtilServer.getPlayers()) + { + int level = GetLevel(cur); + + if (level > 0) + { + if (UtilTime.elapsed(Factory.Movement().Get(cur).LastMovement, 3000)) + { + cur.setSaturation(0f); + cur.setExhaustion(0f); + UtilPlayer.hunger(cur, 1); + } + } + } + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Recharge.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Recharge.java new file mode 100644 index 000000000..53d7aa937 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Recharge.java @@ -0,0 +1,52 @@ +package mineplex.minecraft.game.classcombat.Skill.Global; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.energy.event.EnergyEvent; +import mineplex.core.energy.event.EnergyEvent.EnergyChangeReason; +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Recharge extends Skill +{ + public Recharge(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "For every 1.5 seconds since you", + "last used Energy, you receive", + "+50% Energy regenerate rate.", + "", + "Maximum of +300% bonus." + }); + } + + @EventHandler + public void Skill(EnergyEvent event) + { + if (event.GetReason() != EnergyChangeReason.Recharge) + return; + + if (GetLevel(event.GetPlayer()) <= 0) + return; + + long duration = System.currentTimeMillis() - Factory.Energy().Get(event.GetPlayer()).LastEnergy; + + int bonus = (int) (duration / 1500); + + if (bonus > 6) + bonus = 6; + + event.AddMod(bonus * 0.2); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Resistance.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Resistance.java new file mode 100644 index 000000000..311756dfc --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Resistance.java @@ -0,0 +1,44 @@ +package mineplex.minecraft.game.classcombat.Skill.Global; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent; + +public class Resistance extends Skill +{ + public Resistance(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Your body and mind is exceptionally resistant.", + "Durations on you are 50% shorter for;", + "Fire, Shock, Confusion, Poison, Blindness." + }); + } + + @EventHandler + public void Resist(ConditionApplyEvent event) + { + if (event.GetCondition().GetType() != ConditionType.BURNING && + event.GetCondition().GetType() != ConditionType.SHOCK && + event.GetCondition().GetType() != ConditionType.CONFUSION && + event.GetCondition().GetType() != ConditionType.POISON && + event.GetCondition().GetType() != ConditionType.BLINDNESS) + return; + + event.GetCondition().ModifyTicks((int) (event.GetCondition().GetTicksTotal() * 0.5)); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Stamina.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Stamina.java new file mode 100644 index 000000000..63200eafe --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Stamina.java @@ -0,0 +1,33 @@ +package mineplex.minecraft.game.classcombat.Skill.Global; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +import org.bukkit.entity.Player; + +public class Stamina extends Skill +{ + public Stamina(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "You have exceptional Stamina;", + "Swinging weapons uses 75% less Energy." + }); + } + + @Override + public void OnPlayerAdd(Player player) + { + Factory.Energy().AddEnergySwingMod(player, GetName(), -3); + } + + @Override + public void Reset(Player player) + { + Factory.Energy().RemoveEnergySwingMod(player, GetName()); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Swim.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Swim.java new file mode 100644 index 000000000..052d43b28 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Swim.java @@ -0,0 +1,69 @@ +package mineplex.minecraft.game.classcombat.Skill.Global; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerToggleSneakEvent; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.UtilAction; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Swim extends Skill +{ + public Swim(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Tap Crouch to Swim forwards." + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 5"; + } + + @EventHandler(priority=EventPriority.HIGHEST) + public void Crouch(PlayerToggleSneakEvent event) + { + if (event.isCancelled()) + return; + + Player player = event.getPlayer(); + + //Water + if (player.getLocation().getBlock().getTypeId() != 8 && player.getLocation().getBlock().getTypeId() != 9) + return; + + //Level + int level = GetLevel(player); + + if (level == 0) + return; + + //Recharge + if (!mineplex.core.recharge.Recharge.Instance.use(player, GetName(), GetName(level), 800, false)) + return; + + if (!Factory.Energy().Use(player, GetName(level), 5, true, false)) + return; + + //Action + UtilAction.velocity(player, 0.6, 0.2, 0.6, false); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 0.3f, 2f); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/ISkill.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/ISkill.java new file mode 100644 index 000000000..4d1b6147e --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/ISkill.java @@ -0,0 +1,36 @@ +package mineplex.minecraft.game.classcombat.Skill; + +import java.util.List; + +import org.bukkit.entity.Player; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; + +public interface ISkill +{ + public enum SkillType + { + Axe, + Bow, + Sword, + PassiveA, + PassiveB, + GlobalPassive, + Class, + } + + String GetName(); + ClassType GetClassType(); + SkillType GetSkillType(); + int GetCost(); + boolean IsFree(); + String[] GetDesc(); + void Reset(Player player); + + List GetUsers(); + void AddUser(Player player); + void RemoveUser(Player player); + + Integer GetSalesPackageId(); + +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/ISkillFactory.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/ISkillFactory.java new file mode 100644 index 000000000..1aff4cec1 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/ISkillFactory.java @@ -0,0 +1,13 @@ +package mineplex.minecraft.game.classcombat.Skill; + +import java.util.HashMap; +import java.util.List; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass; + +public interface ISkillFactory +{ + List GetGlobalSkills(); + List GetSkillsFor(IPvpClass gameClass); + HashMap GetDefaultSkillsFor(IPvpClass gameClass); +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/BullsCharge.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/BullsCharge.java new file mode 100644 index 000000000..bd215aa24 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/BullsCharge.java @@ -0,0 +1,122 @@ +package mineplex.minecraft.game.classcombat.Skill.Knight; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class BullsCharge extends SkillActive +{ + public BullsCharge(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Charge forwards with Speed II for", + "8 seconds. If you attack during this", + "time, your target receives Slow 4", + "for 4 seconds, as well as no knockback." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + Factory.Condition().Factory().Speed(GetName(), player, player, 8, 1, false, true, true); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_SCREAM, 1.5f, 0f); + player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 49); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(true); + LivingEntity damagee = event.GetDamageeEntity(); + + if (damager == null || damagee == null) + return; + + //Isn't using Bulls Charge + if (!Factory.Condition().HasCondition(damager, ConditionType.SPEED, GetName())) + return; + + //Level + int level = GetLevel(damager); + if (level == 0) return; + + //Condition + Factory.Condition().Factory().Slow(GetName(), damagee, damager, 4, 3, false, true, true, true); + Factory.Condition().EndCondition(damager, ConditionType.SPEED, GetName()); + + //Damage + //event.AddMod(damager.getName(), GetName(), level, true); + event.SetKnockback(false); + + //Effect + damager.getWorld().playSound(damager.getLocation(), Sound.ENDERMAN_SCREAM, 1.5f, 0f); + damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_METAL, 1.5f, 0.5f); + + //Inform + UtilPlayer.message(damagee, F.main(GetClassType().name(), + F.name(damager.getName()) + " hit you with " + F.skill(GetName(level)) + ".")); + + UtilPlayer.message(damager, F.main(GetClassType().name(), + "You hit " + F.name(UtilEnt.getName(damagee)) +" with " + F.skill(GetName(level)) + ".")); + } + + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Cleave.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Cleave.java new file mode 100644 index 000000000..187ad6b11 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Cleave.java @@ -0,0 +1,79 @@ +package mineplex.minecraft.game.classcombat.Skill.Knight; + +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Cleave extends Skill +{ + public Cleave(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Your attacks hit all opponents", + "within 2 Blocks of your target.", + "", + "This only applies for Axes." + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Skill(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + if (event.GetReason() != null) + return; + + //Damager + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!UtilGear.isAxe(damager.getItemInHand())) + return; + + int level = GetLevel(damager); + if (level == 0) return; + + //Damagee + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + //Damage + event.AddMod(damager.getName(), GetName(), 0, false); + + //Splash + for (Player other : UtilPlayer.getNearby(damagee.getLocation(), 2.4)) + { + if (!other.equals(damagee)) + if (Factory.Relation().CanHurt(damager, other)) + { + //Damage Event + Factory.Damage().NewDamageEvent(other, damager, null, + DamageCause.ENTITY_ATTACK, event.GetDamageInitial(), true, false, false, + damager.getName(), GetName()); + } + } + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.java new file mode 100644 index 000000000..24d847956 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.java @@ -0,0 +1,125 @@ +package mineplex.minecraft.game.classcombat.Skill.Knight; + +import java.util.HashMap; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class DefensiveStance extends SkillActive +{ + private HashMap _useTime = new HashMap(); + + public DefensiveStance(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "While Blocking, you are immune to all", + "damage from attacks infront of you." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + return true; + } + + @Override + public void Skill(Player player, int level) + { + _useTime.put(player, System.currentTimeMillis()); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damager(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK && event.GetCause() != DamageCause.PROJECTILE) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!_useTime.containsKey(damager)) + return; + + if (UtilTime.elapsed(_useTime.get(damager), 500)) + return; + + event.SetCancelled(GetName() + " Attack"); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damagee(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK && event.GetCause() != DamageCause.PROJECTILE) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + if (!damagee.isBlocking()) + return; + + int level = GetLevel(damagee); + if (level == 0) return; + + LivingEntity damager = event.GetDamagerEntity(true); + if (damager == null) return; + + Vector look = damagee.getLocation().getDirection(); + look.setY(0); + look.normalize(); + + Vector from = UtilAlg.getTrajectory(damagee, damager); + from.normalize(); + + if (damagee.getLocation().getDirection().subtract(from).length() > 0.6) + return; + + //Damage + //event.SetKnockback(false); + event.SetCancelled(GetName() + " Defense"); + //event.AddMod(damagee.getName(), GetName(), -5, true); + + //Effect + damagee.getWorld().playSound(damagee.getLocation(), Sound.ZOMBIE_METAL, 1f, 2f); + } + + @Override + public void Reset(Player player) + { + _useTime.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Deflection.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Deflection.java new file mode 100644 index 000000000..9e4b7eeb2 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Deflection.java @@ -0,0 +1,83 @@ +package mineplex.minecraft.game.classcombat.Skill.Knight; + +import java.util.HashMap; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Deflection extends Skill +{ + private HashMap _charges = new HashMap(); + + public Deflection(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Prepare to deflect incoming attacks.", + "You gain 1 Charge every 3 seconds.", + "You can store a maximum of 5 Charges.", + "", + "When you are attacked, the damage is", + "reduced by the number of your Charges,", + "and your Charges reset to 0.", + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void DecreaseDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + //Damagee + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + if (!_charges.containsKey(damagee)) + return; + + event.AddMod(damagee.getName(), GetName(), -_charges.remove(damagee), false); + } + + @EventHandler + public void Charge(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!Recharge.Instance.use(cur, GetName(), 3000, false)) + continue; + + int charge = 1; + if (_charges.containsKey(cur)) + charge += _charges.get(cur); + + charge = Math.min(5, charge); + + _charges.put(cur, charge); + } + } + + @Override + public void Reset(Player player) + { + _charges.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Fortitude.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Fortitude.java new file mode 100644 index 000000000..1e0be9fc8 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Fortitude.java @@ -0,0 +1,98 @@ +package mineplex.minecraft.game.classcombat.Skill.Knight; + +import java.util.HashSet; +import java.util.WeakHashMap; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Fortitude extends Skill +{ + private WeakHashMap _health = new WeakHashMap(); + private WeakHashMap _last = new WeakHashMap(); + + public Fortitude(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "After taking damage, you slowly", + "regenerate up to 5 health, at a", + "rate of 1 health per 1.5 seconds.", + "", + "This does not stack, and is reset", + "if you are hit again." + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void RegisterLast(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + int damage = (int) (event.GetDamage()/2); + if (damage <= 0) return; + + //Damager + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + int level = GetLevel(damagee); + if (level == 0) return; + + _health.put(damagee, Math.min(5, damage)); + _last.put(damagee, System.currentTimeMillis()); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + HashSet remove = new HashSet(); + + for (Player cur : _health.keySet()) + { + int level = GetLevel(cur); + if (level == 0) continue; + + if (UtilTime.elapsed(_last.get(cur), 1500)) + { + _health.put(cur, _health.get(cur) - 1); + _last.put(cur, System.currentTimeMillis()); + + if (_health.get(cur) <= 0) + remove.add(cur); + + //Heal + UtilPlayer.health(cur, 1); + } + } + + for (Player cur : remove) + { + _health.remove(cur); + _last.remove(cur); + } + } + + @Override + public void Reset(Player player) + { + _health.remove(player); + _last.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/HiltSmash.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/HiltSmash.java new file mode 100644 index 000000000..15fe339b3 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/HiltSmash.java @@ -0,0 +1,177 @@ +package mineplex.minecraft.game.classcombat.Skill.Knight; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEntityEvent; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; + +public class HiltSmash extends SkillActive +{ + private HashSet _used = new HashSet(); + + public HiltSmash(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Smash the hilt of your sword into", + "your opponent, dealing 6 damage", + "and Slow 5 for 0.5 seconds." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (_used.contains(player)) + return false; + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You missed " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Miss(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + _used.clear(); + } + + public boolean CanUse(Player player) + { + int level = GetLevel(player); + if (level == 0) + return false; + + //Check Material + if (!_itemSet.contains(player.getItemInHand().getType())) + return false; + + //Check Allowed + SkillTriggerEvent trigger = new SkillTriggerEvent(player, GetName(), GetClassType()); + UtilServer.getServer().getPluginManager().callEvent(trigger); + if (trigger.IsCancelled()) + return false; + + //Check Energy/Recharge + if (!EnergyRechargeCheck(player, level)) + return false; + + //Allow + return true; + } + + @EventHandler + public void Hit(PlayerInteractEntityEvent event) + { + if (event.isCancelled()) + return; + + Player player = event.getPlayer(); + + //Level + int level = GetLevel(player); + if (level == 0) return; + + if (!CanUse(player)) + return; + + Entity ent = event.getRightClicked(); + + if (ent == null) + return; + + if (!(ent instanceof LivingEntity)) + return; + + if (UtilMath.offset(player, ent) > 2.2) + { + UtilPlayer.message(player, F.main(GetClassType().name(), "You missed " + F.skill(GetName()) + ".")); + return; + } + + //Set Used + _used.add(player); + + //Damage Event + Factory.Damage().NewDamageEvent((LivingEntity)ent, player, null, + DamageCause.ENTITY_ATTACK, 5, false, true, false, + player.getName(), GetName()); + } + + @EventHandler + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + int level = GetLevel(damager); + if (level == 0) return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + return; + + //Condition + Factory.Condition().Factory().Slow(GetName(), damagee, damager, 0.5, 4, false, true, true, true); + + //Effect + damagee.getWorld().playSound(damagee.getLocation(), Sound.ZOMBIE_WOOD, 1f, 1.2f); + + //Inform + UtilPlayer.message(damager, F.main(GetClassType().name(), "You used " + F.skill(GetName()) + ".")); + UtilPlayer.message(damagee, F.main(GetClassType().name(), F.name(damager.getName()) + " hit you with " + F.skill(GetName(level)) + ".")); + } + + @Override + public void Reset(Player player) + { + _used.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/HoldPosition.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/HoldPosition.java new file mode 100644 index 000000000..aef646125 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/HoldPosition.java @@ -0,0 +1,99 @@ +package mineplex.minecraft.game.classcombat.Skill.Knight; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.condition.Condition; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class HoldPosition extends SkillActive +{ + public HoldPosition(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Hold your position, gaining", + "Protection 4, Slow III and no", + "knockback for 8 seconds." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + Factory.Condition().Factory().Slow(GetName(), player, player, 8, 2, false, true, false, true); + Factory.Condition().Factory().Protection(GetName(), player, player, 8, 3, false, true, true); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_SCREAM, 1.5f, 0f); + player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 49); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + int level = GetLevel(damagee); + if (level == 0) return; + + Condition data = Factory.Condition().GetActiveCondition(damagee, ConditionType.DAMAGE_RESISTANCE); + if (data == null) return; + + if (!data.GetReason().equals(GetName())) + return; + + //Damage + event.AddMod(damagee.getName(), GetName(), 0, false); + event.SetKnockback(false); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Knight.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Knight.java new file mode 100644 index 000000000..9a7684728 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Knight.java @@ -0,0 +1,37 @@ +package mineplex.minecraft.game.classcombat.Skill.Knight; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityShootBowEvent; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Knight extends Skill +{ + public Knight(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "25% reduction in Arrow Velocity." + }); + } + + @EventHandler + public void BowShoot(EntityShootBowEvent event) + { + if (GetLevel(event.getEntity()) == 0) + return; + + event.getProjectile().setVelocity(event.getProjectile().getVelocity().multiply(0.75)); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/LevelField.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/LevelField.java new file mode 100644 index 000000000..b91eb39f4 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/LevelField.java @@ -0,0 +1,128 @@ +package mineplex.minecraft.game.classcombat.Skill.Knight; + +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class LevelField extends Skill +{ + public LevelField(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Even the battlefield with courage!", + "You deal X more damage.", + "You take X less damage.", + "X = (Nearby Enemies) - (Nearby Allies)", + "Players within 8 Blocks are considered.", + "", + "Damage can be altered a maximum of 3.", + "You can not deal less damage, or take", + "more damage via this." + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Decrease(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + //Damager + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + LivingEntity damager = event.GetDamagerEntity(false); + if (damager == null) return; + + //Level + int level = GetLevel(damagee); + if (level == 0) return; + + int alt = 0; + + for (Player cur : UtilPlayer.getNearby(damagee.getLocation(), 8)) + { + if (cur.equals(damagee)) + alt += 1; + + else if (Factory.Relation().CanHurt(damagee, cur)) + alt -= 1; + + else + alt += 1; + } + + if (alt > 3) alt = 3; + if (alt < -3) alt = -3; + + if (alt >= 0) + return; + + //Decrease Damage + event.AddMod(damagee.getName(), GetName(), alt, false); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Increase(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + //Damager + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + //Level + int level = GetLevel(damager); + if (level == 0) return; + + int alt = 0; + + for (Player cur : UtilPlayer.getNearby(damager.getLocation(), 8)) + { + if (cur.equals(damager)) + alt -= 1; + + else if (Factory.Relation().CanHurt(damager, cur)) + alt += 1; + + else + alt -= 1; + } + + if (alt > 3) alt = 3; + if (alt < -3) alt = -3; + + if (alt <= 0) + return; + + //Decrease Damage + event.AddMod(damager.getName(), GetName(), alt, false); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/PowerChop.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/PowerChop.java new file mode 100644 index 000000000..40f34f54a --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/PowerChop.java @@ -0,0 +1,109 @@ +package mineplex.minecraft.game.classcombat.Skill.Knight; + +import java.util.WeakHashMap; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class PowerChop extends SkillActive +{ + private WeakHashMap _charge = new WeakHashMap(); + + public PowerChop(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Put more strength into your", + "next axe attack, causing it", + "to deal 2 bonus damage.", + "", + "Attack must be made within", + "0.5 seconds of being used." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + if (!mineplex.core.recharge.Recharge.Instance.use(player, GetName() + " Cooldown", 250, false)) + return false; + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + _charge.put(player, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!UtilGear.isAxe(damager.getItemInHand())) + return; + + if (!_charge.containsKey(damager)) + return; + + if (UtilTime.elapsed(_charge.remove(damager), 500)) + return; + + //Damage + event.AddMod(damager.getName(), GetName(), 2, true); + + //Effect + damager.getWorld().playSound(damager.getLocation(), Sound.IRONGOLEM_HIT, 1f, 1f); + } + + @Override + public void Reset(Player player) + { + _charge.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Riposte.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Riposte.java new file mode 100644 index 000000000..9767d1fd8 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Riposte.java @@ -0,0 +1,192 @@ +package mineplex.minecraft.game.classcombat.Skill.Knight; + +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Riposte extends SkillActive +{ + private HashMap _prepare = new HashMap(); + private HashMap _block = new HashMap(); + + public Riposte(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Block an incoming attack to parry,", + "then quickly return the attack ", + "to riposte.", + "", + "If successful, you gain 1 health,", + "20 energy, and deal 2 bonus damage.", + "", + "You must block, parry, then riposte", + "all within 1 second of each other." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Prepare + _prepare.put(player, System.currentTimeMillis() + 1000); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared to " + F.skill(GetName()) + ".")); + } + + @EventHandler(priority = EventPriority.LOW) + public void DoParry(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + //Damagee + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + //Blocking + if (!damagee.isBlocking()) + return; + + if (!_prepare.containsKey(damagee)) + return; + + //Damager + LivingEntity damager = event.GetDamagerEntity(false); + if (damager == null) return; + + //Level + int level = GetLevel(damagee); + if (level == 0) return; + + //Prepare + if (!_block.containsKey(damagee)) + { + //Cancel + event.SetCancelled(GetName() + " Parry"); + + //Add + _block.put(damagee, damager); + _prepare.put(damagee, System.currentTimeMillis() + 1000); + + //Effect + damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_METAL, 0.5f, 1.6f); + + //Inform + UtilPlayer.message(damagee, F.main(GetClassType().name(), "You parried with " + F.skill(GetName(level)) + ".")); + UtilPlayer.message(event.GetDamagerPlayer(false), F.main(GetClassType().name(), F.name(damagee.getName()) + " parried with " + F.skill(GetName(level)) + ".")); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void DoRiposte(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + //Damager + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!_prepare.containsKey(damager)) + return; + + //Level + int level = GetLevel(damager); + if (level == 0) return; + + //Counter + if (_block.containsKey(damager)) + { + //End + LivingEntity target = _block.remove(damager); + _prepare.remove(damager); + + //Damage + event.AddMod(damager.getName(), GetName(), 2, true); + + //Effect + damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_METAL, 1f, 1.2f); + + //Energy + Factory.Energy().ModifyEnergy(damager, 20); + UtilPlayer.health(damager, 1); + + //Inform + UtilPlayer.message(damager, F.main(GetClassType().name(), "You countered with " + F.skill(GetName(level)) + ".")); + UtilPlayer.message(target, F.main(GetClassType().name(), F.name(damager.getName()) + " countered with " + F.skill(GetName(level)) + ".")); + } + } + + @EventHandler + public void End(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet expired = new HashSet(); + + for (Player cur : _prepare.keySet()) + if (System.currentTimeMillis() > _prepare.get(cur)) + expired.add(cur); + + for (Player cur : expired) + { + //Remove + _prepare.remove(cur); + _block.remove(cur); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), "You failed to " + F.skill(GetName()) + ".")); + } + } + + @Override + public void Reset(Player player) + { + _prepare.remove(player); + _block.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Swordsmanship.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Swordsmanship.java new file mode 100644 index 000000000..8741c5b96 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Swordsmanship.java @@ -0,0 +1,89 @@ +package mineplex.minecraft.game.classcombat.Skill.Knight; + +import java.util.HashMap; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.UtilGear; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Swordsmanship extends Skill +{ + private HashMap _charges = new HashMap(); + + public Swordsmanship(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Prepare a powerful sword attack;", + "You gain 1 Charge every 3 seconds.", + "You can store a maximum of 3 Charges.", + "", + "When you attacked, your damage is", + "increased by the number of your Charges,", + "and your Charges reset to 0.", + "", + "This only applies for Swords." + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void IncreaseDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + //Damagee + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!_charges.containsKey(damager)) + return; + + if (!UtilGear.isSword(damager.getItemInHand())) + return; + + event.AddMod(damager.getName(), GetName(), _charges.remove(damager), false); + } + + @EventHandler + public void Charge(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!Recharge.Instance.use(cur, GetName(), 3000, false)) + continue; + + int charge = 1; + if (_charges.containsKey(cur)) + charge += _charges.get(cur); + + charge = Math.min(3, charge); + + _charges.put(cur, charge); + } + } + + @Override + public void Reset(Player player) + { + _charges.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Vengeance.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Vengeance.java new file mode 100644 index 000000000..aadf02b29 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Vengeance.java @@ -0,0 +1,103 @@ +package mineplex.minecraft.game.classcombat.Skill.Knight; + +import java.util.HashMap; +import java.util.WeakHashMap; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Vengeance extends Skill +{ + private WeakHashMap> _vengeance = new WeakHashMap>(); + + public Vengeance(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "When you attack someone, your damage", + "is increased by 1 for each time the", + "enemy hurt you since you last hit them,", + "up to a maximum of 3 bonus damage." + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void RegisterDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + //Damagee + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + int level = GetLevel(damagee); + if (level == 0) return; + + //Damager + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!_vengeance.containsKey(damagee)) + _vengeance.put(damagee, new HashMap()); + + //Register Hit + if (!_vengeance.get(damagee).containsKey(damager.getName())) + _vengeance.get(damagee).put(damager.getName(), 0); + else + { + _vengeance.get(damagee).put(damager.getName(), Math.min(level * 2, _vengeance.get(damagee).get(damager.getName()) + 1)); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void IncreaseDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + //Damager + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + int level = GetLevel(damager); + if (level == 0) return; + + if (!_vengeance.containsKey(damager)) + return; + + //Damagee + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + if (!_vengeance.get(damager).containsKey(damagee.getName())) + return; + + if (_vengeance.get(damager).get(damagee.getName()) == 0) + return; + + //Increase + event.AddMod(damager.getName(), GetName(), _vengeance.get(damager).remove(damagee.getName()), true); + } + + @Override + public void Reset(Player player) + { + _vengeance.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/ArcticArmor.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/ArcticArmor.java new file mode 100644 index 000000000..3be7fa691 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/ArcticArmor.java @@ -0,0 +1,218 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerDropItemEvent; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; + +public class ArcticArmor extends Skill +{ + private HashSet _active = new HashSet(); + + public ArcticArmor(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Drop Axe/Sword to Toggle.", + "", + "Create a freezing area around you", + "in a 5 Block radius. Allies inside", + "this area receive Protection II.", + "", + "You are permanently immune to the", + "Slowing effect of snow." + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 3 per Second"; + } + + @EventHandler + public void Toggle(PlayerDropItemEvent event) + { + Player player = event.getPlayer(); + + if (GetLevel(player) == 0) + return; + + if (!UtilGear.isWeapon(event.getItemDrop().getItemStack())) + return; + + event.setCancelled(true); + + //Check Allowed + SkillTriggerEvent trigger = new SkillTriggerEvent(player, GetName(), GetClassType()); + UtilServer.getServer().getPluginManager().callEvent(trigger); + if (trigger.IsCancelled()) + return; + + if (_active.contains(player)) + { + Remove(player); + } + else + { + if (!Factory.Energy().Use(player, "Enable " + GetName(), 10, true, true)) + return; + + Add(player); + } + } + + public void Add(Player player) + { + _active.add(player); + UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.oo("Enabled", true))); + } + + public void Remove(Player player) + { + _active.remove(player); + UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.oo("Disabled", false))); + Factory.Condition().EndCondition(player, null, GetName()); + } + + @EventHandler + public void Audio(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Player cur : _active) + cur.getWorld().playSound(cur.getLocation(), Sound.AMBIENCE_RAIN, 0.3f, 0f); + } + + @EventHandler + public void SnowAura(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + //Level + if (GetLevel(cur) == 0) + { + Remove(cur); + continue; + } + + + //Check Allowed + SkillTriggerEvent trigger = new SkillTriggerEvent(cur, GetName(), GetClassType()); + UtilServer.getServer().getPluginManager().callEvent(trigger); + if (trigger.IsCancelled()) + { + Remove(cur); + continue; + } + + //Energy + if (!Factory.Energy().Use(cur, GetName(), 0.15, true, true)) + { + Remove(cur); + continue; + } + + //Blocks + double duration = 2000; + HashMap blocks = UtilBlock.getInRadius(cur.getLocation().getBlock().getLocation(), 5d); + for (Block block : blocks.keySet()) + { + //Freeze + if (!block.getRelative(BlockFace.UP).isLiquid()) + if (block.getLocation().getY() <= cur.getLocation().getY()) + if (block.getTypeId() == 8 || block.getTypeId() == 9 || block.getTypeId() == 79) + Factory.BlockRestore().Add(block, 79, (byte)0, (long)(duration * (1 + blocks.get(block)))); + + //Snow + Factory.BlockRestore().Snow(block, (byte)1, (byte)1, (long)(duration * (1 + blocks.get(block))), 250, 0); + } + } + } + + @EventHandler + public void ProtectionAura(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : _active) + { + //Protection + for (Player other : UtilPlayer.getNearby(cur.getLocation(), 5)) + if (!Factory.Relation().CanHurt(cur, other) || other.equals(cur)) + Factory.Condition().Factory().Protection(GetName(), other, cur, 1.9, 1, false, true, true); + } + } + + @EventHandler + public void Slow(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : UtilServer.getPlayers()) + { + if (cur.getLocation().getChunk() == null) + continue; + + Block block = cur.getLocation().getBlock(); + + if (block.getTypeId() != 78) + continue; + + if (block.getData() == 0) + continue; + + if (GetLevel(cur) > 0) + continue; + + int level = 0; + if (block.getData() == 2 || block.getData() == 3) + level = 1; + else if (block.getData() == 4 || block.getData() == 5) + level = 2; + else if (block.getData() == 6 || block.getData() == 7) + level = 3; + + //Slow + Factory.Condition().Factory().Custom("Thick Snow", cur, cur, + ConditionType.SLOW, 1.9, level, false, + Material.SNOW_BALL, (byte)0, true); + } + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Blizzard.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Blizzard.java new file mode 100644 index 000000000..54a90886b --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Blizzard.java @@ -0,0 +1,194 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import java.util.HashMap; +import java.util.WeakHashMap; +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Snowball; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Blizzard extends SkillActive +{ + private HashSet _active = new HashSet(); + private WeakHashMap _snowball = new WeakHashMap(); + + public Blizzard(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Hold Block to release a Blizzard.", + "Target the ground to create snow,", + "or target air to create a torrent", + "of snowballs, to push players away." + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 24 per Second"; + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + _active.add(player); + } + + @EventHandler + public void Snow(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) + return; + + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + if (!cur.isBlocking()) + { + _active.remove(cur); + continue; + } + + //Level + int level = GetLevel(cur); + if (level == 0) + { + _active.remove(cur); + continue; + } + + //Energy + if (!Factory.Energy().Use(cur, GetName(), 4, true, true)) + { + _active.remove(cur); + continue; + } + + //Target + HashSet ignore = new HashSet(); + ignore.add((byte) 0); + ignore.add((byte) 78); + ignore.add((byte) 80); + + Block target = cur.getTargetBlock(ignore, 7); + + //Snow + if (target == null || target.getType() == Material.AIR || UtilMath.offset(target.getLocation(), cur.getLocation()) > 5) + for (int i=0 ; i<4 ; i++) + { + Projectile snow = cur.launchProjectile(Snowball.class); + double x = 0.2 - (UtilMath.r(40)/100d); + double y = UtilMath.r(20)/100d; + double z = 0.2 - (UtilMath.r(40)/100d); + snow.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2)); + _snowball.put(snow, cur); + } + + if (target == null || target.getType() == Material.AIR) + continue; + + if (UtilMath.offset(target.getLocation(), cur.getLocation()) > 7) + continue; + + HashMap blocks = UtilBlock.getInRadius(target.getLocation(), 2d, 1); + for (Block block : blocks.keySet()) + { + Factory.BlockRestore().Snow(block, (byte)(1 + (int)(2*blocks.get(block))), (byte)7, 2500, 250, 3); + } + + //Effect + target.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, 80); + cur.getWorld().playSound(cur.getLocation(), Sound.STEP_SNOW, 0.1f, 0.5f); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void Snowball(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Projectile proj = event.GetProjectile(); + if (proj == null) return; + + if (!(proj instanceof Snowball)) + return; + + if (!_snowball.containsKey(proj)) + return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + event.SetCancelled(GetName()); + damagee.setVelocity(proj.getVelocity().multiply(0.1).add(new Vector(0, 0.15, 0))); + } + + @EventHandler + public void SnowballForm(ProjectileHitEvent event) + { + if (!(event.getEntity() instanceof Snowball)) + return; + + if (_snowball.remove(event.getEntity()) == null) + return; + + Factory.BlockRestore().Snow(event.getEntity().getLocation().getBlock(), (byte)1, (byte)7, 2000, 250, 0); + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FireBlast.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FireBlast.java new file mode 100644 index 000000000..99b40acf2 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FireBlast.java @@ -0,0 +1,130 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import java.util.HashMap; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Item; +import org.bukkit.entity.LargeFireball; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class FireBlast extends SkillActive +{ + public FireBlast(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Launch an explosive fireball;", + "Explosion gives large knockback", + "and ignites enemies for 8 seconds.", + "", + "Effects scale down with distance", + "from explosion." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + LargeFireball ball = player.launchProjectile(LargeFireball.class); + ball.setShooter(player); + ball.setIsIncendiary(false); + ball.setYield(0); + ball.setBounce(false); + ball.teleport(player.getEyeLocation().add(player.getLocation().getDirection().multiply(1))); + ball.setVelocity(new Vector(0,0,0)); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.GHAST_FIREBALL, 1f, 0.8f); + } + + @EventHandler + public void Collide(ProjectileHitEvent event) + { + Projectile proj = event.getEntity(); + + if (!(proj instanceof LargeFireball)) + return; + + if (proj.getShooter() == null) + return; + + if (!(proj.getShooter() instanceof Player)) + return; + + Player player = (Player)proj.getShooter(); + + //Level + int level = GetLevel(player); + if (level == 0) return; + + //Velocity Players + HashMap hitMap = UtilPlayer.getInRadius(proj.getLocation(), 8); + for (Player cur : hitMap.keySet()) + { + double range = hitMap.get(cur); + + //Damage Event + Factory.Condition().Factory().Ignite(GetName(), cur, player, 2 + 6 * range, false, false); + + //Velocity + UtilAction.velocity(cur, UtilAlg.getTrajectory(proj.getLocation().add(0, -0.5, 0), cur.getEyeLocation()), + 0.5 + 1.5 * range, false, 0, 0.2 + 0.4 * range, 1.2, true); + } + + //Fire + for (int i=0 ; i<60 ; i++) + { + Item fire = player.getWorld().dropItem(proj.getLocation().add(0, 0.5, 0), ItemStackFactory.Instance.CreateStack(Material.FIRE)); + fire.setVelocity(new Vector((Math.random() - 0.5)/2,Math.random()/2+0.5,(Math.random() - 0.5)/2)); + Factory.Fire().Add(fire, player, 8, 2, 3, 0, GetName()); + } + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Fissure.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Fissure.java new file mode 100644 index 000000000..a6ca8556f --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Fissure.java @@ -0,0 +1,103 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Fissure extends SkillActive +{ + private HashSet _active = new HashSet(); + + public Fissure(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Fissures the earth infront of you,", + "creating an impassable wall.", + "", + "Players struck by the initial slam", + "receive Slow 2 for 4 seconds", + "", + "Players struck by the fissure", + "receive (4 + Power) damage.", + "Fissure gains Power as it extends" + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + if (!UtilEnt.isGrounded(player)) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " while airborne.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + FissureData data = new FissureData(this, player, level, player.getLocation().getDirection(), player.getLocation().add(0, -0.5, 0)); + _active.add(data); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet remove = new HashSet(); + + for (FissureData data : _active) + if (data.Update()) + remove.add(data); + + for (FissureData data : remove) + { + _active.remove(data); + data.Clear(); + } + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FissureData.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FissureData.java new file mode 100644 index 000000000..12129c0c0 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FissureData.java @@ -0,0 +1,187 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import java.util.ArrayList; +import java.util.HashSet; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.util.Vector; + +public class FissureData +{ + private Fissure Host; + + private Player _player; + private int _level; + + private Vector _vec; + private Location _loc; + private Location _startLoc; + + private int _height = 0; + private int _handled = 0; + + private HashSet _hit = new HashSet(); + + private ArrayList _path = new ArrayList(); + + public FissureData(Fissure host, Player player, int level, Vector vec, Location loc) + { + Host = host; + + vec.setY(0); + vec.normalize(); + vec.multiply(0.1); + + this._player = player; + this._level = level; + this._vec = vec; + this._loc = loc; + this._startLoc = new Location(loc.getWorld(), loc.getX(), loc.getY(), loc.getZ()); + + MakePath(); + } + + private void MakePath() + { + while (UtilMath.offset2d(_loc, _startLoc) < 14) + { + _loc.add(_vec); + + Block block = _loc.getBlock(); + + if (block.equals(_startLoc.getBlock())) + continue; + + if (_path.contains(block)) + continue; + + //Up + if (UtilBlock.solid(block.getRelative(BlockFace.UP))) + { + _loc.add(0, 1, 0); + block = _loc.getBlock(); + + if (UtilBlock.solid(block.getRelative(BlockFace.UP))) + return; + } + + //Down + else if (!UtilBlock.solid(block)) + { + _loc.add(0, -1, 0); + block = _loc.getBlock(); + + if (!UtilBlock.solid(block)) + return; + } + + if (UtilMath.offset(block.getLocation().add(0.5, 0.5, 0.5), _loc) > 0.5) + continue; + + _path.add(block); + + //Effect + _loc.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + + //Slow + for (Player cur : block.getWorld().getPlayers()) + if (!cur.equals(_player)) + if (UtilMath.offset(block.getLocation().add(0.5, 0.5, 0.5), cur.getLocation()) < 1.5) + { + //Condition + Host.Factory.Condition().Factory().Slow("Fissure", cur, _player, 4, 1, false, true, true, true); + } + } + } + + public boolean Update() + { + if (_handled >= _path.size()) + return true; + + Block block = _path.get(_handled); + + //Cannot raise + if (block.getTypeId() == 46) + return false; + + Block up = block.getRelative(0, _height + 1, 0); + + //Done Column + if (!UtilBlock.airFoliage(up)) + { + _loc.getWorld().playEffect(up.getLocation(), Effect.STEP_SOUND, up.getTypeId()); + _height = 0; + _handled++; + return false; + } + + //Boost Column + if (block.getTypeId() == 1) Host.Factory.BlockRestore().Add(block, 4, block.getData(), 14000); + if (block.getTypeId() == 2) Host.Factory.BlockRestore().Add(block, 3, block.getData(), 14000); + if (block.getTypeId() == 98) Host.Factory.BlockRestore().Add(block, 98, (byte)2, 14000); + + Host.Factory.BlockRestore().Add(up, block.getTypeId(), block.getData(), 10000 - (1000 * _height)); + _height++; + + //Effect + up.getWorld().playEffect(up.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + + //Damage + for (Player cur : up.getWorld().getPlayers()) + if (!cur.equals(_player)) + { + //Teleport + if (cur.getLocation().getBlock().equals(block)) + { + Host.Factory.Teleport().TP(cur, cur.getLocation().add(0, 1, 0)); + } + + //Damage + if (!_hit.contains(cur)) + if (UtilMath.offset(up.getLocation().add(0.5, 0.5, 0.5), cur.getLocation()) < 1.5) + { + _hit.add(cur); + + int damage = 4 + _handled; + + //Damage Event + Host.Factory.Damage().NewDamageEvent(cur, _player, null, + DamageCause.CUSTOM, damage, false, false, false, + _player.getName(), "Fissure"); + + //Inform + UtilPlayer.message(cur, F.main(Host.GetClassType().name(), F.name(_player.getName()) +" hit you with " + F.skill(Host.GetName(_level)) + ".")); + } + } + + //Next Column + if (_height >= Math.min(3, _handled/2 + 1)) + { + _height = 0; + _handled++; + } + + return (_handled >= _path.size()); + } + + public void Clear() + { + _hit.clear(); + _path.clear(); + Host = null; + _player = null; + _loc = null; + _startLoc = null; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java new file mode 100644 index 000000000..9bad092b4 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java @@ -0,0 +1,152 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import java.util.HashMap; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.block.Action; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class FreezingBlast extends SkillActive implements IThrown +{ + public FreezingBlast(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Launch a freezing blast;", + "Creates long lasting Snow, and", + "gives Slow 4 to nearby players.", + "", + "Direct hit applies Frost Armor,", + "giving Protection 4 and Slow 4", + "for 10 seconds.", + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(79)); + item.setVelocity(player.getLocation().getDirection()); + Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, + Sound.FIZZ, 0.6f, 1.6f, null, 0, UpdateType.FASTEST, 2d); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + + //Effect + item.getWorld().playSound(item.getLocation(), Sound.SILVERFISH_HIT, 2f, 1f); + } + + + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + Action(target, data); + } + + @Override + public void Idle(ProjectileUser data) + { + Action(null, data); + } + + @Override + public void Expire(ProjectileUser data) + { + Action(null, data); + } + + public void Action(LivingEntity target, ProjectileUser data) + { + //Effect + data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 79); + + //Remove + data.GetThrown().remove(); + + //Thrower + if (!(data.GetThrower() instanceof Player)) + return; + + Player player = (Player)data.GetThrower(); + + //Level + int level = GetLevel(player); + if (level == 0) return; + + //Snow Spread + HashMap blocks = UtilBlock.getInRadius(data.GetThrown().getLocation(), 4d); + for (Block cur : blocks.keySet()) + { + if (UtilBlock.airFoliage(cur) && UtilBlock.solid(cur.getRelative(BlockFace.DOWN))) + { + Factory.BlockRestore().Snow(cur, (byte)(7 * blocks.get(cur)), (byte)7, (long)(15000 * (1 + blocks.get(cur))), 1000, 0); + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, 80); + } + } + + //Slow Players + for (Player curPlayer : UtilPlayer.getNearby(data.GetThrown().getLocation(), 4)) + Factory.Condition().Factory().Slow(GetName(), curPlayer, player, 2.9, 0, false, true, true, true); + + if (target == null) + return; + + //Freeze + Factory.Condition().Factory().Protection(GetName(), target, player, 10, 3, false, true, true); + Factory.Condition().Factory().Slow(GetName(), target, player, 10, 3, false, true, true, true); + + //Inform + UtilPlayer.message(target, F.main(GetClassType().name(), F.name(player.getName()) + " used " + F.skill("Frost Armor") + " on you.")); + + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java new file mode 100644 index 000000000..f1727a922 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java @@ -0,0 +1,116 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class GlacialBlade extends SkillActive implements IThrown +{ + public GlacialBlade(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Swinging your sword releases a", + "shard of ice, dealing 5 damage", + "to anything it hits.", + "", + "Will not work if enemies are close." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + for (Player cur : UtilPlayer.getNearby(player.getLocation(), 4)) + if (cur.equals(player)) + continue; + else if (Factory.Relation().CanHurt(cur, player)) + return false; + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(370)); + UtilAction.velocity(item, player.getLocation().getDirection(), 1.2, false, 0, 0.1, 10, false); + Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, 1d); + + //Effect + item.getWorld().playSound(item.getLocation(), Sound.ORB_PICKUP, 1f, 2f); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + //Effect + data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 20); + + //Remove + data.GetThrown().remove(); + + if (target == null) + return; + + //Damage + Factory.Damage().NewDamageEvent(target, data.GetThrower(), null, + DamageCause.CUSTOM, 5, true, true, false, + UtilEnt.getName(data.GetThrower()), GetName()); + } + + @Override + public void Idle(ProjectileUser data) + { + //Effect + data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 20); + + //Remove + data.GetThrown().remove(); + } + + @Override + public void Expire(ProjectileUser data) + { + //Effect + data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 20); + + //Remove + data.GetThrown().remove(); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Immolate.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Immolate.java new file mode 100644 index 000000000..8d37c4907 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Immolate.java @@ -0,0 +1,194 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; + +public class Immolate extends Skill +{ + private HashSet _active = new HashSet(); + + public Immolate(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Drop Axe/Sword to Toggle.", + "", + "Ignite yourself in flaming fury.", + "You receive Strength 4, Speed 1,", + "Fire Resistance and Vulnerability 2.", + "", + "You leave a trail of fire, which", + "burns players that go near it." + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 12 per Second"; + } + + @EventHandler + public void Toggle(PlayerDropItemEvent event) + { + Player player = event.getPlayer(); + + if (GetLevel(player) == 0) + return; + + if (!UtilGear.isWeapon(event.getItemDrop().getItemStack())) + return; + + event.setCancelled(true); + + //Check Allowed + SkillTriggerEvent trigger = new SkillTriggerEvent(player, GetName(), GetClassType()); + UtilServer.getServer().getPluginManager().callEvent(trigger); + if (trigger.IsCancelled()) + return; + + if (_active.contains(player)) + { + Remove(player); + } + else + { + if (!Factory.Energy().Use(player, "Enable " + GetName(), 10, true, true)) + return; + + Add(player); + } + } + + public void Add(Player player) + { + _active.add(player); + UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.oo("Enabled", true))); + } + + public void Remove(Player player) + { + _active.remove(player); + UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.oo("Disabled", false))); + + Factory.Condition().EndCondition(player, null, GetName()); + Factory.Condition().Factory().FireResist(GetName(), player, player, 0.9, 0, false, true, true); + } + + @EventHandler + public void Aura(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + //Level + if (GetLevel(cur) == 0) + { + Remove(cur); + continue; + } + + //Check Allowed + SkillTriggerEvent trigger = new SkillTriggerEvent(cur, GetName(), GetClassType()); + UtilServer.getServer().getPluginManager().callEvent(trigger); + if (trigger.IsCancelled()) + { + Remove(cur); + continue; + } + + //Energy + if (!Factory.Energy().Use(cur, GetName(), 0.6, true, true)) + { + Remove(cur); + continue; + } + + //Put out Fire + cur.setFireTicks(0); + } + } + + @EventHandler + public void Combust(EntityCombustEvent event) + { + if (_active.contains(event.getEntity())) + event.setCancelled(true); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() == UpdateType.FAST) + Conditions(); + + if (event.getType() == UpdateType.TICK) + Flames(); + } + + public void Conditions() + { + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + //Speed + Strength + Factory.Condition().Factory().Speed(GetName(), cur, cur, 1.9, 0, false, true, true); + Factory.Condition().Factory().Strength(GetName(), cur, cur, 1.9, 3, false, true, true); + Factory.Condition().Factory().FireResist(GetName(), cur, cur, 1.9, 0, false, true, true); + Factory.Condition().Factory().Vulnerable(GetName(), cur, cur, 1.9, 1, false, true, true); + } + } + + public void Flames() + { + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + //Fire + Item fire = cur.getWorld().dropItem(cur.getLocation().add(0, 0.5, 0), ItemStackFactory.Instance.CreateStack(Material.FIRE)); + fire.setVelocity(new Vector((Math.random() - 0.5)/3,Math.random()/3,(Math.random() - 0.5)/3)); + Factory.Fire().Add(fire, cur, 1, 0, 1.2, 0, GetName()); + + //Sound + cur.getWorld().playSound(cur.getLocation(), Sound.FIZZ, 0.2f, 1f); + } + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Inferno.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Inferno.java new file mode 100644 index 000000000..102ff173e --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Inferno.java @@ -0,0 +1,125 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Inferno extends SkillActive +{ + private HashSet _active = new HashSet(); + + public Inferno(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Hold Block to use Inferno;", + "You spray fire at high speed,", + "igniting anything it hits." + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 24 per Second"; + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + _active.add(player); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + if (!cur.isBlocking()) + { + _active.remove(cur); + continue; + } + + //Level + int level = GetLevel(cur); + if (level == 0) + { + _active.remove(cur); + continue; + } + + //Energy + if (!Factory.Energy().Use(cur, GetName(), 1.2, true, false)) + { + _active.remove(cur); + continue; + } + + //Fire + Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.FIRE)); + Factory.Fire().Add(fire, cur, 0.7, 0, 0.5, 1, GetName()); + + fire.teleport(cur.getEyeLocation()); + double x = 0.07 - (UtilMath.r(14)/100d); + double y = 0.07 - (UtilMath.r(14)/100d); + double z = 0.07 - (UtilMath.r(14)/100d); + fire.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(1.6)); + + //Effect + cur.getWorld().playSound(cur.getLocation(), Sound.GHAST_FIREBALL, 0.1f, 1f); + } + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LifeBonds.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LifeBonds.java new file mode 100644 index 000000000..a1b513bde --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LifeBonds.java @@ -0,0 +1,279 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryPickupItemEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; + +public class LifeBonds extends Skill +{ + private HashSet _active = new HashSet(); + private HashSet _items = new HashSet(); + + public LifeBonds(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Drop Axe/Sword to Toggle.", + "", + "Transfers life from healthy allies", + "to nearby allies with less health.", + "", + "Transfers 1 health every 0.5 seconds.", + "Maximum range of 8 Blocks from user." + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 4 per Second"; + } + + @EventHandler + public void Toggle(PlayerDropItemEvent event) + { + Player player = event.getPlayer(); + + if (GetLevel(player) == 0) + return; + + if (!UtilGear.isWeapon(event.getItemDrop().getItemStack())) + return; + + event.setCancelled(true); + + //Check Allowed + SkillTriggerEvent trigger = new SkillTriggerEvent(player, GetName(), GetClassType()); + UtilServer.getServer().getPluginManager().callEvent(trigger); + if (trigger.IsCancelled()) + return; + + if (_active.contains(player)) + { + Remove(player); + } + else + { + if (!Factory.Energy().Use(player, "Enable " + GetName(), 10, true, true)) + return; + + Add(player); + } + } + + public void Add(Player player) + { + _active.add(player); + UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.oo("Enabled", true))); + } + + public void Remove(Player player) + { + _active.remove(player); + UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.oo("Disabled", false))); + } + + @EventHandler + public void Energy(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + //Level + if (GetLevel(cur) == 0) + { + Remove(cur); + continue; + } + + //Check Allowed + SkillTriggerEvent trigger = new SkillTriggerEvent(cur, GetName(), GetClassType()); + UtilServer.getServer().getPluginManager().callEvent(trigger); + if (trigger.IsCancelled()) + { + Remove(cur); + continue; + } + + //Energy + if (!Factory.Energy().Use(cur, GetName(), 0.2, true, true)) + { + _active.remove(cur); + UtilPlayer.message(cur, F.main(GetClassType().name(), GetName() + ": " + F.oo("Disabled", false))); + continue; + } + } + } + + @EventHandler + public void Plants(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) + return; + + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + for (Player other : UtilPlayer.getNearby(cur.getLocation(), 8)) + { + if (Factory.Relation().CanHurt(cur, other)) + continue; + + //Plants + ItemStack stack; + + double r = Math.random(); + + if (r > 0.4) stack = ItemStackFactory.Instance.CreateStack(31, (byte)1); + else if (r > 0.11) stack = ItemStackFactory.Instance.CreateStack(31, (byte)2); + else if (r > 0.05) stack = ItemStackFactory.Instance.CreateStack(37, (byte)0); + else stack = ItemStackFactory.Instance.CreateStack(38, (byte)0); + + Item item = other.getWorld().dropItem(other.getLocation().add(0, 0.4, 0), stack); + _items.add(item); + + Vector vec = new Vector(Math.random() - 0.5, Math.random()/2 + 0.2, Math.random() - 0.5).normalize(); + vec.multiply(0.1 + Math.random()/8); + item.setVelocity(vec); + } + } + } + + @EventHandler + public void LifeTransfer(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + //Bonds + Player highest = null; + double highestHp = 0; + + Player lowest = null; + double lowestHp = 20; + + for (Player other : UtilPlayer.getNearby(cur.getLocation(), 8)) + { + if (Factory.Relation().CanHurt(cur, other)) + continue; + + if (highest == null || other.getHealth() > highestHp) + { + highest = other; + highestHp = other.getHealth(); + } + + if (lowest == null || other.getHealth() < lowestHp) + { + lowest = other; + lowestHp = other.getHealth(); + } + } + + //Nothing to Transfer + if (highest == null || lowest == null || highest.equals(lowest) || highestHp - lowestHp < 2) + continue; + + //Transfer + UtilPlayer.health(highest, -1); + UtilPlayer.health(lowest, 1); + + //Effect + highest.getWorld().playEffect(highest.getLocation(), Effect.STEP_SOUND, 18); + lowest.getWorld().playEffect(lowest.getLocation(), Effect.STEP_SOUND, 18); + } + } + + @EventHandler + public void ItemPickup(PlayerPickupItemEvent event) + { + if (_items.contains(event.getItem())) + event.setCancelled(true); + } + + @EventHandler + public void HopperPickup(InventoryPickupItemEvent event) + { + if (_items.contains(event.getItem())) + event.setCancelled(true); + } + + @EventHandler + public void ItemDestroy(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (_items.isEmpty()) + return; + + HashSet remove = new HashSet(); + + for (Item cur : _items) + if (UtilEnt.isGrounded(cur) || cur.getTicksLived() > 400 || cur.isDead() || !cur.isValid()) + remove.add(cur); + + for (Item cur : remove) + { + Block block = cur.getLocation().getBlock(); + if (block.getTypeId() == 0) + { + int below = block.getRelative(BlockFace.DOWN).getTypeId(); + if (below == 2 || below == 3) + { + byte data = 0; + if (cur.getItemStack().getData() != null) + data = cur.getItemStack().getData().getData(); + + Factory.BlockRestore().Add(block, cur.getItemStack().getTypeId(), data, 2000); + } + } + + _items.remove(cur); + cur.remove(); + } + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java new file mode 100644 index 000000000..21387121f --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java @@ -0,0 +1,160 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import java.util.HashMap; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockIgniteEvent; +import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class LightningOrb extends SkillActive implements IThrown +{ + public LightningOrb(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Launch a lightning orb.", + "", + "Detonates on direct hit, or after", + "4 seconds. On detonation, enemies", + "within 6 range are struck by lightning,", + "receiving Shock, Slow and Vulnerability", + "for 2 seconds", + "", + "Effectiveness scales down with range." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(57)); + item.setVelocity(player.getLocation().getDirection()); + Factory.Projectile().AddThrow(item, player, this, System.currentTimeMillis() + 4000, true, false, false, + Sound.FIZZ, 0.6f, 1.6f, null, 0, UpdateType.FASTEST, 1d); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + + //Effect + item.getWorld().playSound(item.getLocation(), Sound.SILVERFISH_HIT, 2f, 1f); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + Strike(target, data); + } + + @Override + public void Idle(ProjectileUser data) + { + Strike(null, data); + } + + @Override + public void Expire(ProjectileUser data) + { + Strike(null, data); + } + + public void Strike(LivingEntity target, ProjectileUser data) + { + //Remove + data.GetThrown().remove(); + + //Thrower + if (!(data.GetThrower() instanceof Player)) + return; + + Player player = (Player)data.GetThrower(); + + //Level + int level = GetLevel(player); + if (level == 0) return; + + //Others + HashMap hit = UtilPlayer.getInRadius(data.GetThrown().getLocation(), 6); + for (Player cur : hit.keySet()) + { + //Lightning Condition + Factory.Condition().Factory().Lightning(GetName(), cur, player, 2, 1, false, true); + } + + for (Player cur : hit.keySet()) + { + if (!UtilAlg.HasSight(data.GetThrown().getLocation(), cur)) + continue; + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(player.getName()) + " hit you with " + F.skill(GetName(level)) + ".")); + + //Lightning + cur.getWorld().strikeLightning(cur.getLocation()); + } + + //Apply Aftereffects + for (Player cur : hit.keySet()) + { + //Condition + Factory.Condition().Factory().Shock(GetName(), cur, player, 2, false, true); + Factory.Condition().Factory().Slow(GetName(), cur, player, 2, 0, false, true, true, true); + Factory.Condition().Factory().Vulnerable(GetName(), cur, data.GetThrower(), 2, 0, false, true, true); + } + } + + @EventHandler + public void CancelFire(BlockIgniteEvent event) + { + if (event.getCause() == IgniteCause.LIGHTNING) + event.setCancelled(true); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Mage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Mage.java new file mode 100644 index 000000000..d75074a21 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Mage.java @@ -0,0 +1,37 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityShootBowEvent; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Mage extends Skill +{ + public Mage(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "25% reduction in Arrow Velocity." + }); + } + + @EventHandler + public void BowShoot(EntityShootBowEvent event) + { + if (GetLevel(event.getEntity()) == 0) + return; + + event.getProjectile().setVelocity(event.getProjectile().getVelocity().multiply(0.75)); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/MagmaBlade.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/MagmaBlade.java new file mode 100644 index 000000000..04ed5ce92 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/MagmaBlade.java @@ -0,0 +1,67 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.common.util.UtilGear; +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class MagmaBlade extends Skill +{ + public MagmaBlade(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Your sword scorches opponents,", + "dealing an additional 2 damage", + "to players who are on fire." + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + //Damagee + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + if (damagee.getFireTicks() <= 0) + return; + + //Damager + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!UtilGear.isSword(damager.getItemInHand())) + return; + + int level = GetLevel(damager); + if (level == 0) return; + + //Damage + event.AddMod(damager.getName(), GetName(), 2, true); + + //Effect + damager.getWorld().playSound(damager.getLocation(), Sound.FIZZ, 0.8f, 0f); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Magnetize.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Magnetize.java new file mode 100644 index 000000000..ca867c35b --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Magnetize.java @@ -0,0 +1,130 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Magnetize extends SkillActive +{ + private HashSet _active = new HashSet(); + + public Magnetize(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "SKILL NEEDS REPLACING", + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 16 per Second"; + } + + @Override + public boolean CustomCheck(Player player, int level) + { + UtilPlayer.message(player, F.main("Skill", "This skill is currently being re-worked.")); + return false; + } + + @Override + public void Skill(Player player, int level) + { + _active.add(player); + } + + + @EventHandler + public void Energy(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + if (!cur.isBlocking()) + { + _active.remove(cur); + continue; + } + + //Level + int level = GetLevel(cur); + if (level == 0) + { + _active.remove(cur); + continue; + } + + if (!Factory.Energy().Use(cur, GetName(), 2, true, true)) + { + _active.remove(cur); + continue; + } + + //Effect + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, 42); + + //Pull + for (int i=0 ; i<=5+level ; i++) + Pull(cur, cur.getEyeLocation().add(cur.getLocation().getDirection().multiply(i))); + } + } + + public void Pull(Player player, Location loc) + { + for (Player other : UtilPlayer.getNearby(loc, 2)) + { + if (player.equals(other)) + continue; + + if (!Factory.Relation().CanHurt(player, other)) + continue; + + if (UtilMath.offset(player, other) < 2) + continue; + + UtilAction.velocity(other, UtilAlg.getTrajectory2d(other, player), + 0.2, false, 0, 0, 1, false); + } + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/NullBlade.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/NullBlade.java new file mode 100644 index 000000000..2af21aaf6 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/NullBlade.java @@ -0,0 +1,67 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.common.util.UtilGear; +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class NullBlade extends Skill +{ + public NullBlade(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Your sword sucks 6 energy from", + "opponents with every attack." + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Drain(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + //Damager + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!UtilGear.isSword(damager.getItemInHand())) + return; + + int level = GetLevel(damager); + if (level == 0) return; + + //Damagee + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + //Energy + Factory.Energy().ModifyEnergy(damagee, -6); + Factory.Energy().ModifyEnergy(damager, 6); + + //Damage + event.AddMod(damager.getName(), GetName(), 0, true); + + //Effect + damager.getWorld().playSound(damager.getLocation(), Sound.BREATH, 0.6f, 0.6f); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/RootingAxe.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/RootingAxe.java new file mode 100644 index 000000000..1c4e165d9 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/RootingAxe.java @@ -0,0 +1,92 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import org.bukkit.Effect; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilGear; +import mineplex.core.recharge.Recharge; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class RootingAxe extends Skill +{ + public RootingAxe(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Your axe rips players downward into", + "the earth, disrupting their movement." + }); + } + + @Override + public String GetRechargeString() + { + return "Recharge: 6 seconds"; + } + + @EventHandler(priority = EventPriority.HIGH) + public void Root(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + //Damager + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!UtilGear.isAxe(damager.getItemInHand())) + return; + + int level = GetLevel(damager); + if (level == 0) return; + + //Damagee + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + event.SetKnockback(false); + + //Root + if (Recharge.Instance.use(damager, GetName(), 6000, false)) + if (UtilEnt.isGrounded(damagee)) + { + //Double Down + if (UtilBlock.solid(damagee.getLocation().getBlock())) + return; + + //Fall Through + if (UtilBlock.airFoliage(damagee.getLocation().getBlock().getRelative(0, -2, 0))) + return; + + //Action + Factory.Teleport().TP(damagee, damagee.getLocation().add(0, -0.9, 0)); + + //Effect + damagee.getWorld().playEffect(damagee.getLocation().add(0, 1, 0), Effect.STEP_SOUND, damagee.getLocation().getBlock().getTypeId()); + } + + //Velocity Down + UtilAction.velocity(damagee, new Vector(0,-1,0), 0.5, false, 0, 0, 10, false); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java new file mode 100644 index 000000000..a5b729acd --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java @@ -0,0 +1,389 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.WeakHashMap; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.inventory.InventoryPickupItemEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Rupture extends SkillActive +{ + private int maxPower = 5; + + private HashSet _items = new HashSet(); + + private WeakHashMap _target = new WeakHashMap(); + private WeakHashMap _charge = new WeakHashMap(); + + public Rupture(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Hold Block to create a rupture", + "at your feet. It will snake through", + "the ground towards your target,", + "giving Slow 2 to nearby opponents.", + "", + "Release Block to release the rupture,", + "causing earth and players to fly upward,", + "dealing up to 6 inital damage." + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 12 per Second"; + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + if (!UtilEnt.isGrounded(player)) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " while airborne.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + _target.put(player, player.getLocation().subtract(0, 1, 0)); + _charge.put(player, 0); + } + + public void Clean(Player player) + { + _target.remove(player); + _charge.remove(player); + } + + @EventHandler + public void UpdateSlow(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : _target.keySet()) + { + Location loc = _target.get(cur); + + for (Player other : cur.getWorld().getPlayers()) + if (!other.equals(cur)) + if (UtilMath.offset(loc, other.getLocation()) < 2) + if (Factory.Relation().CanHurt(cur, other)) + Factory.Condition().Factory().Slow(GetName(), other, cur, 1.9, 1, false, true, false, true); + } + } + + @EventHandler + public void UpdateMove(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : UtilServer.getPlayers()) + { + //Not Charging + if (!_target.containsKey(cur)) + continue; + + //Level + int level = GetLevel(cur); + if (level == 0) return; + + //Add Charge + if (!cur.isBlocking()) + DoRupture(cur); + + else + { + //Energy + if (!Factory.Energy().Use(cur, GetName(), 0.6, true, true)) + { + DoRupture(cur); + continue; + } + + //Charge + if (Recharge.Instance.use(cur, GetName() + " Charge", 600, false)) + { + int charge = 0; + if (_charge.containsKey(cur)) + charge += _charge.get(cur); + + if (charge < maxPower) + { + _charge.put(cur, charge + 1); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), GetName() + ": " + F.elem((_charge.get(cur) * (100/maxPower)) + "% Power"))); + } + } + + MoveRupture(cur); + } + } + } + + public void MoveRupture(Player cur) + { + Block targetBlock = cur.getTargetBlock(null, 0); + if (targetBlock == null) return; + + //Aiming at sky + if (targetBlock.getY() == 0) + { + //Display + DisplayRupture(cur); + + return; + } + + Location target = targetBlock.getLocation().add(0.5, 0.5, 0.5); + + Location loc = _target.get(cur); + if (loc == null) return; + + loc.add(UtilAlg.getTrajectory(loc, target).normalize().multiply(0.36)); + + //Relocate + RelocateRupture(cur, loc, target); + + //Display + DisplayRupture(cur); + } + + public void RelocateRupture(Player cur, Location loc, Location target) + { + if (CanTravel(loc.getBlock())) + return; + + Location bestLoc = null; + double bestDist = 9999; + + for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet()) + { + if (!CanTravel(block)) + continue; + + if (UtilMath.offset(block.getLocation(), target) < bestDist) + { + bestLoc = block.getLocation(); + bestDist = UtilMath.offset(block.getLocation(), target); + } + } + + if (bestLoc == null) + { + UtilPlayer.message(cur, F.main("Skill", "Your " + F.skill(GetName()) + " has failed.")); + Clean(cur); + } + + else + _target.put(cur, bestLoc); + } + + public boolean CanTravel(Block block) + { + int id = block.getTypeId(); + + return (id == 1 || + id == 2 || + id == 3 || + id == 12 || + id == 13); + } + + public void DisplayRupture(Player cur) + { + if (_target.get(cur) == null) + return; + + for (Block block : UtilBlock.getInRadius(_target.get(cur), 1d).keySet()) + if (block.getRelative(BlockFace.UP).getTypeId() == 0 || + block.getRelative(BlockFace.DOWN).getTypeId() == 0 || + block.getRelative(BlockFace.NORTH).getTypeId() == 0 || + block.getRelative(BlockFace.SOUTH).getTypeId() == 0 || + block.getRelative(BlockFace.EAST).getTypeId() == 0 || + block.getRelative(BlockFace.WEST).getTypeId() == 0) + { + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + } + + } + + public void DoRupture(Player player) + { + Location loc = _target.get(player); + int power = _charge.get(player); + + Clean(player); + + double range = 2 + 2 * (power/5d); + double mult = 0.5 + 0.5 * (power/maxPower); + + int level = GetLevel(player); + + //Fling + HashMap targets = UtilEnt.getInRadius(loc, range); + for (LivingEntity cur : targets.keySet()) + { + //Velocity + UtilAction.velocity(cur, + UtilAlg.getTrajectory2d(loc.toVector().add(new Vector(0.5,0,0.5)), cur.getLocation().toVector()), + 0.8 + 0.8 * targets.get(cur) * mult, true, 0, 0.4 + 1.0 * targets.get(cur) * mult, 0.4 + 1.0 * mult, true); + + //Condition + Factory.Condition().Factory().Falling(GetName(), cur, player, 10, false, true); + + //Inform + if (cur instanceof Player) + UtilPlayer.message((Player)cur, F.main(GetClassType().name(), F.name(player.getName()) +" hit you with " + F.skill(GetName(level)) + ".")); + + //Damage Event + Factory.Damage().NewDamageEvent(cur, player, null, + DamageCause.CUSTOM, 1 + power, false, true, false, + player.getName(), GetName()); + } + + //Blocks + int attempts = 0; + int done = 0; + + Block locBlock = loc.getBlock(); + + while (done < power * 12 && attempts < power * 100) + { + attempts++; + + Vector vec = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize(); + Location side = new Location(loc.getWorld(), loc.getX() + vec.getX(), loc.getY() + vec.getY(), loc.getZ() + vec.getZ()); + + if (!UtilBlock.airFoliage(side.getBlock())) + continue; + + //Add Directional + vec.add(UtilAlg.getTrajectory(loc.getBlock().getLocation(), side.getBlock().getLocation())); + + //Add Up + vec.add(new Vector(0, 1.6, 0)); + + vec.normalize(); + + //Scale + vec.multiply(0.1 + 0.3 * Math.random() + 0.6 * ((double)power/(double)maxPower)); + + //Block! + Item item = loc.getWorld().dropItem(side, ItemStackFactory.Instance.CreateStack(locBlock.getTypeId(), locBlock.getData())); + item.setVelocity(vec); + item.setPickupDelay(50000); + _items.add(item); + + //Effect + side.getWorld().playEffect(side, Effect.STEP_SOUND, locBlock.getTypeId()); + + done++; + } + } + + @EventHandler + public void ItemPickup(PlayerPickupItemEvent event) + { + if (_items.contains(event.getItem())) + event.setCancelled(true); + } + + @EventHandler + public void HopperPickup(InventoryPickupItemEvent event) + { + if (_items.contains(event.getItem())) + event.setCancelled(true); + } + + @EventHandler + public void ItemDestroy(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (_items.isEmpty()) + return; + + Iterator itemIterator = _items.iterator(); + + while (itemIterator.hasNext()) + { + Item item = itemIterator.next(); + + if (item.isDead() || !item.isValid()) + { + item.remove(); + itemIterator.remove(); + } + else if (UtilEnt.isGrounded(item) || item.getTicksLived() > 60) + { + item.getWorld().playEffect(item.getLocation(), Effect.STEP_SOUND, item.getItemStack().getTypeId()); + item.remove(); + itemIterator.remove(); + } + } + } + + @Override + public void Reset(Player player) + { + Clean(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Void.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Void.java new file mode 100644 index 000000000..6e80f1a5e --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Void.java @@ -0,0 +1,184 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import java.util.HashSet; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerDropItemEvent; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; + +public class Void extends Skill +{ + private HashSet _active = new HashSet(); + + public Void(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Drop Axe/Sword to Toggle.", + "", + "While in void form, you receive", + "Slow 3, take no knockback and", + "use no energy to swing weapons.", + "", + "Reduces incoming damage by 4, but", + "burns 8 Energy per 1 damage reduced." + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 6 per Second"; + } + + @EventHandler + public void Toggle(PlayerDropItemEvent event) + { + Player player = event.getPlayer(); + + if (!UtilGear.isWeapon(event.getItemDrop().getItemStack())) + return; + + if (GetLevel(player) == 0) + return; + + event.setCancelled(true); + + //Check Allowed + SkillTriggerEvent trigger = new SkillTriggerEvent(player, GetName(), GetClassType()); + UtilServer.getServer().getPluginManager().callEvent(trigger); + if (trigger.IsCancelled()) + return; + + if (_active.contains(player)) + { + _active.remove(player); + UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.oo("Disabled", false))); + + //Remove Condition + Factory.Condition().EndCondition(event.getPlayer(), null, GetName()); + } + else + { + if (!Factory.Energy().Use(player, "Enable " + GetName(), 10, true, true)) + return; + + _active.add(player); + UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.oo("Enabled", true))); + + //Remove Condition + Factory.Condition().EndCondition(event.getPlayer(), null, GetName()); + } + } + + @EventHandler + public void Silence(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + //Check Allowed + SkillTriggerEvent trigger = new SkillTriggerEvent(cur, GetName(), GetClassType()); + UtilServer.getServer().getPluginManager().callEvent(trigger); + if (trigger.IsCancelled()) + _active.remove(cur); + } + } + + @EventHandler + public void Audio(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : _active) + cur.getWorld().playSound(cur.getLocation(), Sound.BREATH, 0.5f, 0.5f); + } + + @EventHandler + public void Aura(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : _active) + { + if (cur.isDead()) + continue; + + //Energy + Factory.Energy().ModifyEnergy(cur, -0.3); + + //Condition + Factory.Condition().Factory().Invisible(GetName(), cur, cur, 1.9, 0, false, true, true); + Factory.Condition().Factory().Slow(GetName(), cur, cur, 1.9, 1, false, true, false, true); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void Shield(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + if (!_active.contains(damagee)) + return; + + int level = GetLevel(damagee); + if (level == 0) return; + + double dmgToEnergy = 8; + int dmgLower = 4; + + int currentEnergy = (int)Factory.Energy().GetCurrent(damagee); + double requiredEnergy = Math.min(dmgLower, event.GetDamage()) * dmgToEnergy; + + //Lower + if (currentEnergy < requiredEnergy) + dmgLower = (int)(currentEnergy/dmgToEnergy); + + //Use Energy + Factory.Energy().ModifyEnergy(damagee, -requiredEnergy); + + //Damage + event.AddMod(damagee.getName(), GetName(), -dmgLower, false); + event.SetKnockback(false); + + //Effect + damagee.getWorld().playSound(damagee.getLocation(), Sound.BREATH, 2f, 1f); + } + + + @Override + public void Reset(Player player) + { + _active.remove(player); + + //Remove Condition + Factory.Condition().EndCondition(player, null, GetName()); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Agility.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Agility.java new file mode 100644 index 000000000..adb26b223 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Agility.java @@ -0,0 +1,141 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.potion.PotionEffectType; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Agility extends SkillActive +{ + private HashSet _active = new HashSet(); + + public Agility(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Sprint with great agility, gaining", + "Speed I for 8 seconds. You are", + "immune to attacks while sprinting.", + "", + "Agility ends if you interact." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + Factory.Condition().Factory().Speed(GetName(), player, player, 8, 0, false, true, true); + _active.add(player); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.NOTE_PLING, 0.5f, 0.5f); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void End(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (event.getAction() == Action.PHYSICAL) + return; + + if (!_active.contains(player)) + return; + + //Remove + _active.remove(player); + player.removePotionEffect(PotionEffectType.SPEED); + } + + @EventHandler(priority = EventPriority.LOW) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damagee = event.GetDamageePlayer(); + + if (damagee == null) + return; + + if (!damagee.isSprinting()) + return; + + if (!_active.contains(damagee)) + return; + + //Cancel + event.SetCancelled(GetName()); + + //Inform + UtilPlayer.message(event.GetDamagerPlayer(true), F.main(GetClassType().name(), + F.name(damagee.getName()) + " is using " + F.skill(GetName(GetLevel(damagee))) + ".")); + + //Effect + damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 0.5f, 2f); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + HashSet expired = new HashSet(); + for (Player cur : _active) + if (!cur.hasPotionEffect(PotionEffectType.SPEED)) + expired.add(cur); + + for (Player cur : expired) + _active.remove(cur); + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/BarbedArrows.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/BarbedArrows.java new file mode 100644 index 000000000..d96e81f83 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/BarbedArrows.java @@ -0,0 +1,74 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class BarbedArrows extends Skill +{ + public BarbedArrows(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Your arrows are barbed, and give", + "opponents Slow 1 for 4 seconds.", + "If opponent is sprinting, they", + "receive Slow 3 instead.", + "", + "Slow scales with arrow velocity." + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Projectile projectile = event.GetProjectile(); + if (projectile == null) return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + //Level + int level = GetLevel(damager); + if (level == 0) return; + + Player damageePlayer = event.GetDamageePlayer(); + + //Action + int str = 0; + if (damageePlayer != null) + if (damageePlayer.isSprinting()) + str = 3; + + //Damage + event.AddMod(damager.getName(), GetName(), 0, false); + + //Condition + Factory.Condition().Factory().Slow(GetName(), damagee, damager, (projectile.getVelocity().length() / 3) * 4, str, false, true, true, true); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Barrage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Barrage.java new file mode 100644 index 000000000..7b1beedfd --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Barrage.java @@ -0,0 +1,249 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.WeakHashMap; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +public class Barrage extends Skill +{ + private WeakHashMap _charge = new WeakHashMap(); + private WeakHashMap _chargeLast = new WeakHashMap(); + + private HashSet _firing = new HashSet(); + private HashSet _arrows = new HashSet(); + + public Barrage(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Load an extra arrow into your bow", + "while charging, every 0.2 seconds.", + "", + "Maximum of 20 additional arrows." + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 3 per Arrow"; + } + + @EventHandler + public void DrawBow(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!UtilGear.isMat(event.getItem(), Material.BOW)) + return; + + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (!player.getInventory().contains(Material.ARROW)) + return; + + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + return; + + if (event.getClickedBlock() != null) + { + if (UtilBlock.usable(event.getClickedBlock())) + return; + } + + //Level + int level = GetLevel(player); + if (level == 0) return; + + //Start Charge + _charge.put(player, 0); + _chargeLast.put(player, System.currentTimeMillis()); + _firing.remove(player); + } + + @EventHandler + public void Charge(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + //Not Charging + if (!_charge.containsKey(cur)) + continue; + + if (_firing.contains(cur)) + continue; + + int level = GetLevel(cur); + if (level == 0) continue; + + //Max Charge + if (_charge.get(cur) >= 20) + continue; + + //Charge Interval + if (_charge.get(cur) == 0) + { + if (!UtilTime.elapsed(_chargeLast.get(cur), 1200)) + continue; + } + else + { + if (!UtilTime.elapsed(_chargeLast.get(cur), 100)) + continue; + } + + //No Longer Holding Bow + if (!UtilGear.isMat(cur.getItemInHand(), Material.BOW)) + { + _charge.remove(cur); + _chargeLast.remove(cur); + continue; + } + + //Energy + if (!Factory.Energy().Use(cur, GetName(), 3, true, false)) + continue; + + //Increase Charge + _charge.put(cur, _charge.get(cur) + 1); + _chargeLast.put(cur, System.currentTimeMillis()); + + //Inform + if (_charge.get(cur) % 5 == 0) + UtilPlayer.message(cur, F.main(GetClassType().name(), "Barrage: " + F.elem("+" + _charge.get(cur) + " Arrows"))); + + //Effect + cur.playSound(cur.getLocation(), Sound.CLICK, 0.4f, 1f + (0.05f * _charge.get(cur))); + } + } + + @EventHandler + public void FireBow(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + if (!(event.getProjectile() instanceof Arrow)) + return; + + Player player = (Player)event.getEntity(); + + if (!_charge.containsKey(player)) + return; + + //Start Barrage + _firing.add(player); + _chargeLast.put(player, System.currentTimeMillis()); + } + + @EventHandler + public void Skill(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet remove = new HashSet(); + + for (Player cur : _firing) + { + if (!_charge.containsKey(cur) || !_chargeLast.containsKey(cur)) + { + remove.add(cur); + continue; + } + + if (!UtilGear.isBow(cur.getItemInHand())) + { + remove.add(cur); + continue; + } + + int arrows = _charge.get(cur); + if (arrows <= 0) + { + remove.add(cur); + continue; + } + + //if (!UtilTime.elapsed(_chargeLast.get(cur), 100)) + // continue; + + //_chargeLast.put(cur, System.currentTimeMillis()); + _charge.put(cur, arrows-1); + + //Fire Arrow + Vector random = new Vector((Math.random()-0.5)/10, (Math.random()-0.5)/10, (Math.random()-0.5)/10); + Projectile arrow = cur.launchProjectile(Arrow.class); + arrow.setVelocity(cur.getLocation().getDirection().add(random).multiply(3)); + _arrows.add(arrow); + cur.getWorld().playSound(cur.getLocation(), Sound.SHOOT_ARROW, 1f, 1f); + } + + for (Player cur : remove) + { + _charge.remove(cur); + _chargeLast.remove(cur); + _firing.remove(cur); + } + } + + @EventHandler + public void ProjectileHit(ProjectileHitEvent event) + { + if (_arrows.remove(event.getEntity())) + event.getEntity().remove(); + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Projectile arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid()) + arrowIterator.remove(); + } + } + + @Override + public void Reset(Player player) + { + _charge.remove(player); + _chargeLast.remove(player); + _firing.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Disengage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Disengage.java new file mode 100644 index 000000000..6aa4761c6 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Disengage.java @@ -0,0 +1,150 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import java.util.HashMap; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Disengage extends SkillActive +{ + private HashMap _prepare = new HashMap(); + + public Disengage(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Push Block, then block an attack", + "within 1 second to disengage.", + "", + "If successful, you leap backwards", + "and your attacker receives Slow 4", + "for 6 seconds.", + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Prepare + _prepare.put(player, System.currentTimeMillis() + 1000); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared to " + F.skill(GetName()) + ".")); + } + + @EventHandler(priority = EventPriority.LOW) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + //Damagee + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + //Blocking + if (!damagee.isBlocking()) + return; + + if (!_prepare.containsKey(damagee)) + return; + + //Damager + LivingEntity damager = event.GetDamagerEntity(false); + if (damager == null) return; + + //Level + int level = GetLevel(damagee); + if (level == 0) return; + + //Cancel + event.SetCancelled(GetName()); + + //Remove + _prepare.remove(damagee); + + //Velocity + if (UtilEnt.isGrounded(damagee)) + UtilAction.velocity(damagee, UtilAlg.getTrajectory2d(damager, damagee), 3, true, 0, 0.8, 1, true); + else + UtilAction.velocity(damagee, UtilAlg.getTrajectory2d(damager, damagee), 1.5, true, 0, 0.8, 1, true); + + //Condition + Factory.Condition().Factory().Slow(GetName(), damager, damagee, 6, 3, false, true, true, true); + + //Effect + damagee.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_METAL, 0.5f, 1.6f); + + //Inform + UtilPlayer.message(damagee, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + UtilPlayer.message(event.GetDamageePlayer(), F.main(GetClassType().name(), F.name(damagee.getName()) + " used " + F.skill(GetName(level)) + ".")); + + } + + @EventHandler + public void Expire(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!_prepare.containsKey(cur)) + continue; + + if (System.currentTimeMillis() > _prepare.get(cur)) + { + //Remove + _prepare.remove(cur); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), "You failed to " + F.skill(GetName()) + ".")); + } + } + } + + @Override + public void Reset(Player player) + { + _prepare.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Fletcher.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Fletcher.java new file mode 100644 index 000000000..774bf318b --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Fletcher.java @@ -0,0 +1,222 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.WeakHashMap; + +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.inventory.InventoryOpenEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Fletcher extends Skill +{ + private WeakHashMap _time = new WeakHashMap(); + private HashSet _fletchArrows = new HashSet(); + private HashSet _fletchDisable = new HashSet(); + + public Fletcher(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Craft arrows from your surroundings,", + "creating 1 Arrow every 10 seconds.", + "", + "Maximum of 8 Fletched Arrows.", + "Fletched Arrows are temporary." + }); + } + + @EventHandler + public void ShootBow(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + Player player = (Player)event.getEntity(); + + int level = GetLevel(player); + if (level == 0) return; + + for (int i=0 ; i<=8 ; i++) + if (player.getInventory().getItem(i) != null) + if (player.getInventory().getItem(i).getType() == Material.ARROW) + if (player.getInventory().getItem(i).getData() != null) + { + if (player.getInventory().getItem(i).getData().getData() == (byte)1) + _fletchArrows.add(event.getProjectile()); + + return; + } + } + + @EventHandler + public void ProjectileHit(ProjectileHitEvent event) + { + if (_fletchArrows.remove(event.getEntity())) + event.getEntity().remove(); + } + + @EventHandler + public void Fletch(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : GetUsers()) + { + if (!_time.containsKey(cur)) + _time.put(cur, System.currentTimeMillis()); + + if (!UtilTime.elapsed(_time.get(cur), 10000)) + continue; + + if (UtilInv.contains(cur, Material.ARROW, (byte)1, 8)) + continue; + + if (_fletchDisable.contains(cur)) + continue; + + _time.put(cur, System.currentTimeMillis()); + + //Add + cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, "Fletched Arrow")); + + //Inform + //UtilPlayer.message(cur, F.main(GetName(), "You crafted a " + F.item("Fletched Arrow") + ".")); + } + } + + @EventHandler + public void Drop(PlayerDropItemEvent event) + { + if (event.getItemDrop().getItemStack().getType() != Material.ARROW) + return; + + if (event.getItemDrop().getItemStack().getData() == null) + return; + + if (event.getItemDrop().getItemStack().getData().getData() != (byte)1) + return; + + //Cancel + event.setCancelled(true); + + //Inform + UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot drop " + F.item("Fletched Arrow") + ".")); + } + + @EventHandler + public void Dead(PlayerDeathEvent event) + { + HashSet remove = new HashSet(); + + for (ItemStack item : event.getDrops()) + if (item.getType() == Material.ARROW) + if (item.getData() != null) + if (item.getData().getData() == 1) + remove.add(item); + + for (ItemStack item : remove) + event.getDrops().remove(item); + } + + @EventHandler + public void ChestRemove(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + return; + + if ( event.getClickedBlock().getType() != Material.CHEST && + event.getClickedBlock().getType() != Material.FURNACE && + event.getClickedBlock().getType() != Material.BURNING_FURNACE && + event.getClickedBlock().getType() != Material.WORKBENCH && + event.getClickedBlock().getType() != Material.DISPENSER && + event.getClickedBlock().getType() != Material.ENCHANTMENT_TABLE && + event.getClickedBlock().getType() != Material.BEACON) + return; + + UtilInv.removeAll(event.getPlayer(), Material.ARROW, (byte)1); + } + + @EventHandler + public void InvDisable(InventoryOpenEvent event) + { + if (GetLevel(event.getPlayer()) > 0) + _fletchDisable.add(event.getPlayer()); + } + + @EventHandler + public void InvEnable(InventoryCloseEvent event) + { + _fletchDisable.remove(event.getPlayer()); + } + + @EventHandler + public void InvClick(InventoryClickEvent event) + { + if (event.getCurrentItem() == null) + return; + + if (event.getCurrentItem().getType() != Material.ARROW) + return; + + if (event.getCurrentItem().getData() == null) + return; + + if (event.getCurrentItem().getData().getData() != 1) + return; + + event.setCancelled(true); + + //Inform + UtilPlayer.message(event.getWhoClicked(), F.main(GetName(), "You cannot move " + F.item("Fletched Arrow") + ".")); + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Iterator arrowIterator = _fletchArrows.iterator(); arrowIterator.hasNext();) + { + Entity arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid()) + arrowIterator.remove(); + } + } + + @Override + public void Reset(Player player) + { + _time.remove(player); + _fletchDisable.remove(player); + UtilInv.removeAll(player, Material.ARROW, (byte)1); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HealingShot.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HealingShot.java new file mode 100644 index 000000000..057ea4fbe --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HealingShot.java @@ -0,0 +1,190 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Effect; +import org.bukkit.EntityEffect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.potion.PotionEffectType; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class HealingShot extends SkillActive +{ + private HashSet _arrows = new HashSet(); + private HashSet _active = new HashSet(); + + public HealingShot(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Prepare a healing shot;", + "Your next arrow will give its target", + "Regeneration 1 for 10 seconds,", + "and remove all negative effects." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + _active.add(player); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f); + } + + @EventHandler + public void ShootBow(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + if (!(event.getProjectile() instanceof Arrow)) + return; + + Player player = (Player)event.getEntity(); + + if (!_active.remove(player)) + return; + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(GetName(GetLevel(player))) + ".")); + + _arrows.add(event.getProjectile()); + } + + @EventHandler(priority = EventPriority.NORMAL) + public void ArrowHit(EntityDamageEvent event) + { + if (event.getCause() != DamageCause.PROJECTILE) + return; + + if (!(event instanceof EntityDamageByEntityEvent)) + return; + + EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent)event; + + if (!(eventEE.getDamager() instanceof Projectile)) + return; + + Projectile projectile = (Projectile)eventEE.getDamager(); + + //Not Pin Down Arrow + if (!_arrows.contains((Entity)projectile)) + return; + + if (!(event.getEntity() instanceof LivingEntity)) + return; + + LivingEntity damagee = (LivingEntity)event.getEntity(); + + if (projectile.getShooter() == null) + return; + + if (!(projectile.getShooter() instanceof Player)) + return; + + Player damager = (Player)projectile.getShooter(); + + //Level + int level = GetLevel(damager); + if (level == 0) return; + + //Remove + _arrows.remove(projectile); + projectile.remove(); + + //Regen + Factory.Condition().Factory().Regen(GetName(), damagee, damager, 10, 0, false, true, true); + + //Remove Bad + damagee.setFireTicks(0); + damagee.removePotionEffect(PotionEffectType.SLOW); + damagee.removePotionEffect(PotionEffectType.POISON); + damagee.removePotionEffect(PotionEffectType.CONFUSION); + damagee.removePotionEffect(PotionEffectType.WEAKNESS); + + //Effect + damagee.getWorld().playSound(damagee.getLocation(), Sound.LEVEL_UP, 1f, 1.5f); + damagee.getWorld().playEffect(damagee.getLocation(), Effect.STEP_SOUND, 115); + damagee.playEffect(EntityEffect.HURT); + + //Inform + UtilPlayer.message(damagee, F.main(GetClassType().name(), + F.name(damager.getName()) +" hit you with " + F.skill(GetName(level)) + ".")); + + UtilPlayer.message(damager, F.main(GetClassType().name(), + "You hit " + F.name(UtilEnt.getName(damagee)) +" with " + F.skill(GetName(level)) + ".")); + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Entity arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid()) + arrowIterator.remove(); + } + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HeavyArrows.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HeavyArrows.java new file mode 100644 index 000000000..c5d2b4950 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HeavyArrows.java @@ -0,0 +1,56 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityShootBowEvent; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.UtilAction; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class HeavyArrows extends Skill +{ + public HeavyArrows(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Your arrows are extremely heavy,", + "moving 20% slower, also pushing", + "you back upon firing them." + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void ShootBow(EntityShootBowEvent event) + { + if (event.isCancelled()) + return; + + if (!(event.getEntity() instanceof Player)) + return; + + Player player = (Player)event.getEntity(); + + //Level + int level = GetLevel(player); + if (level == 0) return; + + //Backboost + double vel = (event.getProjectile().getVelocity().length() / 3); + UtilAction.velocity(player, player.getLocation().getDirection().multiply(-1), vel, + false, 0, 0.2, 0.8, true); + + //Decrease Speed + event.getProjectile().setVelocity(event.getProjectile().getVelocity().multiply(0.8)); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java new file mode 100644 index 000000000..dd12e6b36 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java @@ -0,0 +1,156 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class IncendiaryShot extends SkillActive +{ + private HashSet _arrows = new HashSet(); + private HashSet _active = new HashSet(); + + public IncendiaryShot(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Prepare an incendiary shot;", + "Your next arrow will ignite", + "its target for 6 seconds." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + _active.add(player); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f); + } + + @EventHandler + public void ShootBow(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + if (!(event.getProjectile() instanceof Arrow)) + return; + + Player player = (Player)event.getEntity(); + + if (!_active.remove(player)) + return; + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(GetName(GetLevel(player))) + ".")); + + _arrows.add(event.getProjectile()); + event.getProjectile().setFireTicks(200); + } + + @EventHandler(priority = EventPriority.HIGH) + public void ArrowHit(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Projectile projectile = event.GetProjectile(); + if (projectile == null) return; + + if (!_arrows.contains((Entity)projectile)) + return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + //Level + int level = GetLevel(damager); + if (level == 0) return; + + //Ignite + Factory.Condition().Factory().Ignite(GetName(), damagee, damager, 6, true, true); + + //Damage + event.AddMod(damager.getName(), GetName(), 0, true); + + //Effect + damagee.getWorld().playSound(damagee.getLocation(), Sound.FIZZ, 2f, 1.5f); + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Entity arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid()) + arrowIterator.remove(); + } + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Longshot.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Longshot.java new file mode 100644 index 000000000..f36bdb1da --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Longshot.java @@ -0,0 +1,162 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Location; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerDropItemEvent; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Longshot extends Skill +{ + private HashSet _zoomed = new HashSet(); + private HashMap _arrows = new HashMap(); + + public Longshot(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Arrows do an additional", + "1 damage per 3 Blocks travelled,", + "however, their base damage is", + "reduced by 3.", + "", + "Maximum of 20 additional damage." + }); + } + + @EventHandler + public void ShootBow(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + int level = GetLevel((Player)event.getEntity()); + if (level == 0) return; + + //Save + _arrows.put(event.getProjectile(), event.getProjectile().getLocation()); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Projectile projectile = event.GetProjectile(); + if (projectile == null) return; + + if (!_arrows.containsKey(projectile)) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + Location loc = _arrows.remove(projectile); + double length = UtilMath.offset(loc, projectile.getLocation()); + + //Damage + double damage = Math.min(20, (length / 3) - 3); + + event.AddMod(damager.getName(), GetName(), damage, damage > 0); + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + HashSet remove = new HashSet(); + + for (Entity cur : _arrows.keySet()) + if (cur.isDead() || !cur.isValid()) + remove.add(cur); + + for (Entity cur : remove) + { + _arrows.remove(cur); + } + } + + //@EventHandler + public void ToggleZoom(PlayerDropItemEvent event) + { + Player player = event.getPlayer(); + + if (GetLevel(player) == 0) + return; + + if (UtilGear.isWeapon(player.getItemInHand())) + return; + + event.setCancelled(true); + + //Disable + if (_zoomed.contains(player)) + { + _zoomed.remove(player); + UtilPlayer.message(player, F.main(GetClassType().name(), "Hawks Eye: " + F.oo("Disabled", false))); + Factory.Condition().EndCondition(player, ConditionType.SLOW, GetName()); + } + //Enable + else + { + _zoomed.add(event.getPlayer()); + UtilPlayer.message(event.getPlayer(), F.main(GetClassType().name(), "Hawks Eye: " + F.oo("Enabled", true))); + } + } + + //@EventHandler + public void Zoom(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator zoomIterator = _zoomed.iterator(); + + while (zoomIterator.hasNext()) + { + Player cur = zoomIterator.next(); + + if (!cur.isOnline()) + { + zoomIterator.remove(); + continue; + } + + if (GetLevel(cur) > 0) + Factory.Condition().Factory().Slow(GetName(), cur, cur, 1.9, 1 + (GetLevel(cur)), false, true, false, true); + } + } + + @Override + public void Reset(Player player) + { + _zoomed.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.java new file mode 100644 index 000000000..222f984eb --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.java @@ -0,0 +1,149 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.ProjectileHitEvent; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class NapalmShot extends SkillActive +{ + private HashSet _arrows = new HashSet(); + private HashSet _napalm = new HashSet(); + + public NapalmShot(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Prepare a napalm shot;", + "Your next arrow will explode on", + "impact, spewing out a rain of", + "flames, which ignite players." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + _napalm.add(player); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f); + } + + @EventHandler + public void BowShoot(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + if (!(event.getProjectile() instanceof Arrow)) + return; + + Player player = (Player)event.getEntity(); + + if (!_napalm.remove(player)) + return; + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(GetName(GetLevel(player))) + ".")); + + _arrows.add(event.getProjectile()); + event.getProjectile().setFireTicks(120); + } + + @EventHandler + public void ProjectileHit(ProjectileHitEvent event) + { + Projectile proj = event.getEntity(); + + if (!_arrows.remove(proj)) + return; + + if (proj.getShooter() == null) + return; + + if (!(proj.getShooter() instanceof Player)) + return; + + Player damager = (Player)proj.getShooter(); + int level = GetLevel(damager); + if (level == 0) return; + + proj.getWorld().playSound(proj.getLocation(), Sound.EXPLODE, 0.4f, 2f); + + for (int i = 0 ; i < 32 ; i++) + { + Item fire = proj.getWorld().dropItemNaturally(proj.getLocation(), ItemStackFactory.Instance.CreateStack(Material.FIRE, 1)); + Factory.Fire().Add(fire, damager, 16, 0.25, 2, 0, GetName()); + fire.setVelocity(fire.getVelocity().multiply(1.6)); + } + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Entity arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid()) + arrowIterator.remove(); + } + } + + @Override + public void Reset(Player player) + { + _napalm.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Overcharge.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Overcharge.java new file mode 100644 index 000000000..5a58385d2 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Overcharge.java @@ -0,0 +1,214 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.WeakHashMap; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +public class Overcharge extends Skill +{ + private HashMap _arrows = new HashMap(); + private WeakHashMap _charge = new WeakHashMap(); + private WeakHashMap _chargeLast = new WeakHashMap(); + + public Overcharge(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Draw back harder on your bow, giving", + "2 bonus damage per 0.8 seconds", + "", + "Maximum of 8 bonus damage" + }); + } + + @EventHandler + public void Interact(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!UtilGear.isMat(event.getItem(), Material.BOW)) + return; + + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (!player.getInventory().contains(Material.ARROW)) + return; + + if (event.getClickedBlock() != null) + { + if (UtilBlock.usable(event.getClickedBlock())) + return; + } + + //Level + int level = GetLevel(player); + if (level == 0) return; + + //Start Charge + _charge.put(player, 0); + _chargeLast.put(player, System.currentTimeMillis()); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + //Not Charging + if (!_charge.containsKey(cur)) + continue; + + //Max Charge + if (_charge.get(cur) >= 4) + continue; + + //Charge Interval + if (_charge.get(cur) == 0) + { + if (!UtilTime.elapsed(_chargeLast.get(cur), 1200)) + continue; + } + else + { + if (!UtilTime.elapsed(_chargeLast.get(cur), 800)) + continue; + } + + //No Longer Holding Bow + if (!UtilGear.isMat(cur.getItemInHand(), Material.BOW)) + { + _charge.remove(cur); + _chargeLast.remove(cur); + continue; + } + + //Energy + if (!Factory.Energy().Use(cur, GetName(), 10, true, false)) + continue; + + //Increase Charge + _charge.put(cur, _charge.get(cur) + 1); + _chargeLast.put(cur, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), "Overcharge: " + F.elem("+" + (_charge.get(cur) * 2) + " Damage"))); + + //Effect + for (int i=_charge.get(cur) ; i>0 ; i--) + cur.playEffect(cur.getLocation(), Effect.CLICK2, 0); + } + } + + @EventHandler + public void ShootBow(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + if (!(event.getProjectile() instanceof Arrow)) + return; + + Player player = (Player)event.getEntity(); + + if (!_charge.containsKey(player)) + return; + + //Add Velocity + _arrows.put(event.getProjectile(), _charge.get(player)); + + //Clear Charge + _charge.remove(player); + _chargeLast.remove(player); + } + + @EventHandler(priority = EventPriority.HIGH) + public void ArrowHit(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Projectile projectile = event.GetProjectile(); + if (projectile == null) return; + + if (!_arrows.containsKey(projectile)) + return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + //Level + int level = GetLevel(damager); + if (level == 0) return; + + int damage = _arrows.remove(projectile) * 2; + + //Damage + event.AddMod(damager.getName(), GetName(), damage, true); + + //Effect + damagee.getWorld().playSound(damagee.getLocation(), Sound.HURT_FLESH, 1f, 0.5f); + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + HashSet remove = new HashSet(); + + for (Entity cur : _arrows.keySet()) + if (cur.isDead() || !cur.isValid()) + remove.add(cur); + + for (Entity cur : remove) + _arrows.remove(cur); + } + + @Override + public void Reset(Player player) + { + _charge.remove(player); + _chargeLast.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/PinDown.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/PinDown.java new file mode 100644 index 000000000..4afa66068 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/PinDown.java @@ -0,0 +1,160 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.EntityEffect; +import org.bukkit.Material; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class PinDown extends SkillActive +{ + private HashSet _arrows = new HashSet(); + + public PinDown(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Instantly fire an arrow, giving", + "target Slow 3 for 6 seconds." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + //Use Arrow + if (!UtilInv.contains(player, Material.ARROW, (byte)0, 1)) + { + UtilPlayer.message(player, F.main("Skill", "You need " + F.item("1 Arrow") + " to use " + F.skill(GetName()) + ".")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Arrow + UtilInv.remove(player, Material.ARROW, (byte)0, 1); + + //Action + Projectile proj = player.launchProjectile(Arrow.class); + _arrows.add(proj); + + //Speed + proj.setVelocity(player.getLocation().getDirection().multiply(1.6)); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + + //Effect + player.getWorld().playEffect(player.getLocation(), Effect.BOW_FIRE, 0); + player.getWorld().playEffect(player.getLocation(), Effect.BOW_FIRE, 0); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Hit(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Projectile projectile = event.GetProjectile(); + if (projectile == null) return; + + //Not Pin Down Arrow + if (!_arrows.contains(projectile)) + return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + //Level + int level = GetLevel(damager); + if (level == 0) return; + + //Cripple + double dur = 6; + Factory.Condition().Factory().Slow(GetName(), damagee, damager, dur, 3, false, true, true, true); + + //Damage + event.AddMod(damager.getName(), GetName(), 0, true); + event.SetKnockback(false); + + //Effect + for (int i=0 ; i<3 ; i++) + damagee.playEffect(EntityEffect.HURT); + + //Clean + _arrows.remove(projectile); + projectile.remove(); + + //Inform + UtilPlayer.message(event.GetDamageePlayer(), F.main(GetClassType().name(), F.name(damager.getName()) +" hit you with " + F.skill(GetName(level)) + ".")); + UtilPlayer.message(damager, F.main(GetClassType().name(), "You hit " + F.name(UtilEnt.getName(event.GetDamageeEntity())) +" with " + F.skill(GetName(level)) + ".")); + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + HashSet remove = new HashSet(); + + for (Projectile cur : _arrows) + if (cur.isDead() || !cur.isValid()) + remove.add(cur); + + for (Projectile cur : remove) + _arrows.remove(cur); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Ranger.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Ranger.java new file mode 100644 index 000000000..f62cc505a --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Ranger.java @@ -0,0 +1,26 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import org.bukkit.entity.Player; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Ranger extends Skill +{ + public Ranger(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + + }); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/RopedArrow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/RopedArrow.java new file mode 100644 index 000000000..ce51541c0 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/RopedArrow.java @@ -0,0 +1,143 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class RopedArrow extends SkillActive +{ + private HashSet _arrows = new HashSet(); + private HashSet _roped = new HashSet(); + + public RopedArrow(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Prepare a roped arrow;", + "Your next arrow will pull you", + "pull you in after it hits.", + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + _roped.add(player); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f); + } + + @EventHandler + public void handleShootBow(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + if (!(event.getProjectile() instanceof Arrow)) + return; + + Player player = (Player)event.getEntity(); + + if (!_roped.remove(player)) + return; + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(GetName(GetLevel(player))) + ".")); + + _arrows.add(event.getProjectile()); + } + + @EventHandler + public void ArrowHit(ProjectileHitEvent event) + { + if (!_arrows.remove((Entity)event.getEntity())) + return; + + Projectile proj = event.getEntity(); + + if (proj.getShooter() == null) + return; + + if (!(proj.getShooter() instanceof Player)) + return; + + //Level + int level = GetLevel(((Player)proj.getShooter())); + if (level == 0) return; + + Vector vec = UtilAlg.getTrajectory(proj.getShooter(), proj); + double mult = (proj.getVelocity().length() / 3d); + + //Action + UtilAction.velocity(proj.getShooter(), vec, + 0.4 + mult, false, 0, 0.3 * mult, 1.2 * mult, true); + + //Effect + proj.getWorld().playSound(proj.getLocation(), Sound.BREATH, 2.5f, 2.0f); + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Entity arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid()) + arrowIterator.remove(); + } + } + + @Override + public void Reset(Player player) + { + _roped.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Shadowmeld.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Shadowmeld.java new file mode 100644 index 000000000..0a3dfe0f2 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Shadowmeld.java @@ -0,0 +1,144 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import java.util.HashSet; +import java.util.WeakHashMap; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerInteractEvent; + +public class Shadowmeld extends Skill +{ + private WeakHashMap _crouchTime = new WeakHashMap(); + + private HashSet _active = new HashSet(); + + public Shadowmeld(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Crouch for 2 seconds to meld into", + "the shadows, turning invisible,", + "and receive Vulnerability II.", + "", + "Shadowmeld ends if you stop crouching,", + "interact or another player comes within", + "4 Blocks of you." + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 8 per Second"; + } + + @EventHandler + public void Skill(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : GetUsers()) + { + int level = GetLevel(cur); + if (level == 0) continue; + + //Proximity Decloak + if (_active.contains(cur) || _crouchTime.containsKey(cur)) + for (Player other : cur.getWorld().getEntitiesByClass(Player.class)) + { + if (other.equals(cur)) + continue; + + if (UtilMath.offset(cur, other) > 4) + continue; + + End(cur); + break; + } + + //Active - Check for Disable + if (_active.contains(cur)) + { + if (!cur.isSneaking()) + End(cur); + else + Factory.Condition().Factory().Cloak(GetName(), cur, cur, 1.9, false, true); + } + else if (cur.isSneaking()) + { + //Start Timer + if (!_crouchTime.containsKey(cur)) + { + _crouchTime.put(cur, System.currentTimeMillis()); + } + //Check Timer + else if (UtilTime.elapsed(_crouchTime.get(cur), 2000)) + { + _crouchTime.remove(cur); + _active.add(cur); + Factory.Condition().Factory().Cloak(GetName(), cur, cur, 1.9, false, true); + } + } + } + } + + @EventHandler + public void Energy(UpdateEvent event) + { + if (event.getType() == UpdateType.TICK) + for (Player cur : _active) + if (!Factory.Energy().Use(cur, GetName(), -0.4, true, true)) + End(cur); + + if (event.getType() == UpdateType.FAST) + for (Player cur : _active) + Factory.Condition().Factory().Vulnerable(GetName(), cur, cur, 2.9, 1, false, true, true); + } + + @EventHandler(priority = EventPriority.HIGH) + public void EndDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + End(damagee); + } + + @EventHandler + public void EndInteract(PlayerInteractEvent event) + { + End(event.getPlayer()); + } + + public void End(Player player) + { + if (_active.remove(player)) + Factory.Condition().EndCondition(player, ConditionType.CLOAK, GetName()); + + _crouchTime.remove(player); + } + + @Override + public void Reset(Player player) + { + End(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.java new file mode 100644 index 000000000..701991862 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.java @@ -0,0 +1,122 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.WeakHashMap; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +public class Sharpshooter extends Skill +{ + private WeakHashMap _hitCount = new WeakHashMap(); + private HashMap _arrows = new HashMap(); + + public Sharpshooter(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Consecutive arrow hits deal an", + "additional 2 damage.", + "Stacks up to 3 times", + "Missing an arrow resets the bonus.", + }); + } + + @EventHandler + public void ShootBow(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + int level = GetLevel((Player)event.getEntity()); + if (level == 0) return; + + //Store + _arrows.put(event.getProjectile(), (Player)event.getEntity()); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Projectile projectile = event.GetProjectile(); + if (projectile == null) return; + + if (!_arrows.containsKey(projectile)) + return; + + Player player = _arrows.remove(projectile); + + if (_hitCount.containsKey(player)) + { + //Damage + event.AddMod(player.getName(), GetName(), _hitCount.get(player) * 2, true); + + //Increment + _hitCount.put(player, _hitCount.get(player) + 1); + + int limit = Math.min(3, _hitCount.get(player)); + + //Inform + UtilPlayer.message(projectile.getShooter(), F.main(GetClassType().name(), GetName() + ": " + + F.elem(_hitCount.get(player) + " Consecutive Hits") + C.cGray + " (" + F.skill("+"+ (limit * 2) + "Damage" ) + C.cGray + ")" ) ); + } + else + { + _hitCount.put(player, 1); + } + + projectile.remove(); + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + HashSet remove = new HashSet(); + + for (Entity cur : _arrows.keySet()) + if (cur.isDead() || !cur.isValid()) + remove.add(cur); + + for (Entity cur : remove) + { + Player player = _arrows.remove(cur); + + if (player != null) + if (_hitCount.remove(player) != null) + UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.elem("0 Consecutive Hits"))); + } + } + + @Override + public void Reset(Player player) + { + _hitCount.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/VitalitySpores.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/VitalitySpores.java new file mode 100644 index 000000000..8b9200a4b --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/VitalitySpores.java @@ -0,0 +1,54 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class VitalitySpores extends Skill +{ + public VitalitySpores(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "After 10 seconds of not taking damage,", + "forest spores surround you, giving", + "you Regeneration 1 for 6 seconds.", + "", + "This remains until you take damage." + }); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : GetUsers()) + { + int level = GetLevel(cur); + if (level == 0) continue; + + if (UtilTime.elapsed(Factory.Combat().Get(cur).LastDamaged, 10000)) + { + Factory.Condition().Factory().Regen(GetName(), cur, cur, 6.9, 0, false, true, true); + UtilPlayer.health(cur, 1); + } + } + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsFury.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsFury.java new file mode 100644 index 000000000..10c9459b0 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsFury.java @@ -0,0 +1,190 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import java.util.HashSet; +import java.util.WeakHashMap; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilGear; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class WolfsFury extends SkillActive +{ + private WeakHashMap _active = new WeakHashMap(); + private HashSet _swing = new HashSet(); + private HashSet _miss = new HashSet(); + + public WolfsFury(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Summon the power of the wolf, gaining", + "Strength 2 for 8 seconds, and giving", + "no knockback on your attacks.", + "", + "If you miss two consecutive attacks,", + "Wolfs Fury ends." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + _active.put(player, System.currentTimeMillis() + 8000); + + //Condition + Factory.Condition().Factory().Strength(GetName(), player, player, 8, 1, false, true, true); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.WOLF_GROWL, 1.4f, 1.2f); + } + + @EventHandler + public void Expire(UpdateEvent event) + { + //End Skill + if (event.getType() == UpdateType.FAST) + { + HashSet expired = new HashSet(); + + for (Player cur : _active.keySet()) + if (System.currentTimeMillis() > _active.get(cur)) + expired.add(cur); + + for (Player cur : expired) + End(cur); + } + } + + @EventHandler + public void Swing(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.L)) + return; + + if(!_active.containsKey(event.getPlayer())) + return; + + if (!UtilGear.isAxe(event.getPlayer().getItemInHand()) && !UtilGear.isSword(event.getPlayer().getItemInHand())) + return; + + _swing.add(event.getPlayer()); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Hit(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + int level = GetLevel(damager); + if (level == 0) return; + + if (!_swing.remove(damager)) + return; + + //Remove Miss + _miss.remove(damager); + + //Damage + event.SetKnockback(false); + + //Effect + damager.getWorld().playSound(damager.getLocation(), Sound.WOLF_BARK, 0.5f, 1.2f); + } + + @EventHandler + public void Miss(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet expired = new HashSet(); + + for (Player cur : _swing) + expired.add(cur); + + for (Player cur : expired) + { + _swing.remove(cur); + + if (_miss.remove(cur)) + { + End(cur); + } + else + { + _miss.add(cur); + } + } + } + + public void End(Player player) + { + Reset(player); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), F.skill(GetName()) + " has ended.")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.WOLF_WHINE, 0.6f, 0.8f); + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + _swing.remove(player); + _miss.remove(player); + Factory.Condition().EndCondition(player, ConditionType.INCREASE_DAMAGE, GetName()); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsPounce.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsPounce.java new file mode 100644 index 000000000..ff6cc1f5b --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsPounce.java @@ -0,0 +1,202 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import java.util.HashSet; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; + +import org.bukkit.Effect; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +public class WolfsPounce extends mineplex.minecraft.game.classcombat.Skill.Skill +{ + private NautHashMap _charge = new NautHashMap(); + private NautHashMap _chargeLast = new NautHashMap(); + private NautHashMap _pounceTime = new NautHashMap(); + private NautHashMap _pounceCharge = new NautHashMap(); + + public WolfsPounce(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Hold Block to charge pounce.", + "Release Block to pounce.", + "", + "Attacking while airborne tackles players,", + "giving Slow 3 for up to 5 seconds." + }); + } + + @Override + public String GetEnergyString() + { + return "Energy: 10 per 20% Velocity"; + } + + @EventHandler + public void Pounce(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : UtilServer.getPlayers()) + { + //Level + int level = GetLevel(cur); + if (level == 0) continue; + + if (cur.isBlocking()) + { + if (!UtilEnt.isGrounded(cur)) + continue; + + if (cur.getLocation().getBlock().isLiquid()) + continue; + + //Not Charging + if (!_charge.containsKey(cur)) + { + if (!Factory.Energy().Use(cur, GetName(level), 10, false, false)) + continue; + + SkillTriggerEvent triggerEvent = new SkillTriggerEvent(cur, GetName(), GetClassType()); + UtilServer.getServer().getPluginManager().callEvent(triggerEvent); + + if (triggerEvent.IsCancelled()) + continue; + + if (!Recharge.Instance.use(cur, GetName(level), 500, false)) + continue; + + Factory.Energy().Use(cur, GetName(level), 10, true, false); + + //Start Charge + _charge.put(cur, 0); + _chargeLast.put(cur, System.currentTimeMillis()); + + //Leap + UtilPlayer.message(cur, F.main(GetClassType().name(), GetName() + ": " + F.elem("20% Velocity"))); + } + else + { + //Max Charge + if (_charge.get(cur) >= 4) + continue; + + //Charge Interval + if (!UtilTime.elapsed(_chargeLast.get(cur), 1000 - (level * 180))) + continue; + + if (!Factory.Energy().Use(cur, GetName(level), 10, true, false)) + continue; + + //Increase Charge + _charge.put(cur, _charge.get(cur) + 1); + _chargeLast.put(cur, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), GetName() + ": " + F.elem((_charge.get(cur) * 20 + 20) + "% Velocity"))); + + //Effect + for (int i=_charge.get(cur) ; i>0 ; i--) + cur.playEffect(cur.getLocation(), Effect.CLICK2, 0); + } + } + //Release Charge + else if (_charge.containsKey(cur)) + { + //Action + int charge = _charge.remove(cur); + UtilAction.velocity(cur, 0.4 + (0.4*charge), 0.2, 0.6 + (0.1*charge), true); + _chargeLast.remove(cur); + _pounceCharge.put(cur, charge); + _pounceTime.put(cur, System.currentTimeMillis()); + + //Effect + cur.getWorld().playSound(cur.getLocation(), Sound.WOLF_BARK, 1f, 1.2f + (level * 0.2f)); + } + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void Hit(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + int level = GetLevel(damager); + if (level == 0) return; + + if (!_pounceTime.containsKey(damager)|| UtilTime.elapsed(_pounceTime.get(damager), 250)) + return; + + int charge = _pounceCharge.get(damager); + + //Damage + event.SetKnockback(false); + event.AddMod(damager.getName(), GetName(), 0, true); + + //Condition + Factory.Condition().Factory().Slow(GetName(), damagee, damager, 1 + charge, 2, false, true, true, true); + + //Effect + damager.getWorld().playSound(damager.getLocation(), Sound.WOLF_BARK, 0.5f, 0.5f); + + _pounceTime.remove(damager); + } + + @EventHandler + public void Grounded(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet expired = new HashSet(); + + for (Player cur : _pounceTime.keySet()) + if (UtilEnt.isGrounded(cur)) + if (UtilTime.elapsed(_pounceTime.get(cur), 250)) + expired.add(cur); + + for (Player cur : expired) + _pounceTime.remove(cur); + } + + @Override + public void Reset(Player player) + { + _charge.remove(player); + _chargeLast.remove(player); + _pounceTime.remove(player); + _pounceCharge.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/ChickenForm.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/ChickenForm.java new file mode 100644 index 000000000..735638f22 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/ChickenForm.java @@ -0,0 +1,92 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Chicken; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.FormBase; + +import org.bukkit.ChatColor; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +public class ChickenForm extends FormBase +{ + public ChickenForm(SkillFactory skills, String name, ClassType classType, + SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels, + EntityType.CHICKEN, new String[] + { + "Flap" + }); + + SetDesc(new String[] + { + ChatColor.WHITE + "Passives:", + "* Slow I", + "* +10 Damage taken from Arrows", + "", + "", + ChatColor.WHITE + "Attack: " + ChatColor.GREEN + "None", + "", + "", + ChatColor.WHITE + "Sword Skill: " + ChatColor.GREEN + "Fly", + "Push Block to Flap;", + "* Velocity of 0.5 + 0.05pL", + "", + "Hold Block to Glide;", + "* Min speed of 0.3 + 0.03pL", + "* Max speed of 0.7 + 0.07pL", + "", + "Glide through enemies to pick them up.", + "Stop gliding to drop them.", + "", + "", + ChatColor.WHITE + "Axe Skill: " + ChatColor.GREEN + "Spin Web", + "Spin a temporary web;", + "* Lasts 5 + 1pL seconds", + }); + } + + @Override + public void UnapplyMorph(Player player) + { + Flap flap = (Flap)Factory.GetSkill("Flap"); + flap.GetGrab().Release(player); + + Factory.Condition().EndCondition(player, null, GetName()); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Attack(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!IsMorphed(damager)) + return; + + event.SetCancelled(GetName()); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : GetMorphedUsers()) + Factory.Condition().Factory().Slow(GetName(), cur, cur, 1.9, 0, false, false, false); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/Flap.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/Flap.java new file mode 100644 index 000000000..f3066a4a6 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/Flap.java @@ -0,0 +1,262 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Chicken; + +import java.util.HashMap; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Flap extends SkillActive +{ + private HashMap _active = new HashMap(); + private HashMap _damaged = new HashMap(); + + private long _damageDisableTime = 6000; + + private double _flap = 0.5; + private double _min = 0.3; + private double _max = 0.7; + + private FlapGrab _grab = null; + + private int _tick = 0; + + public Flap(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + _grab = new FlapGrab(this); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + //Wings Damaged + if (_damaged.containsKey(player)) + { + long damageTime = _damaged.get(player); + + if (!UtilTime.elapsed(damageTime, _damageDisableTime)) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " for " + + F.time(UtilTime.MakeStr(_damageDisableTime - (System.currentTimeMillis() - damageTime))) + ".")); + + return false; + } + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Initial Flap + Vector vel = player.getLocation().getDirection(); + vel.multiply(_flap + ((_flap/10d) * level)); + vel.add(new Vector(0,0.1,0)); + + //Clutch Penalty + if (player.getVehicle() != null) + vel.multiply(0.5 + (level * 0.05)); + + _active.put(player, vel); + + //Apply Velocity + player.setVelocity(vel); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, 1f, 1f); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + return; + + if (event.GetDamageePlayer() == null) + return; + + if (!GetUsers().containsKey(event.GetDamageePlayer())) + return; + + event.AddMod(UtilEnt.getName(event.GetDamagerEntity(true)), "Chicken Weakness", 10, false); + + _damaged.put(event.GetDamageePlayer(), System.currentTimeMillis()); + } + + @EventHandler + public void Glide(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + _tick = (_tick + 1)%12; + + for (Player cur : GetUsers()) + { + if (!_active.containsKey(cur)) + { + GetGrab().Release(cur); + continue; + } + + if (!cur.isBlocking()) + { + _active.remove(cur); + continue; + } + + //Level + int level = GetLevel(cur); + if (level == 0) + { + _active.remove(cur); + continue; + } + + //Clutch Penalty + if (cur.getVehicle() != null) + { + //Energy + if (!Factory.Energy().Use(cur, "Glide", 1.2 - (0.02 * level), true, true)) + { + _active.remove(cur); + continue; + } + } + else + { + //Energy + if (!Factory.Energy().Use(cur, "Glide", 0.6 - (0.02 * level), true, true)) + { + _active.remove(cur); + continue; + } + } + + //Target to apply velocity to + Entity target = cur; + if (cur.getVehicle() != null) + target = cur.getVehicle(); + + //Get Velocity + Vector vel = _active.get(cur); + + if (UtilEnt.isGrounded(target) && vel.getY() < 0) + { + _active.remove(cur); + continue; + } + + //Turn + double speed = vel.length(); + Vector turn = cur.getLocation().getDirection(); + turn.subtract(UtilAlg.Normalize(UtilAlg.Clone(vel))); + turn.multiply(0.1); + vel.add(turn); + UtilAlg.Normalize(vel).multiply(speed); + + //Gravity + vel.setX(vel.getX() * (1 - (vel.getY() / 6))); + vel.setZ(vel.getZ() * (1 - (vel.getY() / 6))); + if (vel.getY() > 0) vel.setY(vel.getY() * (1 - (vel.getY() / 6))); + + //Air Friction + vel.multiply(0.998); + + double minSpeed = _min + ((_min/10d) * level); + double maxSpeed = _max + ((_max/10d) * level); + + //Speed Min + if (vel.length() < minSpeed) + vel.normalize().multiply(minSpeed); + + //Speed Max + if (vel.length() > maxSpeed) + vel.normalize().multiply(maxSpeed); + + //Apply Velocity + target.setVelocity(vel); + + //Fall Dist + target.setFallDistance(0f); + + //Hit Others (only if not carrying) + if (cur.equals(target)) + { + for (Player other : UtilPlayer.getNearby(cur.getLocation(), 2)) + { + if (other.equals(cur)) + continue; + + if (!Factory.Relation().CanHurt(cur, other)) + continue; + + _grab.Grab(cur, other); + + if (vel.getY() < 0.1) + vel.setY(0.1); + } + } + + //Sound + if (_tick == 0) + cur.getWorld().playSound(cur.getLocation(), Sound.BAT_TAKEOFF, 0.4f, 1f); + } + } + + @EventHandler + public void DamageRelease(CustomDamageEvent event) + { + GetGrab().DamageRelease(event); + } + + public FlapGrab GetGrab() + { + return _grab; + } + + @Override + public void Reset(Player player) + { + _grab.Reset(player); + + _active.remove(player); + _damaged.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/Flap.java.orig b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/Flap.java.orig new file mode 100644 index 000000000..4dbe9748a --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/Flap.java.orig @@ -0,0 +1,262 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Chicken; + +import java.util.HashMap; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Flap extends SkillActive +{ + private HashMap _active = new HashMap(); + private HashMap _damaged = new HashMap(); + + private long _damageDisableTime = 6000; + + private double _flap = 0.5; + private double _min = 0.3; + private double _max = 0.7; + + private FlapGrab _grab = null; + + private int _tick = 0; + + public Flap(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + _grab = new FlapGrab(this); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + //Wings Damaged + if (_damaged.containsKey(player)) + { + long damageTime = _damaged.get(player); + + if (!UtilTime.elapsed(damageTime, _damageDisableTime)) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " for " + + F.time(UtilTime.MakeStr(_damageDisableTime - (System.currentTimeMillis() - damageTime))) + ".")); + + return false; + } + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Initial Flap + Vector vel = player.getLocation().getDirection(); + vel.multiply(_flap + ((_flap/10d) * level)); + vel.add(new Vector(0,0.1,0)); + + //Clutch Penalty + if (player.getVehicle() != null) + vel.multiply(0.5 + (level * 0.05)); + + _active.put(player, vel); + + //Apply Velocity + player.setVelocity(vel); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, 1f, 1f); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + return; + + if (event.GetDamageePlayer() == null) + return; + + if (!GetUsers().containsKey(event.GetDamageePlayer())) + return; + + event.AddMod(UtilEnt.getName(event.GetDamagerEntity(true)), "Chicken Weakness", 10, false); + + _damaged.put(event.GetDamageePlayer(), System.currentTimeMillis()); + } + + @EventHandler + public void Glide(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + _tick = (_tick + 1)%12; + + for (Player cur : GetUsers()) + { + if (!_active.containsKey(cur)) + { + GetGrab().Release(cur); + continue; + } + + if (!cur.isBlocking()) + { + _active.remove(cur); + continue; + } + + //Level + int level = GetLevel(cur); + if (level == 0) + { + _active.remove(cur); + continue; + } + + //Clutch Penalty + if (cur.getVehicle() != null) + { + //Energy + if (!Factory.Energy().use(cur, "Glide", 1.2 - (0.02 * level), true, true)) + { + _active.remove(cur); + continue; + } + } + else + { + //Energy + if (!Factory.Energy().use(cur, "Glide", 0.6 - (0.02 * level), true, true)) + { + _active.remove(cur); + continue; + } + } + + //Target to apply velocity to + Entity target = cur; + if (cur.getVehicle() != null) + target = cur.getVehicle(); + + //Get Velocity + Vector vel = _active.get(cur); + + if (UtilEnt.isGrounded(target) && vel.getY() < 0) + { + _active.remove(cur); + continue; + } + + //Turn + double speed = vel.length(); + Vector turn = cur.getLocation().getDirection(); + turn.subtract(UtilAlg.Normalize(UtilAlg.Clone(vel))); + turn.multiply(0.1); + vel.add(turn); + UtilAlg.Normalize(vel).multiply(speed); + + //Gravity + vel.setX(vel.getX() * (1 - (vel.getY() / 6))); + vel.setZ(vel.getZ() * (1 - (vel.getY() / 6))); + if (vel.getY() > 0) vel.setY(vel.getY() * (1 - (vel.getY() / 6))); + + //Air Friction + vel.multiply(0.998); + + double minSpeed = _min + ((_min/10d) * level); + double maxSpeed = _max + ((_max/10d) * level); + + //Speed Min + if (vel.length() < minSpeed) + vel.normalize().multiply(minSpeed); + + //Speed Max + if (vel.length() > maxSpeed) + vel.normalize().multiply(maxSpeed); + + //Apply Velocity + target.setVelocity(vel); + + //Fall Dist + target.setFallDistance(0f); + + //Hit Others (only if not carrying) + if (cur.equals(target)) + { + for (Player other : UtilPlayer.getNearby(cur.getLocation(), 2)) + { + if (other.equals(cur)) + continue; + + if (!Factory.Relation().CanHurt(cur, other)) + continue; + + _grab.Grab(cur, other); + + if (vel.getY() < 0.1) + vel.setY(0.1); + } + } + + //Sound + if (_tick == 0) + cur.getWorld().playSound(cur.getLocation(), Sound.BAT_TAKEOFF, 0.4f, 1f); + } + } + + @EventHandler + public void DamageRelease(CustomDamageEvent event) + { + GetGrab().DamageRelease(event); + } + + public FlapGrab GetGrab() + { + return _grab; + } + + @Override + public void Reset(Player player) + { + _grab.Reset(player); + + _active.remove(player); + _damaged.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/FlapGrab.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/FlapGrab.java new file mode 100644 index 000000000..be4f69219 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Chicken/FlapGrab.java @@ -0,0 +1,99 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Chicken; + +import java.util.HashMap; + +import org.bukkit.EntityEffect; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.F; + +public class FlapGrab +{ + public Flap Host; + + private HashMap _clutch = new HashMap(); + + public FlapGrab(Flap host) + { + Host = host; + } + + public void Grab(Player player, LivingEntity ent) + { + if (_clutch.containsKey(player)) + return; + + if (ent == null) + return; + + //Ent already has LE passenger + if (ent.getPassenger() != null) + if (ent.getPassenger() instanceof LivingEntity) + return; + + //Player on something + if (player.getVehicle() != null) + return; + + //Condition Indicators + Host.Factory.Condition().SetIndicatorVisibility((LivingEntity)ent, false); + + //Action + player.leaveVehicle(); + ent.eject(); + ent.setPassenger(player); + _clutch.put(player, (LivingEntity)ent); + + //Inform + UtilPlayer.message(player, F.main(Host.GetClassType().name(), "You picked up " + F.name(UtilEnt.getName(ent)) + ".")); + UtilPlayer.message(ent, F.main(Host.GetClassType().name(), F.name(player.getName()) + " picked you up.")); + + //Effect + ent.playEffect(EntityEffect.HURT); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_HURT, 2f, 1.5f); + } + + public void Release(Player player) + { + LivingEntity ent = _clutch.remove(player); + if (ent == null) return; + + player.leaveVehicle(); + ent.eject(); + + //Condition Indicators + Host.Factory.Condition().SetIndicatorVisibility(ent, true); + + //Inform + UtilPlayer.message(player, F.main(Host.GetClassType().name(), "You released " + F.name(UtilEnt.getName(ent)) + ".")); + UtilPlayer.message(ent, F.main(Host.GetClassType().name(), F.name(player.getName()) + " released you.")); + + //Effect + ent.playEffect(EntityEffect.HURT); + } + + public void DamageRelease(CustomDamageEvent event) + { + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + Release(damagee); + } + + public void Reset(Player player) + { + LivingEntity ent = _clutch.remove(player); + if (ent != null) + { + ent.eject(); + Host.Factory.Condition().SetIndicatorVisibility(ent, true); + } + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Creeper/CreeperForm.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Creeper/CreeperForm.java new file mode 100644 index 000000000..e8040c6b2 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Creeper/CreeperForm.java @@ -0,0 +1,5 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Creeper; + +public class CreeperForm { + +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/FormBase.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/FormBase.java new file mode 100644 index 000000000..8cce29205 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/FormBase.java @@ -0,0 +1,186 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map.Entry; + +import mineplex.minecraft.game.classcombat.Class.ClientClass; +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.F; +import mineplex.minecraft.game.classcombat.Skill.ISkill; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerDropItemEvent; + +public abstract class FormBase extends Skill +{ + private EntityType _type; + private ArrayList _formSkills = new ArrayList(); + private String[] _formSkillNames; + + private HashMap> _savedSkills = new HashMap>(); + + public FormBase(SkillFactory skills, String name, ClassType classType, + SkillType skillType, int cost, int levels, EntityType type, String[] formSkillNames) + { + super(skills, name, classType, skillType, cost, levels); + + _type = type; + _formSkillNames = formSkillNames; + } + + @EventHandler + public void Use(PlayerDropItemEvent event) + { + Player player = event.getPlayer(); + + int level = GetLevel(player); + if (level == 0) return; + + if (!UtilGear.isWeapon(event.getItemDrop().getItemStack())) + return; + + //Shift/Non-Shift for A/B + if (!IsMorphed(player)) + { + if (this.GetSkillType() == SkillType.PassiveA) + if (player.isSneaking()) + return; + + if (this.GetSkillType() == SkillType.PassiveB) + if (!player.isSneaking()) + return; + } + + event.setCancelled(true); + + if (_savedSkills.containsKey(player)) + Unmorph(player); + else + Morph(player); + } + + public EntityType GetType() + { + return _type; + } + + public void Morph(Player player) + { + SaveHumanSkills(player); + + //Set Skills + ClientClass cc = Factory.ClassManager().Get(player); + + for (ISkill skill : GetFormSkills()) + cc.AddSkill(skill, GetLevel(player)); + + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You shapeshifted into " + F.skill(GetName() + " " + GetLevel(player)))); + } + + public void Unmorph(Player player) + { + //Reset Skills + for (ISkill skill : GetFormSkills()) + skill.Reset(player); + + UnapplyMorph(player); + RestoreHumanSkills(player); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You returned to " + F.skill("Human Form"))); + } + + public boolean IsMorphed(Player player) + { + return _savedSkills.containsKey(player); + } + + public Collection GetMorphedUsers() + { + return _savedSkills.keySet(); + } + + public ArrayList GetFormSkills() + { + if (_formSkills.isEmpty()) + for (String name : _formSkillNames) + { + ISkill skill = Factory.GetSkill(name); + + if (skill != null) + _formSkills.add(skill); + + else + System.out.println("Invalid Skill [" + name + "] for [" + GetName() + "]."); + } + + + return _formSkills; + } + + public abstract void UnapplyMorph(Player player); + + private void SaveHumanSkills(Player player) + { + ClientClass cc = Factory.ClassManager().Get(player); + + //Save Current + _savedSkills.put(player, new HashMap()); + + for (Entry skill : cc.GetSkills()) + { + //Save Sword/Axe + if (skill.getKey().GetSkillType() == SkillType.Sword || + skill.getKey().GetSkillType() == SkillType.Axe || + skill.getKey().GetSkillType() == SkillType.Class) + _savedSkills.get(player).put(skill.getKey(), skill.getValue()); + + //Save OTHER Morph + if (this.GetSkillType() == SkillType.PassiveA) + if (skill.getKey().GetSkillType() == SkillType.PassiveB) + _savedSkills.get(player).put(skill.getKey(), skill.getValue()); + + if (this.GetSkillType() == SkillType.PassiveB) + if (skill.getKey().GetSkillType() == SkillType.PassiveA) + _savedSkills.get(player).put(skill.getKey(), skill.getValue()); + } + + //Remove Saved + for (ISkill skill : _savedSkills.get(player).keySet()) + cc.RemoveSkill(cc.GetSkillByType(skill.GetSkillType())); + } + + private void RestoreHumanSkills(Player player) + { + ClientClass cc = Factory.ClassManager().Get(player); + + //Remove Morph Skills + cc.RemoveSkill(cc.GetSkillByType(SkillType.Sword)); + cc.RemoveSkill(cc.GetSkillByType(SkillType.Axe)); + + //Restore Old + if (!_savedSkills.containsKey(player)) + return; + + for (ISkill skill : _savedSkills.get(player).keySet()) + cc.AddSkill(skill, _savedSkills.get(player).get(skill)); + + _savedSkills.remove(player); + } + + @Override + public void Reset(Player player) + { + _savedSkills.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/GolemForm.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/GolemForm.java new file mode 100644 index 000000000..e88d90ade --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/GolemForm.java @@ -0,0 +1,127 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Golem; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.UtilGear; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.FormBase; + +import org.bukkit.ChatColor; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +public class GolemForm extends FormBase +{ + public GolemForm(SkillFactory skills, String name, ClassType classType, + SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels, + EntityType.IRON_GOLEM, new String[] + { + "Magnetic Pull", + "Magnetic Repel" + }); + + SetDesc(new String[] + { + ChatColor.WHITE + "Passives:", + "* Slow II", + "* Protection III", + "* -4 Damage Dealt", + "", + ChatColor.WHITE + "Sword Attack: " + ChatColor.GREEN + "Iron Crush", + "* No Knockback", + "* Slow V for 0.5 seconds", + "", + "", + ChatColor.WHITE + "Axe Attack: " + ChatColor.GREEN + "Iron Smash", + "* Strong Knockback", + "", + "", + ChatColor.WHITE + "Sword Skill: " + ChatColor.GREEN + "Magnetic Pull", + "Pull in enemies infront of you;", + "* Range of 4 + 2pL", + "* Radius of 2 + 0.5pL", + "", + "", + ChatColor.WHITE + "Axe Skill: " + ChatColor.GREEN + "Magnetic Repel", + "Repel all nearby enemies;", + "* Range of 4 + 2pL", + "* Velocity of 1.2 + 0.2pL" + }); + } + + @Override + public void UnapplyMorph(Player player) + { + Factory.Condition().EndCondition(player, null, GetName()); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : GetMorphedUsers()) + { + Factory.Condition().Factory().Protection(GetName(), cur, cur, 1.9, 2, false, false); + Factory.Condition().Factory().Slow(GetName(), cur, cur, 1.9, 1, false, false, false); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void KnockbackTaken(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + if (!IsMorphed(damagee)) + return; + + event.SetKnockback(false); + damagee.getWorld().playSound(damagee.getLocation(), Sound.ZOMBIE_METAL, 0.8f, 1.8f); + } + + @EventHandler(priority = EventPriority.HIGH) + public void KnockbackGiven(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!IsMorphed(damager)) + return; + + event.AddMod(damager.getName(), GetName(), -4, false); + + if (UtilGear.isSword(damager.getItemInHand())) + { + damager.getWorld().playSound(damager.getLocation(), Sound.IRONGOLEM_HIT, 1f, 1.6f); + Factory.Condition().Factory().Slow(GetName(), event.GetDamageeEntity(), damager, 0.5, 4, false, false, true); + event.SetKnockback(false); + } + else if (UtilGear.isAxe(damager.getItemInHand())) + { + damager.getWorld().playSound(damager.getLocation(), Sound.IRONGOLEM_HIT, 1f, 0.8f); + event.AddKnockback(GetName(), 4d); + } + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticPull.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticPull.java new file mode 100644 index 000000000..494893c95 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticPull.java @@ -0,0 +1,142 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Golem; + +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class MagneticPull extends SkillActive +{ + private HashSet _active = new HashSet(); + + public MagneticPull(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + } + + @Override + public String GetEnergyString() + { + return "Energy: 16 per Second"; + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + _active.add(player); + + player.getWorld().playSound(player.getLocation(), Sound.IRONGOLEM_DEATH, 0.6f, 0.6f); + } + + + @EventHandler + public void Energy(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + if (!cur.isBlocking()) + { + _active.remove(cur); + continue; + } + + //Level + int level = GetLevel(cur); + if (level == 0) + { + _active.remove(cur); + continue; + } + + if (!Factory.Energy().Use(cur, GetName(), 2 - (level * 0.1), true, true)) + { + _active.remove(cur); + continue; + } + + //Effect + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, 42); + + //Pull + for (int i=0 ; i<=4 + (2*level) ; i++) + Pull(cur, cur.getEyeLocation().add(cur.getLocation().getDirection().multiply(i))); + } + } + + public void Pull(Player player, Location loc) + { + for (Entity other : player.getWorld().getEntities()) + { + if (!(other instanceof LivingEntity) && !(other instanceof Item)) + continue; + + if (player.equals(other)) + continue; + + if (UtilMath.offset(player, other) < 2 || UtilMath.offset(loc, other.getLocation()) > 2 + ((GetLevel(player) * 0.5))) + continue; + + if (other instanceof Player) + { + if (!Factory.Relation().CanHurt(player, (Player)other)) + continue; + } + + UtilAction.velocity(other, UtilAlg.getTrajectory2d(other, player), + 0.2, false, 0, 0, 1, true); + } + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticPull.java.orig b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticPull.java.orig new file mode 100644 index 000000000..c03db462e --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticPull.java.orig @@ -0,0 +1,142 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Golem; + +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class MagneticPull extends SkillActive +{ + private HashSet _active = new HashSet(); + + public MagneticPull(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + } + + @Override + public String GetEnergyString() + { + return "Energy: 16 per Second"; + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + _active.add(player); + + player.getWorld().playSound(player.getLocation(), Sound.IRONGOLEM_DEATH, 0.6f, 0.6f); + } + + + @EventHandler + public void Energy(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + if (!cur.isBlocking()) + { + _active.remove(cur); + continue; + } + + //Level + int level = GetLevel(cur); + if (level == 0) + { + _active.remove(cur); + continue; + } + + if (!Factory.Energy().use(cur, GetName(), 2 - (level * 0.1), true, true)) + { + _active.remove(cur); + continue; + } + + //Effect + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, 42); + + //Pull + for (int i=0 ; i<=4 + (2*level) ; i++) + Pull(cur, cur.getEyeLocation().add(cur.getLocation().getDirection().multiply(i))); + } + } + + public void Pull(Player player, Location loc) + { + for (Entity other : player.getWorld().getEntities()) + { + if (!(other instanceof LivingEntity) && !(other instanceof Item)) + continue; + + if (player.equals(other)) + continue; + + if (UtilMath.offset(player, other) < 2 || UtilMath.offset(loc, other.getLocation()) > 2 + ((GetLevel(player) * 0.5))) + continue; + + if (other instanceof Player) + { + if (!Factory.Relation().CanHurt(player, (Player)other)) + continue; + } + + UtilAction.velocity(other, UtilAlg.getTrajectory2d(other, player), + 0.2, false, 0, 0, 1, true); + } + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticRepel.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticRepel.java new file mode 100644 index 000000000..e4d0c8293 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Golem/MagneticRepel.java @@ -0,0 +1,98 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Golem; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.block.Action; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class MagneticRepel extends SkillActive +{ + public MagneticRepel(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Repel + for (Entity other : player.getWorld().getEntities()) + { + if (!(other instanceof LivingEntity)) + continue; + + if (player.equals(other)) + continue; + + double offset = UtilMath.offset(player, other); + double maxOffset = 6 + (level * 2); + + if (offset > maxOffset) + continue; + + if (other instanceof Player) + { + if (!Factory.Relation().CanHurt(player, (Player)other)) + continue; + } + + double power = 0.5 + (0.5 *((maxOffset - offset) / maxOffset)); + + Vector vel = UtilAlg.getTrajectory(player, other); + vel.setY(Math.min(0.3, vel.getY())); + vel.normalize(); + + UtilAction.velocity(other, vel, + power * (2 + (level * 0.5)), false, 0, 0.8, 0.8, true); + } + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + + //Sound + for (int i=0 ; i<3 ; i++) + player.getWorld().playSound(player.getLocation(), Sound.FIZZ, 2f, 0.6f); + + player.getWorld().playSound(player.getLocation(), Sound.IRONGOLEM_DEATH, 2f, 2f); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Needler.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Needler.java new file mode 100644 index 000000000..4350ac128 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Needler.java @@ -0,0 +1,211 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Spider; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Needler extends SkillActive +{ + private HashMap _stored = new HashMap(); + private HashMap _fired = new HashMap(); + + private HashSet _arrows = new HashSet(); + + private boolean _tick = false; + + public Needler(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + return true; + } + + @Override + public void Skill(Player player, int level) + { + + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + _tick = !_tick; + + if (_tick) + return; + + for (Player cur : GetUsers()) + { + if (!cur.isBlocking()) + continue; + + //Level + int level = GetLevel(cur); + if (level == 0) + continue; + //Water + if (cur.getLocation().getBlock().isLiquid()) + { + UtilPlayer.message(cur, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in liquids.")); + continue; + } + + //Use Charge + if (!UseCharge(cur)) + continue; + + //Use Energy + Factory.Energy().Use(cur, GetName(), 3 - (0.2 * level), true, false); + + Arrow arrow = cur.getWorld().spawnArrow(cur.getEyeLocation().add(cur.getLocation().getDirection()), + cur.getLocation().getDirection(), 1.6f + (level * 0.4f), 2); + arrow.setShooter(cur); + _arrows.add(arrow); + + //Set Fired + _fired.put(cur, System.currentTimeMillis()); + + //Sound + cur.getWorld().playSound(cur.getLocation(), Sound.SPIDER_IDLE, 0.8f, 2f); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void Damage(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Projectile projectile = event.GetProjectile(); + if (projectile == null) return; + + if (!_arrows.remove(projectile)) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + event.SetCancelled(GetName()); + + //Damage Event + Factory.Damage().NewDamageEvent(damagee, damager, null, + DamageCause.THORNS, 2, true, true, false, + damager.getName(), GetName()); + + Factory.Condition().Factory().Poison(GetName(), damagee, damager, 2, 0, false, true); + } + + public boolean UseCharge(Player player) + { + if (!_stored.containsKey(player)) + return false; + + int charges = _stored.get(player); + + if (charges <= 0) + return false; + + _stored.put(player, charges-1); + player.setLevel(charges-1); + + return true; + } + + @EventHandler + public void Recharge(UpdateEvent event) + { + for (Player cur : GetUsers()) + if (!_stored.containsKey(cur)) + { + _stored.put(cur, 0); + } + else + { + //Dont recharge while firing + if (_fired.containsKey(cur)) + if (!UtilTime.elapsed(_fired.get(cur), 1000 - (GetLevel(cur) * 50))) + continue; + + int charges = _stored.get(cur); + + if (charges >= 3 + (1 * GetLevel(cur))) + continue; + + if (!Recharge.Instance.use(cur, GetName() + " Recharge", 100 - (GetLevel(cur) * 10), false)) + continue; + + charges += 1; + + _stored.put(cur, charges); + + cur.setLevel(charges); + } + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Arrow arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid() || arrow.getTicksLived() > 300) + { + arrowIterator.remove(); + arrow.remove(); + } + } + } + + @Override + public void Reset(Player player) + { + _stored.remove(player); + _fired.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Needler.java.orig b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Needler.java.orig new file mode 100644 index 000000000..539bfb439 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Needler.java.orig @@ -0,0 +1,211 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Spider; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Needler extends SkillActive +{ + private HashMap _stored = new HashMap(); + private HashMap _fired = new HashMap(); + + private HashSet _arrows = new HashSet(); + + private boolean _tick = false; + + public Needler(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + return true; + } + + @Override + public void Skill(Player player, int level) + { + + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + _tick = !_tick; + + if (_tick) + return; + + for (Player cur : GetUsers()) + { + if (!cur.isBlocking()) + continue; + + //Level + int level = GetLevel(cur); + if (level == 0) + continue; + //Water + if (cur.getLocation().getBlock().isLiquid()) + { + UtilPlayer.message(cur, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in liquids.")); + continue; + } + + //Use Charge + if (!UseCharge(cur)) + continue; + + //Use Energy + Factory.Energy().use(cur, GetName(), 3 - (0.2 * level), true, false); + + Arrow arrow = cur.getWorld().spawnArrow(cur.getEyeLocation().add(cur.getLocation().getDirection()), + cur.getLocation().getDirection(), 1.6f + (level * 0.4f), 2); + arrow.setShooter(cur); + _arrows.add(arrow); + + //Set Fired + _fired.put(cur, System.currentTimeMillis()); + + //Sound + cur.getWorld().playSound(cur.getLocation(), Sound.SPIDER_IDLE, 0.8f, 2f); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void Damage(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Projectile projectile = event.GetProjectile(); + if (projectile == null) return; + + if (!_arrows.remove(projectile)) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + event.SetCancelled(GetName()); + + //Damage Event + Factory.Damage().NewDamageEvent(damagee, damager, null, + DamageCause.THORNS, 2, true, true, false, + damager.getName(), GetName()); + + Factory.Condition().Factory().Poison(GetName(), damagee, damager, 2, 0, false, true); + } + + public boolean UseCharge(Player player) + { + if (!_stored.containsKey(player)) + return false; + + int charges = _stored.get(player); + + if (charges <= 0) + return false; + + _stored.put(player, charges-1); + player.setLevel(charges-1); + + return true; + } + + @EventHandler + public void Recharge(UpdateEvent event) + { + for (Player cur : GetUsers()) + if (!_stored.containsKey(cur)) + { + _stored.put(cur, 0); + } + else + { + //Dont recharge while firing + if (_fired.containsKey(cur)) + if (!UtilTime.elapsed(_fired.get(cur), 1000 - (GetLevel(cur) * 50))) + continue; + + int charges = _stored.get(cur); + + if (charges >= 3 + (1 * GetLevel(cur))) + continue; + + if (!Recharge.Instance.use(cur, GetName() + " Recharge", 100 - (GetLevel(cur) * 10), false)) + continue; + + charges += 1; + + _stored.put(cur, charges); + + cur.setLevel(charges); + } + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Arrow arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid() || arrow.getTicksLived() > 300) + { + arrowIterator.remove(); + arrow.remove(); + } + } + } + + @Override + public void Reset(Player player) + { + _stored.remove(player); + _fired.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Pounce.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Pounce.java new file mode 100644 index 000000000..8cfeab584 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/Pounce.java @@ -0,0 +1,89 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Spider; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Pounce extends SkillActive +{ + public Pounce(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + return true; + } + + @EventHandler(priority = EventPriority.LOW) + public void EndDamager(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + int level = GetLevel(damager); + if (level == 0) return; + + event.SetCancelled(GetName()); + + Skill(damager, level); + } + + @Override + public void Skill(Player player, int level) + { + if (player.getLocation().getBlock().isLiquid()) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in liquids.")); + return; + } + + if (UtilTime.elapsed(Factory.Movement().Get(player).LastGrounded, 1000)) + { + UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill(GetName()) + " while airborne.")); + } + + //Action + UtilAction.velocity(player, 0.7 + (0.1 * level), 0.2, 0.8, true); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.SPIDER_DEATH, 0.5f, 2f); + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/SpiderForm.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/SpiderForm.java new file mode 100644 index 000000000..29bc76b73 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/SpiderForm.java @@ -0,0 +1,66 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Spider; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.FormBase; + +import org.bukkit.ChatColor; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class SpiderForm extends FormBase +{ + public SpiderForm(SkillFactory skills, String name, ClassType classType, + SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels, + EntityType.SPIDER, new String[] + { + "Venomous Spines", + "Spin Web", + "Pounce" + }); + + SetDesc(new String[] + { + ChatColor.WHITE + "Passives:", + "* Slow II", + "", + "", + ChatColor.WHITE + "Attack: " + ChatColor.GREEN + "Pounce", + "Pounce with 0.7 + 0.1pL Velocity", + "", + "", + ChatColor.WHITE + "Sword Skill: " + ChatColor.GREEN + "Needler", + "Spit out a flurry of needles;", + "* Capacity of 3 + 1pL", + "", + "", + ChatColor.WHITE + "Axe Skill: " + ChatColor.GREEN + "Spin Web", + "Spin a temporary web;", + "* Lasts 5 + 1pL seconds" + }); + } + + @Override + public void UnapplyMorph(Player player) + { + Factory.Condition().EndCondition(player, null, GetName()); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : GetMorphedUsers()) + { + Factory.Condition().Factory().Protection(GetName(), cur, cur, 1.9, 0, false, false); + Factory.Condition().Factory().Slow(GetName(), cur, cur, 1.9, 0, false, false, false); + } + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/SpinWeb.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/SpinWeb.java new file mode 100644 index 000000000..ccc5f54ff --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Spider/SpinWeb.java @@ -0,0 +1,110 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Spider; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class SpinWeb extends SkillActive +{ + public SpinWeb(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + } + + @Override + @EventHandler(priority = EventPriority.LOW) + public void Interact(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + //Check Block + if (UtilBlock.usable(event.getClickedBlock())) + return; + + //Check Action + if (!_actionSet.contains(event.getAction())) + return; + + //Check Material + if (!_itemSet.contains(player.getItemInHand().getType())) + return; + + //Level + int level = GetLevel(player); + if (level <= 0) return; + + if (!CustomCheck(player, level)) + return; + + //Unique Weapon + if (player.getItemInHand().getEnchantments().containsKey(Enchantment.ARROW_DAMAGE)) + return; + + //Block + Block block = event.getClickedBlock(); + if (block == null) return; + + block = block.getRelative(event.getBlockFace()); + + //Check Energy + if (!Factory.Energy().Use(player, GetName(), 20 - (level * 2), true, true)) + return; + + //Block + Factory.BlockRestore().Add(block, 30, (byte)0, 5000 + (1000 * level)); + + //Effect + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 30); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 1f, 0.3f); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/Construction.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/Construction.java new file mode 100644 index 000000000..f47133a0e --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/Construction.java @@ -0,0 +1,119 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Squid; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.UtilBlock; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Construction extends SkillActive +{ + public Construction(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + } + + @Override + @EventHandler(priority = EventPriority.LOW) + public void Interact(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + //Check Block + if (UtilBlock.usable(event.getClickedBlock())) + return; + + //Check Action + if (!_actionSet.contains(event.getAction())) + return; + + //Check Material + if (!_itemSet.contains(player.getItemInHand().getType())) + return; + + //Level + int level = GetLevel(player); + if (level <= 0) return; + + if (!CustomCheck(player, level)) + return; + + //Unique Weapon + if (player.getItemInHand().getEnchantments().containsKey(Enchantment.ARROW_DAMAGE)) + return; + + //Block + Block block = event.getClickedBlock(); + if (block == null) return; + + if (event.getAction() == Action.RIGHT_CLICK_BLOCK) + block = block.getRelative(event.getBlockFace()); + + if (block.getTypeId() != 8 && block.getTypeId() != 9 && event.getAction() == Action.RIGHT_CLICK_BLOCK) + return; + + if (block.getTypeId() != 79 && event.getAction() == Action.LEFT_CLICK_BLOCK) + return; + + //Check Energy + if (!Factory.Energy().Use(player, GetName(), 12 - (level * 2), true, true)) + return; + + //Block + if (block.getTypeId() == 79) + { + block.setTypeId(8); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 0.5f, 0.5f); + } + else + { + block.setTypeId(79); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.ORB_PICKUP, 0.5f, 3f); + } + + //Effect + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 80); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + return true; + } + + @Override + public void Skill(Player player, int level) + { + + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/Propel.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/Propel.java new file mode 100644 index 000000000..5f4567bf3 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/Propel.java @@ -0,0 +1,118 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Squid; + +import java.util.HashMap; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Propel extends SkillActive +{ + private HashMap _active = new HashMap(); + + public Propel(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "" + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (!player.getLocation().getBlock().isLiquid()) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " out of water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Velocity + UtilAction.velocity(player, 0.6 + (0.2 * level), 0.2, 2, false); + + //Store + _active.put(player, System.currentTimeMillis()); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.SPLASH2, 1.5f, 1.5f); + } + + @EventHandler + public void Reuse(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!_active.containsKey(cur)) + continue; + + if (!cur.isBlocking()) + { + _active.remove(cur); + continue; + } + + //Level + int level = GetLevel(cur); + if (level == 0) + { + _active.remove(cur); + continue; + } + + //Time + if (!UtilTime.elapsed(_active.get(cur), 400)) + continue; + + if (!cur.getLocation().getBlock().isLiquid()) + continue; + + //Thrust + UtilAction.velocity(cur, 0.3 + (0.1 * level), 0.1, 2, false); + + //Store + _active.put(cur, System.currentTimeMillis()); + + //Sound + cur.getWorld().playSound(cur.getLocation(), Sound.SPLASH2, 0.5f, 1f); + } + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/SquidForm.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/SquidForm.java new file mode 100644 index 000000000..cfd278488 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Squid/SquidForm.java @@ -0,0 +1,115 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Squid; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.FormBase; + +import org.bukkit.ChatColor; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.util.Vector; + +public class SquidForm extends FormBase +{ + public SquidForm(SkillFactory skills, String name, ClassType classType, + SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels, + EntityType.SQUID, new String[] + { + "Propel", + "Ice Construction" + }); + + SetDesc(new String[] + { + ChatColor.WHITE + "Passives:", + "* Unlimited Air", + "* Protection II", + "", + "", + ChatColor.WHITE + "Attack: " + ChatColor.GREEN + "Suffocate", + "* Target has 1.5 second of air removed", + "* Target is pushed downward slightly", + "", + "", + ChatColor.WHITE + "Sword Skill: " + ChatColor.GREEN + "Swim", + "Push Block to thrust forwards;", + "* Velocity of 0.6 + 0.2pL", + "", + "Hold Block to swim;", + "* Velocity of 0.3 + 0.1pL", + "", + "", + ChatColor.WHITE + "Axe Skill: " + ChatColor.GREEN + "Ice Construction", + "Right-Click to freeze water", + "Left-Click to melt ice" + }); + } + + + @EventHandler + public void Unmorph(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : UtilServer.getPlayers()) + { + if (!IsMorphed(cur)) + continue; + + if (UtilEnt.isGrounded(cur) && !cur.getLocation().getBlock().isLiquid()) + Unmorph(cur); + } + } + + @Override + public void UnapplyMorph(Player player) + { + Factory.Condition().EndCondition(player, null, GetName()); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Attack(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!IsMorphed(damager)) + return; + + event.SetKnockback(false); + + //Attack + event.GetDamageeEntity().setRemainingAir(Math.max(0, event.GetDamageeEntity().getRemainingAir() - 30)); + event.GetDamageeEntity().setVelocity(new Vector(0, -0.5, 0)); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : GetMorphedUsers()) + { + cur.setRemainingAir(cur.getMaximumAir()); + Factory.Condition().Factory().Protection(GetName(), cur, cur, 1.9, 1, false, false); + } + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Wolf/WolfForm.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Wolf/WolfForm.java new file mode 100644 index 000000000..2316b09cb --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Forms/Wolf/WolfForm.java @@ -0,0 +1,64 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Wolf; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.FormBase; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class WolfForm extends FormBase +{ + public WolfForm(SkillFactory skills, String name, ClassType classType, + SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels, + EntityType.WOLF, new String[] + { + //skills.GetSkill("Magnetic Pull"), + //skills.GetSkill("Magnetic Repel") + }); + + SetDesc(new String[] + { + "Dire Wolf Form (Harass / Ganking);", + "* Speed I", + "* Protection I", + "* Regeneration I", + "", + "", + "Axe Skill: Howl", + "Nearby allies receive;", + "* Speed III for 3 + 1pL seconds", + "", + "", + "Sword Skill: Bite", + "Hold Block to bite target;", + "* Slow IV for 2 seconds", + "* You are pulled along with target" + }); + } + + @Override + public void UnapplyMorph(Player player) + { + Factory.Condition().EndCondition(player, null, GetName()); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : GetMorphedUsers()) + { + Factory.Condition().Factory().Protection(GetName(), cur, cur, 1.9, 0, false, false); + Factory.Condition().Factory().Speed(GetName(), cur, cur, 1.9, 0, false, false); + Factory.Condition().Factory().Regen(GetName(), cur, cur, 1.9, 0, false, false); + } + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Polysmash.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Polysmash.java new file mode 100644 index 000000000..c508f725b --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Polysmash.java @@ -0,0 +1,146 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEntityEvent; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; + +public class Polysmash extends SkillActive +{ + private HashSet _used = new HashSet(); + + public Polysmash(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Turn target enemy into a sheep", + "for 6 seconds. While in sheep form,", + "players have Slow and Silence." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (_used.contains(player)) + return false; + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You missed " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Miss(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + _used.clear(); + } + + public boolean CanUse(Player player) + { + int level = GetLevel(player); + if (level == 0) + return false; + + //Check Material + if (!_itemSet.contains(player.getItemInHand().getType())) + return false; + + //Check Allowed + SkillTriggerEvent trigger = new SkillTriggerEvent(player, GetName(), GetClassType()); + UtilServer.getServer().getPluginManager().callEvent(trigger); + if (trigger.IsCancelled()) + return false; + + //Check Energy/Recharge + if (!EnergyRechargeCheck(player, level)) + return false; + + //Allow + return true; + } + + @EventHandler + public void Hit(PlayerInteractEntityEvent event) + { + Player player = event.getPlayer(); + + //Level + int level = GetLevel(player); + if (level == 0) return; + + if (!CanUse(player)) + return; + + if (event.getRightClicked() == null) + return; + + if (!(event.getRightClicked() instanceof LivingEntity)) + return; + + LivingEntity ent = (LivingEntity)event.getRightClicked(); + + if (UtilMath.offset(player, ent) > 3) + { + UtilPlayer.message(player, F.main(GetClassType().name(), "You missed " + F.skill(GetName()) + ".")); + return; + } + + //Set Used + _used.add(player); + + //Condition + Factory.Condition().Factory().Slow(GetName(), ent, player, 5, 0, false, true, false); + Factory.Condition().Factory().Silence(GetName(), ent, player, 5, false, true); + + //Effect + ent.getWorld().playSound(ent.getLocation(), Sound.SHEEP_IDLE, 2f, 1f); + ent.getWorld().playSound(ent.getLocation(), Sound.SHEEP_IDLE, 2f, 1f); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName()) + ".")); + UtilPlayer.message(ent, F.main(GetClassType().name(), F.name(player.getName()) + " hit you with " + F.skill(GetName(level)) + ".")); + } + + @Override + public void Reset(Player player) + { + _used.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Shifter.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Shifter.java new file mode 100644 index 000000000..dbc62deaa --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/Shifter.java @@ -0,0 +1,56 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.PlayerInventory; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.classcombat.Skill.Skill; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class Shifter extends Skill +{ + public Shifter(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + super(skills, name, classType, skillType, cost, levels); + + SetDesc(new String[] + { + "Permanent Protection II." + }); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() == UpdateType.FAST) + for (Player cur : GetUsers()) + Factory.Condition().Factory().Protection(GetName(), cur, cur, 1.9, 1, false, false); + + if (event.getType() == UpdateType.SLOWER) + for (Player cur : GetUsers()) + { + PlayerInventory inv = cur.getInventory(); + + if (inv.getHelmet() != null && inv.getHelmet().getDurability() > 0) + inv.getHelmet().setDurability((short) (inv.getHelmet().getDurability()-1)); + + if (inv.getChestplate() != null && inv.getChestplate().getDurability() > 0) + inv.getChestplate().setDurability((short) (inv.getChestplate().getDurability()-1)); + + if (inv.getLeggings() != null && inv.getLeggings().getDurability() > 0) + inv.getLeggings().setDurability((short) (inv.getLeggings().getDurability()-1)); + + if (inv.getBoots() != null && inv.getBoots().getDurability() > 0) + inv.getBoots().setDurability((short) (inv.getBoots().getDurability()-1)); + } + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/TreeShift.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/TreeShift.java new file mode 100644 index 000000000..4fa3fe8ee --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/TreeShift.java @@ -0,0 +1,170 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter; + +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class TreeShift extends SkillActive +{ + private HashMap trees = new HashMap(); + + public TreeShift(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Creates an illusionary tree at target location.", + "Other players cannot attack or see through it.", + "You view it as a sapling, and can attack over it.", + "Lasts 2 + 2pL seconds." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + Block block = player.getTargetBlock(null, 0); + if (UtilMath.offset(block.getLocation().add(0.5, 0.5, 0.5), player.getLocation()) > 8 + level) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " so far away.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + HashMap tree = new HashMap(); + + Block block = player.getTargetBlock(null, 0); + + //Show to Player + final Player fPlayer = player; + final Location fLoc = block.getLocation().add(0, 1, 0); + UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Factory.GetPlugin(), new Runnable() + { + public void run() + { + fPlayer.sendBlockChange(fLoc, 6, (byte)0); + } + }, 0); + + + + //Generate Tree + for (int i=0 ; i<6 ; i++) + { + block = block.getRelative(BlockFace.UP); + + if (block.getTypeId() != 0) + { + block = block.getRelative(BlockFace.DOWN); + break; + } + + tree.put(block.getLocation(), Material.LOG); + } + + if (tree.size() > 5) + { + for (Block leaf : UtilBlock.getInRadius(block.getLocation(), 2.5d).keySet()) + { + if (!tree.containsKey(leaf.getLocation()) && leaf.getTypeId() == 0) + { + tree.put(leaf.getLocation(), Material.LEAVES); + } + } + } + + + //Show Tree + for (Location loc : tree.keySet()) + { + trees.put(loc, System.currentTimeMillis() + (2000 + (2000 * level))); + + for (Player other : player.getWorld().getPlayers()) + { + if (other.equals(player)) + continue; + + other.sendBlockChange(loc, tree.get(loc), (byte)0); + + if (tree.get(loc) == Material.LOG) + other.playEffect(loc, Effect.STEP_SOUND, 17); + } + } + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + } + + @EventHandler + public void Detree(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (trees.isEmpty()) + return; + + HashSet remove = new HashSet(); + + for (Location loc : trees.keySet()) + { + if (System.currentTimeMillis() > trees.get(loc)) + remove.add(loc); + } + + for (Location loc : remove) + { + for (Player player : loc.getWorld().getPlayers()) + player.sendBlockChange(loc, 0, (byte)0); + + trees.remove(loc); + } + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/TreeShiftBlock.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/TreeShiftBlock.java new file mode 100644 index 000000000..a3ee9d864 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Shifter/TreeShiftBlock.java @@ -0,0 +1,5 @@ +package mineplex.minecraft.game.classcombat.Skill.Shifter; + +public class TreeShiftBlock { + +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Skill.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Skill.java new file mode 100644 index 000000000..dfe08cb70 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Skill.java @@ -0,0 +1,199 @@ +package mineplex.minecraft.game.classcombat.Skill; + +import java.util.ArrayList; +import java.util.List; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +public abstract class Skill implements ISkill, Listener +{ + //Properties + private String _name; + private String[] _desc; + private String[] _descFull; + + private ClassType _classType; + private SkillType _skillType; + + private int _salesPackageId; + private int _cost; + + private boolean _free; + private List _users; + + public SkillFactory Factory; + + public Skill(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) + { + Factory = skills; + _name = name; + _desc = new String[] { "" }; + _classType = classType; + _skillType = skillType; + _users = new ArrayList(); + } + + @Override + public String GetName() + { + return _name; + } + + public String GetName(int level) + { + if (level <= 1) + return GetName(); + + return _name + " " + level; + } + + public String GetName(String type) + { + return _name + " (" + type + ")"; + } + + @Override + public Integer GetSalesPackageId() + { + return _salesPackageId; + } + + @Override + public ClassType GetClassType() + { + return _classType; + } + + @Override + public SkillType GetSkillType() + { + return _skillType; + } + + @Override + public int GetCost() + { + return _cost; + } + + public int GetLevel(Entity ent) + { + if (!(ent instanceof Player)) + return 0; + + Player player = (Player)ent; + + if (!_users.contains(player)) + return 0; + + return 1; + } + + @Override + public String[] GetDesc() + { + if (_descFull != null) + return _descFull; + + String recharge = GetRechargeString(); + String energy = GetEnergyString(); + + if (recharge == null && energy == null) + _descFull = _desc; + + ArrayList descFull = new ArrayList(); + + for (String line : _desc) + descFull.add(line); + + if (energy != null || recharge != null) + descFull.add(""); + + if (energy != null) + descFull.add(energy); + + if (recharge != null) + descFull.add(recharge); + + _descFull = new String[descFull.size()]; + for (int i=0 ; i GetUsers() + { + _users.remove(null); + return _users; + } + + @Override + public void AddUser(Player player) + { + _users.add(player); + OnPlayerAdd(player); + } + + public void OnPlayerAdd(Player player) + { + //Null Default + } + + @Override + public void RemoveUser(Player player) + { + _users.remove(player); + Reset(player); + } + + public void SetDesc(String[] desc) + { + _desc = desc; + } + + @EventHandler + public final void Death(PlayerDeathEvent event) + { + Reset(event.getEntity()); + } + + @EventHandler + public final void Quit(PlayerQuitEvent event) + { + Reset(event.getPlayer()); + _users.remove(event.getPlayer()); + } + + @Override + public boolean IsFree() + { + return _free; + } + + public void Update(SkillToken skillToken) + { + _salesPackageId = skillToken.SalesPackage.GameSalesPackageId; + _free = skillToken.SalesPackage.Free; + _cost = skillToken.SalesPackage.Gems; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillActive.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillActive.java new file mode 100644 index 000000000..1c3e30b27 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillActive.java @@ -0,0 +1,164 @@ +package mineplex.minecraft.game.classcombat.Skill; + +import java.util.HashSet; + +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.recharge.Recharge; +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +public abstract class SkillActive extends Skill implements Listener +{ + protected int _energy; + protected int _energyMod; + + protected long _recharge; + protected long _rechargeMod; + protected boolean _rechargeInform; + + protected HashSet _itemSet = new HashSet(); + protected HashSet _actionSet = new HashSet(); + + public SkillActive(SkillFactory skills, + String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, Action[] actionArray) + { + super(skills, name, classType, skillType, cost, levels); + + _energy = energy; + _energyMod = energyMod; + + _recharge = recharge; + _rechargeMod = rechargeMod; + _rechargeInform = rechargeInform; + + for (Material cur : itemArray) + _itemSet.add(cur); + + for (Action cur : actionArray) + _actionSet.add(cur); + } + + public HashSet GetItems() + { + return _itemSet; + } + + public HashSet GetActions() + { + return _actionSet; + } + + @EventHandler(priority = EventPriority.LOW) + public void Interact(PlayerInteractEvent event) + { + SkillCheck(event.getPlayer(), event.getAction(), event.getClickedBlock()); + } + + public boolean SkillCheck(Player player, Action action, Block block) + { + int level = GetLevel(player); + + if (level == 0) + return false; + + //Check Block + if (UtilBlock.usable(block)) + return false; + + //Check Action + if (!_actionSet.contains(action)) + return false; + + //Check Material + if (!_itemSet.contains(player.getItemInHand().getType())) + return false; + + //Unique Weapon + if (player.getItemInHand().getEnchantments().containsKey(Enchantment.ARROW_DAMAGE)) + return false; + + //Check Allowed + SkillTriggerEvent event = new SkillTriggerEvent(player, GetName(), GetClassType()); + Bukkit.getServer().getPluginManager().callEvent(event); + + if (event.IsCancelled()) + return false; + + //Custom Check + if (!CustomCheck(player, level)) + return false; + + //Check Energy/Recharge + if (!EnergyRechargeCheck(player, level)) + return false; + + //Do Ability + Skill(player, level); + return true; + } + + public abstract boolean CustomCheck(Player player, int level); + + public abstract void Skill(Player player, int level); + + public boolean EnergyRechargeCheck(Player player, int level) + { + //Check Energy - DO NOT USE YET + if (!Factory.Energy().Use(player, GetName(level), Energy(level), false, true)) + return false; + + //Use Recharge + if (!Recharge.Instance.use(player, GetName(), GetName(level), Recharge(level), _rechargeInform)) + return false; + + //Use Energy + Factory.Energy().Use(player, GetName(level), Energy(level), true, true); + + return true; + } + + public int Energy(int level) + { + return _energy + (_energyMod*level); + } + + public long Recharge(int level) + { + return _recharge + (_rechargeMod*level); + } + + @Override + public String GetEnergyString() + { + if (_energyMod != 0) + return "Energy: " + _energy + " - " + (-1 * _energyMod) + "pL"; + else + return "Energy: " + _energy; + } + + @Override + public String GetRechargeString() + { + if (_rechargeMod != 0) + return "Recharge: " + UtilMath.trim(1, _recharge/1000d) + " - " + UtilMath.trim(1, -1 * (_rechargeMod/1000d)) + "pL Seconds"; + + else + return "Recharge: " + UtilMath.trim(1, _recharge/1000d) + " Seconds"; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java new file mode 100644 index 000000000..d82d37b7b --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java @@ -0,0 +1,898 @@ +package mineplex.minecraft.game.classcombat.Skill; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; + +import mineplex.core.MiniPlugin; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.donation.repository.GameSalesPackageToken; +import mineplex.core.energy.Energy; +import mineplex.core.movement.Movement; +import mineplex.core.projectile.ProjectileManager; +import mineplex.core.teleport.Teleport; +import mineplex.minecraft.game.classcombat.Class.IPvpClass; +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.Skill.ISkill.SkillType; +import mineplex.minecraft.game.classcombat.Skill.Brute.*; +import mineplex.minecraft.game.classcombat.Skill.Assassin.Assassin; +import mineplex.minecraft.game.classcombat.Skill.Assassin.BackStab; +import mineplex.minecraft.game.classcombat.Skill.Assassin.Blink; +import mineplex.minecraft.game.classcombat.Skill.Assassin.Evade; +import mineplex.minecraft.game.classcombat.Skill.Assassin.Flash; +import mineplex.minecraft.game.classcombat.Skill.Assassin.Leap; +import mineplex.minecraft.game.classcombat.Skill.Assassin.MarkedForDeath; +import mineplex.minecraft.game.classcombat.Skill.Assassin.Recall; +import mineplex.minecraft.game.classcombat.Skill.Assassin.RepeatedStrikes; +import mineplex.minecraft.game.classcombat.Skill.Assassin.ShockingStrikes; +import mineplex.minecraft.game.classcombat.Skill.Assassin.SilencingArrow; +import mineplex.minecraft.game.classcombat.Skill.Assassin.SmokeBomb; +import mineplex.minecraft.game.classcombat.Skill.Assassin.Stealth; +import mineplex.minecraft.game.classcombat.Skill.Assassin.ToxicArrow; +import mineplex.minecraft.game.classcombat.Skill.Assassin.WoundingStrikes; +import mineplex.minecraft.game.classcombat.Skill.Brute.BlockToss; +import mineplex.minecraft.game.classcombat.Skill.Brute.Bloodlust; +import mineplex.minecraft.game.classcombat.Skill.Brute.Brute; +import mineplex.minecraft.game.classcombat.Skill.Brute.Colossus; +import mineplex.minecraft.game.classcombat.Skill.Brute.CripplingBlow; +import mineplex.minecraft.game.classcombat.Skill.Brute.DwarfToss; +import mineplex.minecraft.game.classcombat.Skill.Brute.FleshHook; +import mineplex.minecraft.game.classcombat.Skill.Brute.Intimidation; +import mineplex.minecraft.game.classcombat.Skill.Brute.Overwhelm; +import mineplex.minecraft.game.classcombat.Skill.Brute.SeismicSlam; +import mineplex.minecraft.game.classcombat.Skill.Brute.Stampede; +import mineplex.minecraft.game.classcombat.Skill.Brute.Takedown; +import mineplex.minecraft.game.classcombat.Skill.Global.BreakFall; +import mineplex.minecraft.game.classcombat.Skill.Global.Fitness; +import mineplex.minecraft.game.classcombat.Skill.Global.QuickRecovery; +import mineplex.minecraft.game.classcombat.Skill.Global.Rations; +import mineplex.minecraft.game.classcombat.Skill.Global.Recharge; +import mineplex.minecraft.game.classcombat.Skill.Global.Resistance; +import mineplex.minecraft.game.classcombat.Skill.Global.Stamina; +import mineplex.minecraft.game.classcombat.Skill.Global.Swim; +import mineplex.minecraft.game.classcombat.Skill.Knight.BullsCharge; +import mineplex.minecraft.game.classcombat.Skill.Knight.Cleave; +import mineplex.minecraft.game.classcombat.Skill.Knight.DefensiveStance; +import mineplex.minecraft.game.classcombat.Skill.Knight.Deflection; +import mineplex.minecraft.game.classcombat.Skill.Knight.Fortitude; +import mineplex.minecraft.game.classcombat.Skill.Knight.HiltSmash; +import mineplex.minecraft.game.classcombat.Skill.Knight.HoldPosition; +import mineplex.minecraft.game.classcombat.Skill.Knight.Knight; +import mineplex.minecraft.game.classcombat.Skill.Knight.LevelField; +import mineplex.minecraft.game.classcombat.Skill.Knight.PowerChop; +import mineplex.minecraft.game.classcombat.Skill.Knight.Riposte; +import mineplex.minecraft.game.classcombat.Skill.Knight.Swordsmanship; +import mineplex.minecraft.game.classcombat.Skill.Knight.Vengeance; +import mineplex.minecraft.game.classcombat.Skill.Mage.ArcticArmor; +import mineplex.minecraft.game.classcombat.Skill.Mage.Blizzard; +import mineplex.minecraft.game.classcombat.Skill.Mage.FireBlast; +import mineplex.minecraft.game.classcombat.Skill.Mage.Fissure; +import mineplex.minecraft.game.classcombat.Skill.Mage.FreezingBlast; +import mineplex.minecraft.game.classcombat.Skill.Mage.GlacialBlade; +import mineplex.minecraft.game.classcombat.Skill.Mage.Immolate; +import mineplex.minecraft.game.classcombat.Skill.Mage.Inferno; +import mineplex.minecraft.game.classcombat.Skill.Mage.LifeBonds; +import mineplex.minecraft.game.classcombat.Skill.Mage.LightningOrb; +import mineplex.minecraft.game.classcombat.Skill.Mage.Mage; +import mineplex.minecraft.game.classcombat.Skill.Mage.MagmaBlade; +import mineplex.minecraft.game.classcombat.Skill.Mage.NullBlade; +import mineplex.minecraft.game.classcombat.Skill.Mage.RootingAxe; +import mineplex.minecraft.game.classcombat.Skill.Mage.Rupture; +import mineplex.minecraft.game.classcombat.Skill.Mage.Void; +import mineplex.minecraft.game.classcombat.Skill.Ranger.Agility; +import mineplex.minecraft.game.classcombat.Skill.Ranger.BarbedArrows; +import mineplex.minecraft.game.classcombat.Skill.Ranger.Barrage; +import mineplex.minecraft.game.classcombat.Skill.Ranger.Disengage; +import mineplex.minecraft.game.classcombat.Skill.Ranger.Fletcher; +import mineplex.minecraft.game.classcombat.Skill.Ranger.HealingShot; +import mineplex.minecraft.game.classcombat.Skill.Ranger.HeavyArrows; +import mineplex.minecraft.game.classcombat.Skill.Ranger.IncendiaryShot; +import mineplex.minecraft.game.classcombat.Skill.Ranger.Longshot; +import mineplex.minecraft.game.classcombat.Skill.Ranger.NapalmShot; +import mineplex.minecraft.game.classcombat.Skill.Ranger.Overcharge; +import mineplex.minecraft.game.classcombat.Skill.Ranger.PinDown; +import mineplex.minecraft.game.classcombat.Skill.Ranger.Ranger; +import mineplex.minecraft.game.classcombat.Skill.Ranger.RopedArrow; +import mineplex.minecraft.game.classcombat.Skill.Ranger.Shadowmeld; +import mineplex.minecraft.game.classcombat.Skill.Ranger.Sharpshooter; +import mineplex.minecraft.game.classcombat.Skill.Ranger.VitalitySpores; +import mineplex.minecraft.game.classcombat.Skill.Ranger.WolfsFury; +import mineplex.minecraft.game.classcombat.Skill.Ranger.WolfsPounce; +import mineplex.minecraft.game.classcombat.Skill.Shifter.*; +import mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Chicken.ChickenForm; +import mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Chicken.Flap; +import mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Golem.GolemForm; +import mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Golem.MagneticPull; +import mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Golem.MagneticRepel; +import mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Spider.Needler; +import mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Spider.Pounce; +import mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Spider.SpiderForm; +import mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Spider.SpinWeb; +import mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Squid.Construction; +import mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Squid.Propel; +import mineplex.minecraft.game.classcombat.Skill.Shifter.Forms.Squid.SquidForm; +import mineplex.minecraft.game.classcombat.Skill.repository.SkillRepository; +import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken; +import mineplex.minecraft.game.core.IRelation; +import mineplex.minecraft.game.core.combat.CombatManager; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.damage.DamageManager; +import mineplex.minecraft.game.core.fire.Fire; + +import org.bukkit.Material; +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.Action; +import org.bukkit.plugin.java.JavaPlugin; + +public class SkillFactory extends MiniPlugin implements ISkillFactory +{ + private DamageManager _damageManager; + private IRelation _relation; + private CombatManager _combatManager; + private ConditionManager _conditionManager; + private ProjectileManager _projectileManager; + private BlockRestore _blockRestore; + private Fire _fire; + private Movement _movement; + private Teleport _teleport; + private Energy _energy; + private SkillRepository _repository; + private HashMap _skillMap; + private HashMap _skillSalesPackageMap; + + public SkillFactory(JavaPlugin plugin, DamageManager damageManager, IRelation relation, + CombatManager combatManager, ConditionManager conditionManager, ProjectileManager projectileManager, + BlockRestore blockRestore, Fire fire, Movement movement, Teleport teleport, Energy energy, String webAddress) + { + super("Skill Factory", plugin); + + _repository = new SkillRepository(webAddress); + _damageManager = damageManager; + _relation = relation; + _combatManager = combatManager; + _conditionManager = conditionManager; + _projectileManager = projectileManager; + _blockRestore = blockRestore; + _fire = fire; + _movement = movement; + _teleport = teleport; + _energy = energy; + _skillMap = new HashMap(); + _skillSalesPackageMap = new HashMap(); + + PopulateSkills(); + } + + public ConditionManager Condition() + { + return _conditionManager; + } + + public Teleport Teleport() + { + return _teleport; + } + + public Energy Energy() + { + return _energy; + } + + private void PopulateSkills() + { + _skillMap.clear(); + + AddAssassin(); + AddBrute(); + AddKnight(); + AddMage(); + AddRanger(); + //AddShifter(); + AddGlobal(); + + for (Skill skill : _skillMap.values()) + GetPlugin().getServer().getPluginManager().registerEvents(skill, GetPlugin()); + + List skillTokens = new ArrayList(); + + for (Skill skill : _skillMap.values()) + { + for (int i=0; i < 1; i++) + { + SkillToken skillToken = new SkillToken(); + + skillToken.Name = skill.GetName(); + skillToken.Level = i + 1; + skillToken.SalesPackage = new GameSalesPackageToken(); + skillToken.SalesPackage.Gems = 1200; + + skillTokens.add(skillToken); + } + } + + for (SkillToken skillToken : _repository.GetSkills(skillTokens)) + { + if (_skillMap.containsKey(skillToken.Name)) + { + Skill skill = _skillMap.get(skillToken.Name); + _skillSalesPackageMap.put(skillToken.SalesPackage.GameSalesPackageId, skill); + _skillMap.get(skillToken.Name).Update(skillToken); + } + } + } + + public void AddGlobal() + { + //Passive C + AddSkill(new BreakFall(this, "Break Fall", ClassType.Global, SkillType.GlobalPassive, 1, 1)); + AddSkill(new Fitness(this, "Fitness", ClassType.Global, SkillType.GlobalPassive, 1, 1)); + AddSkill(new Stamina(this, "Stamina", ClassType.Global, SkillType.GlobalPassive, 1, 1)); + AddSkill(new Recharge(this, "Recharge", ClassType.Global, SkillType.GlobalPassive, 1, 1)); + AddSkill(new Resistance(this, "Resistance", ClassType.Global, SkillType.GlobalPassive, 1, 1)); + AddSkill(new QuickRecovery(this, "Quick Recovery", ClassType.Global, SkillType.GlobalPassive, 1, 1)); + AddSkill(new Swim(this, "Swim", ClassType.Global, SkillType.GlobalPassive, 1, 1)); + AddSkill(new Rations(this, "Rations", ClassType.Global, SkillType.GlobalPassive, 1, 1)); + } + + public void AddAssassin() + { + AddSkill(new Assassin(this, "Assassin Class", ClassType.Assassin, SkillType.Class, 0, 1)); + + //Sword + AddSkill(new Evade(this, "Evade", ClassType.Assassin, SkillType.Sword, + 0, 1, + 20, 0, + 0, 0, true, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + //Axe + AddSkill(new Blink(this, "Blink", ClassType.Assassin, SkillType.Axe, + 0, 1, + 40, 0, + 24000, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new Flash(this, "Flash", ClassType.Assassin, SkillType.Axe, + 0, 1, + 20, 0, + 0, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new Leap(this, "Leap", ClassType.Assassin, SkillType.Axe, + 0, 1, + 20, 0, + 6000, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + //Bow + AddSkill(new MarkedForDeath(this, "Marked for Death", ClassType.Assassin, SkillType.Bow, + 0, 1, + 40, 0, + 15000, 0, true, + new Material[] {Material.BOW}, + new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); + + AddSkill(new ToxicArrow(this, "Toxic Arrow", ClassType.Assassin, SkillType.Bow, + 0, 1, + 40, 0, + 15000, 0, true, + new Material[] {Material.BOW}, + new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); + + AddSkill(new SilencingArrow(this, "Silencing Arrow", ClassType.Assassin, SkillType.Bow, + 0, 1, + 40, 0, + 15000, 0, true, + new Material[] {Material.BOW}, + new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); + + + //Passive A + AddSkill(new SmokeBomb(this, "Smoke Bomb", ClassType.Assassin, SkillType.PassiveA, 0, 1)); + AddSkill(new Stealth(this, "Stealth", ClassType.Assassin, SkillType.PassiveA, 0, 1)); + AddSkill(new Recall(this, "Recall", ClassType.Assassin, SkillType.PassiveA, 0, 1)); + + //Passive B + AddSkill(new ShockingStrikes(this, "Shocking Strikes", ClassType.Assassin, SkillType.PassiveB, 0, 1)); + AddSkill(new RepeatedStrikes(this, "Repeated Strikes", ClassType.Assassin, SkillType.PassiveB, 0, 1)); + AddSkill(new WoundingStrikes(this, "Wounding Strikes", ClassType.Assassin, SkillType.PassiveB, 0, 1)); + AddSkill(new BackStab(this, "Backstab", ClassType.Assassin, SkillType.PassiveB, 0, 1)); + } + + public void AddBrute() + { + AddSkill(new Brute(this, "Brute Class", ClassType.Brute, SkillType.Class, 0, 1)); + + + //Sword + AddSkill(new DwarfToss(this, "Dwarf Toss", ClassType.Brute, SkillType.Sword, + 0, 1, + 20, 0, + 20000, 0, true, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new FleshHook(this, "Flesh Hook", ClassType.Brute, SkillType.Sword, + 10, 5, + 20, 0, + 10000, 0, true, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new BlockToss(this, "Block Toss", ClassType.Brute, SkillType.Sword, 10, 5)); + + + //Axe + AddSkill(new SeismicSlam(this, "Seismic Slam", ClassType.Brute, SkillType.Axe, + 0, 1, + 40, 0, + 30000, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new Rampage(this, "Rampage", ClassType.Brute, SkillType.Axe, + 10, 5, + 60, 0, + 30000, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new Takedown(this, "Takedown", ClassType.Brute, SkillType.Axe, + 10, 5, + 60, 0, + 30000, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + + //Passive A + AddSkill(new Stampede(this, "Stampede", ClassType.Brute, SkillType.PassiveA, 0, 1)); + AddSkill(new Bloodlust(this, "Bloodlust", ClassType.Brute, SkillType.PassiveA, 0, 1)); + AddSkill(new Intimidation(this, "Intimidation", ClassType.Brute, SkillType.PassiveA, 0, 1)); + + //Passive B + AddSkill(new CripplingBlow(this, "Crippling Blow", ClassType.Brute, SkillType.PassiveB, 0, 1)); + AddSkill(new Colossus(this, "Colossus", ClassType.Brute, SkillType.PassiveB, 0, 1)); + AddSkill(new Overwhelm(this, "Overwhelm", ClassType.Brute, SkillType.PassiveB, 0, 1)); + } + + public void AddKnight() + { + AddSkill(new Knight(this, "Knight Class", ClassType.Knight, SkillType.Class, 0, 1)); + + //Sword + AddSkill(new HiltSmash(this, "Hilt Smash", ClassType.Knight, SkillType.Sword, + 0, 1, + 30, 0, + 10000, 0, true, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new Riposte(this, "Riposte", ClassType.Knight, SkillType.Sword, + 0, 1, + 40, 0, + 4000, 0, false, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new DefensiveStance(this, "Defensive Stance", ClassType.Knight, SkillType.Sword, + 0, 1, + 0, 0, + 0, 0, true, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + + //Axe + AddSkill(new BullsCharge(this, "Bulls Charge", ClassType.Knight, SkillType.Axe, + 0, 1, + 40, 0, + 10000, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new HoldPosition(this, "Hold Position", ClassType.Knight, SkillType.Axe, + 0, 1, + 60, 0, + 30000, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new PowerChop(this, "Power Chop", ClassType.Knight, SkillType.Axe, + 0, 1, + 12, 0, + 0, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + + //Passive A + AddSkill(new Cleave(this, "Cleave", ClassType.Knight, SkillType.PassiveA, 0, 1)); + AddSkill(new Swordsmanship(this, "Swordsmanship", ClassType.Knight, SkillType.PassiveA, 0, 1)); + AddSkill(new Deflection(this, "Deflection", ClassType.Knight, SkillType.PassiveA, 0, 1)); + + //Passive B + AddSkill(new Vengeance(this, "Vengeance", ClassType.Knight, SkillType.PassiveB, 0, 1)); + AddSkill(new Fortitude(this, "Fortitude", ClassType.Knight, SkillType.PassiveB, 0, 1)); + AddSkill(new LevelField(this, "Level Field", ClassType.Knight, SkillType.PassiveB, 0, 1)); + } + + public void AddMage() + { + AddSkill(new Mage(this, "Mage Class", ClassType.Mage, SkillType.Class, 0, 1)); + + //Sword + AddSkill(new Blizzard(this, "Blizzard", ClassType.Mage, SkillType.Sword, + 0, 1, + 0, 0, + 0, 0, true, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + /* + AddSkill(new Magnetize(this, "Magnetize", ClassType.Mage, SkillType.Sword, + 0, 1, + 0, 0, + 0, 0, true, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + */ + AddSkill(new Inferno(this, "Inferno", ClassType.Mage, SkillType.Sword, + 0, 1, + 0, 0, + 0, 0, true, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new Rupture(this, "Rupture", ClassType.Mage, SkillType.Sword, + 0, 1, + 20, 0, + 0, 0, true, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + //Axe + AddSkill(new FireBlast(this, "Fire Blast", ClassType.Mage, SkillType.Axe, + 0, 1, + 40, 0, + 15000, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new LightningOrb(this, "Lightning Orb", ClassType.Mage, SkillType.Axe, + 0, 1, + 40, 0, + 20000, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new FreezingBlast(this, "Freezing Blast", ClassType.Mage, SkillType.Axe, + 0, 1, + 40, 0, + 20000, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new Fissure(this, "Fissure", ClassType.Mage, SkillType.Axe, + 0, 1, + 40, 0, + 20000, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + // AddSkill(new Tundra(this, "Tundra", ClassType.Mage, SkillType.Axe, 830, 200, 1)); + + + //Passive A + AddSkill(new ArcticArmor(this, "Arctic Armor", ClassType.Mage, SkillType.PassiveA, 20, 1)); + AddSkill(new Immolate(this, "Immolate", ClassType.Mage, SkillType.PassiveA, 20, 1)); + AddSkill(new Void(this, "Void", ClassType.Mage, SkillType.PassiveA, 5, 5)); + AddSkill(new LifeBonds(this, "Life Bonds", ClassType.Mage, SkillType.PassiveA, 20, 1)); + + + //Passive B + AddSkill(new GlacialBlade(this, "Glacial Blade", ClassType.Mage, SkillType.PassiveB, + 0, 1, + 4, 0, + 350, 0, false, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); + + AddSkill(new MagmaBlade(this, "Magma Blade", ClassType.Mage, SkillType.PassiveB, 0, 1)); + AddSkill(new NullBlade(this, "Null Blade", ClassType.Mage, SkillType.PassiveB, 0, 1)); + AddSkill(new RootingAxe(this, "Rooting Axe", ClassType.Mage, SkillType.PassiveB, 0, 1)); + } + + public void AddRanger() + { + AddSkill(new Ranger(this, "Ranger Class", ClassType.Ranger, SkillType.Class, 0, 1)); + + //Sword + AddSkill(new Disengage(this, "Disengage", ClassType.Ranger, SkillType.Sword, + 0, 1, + 40, 0, + 12000, 0, true, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new WolfsPounce(this, "Wolfs Pounce", ClassType.Ranger, SkillType.Sword, 0, 1)); + + + //Axe + AddSkill(new Agility(this, "Agility", ClassType.Ranger, SkillType.Axe, + 0, 1, + 60, 0, + 30000, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new WolfsFury(this, "Wolfs Fury", ClassType.Ranger, SkillType.Axe, + 0, 1, + 60, 0, + 30000, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + //Bow + AddSkill(new HealingShot(this, "Healing Shot", ClassType.Ranger, SkillType.Bow, + 0, 1, + 40, 0, + 10000, 0, true, + new Material[] {Material.BOW}, + new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); + + AddSkill(new IncendiaryShot(this, "Incendiary Shot", ClassType.Ranger, SkillType.Bow, + 0, 1, + 0, 1, + 10000, 0, false, + new Material[] {Material.BOW}, + new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); + + AddSkill(new NapalmShot(this, "Napalm Shot", ClassType.Ranger, SkillType.Bow, + 0, 1, + 40, 0, + 15000, 0, true, + new Material[] {Material.BOW}, + new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); + + AddSkill(new PinDown(this, "Pin Down", ClassType.Ranger, SkillType.Bow, + 0, 1, + 30, 0, + 8000, 0, true, + new Material[] {Material.BOW}, + new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); + + AddSkill(new RopedArrow(this, "Roped Arrow", ClassType.Ranger, SkillType.Bow, + 0, 1, + 10, 0, + 250, 0, false, + new Material[] {Material.BOW}, + new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); + + //Passive A + AddSkill(new Barrage(this, "Barrage", ClassType.Ranger, SkillType.PassiveA, 0, 1)); + AddSkill(new Overcharge(this, "Overcharge", ClassType.Ranger, SkillType.PassiveA, 0, 1)); + AddSkill(new VitalitySpores(this, "Vitality Spores", ClassType.Ranger, SkillType.PassiveA, 0, 1)); + + //Passive B + AddSkill(new BarbedArrows(this, "Barbed Arrows", ClassType.Ranger, SkillType.PassiveB, 0, 1)); + AddSkill(new HeavyArrows(this, "Heavy Arrows", ClassType.Ranger, SkillType.PassiveB, 0, 1)); + AddSkill(new Shadowmeld(this, "Shadowmeld", ClassType.Ranger, SkillType.PassiveB, 0, 1)); + AddSkill(new Longshot(this, "Longshot", ClassType.Ranger, SkillType.PassiveB, 0, 1)); + AddSkill(new Sharpshooter(this, "Sharpshooter", ClassType.Ranger, SkillType.PassiveB, 0, 1)); + AddSkill(new Fletcher(this, "Fletcher", ClassType.Ranger, SkillType.PassiveB, 0, 1)); + } + + public void AddShifter() + { + AddSkill(new Shifter(this, "Shifter Class", ClassType.Shifter, SkillType.Class, 0, 1)); + + //Axe + AddSkill(new TreeShift(this, "Tree Shift", ClassType.Shifter, SkillType.Axe, + 0, 1, + 40, 0, + 4000, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + //Sword + AddSkill(new Polysmash(this, "Polysmash", ClassType.Shifter, SkillType.Sword, + 0, 1, + 30, 0, + 16000, 0, true, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + //CHICKEN========================================================================================= + AddSkill(new ChickenForm(this, "Chicken Form", ClassType.Shifter, SkillType.PassiveB, 0, 5)); + + AddSkill(new Flap(this, "Flap", ClassType.Shifter, SkillType.Sword, + 0, 1, + 5, 0, + 0, 0, true, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + + + //SQUID========================================================================================= + AddSkill(new SquidForm(this, "Squid Form", ClassType.Shifter, SkillType.PassiveB, 0, 5)); + + AddSkill(new Propel(this, "Propel", ClassType.Shifter, SkillType.Sword, + 0, 1, + 12, 0, + 250, 0, false, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new Construction(this, "Ice Construction", ClassType.Shifter, SkillType.Axe, + 0, 1, + 8, 0, + 0, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.LEFT_CLICK_BLOCK, Action.RIGHT_CLICK_BLOCK})); + + + //GOLEM========================================================================================= + AddSkill(new GolemForm(this, "Magnetic Golem Form", ClassType.Shifter, SkillType.PassiveA, 0, 5)); + + AddSkill(new MagneticPull(this, "Magnetic Pull", ClassType.Shifter, SkillType.Sword, + 0, 1, + 0, 0, + 0, 0, true, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new MagneticRepel(this, "Magnetic Repel", ClassType.Shifter, SkillType.Axe, + 0, 1, + 60, 0, + 30000, -3000, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + + //SPIDER========================================================================================= + AddSkill(new SpiderForm(this, "Spitting Spider Form", ClassType.Shifter, SkillType.PassiveA, 0, 5)); + + AddSkill(new Needler(this, "Needler", ClassType.Shifter, SkillType.Sword, + 0, 1, + 0, 0, + 0, 0, true, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new SpinWeb(this, "Spin Web", ClassType.Shifter, SkillType.Axe, + 0, 1, + 20, -1, + 0, 0, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new Pounce(this, "Pounce", ClassType.Shifter, SkillType.PassiveB, + 0, 1, + 20, 0, + 6000, 0, true, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD, Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); + } + + public ISkill GetSkillBySalesPackageId(int id) + { + return _skillSalesPackageMap.get(id); + } + + public Skill GetSkill(String skillName) + { + return _skillMap.get(skillName); + } + + public Collection GetAllSkills() + { + return _skillMap.values(); + } + + public void AddSkill(Skill skill) + { + _skillMap.put(skill.GetName(), skill); + } + + public void RemoveSkill(String skillName, String defaultReplacement) + { + if (skillName == null) + { + System.out.println("[Skill Factory] Remove Skill: Remove Skill NULL [" + skillName + "]."); + return; + } + + Skill remove = _skillMap.get(skillName); + if (remove == null) + { + System.out.println("[Skill Factory] Remove Skill: Remove Skill NULL [" + skillName + "]."); + return; + } + + Skill replacement = null; + if (defaultReplacement != null) + { + replacement = _skillMap.get(defaultReplacement); + if (replacement == null) + { + System.out.println("[Skill Factory] Remove Skill: Replacement Skill NULL [" + defaultReplacement + "]."); + return; + } + } + + //Remove + _skillMap.remove(remove.GetName()); + HandlerList.unregisterAll(remove); + + System.out.println("Skill Factory: Removed " + remove.GetName() + " from SkillMap."); + } + + @Override + public List GetGlobalSkills() + { + List skills = new LinkedList(); + + for (ISkill cur : _skillMap.values()) + { + if (cur.GetClassType() == ClassType.Global) + { + skills.add(cur); + } + } + + return skills; + } + + @Override + public List GetSkillsFor(IPvpClass gameClass) + { + List skills = new LinkedList(); + + for (ISkill cur : _skillMap.values()) + { + if (cur.GetClassType() == gameClass.GetType()) + { + skills.add(cur); + } + } + + return skills; + } + + //Called once, upon Class creation. + @Override + public HashMap GetDefaultSkillsFor(IPvpClass classType) + { + HashMap skills = new HashMap(); + if (classType.GetType() == ClassType.Knight) + { + AddSkill(skills, "Knight Class", 1); //Class + + AddSkill(skills, "Bulls Charge", 1); //Axe + AddSkill(skills, "Riposte", 1); //Sword + AddSkill(skills, "Deflection", 1); //Passive A + AddSkill(skills, "Vengeance", 1); //Passive B + + AddSkill(skills, "Resistance", 1); //Passive C + } + + else if (classType.GetType() == ClassType.Ranger) + { + AddSkill(skills, "Ranger Class", 1); //Class + + AddSkill(skills, "Napalm Shot", 1); //Bow + AddSkill(skills, "Agility", 1); //Axe + AddSkill(skills, "Disengage", 1); //Sword + AddSkill(skills, "Barrage", 1); //Passive A + AddSkill(skills, "Barbed Arrows", 1); //Passive B + + AddSkill(skills, "Quick Recovery", 1); //Passive D + } + + else if (classType.GetType() == ClassType.Brute) + { + AddSkill(skills, "Brute Class", 1); //Class + + AddSkill(skills, "Seismic Slam", 1); //Axe + AddSkill(skills, "Dwarf Toss", 1); //Sword + AddSkill(skills, "Stampede", 1); //Passive A + AddSkill(skills, "Crippling Blow", 1); //Passive B + + AddSkill(skills, "Resistance", 1); //Passive C + } + + else if (classType.GetType() == ClassType.Assassin) + { + AddSkill(skills, "Assassin Class", 1); //Class + + AddSkill(skills, "Blink", 1); //Axe + AddSkill(skills, "Evade", 1); //Sword + AddSkill(skills, "Toxic Arrow", 1); //Bow + AddSkill(skills, "Smoke Bomb", 1); //Passive A + AddSkill(skills, "Repeated Strikes", 1); //Passive B + + AddSkill(skills, "Break Fall", 1); //Passive C + } + + else if (classType.GetType() == ClassType.Mage) + { + AddSkill(skills, "Mage Class", 1); //Class + + AddSkill(skills, "Freezing Blast", 1); //Axe + AddSkill(skills, "Blizzard", 1); //Sword + AddSkill(skills, "Arctic Armor", 1); //Passive A + AddSkill(skills, "Glacial Blade", 1); //Passive B + + AddSkill(skills, "Fitness", 1); //Passive D + } + + else if (classType.GetType() == ClassType.Shifter) + { + AddSkill(skills, "Shifter Class", 1); //Class + + AddSkill(skills, "Tree Shift", 1); //Axe + AddSkill(skills, "Polysmash", 1); //Sword + AddSkill(skills, "Golem Form", 1); //Passive A + AddSkill(skills, "Chicken Form", 1); //Passive B + + AddSkill(skills, "Quick Recovery", 1); //Passive D + } + + skills.remove(null); + + return skills; + } + + public void AddSkill(HashMap skills, String skillName, int level) + { + ISkill skill = GetSkill(skillName); + + if (skill == null) + return; + + skills.put(skill, level); + } + + public Movement Movement() + { + return _movement; + } + + public DamageManager Damage() + { + return _damageManager; + } + + public CombatManager Combat() + { + return _combatManager; + } + + public ProjectileManager Projectile() + { + return _projectileManager; + } + + public BlockRestore BlockRestore() + { + return _blockRestore; + } + + public Fire Fire() + { + return _fire; + } + + public IRelation Relation() + { + return _relation; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/event/SkillEvent.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/event/SkillEvent.java new file mode 100644 index 000000000..fa39b0639 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/event/SkillEvent.java @@ -0,0 +1,87 @@ +package mineplex.minecraft.game.classcombat.Skill.event; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class SkillEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private String _skill; + private List _targets; + private ClassType _classType; + + public SkillEvent(Player player, String skill, ClassType classType, List targets) + { + _player = player; + _skill = skill; + _classType = classType; + _targets = targets; + } + + public SkillEvent(Player player, String skill, ClassType classType, Entity target) + { + _player = player; + _skill = skill; + _classType = classType; + _targets = new ArrayList(); + _targets.add(target); + } + + public SkillEvent(Player player, String skill, ClassType classType, Set targets) + { + _player = player; + _skill = skill; + _classType = classType; + _targets = new ArrayList(); + for (LivingEntity ent : targets) + _targets.add(ent); + } + + public SkillEvent(Player player, String skill, ClassType classType) + { + _player = player; + _skill = skill; + _classType = classType; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public String GetSkillName() + { + return _skill; + } + + public Player GetPlayer() + { + return _player; + } + + public ClassType GetClassType() + { + return _classType; + } + + public List GetTargets() + { + return _targets; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/event/SkillTriggerEvent.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/event/SkillTriggerEvent.java new file mode 100644 index 000000000..27e180d55 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/event/SkillTriggerEvent.java @@ -0,0 +1,97 @@ +package mineplex.minecraft.game.classcombat.Skill.event; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class SkillTriggerEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private String _skill; + private List _targets; + private ClassType _classType; + private boolean _cancelled = false; + + public SkillTriggerEvent(Player player, String skill, ClassType classType, List targets) + { + _player = player; + _skill = skill; + _classType = classType; + _targets = targets; + } + + public SkillTriggerEvent(Player player, String skill, ClassType classType, Entity target) + { + _player = player; + _skill = skill; + _classType = classType; + _targets = new ArrayList(); + _targets.add(target); + } + + public SkillTriggerEvent(Player player, String skill, ClassType classType, Set targets) + { + _player = player; + _skill = skill; + _classType = classType; + _targets = new ArrayList(); + for (LivingEntity ent : targets) + _targets.add(ent); + } + + public SkillTriggerEvent(Player player, String skill, ClassType classType) + { + _player = player; + _skill = skill; + _classType = classType; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public String GetSkillName() + { + return _skill; + } + + public Player GetPlayer() + { + return _player; + } + + public ClassType GetClassType() + { + return _classType; + } + + public List GetTargets() + { + return _targets; + } + + public boolean IsCancelled() { + return _cancelled; + } + + public void SetCancelled(boolean cancelled) + { + this._cancelled = cancelled; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/repository/SkillRepository.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/repository/SkillRepository.java new file mode 100644 index 000000000..5cfee0dca --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/repository/SkillRepository.java @@ -0,0 +1,23 @@ +package mineplex.minecraft.game.classcombat.Skill.repository; + +import java.util.List; + +import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; + +import mineplex.core.server.remotecall.JsonWebCall; +import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken; + +public class SkillRepository +{ + private String _webAddress; + + public SkillRepository(String webAddress) + { + _webAddress = webAddress; + } + + public List GetSkills(List skills) + { + return new JsonWebCall(_webAddress + "Dominate/GetSkills").Execute(new TypeToken>(){}.getType(), skills); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/repository/token/SkillToken.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/repository/token/SkillToken.java new file mode 100644 index 000000000..68791ec7f --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/repository/token/SkillToken.java @@ -0,0 +1,14 @@ +package mineplex.minecraft.game.classcombat.Skill.repository.token; + +import mineplex.core.donation.repository.GameSalesPackageToken; + +public class SkillToken +{ + public int SkillId; + + public String Name; + + public Integer Level; + + public GameSalesPackageToken SalesPackage; +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Consume/Apple.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Consume/Apple.java new file mode 100644 index 000000000..f1578159a --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Consume/Apple.java @@ -0,0 +1,84 @@ +package mineplex.minecraft.game.classcombat.item.Consume; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.ProjectileUser; +import mineplex.minecraft.game.classcombat.item.ItemFactory; +import mineplex.minecraft.game.classcombat.item.ItemUsable; + +public class Apple extends ItemUsable +{ + public Apple(ItemFactory factory, int salesPackageId, Material type, + int amount, boolean canDamage, int creditCost, + ActionType useAction, boolean useStock, long useDelay, + int useEnergy, ActionType throwAction, boolean throwStock, + long throwDelay, int throwEnergy, float throwPower, + long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup) + { + super(factory, salesPackageId, "Apple", new String[] { "Consume:", "Heals two hunger points.", " ", "Thrown:", "Does half a heart of damage on hit." }, type, amount, canDamage, creditCost, + useAction, useStock, useDelay, useEnergy, throwAction, throwStock, + throwDelay, throwEnergy, throwPower, + throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup); + } + + @Override + public void UseAction(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + //Food + UtilPlayer.hunger(player, 4); + + //Energy + Factory.Energy().ModifyEnergy(player, 10); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.EAT, 1f, 1f); + player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 40); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (target == null) + return; + + //Damage Event + Factory.Damage().NewDamageEvent(target, data.GetThrower(), null, + DamageCause.CUSTOM, 2, true, true, false, + UtilEnt.getName(data.GetThrower()), GetName()); + + //Effect + data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1.6f); + + //Re-Drop + if (data.GetThrown() instanceof Item) + data.GetThrown().getWorld().dropItem(data.GetThrown().getLocation(), ItemStackFactory.Instance.CreateStack(((Item)data.GetThrown()).getItemStack().getType())).setPickupDelay(60); + + data.GetThrown().remove(); + } + + @Override + public void Idle(ProjectileUser data) + { + + } + + @Override + public void Expire(ProjectileUser data) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Consume/Soup.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Consume/Soup.java new file mode 100644 index 000000000..3f643cb35 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Consume/Soup.java @@ -0,0 +1,69 @@ +package mineplex.minecraft.game.classcombat.item.Consume; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.projectile.ProjectileUser; +import mineplex.minecraft.game.classcombat.item.ItemFactory; +import mineplex.minecraft.game.classcombat.item.ItemUsable; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; + +public class Soup extends ItemUsable +{ + public Soup(ItemFactory factory, int salesPackageId, Material type, + int amount, boolean canDamage, int creditCost, + ActionType useAction, boolean useStock, long useDelay, + int useEnergy, ActionType throwAction, boolean throwStock, + long throwDelay, int throwEnergy, float throwPower, + long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup) + { + super(factory, salesPackageId, "Mushroom Soup", new String[] { "Consume:", "Heals two hunger points.", "Gives Regen II boost for 4 seconds" }, type, amount, canDamage, creditCost, + useAction, useStock, useDelay, useEnergy, throwAction, throwStock, + throwDelay, throwEnergy, throwPower, + throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup); + } + + @Override + public void UseAction(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + //Food + UtilPlayer.hunger(player, 4); + + //Condition + Factory.Condition().Factory().Custom(GetName(), player, player, + ConditionType.REGENERATION, 4, 1, false, + Material.MUSHROOM_SOUP, (byte)0, true); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.EAT, 1f, 1f); + player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 39); + player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 40); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + + } + + @Override + public void Idle(ProjectileUser data) + { + + } + + @Override + public void Expire(ProjectileUser data) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/IItem.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/IItem.java new file mode 100644 index 000000000..906eefa2d --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/IItem.java @@ -0,0 +1,14 @@ +package mineplex.minecraft.game.classcombat.item; + +import org.bukkit.Material; + +public interface IItem +{ + Material GetType(); + int GetAmount(); + int GetGemCost(); + boolean IsFree(); + int GetSalesPackageId(); + String GetName(); + String[] GetDesc(); +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/IItemFactory.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/IItemFactory.java new file mode 100644 index 000000000..64b5ac1ff --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/IItemFactory.java @@ -0,0 +1,8 @@ +package mineplex.minecraft.game.classcombat.item; + +import java.util.Collection; + +public interface IItemFactory +{ + Collection GetItems(); +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Item.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Item.java new file mode 100644 index 000000000..1260f2b58 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Item.java @@ -0,0 +1,98 @@ +package mineplex.minecraft.game.classcombat.item; + +import mineplex.core.common.util.UtilGear; +import mineplex.minecraft.game.classcombat.item.repository.ItemToken; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +public class Item implements IItem, Listener +{ + protected ItemFactory Factory; + + private int _salesPackageId; + private Material _type; + private String _name; + private String[] _desc; + private int _amount; + private boolean _free; + private int _gemCost; + private boolean _canDamage; + + public Item(ItemFactory factory, int salesPackageId, String name, String[] desc, Material type, int amount, boolean canDamage, int gemCost) + { + Factory = factory; + _salesPackageId = salesPackageId; + _name = name; + _desc = desc; + _type = type; + _amount = amount; + _gemCost = gemCost; + _canDamage = canDamage; + } + + @Override + public Material GetType() + { + return _type; + } + + @Override + public int GetAmount() + { + return _amount; + } + + @Override + public int GetGemCost() + { + return _gemCost; + } + + @Override + public int GetSalesPackageId() + { + return _salesPackageId; + } + + @Override + public String GetName() + { + return _name; + } + + @EventHandler + public void Damage(CustomDamageEvent event) + { + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!UtilGear.isMat(damager.getItemInHand(), GetType())) + return; + + if (!_canDamage) + event.SetCancelled("Item Damage Cancel"); + } + + @Override + public boolean IsFree() + { + return _free; + } + + public void Update(ItemToken itemToken) + { + _salesPackageId = itemToken.SalesPackage.GameSalesPackageId; + _gemCost = itemToken.SalesPackage.Gems; + _free = itemToken.SalesPackage.Free; + } + + @Override + public String[] GetDesc() + { + return _desc; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java new file mode 100644 index 000000000..d73759807 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java @@ -0,0 +1,246 @@ +package mineplex.minecraft.game.classcombat.item; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; + +import mineplex.core.MiniPlugin; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.donation.repository.GameSalesPackageToken; +import mineplex.core.energy.Energy; +import mineplex.minecraft.game.core.fire.Fire; +import mineplex.core.projectile.ProjectileManager; +import mineplex.minecraft.game.classcombat.Class.ClassManager; +import mineplex.minecraft.game.classcombat.item.Consume.*; +import mineplex.minecraft.game.classcombat.item.Throwable.*; +import mineplex.minecraft.game.classcombat.item.Tools.Scanner; +import mineplex.minecraft.game.classcombat.item.repository.ItemRepository; +import mineplex.minecraft.game.classcombat.item.repository.ItemToken; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.damage.DamageManager; + +import org.bukkit.Material; +import org.bukkit.plugin.java.JavaPlugin; + +public class ItemFactory extends MiniPlugin implements IItemFactory +{ + private BlockRestore _blockRestore; + private ClassManager _classManager; + private ConditionManager _condition; + private DamageManager _damage; + private Energy _energy; + private Fire _fire; + private ProjectileManager _projectileManager; + private java.lang.reflect.Field _itemMaxDurability; + private HashMap _items; + private HashSet _ignore; + + public ItemFactory(JavaPlugin plugin, BlockRestore blockRestore, ClassManager classManager, ConditionManager condition, DamageManager damage, Energy energy, Fire fire, ProjectileManager projectileManager, String webAddress, HashSet ignore) + { + super("Item Factory", plugin); + + _blockRestore = blockRestore; + _classManager = classManager; + _condition = condition; + _damage = damage; + _energy = energy; + _fire = fire; + _projectileManager = projectileManager; + + _items = new HashMap(); + _ignore = ignore; + + try + { + _itemMaxDurability = net.minecraft.server.v1_6_R2.Item.class.getDeclaredField("durability"); + _itemMaxDurability.setAccessible(true); + } + catch (SecurityException e) + { + e.printStackTrace(); + } + catch (NoSuchFieldException e) + { + e.printStackTrace(); + } + + PopulateFactory(webAddress); + } + + private void PopulateFactory(String webAddress) + { + _items.clear(); + + AddConsumables(); + AddPassive(); + AddThrowable(); + AddTools(); + AddOther(); + + for (Item cur : _items.values()) + RegisterEvents(cur); + + List itemTokens = new ArrayList(); + + for (Item item : _items.values()) + { + ItemToken itemToken = new ItemToken(); + itemToken.Name = item.GetName(); + itemToken.Material = item.GetType().toString(); + itemToken.SalesPackage = new GameSalesPackageToken(); + itemToken.SalesPackage.GameSalesPackageId = item.GetSalesPackageId(); + itemToken.SalesPackage.Gems = item.GetGemCost(); + + itemTokens.add(itemToken); + } + + for (ItemToken itemToken : new ItemRepository(webAddress).GetItems(itemTokens)) + { + if (_items.containsKey(itemToken.Name)) + { + _items.get(itemToken.Name).Update(itemToken); + } + } + } + + private void AddConsumables() + { + AddItem(new Apple(this, 100, + Material.APPLE, 1, false, 0, + ActionType.R, true, 500, 0, + ActionType.L, true, 500, 4, 1.2f, + -1, true, true, true, false)); + + AddItem(new Soup(this, 103, + Material.MUSHROOM_SOUP, 1, true, 0, + ActionType.R, true, 500, 0, + null, false, 0, 0, 0f, + -1, true, true, true, false)); + } + + private void AddPassive() + { + + } + + private void AddThrowable() + { + AddItem(new WaterBottle(this, 301, + Material.POTION, 1, false, 0, + ActionType.R, true, 500, 0, + ActionType.L, true, 500, 4, 1f, + -1, true, true, true, false)); + + AddItem(new Web(this, 30, + Material.WEB, 2, false, 500, + null, true, 0, 0, + ActionType.L, true, 250, 8, 1f, + -1, true, true, true, false)); + + AddItem(new PoisonBall(this, 304, + Material.SLIME_BALL, 1, false, 1500, + null, true, 0, 0, + ActionType.L, true, 0, 6, 1.2f, + -1, true, true, true, false)); + + AddItem(new ProximityExplosive(this, 307, + Material.COMMAND, 1, false, 1000, + null, true, 0, 0, + ActionType.L, true, 250, 10, 0.8f, + 4000, false, false, false, true)); + + AddItem(new ProximityZapper(this, 308, + Material.REDSTONE_LAMP_ON, 1, false, 1000, + null, true, 0, 0, + ActionType.L, true, 250, 10, 0.8f, + 4000, false, false, false, true)); + } + + private void AddTools() + { + AddItem(new Scanner(this, 303, + Material.SHEARS, 1, true, 1000, + ActionType.R, false, 2000, 20, + null, true, 250, 6, 1.8f, + -1, true, true, true, false)); + } + + private void AddOther() + { + AddItem(new Item(this, 401, "Arrows", new String[] { "Standard Arrows" }, Material.ARROW, 8, true, 0)); + //AddItem(new Item(this, 402, "Pistol Ammo", new String[] { "Pistol Ammo" }, Material.MELON_SEEDS, 5, true, 5, 0)); + } + + public IItem GetItem(String weaponName) + { + return _items.get(weaponName); + } + + @Override + public Collection GetItems() + { + return _items.values(); + } + + public void AddItem(Item newItem) + { + if (_ignore.contains(newItem.GetName())) + { + System.out.println("Item Factory: Ignored " + newItem.GetName()); + return; + } + + try + { + _itemMaxDurability.setInt(net.minecraft.server.v1_6_R2.Item.byId[newItem.GetType().getId()], 56); + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + + _items.put(newItem.GetName(), newItem); + } + + public BlockRestore BlockRestore() + { + return _blockRestore; + } + + public ClassManager ClassManager() + { + return _classManager; + } + + public ConditionManager Condition() + { + return _condition; + } + + public DamageManager Damage() + { + return _damage; + } + + public Energy Energy() + { + return _energy; + } + + public Fire Fire() + { + return _fire; + } + + public ProjectileManager Throw() + { + return _projectileManager; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemUsable.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemUsable.java new file mode 100644 index 000000000..fc1978202 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemUsable.java @@ -0,0 +1,178 @@ +package mineplex.minecraft.game.classcombat.item; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.minecraft.game.classcombat.item.Item; +import mineplex.minecraft.game.classcombat.item.ItemFactory; + +public abstract class ItemUsable extends Item implements IThrown +{ + private ActionType _useAction; + private boolean _useStock; + private long _useDelay; + private int _useEnergy; + + private ActionType _throwAction; + private boolean _throwStock; + private long _throwDelay; + private int _throwEnergy; + private float _throwPower; + + private long _throwExpire; + private boolean _throwPlayer; + private boolean _throwBlock; + private boolean _throwIdle; + private boolean _throwPickup; + + public ItemUsable(ItemFactory factory, int salesPackageId, String name, String[] desc, + Material type, int amount, boolean canDamage, int gemCost, + ActionType useAction, boolean useStock, long useDelay, int useEnergy, + ActionType throwAction, boolean throwStock, long throwDelay, int throwEnergy, float throwPower, + long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup) + { + super(factory, salesPackageId, name, desc, type, amount, canDamage, gemCost); + _useAction = useAction; + _throwAction = throwAction; + _useStock = useStock; + _useDelay = useDelay; + _useEnergy = useEnergy; + + _throwStock = throwStock; + _throwDelay = throwDelay; + _throwPower = throwPower; + _throwEnergy = throwEnergy; + _throwExpire = throwExpire; + _throwIdle = throwIdle; + _throwPlayer = throwPlayer; + _throwBlock = throwBlock; + _throwPickup = throwPickup; + } + + @EventHandler + public void Use(PlayerInteractEvent event) + { + if (_useAction == null) + return; + + Player player = event.getPlayer(); + + if (!UtilGear.isMat(player.getItemInHand(), GetType())) + return; + + if (!UtilEvent.isAction(event, _useAction)) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + event.setCancelled(true); + + if (!EnergyRecharge(player, GetName(), _useEnergy, _useDelay)) + return; + + if (_useStock) + { + if (player.getItemInHand().getAmount() > 1) + player.getItemInHand().setAmount(player.getItemInHand().getAmount() - 1); + else + player.setItemInHand(null); + + UtilInv.Update(player); + } + + UseAction(event); + } + + public abstract void UseAction(PlayerInteractEvent event); + + @EventHandler + public void Throw(PlayerInteractEvent event) + { + if (_throwAction == null) + return; + + Player player = event.getPlayer(); + + if (((CraftPlayer)player).getHandle().spectating) + return; + + if (!UtilGear.isMat(player.getItemInHand(), GetType())) + return; + + if (!UtilEvent.isAction(event, _throwAction)) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + event.setCancelled(true); + + if (!EnergyRecharge(player, GetName(), _throwEnergy, _throwDelay)) + return; + + if (_throwStock) + { + if (player.getItemInHand().getAmount() > 1) + player.getItemInHand().setAmount(player.getItemInHand().getAmount() - 1); + else + player.setItemInHand(null); + + UtilInv.Update(player); + } + + //Throw + long expire = -1; + if (_throwExpire >= 0) + expire = System.currentTimeMillis() + _throwExpire; + + org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(GetType())); + UtilAction.velocity(ent, player.getLocation().getDirection(), _throwPower, false, 0, 0.2, 10, false); + Factory.Throw().AddThrow(ent, player, this, expire, _throwPlayer, _throwBlock, _throwIdle, _throwPickup, 1d); + + ThrowCustom(event, ent); + } + + public void ThrowCustom(PlayerInteractEvent event, org.bukkit.entity.Item ent) + { + //Specifics. + } + + @Override + public abstract void Collide(LivingEntity target, Block block, ProjectileUser data); + + @Override + public abstract void Idle(ProjectileUser data); + + @Override + public abstract void Expire(ProjectileUser data); + + private boolean EnergyRecharge(Player player, String ability, int energy, long recharge) + { + if (!Factory.Energy().Use(player, ability, energy, false, true)) + return false; + + if (!Recharge.Instance.use(player, ability, recharge, (recharge > 2000))) + return false; + + if (!Factory.Energy().Use(player, ability, energy, true, true)) + return false; + + return true; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Pistol.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Pistol.java new file mode 100644 index 000000000..75ab9cac5 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Pistol.java @@ -0,0 +1,190 @@ +package mineplex.minecraft.game.classcombat.item.Throwable; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.projectile.ProjectileUser; +import mineplex.minecraft.game.classcombat.item.ItemFactory; +import mineplex.minecraft.game.classcombat.item.ItemUsable; + +public class Pistol extends ItemUsable +{ + public Pistol(ItemFactory factory, int salesPackageId, Material type, + int amount, boolean canDamage, int creditCost, + ActionType useAction, boolean useStock, long useDelay, + int useEnergy, ActionType throwAction, boolean throwStock, + long throwDelay, int throwEnergy, float throwPower, + long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup) + { + super(factory, salesPackageId, "Pistol", new String[] { "Pew pew pew." }, type, amount, canDamage, creditCost, + useAction, useStock, useDelay, useEnergy, throwAction, throwStock, + throwDelay, throwEnergy, throwPower, + throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup); + } + + @Override + public void UseAction(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + //Use Gunpowder + if (!UtilInv.remove(player, Material.MELON_SEEDS, (byte)0, 1)) + { + UtilPlayer.message(player, F.main("Skill", "You need " + F.item("Pistol Ammo") + " to use " + F.skill(GetName()) + ".")); + return; + } + + RifleShoot(player); + } + + public void RifleShoot(Player player) + { + //Action + double sharpness = 0.1; + + double travel = 0; + double maxTravel = 100; + + double hitBox = 0.5; + + //Effect + player.getWorld().playEffect(player.getEyeLocation().add(player.getLocation().getDirection()), Effect.SMOKE, 4); + player.getWorld().playSound(player.getEyeLocation(), Sound.EXPLODE, 0.6f, 2f); + + while (travel < maxTravel) + { + Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(travel)); + for (Entity ent : player.getWorld().getEntities()) + { + if (!(ent instanceof LivingEntity)) + continue; + + LivingEntity cur = (LivingEntity)ent; + + if (cur.equals(player)) + continue; + + //Player + if (cur instanceof Player) + { + if (UtilEnt.hitBox(loc, (Player)cur, 1)) + { + RifleHit(cur, player, true); + player.getWorld().playSound(loc, Sound.BLAZE_HIT, 0.4f, 2f); + return; + } + } + //Other + else + { + if (UtilMath.offset(loc, cur.getEyeLocation()) < 0.3) + { + RifleHit(cur, player, true); + player.getWorld().playSound(loc, Sound.BLAZE_HIT, 0.4f, 2f); + return; + } + else if (UtilMath.offset2d(loc, cur.getLocation()) < hitBox) + { + if (loc.getY() > cur.getLocation().getY() && loc.getY() < cur.getLocation().getY() + 1) + { + RifleHit(cur, player, false); + player.getWorld().playSound(loc, Sound.BLAZE_HIT, 0.4f, 2f); + return; + } + } + } + } + + if (UtilBlock.solid(loc.getBlock())) + { + loc.getBlock().getWorld().playEffect(loc, Effect.STEP_SOUND, loc.getBlock().getTypeId()); + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_HIT, 0.4f, 2f); + return; + } + + travel += sharpness; + } + } + + public void RifleHit(LivingEntity hit, Player attacker, boolean headshot) + { + int damage = 12; + if (headshot) + { + if (hit instanceof Player) + { + /* + Player damagee = (Player)hit; + + if (Factory.Clans().CUtil().canHurt(damagee, attacker)) + { + if (damagee.getInventory().getHelmet() == null) + { + //Damage + damage = 500; + damagee.getWorld().playEffect(damagee.getEyeLocation(), Effect.STEP_SOUND, 55); + + //Inform + UtilServer.broadcast(F.main("Item", F.name(((Player)hit).getName()) + " was headshotted by " + F.name(attacker.getName()) + " with " + F.item("Rifle") + ".")); + } + else + { + int id = 55; + if (damagee.getInventory().getHelmet().getType() == Material.IRON_HELMET) id = 42; + if (damagee.getInventory().getHelmet().getType() == Material.GOLD_HELMET) id = 41; + if (damagee.getInventory().getHelmet().getType() == Material.DIAMOND_HELMET) id = 57; + if (damagee.getInventory().getHelmet().getType() == Material.CHAINMAIL_HELMET) id = 4; + if (damagee.getInventory().getHelmet().getType() == Material.LEATHER_HELMET) id = 17; + damagee.getWorld().playEffect(damagee.getEyeLocation(), Effect.STEP_SOUND, id); + + Item item = damagee.getWorld().dropItemNaturally(damagee.getEyeLocation(), damagee.getInventory().getHelmet()); + item.setPickupDelay(60); + damagee.getInventory().setHelmet(null); + } + } + */ + } + else + { + hit.getWorld().playEffect(hit.getEyeLocation(), Effect.STEP_SOUND, 55); + damage = 500; + } + } + + if (damage > 1) + return; + //UtilPlayer.Damage(hit, attacker, damage, GetName(), true, true, false); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + + } + + @Override + public void Idle(ProjectileUser data) + { + + } + + @Override + public void Expire(ProjectileUser data) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/PoisonBall.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/PoisonBall.java new file mode 100644 index 000000000..3bf3e4587 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/PoisonBall.java @@ -0,0 +1,75 @@ +package mineplex.minecraft.game.classcombat.item.Throwable; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.projectile.ProjectileUser; +import mineplex.minecraft.game.classcombat.item.ItemFactory; +import mineplex.minecraft.game.classcombat.item.ItemUsable; + +public class PoisonBall extends ItemUsable +{ + public PoisonBall(ItemFactory factory, int salesPackageId, Material type, + int amount, boolean canDamage, int creditCost, + ActionType useAction, boolean useStock, long useDelay, + int useEnergy, ActionType throwAction, boolean throwStock, + long throwDelay, int throwEnergy, float throwPower, + long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup) + { + super(factory, salesPackageId, "Poison Ball", new String[] { "Thrown:", "Poisons for 6 seconds on hit.", "Bounces back to you.", "Can be intercepted by enemy on return." }, type, amount, canDamage, creditCost, + useAction, useStock, useDelay, useEnergy, throwAction, throwStock, + throwDelay, throwEnergy, throwPower, + throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup); + } + + @Override + public void UseAction(PlayerInteractEvent event) + { + + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + Rebound(data.GetThrower(), data.GetThrown()); + + if (target == null) + return; + + Factory.Condition().Factory().Poison(GetName(), target, data.GetThrower(), 6, 0, false, true, true); + } + + @Override + public void Idle(ProjectileUser data) + { + Rebound(data.GetThrower(), data.GetThrown()); + } + + @Override + public void Expire(ProjectileUser data) + { + Rebound(data.GetThrower(), data.GetThrown()); + } + + public void Rebound(LivingEntity player, Entity ent) + { + ent.getWorld().playSound(ent.getLocation(), Sound.ITEM_PICKUP, 1f, 0.5f); + + double mult = 0.5 + (0.6 * (UtilMath.offset(player.getLocation(), ent.getLocation())/16d)); + + //Velocity + ent.setVelocity(player.getLocation().toVector().subtract(ent.getLocation().toVector()).normalize().add(new Vector(0, 0.4, 0)).multiply(mult)); + + //Ticks + if (ent instanceof Item) + ((Item)ent).setPickupDelay(5); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java new file mode 100644 index 000000000..14918156a --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java @@ -0,0 +1,161 @@ +package mineplex.minecraft.game.classcombat.item.Throwable; + +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.inventory.InventoryPickupItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; + +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.minecraft.game.classcombat.item.ItemFactory; +import mineplex.minecraft.game.classcombat.item.ItemUsable; + +public class ProximityExplosive extends ItemUsable +{ + private HashMap _armed = new HashMap(); + + public ProximityExplosive(ItemFactory factory, int salesPackageId, Material type, + int amount, boolean canDamage, int creditCost, + ActionType useAction, boolean useStock, long useDelay, + int useEnergy, ActionType throwAction, boolean throwStock, + long throwDelay, int throwEnergy, float throwPower, + long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup) + { + super(factory, salesPackageId, "Proximity Explosive", new String[] { + "Thrown Item:", + "Activates after 4 seconds.", + "Detonates on player proximity;", + "* 8 Range" , + "* 1 Damage" , + "* Strong Knockback" , + "All effects scale down with range." + }, type, amount, canDamage, creditCost, + useAction, useStock, useDelay, useEnergy, throwAction, throwStock, + throwDelay, throwEnergy, throwPower, + throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup); + } + + @Override + public void UseAction(PlayerInteractEvent event) + { + + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + + } + + @Override + public void Idle(ProjectileUser data) + { + + } + + @Override + public void Expire(ProjectileUser data) + { + //Arm + _armed.put(data.GetThrown(), data.GetThrower()); + + //Effect + data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); + data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); + } + + @EventHandler(priority = EventPriority.LOW) + public void Pickup(PlayerPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (((CraftPlayer)event.getPlayer()).getHandle().spectating) + return; + + if (_armed.containsKey(event.getItem())) + { + event.setCancelled(true); + Detonate(event.getItem()); + } + } + + @EventHandler + public void HopperPickup(InventoryPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (_armed.containsValue(event.getItem())) + event.setCancelled(true); + } + + public void Detonate(Entity ent) + { + //Remove + ent.remove(); + LivingEntity thrower = _armed.remove(ent); + + //Blast + HashMap hit = UtilPlayer.getInRadius(ent.getLocation(), 8); + for (Player player : hit.keySet()) + { + //Velocity + UtilAction.velocity(player, UtilAlg.getTrajectory(ent.getLocation(), + player.getEyeLocation()), 2.4*hit.get(player), false, 0, 0.6*hit.get(player), 1.6, true); + + //Damage Event + Factory.Damage().NewDamageEvent(player, thrower, null, + DamageCause.CUSTOM, 10*hit.get(player), false, true, false, + UtilEnt.getName(thrower), GetName()); + + //Inform + UtilPlayer.message(player, F.main(GetName(), F.name(UtilEnt.getName(thrower)) +" hit you with " + F.item(GetName()) + ".")); + } + + //Effect + ent.getWorld().playSound(ent.getLocation(), Sound.NOTE_PLING, 0.5f, 0.5f); + ent.getWorld().createExplosion(ent.getLocation(), 0f); + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + HashSet expired = new HashSet(); + + for (Entity ent : _armed.keySet()) + { + if (ent.isDead() || !ent.isValid() || ent.getTicksLived() >= 6000) + expired.add(ent); + } + + for (Entity ent : expired) + { + Detonate(ent); + } + } +} + diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java new file mode 100644 index 000000000..59cc198c3 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java @@ -0,0 +1,155 @@ +package mineplex.minecraft.game.classcombat.item.Throwable; + +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.inventory.InventoryPickupItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; + +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.minecraft.game.classcombat.item.ItemFactory; +import mineplex.minecraft.game.classcombat.item.ItemUsable; + +public class ProximityZapper extends ItemUsable +{ + private HashMap _armed = new HashMap(); + + public ProximityZapper(ItemFactory factory, int salesPackageId, Material type, + int amount, boolean canDamage, int creditCost, + ActionType useAction, boolean useStock, long useDelay, + int useEnergy, ActionType throwAction, boolean throwStock, + long throwDelay, int throwEnergy, float throwPower, + long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup) + { + super(factory, salesPackageId, "Proximity Zapper", new String[] { + "Thrown Item:", + "Activates after 4 seconds.", + "Detonates on player proximity;", + "* Lightning strikes the Zapper" , + "* Silence for 6 seconds" , + "* Shock for 6 seconds" , + "* Slow IV for 6 seconds" + }, type, amount, canDamage, creditCost, + useAction, useStock, useDelay, useEnergy, throwAction, throwStock, + throwDelay, throwEnergy, throwPower, + throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup); + } + + @Override + public void UseAction(PlayerInteractEvent event) + { + + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + + } + + @Override + public void Idle(ProjectileUser data) + { + + } + + @Override + public void Expire(ProjectileUser data) + { + //Arm + _armed.put(data.GetThrown(), data.GetThrower()); + + //Effect + data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); + data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); + } + + @EventHandler(priority = EventPriority.LOW) + public void Pickup(PlayerPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (((CraftPlayer)event.getPlayer()).getHandle().spectating) + return; + + if (_armed.containsKey(event.getItem())) + { + event.setCancelled(true); + Detonate(event.getItem(), event.getPlayer()); + } + } + + @EventHandler + public void HopperPickup(InventoryPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (_armed.containsValue(event.getItem())) + event.setCancelled(true); + } + + public void Detonate(Entity ent, Player player) + { + //Remove + ent.remove(); + LivingEntity thrower = _armed.remove(ent); + + //Stun + if (player != null) + { + //Inform + UtilPlayer.message(player, F.main(GetName(), F.name(UtilEnt.getName(thrower)) +" hit you with " + F.item(GetName()) + ".")); + + Factory.Condition().Factory().Silence(GetName(), player, thrower, 6, false, true); + Factory.Condition().Factory().Shock(GetName(), player, thrower, 6, false, false); + Factory.Condition().Factory().Slow(GetName(), player, thrower, 6, 3, false, true, true, true); + } + + //Blast + ent.getWorld().strikeLightning(ent.getLocation()); + + //Effect + ent.getWorld().playSound(ent.getLocation(), Sound.NOTE_PLING, 0.5f, 0.5f); + ent.getWorld().createExplosion(ent.getLocation(), 0f); + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + HashSet expired = new HashSet(); + + for (Entity ent : _armed.keySet()) + { + if (ent.isDead() || !ent.isValid() || ent.getTicksLived() >= 6000) + expired.add(ent); + } + + for (Entity ent : expired) + { + Detonate(ent, null); + } + } +} + diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java new file mode 100644 index 000000000..9dcd9f028 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java @@ -0,0 +1,97 @@ +package mineplex.minecraft.game.classcombat.item.Throwable; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.projectile.ProjectileUser; +import mineplex.minecraft.game.classcombat.item.ItemFactory; +import mineplex.minecraft.game.classcombat.item.ItemUsable; + +public class WaterBottle extends ItemUsable +{ + public WaterBottle(ItemFactory factory, int salesPackageId, Material type, + int amount, boolean canDamage, int creditCost, + ActionType useAction, boolean useStock, long useDelay, + int useEnergy, ActionType throwAction, boolean throwStock, + long throwDelay, int throwEnergy, float throwPower, + long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup) + { + super(factory, salesPackageId, "Water Bottle", new String[] { + "Thrown, giving AoE effect;", + "* 3 Range", + "* Douses Players", + "* Extinguishes Fires", + "Used, giving personal effect;", + "* Douses Player", + "* Fire Resistance for 4 Seconds" + }, type, amount, canDamage, creditCost, + useAction, useStock, useDelay, useEnergy, throwAction, throwStock, + throwDelay, throwEnergy, throwPower, + throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup); + } + + @Override + public void UseAction(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (((CraftPlayer)player).getHandle().spectating) + return; + + //Extinguish + player.setFireTicks(-20); + + //Resist + Factory.Condition().Factory().FireResist(GetName(), player, player, 4, 0, false, true, true); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 1f, 1.4f); + player.getWorld().playEffect(player.getEyeLocation(), Effect.STEP_SOUND, 8); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + Break(data); + } + + @Override + public void Idle(ProjectileUser data) + { + Break(data); + } + + @Override + public void Expire(ProjectileUser data) + { + Break(data); + } + + public void Break(ProjectileUser data) + { + //Splash + data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 20); + data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 8); + data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.SPLASH, 1f, 1.4f); + + //Extinguish + Factory.Fire().RemoveNear(data.GetThrown().getLocation(), 3); + + //Remove + data.GetThrown().remove(); + + for (Player player : UtilPlayer.getNearby(data.GetThrown().getLocation(), 3)) + { + //Extinguish + player.setFireTicks(-20); + } + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Web.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Web.java new file mode 100644 index 000000000..ef7b650ca --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Web.java @@ -0,0 +1,75 @@ +package mineplex.minecraft.game.classcombat.item.Throwable; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.projectile.ProjectileUser; +import mineplex.minecraft.game.classcombat.item.ItemFactory; +import mineplex.minecraft.game.classcombat.item.ItemUsable; + +public class Web extends ItemUsable +{ + public Web(ItemFactory factory, int salesPackageId, Material type, + int amount, boolean canDamage, int creditCost, + ActionType useAction, boolean useStock, long useDelay, + int useEnergy, ActionType throwAction, boolean throwStock, + long throwDelay, int throwEnergy, float throwPower, + long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup) + { + super(factory, salesPackageId, "Web", new String[] { "Thrown:", "Used to trap enemies." }, type, amount, canDamage, creditCost, + useAction, useStock, useDelay, useEnergy, throwAction, throwStock, + throwDelay, throwEnergy, throwPower, + throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup); + } + + @Override + public void UseAction(PlayerInteractEvent event) + { + + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + double distance = UtilMath.offset(target.getLocation(), data.GetThrown().getLocation()); + if (distance > .75) + { + data.GetThrown().teleport(data.GetThrown().getLocation().add(new Vector(0, -distance / 2, 0))); + } + + CreateWeb(data.GetThrown()); + } + + @Override + public void Idle(ProjectileUser data) + { + CreateWeb(data.GetThrown()); + } + + @Override + public void Expire(ProjectileUser data) + { + CreateWeb(data.GetThrown()); + } + + public void CreateWeb(Entity ent) + { + //Effect + ent.getWorld().playEffect(ent.getLocation(), Effect.STEP_SOUND, 30); + + if (!UtilBlock.airFoliage(ent.getLocation().getBlock())) + return; + + Factory.BlockRestore().Add(ent.getLocation().getBlock(), 30, (byte)0, 6000); + + ent.remove(); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Tools/Scanner.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Tools/Scanner.java new file mode 100644 index 000000000..19bbad772 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Tools/Scanner.java @@ -0,0 +1,70 @@ +package mineplex.minecraft.game.classcombat.item.Tools; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.projectile.ProjectileUser; +import mineplex.minecraft.game.classcombat.item.ItemFactory; +import mineplex.minecraft.game.classcombat.item.ItemUsable; + +public class Scanner extends ItemUsable +{ + public Scanner(ItemFactory factory, int salesPackageId, Material type, + int amount, boolean canDamage, int creditCost, + ActionType useAction, boolean useStock, long useDelay, + int useEnergy, ActionType throwAction, boolean throwStock, + long throwDelay, int throwEnergy, float throwPower, + long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup) + { + super(factory, salesPackageId, "Scanner VR-9000", new String[] { "Displays target players skills." }, type, amount, canDamage, creditCost, + useAction, useStock, useDelay, useEnergy, throwAction, throwStock, + throwDelay, throwEnergy, throwPower, + throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup); + } + + @Override + public void UseAction(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + double max = 100; + double cur = 4; + + while (cur < max) + { + for (Player target : UtilPlayer.getNearby(player.getLocation().add(player.getLocation().getDirection().multiply(cur)), 2)) + { + Factory.ClassManager().Get(target).ListSkills(player); + return; + } + + cur += 2; + } + + UtilPlayer.message(player, F.main("Scanner", "There are no targets in range.")); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + + } + + @Override + public void Idle(ProjectileUser data) + { + + } + + @Override + public void Expire(ProjectileUser data) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/repository/ItemRepository.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/repository/ItemRepository.java new file mode 100644 index 000000000..99af649a4 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/repository/ItemRepository.java @@ -0,0 +1,22 @@ +package mineplex.minecraft.game.classcombat.item.repository; + +import java.util.List; + +import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; + +import mineplex.core.server.remotecall.JsonWebCall; + +public class ItemRepository +{ + private String _webAddress; + + public ItemRepository(String webAddress) + { + _webAddress = webAddress; + } + + public List GetItems(List items) + { + return new JsonWebCall(_webAddress + "Dominate/GetItems").Execute(new TypeToken>(){}.getType(), items); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/repository/ItemToken.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/repository/ItemToken.java new file mode 100644 index 000000000..9a819d4b0 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/repository/ItemToken.java @@ -0,0 +1,11 @@ +package mineplex.minecraft.game.classcombat.item.repository; + +import mineplex.core.donation.repository.GameSalesPackageToken; + +public class ItemToken +{ + public String Name; + public String Material; + + public GameSalesPackageToken SalesPackage; +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/itempack/ItemPack.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/itempack/ItemPack.java new file mode 100644 index 000000000..18327588e --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/itempack/ItemPack.java @@ -0,0 +1,30 @@ +package mineplex.minecraft.game.classcombat.itempack; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class ItemPack +{ + private List _items = new ArrayList(9); + + public void AddItem(ItemStack itemStack) + { + _items.add(itemStack); + } + + public void ApplyToPlayer(Player player) + { + for (int i = 0; i < 9; i++) + { + player.getInventory().setItem(i, _items.size() > i ? _items.get(i) : null); + } + } + + public int GetCost() + { + return 1000; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/itempack/ItemPackFactory.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/itempack/ItemPackFactory.java new file mode 100644 index 000000000..5d4ef0772 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/itempack/ItemPackFactory.java @@ -0,0 +1,81 @@ +package mineplex.minecraft.game.classcombat.itempack; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.NautHashMap; +import mineplex.minecraft.game.classcombat.Class.IPvpClass; +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; + +public class ItemPackFactory extends MiniPlugin +{ + private NautHashMap> _classItemPackMap = new NautHashMap>(); + + public ItemPackFactory(JavaPlugin plugin) + { + super("Item Pack Factory", plugin); + + AddItemPacks(); + } + + /* + public List GetItemPacks(IPvpClass pvpClass) + { + + } + */ + + private void AddItemPacks() + { + for (ClassType pvpClassType : ClassType.values()) + _classItemPackMap.put(pvpClassType, new ArrayList()); + + AddAssassin(); + AddBrute(); + AddKnight(); + AddMage(); + AddRanger(); + //AddShifter(); + AddGlobal(); + } + + private void AddGlobal() + { + /* + for (ClassType pvpClassType : ClassType.values()) + _classItemPackMap.get(pvpClassType).add(itemPack); + */ + } + + private void AddRanger() + { + + } + + private void AddMage() + { + // TODO Auto-generated method stub + + } + + private void AddKnight() + { + // TODO Auto-generated method stub + + } + + private void AddBrute() + { + // TODO Auto-generated method stub + + } + + private void AddAssassin() + { + // TODO Auto-generated method stub + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatCustomBuildShop.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatCustomBuildShop.java new file mode 100644 index 000000000..1b361734f --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatCustomBuildShop.java @@ -0,0 +1,14 @@ +package mineplex.minecraft.game.classcombat.shop; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.donation.DonationManager; + +public class ClassCombatCustomBuildShop extends ClassCombatShop +{ + public ClassCombatCustomBuildShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, String name) + { + super(plugin, clientManager, donationManager, name); + + Customizing = true; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatPurchaseShop.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatPurchaseShop.java new file mode 100644 index 000000000..4abcc03cb --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatPurchaseShop.java @@ -0,0 +1,14 @@ +package mineplex.minecraft.game.classcombat.shop; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.donation.DonationManager; + +public class ClassCombatPurchaseShop extends ClassCombatShop +{ + public ClassCombatPurchaseShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, String name) + { + super(plugin, clientManager, donationManager, name); + + Purchasing = true; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java new file mode 100644 index 000000000..bf018fac9 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java @@ -0,0 +1,74 @@ +package mineplex.minecraft.game.classcombat.shop; + +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.ShopBase; +import mineplex.core.shop.page.ShopPageBase; +import mineplex.core.common.CurrencyType; +import mineplex.core.common.util.NautHashMap; +import mineplex.minecraft.game.classcombat.Class.ClientClass; +import mineplex.minecraft.game.classcombat.shop.page.ArmorPage; + +public class ClassCombatShop extends ShopBase +{ + private NautHashMap _inventoryStorage = new NautHashMap(); + private NautHashMap _armorStorage = new NautHashMap(); + + protected boolean Purchasing = false; + protected boolean Customizing = false; + + public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, String name) + { + super(plugin, clientManager, donationManager, name, CurrencyType.Gems); + } + + @Override + protected ShopPageBase BuildPagesFor(Player player) + { + return new ArmorPage(Plugin, this, ClientManager, DonationManager, player, Purchasing); + } + + @Override + protected ShopPageBase> GetOpeningPageForPlayer(Player player) + { + return new ArmorPage(Plugin, this, ClientManager, DonationManager, player, Purchasing); + } + + @Override + protected void OpenShopForPlayer(Player player) + { + if (Purchasing || Customizing) + { + _inventoryStorage.put(player.getName(), player.getInventory().getContents()); + _armorStorage.put(player.getName(), player.getInventory().getArmorContents()); + + player.getInventory().clear(); + player.getInventory().setArmorContents(new ItemStack[4]); + + ((CraftPlayer)player).getHandle().updateInventory(((CraftPlayer)player).getHandle().defaultContainer); + } + } + + @Override + protected void CloseShopForPlayer(Player player) + { + ClientClass clientClass = Plugin.GetClassManager().Get(player); + + if (clientClass != null && clientClass.IsSavingCustomBuild()) + { + clientClass.SaveActiveCustomBuild(); + } + + if (player.isOnline() && (Purchasing || Customizing)) + { + player.getInventory().setContents(_inventoryStorage.get(player.getName())); + player.getInventory().setArmorContents(_armorStorage.get(player.getName())); + } + + ((CraftPlayer)player).getHandle().updateInventory(((CraftPlayer)player).getHandle().defaultContainer); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java new file mode 100644 index 000000000..4b5f72639 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java @@ -0,0 +1,39 @@ +package mineplex.minecraft.game.classcombat.shop; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.minecraft.game.classcombat.Class.ClassManager; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.itempack.ItemPackFactory; + +public class ClassShopManager extends MiniPlugin +{ + private ClassManager _classManager; + private SkillFactory _skillFactory; + private ItemPackFactory _itemPackFactory; + + public ClassShopManager(JavaPlugin plugin, ClassManager classManager, SkillFactory skillFactory, ItemPackFactory itemPackFactory) + { + super("Class Shop Manager", plugin); + + _classManager = classManager; + _skillFactory = skillFactory; + _itemPackFactory = itemPackFactory; + } + + public ClassManager GetClassManager() + { + return _classManager; + } + + public SkillFactory GetSkillFactory() + { + return _skillFactory; + } + + public ItemPackFactory GetItemPackFactory() + { + return _itemPackFactory; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/DeleteCustomBuildButton.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/DeleteCustomBuildButton.java new file mode 100644 index 000000000..bf4587f04 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/DeleteCustomBuildButton.java @@ -0,0 +1,25 @@ +package mineplex.minecraft.game.classcombat.shop.button; + +import org.bukkit.entity.Player; + +import mineplex.core.shop.item.IButton; +import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; +import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage; + +public class DeleteCustomBuildButton implements IButton +{ + private CustomBuildPage _page; + private CustomBuildToken _customBuild; + + public DeleteCustomBuildButton(CustomBuildPage page, CustomBuildToken customBuild) + { + _page = page; + _customBuild = customBuild; + } + + @Override + public void Clicked(Player player) + { + _page.DeleteCustomBuild(_customBuild); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/EditAndDontSaveCustomBuildButton.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/EditAndDontSaveCustomBuildButton.java new file mode 100644 index 000000000..803d2c086 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/EditAndDontSaveCustomBuildButton.java @@ -0,0 +1,25 @@ +package mineplex.minecraft.game.classcombat.shop.button; + +import org.bukkit.entity.Player; + +import mineplex.core.shop.item.IButton; +import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; +import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage; + +public class EditAndDontSaveCustomBuildButton implements IButton +{ + private CustomBuildPage _page; + private CustomBuildToken _customBuild; + + public EditAndDontSaveCustomBuildButton(CustomBuildPage page, CustomBuildToken customBuild) + { + _page = page; + _customBuild = customBuild; + } + + @Override + public void Clicked(Player player) + { + _page.EditAndDontSaveCustomBuild(_customBuild); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/EditAndSaveCustomBuildButton.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/EditAndSaveCustomBuildButton.java new file mode 100644 index 000000000..8066c19bd --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/EditAndSaveCustomBuildButton.java @@ -0,0 +1,25 @@ +package mineplex.minecraft.game.classcombat.shop.button; + +import org.bukkit.entity.Player; + +import mineplex.core.shop.item.IButton; +import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; +import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage; + +public class EditAndSaveCustomBuildButton implements IButton +{ + private CustomBuildPage _page; + private CustomBuildToken _customBuild; + + public EditAndSaveCustomBuildButton(CustomBuildPage page, CustomBuildToken customBuild) + { + _page = page; + _customBuild = customBuild; + } + + @Override + public void Clicked(Player player) + { + _page.EditAndSaveCustomBuild(_customBuild); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/PurchaseSkillButton.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/PurchaseSkillButton.java new file mode 100644 index 000000000..fca186115 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/PurchaseSkillButton.java @@ -0,0 +1,25 @@ +package mineplex.minecraft.game.classcombat.shop.button; + +import mineplex.core.shop.item.IButton; +import mineplex.minecraft.game.classcombat.Skill.ISkill; +import mineplex.minecraft.game.classcombat.shop.page.SkillPage; + +import org.bukkit.entity.Player; + +public class PurchaseSkillButton implements IButton +{ + private SkillPage _page; + private ISkill _skill; + + public PurchaseSkillButton(SkillPage page, ISkill skill) + { + _page = page; + _skill = skill; + } + + @Override + public void Clicked(Player player) + { + _page.PurchaseSkill(player, _skill); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectClassButton.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectClassButton.java new file mode 100644 index 000000000..d8bf649ca --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectClassButton.java @@ -0,0 +1,25 @@ +package mineplex.minecraft.game.classcombat.shop.button; + +import org.bukkit.entity.Player; + +import mineplex.core.shop.item.IButton; +import mineplex.minecraft.game.classcombat.Class.IPvpClass; +import mineplex.minecraft.game.classcombat.shop.page.ArmorPage; + +public class SelectClassButton implements IButton +{ + ArmorPage _page; + private IPvpClass _pvpClass; + + public SelectClassButton(ArmorPage page, IPvpClass pvpClass) + { + _page = page; + _pvpClass = pvpClass; + } + + @Override + public void Clicked(Player player) + { + _page.SelectClass(player, _pvpClass); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectCustomBuildButton.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectCustomBuildButton.java new file mode 100644 index 000000000..68a898776 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectCustomBuildButton.java @@ -0,0 +1,25 @@ +package mineplex.minecraft.game.classcombat.shop.button; + +import org.bukkit.entity.Player; + +import mineplex.core.shop.item.IButton; +import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; +import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage; + +public class SelectCustomBuildButton implements IButton +{ + private CustomBuildPage _page; + private CustomBuildToken _customBuild; + + public SelectCustomBuildButton(CustomBuildPage page, CustomBuildToken customBuild) + { + _page = page; + _customBuild = customBuild; + } + + @Override + public void Clicked(Player player) + { + _page.SelectCustomBuild(_customBuild); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectSkillButton.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectSkillButton.java new file mode 100644 index 000000000..f4464c733 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectSkillButton.java @@ -0,0 +1,25 @@ +package mineplex.minecraft.game.classcombat.shop.button; + +import org.bukkit.entity.Player; + +import mineplex.core.shop.item.IButton; +import mineplex.minecraft.game.classcombat.Skill.ISkill; +import mineplex.minecraft.game.classcombat.shop.page.SkillPage; + +public class SelectSkillButton implements IButton +{ + private SkillPage _page; + private ISkill _skill; + + public SelectSkillButton(SkillPage page, ISkill skill) + { + _page = page; + _skill = skill; + } + + @Override + public void Clicked(Player player) + { + _page.SelectSkill(player, _skill); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/ArmorPage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/ArmorPage.java new file mode 100644 index 000000000..295b7c681 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/ArmorPage.java @@ -0,0 +1,93 @@ +package mineplex.minecraft.game.classcombat.shop.page; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.bukkit.entity.Player; +import org.bukkit.Sound; + +import mineplex.minecraft.game.classcombat.Class.ClientClass; +import mineplex.minecraft.game.classcombat.Class.IPvpClass; +import mineplex.minecraft.game.classcombat.shop.ClassCombatShop; +import mineplex.minecraft.game.classcombat.shop.ClassShopManager; +import mineplex.minecraft.game.classcombat.shop.button.SelectClassButton; +import mineplex.core.account.CoreClientManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.page.ShopPageBase; +import mineplex.core.common.util.C; + +public class ArmorPage extends ShopPageBase +{ + private boolean _purchasing; + + public ArmorPage(ClassShopManager shopManager, ClassCombatShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player, boolean purchasing) + { + super(shopManager, shop, clientManager, donationManager, " Armor", player); + + _purchasing = purchasing; + + BuildPage(); + } + + public void SelectClass(Player player, IPvpClass pvpClass) + { + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, .6f); + + if (_purchasing) + Shop.OpenPageForPlayer(Player, new SkillPage(Plugin, Shop, ClientManager, DonationManager, Player, pvpClass, true)); + else + { + ClientClass clientClass = Plugin.GetClassManager().Get(player); + + player.getInventory().clear(); + + clientClass.SetGameClass(pvpClass); + pvpClass.ApplyArmor(player); + clientClass.ClearDefaults(); + + Shop.OpenPageForPlayer(Player, new CustomBuildPage(Plugin, Shop, ClientManager, DonationManager, player, pvpClass)); + } + } + + @Override + protected void BuildPage() + { + int slot = 9; + + for (IPvpClass gameClass : Plugin.GetClassManager().GetGameClasses()) + { + BuildArmorSelectPackage(gameClass, slot); + + slot += 2; + } + } + + private void BuildArmorSelectPackage(IPvpClass gameClass, int slot) + { + List lockedClassDesc = new ArrayList(); + List unlockedClassDesc = new ArrayList(); + + lockedClassDesc.add(C.cBlack); + unlockedClassDesc.add(C.cBlack); + + lockedClassDesc.addAll(Arrays.asList(gameClass.GetDesc())); + unlockedClassDesc.addAll(Arrays.asList(gameClass.GetDesc())); + + for (int i = 1; i < lockedClassDesc.size(); i++) + { + lockedClassDesc.set(i, C.cGray + lockedClassDesc.get(i)); + } + + for (int i = 1; i < unlockedClassDesc.size(); i++) + { + unlockedClassDesc.set(i, C.cGray + unlockedClassDesc.get(i)); + } + + AddButton(slot, new ShopItem(gameClass.GetHead(), gameClass.GetName(), 1, false), new SelectClassButton(this, gameClass)); + AddButton(slot + 9, new ShopItem(gameClass.GetChestplate(), gameClass.GetName(), 1, false), new SelectClassButton(this, gameClass)); + AddButton(slot + 18, new ShopItem(gameClass.GetLeggings(), gameClass.GetName(), 1, false), new SelectClassButton(this, gameClass)); + AddButton(slot + 27, new ShopItem(gameClass.GetBoots(), gameClass.GetName(), 1, false), new SelectClassButton(this, gameClass)); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/CustomBuildPage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/CustomBuildPage.java new file mode 100644 index 000000000..d306bcac6 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/CustomBuildPage.java @@ -0,0 +1,195 @@ +package mineplex.minecraft.game.classcombat.shop.page; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.minecraft.game.classcombat.Class.ClientClass; +import mineplex.minecraft.game.classcombat.Class.IPvpClass; +import mineplex.minecraft.game.classcombat.Class.event.ClassSetupEvent; +import mineplex.minecraft.game.classcombat.Class.event.ClassSetupEvent.SetupType; +import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; +import mineplex.minecraft.game.classcombat.shop.ClassCombatShop; +import mineplex.minecraft.game.classcombat.shop.ClassShopManager; +import mineplex.minecraft.game.classcombat.shop.button.DeleteCustomBuildButton; +import mineplex.minecraft.game.classcombat.shop.button.EditAndDontSaveCustomBuildButton; +import mineplex.minecraft.game.classcombat.shop.button.EditAndSaveCustomBuildButton; +import mineplex.minecraft.game.classcombat.shop.button.SelectCustomBuildButton; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.page.ShopPageBase; + +public class CustomBuildPage extends ShopPageBase +{ + private IPvpClass _pvpClass; + + protected boolean equipItems = true; + protected boolean equipDefaultArmor = true; + protected boolean saveActiveCustomBuild = false; + + public CustomBuildPage(ClassShopManager shopManager, ClassCombatShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player, IPvpClass pvpClass) + { + super(shopManager, shop, clientManager, donationManager, " Custom Build", player); + _pvpClass = pvpClass; + + BuildPage(); + } + + @Override + protected void BuildPage() + { + int slot = 9; + + for (int i=0; i < 5; i++) + { + byte itemData; + String[] lockedText = new String[] { }; + boolean locked = false; + + switch (i) + { + case 0: + itemData = 1; + break; + case 1: + itemData = 14; + break; + case 2: + itemData = 11; + + if (!Client.GetRank().Has(Rank.ULTRA)) + { + locked = true; + lockedText = new String[] { "§rGet Ultra rank to access this slot" }; + } + break; + case 3: + itemData = 2; + + if (!Client.GetRank().Has(Rank.ULTRA)) + { + locked = true; + lockedText = new String[] { "§rGet Ultra rank to access this slot" }; + } + break; + default: + itemData = 4; + + if (!Client.GetRank().Has(Rank.ULTRA)) + { + locked = true; + lockedText = new String[] { "§rGet Ultra rank to access this slot" }; + } + break; + } + + ClientClass clientClass = Plugin.GetClassManager().Get(Player); + + CustomBuildToken customBuild = clientClass.GetCustomBuilds(_pvpClass).get(i); + + if (customBuild != null) + { + AddButton(slot, new ShopItem(Material.INK_SACK, itemData, customBuild.Name, lockedText, 1, locked, true), new SelectCustomBuildButton(this, customBuild)); + } + else + { + getInventory().setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, locked ? "Locked Build" : "Unsaved Build", lockedText, 1, locked, true).getHandle()); + } + + if (!locked) + { + if (customBuild == null) + { + customBuild = new CustomBuildToken(); + customBuild.CustomBuildNumber = i; + customBuild.Name = "Build " + (i + 1); + customBuild.PvpClassId = _pvpClass.GetSalesPackageId(); + } + + AddButton(slot + 9, new ShopItem(Material.ANVIL, "Edit & Save Build", new String[] { }, 1, locked, true), new EditAndSaveCustomBuildButton(this, customBuild)); + AddButton(slot + 18, new ShopItem(Material.WORKBENCH, "Edit & Don't Save Build", new String[] { }, 1, locked, true), new EditAndDontSaveCustomBuildButton(this, customBuild)); + AddButton(slot + 36, new ShopItem(Material.FIRE, "Delete Build", new String[] { "§rIt will never come back..."}, 1, locked, true), new DeleteCustomBuildButton(this, customBuild)); + } + else + { + getInventory().setItem(slot + 9, new ShopItem(Material.ANVIL, "Edit & Save Build", new String[] { }, 1, locked, true).getHandle()); + getInventory().setItem(slot + 18, new ShopItem(Material.WORKBENCH, "Edit & Don't Save Build", new String[] { }, 1, locked, true).getHandle()); + getInventory().setItem(slot + 36, new ShopItem(Material.FIRE, "Delete Build", new String[] { "§rIt will never come back..."}, 1, locked, true).getHandle()); + } + + slot += 2; + } + } + + public void EditAndSaveCustomBuild(CustomBuildToken customBuild) + { + ClientClass clientClass = Plugin.GetClassManager().Get(Player); + clientClass.SetActiveCustomBuild(_pvpClass, customBuild); + + ClassSetupEvent event = new ClassSetupEvent(Player, SetupType.SaveEditCustomBuild, _pvpClass.GetType(), customBuild.CustomBuildNumber, customBuild); + Plugin.GetPlugin().getServer().getPluginManager().callEvent(event); + + if (event.IsCancelled()) + return; + + clientClass.EquipCustomBuild(customBuild, false); + clientClass.SetSavingCustomBuild(_pvpClass, customBuild); + + Shop.OpenPageForPlayer(Player, new SkillPage(Plugin, Shop, ClientManager, DonationManager, Player, _pvpClass, false)); + } + + public void EditAndDontSaveCustomBuild(CustomBuildToken customBuild) + { + ClientClass clientClass = Plugin.GetClassManager().Get(Player); + clientClass.SetActiveCustomBuild(_pvpClass, customBuild); + + ClassSetupEvent event = new ClassSetupEvent(Player, SetupType.EditCustomBuild, _pvpClass.GetType(), customBuild.CustomBuildNumber + 1, customBuild); + Plugin.GetPlugin().getServer().getPluginManager().callEvent(event); + + if (event.IsCancelled()) + return; + + clientClass.EquipCustomBuild(customBuild, false); + + Shop.OpenPageForPlayer(Player, new SkillPage(Plugin, Shop, ClientManager, DonationManager, Player, _pvpClass, false)); + } + + public void SelectCustomBuild(CustomBuildToken customBuild) + { + ClientClass clientClass = Plugin.GetClassManager().Get(Player); + clientClass.SetActiveCustomBuild(_pvpClass, customBuild); + + ClassSetupEvent event = new ClassSetupEvent(Player, SetupType.ApplyCustomBuild, _pvpClass.GetType(), customBuild.CustomBuildNumber + 1, customBuild); + Plugin.GetPluginManager().callEvent(event); + + if (event.IsCancelled()) + return; + + clientClass.EquipCustomBuild(customBuild); + + if (saveActiveCustomBuild) + clientClass.SetSavingCustomBuild(_pvpClass, customBuild); + + Player.closeInventory(); + } + + @SuppressWarnings("deprecation") + public void DeleteCustomBuild(CustomBuildToken customBuild) + { + ClientClass clientClass = Plugin.GetClassManager().Get(Player); + + //Event + ClassSetupEvent event = new ClassSetupEvent(Player, SetupType.DeleteCustomBuild, _pvpClass.GetType(), customBuild.CustomBuildNumber + 1, customBuild); + Plugin.GetPlugin().getServer().getPluginManager().callEvent(event); + + if (event.IsCancelled()) + return; + + clientClass.GetCustomBuilds(_pvpClass).remove(customBuild.CustomBuildNumber); + + BuildPage(); + Player.updateInventory(); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java new file mode 100644 index 000000000..e76ce68ce --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java @@ -0,0 +1,237 @@ +package mineplex.minecraft.game.classcombat.shop.page; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.CurrencyType; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.page.ConfirmationPage; +import mineplex.core.shop.page.ShopPageBase; +import mineplex.minecraft.game.classcombat.Class.ClientClass; +import mineplex.minecraft.game.classcombat.Class.IPvpClass; +import mineplex.minecraft.game.classcombat.Skill.ISkill; +import mineplex.minecraft.game.classcombat.shop.ClassCombatShop; +import mineplex.minecraft.game.classcombat.shop.ClassShopManager; +import mineplex.minecraft.game.classcombat.shop.button.PurchaseSkillButton; +import mineplex.minecraft.game.classcombat.shop.button.SelectSkillButton; +import mineplex.minecraft.game.classcombat.shop.salespackage.SkillSalesPackage; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class SkillPage extends ShopPageBase +{ + private IPvpClass _pvpClass; + private boolean _purchasing; + + public SkillPage(ClassShopManager plugin, ClassCombatShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player, IPvpClass pvpClass, boolean purchasing) + { + super(plugin, shop, clientManager, donationManager, " Select Skills", player); + + _pvpClass = pvpClass; + _purchasing = purchasing; + + BuildPage(); + } + + public void PlayerClosed() + { + super.PlayerClosed(); + + for (int i = 9; i < 36; i++) + { + Player.getInventory().setItem(i, null); + } + } + + @Override + protected void BuildPage() + { + ButtonMap.clear(); + clear(); + + BuildClassSkills(_pvpClass); + BuildGlobalSkills(); + //BuildItemPacks(); + } + + private void BuildClassSkills(IPvpClass gameClass) + { + getInventory().setItem(0, new ShopItem(Material.IRON_SWORD, "Sword Skills", null, 1, true, true).getHandle()); + getInventory().setItem(9, new ShopItem(Material.IRON_AXE, "Axe Skills", null, 1, true, true).getHandle()); + getInventory().setItem(18, new ShopItem(Material.BOW, "Bow Skills", null, 1, true, true).getHandle()); + getInventory().setItem(27, new ShopItem(Material.INK_SACK, (byte)1, "Class Passive A Skills", null, 1, true, true).getHandle()); + getInventory().setItem(36, new ShopItem(Material.INK_SACK, (byte)14, "Class Passive B Skills", null, 1, true, true).getHandle()); + + int slotNumber = 53; + + int swordSlotNumber = 1; + int axeSlotNumber = 10; + int bowSlotNumber = 19; + int passiveASlotNumber = 28; + int passiveBSlotNumber = 37; + + for (ISkill skill : Plugin.GetSkillFactory().GetSkillsFor(gameClass)) + { + switch (skill.GetSkillType()) + { + case Sword: + slotNumber = swordSlotNumber; + swordSlotNumber++; + break; + case Axe: + slotNumber = axeSlotNumber; + axeSlotNumber++; + break; + case Bow: + slotNumber = bowSlotNumber; + bowSlotNumber++; + break; + case PassiveA: + slotNumber = passiveASlotNumber; + passiveASlotNumber++; + break; + case PassiveB: + slotNumber = passiveBSlotNumber; + passiveBSlotNumber++; + break; + + default: + continue; + } + + BuildSkillItem(skill, slotNumber); + } + } + + private void BuildGlobalSkills() + { + getInventory().setItem(45, new ShopItem(Material.INK_SACK, (byte)11, "Global Passive Skills", null, 1, true, true).getHandle()); + + int slotNumber = 46; + + for (ISkill skill : Plugin.GetSkillFactory().GetGlobalSkills()) + { + BuildSkillItem(skill, slotNumber++); + } + } + + protected void BuildSkillItem(ISkill skill, int slotNumber) + { + List skillLore = new ArrayList(); + + if (_purchasing) + { + skillLore.add(C.cYellow + skill.GetCost() + " Gems"); + skillLore.add(C.cBlack); + } + + skillLore.addAll(Arrays.asList(skill.GetDesc())); + + for (int i = 0; i < skillLore.size(); i++) + { + skillLore.set(i, C.cGray + skillLore.get(i)); + } + + boolean locked = !skill.IsFree() && !DonationManager.Get(Player.getName()).Owns(skill.GetSalesPackageId()) && !Client.GetRank().Has(Rank.ULTRA); + ShopItem skillItem = new ShopItem(locked ? Material.BOOK_AND_QUILL : ((skill.GetUsers().contains(Player) || _purchasing) ? Material.WRITTEN_BOOK : Material.BOOK), (locked ? ChatColor.RED + skill.GetName() + " (Locked)" : skill.GetName()), skillLore.toArray(new String[skillLore.size()]), 1, locked, true); + + if (_purchasing) + { + if (locked) + AddButton(slotNumber, skillItem, new PurchaseSkillButton(this, skill)); + else + AddItem(slotNumber, skillItem); + } + else + { + if (locked) + AddItem(slotNumber, skillItem); + else + AddButton(slotNumber, skillItem, new SelectSkillButton(this, skill)); + } + } + + /* + private void BuildItemPacks() + { + Player.getInventory().setItem(18, new ShopItem(Material.WORKBENCH, (byte)11, "Item packs", null, 1, true, true)); + + int slotNumber = 19; + + for (ItemPack item : Plugin.GetItemPackFactory().GetItemPacks(_pvpClass)) + { + BuildItemPack(item, slotNumber++); + } + } + + private void BuildItemPack(ItemPack itemPack, int slotNumber) + { + List skillLore = new ArrayList(); + + if (_purchasing) + { + skillLore.add(C.cYellow + itemPack.GetCost() + " Gems"); + skillLore.add(C.cBlack); + } + + skillLore.addAll(Arrays.asList(itemPack.GetDesc())); + + for (int i = 0; i < skillLore.size(); i++) + { + skillLore.set(i, C.cGray + skillLore.get(i)); + } + + boolean locked = !itemPack.IsFree() && !DonationManager.Get(Player.getName()).OwnsUnknownPackage("Competitive itempack " + itemPack.GetName()) && !Client.GetRank().Has(Rank.ULTRA); + ShopItem skillItem = new ShopItem(locked ? Material.BOOK_AND_QUILL : ((skill.GetUsers().contains(Player) || _purchasing) ? Material.WRITTEN_BOOK : Material.BOOK), (locked ? ChatColor.RED + skill.GetName() + " (Locked)" : skill.GetName()), skillLore.toArray(new String[skillLore.size()]), 1, locked, true); + + if (_purchasing) + { + if (locked) + AddButton(slotNumber, skillItem, new PurchaseItemPackButton(this, itemPack)); + else + AddItem(slotNumber, skillItem); + } + else + { + if (locked) + AddItem(slotNumber, skillItem); + else + AddButton(slotNumber, skillItem, new SelectItemPackButton(this, itemPack)); + } + } +*/ + public void SelectSkill(Player player, ISkill skill) + { + ClientClass clientClass = Plugin.GetClassManager().Get(player); + ISkill existingSkill = clientClass.GetSkillByType(skill.GetSkillType()); + + if (existingSkill != null) + { + clientClass.RemoveSkill(existingSkill); + } + + clientClass.AddSkill(skill); + + PlayAcceptSound(player); + + BuildPage(); + } + + public void PurchaseSkill(Player player, ISkill skill) + { + Shop.OpenPageForPlayer(player, new ConfirmationPage(Plugin, Shop, ClientManager, DonationManager, new Runnable() + { + public void run() + { + BuildPage(); + } + }, this, new SkillSalesPackage(skill), CurrencyType.Gems, player)); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.java new file mode 100644 index 000000000..4339e584e --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.java @@ -0,0 +1,24 @@ +package mineplex.minecraft.game.classcombat.shop.salespackage; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.common.CurrencyType; +import mineplex.core.shop.item.SalesPackageBase; +import mineplex.minecraft.game.classcombat.Skill.ISkill; + +public class SkillSalesPackage extends SalesPackageBase +{ + public SkillSalesPackage(ISkill skill) + { + super(skill.GetName(), Material.BOOK, skill.GetDesc()); + SalesPackageId = skill.GetSalesPackageId(); + Free = skill.IsFree(); + } + + @Override + public void Sold(Player player, CurrencyType currencyType) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/.classpath b/Plugins/Mineplex.Minecraft.Game.Core/.classpath new file mode 100644 index 000000000..94c68654f --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/Plugins/Mineplex.Minecraft.Game.Core/.project b/Plugins/Mineplex.Minecraft.Game.Core/.project new file mode 100644 index 000000000..0e7e5acdb --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/.project @@ -0,0 +1,17 @@ + + + Mineplex.Minecraft.Game.Core + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Mineplex.Minecraft.Game.Core/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.Minecraft.Game.Core/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7341ab168 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/IRelation.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/IRelation.class new file mode 100644 index 000000000..07a0c76bc Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/IRelation.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/ClientCombat.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/ClientCombat.class new file mode 100644 index 000000000..569170348 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/ClientCombat.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/CombatComponent.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/CombatComponent.class new file mode 100644 index 000000000..b1c832871 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/CombatComponent.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/CombatDamage.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/CombatDamage.class new file mode 100644 index 000000000..49e653a2c Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/CombatDamage.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/CombatLog.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/CombatLog.class new file mode 100644 index 000000000..91a9fecb7 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/CombatLog.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/CombatManager.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/CombatManager.class new file mode 100644 index 000000000..5ecc606d6 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/CombatManager.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/event/ClearCombatEvent.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/event/ClearCombatEvent.class new file mode 100644 index 000000000..8a8937680 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/event/ClearCombatEvent.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/event/CombatDeathEvent.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/event/CombatDeathEvent.class new file mode 100644 index 000000000..be8d49a2c Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/event/CombatDeathEvent.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/itemstack/Stats.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/itemstack/Stats.class new file mode 100644 index 000000000..ec09c4067 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/combat/itemstack/Stats.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/Condition$ConditionType.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/Condition$ConditionType.class new file mode 100644 index 000000000..1eaddbc90 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/Condition$ConditionType.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/Condition.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/Condition.class new file mode 100644 index 000000000..1346caea9 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/Condition.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/ConditionApplicator.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/ConditionApplicator.class new file mode 100644 index 000000000..799086194 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/ConditionApplicator.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/ConditionEffect.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/ConditionEffect.class new file mode 100644 index 000000000..683e2f6db Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/ConditionEffect.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/ConditionFactory.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/ConditionFactory.class new file mode 100644 index 000000000..87996de73 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/ConditionFactory.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/ConditionIndicator.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/ConditionIndicator.class new file mode 100644 index 000000000..5ee22b8c0 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/ConditionIndicator.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/ConditionManager.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/ConditionManager.class new file mode 100644 index 000000000..278e9067e Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/ConditionManager.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/conditions/Burning.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/conditions/Burning.class new file mode 100644 index 000000000..2934a8d8a Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/conditions/Burning.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/conditions/Cloak.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/conditions/Cloak.class new file mode 100644 index 000000000..9a5601ae2 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/conditions/Cloak.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/conditions/FireItemImmunity.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/conditions/FireItemImmunity.class new file mode 100644 index 000000000..170c62a3d Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/conditions/FireItemImmunity.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/conditions/Silence.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/conditions/Silence.class new file mode 100644 index 000000000..597c8421a Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/conditions/Silence.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/conditions/Vulnerability.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/conditions/Vulnerability.class new file mode 100644 index 000000000..adae9317f Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/conditions/Vulnerability.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/events/ConditionApplyEvent.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/events/ConditionApplyEvent.class new file mode 100644 index 000000000..e80922755 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/condition/events/ConditionApplyEvent.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/damage/CustomDamageEvent.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/damage/CustomDamageEvent.class new file mode 100644 index 000000000..68718ad7e Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/damage/CustomDamageEvent.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/damage/DamageChange.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/damage/DamageChange.class new file mode 100644 index 000000000..d0a7bb2b5 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/damage/DamageChange.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/damage/DamageManager.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/damage/DamageManager.class new file mode 100644 index 000000000..495b41c99 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/damage/DamageManager.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/damage/DamageManager.java.orig b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/damage/DamageManager.java.orig new file mode 100644 index 000000000..c069159dc --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/damage/DamageManager.java.orig @@ -0,0 +1,505 @@ +package mineplex.minecraft.game.core.damage; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilGear; +import mineplex.core.npc.NpcManager; +import mineplex.minecraft.game.core.combat.CombatManager; +import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener; +import net.minecraft.server.v1_6_R2.DamageSource; +import net.minecraft.server.v1_6_R2.EntityHuman; +import net.minecraft.server.v1_6_R2.EntityLiving; + +import org.bukkit.EntityEffect; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity; +import org.bukkit.entity.Fish; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class DamageManager extends MiniPlugin +{ + private CombatManager _combatManager; + protected Field _lastDamageByPlayerTime; + protected Method _k; + + public boolean UseDefaultWeaponDamage = false; + + public DamageManager(JavaPlugin plugin, CombatManager combatManager, NpcManager npcManager) + { + super("Damage Manager", plugin); + + _combatManager = combatManager; + + try + { + _lastDamageByPlayerTime = EntityLiving.class.getDeclaredField("lastDamageByPlayerTime"); + _lastDamageByPlayerTime.setAccessible(true); + _k = EntityLiving.class.getDeclaredMethod("h", float.class); + _k.setAccessible(true); + } + catch (final Exception e) + { + System.out.println("Problem getting access to EntityLiving: " + e.getMessage()); + } + + RegisterEvents(new NpcProtectListener(npcManager)); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void StartDamageEvent(EntityDamageEvent event) + { + boolean preCancel = false; + if (event.isCancelled()) + preCancel = true; + + if (!(event.getEntity() instanceof LivingEntity)) + return; + + //Get Data + LivingEntity damagee = GetDamageeEntity(event); + LivingEntity damager = GetDamagerEntity(event, true); + Projectile projectile = GetProjectile(event); + + if (projectile instanceof Fish) + return; + + //Pre-Event Modifications + WeaponDamage(event, damager); + + //New Event + NewDamageEvent(damagee, damager, projectile, event.getCause(), event.getDamage(), true, false, false, null, null, preCancel); + + //event.setDamage(0); + //if (GoldPower(damager)) + event.setCancelled(true); + } + + /* + private boolean GoldPower(LivingEntity damager) + { + try + { + Player player = (Player)damager; + if (!Util().Gear().isGold(player.getItemInHand())) + return false; + + if (!player.getInventory().contains(Material.GOLD_NUGGET)) + return false; + + UtilInv.remove(player, Material.GOLD_NUGGET, (byte)0, 1); + return true; + } + catch (Exception e) + { + return false; + } + } + */ + + public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, + DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, + String source, String reason) + { + NewDamageEvent(damagee, damager, proj, + cause, damage, knockback, ignoreRate, ignoreArmor, + source, reason, false); + } + + public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, + DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, + String source, String reason, boolean cancelled) + { + _plugin.getServer().getPluginManager().callEvent( + new CustomDamageEvent(damagee, damager, proj, cause, damage, + knockback, ignoreRate, ignoreArmor, + source, reason, cancelled)); + } + + @EventHandler(priority = EventPriority.LOW) + public void CancelDamageEvent(CustomDamageEvent event) + { + if (event.GetDamageeEntity().getHealth() <= 0) + { + event.SetCancelled("0 Health"); + return; + } + + if (event.GetDamageePlayer() != null) + { + Player damagee = event.GetDamageePlayer(); + + //Not Survival + if (damagee.getGameMode() != GameMode.SURVIVAL) + { + event.SetCancelled("Damagee in Creative"); + return; + } + + //Limit World Damage Rate + if (!event.IgnoreRate()) + { + if (!_combatManager.Get(damagee.getName()).CanBeHurtBy(event.GetDamagerEntity(true))) + { + event.SetCancelled("Damage Rate"); + return; + } + } + } + + if (event.GetDamagerPlayer(true) != null) + { + Player damager = event.GetDamagerPlayer(true); + + //Not Survival + if (damager.getGameMode() != GameMode.SURVIVAL) + { + event.SetCancelled("Damager in Creative"); + return; + } + + //Damage Rate + if (!event.IgnoreRate()) + if (!_combatManager.Get(damager.getName()).CanHurt(event.GetDamageeEntity())) + { + event.SetCancelled("Damage Rate"); + return; + } + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void EndDamageEvent(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetDamage() < 1) + return; + + Damage(event); + } + + private void Damage(CustomDamageEvent event) + { + if (event.GetDamageeEntity().getHealth() <= 0) + return; + + //Player Conditions + if (event.GetDamageePlayer() != null) + { + //Register Damage (must happen before damage) + _combatManager.AddAttack(event); + } + + if (event.GetDamagerPlayer(true) != null) + { + //Display Damage to Damager + if (event.GetCause() != DamageCause.THORNS) + event.GetDamagerPlayer(true).setLevel((int)event.GetDamage()); + } + + try + { + int bruteBonus = 0; + if (event.IsBrute() && + ( + event.GetCause() == DamageCause.ENTITY_ATTACK || + event.GetCause() == DamageCause.PROJECTILE || + event.GetCause() == DamageCause.CUSTOM + ) && event.GetDamage() > 2) + bruteBonus = 10; + + //Do Damage + HandleDamage(event.GetDamageeEntity(), event.GetDamagerEntity(true), event.GetCause(), (int)event.GetDamage() + bruteBonus, event.IgnoreArmor()); + + //Effect + event.GetDamageeEntity().playEffect(EntityEffect.HURT); + + //Knockback + double knockback = event.GetDamage(); + if (knockback < 1) knockback = 1; + knockback = Math.log10(knockback); + + for (double cur : event.GetKnockback().values()) + knockback = knockback * cur; + + if (event.IsKnockback()) + if (event.GetDamagerEntity(true) != null) + { + Vector trajectory = UtilAlg.getTrajectory2d(event.GetDamagerEntity(true), event.GetDamageeEntity()); + trajectory.multiply(0.6 * knockback); + trajectory.setY(Math.abs(trajectory.getY())); + + UtilAction.velocity(event.GetDamageeEntity(), + trajectory, 0.2 + trajectory.length() * 0.8, false, 0, Math.abs(0.2 * knockback), 0.4 + (0.04 * knockback), true); + } + + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (InvocationTargetException e) + { + e.printStackTrace(); + } + } + + private void HandleDamage(LivingEntity damagee, LivingEntity damager, DamageCause cause, float damage, boolean ignoreArmor) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException + { + EntityLiving entityDamagee = ((CraftLivingEntity)damagee).getHandle(); + EntityLiving entityDamager = null; + if (damager != null) + entityDamager= ((CraftLivingEntity)damager).getHandle(); + + entityDamagee.aG = 1.5F; + + if ((float) entityDamagee.noDamageTicks > (float) entityDamagee.maxNoDamageTicks / 2.0F) + { + if (damage <= entityDamagee.lastDamage) + { + return; + } + + ApplyDamage(entityDamagee, damage - entityDamagee.lastDamage, ignoreArmor); + entityDamagee.lastDamage = damage; + } + else + { + entityDamagee.lastDamage = damage; + entityDamagee.ax = entityDamagee.getHealth(); + //entityDamagee.noDamageTicks = entityDamagee.maxNoDamageTicks; + ApplyDamage(entityDamagee, damage, ignoreArmor); + //entityDamagee.hurtTicks = entityDamagee.aW = 10; + } + + if (entityDamager != null) + entityDamagee.b(entityDamager); + + _lastDamageByPlayerTime.setInt(entityDamagee, 60); + + if (entityDamager != null) + if (entityDamager instanceof EntityHuman) + entityDamagee.killer = (EntityHuman)entityDamager; + + if (entityDamagee.getHealth() <= 0) + { + if (entityDamager != null) + { + if (entityDamager instanceof EntityHuman) entityDamagee.die(DamageSource.playerAttack((EntityHuman)entityDamager)); + else if (entityDamager instanceof EntityLiving) entityDamagee.die(DamageSource.mobAttack((EntityLiving)entityDamager)); + else entityDamagee.die(DamageSource.GENERIC); + } + else + entityDamagee.die(DamageSource.GENERIC); + } + } + + @EventHandler + public void DamageSound(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK && event.GetCause() != DamageCause.PROJECTILE) + return; + + //Damagee + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + //Sound + Sound sound = Sound.HURT_FLESH; + float vol = 1f; + float pitch = 1f; + + //Armor Sound + if (damagee instanceof Player) + { + Player player = (Player)damagee; + + double r = Math.random(); + + ItemStack stack = null; + + if (r > 0.50) stack = player.getInventory().getChestplate(); + else if (r > 0.25) stack = player.getInventory().getLeggings(); + else if (r > 0.10) stack = player.getInventory().getHelmet(); + else stack = player.getInventory().getBoots(); + + if (stack != null) + { + if (stack.getType().toString().contains("LEATHER_")) + { + sound = Sound.SHOOT_ARROW; + pitch = 2f; + } + else if (stack.getType().toString().contains("CHAINMAIL_")) + { + sound = Sound.ITEM_BREAK; + pitch = 1.4f; + } + else if (stack.getType().toString().contains("GOLD_")) + { + sound = Sound.ITEM_BREAK; + pitch = 1.8f; + } + else if (stack.getType().toString().contains("IRON_")) + { + sound = Sound.BLAZE_HIT; + pitch = 0.7f; + } + else if (stack.getType().toString().contains("DIAMOND_")) + { + sound = Sound.BLAZE_HIT; + pitch = 0.9f; + } + } + } + //Animal Sound + else + { + UtilEnt.PlayDamageSound(damagee); + } + + damagee.getWorld().playSound(damagee.getLocation(), sound, vol, pitch); + } + + private void ApplyDamage(EntityLiving entityLiving, float damage, boolean ignoreArmor) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException + { + if (!ignoreArmor) + { + int j = 25 - entityLiving.aP(); + float k = damage * (float)j; + + _k.invoke(entityLiving, damage); + damage = k / 25.0f; + } + + /** + if (entityLiving.hasEffect(MobEffectList.RESISTANCE)) + { + int j = (entityLiving.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5; + int k = 25 - j; + int l = damage * k + _aS.getInt(entityLiving); + + damage = l / 25; + _aS.setInt(entityLiving, l % 25); + } + **/ + + entityLiving.setHealth(entityLiving.getHealth() - damage); + } + + private void WeaponDamage(EntityDamageEvent event, LivingEntity ent) + { + + + if (!(ent instanceof Player)) + return; + + if (event.getCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = (Player)ent; + + if (UseDefaultWeaponDamage) + { + if (event.getDamage() > 1) + event.setDamage(event.getDamage() - 1); + + if (damager.getItemInHand().getType().name().contains("GOLD_")) + event.setDamage(event.getDamage() + 3); + + return; + } + + if (damager.getItemInHand() == null || !UtilGear.isWeapon(damager.getItemInHand())) + { + event.setDamage(1); + return; + } + + Material mat = damager.getItemInHand().getType(); + + int damage = 6; + + if (mat.name().contains("WOOD")) damage -= 3; + else if (mat.name().contains("STONE")) damage -= 2; + else if (mat.name().contains("DIAMOND")) damage += 0; + else if (mat.name().contains("GOLD")) damage += 1; + + event.setDamage(damage); + } + + private LivingEntity GetDamagerEntity(EntityDamageEvent event, boolean ranged) + { + if (!(event instanceof EntityDamageByEntityEvent)) + return null; + + EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent)event; + + //Get Damager + if (eventEE.getDamager() instanceof LivingEntity) + return (LivingEntity)eventEE.getDamager(); + + if (!ranged) + return null; + + if (!(eventEE.getDamager() instanceof Projectile)) + return null; + + Projectile projectile = (Projectile)eventEE.getDamager(); + + if (projectile.getShooter() == null) + return null; + + if (!(projectile.getShooter() instanceof LivingEntity)) + return null; + + return (LivingEntity)projectile.getShooter(); + } + + private LivingEntity GetDamageeEntity(EntityDamageEvent event) + { + if (event.getEntity() instanceof LivingEntity) + return (LivingEntity)event.getEntity(); + + return null; + } + + private Projectile GetProjectile(EntityDamageEvent event) + { + if (!(event instanceof EntityDamageByEntityEvent)) + return null; + + EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent)event; + + if (eventEE.getDamager() instanceof Projectile) + return (Projectile)eventEE.getDamager(); + + return null; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/damage/compatibility/NpcProtectListener.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/damage/compatibility/NpcProtectListener.class new file mode 100644 index 000000000..4dd397602 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/damage/compatibility/NpcProtectListener.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/fire/Fire.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/fire/Fire.class new file mode 100644 index 000000000..0b4798c00 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/fire/Fire.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/fire/FireData.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/fire/FireData.class new file mode 100644 index 000000000..774102538 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/fire/FireData.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/mechanics/PistonJump$1.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/mechanics/PistonJump$1.class new file mode 100644 index 000000000..8a6276c07 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/mechanics/PistonJump$1.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/mechanics/PistonJump.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/mechanics/PistonJump.class new file mode 100644 index 000000000..876bafe54 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/mechanics/PistonJump.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/mechanics/Weapon.class b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/mechanics/Weapon.class new file mode 100644 index 000000000..9a25d9c05 Binary files /dev/null and b/Plugins/Mineplex.Minecraft.Game.Core/bin/mineplex/minecraft/game/core/mechanics/Weapon.class differ diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/IRelation.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/IRelation.java new file mode 100644 index 000000000..9c09c5b95 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/IRelation.java @@ -0,0 +1,10 @@ +package mineplex.minecraft.game.core; + +import org.bukkit.entity.Player; + +public interface IRelation +{ + public boolean CanHurt(Player a, Player b); + public boolean CanHurt(String a, String b); + public boolean IsSafe(Player a); +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/ClientCombat.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/ClientCombat.java new file mode 100644 index 000000000..f87eaed48 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/ClientCombat.java @@ -0,0 +1,65 @@ +package mineplex.minecraft.game.core.combat; + +import java.util.LinkedList; +import java.util.WeakHashMap; + +import org.bukkit.entity.LivingEntity; + +public class ClientCombat +{ + private LinkedList _kills = new LinkedList(); + private LinkedList _assists = new LinkedList(); + private LinkedList _deaths = new LinkedList(); + + private WeakHashMap _lastHurt = new WeakHashMap(); + private long _lastHurtByOther = 0; + + public LinkedList GetKills() + { + return _kills; + } + + public LinkedList GetAssists() + { + return _assists; + } + + public LinkedList GetDeaths() + { + return _deaths; + } + + public boolean CanBeHurtBy(LivingEntity damager) + { + if (damager != null) + return true; + + if (System.currentTimeMillis() - _lastHurtByOther > 250) + { + _lastHurtByOther = System.currentTimeMillis(); + return true; + } + + return false; + } + + public boolean CanHurt(LivingEntity damagee) + { + if (damagee == null) + return true; + + if (!_lastHurt.containsKey(damagee)) + { + _lastHurt.put(damagee, System.currentTimeMillis()); + return true; + } + + if (System.currentTimeMillis() - _lastHurt.get(damagee) > 400) + { + _lastHurt.put(damagee, System.currentTimeMillis()); + return true; + } + + return false; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatComponent.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatComponent.java new file mode 100644 index 000000000..46af36a0a --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatComponent.java @@ -0,0 +1,119 @@ +package mineplex.minecraft.game.core.combat; + +import java.util.HashMap; +import java.util.LinkedList; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; + +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; + +public class CombatComponent +{ + private boolean _player = false; + + private LinkedList _damage; + + protected String EntityName; + protected long LastDamage = 0; + + public CombatComponent(String name, LivingEntity ent) + { + EntityName = name; + + if (ent != null) + { + if (ent instanceof Player) + { + _player = true; + } + } + } + + public void AddDamage(String source, double dmg) + { + if (source == null) + source = "-"; + + GetDamage().addFirst(new CombatDamage(source, dmg)); + LastDamage = System.currentTimeMillis(); + } + + public String GetName() + { + if (EntityName.equals("Null")) + return "World"; + + return EntityName; + } + + public LinkedList GetDamage() + { + if (_damage == null) + _damage = new LinkedList(); + + return _damage; + } + + public long GetLastDamage() + { + return LastDamage; + } + + public int GetTotalDamage() + { + int total = 0; + for (CombatDamage cur : GetDamage()) + total += cur.GetDamage(); + return total; + } + + public String GetBestWeapon() + { + HashMap cumulative = new HashMap(); + String weapon = null; + int best = 0; + for (CombatDamage cur : _damage) + { + int dmg = 0; + if (cumulative.containsKey(cur.GetName())) + dmg = cumulative.get(cur.GetName()); + + cumulative.put(cur.GetName(), dmg); + + if (dmg >= best) + weapon = cur.GetName(); + } + + return weapon; + } + + public String Display(long _deathTime) + { + // Time + String time = ""; + if (_deathTime == 0) + time = UtilTime.convertString(System.currentTimeMillis() + - LastDamage, 1, TimeUnit.FIT) + + " Ago"; + else + time = UtilTime.convertString(_deathTime - LastDamage, 1, + TimeUnit.FIT) + " Prior"; + + return F.name(EntityName) + " [" + + F.elem(GetTotalDamage() + "dmg") + "" + "] [" + + F.elem(GetBestWeapon()) + "] [" + F.time(time) + "]"; + } + + public boolean IsPlayer() + { + return _player; + } + + public String GetLastDamageSource() + { + return _damage.getFirst().GetName(); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatDamage.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatDamage.java new file mode 100644 index 000000000..34b060d90 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatDamage.java @@ -0,0 +1,23 @@ +package mineplex.minecraft.game.core.combat; + +public class CombatDamage +{ + private String _name; + private double _dmg; + + public CombatDamage(String name, double dmg) + { + _name = name; + _dmg = dmg; + } + + public String GetName() + { + return _name; + } + + public double GetDamage() + { + return _dmg; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatLog.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatLog.java new file mode 100644 index 000000000..666feb91b --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatLog.java @@ -0,0 +1,166 @@ +package mineplex.minecraft.game.core.combat; + +import java.util.LinkedList; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilTime; + +import org.bukkit.ChatColor; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; + +public class CombatLog +{ + private LinkedList _damager = new LinkedList(); + private CombatComponent _player; + private long _expireTime; + + private long _deathTime = 0; + private CombatComponent _killer; + private int _assistants; + + private String _killedColor = ChatColor.YELLOW + ""; + private String _killerColor = ChatColor.YELLOW + ""; + + protected CombatComponent LastDamager; + public long LastDamaged; + public long LastCombat; + + public CombatLog(Player player, long expireTime) + { + _expireTime = expireTime; + _player = new CombatComponent(player.getName(), player); + } + + public LinkedList GetAttackers() + { + return _damager; + } + + public CombatComponent GetPlayer() + { + return _player; + } + + public void Attacked(String damagerName, double damage, + LivingEntity damagerEnt, String attackName) + { + // Add Attacked + CombatComponent comp = GetEnemy(damagerName, damagerEnt); + + comp.AddDamage(attackName, damage); + + // Set Last + LastDamager = comp; + LastDamaged = System.currentTimeMillis(); + LastCombat = System.currentTimeMillis(); + } + + public CombatComponent GetEnemy(String name, LivingEntity ent) + { + ExpireOld(); + + CombatComponent component = null; + for (CombatComponent cur : _damager) + { + if (cur.GetName().equals(name)) + component = cur; + } + + // Player has attacked in past + if (component != null) + { + _damager.remove(component); + _damager.addFirst(component); + return _damager.getFirst(); + } + + _damager.addFirst(new CombatComponent(name, ent)); + return _damager.getFirst(); + } + + public void ExpireOld() + { + int expireFrom = -1; + for (int i = 0; i < _damager.size(); i++) + { + if (UtilTime.elapsed(_damager.get(i).GetLastDamage(), _expireTime)) + { + expireFrom = i; + break; + } + } + + if (expireFrom != -1) + while (_damager.size() > expireFrom) + _damager.remove(expireFrom); + } + + public LinkedList Display() + { + LinkedList out = new LinkedList(); + + for (int i = 0; i < 8; i++) + { + if (i < _damager.size()) + out.add(F.desc("#" + i, _damager.get(i).Display(_deathTime))); + } + + return out; + } + + public CombatComponent GetKiller() + { + return _killer; + } + + public void SetKiller(CombatComponent killer) + { + _killer = killer; + } + + public int GetAssists() + { + return _assistants; + } + + public void SetAssists(int assistants) + { + _assistants = assistants; + } + + public CombatComponent GetLastDamager() + { + return LastDamager; + } + + public long GetDeathTime() + { + return _deathTime; + } + + public void SetDeathTime(long deathTime) + { + _deathTime = deathTime; + } + + public String GetKilledColor() + { + return _killedColor; + } + + public void SetKilledColor(String color) + { + _killedColor = color; + } + + public String GetKillerColor() + { + return _killerColor; + } + + public void SetKillerColor(String color) + { + _killerColor = color; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java new file mode 100644 index 000000000..d948638ad --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java @@ -0,0 +1,430 @@ +package mineplex.minecraft.game.core.combat; + +import java.util.HashSet; +import java.util.Iterator; + +import net.minecraft.server.v1_6_R2.ItemStack; + +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Fireball; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.account.event.ClientUnloadEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.core.combat.event.ClearCombatEvent; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +public class CombatManager extends MiniPlugin +{ + private NautHashMap _active = new NautHashMap(); + private NautHashMap _combatClients = new NautHashMap(); + + private HashSet _removeList = new HashSet(); + + protected long ExpireTime = 15000; + + public CombatManager(JavaPlugin plugin) + { + super("Combat", plugin); + } + + @EventHandler + public void UnloadDonor(ClientUnloadEvent event) + { + _combatClients.remove(event.GetName()); + } + + public ClientCombat Get(String name) + { + if (!_combatClients.containsKey(name)) + _combatClients.put(name, new ClientCombat()); + + return _combatClients.get(name); + } + + public void AddAttack(CustomDamageEvent event) + { + // Not Player > No Log + if (event.GetDamageePlayer() == null) + return; + + // Damager is ENTITY + if (event.GetDamagerEntity(true) != null) + { + String reason = event.GetReason(); + + if (reason == null) + { + if (event.GetDamagerPlayer(false) != null) + { + Player damager = event.GetDamagerPlayer(false); + + reason = "Fists"; + + if (damager.getItemInHand() != null) + { + ItemStack itemStack = CraftItemStack.asNMSCopy(damager + .getItemInHand()); + + if (itemStack != null) + { + reason = CraftItemStack.asNMSCopy( + damager.getItemInHand()).getName(); + } + } + } else if (event.GetProjectile() != null) + { + if (event.GetProjectile() instanceof Arrow) + reason = "Archery"; + else if (event.GetProjectile() instanceof Fireball) + reason = "Fireball"; + } + } + + if (event.GetDamagerEntity(true) instanceof Player) + Get((Player)event.GetDamagerEntity(true)).LastCombat = System.currentTimeMillis(); + + Get(event.GetDamageePlayer()).Attacked( + UtilEnt.getName(event.GetDamagerEntity(true)), + (int) event.GetDamage(), event.GetDamagerEntity(true), + reason); + } + // Damager is WORLD + else + { + DamageCause cause = event.GetCause(); + + String source = "?"; + String reason = "-"; + + if (cause == DamageCause.BLOCK_EXPLOSION) + { + source = "Explosion"; + reason = "-"; + } else if (cause == DamageCause.CONTACT) + { + source = "Cactus"; + reason = "-"; + } else if (cause == DamageCause.CUSTOM) + { + source = "Custom"; + reason = "-"; + } else if (cause == DamageCause.DROWNING) + { + source = "Water"; + reason = "-"; + } else if (cause == DamageCause.ENTITY_ATTACK) + { + source = "Entity"; + reason = "Attack"; + } else if (cause == DamageCause.ENTITY_EXPLOSION) + { + source = "Explosion"; + reason = "-"; + } else if (cause == DamageCause.FALL) + { + source = "Fall"; + reason = "-"; + } else if (cause == DamageCause.FALLING_BLOCK) + { + source = "Falling Block"; + reason = "-"; + } else if (cause == DamageCause.FIRE) + { + source = "Fire"; + reason = "-"; + } else if (cause == DamageCause.FIRE_TICK) + { + source = "Fire"; + reason = "-"; + } else if (cause == DamageCause.LAVA) + { + source = "Lava"; + reason = "-"; + } else if (cause == DamageCause.LIGHTNING) + { + source = "Lightning"; + reason = "-"; + } else if (cause == DamageCause.MAGIC) + { + source = "Magic"; + reason = "-"; + } else if (cause == DamageCause.MELTING) + { + source = "Melting"; + reason = "-"; + } else if (cause == DamageCause.POISON) + { + source = "Poison"; + reason = "-"; + } else if (cause == DamageCause.PROJECTILE) + { + source = "Projectile"; + reason = "-"; + } else if (cause == DamageCause.STARVATION) + { + source = "Starvation"; + reason = "-"; + } else if (cause == DamageCause.SUFFOCATION) + { + source = "Suffocation"; + reason = "-"; + } else if (cause == DamageCause.SUICIDE) + { + source = "Suicide"; + reason = "-"; + } else if (cause == DamageCause.VOID) + { + source = "Void"; + reason = "-"; + } else if (cause == DamageCause.WITHER) + { + source = "Wither"; + reason = "-"; + } + + Get(event.GetDamageePlayer()).Attacked(source, + (int) event.GetDamage(), null, reason); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void HandleDeath(PlayerDeathEvent event) + { + event.setDeathMessage(null); + + if (!_active.containsKey(event.getEntity())) + return; + + CombatLog log = _active.remove(event.getEntity()); + log.SetDeathTime(System.currentTimeMillis()); + + // Save Death + Get(event.getEntity().getName()).GetDeaths().addFirst(log); + + // Add Kill/Assist + int assists = 0; + for (int i = 0; i < log.GetAttackers().size(); i++) + { + if (!log.GetAttackers().get(i).IsPlayer()) + continue; + + if (UtilTime.elapsed(log.GetAttackers().get(i).GetLastDamage(), + ExpireTime)) + continue; + + if (log.GetKiller() == null) + { + log.SetKiller(log.GetAttackers().get(i)); + + ClientCombat killerClient = Get(log.GetAttackers().get(i).GetName()); + + if (killerClient != null) + killerClient.GetKills().addFirst(log); + } + + else + { + assists++; + + ClientCombat assistClient = Get(log.GetAttackers().get(i).GetName()); + + if (assistClient != null) + assistClient.GetAssists().addFirst(log); + } + } + + log.SetAssists(assists); + + // Event + CombatDeathEvent deathEvent = new CombatDeathEvent(event, Get(event.getEntity().getName()), log); + UtilServer.getServer().getPluginManager().callEvent(deathEvent); + + if (deathEvent.GetBroadcastDeath()) + { + //Display Simple + for (Player cur : event.getEntity().getWorld().getPlayers()) + { + // Killed + String killedColor = log.GetKilledColor(); + + String deadPlayer = killedColor + event.getEntity().getName(); + + // Killer + if (log.GetKiller() != null) + { + String killerColor = log.GetKillerColor(); + + String killPlayer = killerColor + log.GetKiller().GetName(); + + if (log.GetAssists() > 0) + killPlayer += " + " + log.GetAssists(); + + String weapon = log.GetKiller().GetLastDamageSource(); + + UtilPlayer.message( + cur, + F.main("Death", + deadPlayer + C.cGray + " killed by " + + killPlayer + C.cGray + " with " + + F.item(weapon) + ".")); + } + // No Killer + else + { + if (log.GetAttackers().isEmpty()) + UtilPlayer.message(cur, F.main("Death", deadPlayer + + C.cGray + " has died.")); + else + UtilPlayer.message( + cur, + F.main("Death", + deadPlayer + + C.cGray + + " killed by " + + F.name(log.GetAttackers() + .getFirst().GetName())) + + C.cGray + "."); + } + } + } + else + { + //Simple + if (log.GetKiller() != null) + { + //Killer + String killerColor = log.GetKillerColor(); + String killPlayer = killerColor + log.GetKiller().GetName(); + + + // Killed + String killedColor = log.GetKilledColor(); + String deadPlayer = killedColor + event.getEntity().getName(); + + if (log.GetAssists() > 0) + killPlayer += " + " + log.GetAssists(); + + String weapon = log.GetKiller().GetLastDamageSource(); + + Player killer = UtilPlayer.searchExact(log.GetKiller().GetName()); + UtilPlayer.message(killer, F.main("Death", "You killed " + F.elem(deadPlayer) + " with " + F.item(weapon) + ".")); + + UtilPlayer.message(event.getEntity(), F.main("Death", killPlayer + C.cGray + " killed you with " + F.item(weapon) + ".")); + + } + else + { + if (log.GetAttackers().isEmpty()) + { + UtilPlayer.message(event.getEntity(), F.main("Death", "You have died.")); + } + + else + { + UtilPlayer.message(event.getEntity(), F.main("Death", "You were killed by " + + F.name(log.GetAttackers().getFirst().GetName())) + C.cGray + "."); + } + } + } + + // Display Detailed + if (deathEvent.GetBroadcastDeath()) + UtilPlayer.message(event.getEntity(), log.Display()); + } + + @EventHandler + public void ExpireOld(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (CombatLog log : _active.values()) + log.ExpireOld(); + } + + public void Add(Player player) + { + _active.put(player, new CombatLog(player, 15000)); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void Clear(ClearCombatEvent event) + { + _active.remove(event.GetPlayer()); + } + + public CombatLog Get(Player player) + { + if (!_active.containsKey(player)) + Add(player); + + return _active.get(player); + } + + public long GetExpireTime() + { + return ExpireTime; + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void ClearInactives(UpdateEvent event) + { + if (event.getType() == UpdateType.MIN_02) + { + // Remove already marked inactives if still offline + Iterator removeIterator = _removeList.iterator(); + + while (removeIterator.hasNext()) + { + Player player = removeIterator.next(); + + if (!player.isOnline()) + _active.remove(player); + + removeIterator.remove(); + } + + // Mark inactives for cleanup next go around + for (Player player : _active.keySet()) + { + if (!player.isOnline()) + _removeList.add(player); + } + } + } + + public void DebugInfo(Player player) + { + StringBuilder nameBuilder = new StringBuilder(); + + for (Player combats : _active.keySet()) + { + if (!combats.isOnline()) + { + if (nameBuilder.length() != 0) + nameBuilder.append(", "); + + nameBuilder.append(combats.getName()); + } + } + + player.sendMessage(F.main(GetName(), nameBuilder.toString())); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/event/ClearCombatEvent.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/event/ClearCombatEvent.java new file mode 100644 index 000000000..6de1111fb --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/event/ClearCombatEvent.java @@ -0,0 +1,32 @@ +package mineplex.minecraft.game.core.combat.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ClearCombatEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private Player _player; + + + public ClearCombatEvent(Player player) + { + _player = player; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public Player GetPlayer() + { + return _player; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/event/CombatDeathEvent.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/event/CombatDeathEvent.java new file mode 100644 index 000000000..99c6840a4 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/event/CombatDeathEvent.java @@ -0,0 +1,59 @@ +package mineplex.minecraft.game.core.combat.event; + +import mineplex.minecraft.game.core.combat.ClientCombat; +import mineplex.minecraft.game.core.combat.CombatLog; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.EntityDeathEvent; + +public class CombatDeathEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private EntityDeathEvent _event; + private ClientCombat _clientCombat; + private CombatLog _log; + private boolean _broadcast = true; + + public CombatDeathEvent(EntityDeathEvent event, ClientCombat clientCombat, CombatLog log) + { + _event = event; + _clientCombat = clientCombat; + _log = log; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public ClientCombat GetClientCombat() + { + return _clientCombat; + } + + public CombatLog GetLog() + { + return _log; + } + + public EntityDeathEvent GetEvent() + { + return _event; + } + + public void SetBroadcastDeath(boolean value) + { + _broadcast = value; + } + + public boolean GetBroadcastDeath() + { + return _broadcast; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/itemstack/Stats.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/itemstack/Stats.java new file mode 100644 index 000000000..bd9a44640 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/itemstack/Stats.java @@ -0,0 +1,133 @@ +package mineplex.minecraft.game.core.combat.itemstack; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.minecraft.game.core.combat.CombatComponent; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.inventory.ItemStack; + +public class Stats implements Listener +{ + @EventHandler(priority = EventPriority.HIGHEST) + public void StatsKill(CombatDeathEvent event) + { + if (event.GetLog().GetAttackers().isEmpty()) + return; + + CombatComponent kill = event.GetLog().GetAttackers().getFirst(); + + if (!kill.IsPlayer()) return; + + Player killer = UtilPlayer.searchExact(kill.GetName()); + if (killer == null) return; + + if (killer.isBlocking()) + return; + + ItemStack item = killer.getItemInHand(); + + if (item == null) + return; + + if (item.getMaxStackSize() > 1) + return; + + int kills = 1 + ItemStackFactory.Instance.GetLoreVar(item, "Player Kills", 0); + + ItemStackFactory.Instance.SetLoreVar(item, "Player Kills", "" + kills); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void StatsArmor(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() == DamageCause.SUICIDE) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + ItemStackFactory.Instance.StatsArmorRename(damagee.getInventory().getHelmet(), (int)event.GetDamage()); + ItemStackFactory.Instance.StatsArmorRename(damagee.getInventory().getChestplate(), (int)event.GetDamage()); + ItemStackFactory.Instance.StatsArmorRename(damagee.getInventory().getLeggings(), (int)event.GetDamage()); + ItemStackFactory.Instance.StatsArmorRename(damagee.getInventory().getBoots(), (int)event.GetDamage()); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void StatsDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damager = event.GetDamagerPlayer(true); + + if (damager == null) + return; + + if (damager.isBlocking()) + return; + + if (event.GetCause() == DamageCause.FIRE_TICK) + return; + + ItemStack item = damager.getItemInHand(); + + if (item == null) + return; + + if (item.getMaxStackSize() > 1) + return; + + int damage = (int)event.GetDamage() + ItemStackFactory.Instance.GetLoreVar(item, "Damage Dealt", 0); + + ItemStackFactory.Instance.SetLoreVar(item, "Damage Dealt", "" + damage); + + if (damage >= 10000) + item.addEnchantment(Enchantment.DURABILITY, 1); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void StatsBowHit(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + Projectile proj = event.GetProjectile(); + if (proj == null) return; + + ItemStack item = damager.getItemInHand(); + + if (item == null) + return; + + if (item.getType() != Material.BOW) + return; + + int hits = 1 + ItemStackFactory.Instance.GetLoreVar(item, "Arrows Hit", 0); + + ItemStackFactory.Instance.SetLoreVar(item, "Arrows Hit", "" + hits); + + int shots = ItemStackFactory.Instance.GetLoreVar(item, "Arrows Shot", 0); + + double acc = UtilMath.trim(1, ((double)hits/(double)shots)*100); + + ItemStackFactory.Instance.SetLoreVar(item, "Accuracy", acc + "%"); + } + +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java new file mode 100644 index 000000000..18f34e457 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java @@ -0,0 +1,279 @@ +package mineplex.minecraft.game.core.condition; + +import org.bukkit.Material; +import org.bukkit.entity.LivingEntity; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class Condition +{ + public enum ConditionType + { + CLOAK, + SHOCK, + SILENCE, + BURNING, + FALLING, + LIGHTNING, + INVULNERABLE, + EXPLOSION, + FIRE_ITEM_IMMUNITY, + + CUSTOM, + + BLINDNESS, + CONFUSION, + DAMAGE_RESISTANCE, + FAST_DIGGING, + FIRE_RESISTANCE, + HARM, + HEAL, + HUNGER, + INCREASE_DAMAGE, + INVISIBILITY, + JUMP, + NIGHT_VISION, + POISON, + REGENERATION, + SLOW, + SLOW_DIGGING, + SPEED, + WATER_BREATHING, + WEAKNESS, + WITHER + } + + protected ConditionManager Manager; + protected long _time; + + protected String _reason; + + protected String _informOn; + protected String _informOff; + + protected LivingEntity _ent; + protected LivingEntity _source; + + protected ConditionType _type; + protected int _mult; + protected int _ticks; + protected int _ticksTotal; + protected boolean _ambient; + + protected Material _indicatorType; + protected byte _indicatorData; + + protected boolean _add = false; + protected boolean _live = false; + + protected boolean _showIndicator = true; + + public Condition(ConditionManager manager, String reason, LivingEntity ent, LivingEntity source, + ConditionType type, int mult, int ticks, boolean add, Material visualType, byte visualData, boolean showIndicator, boolean ambient) + { + Manager = manager; + _time = System.currentTimeMillis(); + + _reason = reason; + + _ent = ent; + _source = source; + + _type = type; + _mult = mult; + _ticks = ticks; + _ticksTotal = ticks; + _ambient = ambient; + + _indicatorType = visualType; + _indicatorData = visualData; + _showIndicator = showIndicator; + + _add = add; + + //Live if NOT Additive + _live = !add; + } + + public boolean Tick() + { + if (_live && _ticks > 0) + _ticks--; + + return IsExpired(); + } + + public void OnConditionAdd() + { + + } + + public void Apply() + { + _live = true; + + Add(); + } + + public void Add() + { + try + { + PotionEffectType type = PotionEffectType.getByName(_type.toString()); + + //Remove + _ent.removePotionEffect(type); + + //Add + if (_ticks == -1) + (new PotionEffect(type, 72000, _mult, _ambient)).apply(_ent); + else + (new PotionEffect(type, _ticks, _mult, _ambient)).apply(_ent); + } + catch (Exception e) + { + + } + } + + public void Remove() + { + try + { + PotionEffectType type = PotionEffectType.getByName(_type.toString()); + _ent.removePotionEffect(type); + } + catch (Exception e) + { + + } + } + + public Material GetIndicatorMaterial() + { + return _indicatorType; + } + + public byte GetIndicatorData() + { + return _indicatorData; + } + + public LivingEntity GetEnt() + { + return _ent; + } + + public LivingEntity GetSource() + { + return _source; + } + + public boolean IsAdd() + { + return _add; + } + + public ConditionType GetType() + { + return _type; + } + + public int GetMult() + { + return _mult; + } + + public void SetLive(boolean live) + { + _live = live; + } + + public int GetTicks() + { + return _ticks; + } + + public int GetTicksTotal() + { + return _ticksTotal; + } + + public String GetReason() + { + return _reason; + } + + public long GetTime() + { + return _time; + } + + public void Expire() + { + _ticks = 0; + + Remove(); + } + + public void Restart() + { + _ticks = _ticksTotal; + } + + public boolean IsBetterOrEqual(Condition other, boolean additive) + { + if (this.GetMult() > other.GetMult()) + return true; + + if (this.GetMult() < other.GetMult()) + return false; + + if (additive) + return true; + + if (this.GetTicks() >= other.GetTicks()) + return true; + + return false; + } + + public boolean IsVisible() + { + return _showIndicator; + } + + public boolean IsExpired() + { + if (_ticks == -1) + return false; + + return _ticks <= 0; + } + + public ConditionManager GetManager() + { + return Manager; + } + + public String GetInformOn() + { + return _informOn; + } + + public String GetInformOff() + { + return _informOff; + } + + public void ModifyTicks(int amount) + { + _ticks += amount; + _ticksTotal += amount; + } + + public void ModifyMult(int i) + { + _mult = Math.max(0, _mult + i); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionApplicator.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionApplicator.java new file mode 100644 index 000000000..3fe0dabab --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionApplicator.java @@ -0,0 +1,237 @@ +package mineplex.minecraft.game.core.condition; + +import java.util.ArrayList; +import java.util.HashMap; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; + +import org.bukkit.ChatColor; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class ConditionApplicator +{ + //Types + private HashMap _effectMap; + + public ConditionApplicator() + { + _effectMap = new HashMap(); + _effectMap.put("Blindness", PotionEffectType.BLINDNESS); + _effectMap.put("Confusion", PotionEffectType.CONFUSION); + _effectMap.put("DamageResist", PotionEffectType.DAMAGE_RESISTANCE); + _effectMap.put("FastDig", PotionEffectType.FAST_DIGGING); + _effectMap.put("FireResist", PotionEffectType.FIRE_RESISTANCE); + _effectMap.put("Harm", PotionEffectType.HARM); + _effectMap.put("Heal", PotionEffectType.HEAL); + _effectMap.put("Hunger", PotionEffectType.HUNGER); + _effectMap.put("Strength", PotionEffectType.INCREASE_DAMAGE); + _effectMap.put("Jump", PotionEffectType.JUMP); + _effectMap.put("Poison", PotionEffectType.POISON); + _effectMap.put("Regeneration", PotionEffectType.REGENERATION); + _effectMap.put("Slow", PotionEffectType.SLOW); + _effectMap.put("SlowDig", PotionEffectType.SLOW_DIGGING); + _effectMap.put("Speed", PotionEffectType.SPEED); + _effectMap.put("Breathing", PotionEffectType.WATER_BREATHING); + _effectMap.put("Weakness", PotionEffectType.WEAKNESS); + _effectMap.put("Invisibility", PotionEffectType.INVISIBILITY); + _effectMap.put("NightVision", PotionEffectType.NIGHT_VISION); + } + + public void clearEffects(Player player) + { + for (PotionEffectType cur : _effectMap.values()) + player.removePotionEffect(cur); + } + + public void listEffect(Player caller) + { + caller.sendMessage(ChatColor.RED + "[C] " + ChatColor.YELLOW + "Listing Potion Effects;"); + + caller.sendMessage(ChatColor.DARK_GREEN + "Health Effects: " + ChatColor.AQUA + + "Harm, Heal, Poison, Regeneration, Hunger"); + + caller.sendMessage(ChatColor.DARK_GREEN + "Damage Effects: " + ChatColor.AQUA + + "Strength, Weakness, DamageResist, FireResist"); + + caller.sendMessage(ChatColor.DARK_GREEN + "Movement Effects: " + ChatColor.AQUA + + "Slow, Speed, Jump, FireResist"); + + caller.sendMessage(ChatColor.DARK_GREEN + "Vision Effects: " + ChatColor.AQUA + + "Blindness, Confusion, NightVision"); + + caller.sendMessage(ChatColor.DARK_GREEN + "Misc Effects: " + ChatColor.AQUA + + "FastDig, SlowDig, Breathing, Invisibility"); + } + + public HashMap readEffect(Player caller, String eString) + { + HashMap eList = new HashMap(); + ArrayList errorList = new ArrayList(); + + String[] eToken = eString.split(","); + + for (String eCur : eToken) + { + for (String cur : _effectMap.keySet()) + { + if (cur.equalsIgnoreCase(eCur)) + { + eList.put(cur, _effectMap.get(cur)); + } + else + { + errorList.add(eCur); + } + } + } + + if (!errorList.isEmpty()) + { + String out = ChatColor.RED + "[C] " + ChatColor.YELLOW + "Invalid Effects:" + ChatColor.AQUA; + + for (String cur : errorList) + { + out += " '" + cur + "'"; + } + + caller.sendMessage(out); + } + + return eList; + } + + public void doEffect(Player caller, String name, HashMap eMap, String durationString, String strengthString, boolean extend) + { + //All Players + ArrayList targetList = new ArrayList(); + ArrayList invalidList = new ArrayList(); + if (name.equalsIgnoreCase("all")) + { + for (Player cur : UtilServer.getPlayers()) + targetList.add(cur); + } + //Listed Players + else + { + String[] playerTokens = name.split(","); + + for (String curName : playerTokens) + { + Player target = (Player)UtilPlayer.matchOnline(null, name, false); + + if (target != null) + { + targetList.add(target); + } + else + { + invalidList.add(curName); + } + } + } + + if (!invalidList.isEmpty()) + { + String out = ChatColor.RED + "[C] " + ChatColor.YELLOW + "Invalid Targets:"; + for (String cur : invalidList) + { + out += " '" + cur + "'"; + } + caller.sendMessage(out); + } + + + if (targetList.isEmpty()) + { + caller.sendMessage(ChatColor.RED + "[C] " + ChatColor.YELLOW + "No Valid Targets Listed."); + return; + } + + //Parse Effects + if (eMap.isEmpty()) + { + caller.sendMessage(ChatColor.RED + "[C] " + ChatColor.YELLOW + "No Valid Effects Listed."); + return; + } + + //Parse Duration and Strength + double duration; + int strength; + try + { + duration = Double.parseDouble(durationString); + strength = Integer.parseInt(strengthString); + + if (duration <= 0) + { + caller.sendMessage(ChatColor.RED + "[C] " + ChatColor.YELLOW + "Invalid Effect Duration."); + return; + } + + if (strength < 0) + { + caller.sendMessage(ChatColor.RED + "[C] " + ChatColor.YELLOW + "Invalid Effect Strength."); + return; + } + } + catch (Exception ex) + { + caller.sendMessage(ChatColor.RED + "[C] " + ChatColor.YELLOW + "Invalid Effect Duration/Strength."); + return; + } + + + caller.sendMessage(ChatColor.RED + "[C] " + ChatColor.YELLOW + "Applying Effect(s) to Target(s)."); + for (Player curPlayer : targetList) + { + for (String cur : _effectMap.keySet()) + { + addEffect(curPlayer, cur, _effectMap.get(cur), duration, strength, true, extend); + } + } + } + + public boolean addEffect(LivingEntity target, String effectName, PotionEffectType type, double duration, int strength, boolean inform, boolean extend) + { + //Duration of Previous + int oldDur = 0; + + if (target.hasPotionEffect(type)) + { + for (PotionEffect cur : target.getActivePotionEffects()) + { + if (cur.getType().equals(type)) + { + if (cur.getAmplifier() > strength) + return true; + + else if (extend) + oldDur += cur.getDuration(); + } + } + + //Remove Old + target.removePotionEffect(type); + } + + //Create & Add + target.addPotionEffect(new PotionEffect(type, (int)(duration*20) + oldDur, strength), true); + + if (inform && target instanceof Player) + { + Player tPlayer = (Player)target; + UtilPlayer.message(tPlayer, F.main("Condition", "You received " + + F.elem(effectName + " " + (strength+1)) + + " for " + F.time(""+UtilMath.trim(1, duration * 20d)) + " Seconds.")); + + } + + return false; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java new file mode 100644 index 000000000..5e7baad9e --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java @@ -0,0 +1,386 @@ +package mineplex.minecraft.game.core.condition; + +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilTime; + +import org.bukkit.Bukkit; +import org.bukkit.Effect; +import org.bukkit.EntityEffect; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.potion.PotionEffectType; + +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; + +public class ConditionEffect implements Listener +{ + protected ConditionManager Manager; + + public ConditionEffect(ConditionManager manager) + { + Manager = manager; + Manager.GetPlugin().getServer().getPluginManager().registerEvents(this, Manager.GetPlugin()); + } + + @EventHandler(priority = EventPriority.LOW) + public void Invulnerable(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + LivingEntity ent = event.GetDamageeEntity(); + if (ent == null) return; + + if (!Manager.IsInvulnerable(ent)) + return; + + //Set Damage + event.SetCancelled("Invulnerable"); + } + + @EventHandler(priority = EventPriority.LOW) + public void Cloak(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + LivingEntity ent = event.GetDamageeEntity(); + if (ent == null) return; + + if (!Manager.IsCloaked(ent)) + return; + + //Set Damage + event.SetCancelled("Cloak"); + } + + @EventHandler + public void Cloak(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (LivingEntity ent : Manager.GetIndicators().keySet()) + { + if (!(ent instanceof Player)) + continue; + + Player player = (Player)ent; + + //Hide + if (Manager.IsCloaked(ent)) + for (Player other : Bukkit.getServer().getOnlinePlayers()) + ((CraftPlayer)other).hidePlayer(player, true, false); + //Show + else + for (Player other : Bukkit.getServer().getOnlinePlayers()) + { + other.showPlayer(player); + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void Cloak(EntityTargetEvent event) + { + if (!(event.getTarget() instanceof Player)) + return; + + if (!Manager.HasCondition((LivingEntity)event.getTarget(), ConditionType.CLOAK, null)) + return; + + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Protection(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + if (!damagee.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) + return; + + mineplex.minecraft.game.core.condition.Condition cond = Manager.GetActiveCondition(damagee, ConditionType.DAMAGE_RESISTANCE); + if (cond == null) return; + + event.AddMod(UtilEnt.getName(cond.GetSource()), cond.GetReason(), -1 * (cond.GetMult()+1), false); + } + + @EventHandler(priority = EventPriority.HIGH) + public void VulnerabilityDamagee(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + if (!damagee.hasPotionEffect(PotionEffectType.WITHER)) + return; + + mineplex.minecraft.game.core.condition.Condition cond = Manager.GetActiveCondition(damagee, ConditionType.WITHER); + if (cond == null) return; + + event.AddMod(UtilEnt.getName(cond.GetSource()), cond.GetReason(), cond.GetMult()+1, false); + } + + @EventHandler(priority = EventPriority.HIGH) + public void VulnerabilityDamager(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!damager.hasPotionEffect(PotionEffectType.WITHER)) + return; + + mineplex.minecraft.game.core.condition.Condition cond = Manager.GetActiveCondition(damager, ConditionType.WITHER); + if (cond == null) return; + + event.AddMod(UtilEnt.getName(cond.GetSource()), cond.GetReason(), -1 * (cond.GetMult()+1), false); + } + + @EventHandler + public void VulnerabilityEffect(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + for (LivingEntity ent : Manager.GetIndicators().keySet()) + { + if (ent.isDead()) + continue; + + if (!ent.hasPotionEffect(PotionEffectType.WITHER)) + continue; + + if (Manager.HasCondition(ent, ConditionType.CLOAK, null)) + continue; + + ent.getWorld().playEffect(ent.getLocation(), Effect.SMOKE, 1); + ent.getWorld().playEffect(ent.getLocation(), Effect.SMOKE, 3); + ent.getWorld().playEffect(ent.getLocation(), Effect.SMOKE, 5); + ent.getWorld().playEffect(ent.getLocation(), Effect.SMOKE, 7); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void VulnerabilityWitherCancel(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() == DamageCause.WITHER) + event.SetCancelled("Vulnerability Wither"); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Strength(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + if (!damager.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) + return; + + mineplex.minecraft.game.core.condition.Condition cond = Manager.GetActiveCondition(damager, ConditionType.INCREASE_DAMAGE); + if (cond == null) return; + + event.AddMod(damager.getName(), cond.GetReason(), cond.GetMult() + 1, true); + } + + @EventHandler + public void Shock(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (LivingEntity ent : Manager.GetIndicators().keySet()) + for (ConditionIndicator ind : Manager.GetIndicators().get(ent)) + if (ind.GetCondition().GetType() == ConditionType.SHOCK) + ent.playEffect(EntityEffect.HURT); + } + + @EventHandler + public void Lightning(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.LIGHTNING) + return; + + LivingEntity ent = event.GetDamageeEntity(); + if (ent == null) return; + + Condition condition = Manager.GetActiveCondition(ent, ConditionType.LIGHTNING); + if (condition == null) return; + + //Damage + event.SetDamager(condition.GetSource()); + event.AddMod(UtilEnt.getName(condition.GetSource()), condition.GetReason(), 0, true); + + if (condition.GetMult() != 0) + event.AddMod("Lightning Modifier", UtilEnt.getName(condition.GetSource()), condition.GetMult(), false); + + event.SetKnockback(false); + } + + @EventHandler + public void Explosion(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_EXPLOSION && event.GetCause() != DamageCause.BLOCK_EXPLOSION) + return; + + LivingEntity ent = event.GetDamageeEntity(); + if (ent == null) return; + + Condition condition = Manager.GetActiveCondition(ent, ConditionType.EXPLOSION); + if (condition == null) return; + + //Damage + event.SetDamager(condition.GetSource()); + + event.AddMod("Negate", condition.GetReason(), -event.GetDamageInitial(), false); + event.AddMod(UtilEnt.getName(condition.GetSource()), condition.GetReason(), Math.min(event.GetDamageInitial(), condition.GetMult()), true); + + event.SetKnockback(false); + } + + @EventHandler + public void Fire(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.FIRE_TICK) + return; + + LivingEntity ent = event.GetDamageeEntity(); + if (ent == null) return; + + //Limit + if (ent.getFireTicks() > 160) + ent.setFireTicks(160); + + Condition condition = Manager.GetActiveCondition(ent, ConditionType.BURNING); + if (condition == null) return; + + //Damage + event.SetDamager(condition.GetSource()); + event.AddMod(UtilEnt.getName(condition.GetSource()), condition.GetReason(), 0, true); + event.SetIgnoreArmor(true); + event.SetKnockback(false); + } + + @EventHandler + public void FireDouse(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + for (LivingEntity ent : Manager.GetIndicators().keySet()) + if (ent.getFireTicks() <= 0) + Manager.EndCondition(ent, ConditionType.BURNING, null); + } + + @EventHandler + public void Poison(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.POISON) + return; + + LivingEntity ent = event.GetDamageeEntity(); + if (ent == null) return; + + Condition condition = Manager.GetActiveCondition(ent, ConditionType.POISON); + if (condition == null) return; + + //Damage + event.SetDamager(condition.GetSource()); + event.AddMod(UtilEnt.getName(condition.GetSource()), condition.GetReason(), 0, true); + event.SetIgnoreArmor(true); + } + + @EventHandler + public void Fall(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.FALL) + return; + + LivingEntity ent = event.GetDamageeEntity(); + if (ent == null) return; + + Condition condition = Manager.GetActiveCondition(ent, ConditionType.FALLING); + if (condition == null) return; + + //Damage + event.SetDamager(condition.GetSource()); + event.AddMod(UtilEnt.getName(condition.GetSource()), condition.GetReason(), 0, true); + event.SetIgnoreArmor(true); + event.SetKnockback(false); + } + + @EventHandler + public void Fall(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (LivingEntity ent : Manager.GetIndicators().keySet()) + { + if (!UtilEnt.isGrounded(ent)) + continue; + + Condition condition = Manager.GetActiveCondition(ent, ConditionType.FALLING); + if (condition == null) return; + + if (!UtilTime.elapsed(condition.GetTime(), 250)) + continue; + + Manager.EndCondition(ent, ConditionType.FALLING , null); + } + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionFactory.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionFactory.java new file mode 100644 index 000000000..1f1d0eee3 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionFactory.java @@ -0,0 +1,253 @@ +package mineplex.minecraft.game.core.condition; + +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.condition.conditions.*; + +import org.bukkit.Material; +import org.bukkit.entity.LivingEntity; +import org.bukkit.util.Vector; + +public class ConditionFactory +{ + public ConditionManager Manager; + + public ConditionFactory(ConditionManager manager) + { + Manager = manager; + } + + public Condition Custom(String reason, LivingEntity ent, LivingEntity source, + ConditionType type, double duration, int mult, boolean extend, + Material indMat, byte indData, boolean showIndicator) + { + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + type, mult, (int)(20 * duration), extend, + indMat, indData, showIndicator, false)); + } + + public Condition Invulnerable(String reason, LivingEntity ent, LivingEntity source, + double duration, boolean extend, boolean showIndicator) + { + showIndicator = false; + + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.INVULNERABLE, 0, (int)(20 * duration), extend, + Material.GHAST_TEAR, (byte)0, showIndicator, false)); + } + + public Condition FireItemImmunity(String reason, LivingEntity ent, LivingEntity source, + double duration, boolean extend) + { + return Manager.AddCondition(new FireItemImmunity(Manager, reason, ent, source, + ConditionType.FIRE_ITEM_IMMUNITY, 0, (int)(20 * duration), extend, + Material.GHAST_TEAR, (byte)0, false)); + } + + public Condition Cloak(String reason, LivingEntity ent, LivingEntity source, + double duration, boolean extend, boolean inform) + { + return Manager.AddCondition(new Cloak(Manager, reason, ent, source, + ConditionType.CLOAK, 0, (int)(20 * duration), extend, + Material.GHAST_TEAR, (byte)0, false)); + } + + public Condition Explosion(String reason, LivingEntity ent, LivingEntity source, + int mult, double duration, boolean extend, boolean showIndicator) + { + //Never Show + showIndicator = false; + + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.EXPLOSION, mult, (int)(20 * duration), extend, + Material.GHAST_TEAR, (byte)0, showIndicator, false)); + } + + public Condition Lightning(String reason, LivingEntity ent, LivingEntity source, + int mult, double duration, boolean extend, boolean showIndicator) + { + showIndicator = false; + + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.LIGHTNING, mult, (int)(20 * duration), extend, + Material.GHAST_TEAR, (byte)0, showIndicator, false)); + } + + public Condition Falling(String reason, LivingEntity ent, LivingEntity source, + double duration, boolean extend, boolean showIndicator) + { + showIndicator = false; + + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.FALLING, 0, (int)(20 * duration), extend, + Material.GHAST_TEAR, (byte)0, showIndicator, false)); + } + + public Condition Silence(String reason, LivingEntity ent, LivingEntity source, + double duration, boolean extend, boolean showIndicator) + { + return Manager.AddCondition(new Silence(Manager, reason, ent, source, + ConditionType.SILENCE, 0, (int)(20 * duration), extend, + Material.WATCH, (byte)0, showIndicator)); + } + + public Condition Speed(String reason, LivingEntity ent, LivingEntity source, + double duration, int mult, boolean extend, boolean showIndicator, boolean ambient) + { + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.SPEED, mult, (int)(20 * duration), extend, + Material.FEATHER, (byte)0, showIndicator, ambient)); + } + + public Condition Strength(String reason, LivingEntity ent, LivingEntity source, + double duration, int mult, boolean extend, boolean showIndicator, boolean ambient) + { + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.INCREASE_DAMAGE, mult, (int)(20 * duration), extend, + Material.IRON_SWORD, (byte)0, showIndicator, ambient)); + } + + public Condition Hunger(String reason, LivingEntity ent, LivingEntity source, + double duration, int mult, boolean extend, boolean showIndicator, boolean ambient) + { + showIndicator = false; + + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.HUNGER, mult, (int)(20 * duration), extend, + Material.ROTTEN_FLESH, (byte)0, showIndicator, ambient)); + } + + public Condition Regen(String reason, LivingEntity ent, LivingEntity source, + double duration, int mult, boolean extend, boolean showIndicator, boolean ambient) + { + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.REGENERATION, mult, (int)(20 * duration), extend, + Material.INK_SACK, (byte)1, showIndicator, ambient)); + } + + public Condition Weakness(String reason, LivingEntity ent, LivingEntity source, + double duration, int mult, boolean extend, boolean showIndicator, boolean ambient) + { + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.WEAKNESS, mult, (int)(20 * duration), extend, + Material.INK_SACK, (byte)15, showIndicator, ambient)); + } + + public Condition Protection(String reason, LivingEntity ent, LivingEntity source, + double duration, int mult, boolean extend, boolean showIndicator, boolean ambient) + { + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.DAMAGE_RESISTANCE, mult, (int)(20 * duration), extend, + Material.IRON_CHESTPLATE, (byte)0, showIndicator, ambient)); + } + + public Condition FireResist(String reason, LivingEntity ent, LivingEntity source, + double duration, int mult, boolean extend, boolean showIndicator, boolean ambient) + { + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.FIRE_RESISTANCE, mult, (int)(20 * duration), extend, + Material.BLAZE_POWDER, (byte)0, showIndicator, ambient)); + } + + public Condition Breath(String reason, LivingEntity ent, LivingEntity source, + double duration, int mult, boolean extend, boolean showIndicator, boolean ambient) + { + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.WATER_BREATHING, mult, (int)(20 * duration), extend, + Material.INK_SACK, (byte)4, showIndicator, ambient)); + } + + public Condition DigFast(String reason, LivingEntity ent, LivingEntity source, + double duration, int mult, boolean extend, boolean showIndicator, boolean ambient) + { + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.FAST_DIGGING, mult, (int)(20 * duration), extend, + Material.GLOWSTONE_DUST, (byte)0, showIndicator, ambient)); + } + + public Condition DigSlow(String reason, LivingEntity ent, LivingEntity source, + double duration, int mult, boolean extend, boolean showIndicator, boolean ambient) + { + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.SLOW_DIGGING, mult, (int)(20 * duration), extend, + Material.WOOD_PICKAXE, (byte)0, showIndicator, ambient)); + } + + public Condition Jump(String reason, LivingEntity ent, LivingEntity source, + double duration, int mult, boolean extend, boolean showIndicator, boolean ambient) + { + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.JUMP, mult, (int)(20 * duration), extend, + Material.CARROT_ITEM, (byte)0, showIndicator, ambient)); + } + + public Condition Invisible(String reason, LivingEntity ent, LivingEntity source, + double duration, int mult, boolean extend, boolean showIndicator, boolean ambient) + { + showIndicator = false; + + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.INVISIBILITY, mult, (int)(20 * duration), extend, + Material.SNOW_BALL, (byte)0, showIndicator, ambient)); + } + + public Condition Vulnerable(String reason, LivingEntity ent, LivingEntity source, + double duration, int mult, boolean extend, boolean showIndicator, boolean ambient) + { + return Manager.AddCondition(new Vulnerability(Manager, reason, ent, source, + ConditionType.WITHER, mult, (int)(20 * duration), extend, + Material.BONE, (byte)0, showIndicator, ambient)); + } + + public Condition Shock(String reason, LivingEntity ent, LivingEntity source, + double duration, boolean extend, boolean showIndicator) + { + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.SHOCK, 0, (int)(20 * duration), extend, + Material.DEAD_BUSH, (byte)0, showIndicator, false)); + } + + public Condition Ignite(String reason, LivingEntity ent, LivingEntity source, + double duration, boolean extend, boolean showIndicator) + { + showIndicator = false; + + return Manager.AddCondition(new Burning(Manager, reason, ent, source, + ConditionType.BURNING, 0, (int)(20 * duration), extend, + Material.GHAST_TEAR, (byte)0, showIndicator)); + } + + public Condition Slow(String reason, LivingEntity ent, LivingEntity source, + double duration, int mult, boolean extend, boolean showIndicator, boolean stun, boolean ambient) + { + if (stun) + ent.setVelocity(new Vector(0,0,0)); + + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.SLOW, mult, (int)(20 * duration), extend, + Material.WEB, (byte)0, showIndicator, ambient)); + } + + public Condition Poison(String reason, LivingEntity ent, LivingEntity source, + double duration, int mult, boolean extend, boolean showIndicator, boolean ambient) + { + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.POISON, mult, (int)(20 * duration), extend, + Material.SLIME_BALL, (byte)14, showIndicator, ambient)); + } + + public Condition Confuse(String reason, LivingEntity ent, LivingEntity source, + double duration, int mult, boolean extend, boolean showIndicator, boolean ambient) + { + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.CONFUSION, mult, (int)(20 * duration), extend, + Material.ENDER_PEARL, (byte)0, showIndicator, ambient)); + } + + public Condition Blind(String reason, LivingEntity ent, LivingEntity source, + double duration, int mult, boolean extend, boolean showIndicator, boolean ambient) + { + return Manager.AddCondition(new Condition(Manager, reason, ent, source, + ConditionType.BLINDNESS, mult, (int)(20 * duration), extend, + Material.EYE_OF_ENDER, (byte)0, showIndicator, ambient)); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionIndicator.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionIndicator.java new file mode 100644 index 000000000..c365a8cfa --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionIndicator.java @@ -0,0 +1,77 @@ +package mineplex.minecraft.game.core.condition; + +import mineplex.core.itemstack.ItemStackFactory; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryPickupItemEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; + +public class ConditionIndicator implements Listener +{ + private Entity _indicator; + private Condition _condition; + + public ConditionIndicator(Condition condition) + { + SetCondition(condition); + } + + public Condition GetCondition() + { + return _condition; + } + + public Entity GetIndicator() + { + if (!IsVisible()) + return null; + + if (_indicator == null) + _indicator = _condition.GetEnt().getWorld().dropItem(_condition.GetEnt().getEyeLocation(), + ItemStackFactory.Instance.CreateStack(_condition.GetIndicatorMaterial(), _condition.GetIndicatorData())); + + return _indicator; + } + + public void SetCondition(Condition newCon) + { + _condition = newCon; + + if (_indicator != null) + if (_indicator instanceof Item) + ((Item)_indicator).getItemStack().setType(newCon.GetIndicatorMaterial()); + + newCon.Apply(); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void Pickup(PlayerPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (_indicator != null) + if (_indicator.equals(event.getItem())) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void HopperPickup(InventoryPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (_indicator != null) + if (_indicator.equals(event.getItem())) + event.setCancelled(true); + } + + public boolean IsVisible() + { + return GetCondition().IsVisible(); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionManager.java new file mode 100644 index 000000000..db7ade1fd --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionManager.java @@ -0,0 +1,721 @@ +package mineplex.minecraft.game.core.condition; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.Map.Entry; +import java.util.WeakHashMap; + +import mineplex.core.MiniPlugin; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.inventory.InventoryPickupItemEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class ConditionManager extends MiniPlugin +{ + private ConditionFactory _factory; + private ConditionApplicator _applicator; + protected ConditionEffect Effect; + + private WeakHashMap> _conditions = new WeakHashMap>(); + private WeakHashMap> _indicators = new WeakHashMap>(); + private WeakHashMap _buffer = new WeakHashMap(); + private HashSet _hideIndicator = new HashSet(); + private HashSet _items = new HashSet(); + + public ConditionManager(JavaPlugin plugin) + { + super("Condition Manager", plugin); + + Factory(); + Applicator(); + Effect(); + } + + public ConditionFactory Factory() + { + if (_factory == null) + _factory = new ConditionFactory(this); + + return _factory; + } + + public ConditionApplicator Applicator() + { + if (_applicator == null) + _applicator = new ConditionApplicator(); + + return _applicator; + } + + public ConditionEffect Effect() + { + if (Effect == null) + Effect = new ConditionEffect(this); + + return Effect; + } + + @Override + public void Disable() + { + for (LivingEntity ent : _indicators.keySet()) + for (ConditionIndicator ind : _indicators.get(ent)) + { + if (ind.GetIndicator() != null) + ind.GetIndicator().remove(); + + HandlerList.unregisterAll(ind); + } + } + + public Condition AddCondition(Condition newCon) + { + //Event + ConditionApplyEvent condEvent = new ConditionApplyEvent(newCon); + GetPlugin().getServer().getPluginManager().callEvent(condEvent); + + if (condEvent.isCancelled()) + return null; + + //Add Condition + if (!_conditions.containsKey(newCon.GetEnt())) + _conditions.put(newCon.GetEnt(), new LinkedList()); + + _conditions.get(newCon.GetEnt()).add(newCon); + + //Condition Add + newCon.OnConditionAdd(); + + //Indicator + HandleIndicator(newCon); + + return newCon; + } + + public void HandleIndicator(Condition newCon) + { + ConditionIndicator ind = GetIndicatorType(newCon); + + //New Condition + if (ind == null) + { + AddIndicator(newCon); + } + //Condition Exists + else + { + UpdateIndicator(ind, newCon); + } + } + + public ConditionIndicator GetIndicatorType(Condition newCon) + { + if (!_indicators.containsKey(newCon.GetEnt())) + _indicators.put(newCon.GetEnt(), new LinkedList()); + + for (ConditionIndicator ind : _indicators.get(newCon.GetEnt())) + if (ind.GetCondition().GetType() == newCon.GetType()) + return ind; + + return null; + } + + public void AddIndicator(Condition newCon) + { + //Create + ConditionIndicator newInd = new ConditionIndicator(newCon); + + //Get Inds + if (!_indicators.containsKey(newCon.GetEnt())) + _indicators.put(newCon.GetEnt(), new LinkedList()); + + LinkedList entInds = _indicators.get(newCon.GetEnt()); + + /** Spawn Indicator if Applicable **/ + if (false && !_hideIndicator.contains(newCon.GetEnt()) && newInd.GetCondition().IsVisible()) + { + LivingEntity ent = newInd.GetCondition().GetEnt(); + + //First, Add Buffer + if (!_buffer.containsKey(ent)) + { + Entity buffer = ent.getWorld().dropItem(ent.getLocation(), ItemStackFactory.Instance.CreateStack(Material.GHAST_TEAR, 1)); + ent.setPassenger(buffer); + _buffer.put(ent, buffer); + } + + //Indicator on Player + _buffer.get(ent).setPassenger(newInd.GetIndicator()); + + //Indicator Stack + if (!entInds.isEmpty()) + if (entInds.getFirst().GetCondition().IsVisible()) + newInd.GetIndicator().setPassenger(entInds.getFirst().GetIndicator()); + } + + //Register Events + UtilServer.getServer().getPluginManager().registerEvents(newInd, _plugin); + + //Add + entInds.addFirst(newInd); + + //Inform + if (newCon.GetInformOn() != null) + UtilPlayer.message(newCon.GetEnt(), F.main("Condition", newCon.GetInformOn())); + } + + public void UpdateIndicator(ConditionIndicator ind, Condition newCon) + { + //Not Additive + + if (!ind.GetCondition().IsExpired()) + if (ind.GetCondition().IsBetterOrEqual(newCon, newCon.IsAdd())) + return; + + ind.SetCondition(newCon); + } + + @EventHandler + public void ExpireConditions(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + /** Conditions **/ + for (LivingEntity ent : _conditions.keySet()) + { + Iterator conditionIterator = _conditions.get(ent).iterator(); + + while (conditionIterator.hasNext()) + { + Condition cond = conditionIterator.next(); + + if (cond.Tick()) + conditionIterator.remove(); + } + } + + /** Indicators **/ + for (LivingEntity ent : _indicators.keySet()) + { + Iterator conditionIndicatorIterator = _indicators.get(ent).iterator(); + + while (conditionIndicatorIterator.hasNext()) + { + ConditionIndicator conditionIndicator = conditionIndicatorIterator.next(); + + if (conditionIndicator.GetCondition().IsExpired()) + { + Condition replacement = GetBestCondition(ent, conditionIndicator.GetCondition().GetType()); + + if (replacement == null) + { + /** Despawn Indicator **/ + if (!_hideIndicator.contains(ent) && conditionIndicator.GetIndicator() != null) + { + Entity below = conditionIndicator.GetIndicator().getVehicle(); + Entity above = conditionIndicator.GetIndicator().getPassenger(); + + conditionIndicator.GetIndicator().eject(); + conditionIndicator.GetIndicator().leaveVehicle(); + + if (above != null && below != null) + below.setPassenger(above); + + Vector vec = new Vector(Math.random() - 0.5, 0, Math.random() - 0.5); + vec.normalize().multiply(0.1).setY(0.2); + conditionIndicator.GetIndicator().setVelocity(vec); + + //Remove + _items.add(conditionIndicator.GetIndicator()); + } + + HandlerList.unregisterAll(conditionIndicator); + conditionIndicatorIterator.remove(); + + //Remove Buffer + if (_indicators.get(ent).isEmpty()) + { + RemoveBuffer(_buffer.remove(ent)); + // _indicators.remove(ent); + } + + //Inform + if (conditionIndicator.GetCondition().GetInformOff() != null) + UtilPlayer.message(conditionIndicator.GetCondition().GetEnt(), F.main("Condition", conditionIndicator.GetCondition().GetInformOff())); + } + else + UpdateIndicator(conditionIndicator, replacement); + } + } + } + } + + public Condition GetBestCondition(LivingEntity ent, ConditionType type) + { + if (!_conditions.containsKey(ent)) + return null; + + Condition best = null; + + for (Condition con : _conditions.get(ent)) + { + if (con.GetType() != type) + continue; + + if (con.IsExpired()) + continue; + + if (best == null) + { + best = con; + continue; + } + + if (con.IsBetterOrEqual(best, false)) + best = con; + } + + return best; + } + + public Condition GetActiveCondition(LivingEntity ent, ConditionType type) + { + if (!_indicators.containsKey(ent)) + return null; + + for (ConditionIndicator ind : _indicators.get(ent)) + { + if (ind.GetCondition().GetType() != type) + continue; + + if (ind.GetCondition().IsExpired()) + continue; + + return ind.GetCondition(); + } + + return null; + } + + @EventHandler + public void Remove(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet expired = new HashSet(); + + for (Entity cur : _items) + if (UtilEnt.isGrounded(cur) || cur.isDead() || !cur.isValid()) + expired.add(cur); + + for (Entity cur : expired) + { + _items.remove(cur); + cur.remove(); + } + } + + @EventHandler + public void Respawn(PlayerRespawnEvent event) + { + Clean(event.getPlayer()); + } + + @EventHandler + public void Quit(PlayerQuitEvent event) + { + Clean(event.getPlayer()); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void Death(EntityDeathEvent event) + { + //Still Alive - SHOULD IGNORE DEATHS FROM DOMINATE + if (event.getEntity() instanceof Player) + if (event.getEntity().getHealth() > 0) + return; + + Clean(event.getEntity()); + } + + public void Clean(LivingEntity ent) + { + //Wipe Conditions + _conditions.remove(ent); + + //Remove Buffer + RemoveBuffer(_buffer.remove(ent)); + + _hideIndicator.remove(ent); + + //Clean Indicators + LinkedList inds = _indicators.remove(ent); + if (inds == null) + return; + + for (ConditionIndicator ind : inds) + { + HandlerList.unregisterAll(ind); + + if (ind.GetCondition().IsVisible()) + ind.GetIndicator().remove(); + } + } + + public void DebugInfo(Player player) + { + int count = 0; + for (LivingEntity ent : _indicators.keySet()) + { + if (ent.isDead() || !ent.isValid() || (ent instanceof Player && !((Player)ent).isOnline())) + { + count++; + } + } + + player.sendMessage(F.main(GetName(), count + " Invalid Indicators.")); + + count = 0; + for (LivingEntity ent : _conditions.keySet()) + { + if (ent.isDead() || !ent.isValid() || (ent instanceof Player && !((Player)ent).isOnline())) + { + count++; + } + } + + player.sendMessage(F.main(GetName(), count + " Invalid Conditions.")); + + count = 0; + for (LivingEntity ent : _buffer.keySet()) + { + if (ent.isDead() || !ent.isValid() || (ent instanceof Player && !((Player)ent).isOnline())) + { + count++; + } + } + + player.sendMessage(F.main(GetName(), count + " Invalid Buffers.")); + + count = 0; + for (Entity ent : _items) + { + if (ent.isDead() || !ent.isValid() || (ent instanceof Player && !((Player)ent).isOnline())) + { + count++; + } + } + + player.sendMessage(F.main(GetName(), count + " Invalid Items.")); + + count = 0; + for (LivingEntity ent : _hideIndicator) + { + if (ent.isDead() || !ent.isValid() || (ent instanceof Player && !((Player)ent).isOnline())) + { + count++; + } + } + + player.sendMessage(F.main(GetName(), count + " Invalid Hidden Indicators.")); + } + + @EventHandler + public void Debug(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (LivingEntity ent : _indicators.keySet()) + { + if (!(ent instanceof Player)) + continue; + + Player player = (Player)ent; + if (player.getItemInHand() == null) + continue; + + if (player.getItemInHand().getType() != Material.PAPER) + continue; + + if (!player.isOp()) + continue; + + UtilPlayer.message(player, C.cGray + _indicators.get(ent).size() + " Indicators ----------- " + _conditions.get(ent).size() + " Conditions"); + for (ConditionIndicator ind : _indicators.get(ent)) + UtilPlayer.message(player, + F.elem(ind.GetCondition().GetType() + " " + (ind.GetCondition().GetMult()+1)) + " for " + + F.time(UtilTime.convertString(ind.GetCondition().GetTicks()*50L, 1, TimeUnit.FIT)) + " via " + + F.skill(ind.GetCondition().GetReason()) + " from " + + F.name(UtilEnt.getName(ind.GetCondition().GetSource())) + "."); + } + } + + @EventHandler + public void Pickup(PlayerPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (_items.contains(event.getItem())) + event.setCancelled(true); + + else if (_buffer.containsValue(event.getItem())) + event.setCancelled(true); + } + + @EventHandler + public void HopperPickup(InventoryPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (_items.contains(event.getItem())) + event.setCancelled(true); + + else if (_buffer.containsValue(event.getItem())) + event.setCancelled(true); + } + + public void EndCondition(LivingEntity target, ConditionType type, String reason) + { + if (!_conditions.containsKey(target)) + return; + + for (Condition cond : _conditions.get(target)) + if (reason == null || cond.GetReason().equals(reason)) + if (type == null || cond.GetType() == type) + { + cond.Expire(); + + Condition best = GetBestCondition(target, cond.GetType()); + if (best != null) best.Apply(); + } + } + + public boolean HasCondition(LivingEntity target, ConditionType type, String reason) + { + if (!_conditions.containsKey(target)) + return false; + + for (Condition cond : _conditions.get(target)) + if (reason == null || cond.GetReason().equals(reason)) + if (type == null || cond.GetType() == type) + return true; + + return false; + } + + public WeakHashMap> GetIndicators() + { + return _indicators; + } + + public void SetIndicatorVisibility(LivingEntity ent, boolean showIndicator) + { + if (!showIndicator) + { + if (_hideIndicator.contains(ent)) + return; + + _hideIndicator.add(ent); + + LinkedList inds = _indicators.remove(ent); + if (inds == null) return; + + //Delete Indicators + for (ConditionIndicator ind : inds) + { + HandlerList.unregisterAll(ind); + + if (ind.GetCondition().IsVisible()) + ind.GetIndicator().remove(); + } + + //Remove Buffer + RemoveBuffer(_buffer.remove(ent)); + } + else + { + if (_hideIndicator.remove(ent)) + LoadIndicators(ent); + } + } + + public void RemoveBuffer(Entity buffer) + { + if (buffer == null) + return; + + buffer.eject(); + buffer.leaveVehicle(); + buffer.remove(); + } + + public void LoadIndicators(LivingEntity ent) + { + LinkedList inds = _indicators.get(ent); + if (inds == null) return; + + Entity previous = null; + for (ConditionIndicator ind : inds) + { + /** Spawn Indicator if Applicable **/ + if (ind.IsVisible() && !_hideIndicator.contains(ent)) + { + //First, Add Buffer + if (!_buffer.containsKey(ent)) + { + Entity buffer = ent.getWorld().dropItem(ent.getLocation(), ItemStackFactory.Instance.CreateStack(Material.GHAST_TEAR)); + ent.setPassenger(buffer); + _buffer.put(ent, buffer); + previous = buffer; + } + + previous.setPassenger(ind.GetIndicator()); + previous = ind.GetIndicator(); + } + } + } + + public boolean IsSilenced(LivingEntity ent, String ability) + { + if (!_indicators.containsKey(ent)) + return false; + + for (ConditionIndicator ind : _indicators.get(ent)) + if (ind.GetCondition().GetType() == ConditionType.SILENCE) + { + if (ability != null) + { + if (ent instanceof Player) + { + if (Recharge.Instance.use((Player)ent, "Silence Feedback", 200, false)) + { + //Inform + UtilPlayer.message(ent, F.main("Condition", "Cannot use " + F.skill(ability) + " while silenced.")); + + //Effect + ((Player)ent).playSound(ent.getLocation(), Sound.BAT_HURT, 0.8f, 0.8f); + } + } + } + return true; + } + + return false; + } + + public boolean IsInvulnerable(LivingEntity ent) + { + if (!_indicators.containsKey(ent)) + return false; + + for (ConditionIndicator ind : _indicators.get(ent)) + if (ind.GetCondition().GetType() == ConditionType.INVULNERABLE) + return true; + + return false; + } + + public boolean IsCloaked(LivingEntity ent) + { + if (!_indicators.containsKey(ent)) + return false; + + for (ConditionIndicator ind : _indicators.get(ent)) + if (ind.GetCondition().GetType() == ConditionType.CLOAK) + return true; + + return false; + } + + @EventHandler + public void DisableIndicators(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + Iterator>> conditionIndIterator = _indicators.entrySet().iterator(); + + while (conditionIndIterator.hasNext()) + { + Entry> entry = conditionIndIterator.next(); + LivingEntity ent = entry.getKey(); + + if (ent.isDead() || !ent.isValid() || (ent instanceof Player && !((Player)ent).isOnline())) + { + ent.remove(); + + for (ConditionIndicator ind : entry.getValue()) + { + HandlerList.unregisterAll(ind); + + if (ind.GetIndicator() != null) + ind.GetIndicator().remove(); + } + + conditionIndIterator.remove(); + } + } + + Iterator>> conditionIterator = _conditions.entrySet().iterator(); + + while (conditionIterator.hasNext()) + { + Entry> entry = conditionIterator.next(); + LivingEntity ent = entry.getKey(); + + if (ent.isDead() || !ent.isValid() || (ent instanceof Player && !((Player)ent).isOnline())) + { + ent.remove(); + + conditionIterator.remove(); + } + } + + Iterator> bufferIterator = _buffer.entrySet().iterator(); + + while (bufferIterator.hasNext()) + { + Entry entry = bufferIterator.next(); + LivingEntity ent = entry.getKey(); + + if (ent.isDead() || !ent.isValid() || (ent instanceof Player && !((Player)ent).isOnline())) + { + ent.remove(); + + bufferIterator.remove(); + } + } + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/Burning.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/Burning.java new file mode 100644 index 000000000..ed772a92a --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/Burning.java @@ -0,0 +1,40 @@ +package mineplex.minecraft.game.core.condition.conditions; + +import org.bukkit.Material; +import org.bukkit.entity.LivingEntity; + +import mineplex.minecraft.game.core.condition.Condition; +import mineplex.minecraft.game.core.condition.ConditionManager; + +public class Burning extends Condition +{ + public Burning(ConditionManager manager, String reason, LivingEntity ent, + LivingEntity source, ConditionType type, int mult, int ticks, + boolean add, Material visualType, byte visualData, + boolean showIndicator) + { + super(manager, reason, ent, source, type, mult, ticks, add, visualType, + visualData, showIndicator, false); + } + + @Override + public void Add() + { + + } + + @Override + public void Remove() + { + + } + + @Override + public void OnConditionAdd() + { + if (_ent.getFireTicks() > 0) + _ent.setFireTicks(_ent.getFireTicks() + _ticksTotal); + else + _ent.setFireTicks(_ticksTotal); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/Cloak.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/Cloak.java new file mode 100644 index 000000000..02bbdab45 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/Cloak.java @@ -0,0 +1,67 @@ +package mineplex.minecraft.game.core.condition.conditions; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; + +import mineplex.minecraft.game.core.condition.Condition; +import mineplex.minecraft.game.core.condition.ConditionManager; + +public class Cloak extends Condition +{ + + public Cloak(ConditionManager manager, String reason, LivingEntity ent, + LivingEntity source, ConditionType type, int mult, int ticks, + boolean add, Material visualType, byte visualData, + boolean showIndicator) + { + super(manager, reason, ent, source, type, mult, ticks, add, visualType, + visualData, showIndicator, false); + + _informOn = "You are now invisible."; + _informOff = "You are no longer invisible."; + } + + @Override + public void Add() + { + Manager.SetIndicatorVisibility(_ent, false); + + if (!(_ent instanceof Player)) + return; + + for (Player other : _ent.getServer().getOnlinePlayers()) + { + other.hidePlayer((Player)_ent); + } + + for (Entity ent : _ent.getWorld().getEntities()) + { + if (!(ent instanceof Creature)) + continue; + + Creature creature = (Creature)ent; + + if (creature.getTarget() != null && !creature.getTarget().equals(_ent)) + continue; + + creature.setTarget(null); + } + } + + @Override + public void Remove() + { + super.Remove(); + + Manager.SetIndicatorVisibility(_ent, true); + + for (Player other : _ent.getServer().getOnlinePlayers()) + { + other.hidePlayer((Player)_ent); + other.showPlayer((Player)_ent); + } + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/FireItemImmunity.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/FireItemImmunity.java new file mode 100644 index 000000000..1a758c2a3 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/FireItemImmunity.java @@ -0,0 +1,19 @@ +package mineplex.minecraft.game.core.condition.conditions; + +import org.bukkit.Material; +import org.bukkit.entity.LivingEntity; + +import mineplex.minecraft.game.core.condition.Condition; +import mineplex.minecraft.game.core.condition.ConditionManager; + +public class FireItemImmunity extends Condition +{ + public FireItemImmunity(ConditionManager manager, String reason, LivingEntity ent, + LivingEntity source, ConditionType type, int mult, int ticks, + boolean add, Material visualType, byte visualData, + boolean showIndicator) + { + super(manager, reason, ent, source, type, mult, ticks, add, visualType, + visualData, showIndicator, false); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/Silence.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/Silence.java new file mode 100644 index 000000000..3ae8dd505 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/Silence.java @@ -0,0 +1,34 @@ +package mineplex.minecraft.game.core.condition.conditions; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; + +import mineplex.minecraft.game.core.condition.Condition; +import mineplex.minecraft.game.core.condition.ConditionManager; + +public class Silence extends Condition +{ + public Silence(ConditionManager manager, String reason, LivingEntity ent, + LivingEntity source, ConditionType type, int mult, int ticks, + boolean add, Material visualType, byte visualData, + boolean showIndicator) + { + super(manager, reason, ent, source, type, mult, ticks, add, visualType, + visualData, showIndicator, false); + } + + @Override + public void Add() + { + if (_ent instanceof Player) + ((Player)_ent).playSound(_ent.getLocation(), Sound.BAT_HURT, 0.8f, 0.8f); + } + + @Override + public void Remove() + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/Vulnerability.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/Vulnerability.java new file mode 100644 index 000000000..e49b7a3e6 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/Vulnerability.java @@ -0,0 +1,26 @@ +package mineplex.minecraft.game.core.condition.conditions; + +import org.bukkit.Material; +import org.bukkit.entity.LivingEntity; + +import mineplex.core.common.util.F; +import mineplex.minecraft.game.core.condition.Condition; +import mineplex.minecraft.game.core.condition.ConditionManager; + +public class Vulnerability extends Condition +{ + + public Vulnerability(ConditionManager manager, String reason, LivingEntity ent, + LivingEntity source, ConditionType type, int mult, int ticks, + boolean add, Material visualType, byte visualData, + boolean showIndicator, boolean ambient) + { + super(manager, reason, ent, source, type, mult, ticks, add, visualType, + visualData, showIndicator, ambient); + + _showIndicator = false; + + _informOn = F.elem("Vulnerability " + (mult+1)) + " makes you take " + F.elem("+" + (mult+1) + " Damage") + + " and deal " + F.elem("-" + (mult+1) + " Damage") + "."; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/events/ConditionApplyEvent.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/events/ConditionApplyEvent.java new file mode 100644 index 000000000..1257804ff --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/events/ConditionApplyEvent.java @@ -0,0 +1,48 @@ +package mineplex.minecraft.game.core.condition.events; + +import mineplex.minecraft.game.core.condition.Condition; + +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ConditionApplyEvent extends Event implements Cancellable +{ + private static final HandlerList handlers = new HandlerList(); + private boolean _cancelled = false; + + private Condition _cond; + + public ConditionApplyEvent(Condition cond) + { + _cond = cond; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean cancel) + { + _cancelled = cancel; + } + + public Condition GetCondition() + { + return _cond; + } + +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java new file mode 100644 index 000000000..87f8f5e3c --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java @@ -0,0 +1,261 @@ +package mineplex.minecraft.game.core.damage; + +import java.util.ArrayList; +import java.util.HashMap; + +import mineplex.core.common.util.C; + +import org.bukkit.ChatColor; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +public class CustomDamageEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private DamageCause _eventCause; + private double _initialDamage; + + private ArrayList _damageMult = new ArrayList(); + private ArrayList _damageMod = new ArrayList(); + + private ArrayList _cancellers = new ArrayList(); + + private HashMap _knockbackMod = new HashMap(); + + //Ents + private LivingEntity _damageeEntity; + private Player _damageePlayer; + private LivingEntity _damagerEntity; + private Player _damagerPlayer; + private Projectile _projectile; + + //Flags + private boolean _ignoreArmor = false; + private boolean _ignoreRate = false; + private boolean _knockback = true; + private boolean _damageeBrute = false; + + public CustomDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile projectile, + DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, + String initialSource, String initialReason, boolean cancelled) + { + _eventCause = cause; + + if (initialSource == null || initialReason == null) + _initialDamage = damage; + + _damageeEntity = damagee; + if (_damageeEntity != null && _damageeEntity instanceof Player) _damageePlayer = (Player)_damageeEntity; + + _damagerEntity = damager; + if (_damagerEntity != null && _damagerEntity instanceof Player) _damagerPlayer = (Player)_damagerEntity; + + _projectile = projectile; + + _knockback = knockback; + _ignoreRate = ignoreRate; + _ignoreArmor = ignoreArmor; + + if (initialSource != null && initialReason != null) + AddMod(initialSource, initialReason, damage, true); + + if (_eventCause == DamageCause.FALL) + _ignoreArmor = true; + + if (cancelled) + SetCancelled("Pre-Cancelled"); + } + + @Override + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public void AddMult(String source, String reason, double mod, boolean useAttackName) + { + _damageMult.add(new DamageChange(source, reason, mod, useAttackName)); + } + + + public void AddMod(String source, String reason, double mod, boolean useAttackName) + { + _damageMod.add(new DamageChange(source, reason, mod, useAttackName)); + } + + public void AddKnockback(String reason, double d) + { + _knockbackMod.put(reason, d); + } + + public boolean IsCancelled() + { + return !_cancellers.isEmpty(); + } + + public void SetCancelled(String reason) + { + _cancellers.add(reason); + } + + public double GetDamage() + { + double damage = GetDamageInitial(); + + for (DamageChange mult : _damageMult) + damage *= mult.GetDamage(); + + for (DamageChange mult : _damageMod) + damage += mult.GetDamage(); + + return damage; + } + + public LivingEntity GetDamageeEntity() + { + return _damageeEntity; + } + + public Player GetDamageePlayer() + { + return _damageePlayer; + } + + public LivingEntity GetDamagerEntity(boolean ranged) + { + if (ranged) + return _damagerEntity; + + else if (_projectile == null) + return _damagerEntity; + + return null; + } + + public Player GetDamagerPlayer(boolean ranged) + { + if (ranged) + return _damagerPlayer; + + else if (_projectile == null) + return _damagerPlayer; + + return null; + } + + public Projectile GetProjectile() + { + return _projectile; + } + + public DamageCause GetCause() + { + return _eventCause; + } + + public double GetDamageInitial() + { + return _initialDamage; + } + + public void SetIgnoreArmor(boolean ignore) + { + _ignoreArmor = ignore; + } + + public void SetIgnoreRate(boolean ignore) + { + _ignoreRate = ignore; + } + + public void SetKnockback(boolean knockback) + { + _knockback = knockback; + } + + public void SetBrute() + { + _damageeBrute = true; + } + + public boolean IsBrute() + { + return _damageeBrute; + } + + public String GetReason() + { + String reason = ""; + + //Get Reason + for (DamageChange change : _damageMod) + if (change.UseReason()) + reason += C.mSkill + change.GetReason() + ChatColor.GRAY + ", "; + + //Trim Reason + if (reason.length() > 0) + { + reason = reason.substring(0, reason.length() - 2); + return reason; + } + + return null; + } + + public boolean IsKnockback() + { + return _knockback; + } + + public boolean IgnoreRate() + { + return _ignoreRate; + } + + public boolean IgnoreArmor() + { + return _ignoreArmor; + } + + public void SetDamager(LivingEntity ent) + { + if (ent == null) + return; + + _damagerEntity = ent; + + _damagerPlayer = null; + if (ent instanceof Player) + _damagerPlayer = (Player)ent; + } + + public ArrayList GetDamageMod() + { + return _damageMod; + } + + public ArrayList GetDamageMult() + { + return _damageMult; + } + + public HashMap GetKnockback() + { + return _knockbackMod; + } + + public ArrayList GetCancellers() + { + return _cancellers; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageChange.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageChange.java new file mode 100644 index 000000000..0bc1e16c0 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageChange.java @@ -0,0 +1,37 @@ +package mineplex.minecraft.game.core.damage; + +public class DamageChange +{ + private String _source; + private String _reason; + private double _modifier; + private boolean _useReason; + + public DamageChange(String source, String reason, double modifier, boolean useReason) + { + _source = source; + _reason = reason; + _modifier = modifier; + _useReason = useReason; + } + + public String GetSource() + { + return _source; + } + + public String GetReason() + { + return _reason; + } + + public double GetDamage() + { + return _modifier; + } + + public boolean UseReason() + { + return _useReason; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java new file mode 100644 index 000000000..a78867040 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -0,0 +1,505 @@ +package mineplex.minecraft.game.core.damage; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilGear; +import mineplex.core.npc.NpcManager; +import mineplex.minecraft.game.core.combat.CombatManager; +import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener; +import net.minecraft.server.v1_6_R2.DamageSource; +import net.minecraft.server.v1_6_R2.EntityHuman; +import net.minecraft.server.v1_6_R2.EntityLiving; + +import org.bukkit.EntityEffect; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity; +import org.bukkit.entity.Fish; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class DamageManager extends MiniPlugin +{ + private CombatManager _combatManager; + protected Field _lastDamageByPlayerTime; + protected Method _k; + + public boolean UseDefaultWeaponDamage = false; + + public DamageManager(JavaPlugin plugin, CombatManager combatManager, NpcManager npcManager) + { + super("Damage Manager", plugin); + + _combatManager = combatManager; + + try + { + _lastDamageByPlayerTime = EntityLiving.class.getDeclaredField("lastDamageByPlayerTime"); + _lastDamageByPlayerTime.setAccessible(true); + _k = EntityLiving.class.getDeclaredMethod("h", float.class); + _k.setAccessible(true); + } + catch (final Exception e) + { + System.out.println("Problem getting access to EntityLiving: " + e.getMessage()); + } + + RegisterEvents(new NpcProtectListener(npcManager)); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void StartDamageEvent(EntityDamageEvent event) + { + boolean preCancel = false; + if (event.isCancelled()) + preCancel = true; + + if (!(event.getEntity() instanceof LivingEntity)) + return; + + //Get Data + LivingEntity damagee = GetDamageeEntity(event); + LivingEntity damager = GetDamagerEntity(event, true); + Projectile projectile = GetProjectile(event); + + if (projectile instanceof Fish) + return; + + //Pre-Event Modifications + WeaponDamage(event, damager); + + //New Event + NewDamageEvent(damagee, damager, projectile, event.getCause(), event.getDamage(), true, false, false, null, null, preCancel); + + //event.setDamage(0); + //if (GoldPower(damager)) + event.setCancelled(true); + } + + /* + private boolean GoldPower(LivingEntity damager) + { + try + { + Player player = (Player)damager; + if (!Util().Gear().isGold(player.getItemInHand())) + return false; + + if (!player.getInventory().contains(Material.GOLD_NUGGET)) + return false; + + UtilInv.remove(player, Material.GOLD_NUGGET, (byte)0, 1); + return true; + } + catch (Exception e) + { + return false; + } + } + */ + + public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, + DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, + String source, String reason) + { + NewDamageEvent(damagee, damager, proj, + cause, damage, knockback, ignoreRate, ignoreArmor, + source, reason, false); + } + + public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, + DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, + String source, String reason, boolean cancelled) + { + _plugin.getServer().getPluginManager().callEvent( + new CustomDamageEvent(damagee, damager, proj, cause, damage, + knockback, ignoreRate, ignoreArmor, + source, reason, cancelled)); + } + + @EventHandler(priority = EventPriority.LOW) + public void CancelDamageEvent(CustomDamageEvent event) + { + if (event.GetDamageeEntity().getHealth() <= 0) + { + event.SetCancelled("0 Health"); + return; + } + + if (event.GetDamageePlayer() != null) + { + Player damagee = event.GetDamageePlayer(); + + //Not Survival + if (damagee.getGameMode() != GameMode.SURVIVAL) + { + event.SetCancelled("Damagee in Creative"); + return; + } + + //Limit World Damage Rate + if (!event.IgnoreRate()) + { + if (!_combatManager.Get(damagee.getName()).CanBeHurtBy(event.GetDamagerEntity(true))) + { + event.SetCancelled("Damage Rate"); + return; + } + } + } + + if (event.GetDamagerPlayer(true) != null) + { + Player damager = event.GetDamagerPlayer(true); + + //Not Survival + if (damager.getGameMode() != GameMode.SURVIVAL) + { + event.SetCancelled("Damager in Creative"); + return; + } + + //Damage Rate + if (!event.IgnoreRate()) + if (!_combatManager.Get(damager.getName()).CanHurt(event.GetDamageeEntity())) + { + event.SetCancelled("Damage Rate"); + return; + } + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void EndDamageEvent(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetDamage() < 1) + return; + + Damage(event); + } + + private void Damage(CustomDamageEvent event) + { + if (event.GetDamageeEntity().getHealth() <= 0) + return; + + //Player Conditions + if (event.GetDamageePlayer() != null) + { + //Register Damage (must happen before damage) + _combatManager.AddAttack(event); + } + + if (event.GetDamagerPlayer(true) != null) + { + //Display Damage to Damager + if (event.GetCause() != DamageCause.THORNS) + event.GetDamagerPlayer(true).setLevel((int)event.GetDamage()); + } + + try + { + int bruteBonus = 0; + if (event.IsBrute() && + ( + event.GetCause() == DamageCause.ENTITY_ATTACK || + event.GetCause() == DamageCause.PROJECTILE || + event.GetCause() == DamageCause.CUSTOM + ) && event.GetDamage() > 2) + bruteBonus = 10; + + //Do Damage + HandleDamage(event.GetDamageeEntity(), event.GetDamagerEntity(true), event.GetCause(), (int)event.GetDamage() + bruteBonus, event.IgnoreArmor()); + + //Effect + event.GetDamageeEntity().playEffect(EntityEffect.HURT); + + //Knockback + double knockback = event.GetDamage(); + if (knockback < 1) knockback = 1; + knockback = Math.log10(knockback); + + for (double cur : event.GetKnockback().values()) + knockback = knockback * cur; + + if (event.IsKnockback()) + if (event.GetDamagerEntity(true) != null) + { + Vector trajectory = UtilAlg.getTrajectory2d(event.GetDamagerEntity(true), event.GetDamageeEntity()); + trajectory.multiply(0.6 * knockback); + trajectory.setY(Math.abs(trajectory.getY())); + + UtilAction.velocity(event.GetDamageeEntity(), + trajectory, 0.2 + trajectory.length() * 0.8, false, 0, Math.abs(0.2 * knockback), 0.4 + (0.04 * knockback), true); + } + + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (InvocationTargetException e) + { + e.printStackTrace(); + } + } + + private void HandleDamage(LivingEntity damagee, LivingEntity damager, DamageCause cause, float damage, boolean ignoreArmor) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException + { + EntityLiving entityDamagee = ((CraftLivingEntity)damagee).getHandle(); + EntityLiving entityDamager = null; + if (damager != null) + entityDamager= ((CraftLivingEntity)damager).getHandle(); + + entityDamagee.aG = 1.5F; + + if ((float) entityDamagee.noDamageTicks > (float) entityDamagee.maxNoDamageTicks / 2.0F) + { + if (damage <= entityDamagee.lastDamage) + { + return; + } + + ApplyDamage(entityDamagee, damage - entityDamagee.lastDamage, ignoreArmor); + entityDamagee.lastDamage = damage; + } + else + { + entityDamagee.lastDamage = damage; + entityDamagee.ax = entityDamagee.getHealth(); + //entityDamagee.noDamageTicks = entityDamagee.maxNoDamageTicks; + ApplyDamage(entityDamagee, damage, ignoreArmor); + //entityDamagee.hurtTicks = entityDamagee.aW = 10; + } + + if (entityDamager != null) + entityDamagee.b(entityDamager); + + _lastDamageByPlayerTime.setInt(entityDamagee, 60); + + if (entityDamager != null) + if (entityDamager instanceof EntityHuman) + entityDamagee.killer = (EntityHuman)entityDamager; + + if (entityDamagee.getHealth() <= 0) + { + if (entityDamager != null) + { + if (entityDamager instanceof EntityHuman) entityDamagee.die(DamageSource.playerAttack((EntityHuman)entityDamager)); + else if (entityDamager instanceof EntityLiving) entityDamagee.die(DamageSource.mobAttack((EntityLiving)entityDamager)); + else entityDamagee.die(DamageSource.GENERIC); + } + else + entityDamagee.die(DamageSource.GENERIC); + } + } + + @EventHandler + public void DamageSound(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK && event.GetCause() != DamageCause.PROJECTILE) + return; + + //Damagee + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + //Sound + Sound sound = Sound.HURT_FLESH; + float vol = 1f; + float pitch = 1f; + + //Armor Sound + if (damagee instanceof Player) + { + Player player = (Player)damagee; + + double r = Math.random(); + + ItemStack stack = null; + + if (r > 0.50) stack = player.getInventory().getChestplate(); + else if (r > 0.25) stack = player.getInventory().getLeggings(); + else if (r > 0.10) stack = player.getInventory().getHelmet(); + else stack = player.getInventory().getBoots(); + + if (stack != null) + { + if (stack.getType().toString().contains("LEATHER_")) + { + sound = Sound.SHOOT_ARROW; + pitch = 2f; + } + else if (stack.getType().toString().contains("CHAINMAIL_")) + { + sound = Sound.ITEM_BREAK; + pitch = 1.4f; + } + else if (stack.getType().toString().contains("GOLD_")) + { + sound = Sound.ITEM_BREAK; + pitch = 1.8f; + } + else if (stack.getType().toString().contains("IRON_")) + { + sound = Sound.BLAZE_HIT; + pitch = 0.7f; + } + else if (stack.getType().toString().contains("DIAMOND_")) + { + sound = Sound.BLAZE_HIT; + pitch = 0.9f; + } + } + } + //Animal Sound + else + { + UtilEnt.PlayDamageSound(damagee); + } + + damagee.getWorld().playSound(damagee.getLocation(), sound, vol, pitch); + } + + private void ApplyDamage(EntityLiving entityLiving, float damage, boolean ignoreArmor) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException + { + if (!ignoreArmor) + { + int j = 25 - entityLiving.aP(); + float k = damage * (float)j; + + _k.invoke(entityLiving, damage); + damage = k / 25.0f; + } + + /** + if (entityLiving.hasEffect(MobEffectList.RESISTANCE)) + { + int j = (entityLiving.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5; + int k = 25 - j; + int l = damage * k + _aS.getInt(entityLiving); + + damage = l / 25; + _aS.setInt(entityLiving, l % 25); + } + **/ + + entityLiving.setHealth(entityLiving.getHealth() - damage); + } + + private void WeaponDamage(EntityDamageEvent event, LivingEntity ent) + { + + + if (!(ent instanceof Player)) + return; + + if (event.getCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = (Player)ent; + + if (UseDefaultWeaponDamage) + { + if (event.getDamage() > 1) + event.setDamage(event.getDamage() - 1); + + if (damager.getItemInHand().getType().name().contains("GOLD_")) + event.setDamage(event.getDamage() + 2); + + return; + } + + if (damager.getItemInHand() == null || !UtilGear.isWeapon(damager.getItemInHand())) + { + event.setDamage(1); + return; + } + + Material mat = damager.getItemInHand().getType(); + + int damage = 6; + + if (mat.name().contains("WOOD")) damage -= 3; + else if (mat.name().contains("STONE")) damage -= 2; + else if (mat.name().contains("DIAMOND")) damage += 0; + else if (mat.name().contains("GOLD")) damage += 1; + + event.setDamage(damage); + } + + private LivingEntity GetDamagerEntity(EntityDamageEvent event, boolean ranged) + { + if (!(event instanceof EntityDamageByEntityEvent)) + return null; + + EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent)event; + + //Get Damager + if (eventEE.getDamager() instanceof LivingEntity) + return (LivingEntity)eventEE.getDamager(); + + if (!ranged) + return null; + + if (!(eventEE.getDamager() instanceof Projectile)) + return null; + + Projectile projectile = (Projectile)eventEE.getDamager(); + + if (projectile.getShooter() == null) + return null; + + if (!(projectile.getShooter() instanceof LivingEntity)) + return null; + + return (LivingEntity)projectile.getShooter(); + } + + private LivingEntity GetDamageeEntity(EntityDamageEvent event) + { + if (event.getEntity() instanceof LivingEntity) + return (LivingEntity)event.getEntity(); + + return null; + } + + private Projectile GetProjectile(EntityDamageEvent event) + { + if (!(event instanceof EntityDamageByEntityEvent)) + return null; + + EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent)event; + + if (eventEE.getDamager() instanceof Projectile) + return (Projectile)eventEE.getDamager(); + + return null; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java.orig b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java.orig new file mode 100644 index 000000000..c069159dc --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java.orig @@ -0,0 +1,505 @@ +package mineplex.minecraft.game.core.damage; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilGear; +import mineplex.core.npc.NpcManager; +import mineplex.minecraft.game.core.combat.CombatManager; +import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener; +import net.minecraft.server.v1_6_R2.DamageSource; +import net.minecraft.server.v1_6_R2.EntityHuman; +import net.minecraft.server.v1_6_R2.EntityLiving; + +import org.bukkit.EntityEffect; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity; +import org.bukkit.entity.Fish; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class DamageManager extends MiniPlugin +{ + private CombatManager _combatManager; + protected Field _lastDamageByPlayerTime; + protected Method _k; + + public boolean UseDefaultWeaponDamage = false; + + public DamageManager(JavaPlugin plugin, CombatManager combatManager, NpcManager npcManager) + { + super("Damage Manager", plugin); + + _combatManager = combatManager; + + try + { + _lastDamageByPlayerTime = EntityLiving.class.getDeclaredField("lastDamageByPlayerTime"); + _lastDamageByPlayerTime.setAccessible(true); + _k = EntityLiving.class.getDeclaredMethod("h", float.class); + _k.setAccessible(true); + } + catch (final Exception e) + { + System.out.println("Problem getting access to EntityLiving: " + e.getMessage()); + } + + RegisterEvents(new NpcProtectListener(npcManager)); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void StartDamageEvent(EntityDamageEvent event) + { + boolean preCancel = false; + if (event.isCancelled()) + preCancel = true; + + if (!(event.getEntity() instanceof LivingEntity)) + return; + + //Get Data + LivingEntity damagee = GetDamageeEntity(event); + LivingEntity damager = GetDamagerEntity(event, true); + Projectile projectile = GetProjectile(event); + + if (projectile instanceof Fish) + return; + + //Pre-Event Modifications + WeaponDamage(event, damager); + + //New Event + NewDamageEvent(damagee, damager, projectile, event.getCause(), event.getDamage(), true, false, false, null, null, preCancel); + + //event.setDamage(0); + //if (GoldPower(damager)) + event.setCancelled(true); + } + + /* + private boolean GoldPower(LivingEntity damager) + { + try + { + Player player = (Player)damager; + if (!Util().Gear().isGold(player.getItemInHand())) + return false; + + if (!player.getInventory().contains(Material.GOLD_NUGGET)) + return false; + + UtilInv.remove(player, Material.GOLD_NUGGET, (byte)0, 1); + return true; + } + catch (Exception e) + { + return false; + } + } + */ + + public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, + DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, + String source, String reason) + { + NewDamageEvent(damagee, damager, proj, + cause, damage, knockback, ignoreRate, ignoreArmor, + source, reason, false); + } + + public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, + DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, + String source, String reason, boolean cancelled) + { + _plugin.getServer().getPluginManager().callEvent( + new CustomDamageEvent(damagee, damager, proj, cause, damage, + knockback, ignoreRate, ignoreArmor, + source, reason, cancelled)); + } + + @EventHandler(priority = EventPriority.LOW) + public void CancelDamageEvent(CustomDamageEvent event) + { + if (event.GetDamageeEntity().getHealth() <= 0) + { + event.SetCancelled("0 Health"); + return; + } + + if (event.GetDamageePlayer() != null) + { + Player damagee = event.GetDamageePlayer(); + + //Not Survival + if (damagee.getGameMode() != GameMode.SURVIVAL) + { + event.SetCancelled("Damagee in Creative"); + return; + } + + //Limit World Damage Rate + if (!event.IgnoreRate()) + { + if (!_combatManager.Get(damagee.getName()).CanBeHurtBy(event.GetDamagerEntity(true))) + { + event.SetCancelled("Damage Rate"); + return; + } + } + } + + if (event.GetDamagerPlayer(true) != null) + { + Player damager = event.GetDamagerPlayer(true); + + //Not Survival + if (damager.getGameMode() != GameMode.SURVIVAL) + { + event.SetCancelled("Damager in Creative"); + return; + } + + //Damage Rate + if (!event.IgnoreRate()) + if (!_combatManager.Get(damager.getName()).CanHurt(event.GetDamageeEntity())) + { + event.SetCancelled("Damage Rate"); + return; + } + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void EndDamageEvent(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetDamage() < 1) + return; + + Damage(event); + } + + private void Damage(CustomDamageEvent event) + { + if (event.GetDamageeEntity().getHealth() <= 0) + return; + + //Player Conditions + if (event.GetDamageePlayer() != null) + { + //Register Damage (must happen before damage) + _combatManager.AddAttack(event); + } + + if (event.GetDamagerPlayer(true) != null) + { + //Display Damage to Damager + if (event.GetCause() != DamageCause.THORNS) + event.GetDamagerPlayer(true).setLevel((int)event.GetDamage()); + } + + try + { + int bruteBonus = 0; + if (event.IsBrute() && + ( + event.GetCause() == DamageCause.ENTITY_ATTACK || + event.GetCause() == DamageCause.PROJECTILE || + event.GetCause() == DamageCause.CUSTOM + ) && event.GetDamage() > 2) + bruteBonus = 10; + + //Do Damage + HandleDamage(event.GetDamageeEntity(), event.GetDamagerEntity(true), event.GetCause(), (int)event.GetDamage() + bruteBonus, event.IgnoreArmor()); + + //Effect + event.GetDamageeEntity().playEffect(EntityEffect.HURT); + + //Knockback + double knockback = event.GetDamage(); + if (knockback < 1) knockback = 1; + knockback = Math.log10(knockback); + + for (double cur : event.GetKnockback().values()) + knockback = knockback * cur; + + if (event.IsKnockback()) + if (event.GetDamagerEntity(true) != null) + { + Vector trajectory = UtilAlg.getTrajectory2d(event.GetDamagerEntity(true), event.GetDamageeEntity()); + trajectory.multiply(0.6 * knockback); + trajectory.setY(Math.abs(trajectory.getY())); + + UtilAction.velocity(event.GetDamageeEntity(), + trajectory, 0.2 + trajectory.length() * 0.8, false, 0, Math.abs(0.2 * knockback), 0.4 + (0.04 * knockback), true); + } + + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (InvocationTargetException e) + { + e.printStackTrace(); + } + } + + private void HandleDamage(LivingEntity damagee, LivingEntity damager, DamageCause cause, float damage, boolean ignoreArmor) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException + { + EntityLiving entityDamagee = ((CraftLivingEntity)damagee).getHandle(); + EntityLiving entityDamager = null; + if (damager != null) + entityDamager= ((CraftLivingEntity)damager).getHandle(); + + entityDamagee.aG = 1.5F; + + if ((float) entityDamagee.noDamageTicks > (float) entityDamagee.maxNoDamageTicks / 2.0F) + { + if (damage <= entityDamagee.lastDamage) + { + return; + } + + ApplyDamage(entityDamagee, damage - entityDamagee.lastDamage, ignoreArmor); + entityDamagee.lastDamage = damage; + } + else + { + entityDamagee.lastDamage = damage; + entityDamagee.ax = entityDamagee.getHealth(); + //entityDamagee.noDamageTicks = entityDamagee.maxNoDamageTicks; + ApplyDamage(entityDamagee, damage, ignoreArmor); + //entityDamagee.hurtTicks = entityDamagee.aW = 10; + } + + if (entityDamager != null) + entityDamagee.b(entityDamager); + + _lastDamageByPlayerTime.setInt(entityDamagee, 60); + + if (entityDamager != null) + if (entityDamager instanceof EntityHuman) + entityDamagee.killer = (EntityHuman)entityDamager; + + if (entityDamagee.getHealth() <= 0) + { + if (entityDamager != null) + { + if (entityDamager instanceof EntityHuman) entityDamagee.die(DamageSource.playerAttack((EntityHuman)entityDamager)); + else if (entityDamager instanceof EntityLiving) entityDamagee.die(DamageSource.mobAttack((EntityLiving)entityDamager)); + else entityDamagee.die(DamageSource.GENERIC); + } + else + entityDamagee.die(DamageSource.GENERIC); + } + } + + @EventHandler + public void DamageSound(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK && event.GetCause() != DamageCause.PROJECTILE) + return; + + //Damagee + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + //Sound + Sound sound = Sound.HURT_FLESH; + float vol = 1f; + float pitch = 1f; + + //Armor Sound + if (damagee instanceof Player) + { + Player player = (Player)damagee; + + double r = Math.random(); + + ItemStack stack = null; + + if (r > 0.50) stack = player.getInventory().getChestplate(); + else if (r > 0.25) stack = player.getInventory().getLeggings(); + else if (r > 0.10) stack = player.getInventory().getHelmet(); + else stack = player.getInventory().getBoots(); + + if (stack != null) + { + if (stack.getType().toString().contains("LEATHER_")) + { + sound = Sound.SHOOT_ARROW; + pitch = 2f; + } + else if (stack.getType().toString().contains("CHAINMAIL_")) + { + sound = Sound.ITEM_BREAK; + pitch = 1.4f; + } + else if (stack.getType().toString().contains("GOLD_")) + { + sound = Sound.ITEM_BREAK; + pitch = 1.8f; + } + else if (stack.getType().toString().contains("IRON_")) + { + sound = Sound.BLAZE_HIT; + pitch = 0.7f; + } + else if (stack.getType().toString().contains("DIAMOND_")) + { + sound = Sound.BLAZE_HIT; + pitch = 0.9f; + } + } + } + //Animal Sound + else + { + UtilEnt.PlayDamageSound(damagee); + } + + damagee.getWorld().playSound(damagee.getLocation(), sound, vol, pitch); + } + + private void ApplyDamage(EntityLiving entityLiving, float damage, boolean ignoreArmor) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException + { + if (!ignoreArmor) + { + int j = 25 - entityLiving.aP(); + float k = damage * (float)j; + + _k.invoke(entityLiving, damage); + damage = k / 25.0f; + } + + /** + if (entityLiving.hasEffect(MobEffectList.RESISTANCE)) + { + int j = (entityLiving.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5; + int k = 25 - j; + int l = damage * k + _aS.getInt(entityLiving); + + damage = l / 25; + _aS.setInt(entityLiving, l % 25); + } + **/ + + entityLiving.setHealth(entityLiving.getHealth() - damage); + } + + private void WeaponDamage(EntityDamageEvent event, LivingEntity ent) + { + + + if (!(ent instanceof Player)) + return; + + if (event.getCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = (Player)ent; + + if (UseDefaultWeaponDamage) + { + if (event.getDamage() > 1) + event.setDamage(event.getDamage() - 1); + + if (damager.getItemInHand().getType().name().contains("GOLD_")) + event.setDamage(event.getDamage() + 3); + + return; + } + + if (damager.getItemInHand() == null || !UtilGear.isWeapon(damager.getItemInHand())) + { + event.setDamage(1); + return; + } + + Material mat = damager.getItemInHand().getType(); + + int damage = 6; + + if (mat.name().contains("WOOD")) damage -= 3; + else if (mat.name().contains("STONE")) damage -= 2; + else if (mat.name().contains("DIAMOND")) damage += 0; + else if (mat.name().contains("GOLD")) damage += 1; + + event.setDamage(damage); + } + + private LivingEntity GetDamagerEntity(EntityDamageEvent event, boolean ranged) + { + if (!(event instanceof EntityDamageByEntityEvent)) + return null; + + EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent)event; + + //Get Damager + if (eventEE.getDamager() instanceof LivingEntity) + return (LivingEntity)eventEE.getDamager(); + + if (!ranged) + return null; + + if (!(eventEE.getDamager() instanceof Projectile)) + return null; + + Projectile projectile = (Projectile)eventEE.getDamager(); + + if (projectile.getShooter() == null) + return null; + + if (!(projectile.getShooter() instanceof LivingEntity)) + return null; + + return (LivingEntity)projectile.getShooter(); + } + + private LivingEntity GetDamageeEntity(EntityDamageEvent event) + { + if (event.getEntity() instanceof LivingEntity) + return (LivingEntity)event.getEntity(); + + return null; + } + + private Projectile GetProjectile(EntityDamageEvent event) + { + if (!(event instanceof EntityDamageByEntityEvent)) + return null; + + EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent)event; + + if (eventEE.getDamager() instanceof Projectile) + return (Projectile)eventEE.getDamager(); + + return null; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/compatibility/NpcProtectListener.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/compatibility/NpcProtectListener.java new file mode 100644 index 000000000..3fdb92785 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/compatibility/NpcProtectListener.java @@ -0,0 +1,27 @@ +package mineplex.minecraft.game.core.damage.compatibility; + +import mineplex.core.npc.NpcManager; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; + +public class NpcProtectListener implements Listener +{ + private NpcManager _npcManager; + + public NpcProtectListener(NpcManager npcManager) + { + _npcManager = npcManager; + } + + @EventHandler(priority = EventPriority.LOWEST) + public void CustomDamage(CustomDamageEvent event) + { + if (event.GetDamageeEntity() != null && _npcManager.GetNpcByUUID(event.GetDamageeEntity().getUniqueId()) != null) + { + event.SetCancelled("NPC"); + } + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java new file mode 100644 index 000000000..61dc59d41 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java @@ -0,0 +1,224 @@ +package mineplex.minecraft.game.core.fire; + +import java.util.HashMap; +import java.util.HashSet; + +import mineplex.core.MiniPlugin; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.damage.DamageManager; + +import org.bukkit.Effect; +import org.bukkit.EntityEffect; +import org.bukkit.Location; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.inventory.InventoryPickupItemEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.potion.PotionEffectType; + +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; + +public class Fire extends MiniPlugin +{ + private ConditionManager _conditionManager; + private DamageManager _damageManager; + private HashMap _fire = new HashMap(); + + public Fire(JavaPlugin plugin, ConditionManager conditionManager, DamageManager damageManager) + { + super("Fire", plugin); + + _conditionManager = conditionManager; + _damageManager = damageManager; + } + + public void Add(Item item, LivingEntity owner, double expireTime, double delayTime, double burnTime, int damage, String skillName) + { + _fire.put(item, new FireData(owner, expireTime, delayTime, burnTime, damage, skillName)); + item.setPickupDelay(0); + } + + @EventHandler + public void IgniteCollide(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashMap collided = new HashMap(); + + for (Item fire : _fire.keySet()) + { + if (!_fire.get(fire).IsPrimed()) + continue; + + for (LivingEntity ent : fire.getWorld().getEntitiesByClass(LivingEntity.class)) + { + if (ent instanceof Player) + if (((CraftPlayer)ent).getHandle().spectating) + continue; + + if (ent.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE)) + continue; + + if (ent.equals(_fire.get(fire).GetOwner())) + continue; + + if (_conditionManager.HasCondition(ent, ConditionType.FIRE_ITEM_IMMUNITY, null)) + { + continue; + } + + + if (!UtilEnt.hitBox(fire.getLocation(), ent, 1.5)) + continue; + + collided.put(fire, ent); + } + } + + for (Item fire : collided.keySet()) + { + FireData fireData = _fire.remove(fire); + fire.remove(); + Ignite(collided.get(fire), fireData); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void IgnitePickup(PlayerPickupItemEvent event) + { + Player player = event.getPlayer(); + Item fire = event.getItem(); + + if (!_fire.containsKey(fire)) + return; + + event.setCancelled(true); + + if (((CraftPlayer)player).getHandle().spectating) + return; + + if (player.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE)) + return; + + if (!_fire.get(fire).IsPrimed()) + return; + + if (_conditionManager.HasCondition(player, ConditionType.FIRE_ITEM_IMMUNITY, null)) + { + return; + } + + if (!UtilEnt.hitBox(fire.getLocation(), player, 1.5)) + return; + + //Remove + FireData fireData = _fire.remove(fire); + fire.remove(); + Ignite(player, fireData); + } + + @EventHandler + public void HopperPickup(InventoryPickupItemEvent event) + { + if (_fire.containsKey(event.getItem())) + event.setCancelled(true); + } + + public void Ignite(LivingEntity ent, FireData fireData) + { + if (ent == null) + { + System.out.println("Fire.class: Player is NULL"); + return; + } + + _conditionManager.Factory().Ignite(fireData.GetName(), ent, fireData.GetOwner(), fireData.GetBurnTime(), true, true); + + //Damage + if (fireData.GetDamage() > 0) + { + //Inferno Negate + if (fireData.GetDamage() == 1) + if (ent instanceof Player) + if (!Recharge.Instance.use((Player)ent, "Fire Damage", 150, false)) + { + ent.playEffect(EntityEffect.HURT); + return; + } + + + //Damage Event + _damageManager.NewDamageEvent(ent, fireData.GetOwner(), null, + DamageCause.CUSTOM, fireData.GetDamage(), false, true, false, + UtilEnt.getName(fireData.GetOwner()), fireData.GetName()); + } + } + + + + @EventHandler + public void Expire(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet expire = new HashSet(); + + for (Item cur : _fire.keySet()) + { + if (!cur.isValid() || _fire.get(cur).Expired()) + expire.add(cur); + } + for (Item cur : expire) + { + _fire.remove(cur); + cur.remove(); + } + } + + public void Remove(LivingEntity owner, String cause) + { + HashSet remove = new HashSet(); + + for (Item cur : _fire.keySet()) + if (owner == null || _fire.get(cur).GetOwner().equals(owner)) + if (cause == null || _fire.get(cur).GetName().equals(cause)) + remove.add(cur); + + for (Item cur : remove) + { + _fire.remove(cur); + cur.remove(); + } + } + + public void RemoveNear(Location loc, double range) + { + HashSet remove = new HashSet(); + + for (Item cur : _fire.keySet()) + if (UtilMath.offset(loc, cur.getLocation()) < range) + remove.add(cur); + + for (Item cur : remove) + { + _fire.remove(cur); + + cur.getWorld().playEffect(cur.getLocation(), Effect.EXTINGUISH, 0); + + cur.remove(); + } + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/FireData.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/FireData.java new file mode 100644 index 000000000..e70f5627f --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/FireData.java @@ -0,0 +1,53 @@ +package mineplex.minecraft.game.core.fire; + +import org.bukkit.entity.LivingEntity; + +public class FireData +{ + private LivingEntity _owner; + private long _expireTime; + private long _delayTime; + private double _burnTime; + private int _damage; + private String _skillName; + + public FireData(LivingEntity owner, double expireTime, double delayTime, double burnTime, int damage, String skillName) + { + _owner = owner; + _expireTime = System.currentTimeMillis() + (long)(1000 * expireTime); + _delayTime = System.currentTimeMillis() + (long)(1000 * delayTime); + _burnTime = burnTime; + _damage = damage; + _skillName = skillName; + } + + public LivingEntity GetOwner() + { + return _owner; + } + + public double GetBurnTime() + { + return _burnTime; + } + + public int GetDamage() + { + return _damage; + } + + public String GetName() + { + return _skillName; + } + + public boolean IsPrimed() + { + return System.currentTimeMillis() > _delayTime; + } + + public boolean Expired() + { + return System.currentTimeMillis() > _expireTime; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/mechanics/PistonJump.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/mechanics/PistonJump.java new file mode 100644 index 000000000..1a23e9669 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/mechanics/PistonJump.java @@ -0,0 +1,120 @@ +package mineplex.minecraft.game.core.mechanics; + +import java.util.HashMap; +import java.util.HashSet; + +import mineplex.core.MiniPlugin; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilTime; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.BlockState; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.material.PistonBaseMaterial; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class PistonJump extends MiniPlugin +{ + private HashMap _pistonExtend = new HashMap(); + + public PistonJump(JavaPlugin plugin) + { + super("Piston Jump", plugin); + } + + @EventHandler + public void PistonLaunch(PlayerMoveEvent event) + { + Block below = event.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN); + + if (below.getTypeId() != 33) + return; + + if (below.getData() != 1) + return; + + if (below.getRelative(BlockFace.UP).getType() != Material.AIR) + return; + + if (_pistonExtend.containsKey(below)) + return; + + for (Player player : below.getWorld().getPlayers()) + { + if (!below.equals(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + continue; + + //Vector + Vector vec = new Vector(0,1.2,0); + + player.setVelocity(vec); + player.setFallDistance(0); + } + + final Block block = below; + _plugin.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() + { + public void run() + { + //Extend + BlockState state = block.getState(); + PistonBaseMaterial pbm = (PistonBaseMaterial)state.getData(); + pbm.setPowered(true); + state.setData(pbm); + state.update(true); + + block.getRelative(BlockFace.UP).setTypeIdAndData(34, (byte)1, false); + + _pistonExtend.put(block, System.currentTimeMillis()); + //Effect + + block.getWorld().playSound(block.getLocation(), Sound.PISTON_EXTEND, 1f, 1f); + } + }, 10); + } + + + @EventHandler + public void PistonExtendUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + HashSet retract = new HashSet(); + + for (Block cur : _pistonExtend.keySet()) + { + if (UtilTime.elapsed(_pistonExtend.get(cur), 600)) + retract.add(cur); + } + + for (Block cur : retract) + { + _pistonExtend.remove(cur); + + //Retract + if (cur.getTypeId() == 33) + { + //Extend + BlockState state = cur.getState(); + PistonBaseMaterial pbm = (PistonBaseMaterial)state.getData(); + pbm.setPowered(false); + state.setData(pbm); + state.update(true); + } + + if (cur.getRelative(BlockFace.UP).getTypeId() == 34) + cur.getRelative(BlockFace.UP).setTypeIdAndData(0, (byte)0, true); + + //Effect + cur.getWorld().playSound(cur.getLocation(), Sound.PISTON_RETRACT, 1f, 1f); + } + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/mechanics/Weapon.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/mechanics/Weapon.java new file mode 100644 index 000000000..a601abc1f --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/mechanics/Weapon.java @@ -0,0 +1,142 @@ +package mineplex.minecraft.game.core.mechanics; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.potion.PotionEffectType; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.energy.Energy; + +public class Weapon extends MiniPlugin +{ + private Energy _energy; + + public Weapon(JavaPlugin plugin, Energy energy) + { + super("Weapon", plugin); + _energy = energy; + } + + @EventHandler + public void ShootBow(EntityShootBowEvent event) + { + if (event.getEntity().getLocation().getBlock().isLiquid()) + { + UtilPlayer.message(event.getEntity(), F.main("Skill", "You cannot use " + F.item("Bow") + " in water.")); + event.setCancelled(true); + return; + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void ArrowFix(CustomDamageEvent event) + { + Projectile proj = event.GetProjectile(); + if (proj == null) return; + + if (!(proj instanceof Arrow)) + return; + + event.AddMod("Del", "Arrow Fix", -event.GetDamageInitial(), false); + event.AddMod("Add", "Arrow Fix", proj.getVelocity().length() * 3, false); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void ArrowDelete(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Projectile proj = event.GetProjectile(); + if (proj == null) return; + + proj.remove(); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void AttackExhaust(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + //No Energy + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (damager.hasPotionEffect(PotionEffectType.FAST_DIGGING)) + return; + + if (_energy.Use(damager, "Attack", 1, false, false)) + return; + + //50% + event.AddMod(damager.getName(), "Exhaustion", -event.GetDamageInitial() + 1, false); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void WeaponDurability(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (GoldPower(damager)) + return; + + ItemStack item = damager.getItemInHand(); + + if (item == null) + return; + + if (item.getType().getMaxDurability() == 0) + return; + + item.setDurability((short) (item.getDurability() + 1)); + + if (item.getDurability() >= item.getType().getMaxDurability()) + { + UtilPlayer.message(damager, F.main("Weapon", "Your " + F.item(item.getItemMeta().getDisplayName()) + " has broken.")); + damager.setItemInHand(null); + UtilInv.Update(damager); + damager.getWorld().playSound(damager.getLocation(), Sound.ANVIL_LAND, 1f, 0.8f); + } + } + + private boolean GoldPower(Player damager) + { + try + { + if (!UtilGear.isGold(damager.getItemInHand())) + return false; + + if (!damager.getInventory().contains(Material.GOLD_NUGGET)) + return false; + + UtilInv.remove(damager, Material.GOLD_NUGGET, (byte)0, 1); + return true; + } + catch (Exception e) + { + return false; + } + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/.classpath b/Plugins/Nautilus.Core.CraftBukkit/.classpath new file mode 100644 index 000000000..a1ba26cd0 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/Plugins/Nautilus.Core.CraftBukkit/.externalToolBuilders/CB2.launch b/Plugins/Nautilus.Core.CraftBukkit/.externalToolBuilders/CB2.launch new file mode 100644 index 000000000..4067ec440 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/.externalToolBuilders/CB2.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Core.CraftBukkit/.project b/Plugins/Nautilus.Core.CraftBukkit/.project new file mode 100644 index 000000000..e093b6bfc --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/.project @@ -0,0 +1,47 @@ + + + Nautilus.Core.CraftBukkit + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + auto,full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/CB2.launch + + + + + + org.eclipse.jdt.core.javanature + + + + 1350069218645 + + 26 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-main + + + + 1350069218648 + + 26 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-test + + + + diff --git a/Plugins/Nautilus.Core.CraftBukkit/.settings/org.eclipse.jdt.core.prefs b/Plugins/Nautilus.Core.CraftBukkit/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..8000cd6ca --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/Plugins/Nautilus.Core.CraftBukkit/Nautilus.Core.CraftBukkit.xml b/Plugins/Nautilus.Core.CraftBukkit/Nautilus.Core.CraftBukkit.xml new file mode 100644 index 000000000..6c0a40a56 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/Nautilus.Core.CraftBukkit.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/AsyncLoginThread$1.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/AsyncLoginThread$1.class new file mode 100644 index 000000000..0ed7b902c Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/AsyncLoginThread$1.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/AsyncLoginThread.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/AsyncLoginThread.class new file mode 100644 index 000000000..c9d4cd65f Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/AsyncLoginThread.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/Chunk.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/Chunk.class new file mode 100644 index 000000000..88dda8afa Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/Chunk.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/ChunkAddEntityEvent.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/ChunkAddEntityEvent.class new file mode 100644 index 000000000..9c901300a Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/ChunkAddEntityEvent.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/ChunkPreLoadEvent.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/ChunkPreLoadEvent.class new file mode 100644 index 000000000..c4415abf5 Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/ChunkPreLoadEvent.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/ChunkProviderServer.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/ChunkProviderServer.class new file mode 100644 index 000000000..bb3bf0afc Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/ChunkProviderServer.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/ContainerAnvilInventory.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/ContainerAnvilInventory.class new file mode 100644 index 000000000..1a0055faa Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/ContainerAnvilInventory.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/EntityHuman.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/EntityHuman.class new file mode 100644 index 000000000..250ea8270 Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/EntityHuman.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/EntityPlayer.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/EntityPlayer.class new file mode 100644 index 000000000..cd666740f Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/EntityPlayer.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/Packet.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/Packet.class new file mode 100644 index 000000000..ba93ac0b5 Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/Packet.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PendingConnection.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PendingConnection.class new file mode 100644 index 000000000..14f169199 Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PendingConnection.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerChunk$1.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerChunk$1.class new file mode 100644 index 000000000..6bf2beb5e Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerChunk$1.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerChunk$2.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerChunk$2.class new file mode 100644 index 000000000..1b75db1ff Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerChunk$2.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerChunk.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerChunk.class new file mode 100644 index 000000000..beccfa8be Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerChunk.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerConnection$1.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerConnection$1.class new file mode 100644 index 000000000..542a41334 Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerConnection$1.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerConnection$2.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerConnection$2.class new file mode 100644 index 000000000..f67ee646d Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerConnection$2.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerConnection$3.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerConnection$3.class new file mode 100644 index 000000000..995d8da03 Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerConnection$3.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerConnection$4.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerConnection$4.class new file mode 100644 index 000000000..916a7a77a Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerConnection$4.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerConnection.class b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerConnection.class new file mode 100644 index 000000000..240c755f4 Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/net/minecraft/server/v1_6_R2/PlayerConnection.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/org/bukkit/craftbukkit/v1_6_R2/entity/CraftPlayer.class b/Plugins/Nautilus.Core.CraftBukkit/bin/org/bukkit/craftbukkit/v1_6_R2/entity/CraftPlayer.class new file mode 100644 index 000000000..4081a07f6 Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/org/bukkit/craftbukkit/v1_6_R2/entity/CraftPlayer.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/org/bukkit/craftbukkit/v1_6_R2/inventory/CraftInventoryCustom.class b/Plugins/Nautilus.Core.CraftBukkit/bin/org/bukkit/craftbukkit/v1_6_R2/inventory/CraftInventoryCustom.class new file mode 100644 index 000000000..3cee44986 Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/org/bukkit/craftbukkit/v1_6_R2/inventory/CraftInventoryCustom.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/org/bukkit/craftbukkit/v1_6_R2/inventory/CraftItemStack.class b/Plugins/Nautilus.Core.CraftBukkit/bin/org/bukkit/craftbukkit/v1_6_R2/inventory/CraftItemStack.class new file mode 100644 index 000000000..9b3dc43b2 Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/org/bukkit/craftbukkit/v1_6_R2/inventory/CraftItemStack.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/bin/org/bukkit/craftbukkit/v1_6_R2/inventory/MinecraftInventory.class b/Plugins/Nautilus.Core.CraftBukkit/bin/org/bukkit/craftbukkit/v1_6_R2/inventory/MinecraftInventory.class new file mode 100644 index 000000000..16ddad9e0 Binary files /dev/null and b/Plugins/Nautilus.Core.CraftBukkit/bin/org/bukkit/craftbukkit/v1_6_R2/inventory/MinecraftInventory.class differ diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/AsyncLoginThread.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/AsyncLoginThread.java new file mode 100644 index 000000000..028eb4b5d --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/AsyncLoginThread.java @@ -0,0 +1,78 @@ +package net.minecraft.server.v1_6_R2; + +import org.bukkit.craftbukkit.v1_6_R2.CraftServer; +import org.bukkit.craftbukkit.v1_6_R2.util.Waitable; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent; +import org.bukkit.event.player.PlayerPreLoginEvent; + +@SuppressWarnings("deprecation") +public class AsyncLoginThread extends Thread +{ + final PendingConnection pendingConnection; + + // CraftBukkit start + CraftServer server; + + AsyncLoginThread(PendingConnection pendingconnection, CraftServer server) + { + this.server = server; + // CraftBukkit end + this.pendingConnection = pendingconnection; + } + + public void run() + { + try + { + // CraftBukkit start + if (this.pendingConnection.getSocket() == null) { + return; + } + + AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(PendingConnection.d(this.pendingConnection), this.pendingConnection.getSocket().getInetAddress()); + this.server.getPluginManager().callEvent(asyncEvent); + + if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) + { + final PlayerPreLoginEvent event = new PlayerPreLoginEvent(PendingConnection.d(this.pendingConnection), this.pendingConnection.getSocket().getInetAddress()); + if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) + { + event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage()); + } + Waitable waitable = new Waitable() + { + @Override + protected PlayerPreLoginEvent.Result evaluate() + { + AsyncLoginThread.this.server.getPluginManager().callEvent(event); + return event.getResult(); + }}; + + PendingConnection.b(this.pendingConnection).processQueue.add(waitable); + if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) + { + this.pendingConnection.disconnect(event.getKickMessage()); + return; + } + } + else + { + if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) + { + this.pendingConnection.disconnect(asyncEvent.getKickMessage()); + return; + } + } + // CraftBukkit end + + PendingConnection.a(this.pendingConnection, true); + // CraftBukkit start + } + catch (Exception exception) + { + this.pendingConnection.disconnect("Failed to verify username!"); + server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + PendingConnection.d(this.pendingConnection), exception); + // CraftBukkit end + } + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/Chunk.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/Chunk.java new file mode 100644 index 000000000..f88385d63 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/Chunk.java @@ -0,0 +1,939 @@ +package net.minecraft.server.v1_6_R2; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; + +import org.bukkit.Bukkit; // CraftBukkit + +public class Chunk { + + public static boolean a; + private ChunkSection[] sections; + private byte[] s; + public int[] b; + public boolean[] c; + public boolean d; + public World world; + public int[] heightMap; + public final int x; + public final int z; + private boolean t; + public Map tileEntities; + public List[] entitySlices; + public boolean done; + public boolean l; + public boolean m; + public long n; + public boolean seenByPlayer; + public int p; + public long q; + private int u; + + public Chunk(World world, int i, int j) { + this.sections = new ChunkSection[16]; + this.s = new byte[256]; + this.b = new int[256]; + this.c = new boolean[256]; + this.tileEntities = new HashMap(); + this.u = 4096; + this.entitySlices = new List[16]; + this.world = world; + this.x = i; + this.z = j; + this.heightMap = new int[256]; + + for (int k = 0; k < this.entitySlices.length; ++k) { + this.entitySlices[k] = new org.bukkit.craftbukkit.v1_6_R2.util.UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList + } + + Arrays.fill(this.b, -999); + Arrays.fill(this.s, (byte) -1); + + // CraftBukkit start + if (!(this instanceof EmptyChunk)) { + this.bukkitChunk = new org.bukkit.craftbukkit.v1_6_R2.CraftChunk(this); + } + } + + public org.bukkit.Chunk bukkitChunk; + public boolean mustSave; + // CraftBukkit end + + public Chunk(World world, byte[] abyte, int i, int j) { + this(world, i, j); + int k = abyte.length / 256; + + for (int l = 0; l < 16; ++l) { + for (int i1 = 0; i1 < 16; ++i1) { + for (int j1 = 0; j1 < k; ++j1) { + byte b0 = abyte[l << 11 | i1 << 7 | j1]; + + if (b0 != 0) { + int k1 = j1 >> 4; + + if (this.sections[k1] == null) { + this.sections[k1] = new ChunkSection(k1 << 4, !world.worldProvider.g); + } + + this.sections[k1].setTypeId(l, j1 & 15, i1, b0); + } + } + } + } + } + + public boolean a(int i, int j) { + return i == this.x && j == this.z; + } + + public int b(int i, int j) { + return this.heightMap[j << 4 | i]; + } + + public int h() { + for (int i = this.sections.length - 1; i >= 0; --i) { + if (this.sections[i] != null) { + return this.sections[i].getYPosition(); + } + } + + return 0; + } + + public ChunkSection[] i() { + return this.sections; + } + + public void initLighting() { + int i = this.h(); + + this.p = Integer.MAX_VALUE; + + int j; + int k; + + for (j = 0; j < 16; ++j) { + k = 0; + + while (k < 16) { + this.b[j + (k << 4)] = -999; + int l = i + 16 - 1; + + while (true) { + if (l > 0) { + if (this.b(j, l - 1, k) == 0) { + --l; + continue; + } + + this.heightMap[k << 4 | j] = l; + if (l < this.p) { + this.p = l; + } + } + + if (!this.world.worldProvider.g) { + l = 15; + int i1 = i + 16 - 1; + + do { + l -= this.b(j, i1, k); + if (l > 0) { + ChunkSection chunksection = this.sections[i1 >> 4]; + + if (chunksection != null) { + chunksection.setSkyLight(j, i1 & 15, k, l); + this.world.p((this.x << 4) + j, i1, (this.z << 4) + k); + } + } + + --i1; + } while (i1 > 0 && l > 0); + } + + ++k; + break; + } + } + } + + this.l = true; + + for (j = 0; j < 16; ++j) { + for (k = 0; k < 16; ++k) { + this.e(j, k); + } + } + } + + private void e(int i, int j) { + this.c[i + j * 16] = true; + this.t = true; + } + + private void q() { + this.world.methodProfiler.a("recheckGaps"); + if (this.world.areChunksLoaded(this.x * 16 + 8, 0, this.z * 16 + 8, 16)) { + for (int i = 0; i < 16; ++i) { + for (int j = 0; j < 16; ++j) { + if (this.c[i + j * 16]) { + this.c[i + j * 16] = false; + int k = this.b(i, j); + int l = this.x * 16 + i; + int i1 = this.z * 16 + j; + int j1 = this.world.g(l - 1, i1); + int k1 = this.world.g(l + 1, i1); + int l1 = this.world.g(l, i1 - 1); + int i2 = this.world.g(l, i1 + 1); + + if (k1 < j1) { + j1 = k1; + } + + if (l1 < j1) { + j1 = l1; + } + + if (i2 < j1) { + j1 = i2; + } + + this.g(l, i1, j1); + this.g(l - 1, i1, k); + this.g(l + 1, i1, k); + this.g(l, i1 - 1, k); + this.g(l, i1 + 1, k); + } + } + } + + this.t = false; + } + + this.world.methodProfiler.b(); + } + + private void g(int i, int j, int k) { + int l = this.world.getHighestBlockYAt(i, j); + + if (l > k) { + this.d(i, j, k, l + 1); + } else if (l < k) { + this.d(i, j, l, k + 1); + } + } + + private void d(int i, int j, int k, int l) { + if (l > k && this.world.areChunksLoaded(i, 0, j, 16)) { + for (int i1 = k; i1 < l; ++i1) { + this.world.c(EnumSkyBlock.SKY, i, i1, j); + } + + this.l = true; + } + } + + private void h(int i, int j, int k) { + int l = this.heightMap[k << 4 | i] & 255; + int i1 = l; + + if (j > l) { + i1 = j; + } + + while (i1 > 0 && this.b(i, i1 - 1, k) == 0) { + --i1; + } + + if (i1 != l) { + this.world.e(i + this.x * 16, k + this.z * 16, i1, l); + this.heightMap[k << 4 | i] = i1; + int j1 = this.x * 16 + i; + int k1 = this.z * 16 + k; + int l1; + int i2; + + if (!this.world.worldProvider.g) { + ChunkSection chunksection; + + if (i1 < l) { + for (l1 = i1; l1 < l; ++l1) { + chunksection = this.sections[l1 >> 4]; + if (chunksection != null) { + chunksection.setSkyLight(i, l1 & 15, k, 15); + this.world.p((this.x << 4) + i, l1, (this.z << 4) + k); + } + } + } else { + for (l1 = l; l1 < i1; ++l1) { + chunksection = this.sections[l1 >> 4]; + if (chunksection != null) { + chunksection.setSkyLight(i, l1 & 15, k, 0); + this.world.p((this.x << 4) + i, l1, (this.z << 4) + k); + } + } + } + + l1 = 15; + + while (i1 > 0 && l1 > 0) { + --i1; + i2 = this.b(i, i1, k); + if (i2 == 0) { + i2 = 1; + } + + l1 -= i2; + if (l1 < 0) { + l1 = 0; + } + + ChunkSection chunksection1 = this.sections[i1 >> 4]; + + if (chunksection1 != null) { + chunksection1.setSkyLight(i, i1 & 15, k, l1); + } + } + } + + l1 = this.heightMap[k << 4 | i]; + i2 = l; + int j2 = l1; + + if (l1 < l) { + i2 = l1; + j2 = l; + } + + if (l1 < this.p) { + this.p = l1; + } + + if (!this.world.worldProvider.g) { + this.d(j1 - 1, k1, i2, j2); + this.d(j1 + 1, k1, i2, j2); + this.d(j1, k1 - 1, i2, j2); + this.d(j1, k1 + 1, i2, j2); + this.d(j1, k1, i2, j2); + } + + this.l = true; + } + } + + public int b(int i, int j, int k) { + return Block.lightBlock[this.getTypeId(i, j, k)]; + } + + public int getTypeId(int i, int j, int k) { + if (j >> 4 >= this.sections.length) { + return 0; + } else { + ChunkSection chunksection = this.sections[j >> 4]; + + return chunksection != null ? chunksection.getTypeId(i, j & 15, k) : 0; + } + } + + public int getData(int i, int j, int k) { + if (j >> 4 >= this.sections.length) { + return 0; + } else { + ChunkSection chunksection = this.sections[j >> 4]; + + return chunksection != null ? chunksection.getData(i, j & 15, k) : 0; + } + } + + public boolean a(int i, int j, int k, int l, int i1) { + int j1 = k << 4 | i; + + if (j >= this.b[j1] - 1) { + this.b[j1] = -999; + } + + int k1 = this.heightMap[j1]; + int l1 = this.getTypeId(i, j, k); + int i2 = this.getData(i, j, k); + + if (l1 == l && i2 == i1) { + return false; + } else { + ChunkSection chunksection = this.sections[j >> 4]; + boolean flag = false; + + if (chunksection == null) { + if (l == 0) { + return false; + } + + chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !this.world.worldProvider.g); + flag = j >= k1; + } + + int j2 = this.x * 16 + i; + int k2 = this.z * 16 + k; + + if (l1 != 0 && !this.world.isStatic) { + Block.byId[l1].l(this.world, j2, j, k2, i2); + } + + chunksection.setTypeId(i, j & 15, k, l); + if (l1 != 0) { + if (!this.world.isStatic) { + Block.byId[l1].remove(this.world, j2, j, k2, l1, i2); + } else if (Block.byId[l1] instanceof IContainer && l1 != l) { + this.world.s(j2, j, k2); + } + } + + if (chunksection.getTypeId(i, j & 15, k) != l) { + return false; + } else { + chunksection.setData(i, j & 15, k, i1); + if (flag) { + this.initLighting(); + } else { + if (Block.lightBlock[l & 4095] > 0) { + if (j >= k1) { + this.h(i, j + 1, k); + } + } else if (j == k1 - 1) { + this.h(i, j, k); + } + + this.e(i, k); + } + + TileEntity tileentity; + + if (l != 0) { + // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer + if (!this.world.isStatic && (!this.world.callingPlaceEvent || (Block.byId[l] instanceof BlockContainer))) { + Block.byId[l].onPlace(this.world, j2, j, k2); + } + + if (Block.byId[l] instanceof IContainer) { + // CraftBukkit start - Don't create tile entity if placement failed + if (this.getTypeId(i, j, k) != l) { + return false; + } + // CraftBukkit end + + tileentity = this.e(i, j, k); + if (tileentity == null) { + tileentity = ((IContainer) Block.byId[l]).b(this.world); + this.world.setTileEntity(j2, j, k2, tileentity); + } + + if (tileentity != null) { + tileentity.i(); + } + } + } else if (l1 > 0 && Block.byId[l1] instanceof IContainer) { + tileentity = this.e(i, j, k); + if (tileentity != null) { + tileentity.i(); + } + } + + this.l = true; + return true; + } + } + } + + public boolean b(int i, int j, int k, int l) { + ChunkSection chunksection = this.sections[j >> 4]; + + if (chunksection == null) { + return false; + } else { + int i1 = chunksection.getData(i, j & 15, k); + + if (i1 == l) { + return false; + } else { + this.l = true; + chunksection.setData(i, j & 15, k, l); + int j1 = chunksection.getTypeId(i, j & 15, k); + + if (j1 > 0 && Block.byId[j1] instanceof IContainer) { + TileEntity tileentity = this.e(i, j, k); + + if (tileentity != null) { + tileentity.i(); + tileentity.p = l; + } + } + + return true; + } + } + } + + public int getBrightness(EnumSkyBlock enumskyblock, int i, int j, int k) { + ChunkSection chunksection = this.sections[j >> 4]; + + return chunksection == null ? (this.d(i, j, k) ? enumskyblock.c : 0) : (enumskyblock == EnumSkyBlock.SKY ? (this.world.worldProvider.g ? 0 : chunksection.getSkyLight(i, j & 15, k)) : (enumskyblock == EnumSkyBlock.BLOCK ? chunksection.getEmittedLight(i, j & 15, k) : enumskyblock.c)); + } + + public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l) { + ChunkSection chunksection = this.sections[j >> 4]; + + if (chunksection == null) { + chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !this.world.worldProvider.g); + this.initLighting(); + } + + this.l = true; + if (enumskyblock == EnumSkyBlock.SKY) { + if (!this.world.worldProvider.g) { + chunksection.setSkyLight(i, j & 15, k, l); + } + } else if (enumskyblock == EnumSkyBlock.BLOCK) { + chunksection.setEmittedLight(i, j & 15, k, l); + } + } + + public int c(int i, int j, int k, int l) { + ChunkSection chunksection = this.sections[j >> 4]; + + if (chunksection == null) { + return !this.world.worldProvider.g && l < EnumSkyBlock.SKY.c ? EnumSkyBlock.SKY.c - l : 0; + } else { + int i1 = this.world.worldProvider.g ? 0 : chunksection.getSkyLight(i, j & 15, k); + + if (i1 > 0) { + a = true; + } + + i1 -= l; + int j1 = chunksection.getEmittedLight(i, j & 15, k); + + if (j1 > i1) { + i1 = j1; + } + + return i1; + } + } + + public void a(Entity entity) { + this.m = true; + int i = MathHelper.floor(entity.locX / 16.0D); + int j = MathHelper.floor(entity.locZ / 16.0D); + + if (i != this.x || j != this.z) { + // CraftBukkit start + Bukkit.getLogger().warning("Wrong location for " + entity + " in world '" + world.getWorld().getName() + "'!"); + // Thread.dumpStack(); + Bukkit.getLogger().warning("Entity is at " + entity.locX + "," + entity.locZ + " (chunk " + i + "," + j + ") but was stored in chunk " + this.x + "," + this.z); + // CraftBukkit end + } + + ChunkAddEntityEvent event = new ChunkAddEntityEvent(entity.bukkitEntity); + Bukkit.getPluginManager().callEvent(event); + + int k = MathHelper.floor(entity.locY / 16.0D); + + if (k < 0) { + k = 0; + } + + if (k >= this.entitySlices.length) { + k = this.entitySlices.length - 1; + } + + entity.ai = true; + entity.aj = this.x; + entity.ak = k; + entity.al = this.z; + this.entitySlices[k].add(entity); + } + + public void b(Entity entity) { + this.a(entity, entity.ak); + } + + public void a(Entity entity, int i) { + if (i < 0) { + i = 0; + } + + if (i >= this.entitySlices.length) { + i = this.entitySlices.length - 1; + } + + this.entitySlices[i].remove(entity); + } + + public boolean d(int i, int j, int k) { + return j >= this.heightMap[k << 4 | i]; + } + + public TileEntity e(int i, int j, int k) { + ChunkPosition chunkposition = new ChunkPosition(i, j, k); + TileEntity tileentity = (TileEntity) this.tileEntities.get(chunkposition); + + if (tileentity == null) { + int l = this.getTypeId(i, j, k); + + if (l <= 0 || !Block.byId[l].t()) { + return null; + } + + if (tileentity == null) { + tileentity = ((IContainer) Block.byId[l]).b(this.world); + this.world.setTileEntity(this.x * 16 + i, j, this.z * 16 + k, tileentity); + } + + tileentity = (TileEntity) this.tileEntities.get(chunkposition); + } + + if (tileentity != null && tileentity.r()) { + this.tileEntities.remove(chunkposition); + return null; + } else { + return tileentity; + } + } + + public void a(TileEntity tileentity) { + int i = tileentity.x - this.x * 16; + int j = tileentity.y; + int k = tileentity.z - this.z * 16; + + this.a(i, j, k, tileentity); + if (this.d) { + this.world.tileEntityList.add(tileentity); + } + } + + public void a(int i, int j, int k, TileEntity tileentity) { + ChunkPosition chunkposition = new ChunkPosition(i, j, k); + + tileentity.b(this.world); + tileentity.x = this.x * 16 + i; + tileentity.y = j; + tileentity.z = this.z * 16 + k; + if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof IContainer) { + if (this.tileEntities.containsKey(chunkposition)) { + ((TileEntity) this.tileEntities.get(chunkposition)).w_(); + } + + tileentity.s(); + this.tileEntities.put(chunkposition, tileentity); + // CraftBukkit start + } else { + System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.x + "," + tileentity.y + "," + tileentity.z + + " (" + org.bukkit.Material.getMaterial(getTypeId(i, j, k)) + ") where there was no entity tile!"); + System.out.println("Chunk coordinates: " + (this.x * 16) + "," + (this.z * 16)); + new Exception().printStackTrace(); + // CraftBukkit end + } + } + + public void f(int i, int j, int k) { + ChunkPosition chunkposition = new ChunkPosition(i, j, k); + + if (this.d) { + TileEntity tileentity = (TileEntity) this.tileEntities.remove(chunkposition); + + if (tileentity != null) { + tileentity.w_(); + } + } + } + + public void addEntities() { + this.d = true; + this.world.a(this.tileEntities.values()); + + for (int i = 0; i < this.entitySlices.length; ++i) { + Iterator iterator = this.entitySlices[i].iterator(); + + while (iterator.hasNext()) { + Entity entity = (Entity) iterator.next(); + + entity.Q(); + } + + this.world.a(this.entitySlices[i]); + } + } + + public void removeEntities() { + this.d = false; + Iterator iterator = this.tileEntities.values().iterator(); + + while (iterator.hasNext()) { + TileEntity tileentity = (TileEntity) iterator.next(); + + this.world.a(tileentity); + } + + for (int i = 0; i < this.entitySlices.length; ++i) { + // CraftBukkit start + java.util.Iterator iter = this.entitySlices[i].iterator(); + while (iter.hasNext()) { + Entity entity = (Entity) iter.next(); + + // Do not pass along players, as doing so can get them stuck outside of time. + // (which for example disables inventory icon updates and prevents block breaking) + if (entity instanceof EntityPlayer) { + iter.remove(); + } + } + // CraftBukkit end + + this.world.b(this.entitySlices[i]); + } + } + + public void e() { + this.l = true; + } + + public void a(Entity entity, AxisAlignedBB axisalignedbb, List list, IEntitySelector ientityselector) { + int i = MathHelper.floor((axisalignedbb.b - 2.0D) / 16.0D); + int j = MathHelper.floor((axisalignedbb.e + 2.0D) / 16.0D); + + if (i < 0) { + i = 0; + j = Math.max(i, j); + } + + if (j >= this.entitySlices.length) { + j = this.entitySlices.length - 1; + i = Math.min(i, j); + } + + for (int k = i; k <= j; ++k) { + List list1 = this.entitySlices[k]; + + for (int l = 0; l < list1.size(); ++l) { + Entity entity1 = (Entity) list1.get(l); + + if (entity1 != entity && entity1.boundingBox.b(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) { + list.add(entity1); + Entity[] aentity = entity1.an(); + + if (aentity != null) { + for (int i1 = 0; i1 < aentity.length; ++i1) { + entity1 = aentity[i1]; + if (entity1 != entity && entity1.boundingBox.b(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) { + list.add(entity1); + } + } + } + } + } + } + } + + public void a(Class oclass, AxisAlignedBB axisalignedbb, List list, IEntitySelector ientityselector) { + int i = MathHelper.floor((axisalignedbb.b - 2.0D) / 16.0D); + int j = MathHelper.floor((axisalignedbb.e + 2.0D) / 16.0D); + + if (i < 0) { + i = 0; + } else if (i >= this.entitySlices.length) { + i = this.entitySlices.length - 1; + } + + if (j >= this.entitySlices.length) { + j = this.entitySlices.length - 1; + } else if (j < 0) { + j = 0; + } + + for (int k = i; k <= j; ++k) { + List list1 = this.entitySlices[k]; + + for (int l = 0; l < list1.size(); ++l) { + Entity entity = (Entity) list1.get(l); + + if (oclass.isAssignableFrom(entity.getClass()) && entity.boundingBox.b(axisalignedbb) && (ientityselector == null || ientityselector.a(entity))) { + list.add(entity); + } + } + } + } + + public boolean a(boolean flag) { + if (flag) { + if (this.m && this.world.getTime() != this.n || this.l) { + return true; + } + } else if (this.m && this.world.getTime() >= this.n + 600L) { + return true; + } + + return this.l; + } + + public Random a(long i) { + return new Random(this.world.getSeed() + (long) (this.x * this.x * 4987142) + (long) (this.x * 5947611) + (long) (this.z * this.z) * 4392871L + (long) (this.z * 389711) ^ i); + } + + public boolean isEmpty() { + return false; + } + + public void a(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) { + if (!this.done && ichunkprovider.isChunkLoaded(i + 1, j + 1) && ichunkprovider.isChunkLoaded(i, j + 1) && ichunkprovider.isChunkLoaded(i + 1, j)) { + ichunkprovider.getChunkAt(ichunkprovider1, i, j); + } + + if (ichunkprovider.isChunkLoaded(i - 1, j) && !ichunkprovider.getOrCreateChunk(i - 1, j).done && ichunkprovider.isChunkLoaded(i - 1, j + 1) && ichunkprovider.isChunkLoaded(i, j + 1) && ichunkprovider.isChunkLoaded(i - 1, j + 1)) { + ichunkprovider.getChunkAt(ichunkprovider1, i - 1, j); + } + + if (ichunkprovider.isChunkLoaded(i, j - 1) && !ichunkprovider.getOrCreateChunk(i, j - 1).done && ichunkprovider.isChunkLoaded(i + 1, j - 1) && ichunkprovider.isChunkLoaded(i + 1, j - 1) && ichunkprovider.isChunkLoaded(i + 1, j)) { + ichunkprovider.getChunkAt(ichunkprovider1, i, j - 1); + } + + if (ichunkprovider.isChunkLoaded(i - 1, j - 1) && !ichunkprovider.getOrCreateChunk(i - 1, j - 1).done && ichunkprovider.isChunkLoaded(i, j - 1) && ichunkprovider.isChunkLoaded(i - 1, j)) { + ichunkprovider.getChunkAt(ichunkprovider1, i - 1, j - 1); + } + } + + public int d(int i, int j) { + int k = i | j << 4; + int l = this.b[k]; + + if (l == -999) { + int i1 = this.h() + 15; + + l = -1; + + while (i1 > 0 && l == -1) { + int j1 = this.getTypeId(i, i1, j); + Material material = j1 == 0 ? Material.AIR : Block.byId[j1].material; + + if (!material.isSolid() && !material.isLiquid()) { + --i1; + } else { + l = i1 + 1; + } + } + + this.b[k] = l; + } + + return l; + } + + public void k() { + if (this.t && !this.world.worldProvider.g) { + this.q(); + } + } + + public ChunkCoordIntPair l() { + return new ChunkCoordIntPair(this.x, this.z); + } + + public boolean c(int i, int j) { + if (i < 0) { + i = 0; + } + + if (j >= 256) { + j = 255; + } + + for (int k = i; k <= j; k += 16) { + ChunkSection chunksection = this.sections[k >> 4]; + + if (chunksection != null && !chunksection.isEmpty()) { + return false; + } + } + + return true; + } + + public void a(ChunkSection[] achunksection) { + this.sections = achunksection; + } + + public BiomeBase a(int i, int j, WorldChunkManager worldchunkmanager) { + int k = this.s[j << 4 | i] & 255; + + if (k == 255) { + BiomeBase biomebase = worldchunkmanager.getBiome((this.x << 4) + i, (this.z << 4) + j); + + k = biomebase.id; + this.s[j << 4 | i] = (byte) (k & 255); + } + + return BiomeBase.biomes[k] == null ? BiomeBase.PLAINS : BiomeBase.biomes[k]; + } + + public byte[] m() { + return this.s; + } + + public void a(byte[] abyte) { + this.s = abyte; + } + + public void n() { + this.u = 0; + } + + public void o() { + for (int i = 0; i < 8; ++i) { + if (this.u >= 4096) { + return; + } + + int j = this.u % 16; + int k = this.u / 16 % 16; + int l = this.u / 256; + + ++this.u; + int i1 = (this.x << 4) + k; + int j1 = (this.z << 4) + l; + + for (int k1 = 0; k1 < 16; ++k1) { + int l1 = (j << 4) + k1; + + if (this.sections[j] == null && (k1 == 0 || k1 == 15 || k == 0 || k == 15 || l == 0 || l == 15) || this.sections[j] != null && this.sections[j].getTypeId(k, k1, l) == 0) { + if (Block.lightEmission[this.world.getTypeId(i1, l1 - 1, j1)] > 0) { + this.world.A(i1, l1 - 1, j1); + } + + if (Block.lightEmission[this.world.getTypeId(i1, l1 + 1, j1)] > 0) { + this.world.A(i1, l1 + 1, j1); + } + + if (Block.lightEmission[this.world.getTypeId(i1 - 1, l1, j1)] > 0) { + this.world.A(i1 - 1, l1, j1); + } + + if (Block.lightEmission[this.world.getTypeId(i1 + 1, l1, j1)] > 0) { + this.world.A(i1 + 1, l1, j1); + } + + if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 - 1)] > 0) { + this.world.A(i1, l1, j1 - 1); + } + + if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 + 1)] > 0) { + this.world.A(i1, l1, j1 + 1); + } + + this.world.A(i1, l1, j1); + } + } + } + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/ChunkAddEntityEvent.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/ChunkAddEntityEvent.java new file mode 100644 index 000000000..7a170d5fd --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/ChunkAddEntityEvent.java @@ -0,0 +1,31 @@ +package net.minecraft.server.v1_6_R2; + +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ChunkAddEntityEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private org.bukkit.entity.Entity _entity; + + public ChunkAddEntityEvent(org.bukkit.entity.Entity entity) + { + _entity = entity; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public org.bukkit.entity.Entity GetEntity() + { + return _entity; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/ChunkPreLoadEvent.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/ChunkPreLoadEvent.java new file mode 100644 index 000000000..c7c16df59 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/ChunkPreLoadEvent.java @@ -0,0 +1,58 @@ +package net.minecraft.server.v1_6_R2; + +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ChunkPreLoadEvent extends Event implements Cancellable +{ + private static final HandlerList handlers = new HandlerList(); + private boolean _cancelled; + private org.bukkit.World _world; + private int _x; + private int _z; + + public ChunkPreLoadEvent(org.bukkit.World world, int x, int z) + { + _world = world; + _x = x; + _z = z; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public org.bukkit.World GetWorld() + { + return _world; + } + + public int GetX() + { + return _x; + } + + public int GetZ() + { + return _z; + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean arg0) + { + _cancelled = arg0; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/ChunkProviderServer.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/ChunkProviderServer.java new file mode 100644 index 000000000..f6046e114 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/ChunkProviderServer.java @@ -0,0 +1,339 @@ +package net.minecraft.server.v1_6_R2; + +import java.util.Iterator; +import java.util.List; + +// CraftBukkit start +import java.util.Random; + +import org.bukkit.Server; +import org.bukkit.craftbukkit.v1_6_R2.chunkio.ChunkIOExecutor; +import org.bukkit.craftbukkit.v1_6_R2.util.LongHash; +import org.bukkit.craftbukkit.v1_6_R2.util.LongHashSet; +import org.bukkit.craftbukkit.v1_6_R2.util.LongObjectHashMap; +import org.bukkit.event.world.ChunkUnloadEvent; +// CraftBukkit end + +public class ChunkProviderServer implements IChunkProvider { + + // CraftBukkit start + public LongHashSet unloadQueue = new LongHashSet(); + public Chunk emptyChunk; + public IChunkProvider chunkProvider; // CraftBukkit + private IChunkLoader e; + public boolean forceChunkLoad = false; // true -> false + public LongObjectHashMap chunks = new LongObjectHashMap(); + public WorldServer world; + // CraftBukkit end + + public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) { + this.emptyChunk = new EmptyChunk(worldserver, 0, 0); + this.world = worldserver; + this.e = ichunkloader; + this.chunkProvider = ichunkprovider; + } + + public boolean isChunkLoaded(int i, int j) { + return this.chunks.containsKey(LongHash.toLong(i, j)); // CraftBukkit + } + + public void queueUnload(int i, int j) { + if (this.world.worldProvider.e()) { + ChunkCoordinates chunkcoordinates = this.world.getSpawn(); + int k = i * 16 + 8 - chunkcoordinates.x; + int l = j * 16 + 8 - chunkcoordinates.z; + short short1 = 128; + + // CraftBukkit start + if (k < -short1 || k > short1 || l < -short1 || l > short1 || !(this.world.keepSpawnInMemory)) { // Added 'this.world.keepSpawnInMemory' + this.unloadQueue.add(i, j); + + Chunk c = this.chunks.get(LongHash.toLong(i, j)); + if (c != null) { + c.mustSave = true; + } + } + // CraftBukkit end + } else { + // CraftBukkit start + this.unloadQueue.add(i, j); + + Chunk c = this.chunks.get(LongHash.toLong(i, j)); + if (c != null) { + c.mustSave = true; + } + // CraftBukkit end + } + } + + public void a() { + Iterator iterator = this.chunks.values().iterator(); // CraftBukkit + + while (iterator.hasNext()) { + Chunk chunk = (Chunk) iterator.next(); + + this.queueUnload(chunk.x, chunk.z); + } + } + + // CraftBukkit start - add async variant, provide compatibility + public Chunk getChunkAt(int i, int j) { + return getChunkAt(i, j, null); + } + + public Chunk getChunkAt(int i, int j, Runnable runnable) { + this.unloadQueue.remove(i, j); + Chunk chunk = (Chunk) this.chunks.get(LongHash.toLong(i, j)); + boolean newChunk = false; + ChunkRegionLoader loader = null; + + if (this.e instanceof ChunkRegionLoader) { + loader = (ChunkRegionLoader) this.e; + } + + // If the chunk exists but isn't loaded do it async + if (chunk == null && runnable != null && loader != null && loader.chunkExists(this.world, i, j)) { + ChunkIOExecutor.queueChunkLoad(this.world, loader, this, i, j, runnable); + return null; + } + // CraftBukkit end + + Server server = this.world.getServer(); + + if (chunk == null && server != null) + { + ChunkPreLoadEvent event = new ChunkPreLoadEvent(world.getWorld(), i, j); + server.getPluginManager().callEvent(event); + + if (event.isCancelled()) + return null; + } + + if (chunk == null) { + chunk = this.loadChunk(i, j); + if (chunk == null) { + if (this.chunkProvider == null) { + chunk = this.emptyChunk; + } else { + try { + chunk = this.chunkProvider.getOrCreateChunk(i, j); + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.a(throwable, "Exception generating new chunk"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Chunk to be generated"); + + crashreportsystemdetails.a("Location", String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)})); + crashreportsystemdetails.a("Position hash", Long.valueOf(LongHash.toLong(i, j))); + crashreportsystemdetails.a("Generator", this.chunkProvider.getName()); + throw new ReportedException(crashreport); + } + } + newChunk = true; // CraftBukkit + } + + this.chunks.put(LongHash.toLong(i, j), chunk); // CraftBukkit + if (chunk != null) { + chunk.addEntities(); + } + + // CraftBukkit start + if (server != null) { + /* + * If it's a new world, the first few chunks are generated inside + * the World constructor. We can't reliably alter that, so we have + * no way of creating a CraftWorld/CraftServer at that point. + */ + server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, newChunk)); + } + // CraftBukkit end + + chunk.a(this, this, i, j); + } + + // CraftBukkit start - If we didn't need to load the chunk run the callback now + if (runnable != null) { + runnable.run(); + } + // CraftBukkit end + + return chunk; + } + + public Chunk getOrCreateChunk(int i, int j) { + // CraftBukkit start + Chunk chunk = (Chunk) this.chunks.get(LongHash.toLong(i, j)); + + chunk = chunk == null ? (!this.world.isLoading && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk; + if (chunk == this.emptyChunk) return chunk; + if (i != chunk.x || j != chunk.z) { + this.world.getLogger().severe("Chunk (" + chunk.x + ", " + chunk.z + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'"); + this.world.getLogger().severe(chunk.getClass().getName()); + Throwable ex = new Throwable(); + ex.fillInStackTrace(); + ex.printStackTrace(); + } + return chunk; + // CraftBukkit end + } + + public Chunk loadChunk(int i, int j) { // CraftBukkit - private -> public + if (this.e == null) { + return null; + } else { + try { + Chunk chunk = this.e.a(this.world, i, j); + + if (chunk != null) { + chunk.n = this.world.getTime(); + if (this.chunkProvider != null) { + this.chunkProvider.recreateStructures(i, j); + } + } + + return chunk; + } catch (Exception exception) { + exception.printStackTrace(); + return null; + } + } + } + + public void saveChunkNOP(Chunk chunk) { // CraftBukkit - private -> public + if (this.e != null) { + try { + this.e.b(this.world, chunk); + } catch (Exception exception) { + exception.printStackTrace(); + } + } + } + + public void saveChunk(Chunk chunk) { // CraftBukkit - private -> public + if (this.e != null) { + try { + chunk.n = this.world.getTime(); + this.e.a(this.world, chunk); + } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception + ioexception.printStackTrace(); + // CraftBukkit start - remove extra exception + } + // } catch (ExceptionWorldConflict exceptionworldconflict) { + // exceptionworldconflict.printStackTrace(); + // } + // CraftBukkit end + } + } + + public void getChunkAt(IChunkProvider ichunkprovider, int i, int j) { + Chunk chunk = this.getOrCreateChunk(i, j); + + if (!chunk.done) { + chunk.done = true; + if (this.chunkProvider != null) { + this.chunkProvider.getChunkAt(ichunkprovider, i, j); + + // CraftBukkit start + BlockSand.instaFall = true; + Random random = new Random(); + random.setSeed(world.getSeed()); + long xRand = random.nextLong() / 2L * 2L + 1L; + long zRand = random.nextLong() / 2L * 2L + 1L; + random.setSeed((long) i * xRand + (long) j * zRand ^ world.getSeed()); + + org.bukkit.World world = this.world.getWorld(); + if (world != null) { + for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) { + populator.populate(world, random, chunk.bukkitChunk); + } + } + BlockSand.instaFall = false; + this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(chunk.bukkitChunk)); + // CraftBukkit end + + chunk.e(); + } + } + } + + public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) { + int i = 0; + // CraftBukkit start + Iterator iterator = this.chunks.values().iterator(); + + while (iterator.hasNext()) { + Chunk chunk = (Chunk) iterator.next(); + // CraftBukkit end + + if (flag) { + this.saveChunkNOP(chunk); + } + + if (chunk.a(flag)) { + this.saveChunk(chunk); + chunk.l = false; + ++i; + if (i == 24 && !flag) { + return false; + } + } + } + + return true; + } + + public void b() { + if (this.e != null) { + this.e.b(); + } + } + + public boolean unloadChunks() { + if (!this.world.savingDisabled) { + // CraftBukkit start + Server server = this.world.getServer(); + for (int i = 0; i < 100 && !this.unloadQueue.isEmpty(); i++) { + long chunkcoordinates = this.unloadQueue.popFirst(); + Chunk chunk = this.chunks.get(chunkcoordinates); + if (chunk == null) continue; + + ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk); + server.getPluginManager().callEvent(event); + if (!event.isCancelled()) { + chunk.removeEntities(); + this.saveChunk(chunk); + this.saveChunkNOP(chunk); + // this.unloadQueue.remove(integer); + this.chunks.remove(chunkcoordinates); // CraftBukkit + } + } + // CraftBukkit end + + if (this.e != null) { + this.e.a(); + } + } + + return this.chunkProvider.unloadChunks(); + } + + public boolean canSave() { + return !this.world.savingDisabled; + } + + public String getName() { + return "ServerChunkCache: " + this.chunks.values().size() + " Drop: " + this.unloadQueue.size(); // CraftBukkit + } + + public List getMobsFor(EnumCreatureType enumcreaturetype, int i, int j, int k) { + return this.chunkProvider.getMobsFor(enumcreaturetype, i, j, k); + } + + public ChunkPosition findNearestMapFeature(World world, String s, int i, int j, int k) { + return this.chunkProvider.findNearestMapFeature(world, s, i, j, k); + } + + public int getLoadedChunks() { + return this.chunks.values().size(); // CraftBukkit + } + + public void recreateStructures(int i, int j) {} +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/ContainerAnvilInventory.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/ContainerAnvilInventory.java new file mode 100644 index 000000000..34190ceaf --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/ContainerAnvilInventory.java @@ -0,0 +1,54 @@ +package net.minecraft.server.v1_6_R2; + +// CraftBukkit start +import java.util.List; + +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftHumanEntity; +import org.bukkit.entity.HumanEntity; +// CraftBukkit end + +public class ContainerAnvilInventory extends InventorySubcontainer { // CraftBukkit - public + + final ContainerAnvil a; + + // CraftBukkit start + public List transaction = new java.util.ArrayList(); + public org.bukkit.entity.Player player; + private int maxStack = MAX_STACK; + + public ItemStack[] getContents() { + return this.items; + } + + public void onOpen(CraftHumanEntity who) { + transaction.add(who); + } + + public void onClose(CraftHumanEntity who) { + transaction.remove(who); + } + + public List getViewers() { + return transaction; + } + + public org.bukkit.inventory.InventoryHolder getOwner() { + return this.player; + } + + public void setMaxStackSize(int size) { + maxStack = size; + } + // CraftBukkit end + + public ContainerAnvilInventory(ContainerAnvil containeranvil, String s, boolean flag, int i) { + super(s, flag, i); + this.a = containeranvil; + this.setMaxStackSize(1); // CraftBukkit + } + + public void update() { + super.update(); + this.a.a((IInventory) this); + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/EntityHuman.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/EntityHuman.java new file mode 100644 index 000000000..c6d0cb3b7 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/EntityHuman.java @@ -0,0 +1,1523 @@ +package net.minecraft.server.v1_6_R2; + +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +// CraftBukkit start +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftHumanEntity; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftItem; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.EntityCombustByEntityEvent; +import org.bukkit.event.player.PlayerBedEnterEvent; +import org.bukkit.event.player.PlayerBedLeaveEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +// CraftBukkit end + +public abstract class EntityHuman extends EntityLiving implements ICommandListener { + + public PlayerInventory inventory = new PlayerInventory(this); + private InventoryEnderChest enderChest = new InventoryEnderChest(); + public Container defaultContainer; + public Container activeContainer; + protected FoodMetaData foodData = new FoodMetaData(); + protected int br; + public float bs; + public float bt; + protected final String name; + public int bv; + public double bw; + public double bx; + public double by; + public double bz; + public double bA; + public double bB; + // CraftBukkit start + public boolean sleeping; // protected -> public + public boolean fauxSleeping; + public String spawnWorld = ""; + + @Override + public CraftHumanEntity getBukkitEntity() { + return (CraftHumanEntity) super.getBukkitEntity(); + } + // CraftBukkit end + + public ChunkCoordinates bD; + public int sleepTicks; // CraftBukkit - private -> public + public float bE; + public float bF; + private ChunkCoordinates c; + private boolean d; + private ChunkCoordinates e; + public PlayerAbilities abilities = new PlayerAbilities(); + public int oldLevel = -1; // CraftBukkit + public int expLevel; + public int expTotal; + public float exp; + private ItemStack f; + private int g; + protected float bK = 0.1F; + protected float bL = 0.02F; + private int h; + public EntityFishingHook hookedFish; + + public EntityHuman(World world, String s) { + super(world); + this.name = s; + this.defaultContainer = new ContainerPlayer(this.inventory, !world.isStatic, this); + this.activeContainer = this.defaultContainer; + this.height = 1.62F; + ChunkCoordinates chunkcoordinates = world.getSpawn(); + + this.setPositionRotation((double) chunkcoordinates.x + 0.5D, (double) (chunkcoordinates.y + 1), (double) chunkcoordinates.z + 0.5D, 0.0F, 0.0F); + this.ba = 180.0F; + this.maxFireTicks = 20; + } + + protected void ay() { + super.ay(); + this.aW().b(GenericAttributes.e).setValue(1.0D); + } + + protected void a() { + super.a(); + this.datawatcher.a(16, Byte.valueOf((byte) 0)); + this.datawatcher.a(17, Float.valueOf(0.0F)); + this.datawatcher.a(18, Integer.valueOf(0)); + } + + public boolean bq() { + return this.f != null; + } + + public void bs() { + if (this.f != null) { + this.f.b(this.world, this, this.g); + } + + this.bt(); + } + + public void bt() { + this.f = null; + this.g = 0; + if (!this.world.isStatic) { + this.e(false); + } + } + + public boolean isBlocking() { + return this.bq() && Item.byId[this.f.id].c_(this.f) == EnumAnimation.BLOCK; + } + + public void l_() { + if (this.f != null) { + ItemStack itemstack = this.inventory.getItemInHand(); + + if (ItemStack.equals(itemstack, this.f)) { + if (this.g <= 25 && this.g % 4 == 0) { + this.c(itemstack, 5); + } + + if (--this.g == 0 && !this.world.isStatic) { + this.n(); + } + } else { + this.bt(); + } + } + + if (this.bv > 0) { + --this.bv; + } + + if (this.isSleeping()) { + ++this.sleepTicks; + if (this.sleepTicks > 100) { + this.sleepTicks = 100; + } + + if (!this.world.isStatic) { + if (!this.h()) { + this.a(true, true, false); + } else if (this.world.v()) { + this.a(false, true, true); + } + } + } else if (this.sleepTicks > 0) { + ++this.sleepTicks; + if (this.sleepTicks >= 110) { + this.sleepTicks = 0; + } + } + + super.l_(); + if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.a(this)) { + this.closeInventory(); + this.activeContainer = this.defaultContainer; + } + + if (this.isBurning() && this.abilities.isInvulnerable) { + this.extinguish(); + } + + this.bw = this.bz; + this.bx = this.bA; + this.by = this.bB; + double d0 = this.locX - this.bz; + double d1 = this.locY - this.bA; + double d2 = this.locZ - this.bB; + double d3 = 10.0D; + + if (d0 > d3) { + this.bw = this.bz = this.locX; + } + + if (d2 > d3) { + this.by = this.bB = this.locZ; + } + + if (d1 > d3) { + this.bx = this.bA = this.locY; + } + + if (d0 < -d3) { + this.bw = this.bz = this.locX; + } + + if (d2 < -d3) { + this.by = this.bB = this.locZ; + } + + if (d1 < -d3) { + this.bx = this.bA = this.locY; + } + + this.bz += d0 * 0.25D; + this.bB += d2 * 0.25D; + this.bA += d1 * 0.25D; + this.a(StatisticList.k, 1); + if (this.vehicle == null) { + this.e = null; + } + + if (!this.world.isStatic) { + this.foodData.a(this); + } + } + + public int y() { + return this.abilities.isInvulnerable ? 0 : 80; + } + + public int ab() { + return 10; + } + + public void makeSound(String s, float f, float f1) { + this.world.a(this, s, f, f1); + } + + protected void c(ItemStack itemstack, int i) { + if (itemstack.o() == EnumAnimation.DRINK) { + this.makeSound("random.drink", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); + } + + if (itemstack.o() == EnumAnimation.EAT) { + for (int j = 0; j < i; ++j) { + Vec3D vec3d = this.world.getVec3DPool().create(((double) this.random.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D); + + vec3d.a(-this.pitch * 3.1415927F / 180.0F); + vec3d.b(-this.yaw * 3.1415927F / 180.0F); + Vec3D vec3d1 = this.world.getVec3DPool().create(((double) this.random.nextFloat() - 0.5D) * 0.3D, (double) (-this.random.nextFloat()) * 0.6D - 0.3D, 0.6D); + + vec3d1.a(-this.pitch * 3.1415927F / 180.0F); + vec3d1.b(-this.yaw * 3.1415927F / 180.0F); + vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ); + this.world.addParticle("iconcrack_" + itemstack.getItem().id, vec3d1.c, vec3d1.d, vec3d1.e, vec3d.c, vec3d.d + 0.05D, vec3d.e); + } + + this.makeSound("random.eat", 0.5F + 0.5F * (float) this.random.nextInt(2), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); + } + } + + protected void n() { + if (this.f != null) { + this.c(this.f, 16); + int i = this.f.count; + + // CraftBukkit start + org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.f); + PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem); + world.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) { + // Update client + if (this instanceof EntityPlayer) { + ((EntityPlayer) this).playerConnection.sendPacket(new Packet103SetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f)); + } + return; + } + + // Plugin modified the item, process it but don't remove it + if (!craftItem.equals(event.getItem())) { + CraftItemStack.asNMSCopy(event.getItem()).b(this.world, this); + + // Update client + if (this instanceof EntityPlayer) { + ((EntityPlayer) this).playerConnection.sendPacket(new Packet103SetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f)); + } + return; + } + // CraftBukkit end + + ItemStack itemstack = this.f.b(this.world, this); + + if (itemstack != this.f || itemstack != null && itemstack.count != i) { + this.inventory.items[this.inventory.itemInHandIndex] = itemstack; + if (itemstack.count == 0) { + this.inventory.items[this.inventory.itemInHandIndex] = null; + } + } + + this.bt(); + } + } + + protected boolean bb() { + return this.getHealth() <= 0.0F || this.isSleeping(); + } + + // CraftBukkit - protected -> public + public void closeInventory() { + this.activeContainer = this.defaultContainer; + } + + public void mount(Entity entity) { + // CraftBukkit start - mirror Entity mount changes + this.setPassengerOf(entity); + } + + public void setPassengerOf(Entity entity) { + // CraftBukkit end + if (this.vehicle != null && entity == null) { + Entity originalVehicle = this.vehicle; + /* + if (!this.world.isStatic) { + this.l(this.vehicle); + } + + if (this.vehicle != null) { + this.vehicle.passenger = null; + } + + this.vehicle = null; + */ + super.setPassengerOf(entity); + + if (!this.world.isStatic && this.vehicle == null) { + this.l(originalVehicle); + } + } else { + super.setPassengerOf(entity); // CraftBukkit - call new parent + } + } + + public void U() { + if (!this.world.isStatic && this.isSneaking()) { + this.mount((Entity) null); + this.setSneaking(false); + } else { + double d0 = this.locX; + double d1 = this.locY; + double d2 = this.locZ; + float f = this.yaw; + float f1 = this.pitch; + + super.U(); + this.bs = this.bt; + this.bt = 0.0F; + this.k(this.locX - d0, this.locY - d1, this.locZ - d2); + if (this.vehicle instanceof EntityPig) { + this.pitch = f1; + this.yaw = f; + this.aN = ((EntityPig) this.vehicle).aN; + } + } + } + + protected void bk() { + super.bh(); + this.aV(); + } + + public void c() { + if (this.br > 0) { + --this.br; + } + + // CraftBukkit - this.getMaxHealth() -> this.maxHealth + if (this.world.difficulty == 0 && this.getHealth() < this.getMaxHealth() && this.world.getGameRules().getBoolean("naturalRegeneration") && this.ticksLived % 20 * 12 == 0) { + // CraftBukkit - added regain reason of "REGEN" for filtering purposes. + this.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.REGEN); + } + + this.inventory.k(); + this.bs = this.bt; + super.c(); + AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.d); + + if (!this.world.isStatic) { + attributeinstance.setValue((double) this.abilities.b()); + } + + this.aR = this.bL; + if (this.isSprinting()) { + this.aR = (float) ((double) this.aR + (double) this.bL * 0.3D); + } + + this.i((float) attributeinstance.getValue()); + float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ); + // CraftBukkit - Math -> TrigMath + float f1 = (float) org.bukkit.craftbukkit.v1_6_R2.TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F; + + if (f > 0.1F) { + f = 0.1F; + } + + if (!this.onGround || this.getHealth() <= 0.0F) { + f = 0.0F; + } + + if (this.onGround || this.getHealth() <= 0.0F) { + f1 = 0.0F; + } + + this.bt += (f - this.bt) * 0.4F; + this.aK += (f1 - this.aK) * 0.8F; + if (this.getHealth() > 0.0F) { + AxisAlignedBB axisalignedbb = null; + + if (this.vehicle != null && !this.vehicle.dead) { + axisalignedbb = this.boundingBox.a(this.vehicle.boundingBox).grow(1.0D, 0.0D, 1.0D); + } else { + axisalignedbb = this.boundingBox.grow(1.0D, 0.5D, 1.0D); + } + + List list = this.world.getEntities(this, axisalignedbb); + + if (list != null) { + for (int i = 0; i < list.size(); ++i) { + Entity entity = (Entity) list.get(i); + + if (!entity.dead) { + this.r(entity); + } + } + } + } + } + + private void r(Entity entity) { + entity.b_(this); + } + + public int getScore() { + return this.datawatcher.getInt(18); + } + + public void setScore(int i) { + this.datawatcher.watch(18, Integer.valueOf(i)); + } + + public void addScore(int i) { + int j = this.getScore(); + + this.datawatcher.watch(18, Integer.valueOf(j + i)); + } + + public void die(DamageSource damagesource) { + super.die(damagesource); + this.a(0.2F, 0.2F); + this.setPosition(this.locX, this.locY, this.locZ); + this.motY = 0.10000000149011612D; + if (this.name.equals("Notch")) { + this.a(new ItemStack(Item.APPLE, 1), true); + } + + if (!this.world.getGameRules().getBoolean("keepInventory")) { + this.inventory.m(); + } + + if (damagesource != null) { + this.motX = (double) (-MathHelper.cos((this.aA + this.yaw) * 3.1415927F / 180.0F) * 0.1F); + this.motZ = (double) (-MathHelper.sin((this.aA + this.yaw) * 3.1415927F / 180.0F) * 0.1F); + } else { + this.motX = this.motZ = 0.0D; + } + + this.height = 0.1F; + this.a(StatisticList.y, 1); + } + + public void b(Entity entity, int i) { + this.addScore(i); + // CraftBukkit - Get our scores instead + Collection collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.e, this.getLocalizedName(), new java.util.ArrayList()); + + if (entity instanceof EntityHuman) { + this.a(StatisticList.A, 1); + // CraftBukkit - Get our scores instead + this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.d, this.getLocalizedName(), collection); + } else { + this.a(StatisticList.z, 1); + } + + Iterator iterator = collection.iterator(); + + while (iterator.hasNext()) { + ScoreboardScore scoreboardscore = (ScoreboardScore) iterator.next(); // CraftBukkit - Use our scores instead + + scoreboardscore.incrementScore(); + } + } + + public EntityItem a(boolean flag) { + return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && this.inventory.getItemInHand() != null ? this.inventory.getItemInHand().count : 1), false); + } + + public EntityItem drop(ItemStack itemstack) { + return this.a(itemstack, false); + } + + public EntityItem a(ItemStack itemstack, boolean flag) { + if (itemstack == null) { + return null; + } else if (itemstack.count == 0) { + return null; + } else { + EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.getHeadHeight(), this.locZ, itemstack); + + entityitem.pickupDelay = 40; + float f = 0.1F; + float f1; + + if (flag) { + f1 = this.random.nextFloat() * 0.5F; + float f2 = this.random.nextFloat() * 3.1415927F * 2.0F; + + entityitem.motX = (double) (-MathHelper.sin(f2) * f1); + entityitem.motZ = (double) (MathHelper.cos(f2) * f1); + entityitem.motY = 0.20000000298023224D; + } else { + f = 0.3F; + entityitem.motX = (double) (-MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f); + entityitem.motZ = (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f); + entityitem.motY = (double) (-MathHelper.sin(this.pitch / 180.0F * 3.1415927F) * f + 0.1F); + f = 0.02F; + f1 = this.random.nextFloat() * 3.1415927F * 2.0F; + f *= this.random.nextFloat(); + entityitem.motX += Math.cos((double) f1) * (double) f; + entityitem.motY += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F); + entityitem.motZ += Math.sin((double) f1) * (double) f; + } + + // CraftBukkit start + Player player = (Player) this.getBukkitEntity(); + CraftItem drop = new CraftItem(this.world.getServer(), entityitem); + + PlayerDropItemEvent event = new PlayerDropItemEvent(player, drop); + this.world.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) { + player.getInventory().addItem(drop.getItemStack()); + return null; + } + // CraftBukkit end + + this.a(entityitem); + this.a(StatisticList.v, 1); + return entityitem; + } + } + + protected void a(EntityItem entityitem) { + this.world.addEntity(entityitem); + } + + public float a(Block block, boolean flag) { + float f = this.inventory.a(block); + + if (f > 1.0F) { + int i = EnchantmentManager.getDigSpeedEnchantmentLevel(this); + ItemStack itemstack = this.inventory.getItemInHand(); + + if (i > 0 && itemstack != null) { + float f1 = (float) (i * i + 1); + + if (!itemstack.b(block) && f <= 1.0F) { + f += f1 * 0.08F; + } else { + f += f1; + } + } + } + + if (this.hasEffect(MobEffectList.FASTER_DIG)) { + f *= 1.0F + (float) (this.getEffect(MobEffectList.FASTER_DIG).getAmplifier() + 1) * 0.2F; + } + + if (this.hasEffect(MobEffectList.SLOWER_DIG)) { + f *= 1.0F - (float) (this.getEffect(MobEffectList.SLOWER_DIG).getAmplifier() + 1) * 0.2F; + } + + if (this.a(Material.WATER) && !EnchantmentManager.hasWaterWorkerEnchantment(this)) { + f /= 5.0F; + } + + if (!this.onGround) { + f /= 5.0F; + } + + return f; + } + + public boolean a(Block block) { + return this.inventory.b(block); + } + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + NBTTagList nbttaglist = nbttagcompound.getList("Inventory"); + + this.inventory.b(nbttaglist); + this.inventory.itemInHandIndex = nbttagcompound.getInt("SelectedItemSlot"); + this.sleeping = nbttagcompound.getBoolean("Sleeping"); + this.sleepTicks = nbttagcompound.getShort("SleepTimer"); + this.exp = nbttagcompound.getFloat("XpP"); + this.expLevel = nbttagcompound.getInt("XpLevel"); + this.expTotal = nbttagcompound.getInt("XpTotal"); + this.setScore(nbttagcompound.getInt("Score")); + if (this.sleeping) { + this.bD = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); + this.a(true, true, false); + } + + // CraftBukkit start + this.spawnWorld = nbttagcompound.getString("SpawnWorld"); + if ("".equals(spawnWorld)) { + this.spawnWorld = this.world.getServer().getWorlds().get(0).getName(); + } + // CraftBukkit end + + if (nbttagcompound.hasKey("SpawnX") && nbttagcompound.hasKey("SpawnY") && nbttagcompound.hasKey("SpawnZ")) { + this.c = new ChunkCoordinates(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ")); + this.d = nbttagcompound.getBoolean("SpawnForced"); + } + + this.foodData.a(nbttagcompound); + this.abilities.b(nbttagcompound); + if (nbttagcompound.hasKey("EnderItems")) { + NBTTagList nbttaglist1 = nbttagcompound.getList("EnderItems"); + + this.enderChest.a(nbttaglist1); + } + } + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + nbttagcompound.set("Inventory", this.inventory.a(new NBTTagList())); + nbttagcompound.setInt("SelectedItemSlot", this.inventory.itemInHandIndex); + nbttagcompound.setBoolean("Sleeping", this.sleeping); + nbttagcompound.setShort("SleepTimer", (short) this.sleepTicks); + nbttagcompound.setFloat("XpP", this.exp); + nbttagcompound.setInt("XpLevel", this.expLevel); + nbttagcompound.setInt("XpTotal", this.expTotal); + nbttagcompound.setInt("Score", this.getScore()); + if (this.c != null) { + nbttagcompound.setInt("SpawnX", this.c.x); + nbttagcompound.setInt("SpawnY", this.c.y); + nbttagcompound.setInt("SpawnZ", this.c.z); + nbttagcompound.setBoolean("SpawnForced", this.d); + nbttagcompound.setString("SpawnWorld", spawnWorld); // CraftBukkit - fixes bed spawns for multiworld worlds + } + + this.foodData.b(nbttagcompound); + this.abilities.a(nbttagcompound); + nbttagcompound.set("EnderItems", this.enderChest.h()); + } + + public void openContainer(IInventory iinventory) {} + + public void openHopper(TileEntityHopper tileentityhopper) {} + + public void openMinecartHopper(EntityMinecartHopper entityminecarthopper) {} + + public void openHorseInventory(EntityHorse entityhorse, IInventory iinventory) {} + + public void startEnchanting(int i, int j, int k, String s) {} + + public void openAnvil(int i, int j, int k) {} + + public void startCrafting(int i, int j, int k) {} + + public float getHeadHeight() { + return 0.12F; + } + + protected void d_() { + this.height = 1.62F; + } + + public boolean damageEntity(DamageSource damagesource, float f) { + if (this.isInvulnerable()) { + return false; + } else if (this.abilities.isInvulnerable && !damagesource.ignoresInvulnerability()) { + return false; + } else { + this.aV = 0; + if (this.getHealth() <= 0.0F) { + return false; + } else { + if (this.isSleeping() && !this.world.isStatic) { + this.a(true, true, false); + } + + if (damagesource.p()) { + if (this.world.difficulty == 0) { + return false; // CraftBukkit - f = 0 -> return false + } + + if (this.world.difficulty == 1) { + f = f / 2.0F + 1.0F; + } + + if (this.world.difficulty == 3) { + f = f * 3.0F / 2.0F; + } + } + + if (false && f == 0.0F) { // CraftBukkit - Don't filter out 0 damage + return false; + } else { + Entity entity = damagesource.getEntity(); + + if (entity instanceof EntityArrow && ((EntityArrow) entity).shooter != null) { + entity = ((EntityArrow) entity).shooter; + } + + this.a(StatisticList.x, Math.round(f * 10.0F)); + return super.damageEntity(damagesource, f); + } + } + } + } + + public boolean a(EntityHuman entityhuman) { + // CraftBukkit start - Change to check OTHER player's scoreboard team according to API + // To summarize this method's logic, it's "Can parameter hurt this" + org.bukkit.scoreboard.Team team; + if (entityhuman instanceof EntityPlayer) { + EntityPlayer thatPlayer = (EntityPlayer) entityhuman; + team = thatPlayer.getBukkitEntity().getScoreboard().getPlayerTeam(thatPlayer.getBukkitEntity()); + if (team == null || team.allowFriendlyFire()) { + return true; + } + } else { + // This should never be called, but is implemented anyway + org.bukkit.OfflinePlayer thisPlayer = entityhuman.world.getServer().getOfflinePlayer(entityhuman.name); + team = entityhuman.world.getServer().getScoreboardManager().getMainScoreboard().getPlayerTeam(thisPlayer); + if (team == null || team.allowFriendlyFire()) { + return true; + } + } + + if (this instanceof EntityPlayer) { + return !team.hasPlayer(((EntityPlayer) this).getBukkitEntity()); + } + return !team.hasPlayer(this.world.getServer().getOfflinePlayer(this.name)); + // CraftBukkit end + } + + protected void h(float f) { + this.inventory.a(f); + } + + public int aP() { + return this.inventory.l(); + } + + public float bw() { + int i = 0; + ItemStack[] aitemstack = this.inventory.armor; + int j = aitemstack.length; + + for (int k = 0; k < j; ++k) { + ItemStack itemstack = aitemstack[k]; + + if (itemstack != null) { + ++i; + } + } + + return (float) i / (float) this.inventory.armor.length; + } + + protected void d(DamageSource damagesource, float f) { + if (!this.isInvulnerable()) { + if (!damagesource.ignoresArmor() && this.isBlocking() && f > 0.0F) { + f = (1.0F + f) * 0.5F; + } + + f = this.b(damagesource, f); + f = this.c(damagesource, f); + float f1 = f; + + f = Math.max(f - this.bm(), 0.0F); + this.m(this.bm() - (f1 - f)); + if (f != 0.0F) { + this.a(damagesource.f()); + float f2 = this.getHealth(); + + this.setHealth(this.getHealth() - f); + this.aQ().a(damagesource, f2, f); + } + } + } + + public void openFurnace(TileEntityFurnace tileentityfurnace) {} + + public void openDispenser(TileEntityDispenser tileentitydispenser) {} + + public void a(TileEntity tileentity) {} + + public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) {} + + public void openBeacon(TileEntityBeacon tileentitybeacon) {} + + public void openTrade(IMerchant imerchant, String s) {} + + public void c(ItemStack itemstack) {} + + public boolean p(Entity entity) { + ItemStack itemstack = this.bx(); + ItemStack itemstack1 = itemstack != null ? itemstack.cloneItemStack() : null; + + if (!entity.c(this)) { + if (itemstack != null && entity instanceof EntityLiving) { + if (this.abilities.canInstantlyBuild) { + itemstack = itemstack1; + } + + if (itemstack.a(this, (EntityLiving) entity)) { + // CraftBukkit - bypass infinite items; <= 0 -> == 0 + if (itemstack.count == 0 && !this.abilities.canInstantlyBuild) { + this.by(); + } + + return true; + } + } + + return false; + } else { + if (itemstack != null && itemstack == this.bx()) { + if (itemstack.count <= 0 && !this.abilities.canInstantlyBuild) { + this.by(); + } else if (itemstack.count < itemstack1.count && this.abilities.canInstantlyBuild) { + itemstack.count = itemstack1.count; + } + } + + return true; + } + } + + public ItemStack bx() { + return this.inventory.getItemInHand(); + } + + public void by() { + this.inventory.setItem(this.inventory.itemInHandIndex, (ItemStack) null); + } + + public double W() { + return (double) (this.height - 0.5F); + } + + public void attack(Entity entity) { + if (entity.ap()) { + if (!entity.i(this)) { + float f = (float) this.getAttributeInstance(GenericAttributes.e).getValue(); + int i = 0; + float f1 = 0.0F; + + if (entity instanceof EntityLiving) { + f1 = EnchantmentManager.a((EntityLiving) this, (EntityLiving) entity); + i += EnchantmentManager.getKnockbackEnchantmentLevel(this, (EntityLiving) entity); + } + + if (this.isSprinting()) { + ++i; + } + + if (f > 0.0F || f1 > 0.0F) { + boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.e() && !this.G() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving; + + if (flag && f > 0.0F) { + f *= 1.5F; + } + + f += f1; + boolean flag1 = false; + int j = EnchantmentManager.getFireAspectEnchantmentLevel(this); + + if (entity instanceof EntityLiving && j > 0 && !entity.isBurning()) { + flag1 = true; + entity.setOnFire(1); + } + + boolean flag2 = entity.damageEntity(DamageSource.playerAttack(this), f); + + // CraftBukkit start - Return when the damage fails so that the item will not lose durability + if (!flag2) { + if (flag1) { + entity.extinguish(); + } + return; + } + // CraftBukkit end + + if (flag2) { + if (i > 0) { + entity.g((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F)); + this.motX *= 0.6D; + this.motZ *= 0.6D; + this.setSprinting(false); + } + + if (flag) { + this.b(entity); + } + + if (f1 > 0.0F) { + this.c(entity); + } + + if (f >= 18.0F) { + this.a((Statistic) AchievementList.E); + } + + this.k(entity); + if (entity instanceof EntityLiving) { + EnchantmentThorns.a(this, (EntityLiving) entity, this.random); + } + } + + ItemStack itemstack = this.bx(); + Object object = entity; + + if (entity instanceof EntityComplexPart) { + IComplex icomplex = ((EntityComplexPart) entity).owner; + + if (icomplex != null && icomplex instanceof EntityLiving) { + object = (EntityLiving) icomplex; + } + } + + if (itemstack != null && object instanceof EntityLiving) { + itemstack.a((EntityLiving) object, this); + // CraftBukkit - bypass infinite items; <= 0 -> == 0 + if (itemstack.count == 0) { + this.by(); + } + } + + if (entity instanceof EntityLiving) { + this.a(StatisticList.w, Math.round(f * 10.0F)); + if (j > 0 && flag2) { + // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item + EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), j * 4); + org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent); + + if (!combustEvent.isCancelled()) { + entity.setOnFire(combustEvent.getDuration()); + } + // CraftBukkit end + } else if (flag1) { + entity.extinguish(); + } + } + + this.a(0.3F); + } + } + } + } + + public void b(Entity entity) {} + + public void c(Entity entity) {} + + public void die() { + super.die(); + this.defaultContainer.b(this); + if (this.activeContainer != null) { + this.activeContainer.b(this); + } + } + + public boolean inBlock() { + return !this.sleeping && super.inBlock(); + } + + public EnumBedResult a(int i, int j, int k) { + if (!this.world.isStatic) { + if (this.isSleeping() || !this.isAlive()) { + return EnumBedResult.OTHER_PROBLEM; + } + + if (!this.world.worldProvider.d()) { + return EnumBedResult.NOT_POSSIBLE_HERE; + } + + if (this.world.v()) { + return EnumBedResult.NOT_POSSIBLE_NOW; + } + + if (Math.abs(this.locX - (double) i) > 3.0D || Math.abs(this.locY - (double) j) > 2.0D || Math.abs(this.locZ - (double) k) > 3.0D) { + return EnumBedResult.TOO_FAR_AWAY; + } + + double d0 = 8.0D; + double d1 = 5.0D; + List list = this.world.a(EntityMonster.class, AxisAlignedBB.a().a((double) i - d0, (double) j - d1, (double) k - d0, (double) i + d0, (double) j + d1, (double) k + d0)); + + if (!list.isEmpty()) { + return EnumBedResult.NOT_SAFE; + } + } + + if (this.af()) { + this.mount((Entity) null); + } + + // CraftBukkit start + if (this.getBukkitEntity() instanceof Player) { + Player player = (Player) this.getBukkitEntity(); + org.bukkit.block.Block bed = this.world.getWorld().getBlockAt(i, j, k); + + PlayerBedEnterEvent event = new PlayerBedEnterEvent(player, bed); + this.world.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) { + return EnumBedResult.OTHER_PROBLEM; + } + } + // CraftBukkit end + + this.a(0.2F, 0.2F); + this.height = 0.2F; + if (this.world.isLoaded(i, j, k)) { + int l = this.world.getData(i, j, k); + int i1 = BlockBed.j(l); + float f = 0.5F; + float f1 = 0.5F; + + switch (i1) { + case 0: + f1 = 0.9F; + break; + + case 1: + f = 0.1F; + break; + + case 2: + f1 = 0.1F; + break; + + case 3: + f = 0.9F; + } + + this.t(i1); + this.setPosition((double) ((float) i + f), (double) ((float) j + 0.9375F), (double) ((float) k + f1)); + } else { + this.setPosition((double) ((float) i + 0.5F), (double) ((float) j + 0.9375F), (double) ((float) k + 0.5F)); + } + + this.sleeping = true; + this.sleepTicks = 0; + this.bD = new ChunkCoordinates(i, j, k); + this.motX = this.motZ = this.motY = 0.0D; + if (!this.world.isStatic) { + this.world.everyoneSleeping(); + } + + return EnumBedResult.OK; + } + + private void t(int i) { + this.bE = 0.0F; + this.bF = 0.0F; + switch (i) { + case 0: + this.bF = -1.8F; + break; + + case 1: + this.bE = 1.8F; + break; + + case 2: + this.bF = 1.8F; + break; + + case 3: + this.bE = -1.8F; + } + } + + public void a(boolean flag, boolean flag1, boolean flag2) { + this.a(0.6F, 1.8F); + this.d_(); + ChunkCoordinates chunkcoordinates = this.bD; + ChunkCoordinates chunkcoordinates1 = this.bD; + + if (chunkcoordinates != null && this.world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Block.BED.id) { + BlockBed.a(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, false); + chunkcoordinates1 = BlockBed.b(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0); + if (chunkcoordinates1 == null) { + chunkcoordinates1 = new ChunkCoordinates(chunkcoordinates.x, chunkcoordinates.y + 1, chunkcoordinates.z); + } + + this.setPosition((double) ((float) chunkcoordinates1.x + 0.5F), (double) ((float) chunkcoordinates1.y + this.height + 0.1F), (double) ((float) chunkcoordinates1.z + 0.5F)); + } + + this.sleeping = false; + if (!this.world.isStatic && flag1) { + this.world.everyoneSleeping(); + } + + // CraftBukkit start + if (this.getBukkitEntity() instanceof Player) { + Player player = (Player) this.getBukkitEntity(); + + org.bukkit.block.Block bed; + if (chunkcoordinates != null) { + bed = this.world.getWorld().getBlockAt(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z); + } else { + bed = this.world.getWorld().getBlockAt(player.getLocation()); + } + + PlayerBedLeaveEvent event = new PlayerBedLeaveEvent(player, bed); + this.world.getServer().getPluginManager().callEvent(event); + } + // CraftBukkit end + + if (flag) { + this.sleepTicks = 0; + } else { + this.sleepTicks = 100; + } + + if (flag2) { + this.setRespawnPosition(this.bD, false); + } + } + + private boolean h() { + return this.world.getTypeId(this.bD.x, this.bD.y, this.bD.z) == Block.BED.id; + } + + public static ChunkCoordinates getBed(World world, ChunkCoordinates chunkcoordinates, boolean flag) { + IChunkProvider ichunkprovider = world.L(); + + ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z - 3 >> 4); + ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z - 3 >> 4); + ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z + 3 >> 4); + ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z + 3 >> 4); + if (world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Block.BED.id) { + ChunkCoordinates chunkcoordinates1 = BlockBed.b(world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0); + + return chunkcoordinates1; + } else { + Material material = world.getMaterial(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z); + Material material1 = world.getMaterial(chunkcoordinates.x, chunkcoordinates.y + 1, chunkcoordinates.z); + boolean flag1 = !material.isBuildable() && !material.isLiquid(); + boolean flag2 = !material1.isBuildable() && !material1.isLiquid(); + + return flag && flag1 && flag2 ? chunkcoordinates : null; + } + } + + public boolean isSleeping() { + return this.sleeping; + } + + public boolean isDeeplySleeping() { + return this.sleeping && this.sleepTicks >= 100; + } + + protected void b(int i, boolean flag) { + byte b0 = this.datawatcher.getByte(16); + + if (flag) { + this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 1 << i))); + } else { + this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & ~(1 << i)))); + } + } + + public void a(String s) {} + + public ChunkCoordinates getBed() { + return this.c; + } + + public boolean isRespawnForced() { + return this.d; + } + + public void setRespawnPosition(ChunkCoordinates chunkcoordinates, boolean flag) { + if (chunkcoordinates != null) { + this.c = new ChunkCoordinates(chunkcoordinates); + this.d = flag; + this.spawnWorld = this.world.worldData.getName(); // CraftBukkit + } else { + this.c = null; + this.d = false; + this.spawnWorld = ""; // CraftBukkit + } + } + + public void a(Statistic statistic) { + this.a(statistic, 1); + } + + public void a(Statistic statistic, int i) {} + + protected void bd() { + super.bd(); + this.a(StatisticList.u, 1); + if (this.isSprinting()) { + this.a(0.8F); + } else { + this.a(0.2F); + } + } + + public void e(float f, float f1) { + double d0 = this.locX; + double d1 = this.locY; + double d2 = this.locZ; + + if (this.abilities.isFlying && this.vehicle == null) { + double d3 = this.motY; + float f2 = this.aR; + + this.aR = this.abilities.a(); + super.e(f, f1); + this.motY = d3 * 0.6D; + this.aR = f2; + } else { + super.e(f, f1); + } + + this.checkMovement(this.locX - d0, this.locY - d1, this.locZ - d2); + } + + public float bf() { + return (float) this.getAttributeInstance(GenericAttributes.d).getValue(); + } + + public void checkMovement(double d0, double d1, double d2) { + if (this.vehicle == null) { + int i; + + if (this.a(Material.WATER)) { + i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F); + if (i > 0) { + this.a(StatisticList.q, i); + this.a(0.015F * (float) i * 0.01F); + } + } else if (this.G()) { + i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F); + if (i > 0) { + this.a(StatisticList.m, i); + this.a(0.015F * (float) i * 0.01F); + } + } else if (this.e()) { + if (d1 > 0.0D) { + this.a(StatisticList.o, (int) Math.round(d1 * 100.0D)); + } + } else if (this.onGround) { + i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F); + if (i > 0) { + this.a(StatisticList.l, i); + if (this.isSprinting()) { + this.a(0.099999994F * (float) i * 0.01F); + } else { + this.a(0.01F * (float) i * 0.01F); + } + } + } else { + i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F); + if (i > 25) { + this.a(StatisticList.p, i); + } + } + } + } + + private void k(double d0, double d1, double d2) { + if (this.vehicle != null) { + int i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F); + + if (i > 0) { + if (this.vehicle instanceof EntityMinecartAbstract) { + this.a(StatisticList.r, i); + if (this.e == null) { + this.e = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); + } else if ((double) this.e.e(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) >= 1000000.0D) { + this.a((Statistic) AchievementList.q, 1); + } + } else if (this.vehicle instanceof EntityBoat) { + this.a(StatisticList.s, i); + } else if (this.vehicle instanceof EntityPig) { + this.a(StatisticList.t, i); + } + } + } + } + + protected void b(float f) { + if (!this.abilities.canFly) { + if (f >= 2.0F) { + this.a(StatisticList.n, (int) Math.round((double) f * 100.0D)); + } + + super.b(f); + } + } + + public void a(EntityLiving entityliving) { + if (entityliving instanceof IMonster) { + this.a((Statistic) AchievementList.s); + } + } + + public void al() { + if (!this.abilities.isFlying) { + super.al(); + } + } + + public ItemStack o(int i) { + return this.inventory.f(i); + } + + public void giveExp(int i) { + this.addScore(i); + int j = Integer.MAX_VALUE - this.expTotal; + + if (i > j) { + i = j; + } + + this.exp += (float) i / (float) this.getExpToLevel(); + + for (this.expTotal += i; this.exp >= 1.0F; this.exp /= (float) this.getExpToLevel()) { + this.exp = (this.exp - 1.0F) * (float) this.getExpToLevel(); + this.levelDown(1); + } + } + + public void levelDown(int i) { + this.expLevel += i; + if (this.expLevel < 0) { + this.expLevel = 0; + this.exp = 0.0F; + this.expTotal = 0; + } + + if (i > 0 && this.expLevel % 5 == 0 && (float) this.h < (float) this.ticksLived - 100.0F) { + float f = this.expLevel > 30 ? 1.0F : (float) this.expLevel / 30.0F; + + this.world.makeSound(this, "random.levelup", f * 0.75F, 1.0F); + this.h = this.ticksLived; + } + } + + public int getExpToLevel() { + return this.expLevel >= 30 ? 62 + (this.expLevel - 30) * 7 : (this.expLevel >= 15 ? 17 + (this.expLevel - 15) * 3 : 17); + } + + public void a(float f) { + if (!this.abilities.isInvulnerable) { + if (!this.world.isStatic) { + this.foodData.a(f); + } + } + } + + public FoodMetaData getFoodData() { + return this.foodData; + } + + public boolean g(boolean flag) { + return (flag || this.foodData.c()) && !this.abilities.isInvulnerable; + } + + public boolean bI() { + return this.getHealth() > 0.0F && this.getHealth() < this.getMaxHealth(); // CraftBukkit - this.getMaxHealth() -> this.maxHealth + } + + public void a(ItemStack itemstack, int i) { + if (itemstack != this.f) { + this.f = itemstack; + this.g = i; + if (!this.world.isStatic) { + this.e(true); + } + } + } + + public boolean d(int i, int j, int k) { + if (this.abilities.mayBuild) { + return true; + } else { + int l = this.world.getTypeId(i, j, k); + + if (l > 0) { + Block block = Block.byId[l]; + + if (block.material.q()) { + return true; + } + + if (this.bx() != null) { + ItemStack itemstack = this.bx(); + + if (itemstack.b(block) || itemstack.a(block) > 1.0F) { + return true; + } + } + } + + return false; + } + } + + public boolean a(int i, int j, int k, int l, ItemStack itemstack) { + return this.abilities.mayBuild ? true : (itemstack != null ? itemstack.z() : false); + } + + protected int getExpValue(EntityHuman entityhuman) { + if (this.world.getGameRules().getBoolean("keepInventory")) { + return 0; + } else { + int i = this.expLevel * 7; + + return i > 100 ? 100 : i; + } + } + + protected boolean alwaysGivesExp() { + return true; + } + + public String getLocalizedName() { + return this.name; + } + + public void copyTo(EntityHuman entityhuman, boolean flag) { + if (flag) { + this.inventory.b(entityhuman.inventory); + this.setHealth(entityhuman.getHealth()); + this.foodData = entityhuman.foodData; + this.expLevel = entityhuman.expLevel; + this.expTotal = entityhuman.expTotal; + this.exp = entityhuman.exp; + this.setScore(entityhuman.getScore()); + this.as = entityhuman.as; + } else if (this.world.getGameRules().getBoolean("keepInventory")) { + this.inventory.b(entityhuman.inventory); + this.expLevel = entityhuman.expLevel; + this.expTotal = entityhuman.expTotal; + this.exp = entityhuman.exp; + this.setScore(entityhuman.getScore()); + } + + this.enderChest = entityhuman.enderChest; + } + + protected boolean e_() { + return !this.abilities.isFlying; + } + + public void updateAbilities() {} + + public void a(EnumGamemode enumgamemode) {} + + public String getName() { + return this.name; + } + + public World f_() { + return this.world; + } + + public InventoryEnderChest getEnderChest() { + return this.enderChest; + } + + public ItemStack getEquipment(int i) { + return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1]; + } + + public ItemStack aY() { + return this.inventory.getItemInHand(); + } + + public void setEquipment(int i, ItemStack itemstack) { + this.inventory.armor[i] = itemstack; + } + + public ItemStack[] getEquipment() { + return this.inventory.armor; + } + + public boolean av() { + return !this.abilities.isFlying; + } + + public Scoreboard getScoreboard() { + return this.world.getScoreboard(); + } + + public ScoreboardTeamBase getScoreboardTeam() { + return this.getScoreboard().getPlayerTeam(this.name); + } + + public String getScoreboardDisplayName() { + // CraftBukkit todo: fun + return ScoreboardTeam.getPlayerDisplayName(this.getScoreboardTeam(), this.name); + } + + public void m(float f) { + if (f < 0.0F) { + f = 0.0F; + } + + this.getDataWatcher().watch(17, Float.valueOf(f)); + } + + public float bm() { + return this.getDataWatcher().getFloat(17); + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/EntityPlayer.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/EntityPlayer.java new file mode 100644 index 000000000..edc213dbe --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/EntityPlayer.java @@ -0,0 +1,964 @@ +package net.minecraft.server.v1_6_R2; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +// CraftBukkit start +import org.bukkit.Bukkit; +import org.bukkit.WeatherType; +import org.bukkit.craftbukkit.v1_6_R2.CraftWorld; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_6_R2.event.CraftEventFactory; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; +// CraftBukkit end + +public class EntityPlayer extends EntityHuman implements ICrafting { + + private String locale = "en_US"; + public PlayerConnection playerConnection; + public MinecraftServer server; + public PlayerInteractManager playerInteractManager; + public double d; + public double e; + public final List chunkCoordIntPairQueue = new LinkedList(); + public final List removeQueue = new LinkedList(); + private float bO = Float.MIN_VALUE; + private float bP = -1.0E8F; + private int bQ = -99999999; + private boolean bR = true; + public int lastSentExp = -99999999; // CraftBukkit - private -> public + public int invulnerableTicks = 60; // CraftBukkit - private -> public + private int bU; + private int bV; + private boolean bW = true; + private int containerCounter; + public boolean h; + public int ping; + public boolean viewingCredits; + // CraftBukkit start + public String displayName; + public String listName; + public org.bukkit.Location compassTarget; + public int newExp = 0; + public int newLevel = 0; + public int newTotalExp = 0; + public boolean keepLevel = false; + public double maxHealthCache; + // CraftBukkit end + + public boolean spectating; + + public EntityPlayer(MinecraftServer minecraftserver, World world, String s, PlayerInteractManager playerinteractmanager) { + super(world, s); + playerinteractmanager.player = this; + this.playerInteractManager = playerinteractmanager; + this.bU = minecraftserver.getPlayerList().o(); + ChunkCoordinates chunkcoordinates = world.getSpawn(); + int i = chunkcoordinates.x; + int j = chunkcoordinates.z; + int k = chunkcoordinates.y; + + if (!world.worldProvider.g && world.getWorldData().getGameType() != EnumGamemode.ADVENTURE) { + int l = Math.max(5, minecraftserver.getSpawnProtection() - 6); + + i += this.random.nextInt(l * 2) - l; + j += this.random.nextInt(l * 2) - l; + k = world.i(i, j); + } + + this.server = minecraftserver; + this.Y = 0.0F; + this.height = 0.0F; + this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F); + + while (!world.getCubes(this, this.boundingBox).isEmpty()) { + this.setPosition(this.locX, this.locY + 1.0D, this.locZ); + } + + // CraftBukkit start + this.displayName = this.name; + this.listName = this.name; + // this.canPickUpLoot = true; TODO + this.maxHealthCache = this.getMaxHealth(); + // CraftBukkit end + } + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + if (nbttagcompound.hasKey("playerGameType")) { + if (MinecraftServer.getServer().getForceGamemode()) { + this.playerInteractManager.setGameMode(MinecraftServer.getServer().getGamemode()); + } else { + this.playerInteractManager.setGameMode(EnumGamemode.a(nbttagcompound.getInt("playerGameType"))); + } + } + this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit + } + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + nbttagcompound.setInt("playerGameType", this.playerInteractManager.getGameMode().a()); + this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit + } + + // CraftBukkit start - World fallback code, either respawn location or global spawn + public void spawnIn(World world) { + super.spawnIn(world); + if (world == null) { + this.dead = false; + ChunkCoordinates position = null; + if (this.spawnWorld != null && !this.spawnWorld.equals("")) { + CraftWorld cworld = (CraftWorld) Bukkit.getServer().getWorld(this.spawnWorld); + if (cworld != null && this.getBed() != null) { + world = cworld.getHandle(); + position = EntityHuman.getBed(cworld.getHandle(), this.getBed(), false); + } + } + if (world == null || position == null) { + world = ((CraftWorld) Bukkit.getServer().getWorlds().get(0)).getHandle(); + position = world.getSpawn(); + } + this.world = world; + this.setPosition(position.x + 0.5, position.y, position.z + 0.5); + } + this.dimension = ((WorldServer) this.world).dimension; + this.playerInteractManager.a((WorldServer) world); + } + // CraftBukkit end + + public void levelDown(int i) { + super.levelDown(i); + this.lastSentExp = -1; + } + + public void syncInventory() { + this.activeContainer.addSlotListener(this); + } + + protected void d_() { + this.height = 0.0F; + } + + public float getHeadHeight() { + return 1.62F; + } + + public void l_() { + this.playerInteractManager.a(); + --this.invulnerableTicks; + this.activeContainer.b(); + if (!this.world.isStatic && !this.activeContainer.a((EntityHuman) this)) { + this.closeInventory(); + this.activeContainer = this.defaultContainer; + } + + // CraftBukkit start - Check inventory status every tick + if (!this.activeContainer.a(this)) { // Should be stillValid + this.closeInventory(); + this.activeContainer = this.defaultContainer; + } + // CraftBukkit end + + while (!this.removeQueue.isEmpty()) { + int i = Math.min(this.removeQueue.size(), 127); + int[] aint = new int[i]; + Iterator iterator = this.removeQueue.iterator(); + int j = 0; + + while (iterator.hasNext() && j < i) { + aint[j++] = ((Integer) iterator.next()).intValue(); + iterator.remove(); + } + + this.playerConnection.sendPacket(new Packet29DestroyEntity(aint)); + } + + if (!this.chunkCoordIntPairQueue.isEmpty()) { + ArrayList arraylist = new ArrayList(); + Iterator iterator1 = this.chunkCoordIntPairQueue.iterator(); + ArrayList arraylist1 = new ArrayList(); + + while (iterator1.hasNext() && arraylist.size() < 5) { + ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator1.next(); + + iterator1.remove(); + if (chunkcoordintpair != null && this.world.isLoaded(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)) { + // CraftBukkit start - Get tile entities directly from the chunk instead of the world + Chunk chunk = this.world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z); + arraylist.add(chunk); + arraylist1.addAll(chunk.tileEntities.values()); + // CraftBukkit end + } + } + + if (!arraylist.isEmpty()) { + this.playerConnection.sendPacket(new Packet56MapChunkBulk(arraylist)); + Iterator iterator2 = arraylist1.iterator(); + + while (iterator2.hasNext()) { + TileEntity tileentity = (TileEntity) iterator2.next(); + + this.b(tileentity); + } + + iterator2 = arraylist.iterator(); + + while (iterator2.hasNext()) { + Chunk chunk = (Chunk) iterator2.next(); + + this.p().getTracker().a(this, chunk); + } + } + } + } + + public void h() { + try { + super.l_(); + + for (int i = 0; i < this.inventory.getSize(); ++i) { + ItemStack itemstack = this.inventory.getItem(i); + + if (itemstack != null && Item.byId[itemstack.id].f() && this.playerConnection.lowPriorityCount() <= 5) { + Packet packet = ((ItemWorldMapBase) Item.byId[itemstack.id]).c(itemstack, this.world, this); + + if (packet != null) { + this.playerConnection.sendPacket(packet); + } + } + } + + if (this.getHealth() != this.bP || this.bQ != this.foodData.a() || this.foodData.e() == 0.0F != this.bR) { + // CraftBukkit - this.getHealth() -> this.getScaledHealth() + this.playerConnection.sendPacket(new Packet8UpdateHealth(getBukkitEntity().getScaledHealth(), this.foodData.a(), this.foodData.e())); + this.bP = this.getHealth(); + this.bQ = this.foodData.a(); + this.bR = this.foodData.e() == 0.0F; + } + + if (this.getHealth() + this.bm() != this.bO) { + this.bO = this.getHealth() + this.bm(); + // CraftBukkit - Update ALL the scores! + this.world.getServer().getScoreboardManager().updateAllScoresForList(IScoreboardCriteria.f, this.getLocalizedName(), com.google.common.collect.ImmutableList.of(this)); + } + + // CraftBukkit start - Force max health updates + if (this.maxHealthCache != this.getMaxHealth()) { + this.getBukkitEntity().updateScaledHealth(); + } + + if (this.expTotal != this.lastSentExp) { + this.lastSentExp = this.expTotal; + this.playerConnection.sendPacket(new Packet43SetExperience(this.exp, this.expTotal, this.expLevel)); + } + + // CraftBukkit start + if (this.oldLevel == -1) { + this.oldLevel = this.expLevel; + } + + if (this.oldLevel != this.expLevel) { + CraftEventFactory.callPlayerLevelChangeEvent(this.world.getServer().getPlayer((EntityPlayer) this), this.oldLevel, this.expLevel); + this.oldLevel = this.expLevel; + } + // CraftBukkit end + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.a(throwable, "Ticking player"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked"); + + this.a(crashreportsystemdetails); + throw new ReportedException(crashreport); + } + } + + public void die(DamageSource damagesource) { + // CraftBukkit start + if (this.dead) { + return; + } + + java.util.List loot = new java.util.ArrayList(); + boolean keepInventory = this.world.getGameRules().getBoolean("keepInventory"); + + if (!keepInventory) { + for (int i = 0; i < this.inventory.items.length; ++i) { + if (this.inventory.items[i] != null) { + loot.add(CraftItemStack.asCraftMirror(this.inventory.items[i])); + } + } + + for (int i = 0; i < this.inventory.armor.length; ++i) { + if (this.inventory.armor[i] != null) { + loot.add(CraftItemStack.asCraftMirror(this.inventory.armor[i])); + } + } + } + + ChatMessage chatmessage = this.aQ().b(); + + String deathmessage = chatmessage.toString(); + org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage); + + String deathMessage = event.getDeathMessage(); + + if (deathMessage != null && deathMessage.length() > 0) { + if (deathMessage.equals(chatmessage.toString())) { + this.server.getPlayerList().sendMessage(chatmessage); + } else { + this.server.getPlayerList().sendMessage(ChatMessage.d(event.getDeathMessage())); + } + } + + // CraftBukkit - we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory. + if (!keepInventory) { + for (int i = 0; i < this.inventory.items.length; ++i) { + this.inventory.items[i] = null; + } + + for (int i = 0; i < this.inventory.armor.length; ++i) { + this.inventory.armor[i] = null; + } + } + + this.closeInventory(); + // CraftBukkit end + + // CraftBukkit - Get our scores instead + Collection collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.c, this.getLocalizedName(), new java.util.ArrayList()); + Iterator iterator = collection.iterator(); + + while (iterator.hasNext()) { + ScoreboardScore scoreboardscore = (ScoreboardScore) iterator.next(); // CraftBukkit - Use our scores instead + + scoreboardscore.incrementScore(); + } + + EntityLiving entityliving = this.aR(); + + if (entityliving != null) { + entityliving.b(this, this.bb); + } + + this.a(StatisticList.y, 1); + } + + public boolean damageEntity(DamageSource damagesource, float f) { + if (this.isInvulnerable()) { + return false; + } else { + // CraftBukkit - this.server.getPvP() -> this.world.pvpMode + boolean flag = this.server.V() && this.world.pvpMode && "fall".equals(damagesource.translationIndex); + + if (!flag && this.invulnerableTicks > 0 && damagesource != DamageSource.OUT_OF_WORLD) { + return false; + } else { + if (damagesource instanceof EntityDamageSource) { + Entity entity = damagesource.getEntity(); + + if (entity instanceof EntityHuman && !this.a((EntityHuman) entity)) { + return false; + } + + if (entity instanceof EntityArrow) { + EntityArrow entityarrow = (EntityArrow) entity; + + if (entityarrow.shooter instanceof EntityHuman && !this.a((EntityHuman) entityarrow.shooter)) { + return false; + } + } + } + + return super.damageEntity(damagesource, f); + } + } + } + + public boolean a(EntityHuman entityhuman) { + // CraftBukkit - this.server.getPvP() -> this.world.pvpMode + return !this.world.pvpMode ? false : super.a(entityhuman); + } + + public void b(int i) { + if (this.dimension == 1 && i == 1) { + this.a((Statistic) AchievementList.C); + this.world.kill(this); + this.viewingCredits = true; + this.playerConnection.sendPacket(new Packet70Bed(4, 0)); + } else { + if (this.dimension == 0 && i == 1) { + this.a((Statistic) AchievementList.B); + // CraftBukkit start - Rely on custom portal management + /* + ChunkCoordinates chunkcoordinates = this.server.getWorldServer(i).getDimensionSpawn(); + + if (chunkcoordinates != null) { + this.playerConnection.a((double) chunkcoordinates.x, (double) chunkcoordinates.y, (double) chunkcoordinates.z, 0.0F, 0.0F); + } + + i = 1; + */ + // CraftBukkit end + } else { + this.a((Statistic) AchievementList.x); + } + + // CraftBukkit start + TeleportCause cause = (this.dimension == 1 || i == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL; + this.server.getPlayerList().changeDimension(this, i, cause); + // CraftBukkit end + this.lastSentExp = -1; + this.bP = -1.0F; + this.bQ = -1; + } + } + + private void b(TileEntity tileentity) { + if (tileentity != null) { + Packet packet = tileentity.getUpdatePacket(); + + if (packet != null) { + this.playerConnection.sendPacket(packet); + } + } + } + + public void receive(Entity entity, int i) { + super.receive(entity, i); + this.activeContainer.b(); + } + + public EnumBedResult a(int i, int j, int k) { + EnumBedResult enumbedresult = super.a(i, j, k); + + if (enumbedresult == EnumBedResult.OK) { + Packet17EntityLocationAction packet17entitylocationaction = new Packet17EntityLocationAction(this, 0, i, j, k); + + this.p().getTracker().a((Entity) this, (Packet) packet17entitylocationaction); + this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch); + this.playerConnection.sendPacket(packet17entitylocationaction); + } + + return enumbedresult; + } + + public void a(boolean flag, boolean flag1, boolean flag2) { + if (this.fauxSleeping && !this.sleeping) return; // CraftBukkit - Can't leave bed if not in one! + + if (this.isSleeping()) { + this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 3)); + } + + super.a(flag, flag1, flag2); + if (this.playerConnection != null) { + this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch); + } + } + + public void mount(Entity entity) { + // CraftBukkit start + this.setPassengerOf(entity); + } + + public void setPassengerOf(Entity entity) { + // mount(null) doesn't really fly for overloaded methods, + // so this method is needed + Entity currentVehicle = this.vehicle; + + super.setPassengerOf(entity); + // CraftBukkit end + + // Check if the vehicle actually changed. + if (currentVehicle != this.vehicle) { + this.playerConnection.sendPacket(new Packet39AttachEntity(0, this, this.vehicle)); + this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch); + } + } + + protected void a(double d0, boolean flag) {} + + public void b(double d0, boolean flag) { + super.a(d0, flag); + } + + public void a(TileEntity tileentity) { + if (tileentity instanceof TileEntitySign) { + ((TileEntitySign) tileentity).a((EntityHuman)this); + this.playerConnection.sendPacket(new Packet133OpenTileEntity(0, tileentity.x, tileentity.y, tileentity.z)); + } + } + + public int nextContainerCounter() { // CraftBukkit - private void -> public int + this.containerCounter = this.containerCounter % 100 + 1; + return this.containerCounter; // CraftBukkit + } + + public void startCrafting(int i, int j, int k) { + // CraftBukkit start - Inventory open hook + Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerWorkbench(this.inventory, this.world, i, j, k)); + if(container == null) return; + // CraftBukkit end + + this.nextContainerCounter(); + this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 1, "Crafting", 9, true)); + this.activeContainer = container; // CraftBukkit - Use container we passed to event + this.activeContainer.windowId = this.containerCounter; + this.activeContainer.addSlotListener(this); + } + + public void startEnchanting(int i, int j, int k, String s) { + // CraftBukkit start - Inventory open hook + Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerEnchantTable(this.inventory, this.world, i, j, k)); + if(container == null) return; + // CraftBukkit end + + this.nextContainerCounter(); + this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 4, s == null ? "" : s, 9, s != null)); + this.activeContainer = container; // CraftBukkit - Use container we passed to event + this.activeContainer.windowId = this.containerCounter; + this.activeContainer.addSlotListener(this); + } + + public void openAnvil(int i, int j, int k) { + // CraftBukkit start - Inventory open hook + Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerAnvil(this.inventory, this.world, i, j, k, this)); + if(container == null) return; + // CraftBukkit end + + this.nextContainerCounter(); + this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 8, "Repairing", 9, true)); + this.activeContainer = container; // CraftBukkit - Use container we passed to event + this.activeContainer.windowId = this.containerCounter; + this.activeContainer.addSlotListener(this); + } + + public void openContainer(IInventory iinventory) { + if (this.activeContainer != this.defaultContainer) { + this.closeInventory(); + } + + // CraftBukkit start - Inventory open hook + Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, iinventory)); + if(container == null) return; + // CraftBukkit end + + this.nextContainerCounter(); + this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 0, iinventory.getName(), iinventory.getSize(), iinventory.c())); + this.activeContainer = container; // CraftBukkit - Use container we passed to event + this.activeContainer.windowId = this.containerCounter; + this.activeContainer.addSlotListener(this); + } + + public void openHopper(TileEntityHopper tileentityhopper) { + // CraftBukkit start - Inventory open hook + Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, tileentityhopper)); + if(container == null) return; + // CraftBukkit end + + this.nextContainerCounter(); + this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 9, tileentityhopper.getName(), tileentityhopper.getSize(), tileentityhopper.c())); + this.activeContainer = container; // CraftBukkit - Use container we passed to event + this.activeContainer.windowId = this.containerCounter; + this.activeContainer.addSlotListener(this); + } + + public void openMinecartHopper(EntityMinecartHopper entityminecarthopper) { + // CraftBukkit start - Inventory open hook + Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, entityminecarthopper)); + if(container == null) return; + // CraftBukkit end + + this.nextContainerCounter(); + this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 9, entityminecarthopper.getName(), entityminecarthopper.getSize(), entityminecarthopper.c())); + this.activeContainer = container; // CraftBukkit - Use container we passed to event + this.activeContainer.windowId = this.containerCounter; + this.activeContainer.addSlotListener(this); + } + + public void openFurnace(TileEntityFurnace tileentityfurnace) { + // CraftBukkit start - Inventory open hook + Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerFurnace(this.inventory, tileentityfurnace)); + if(container == null) return; + // CraftBukkit end + + this.nextContainerCounter(); + this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 2, tileentityfurnace.getName(), tileentityfurnace.getSize(), tileentityfurnace.c())); + this.activeContainer = container; // CraftBukkit - Use container we passed to event + this.activeContainer.windowId = this.containerCounter; + this.activeContainer.addSlotListener(this); + } + + public void openDispenser(TileEntityDispenser tileentitydispenser) { + // CraftBukkit start - Inventory open hook + Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerDispenser(this.inventory, tileentitydispenser)); + if(container == null) return; + // CraftBukkit end + + this.nextContainerCounter(); + this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, tileentitydispenser instanceof TileEntityDropper ? 10 : 3, tileentitydispenser.getName(), tileentitydispenser.getSize(), tileentitydispenser.c())); + this.activeContainer = container; // CraftBukkit - Use container we passed to event + this.activeContainer.windowId = this.containerCounter; + this.activeContainer.addSlotListener(this); + } + + public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) { + // CraftBukkit start - Inventory open hook + Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBrewingStand(this.inventory, tileentitybrewingstand)); + if(container == null) return; + // CraftBukkit end + + this.nextContainerCounter(); + this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 5, tileentitybrewingstand.getName(), tileentitybrewingstand.getSize(), tileentitybrewingstand.c())); + this.activeContainer = container; // CraftBukkit - Use container we passed to event + this.activeContainer.windowId = this.containerCounter; + this.activeContainer.addSlotListener(this); + } + + public void openBeacon(TileEntityBeacon tileentitybeacon) { + // CraftBukkit start - Inventory open hook + Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBeacon(this.inventory, tileentitybeacon)); + if(container == null) return; + // CraftBukkit end + + this.nextContainerCounter(); + this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 7, tileentitybeacon.getName(), tileentitybeacon.getSize(), tileentitybeacon.c())); + this.activeContainer = container; // CraftBukkit - Use container we passed to event + this.activeContainer.windowId = this.containerCounter; + this.activeContainer.addSlotListener(this); + } + + public void openTrade(IMerchant imerchant, String s) { + // CraftBukkit start - Inventory open hook + Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerMerchant(this.inventory, imerchant, this.world)); + if(container == null) return; + // CraftBukkit end + + this.nextContainerCounter(); + this.activeContainer = container; // CraftBukkit - Use container we passed to event + this.activeContainer.windowId = this.containerCounter; + this.activeContainer.addSlotListener(this); + InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).getMerchantInventory(); + + this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 6, s == null ? "" : s, inventorymerchant.getSize(), s != null)); + MerchantRecipeList merchantrecipelist = imerchant.getOffers(this); + + if (merchantrecipelist != null) { + try { + ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(); + DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream); + + dataoutputstream.writeInt(this.containerCounter); + merchantrecipelist.a(dataoutputstream); + this.playerConnection.sendPacket(new Packet250CustomPayload("MC|TrList", bytearrayoutputstream.toByteArray())); + } catch (IOException ioexception) { + ioexception.printStackTrace(); + } + } + } + + public void openHorseInventory(EntityHorse entityhorse, IInventory iinventory) { + // CraftBukkit start - Inventory open hook + Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHorse(this.inventory, iinventory, entityhorse)); + if(container == null) return; + // CraftBukkit end + + if (this.activeContainer != this.defaultContainer) { + this.closeInventory(); + } + + this.nextContainerCounter(); + this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 11, iinventory.getName(), iinventory.getSize(), iinventory.c(), entityhorse.id)); + this.activeContainer = container; // CraftBukkit - Use container we passed to event + this.activeContainer.windowId = this.containerCounter; + this.activeContainer.addSlotListener(this); + } + + public void a(Container container, int i, ItemStack itemstack) { + if (!(container.getSlot(i) instanceof SlotResult)) { + if (!this.h) { + this.playerConnection.sendPacket(new Packet103SetSlot(container.windowId, i, itemstack)); + } + } + } + + public void updateInventory(Container container) { + this.a(container, container.a()); + } + + public void a(Container container, List list) { + this.playerConnection.sendPacket(new Packet104WindowItems(container.windowId, list)); + this.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.getCarried())); + // CraftBukkit start - Send a Set Slot to update the crafting result slot + if (java.util.EnumSet.of(InventoryType.CRAFTING,InventoryType.WORKBENCH).contains(container.getBukkitView().getType())) { + this.playerConnection.sendPacket(new Packet103SetSlot(container.windowId, 0, container.getSlot(0).getItem())); + } + // CraftBukkit end + } + + public void setContainerData(Container container, int i, int j) { + this.playerConnection.sendPacket(new Packet105CraftProgressBar(container.windowId, i, j)); + } + + public void closeInventory() { + CraftEventFactory.handleInventoryCloseEvent(this); // CraftBukkit + this.playerConnection.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId)); + this.k(); + } + + public void broadcastCarriedItem() { + if (!this.h) { + this.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.getCarried())); + } + } + + public void k() { + this.activeContainer.b((EntityHuman) this); + this.activeContainer = this.defaultContainer; + } + + public void a(float f, float f1, boolean flag, boolean flag1) { + if (this.vehicle != null) { + if (f >= -1.0F && f <= 1.0F) { + this.be = f; + } + + if (f1 >= -1.0F && f1 <= 1.0F) { + this.bf = f1; + } + + this.bd = flag; + this.setSneaking(flag1); + } + } + + public void a(Statistic statistic, int i) { + if (statistic != null) { + if (!statistic.f) { + this.playerConnection.sendPacket(new Packet200Statistic(statistic.e, i)); + } + } + } + + public void l() { + if (this.passenger != null) { + this.passenger.mount(this); + } + + if (this.sleeping) { + this.a(true, false, false); + } + } + + @Override + public boolean L() + { + return !spectating; + } + + public void triggerHealthUpdate() { + this.bP = -1.0E8F; + this.lastSentExp = -1; // CraftBukkit - Added to reset + } + + public void a(String s) { + this.playerConnection.sendPacket(new Packet3Chat(ChatMessage.e(s))); + } + + protected void n() { + this.playerConnection.sendPacket(new Packet38EntityStatus(this.id, (byte) 9)); + super.n(); + } + + public void a(ItemStack itemstack, int i) { + super.a(itemstack, i); + if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().c_(itemstack) == EnumAnimation.EAT) { + this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 5)); + } + } + + public void copyTo(EntityHuman entityhuman, boolean flag) { + super.copyTo(entityhuman, flag); + this.lastSentExp = -1; + this.bP = -1.0F; + this.bQ = -1; + this.removeQueue.addAll(((EntityPlayer) entityhuman).removeQueue); + } + + protected void a(MobEffect mobeffect) { + super.a(mobeffect); + this.playerConnection.sendPacket(new Packet41MobEffect(this.id, mobeffect)); + } + + protected void a(MobEffect mobeffect, boolean flag) { + super.a(mobeffect, flag); + this.playerConnection.sendPacket(new Packet41MobEffect(this.id, mobeffect)); + } + + protected void b(MobEffect mobeffect) { + super.b(mobeffect); + this.playerConnection.sendPacket(new Packet42RemoveMobEffect(this.id, mobeffect)); + } + + public void enderTeleportTo(double d0, double d1, double d2) { + this.playerConnection.a(d0, d1, d2, this.yaw, this.pitch); + } + + public void b(Entity entity) { + this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 6)); + } + + public void c(Entity entity) { + this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 7)); + } + + public void updateAbilities() { + if (this.playerConnection != null) { + this.playerConnection.sendPacket(new Packet202Abilities(this.abilities)); + } + } + + public WorldServer p() { + return (WorldServer) this.world; + } + + public void a(EnumGamemode enumgamemode) { + this.playerInteractManager.setGameMode(enumgamemode); + this.playerConnection.sendPacket(new Packet70Bed(3, enumgamemode.a())); + } + + public void sendMessage(ChatMessage chatmessage) { + this.playerConnection.sendPacket(new Packet3Chat(chatmessage)); + } + + public boolean a(int i, String s) { + return "seed".equals(s) && !this.server.V() ? true : (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) ? (this.server.getPlayerList().isOp(this.name) ? this.server.k() >= i : false) : true); + } + + public String q() { + String s = this.playerConnection.networkManager.getSocketAddress().toString(); + + s = s.substring(s.indexOf("/") + 1); + s = s.substring(0, s.indexOf(":")); + return s; + } + + public void a(Packet204LocaleAndViewDistance packet204localeandviewdistance) { + this.locale = packet204localeandviewdistance.d(); + int i = 256 >> packet204localeandviewdistance.f(); + + if (i > 3 && i < 15) { + this.bU = i; + } + + this.bV = packet204localeandviewdistance.g(); + this.bW = packet204localeandviewdistance.h(); + if (this.server.K() && this.server.J().equals(this.name)) { + this.server.c(packet204localeandviewdistance.i()); + } + + this.b(1, !packet204localeandviewdistance.j()); + } + + public int getChatFlags() { + return this.bV; + } + + public void a(String s, int i) { + String s1 = s + "\0" + i; // CraftBukkit - fix decompile error + + this.playerConnection.sendPacket(new Packet250CustomPayload("MC|TPack", s1.getBytes())); + } + + public ChunkCoordinates b() { + return new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY + 0.5D), MathHelper.floor(this.locZ)); + } + + // CraftBukkit start + public long timeOffset = 0; + public boolean relativeTime = true; + + public long getPlayerTime() { + if (this.relativeTime) { + // Adds timeOffset to the current server time. + return this.world.getDayTime() + this.timeOffset; + } else { + // Adds timeOffset to the beginning of this day. + return this.world.getDayTime() - (this.world.getDayTime() % 24000) + this.timeOffset; + } + } + + public WeatherType weather = null; + + public WeatherType getPlayerWeather() { + return this.weather; + } + + public void setPlayerWeather(WeatherType type, boolean plugin) { + if (!plugin && this.weather != null) { + return; + } + + if (plugin) { + this.weather = type; + } + + this.playerConnection.sendPacket(new Packet70Bed(type == WeatherType.DOWNFALL ? 1 : 2, 0)); + } + + public void resetPlayerWeather() { + this.weather = null; + this.setPlayerWeather(this.world.getWorldData().hasStorm() ? WeatherType.DOWNFALL : WeatherType.CLEAR, false); + } + + @Override + public String toString() { + return super.toString() + "(" + this.name + " at " + this.locX + "," + this.locY + "," + this.locZ + ")"; + } + + public void reset() { + float exp = 0; + boolean keepInventory = this.world.getGameRules().getBoolean("keepInventory"); + + if (this.keepLevel || keepInventory) { + exp = this.exp; + this.newTotalExp = this.expTotal; + this.newLevel = this.expLevel; + } + + this.setHealth(this.getMaxHealth()); + this.fireTicks = 0; + this.fallDistance = 0; + this.foodData = new FoodMetaData(); + this.expLevel = this.newLevel; + this.expTotal = this.newTotalExp; + this.exp = 0; + this.deathTicks = 0; + this.aJ(); + this.updateEffects = true; + this.activeContainer = this.defaultContainer; + this.killer = null; + this.lastDamager = null; + this.combatTracker = new CombatTracker(this); + this.lastSentExp = -1; + if (this.keepLevel || keepInventory) { + this.exp = exp; + } else { + this.giveExp(this.newExp); + } + this.keepLevel = false; + } + + @Override + public CraftPlayer getBukkitEntity() { + return (CraftPlayer) super.getBukkitEntity(); + } + // CraftBukkit end +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/Packet.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/Packet.java new file mode 100644 index 000000000..392d74f23 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/Packet.java @@ -0,0 +1,343 @@ +package net.minecraft.server.v1_6_R2; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.EOFException; +import java.io.IOException; +import java.net.Socket; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; // CraftBukkit + +public abstract class Packet { + + public static IntHashMap l = new IntHashMap(); + private static Map a = new HashMap(); + private static Set b = new HashSet(); + private static Set c = new HashSet(); + protected IConsoleLogManager m; + public final long timestamp = MinecraftServer.aq(); + public static long o; + public static long p; + public static long q; + public static long r; + public boolean lowPriority; + // CraftBukkit start - Calculate packet ID once - used a bunch of times + private int packetID; + + public Packet() { + packetID = ((Integer) a.get(this.getClass())).intValue(); + } + // CraftBukkit end + + static void a(int i, boolean flag, boolean flag1, Class oclass) { + if (l.b(i)) { + throw new IllegalArgumentException("Duplicate packet id:" + i); + } else if (a.containsKey(oclass)) { + throw new IllegalArgumentException("Duplicate packet class:" + oclass); + } else { + l.a(i, oclass); + a.put(oclass, Integer.valueOf(i)); + if (flag) { + b.add(Integer.valueOf(i)); + } + + if (flag1) { + c.add(Integer.valueOf(i)); + } + } + } + + public static Packet a(IConsoleLogManager iconsolelogmanager, int i) { + try { + Class oclass = (Class) l.get(i); + + return oclass == null ? null : (Packet) oclass.newInstance(); + } catch (Exception exception) { + exception.printStackTrace(); + iconsolelogmanager.severe("Skipping packet with id " + i); + return null; + } + } + + public static void a(DataOutput dataoutput, byte[] abyte) throws IOException { // CraftBukkit - throws IOException + dataoutput.writeShort(abyte.length); + dataoutput.write(abyte); + } + + public static byte[] b(DataInput datainput) throws IOException { // CraftBukkit - throws IOException + short short1 = datainput.readShort(); + + if (short1 < 0) { + throw new IOException("Key was smaller than nothing! Weird key!"); + } else { + byte[] abyte = new byte[short1]; + + datainput.readFully(abyte); + return abyte; + } + } + + public final int n() { + return packetID; // ((Integer) a.get(this.getClass())).intValue(); // CraftBukkit + } + + public static Packet a(IConsoleLogManager iconsolelogmanager, DataInput datainput, boolean flag, Socket socket) throws IOException { // CraftBukkit - throws IOException + boolean flag1 = false; + Packet packet = null; + int i = socket.getSoTimeout(); + + int j; + + try { + j = datainput.readUnsignedByte(); + if (flag && !c.contains(Integer.valueOf(j)) || !flag && !b.contains(Integer.valueOf(j))) { + throw new IOException("Bad packet id " + j); + } + + packet = a(iconsolelogmanager, j); + if (packet == null) { + throw new IOException("Bad packet id " + j); + } + + packet.m = iconsolelogmanager; + if (packet instanceof Packet254GetInfo) { + socket.setSoTimeout(1500); + } + + packet.a(datainput); + ++o; + p += (long) packet.a(); + } catch (EOFException eofexception) { + if (eofexception.getMessage() != null) + iconsolelogmanager.severe("Reached end of stream for " + socket.getInetAddress()); + + return null; + } + + // CraftBukkit start + catch (java.net.SocketTimeoutException exception) { + iconsolelogmanager.info("Read timed out"); + return null; + } catch (java.net.SocketException exception) { + iconsolelogmanager.info("Connection reset"); + return null; + } + // CraftBukkit end + + PacketCounter.a(j, (long) packet.a()); + ++o; + p += (long) packet.a(); + socket.setSoTimeout(i); + return packet; + } + + public static void a(Packet packet, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException + dataoutput.write(packet.n()); + packet.a(dataoutput); + ++q; + r += (long) packet.a(); + } + + public static void a(String s, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException + if (s.length() > 32767) { + throw new IOException("String too big"); + } else { + dataoutput.writeShort(s.length()); + dataoutput.writeChars(s); + } + } + + public static String a(DataInput datainput, int i) throws IOException { // CraftBukkit - throws IOException + short short1 = datainput.readShort(); + + if (short1 > i) { + throw new IOException("Received string length longer than maximum allowed (" + short1 + " > " + i + ")"); + } else if (short1 < 0) { + throw new IOException("Received string length is less than zero! Weird string!"); + } else { + StringBuilder stringbuilder = new StringBuilder(); + + for (int j = 0; j < short1; ++j) { + stringbuilder.append(datainput.readChar()); + } + + return stringbuilder.toString(); + } + } + + public abstract void a(DataInput datainput) throws IOException; // CraftBukkit - throws IOException + + public abstract void a(DataOutput dataoutput) throws IOException; // CraftBukkit - throws IOException + + public abstract void handle(Connection connection); + + public abstract int a(); + + public boolean e() { + return false; + } + + public boolean a(Packet packet) { + return false; + } + + public boolean a_() { + return this instanceof Packet3Chat && !((Packet3Chat) this).message.startsWith("/"); // CraftBukkit - async chat + } + + public String toString() { + String s = this.getClass().getSimpleName(); + + return s; + } + + public static ItemStack c(DataInput datainput) throws IOException { // CraftBukkit - throws IOException + ItemStack itemstack = null; + short short1 = datainput.readShort(); + + if (short1 >= 0) { + byte b0 = datainput.readByte(); + short short2 = datainput.readShort(); + + itemstack = new ItemStack(short1, b0, short2); + itemstack.tag = d(datainput); + // CraftBukkit start + if (itemstack.tag != null) { + CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack)); + } + // CraftBukkit end + } + + return itemstack; + } + + public static void a(ItemStack itemstack, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException + if (itemstack == null || itemstack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem() + dataoutput.writeShort(-1); + } else { + dataoutput.writeShort(itemstack.id); + dataoutput.writeByte(itemstack.count); + dataoutput.writeShort(itemstack.getData()); + NBTTagCompound nbttagcompound = null; + + if (itemstack.getItem().usesDurability() || itemstack.getItem().s()) { + nbttagcompound = itemstack.tag; + } + + a(nbttagcompound, dataoutput); + } + } + + public static NBTTagCompound d(DataInput datainput) throws IOException { // CraftBukkit - throws IOException + short short1 = datainput.readShort(); + + if (short1 < 0) { + return null; + } else { + byte[] abyte = new byte[short1]; + + datainput.readFully(abyte); + return NBTCompressedStreamTools.a(abyte); + } + } + + protected static void a(NBTTagCompound nbttagcompound, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException + if (nbttagcompound == null) { + dataoutput.writeShort(-1); + } else { + byte[] abyte = NBTCompressedStreamTools.a(nbttagcompound); + + dataoutput.writeShort((short) abyte.length); + dataoutput.write(abyte); + } + } + + static { + a(0, true, true, Packet0KeepAlive.class); + a(1, true, true, Packet1Login.class); + a(2, false, true, Packet2Handshake.class); + a(3, true, true, Packet3Chat.class); + a(4, true, false, Packet4UpdateTime.class); + a(5, true, false, Packet5EntityEquipment.class); + a(6, true, false, Packet6SpawnPosition.class); + a(7, false, true, Packet7UseEntity.class); + a(8, true, false, Packet8UpdateHealth.class); + a(9, true, true, Packet9Respawn.class); + a(10, true, true, Packet10Flying.class); + a(11, true, true, Packet11PlayerPosition.class); + a(12, true, true, Packet12PlayerLook.class); + a(13, true, true, Packet13PlayerLookMove.class); + a(14, false, true, Packet14BlockDig.class); + a(15, false, true, Packet15Place.class); + a(16, true, true, Packet16BlockItemSwitch.class); + a(17, true, false, Packet17EntityLocationAction.class); + a(18, true, true, Packet18ArmAnimation.class); + a(19, false, true, Packet19EntityAction.class); + a(20, true, false, Packet20NamedEntitySpawn.class); + a(22, true, false, Packet22Collect.class); + a(23, true, false, Packet23VehicleSpawn.class); + a(24, true, false, Packet24MobSpawn.class); + a(25, true, false, Packet25EntityPainting.class); + a(26, true, false, Packet26AddExpOrb.class); + a(27, false, true, Packet27PlayerInput.class); + a(28, true, false, Packet28EntityVelocity.class); + a(29, true, false, Packet29DestroyEntity.class); + a(30, true, false, Packet30Entity.class); + a(31, true, false, Packet31RelEntityMove.class); + a(32, true, false, Packet32EntityLook.class); + a(33, true, false, Packet33RelEntityMoveLook.class); + a(34, true, false, Packet34EntityTeleport.class); + a(35, true, false, Packet35EntityHeadRotation.class); + a(38, true, false, Packet38EntityStatus.class); + a(39, true, false, Packet39AttachEntity.class); + a(40, true, false, Packet40EntityMetadata.class); + a(41, true, false, Packet41MobEffect.class); + a(42, true, false, Packet42RemoveMobEffect.class); + a(43, true, false, Packet43SetExperience.class); + a(44, true, false, Packet44UpdateAttributes.class); + a(51, true, false, Packet51MapChunk.class); + a(52, true, false, Packet52MultiBlockChange.class); + a(53, true, false, Packet53BlockChange.class); + a(54, true, false, Packet54PlayNoteBlock.class); + a(55, true, false, Packet55BlockBreakAnimation.class); + a(56, true, false, Packet56MapChunkBulk.class); + a(60, true, false, Packet60Explosion.class); + a(61, true, false, Packet61WorldEvent.class); + a(62, true, false, Packet62NamedSoundEffect.class); + a(63, true, false, Packet63WorldParticles.class); + a(70, true, false, Packet70Bed.class); + a(71, true, false, Packet71Weather.class); + a(100, true, false, Packet100OpenWindow.class); + a(101, true, true, Packet101CloseWindow.class); + a(102, false, true, Packet102WindowClick.class); + a(103, true, false, Packet103SetSlot.class); + a(104, true, false, Packet104WindowItems.class); + a(105, true, false, Packet105CraftProgressBar.class); + a(106, true, true, Packet106Transaction.class); + a(107, true, true, Packet107SetCreativeSlot.class); + a(108, false, true, Packet108ButtonClick.class); + a(130, true, true, Packet130UpdateSign.class); + a(131, true, false, Packet131ItemData.class); + a(132, true, false, Packet132TileEntityData.class); + a(133, true, false, Packet133OpenTileEntity.class); + a(200, true, false, Packet200Statistic.class); + a(201, true, false, Packet201PlayerInfo.class); + a(202, true, true, Packet202Abilities.class); + a(203, true, true, Packet203TabComplete.class); + a(204, false, true, Packet204LocaleAndViewDistance.class); + a(205, false, true, Packet205ClientCommand.class); + a(206, true, false, Packet206SetScoreboardObjective.class); + a(207, true, false, Packet207SetScoreboardScore.class); + a(208, true, false, Packet208SetScoreboardDisplayObjective.class); + a(209, true, false, Packet209SetScoreboardTeam.class); + a(250, true, true, Packet250CustomPayload.class); + a(252, true, true, Packet252KeyResponse.class); + a(253, true, false, Packet253KeyRequest.class); + a(254, false, true, Packet254GetInfo.class); + a(255, true, true, Packet255KickDisconnect.class); + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/PendingConnection.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/PendingConnection.java new file mode 100644 index 000000000..22ab9aa7b --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/PendingConnection.java @@ -0,0 +1,216 @@ +package net.minecraft.server.v1_6_R2; + +import java.io.Serializable; +import java.net.InetAddress; +import java.net.Socket; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Random; +import javax.crypto.SecretKey; + +public class PendingConnection extends Connection { + + private static Random random = new Random(); + private byte[] d; + private final MinecraftServer server; + public final NetworkManager networkManager; + public boolean b; + private int f; + private String g; + private volatile boolean h; + private String loginKey = Long.toString(random.nextLong(), 16); // CraftBukkit - Security fix + private boolean j; + private SecretKey k; + public String hostname = ""; // CraftBukkit - add field + + public PendingConnection(MinecraftServer minecraftserver, Socket socket, String s) throws java.io.IOException { // CraftBukkit - throws IOException + this.server = minecraftserver; + this.networkManager = new NetworkManager(minecraftserver.getLogger(), socket, s, this, minecraftserver.H().getPrivate()); + this.networkManager.e = 0; + } + + // CraftBukkit start + public Socket getSocket() { + return this.networkManager.getSocket(); + } + // CraftBukkit end + + public void d() { + if (this.h) { + this.e(); + } + + if (this.f++ == 600) { + this.disconnect("Took too long to log in"); + } else { + this.networkManager.b(); + } + } + + public void disconnect(String s) { + try { + this.server.getLogger().info("Disconnecting " + this.getName() + ": " + s); + this.networkManager.queue(new Packet255KickDisconnect(s)); + this.networkManager.d(); + this.b = true; + } catch (Exception exception) { + exception.printStackTrace(); + } + } + + public void a(Packet2Handshake packet2handshake) { + // CraftBukkit start + this.hostname = packet2handshake.c == null ? "" : packet2handshake.c + ':' + packet2handshake.d; + // CraftBukkit end + this.g = packet2handshake.f(); + if (!this.g.equals(StripColor.a(this.g))) { + this.disconnect("Invalid username!"); + } else { + PublicKey publickey = this.server.H().getPublic(); + + if (packet2handshake.d() != 74) { + if (packet2handshake.d() > 74) { + this.disconnect("Outdated server!"); + } else { + this.disconnect("Outdated client!"); + } + } else { + this.loginKey = this.server.getOnlineMode() ? Long.toString(random.nextLong(), 16) : "-"; + this.d = new byte[4]; + random.nextBytes(this.d); + this.networkManager.queue(new Packet253KeyRequest(this.loginKey, publickey, this.d)); + } + } + } + + public void a(Packet252KeyResponse packet252keyresponse) { + PrivateKey privatekey = this.server.H().getPrivate(); + + this.k = packet252keyresponse.a(privatekey); + if (!Arrays.equals(this.d, packet252keyresponse.b(privatekey))) { + this.disconnect("Invalid client reply"); + } + + this.networkManager.queue(new Packet252KeyResponse()); + } + + public void a(Packet205ClientCommand packet205clientcommand) { + if (packet205clientcommand.a == 0) { + if (this.j) { + this.disconnect("Duplicate login"); + return; + } + + this.j = true; + (new AsyncLoginThread(this, server.server)).start(); // CraftBukkit - add CraftServer + } + } + + public void a(Packet1Login packet1login) {} + + public void e() { + // CraftBukkit start + EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.g, this.hostname); + + if (s == null) { + // this.disconnect(s); + return; + // CraftBukkit end + } else { + EntityPlayer entityplayer = this.server.getPlayerList().processLogin(s); // CraftBukkit - this.g -> s + + if (entityplayer != null) { + this.server.getPlayerList().a((INetworkManager) this.networkManager, entityplayer); + } + } + + this.b = true; + } + + public void a(String s, Object[] aobject) { + this.server.getLogger().info(this.getName() + " lost connection"); + this.b = true; + } + + public void a(Packet254GetInfo packet254getinfo) { + if (this.networkManager.getSocket() == null) return; // CraftBukkit - fix NPE when a client queries a server that is unable to handle it. + try { + PlayerList playerlist = this.server.getPlayerList(); + String s = null; + // CraftBukkit + org.bukkit.event.server.ServerListPingEvent pingEvent = org.bukkit.craftbukkit.v1_6_R2.event.CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.getMotd(), playerlist.getPlayerCount(), playerlist.getMaxPlayers()); + if (packet254getinfo.d()) { + // CraftBukkit + s = pingEvent.getMotd() + "\u00A7" + playerlist.getPlayerCount() + "\u00A7" + pingEvent.getMaxPlayers(); + } else { + List list = Arrays.asList(new Serializable[] { Integer.valueOf(1), Integer.valueOf(74), this.server.getVersion(), pingEvent.getMotd(), Integer.valueOf(playerlist.getPlayerCount()), pingEvent.getMaxPlayers()}); + + Object object; + + for (Iterator iterator = list.iterator(); iterator.hasNext(); s = s + object.toString().replaceAll("\0", "")) { + object = iterator.next(); + if (s == null) { + s = "\u00A7"; + } else { + s = s + '\0'; + } + } + } + + InetAddress inetaddress = null; + + if (this.networkManager.getSocket() != null) { + inetaddress = this.networkManager.getSocket().getInetAddress(); + } + + this.networkManager.queue(new Packet255KickDisconnect(s)); + this.networkManager.d(); + if (inetaddress != null && this.server.ag() instanceof DedicatedServerConnection) { + ((DedicatedServerConnection) this.server.ag()).a(inetaddress); + } + + this.b = true; + } catch (Exception exception) { + exception.printStackTrace(); + } + } + + public void onUnhandledPacket(Packet packet) { + this.disconnect("Protocol error"); + } + + public String getName() { + return this.g != null ? this.g + " [" + this.networkManager.getSocketAddress().toString() + "]" : this.networkManager.getSocketAddress().toString(); + } + + public boolean a() { + return true; + } + + public boolean c() { + return this.b; + } + + static String a(PendingConnection pendingconnection) { + return pendingconnection.loginKey; + } + + static MinecraftServer b(PendingConnection pendingconnection) { + return pendingconnection.server; + } + + static SecretKey c(PendingConnection pendingconnection) { + return pendingconnection.k; + } + + static String d(PendingConnection pendingconnection) { + return pendingconnection.g; + } + + static boolean a(PendingConnection pendingconnection, boolean flag) { + return pendingconnection.h = flag; + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/PlayerChunk.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/PlayerChunk.java new file mode 100644 index 000000000..c8c3326c8 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/PlayerChunk.java @@ -0,0 +1,189 @@ +package net.minecraft.server.v1_6_R2; + +import java.util.ArrayList; +import java.util.List; + +class PlayerChunk { + + private final List b; + private final ChunkCoordIntPair location; + private short[] dirtyBlocks; + private int dirtyCount; + private int f; + private long g; + private boolean loaded = false; // CraftBukkit + + final PlayerChunkMap playerChunkMap; + + public PlayerChunk(PlayerChunkMap playerchunkmap, int i, int j) { + this.playerChunkMap = playerchunkmap; + this.b = new ArrayList(); + this.dirtyBlocks = new short[64]; + this.location = new ChunkCoordIntPair(i, j); + // CraftBukkit start + playerchunkmap.a().chunkProviderServer.getChunkAt(i, j, new Runnable() { + public void run() { + PlayerChunk.this.loaded = true; + } + }); + // CraftBukkit end + } + + public void a(final EntityPlayer entityplayer) { // CraftBukkit - added final to argument + if (this.b.contains(entityplayer)) { + throw new IllegalStateException("Failed to add player. " + entityplayer + " already is in chunk " + this.location.x + ", " + this.location.z); + } else { + if (this.b.isEmpty()) { + this.g = PlayerChunkMap.a(this.playerChunkMap).getTime(); + } + + this.b.add(entityplayer); + + // CraftBukkit start + if (this.loaded) { + entityplayer.chunkCoordIntPairQueue.add(this.location); + } else { + // Abuse getChunkAt to add another callback + this.playerChunkMap.a().chunkProviderServer.getChunkAt(this.location.x, this.location.z, new Runnable() { + public void run() { + entityplayer.chunkCoordIntPairQueue.add(PlayerChunk.this.location); + } + }); + } + // CraftBukkit end + } + } + + public void b(EntityPlayer entityplayer) { + if (this.b.contains(entityplayer)) { + Chunk chunk = PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z); + + if (chunk.x == location.x && chunk.z == location.z) + { + entityplayer.playerConnection.sendPacket(new Packet51MapChunk(chunk, true, 0)); + } + + this.b.remove(entityplayer); + entityplayer.chunkCoordIntPairQueue.remove(this.location); + if (this.b.isEmpty()) { + long i = (long) this.location.x + 2147483647L | (long) this.location.z + 2147483647L << 32; + + this.a(chunk); + PlayerChunkMap.b(this.playerChunkMap).remove(i); + PlayerChunkMap.c(this.playerChunkMap).remove(this); + if (this.dirtyCount > 0) { + PlayerChunkMap.d(this.playerChunkMap).remove(this); + } + + this.playerChunkMap.a().chunkProviderServer.queueUnload(this.location.x, this.location.z); + } + } + } + + public void a() { + this.a(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z)); + } + + private void a(Chunk chunk) { + chunk.q += PlayerChunkMap.a(this.playerChunkMap).getTime() - this.g; + this.g = PlayerChunkMap.a(this.playerChunkMap).getTime(); + } + + public void a(int i, int j, int k) { + if (this.dirtyCount == 0) { + PlayerChunkMap.d(this.playerChunkMap).add(this); + } + + this.f |= 1 << (j >> 4); + if (this.dirtyCount < 64) { + short short1 = (short) (i << 12 | k << 8 | j); + + for (int l = 0; l < this.dirtyCount; ++l) { + if (this.dirtyBlocks[l] == short1) { + return; + } + } + + this.dirtyBlocks[this.dirtyCount++] = short1; + } + } + + public void sendAll(Packet packet) { + for (int i = 0; i < this.b.size(); ++i) { + EntityPlayer entityplayer = (EntityPlayer) this.b.get(i); + + if (!entityplayer.chunkCoordIntPairQueue.contains(this.location)) { + entityplayer.playerConnection.sendPacket(packet); + } + } + } + + public void b() { + if (this.dirtyCount != 0) { + int i; + int j; + int k; + + if (this.dirtyCount == 1) { + i = this.location.x * 16 + (this.dirtyBlocks[0] >> 12 & 15); + j = this.dirtyBlocks[0] & 255; + k = this.location.z * 16 + (this.dirtyBlocks[0] >> 8 & 15); + this.sendAll(new Packet53BlockChange(i, j, k, PlayerChunkMap.a(this.playerChunkMap))); + if (PlayerChunkMap.a(this.playerChunkMap).isTileEntity(i, j, k)) { + this.sendTileEntity(PlayerChunkMap.a(this.playerChunkMap).getTileEntity(i, j, k)); + } + } else { + int l; + + if (this.dirtyCount == 64) { + i = this.location.x * 16; + j = this.location.z * 16; + this.sendAll(new Packet51MapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f)); + + for (k = 0; k < 16; ++k) { + if ((this.f & 1 << k) != 0) { + l = k << 4; + List list = PlayerChunkMap.a(this.playerChunkMap).getTileEntities(i, l, j, i + 16, l + 16, j + 16); + + for (int i1 = 0; i1 < list.size(); ++i1) { + this.sendTileEntity((TileEntity) list.get(i1)); + } + } + } + } else { + this.sendAll(new Packet52MultiBlockChange(this.location.x, this.location.z, this.dirtyBlocks, this.dirtyCount, PlayerChunkMap.a(this.playerChunkMap))); + + for (i = 0; i < this.dirtyCount; ++i) { + j = this.location.x * 16 + (this.dirtyBlocks[i] >> 12 & 15); + k = this.dirtyBlocks[i] & 255; + l = this.location.z * 16 + (this.dirtyBlocks[i] >> 8 & 15); + if (PlayerChunkMap.a(this.playerChunkMap).isTileEntity(j, k, l)) { + this.sendTileEntity(PlayerChunkMap.a(this.playerChunkMap).getTileEntity(j, k, l)); + } + } + } + } + + this.dirtyCount = 0; + this.f = 0; + } + } + + private void sendTileEntity(TileEntity tileentity) { + if (tileentity != null) { + Packet packet = tileentity.getUpdatePacket(); + + if (packet != null) { + this.sendAll(packet); + } + } + } + + static ChunkCoordIntPair a(PlayerChunk playerchunk) { + return playerchunk.location; + } + + static List b(PlayerChunk playerchunk) { + return playerchunk.b; + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/PlayerConnection.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/PlayerConnection.java new file mode 100644 index 000000000..0325b0fe1 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R2/PlayerConnection.java @@ -0,0 +1,1824 @@ +package net.minecraft.server.v1_6_R2; + +import java.io.ByteArrayInputStream; +import java.io.DataInput; +import java.io.DataInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Random; +import java.util.concurrent.Callable; + +import org.apache.commons.lang3.StringUtils; + +// CraftBukkit start +import java.io.UnsupportedEncodingException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; +import java.util.HashSet; + +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftInventoryView; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_6_R2.util.LazyPlayerSet; +import org.bukkit.craftbukkit.v1_6_R2.util.Waitable; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_6_R2.event.CraftEventFactory; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.SignChangeEvent; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.event.inventory.CraftItemEvent; +import org.bukkit.event.inventory.InventoryAction; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCreativeEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.inventory.InventoryType.SlotType; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerAnimationEvent; +import org.bukkit.event.player.PlayerChatEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerItemHeldEvent; +import org.bukkit.event.player.PlayerKickEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; +import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.event.player.PlayerToggleSprintEvent; +import org.bukkit.inventory.CraftingInventory; +import org.bukkit.inventory.InventoryView; +// CraftBukkit end + +public class PlayerConnection extends Connection { + + public final INetworkManager networkManager; + private final MinecraftServer minecraftServer; + public boolean disconnected; + public EntityPlayer player; + private int e; + private int f; + private boolean g; + private int h; + private long i; + private static Random j = new Random(); + private long k; + private volatile int chatThrottle; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); // CraftBukkit - multithreaded field + private int x = 0; + private double y; + private double z; + private double p; + public boolean checkMovement = true; // CraftBukkit - private -> public + private IntHashMap r = new IntHashMap(); + + public PlayerConnection(MinecraftServer minecraftserver, INetworkManager inetworkmanager, EntityPlayer entityplayer) { + this.minecraftServer = minecraftserver; + this.networkManager = inetworkmanager; + inetworkmanager.a(this); + this.player = entityplayer; + entityplayer.playerConnection = this; + + // CraftBukkit start + this.server = minecraftserver.server; + } + + private final org.bukkit.craftbukkit.v1_6_R2.CraftServer server; + private int lastTick = MinecraftServer.currentTick; + private int lastDropTick = MinecraftServer.currentTick; + private int dropCount = 0; + private static final int PLACE_DISTANCE_SQUARED = 6 * 6; + + // Get position of last block hit for BlockDamageLevel.STOPPED + private double lastPosX = Double.MAX_VALUE; + private double lastPosY = Double.MAX_VALUE; + private double lastPosZ = Double.MAX_VALUE; + private float lastPitch = Float.MAX_VALUE; + private float lastYaw = Float.MAX_VALUE; + private boolean justTeleported = false; + + // For the packet15 hack :( + Long lastPacket; + + // Store the last block right clicked and what type it was + private int lastMaterial; + + public CraftPlayer getPlayer() { + return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity(); + } + private final static HashSet invalidItems = new HashSet(java.util.Arrays.asList(8, 9, 10, 11, 26, 34, 36, 43, 51, 52, 55, 59, 60, 62, 63, 64, 68, 71, 74, 75, 83, 90, 92, 93, 94, 95, 104, 105, 115, 117, 118, 119, 125, 127, 132, 137, 140, 141, 142, 144)); // TODO: Check after every update. + // CraftBukkit end + + public void e() { + this.g = false; + ++this.e; + this.minecraftServer.methodProfiler.a("packetflow"); + this.networkManager.b(); + this.minecraftServer.methodProfiler.c("keepAlive"); + if ((long) this.e - this.k > 20L) { + this.k = (long) this.e; + this.i = System.nanoTime() / 1000000L; + this.h = j.nextInt(); + this.sendPacket(new Packet0KeepAlive(this.h)); + } + + // CraftBukkit start + for (int spam; (spam = this.chatThrottle) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ; + /* Use thread-safe field access instead + if (this.m > 0) { + --this.m; + } + */ + // CraftBukkit end + + if (this.x > 0) { + --this.x; + } + + this.minecraftServer.methodProfiler.c("playerTick"); + this.minecraftServer.methodProfiler.b(); + } + + public void disconnect(String s) { + if (!this.disconnected) { + // CraftBukkit start + String leaveMessage = EnumChatFormat.YELLOW + this.player.getName() + " left the game."; + + PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage); + + if (this.server.getServer().isRunning()) { + this.server.getPluginManager().callEvent(event); + } + + if (event.isCancelled()) { + // Do not kick the player + return; + } + // Send the possibly modified leave message + s = event.getReason(); + // CraftBukkit end + + this.player.l(); + this.sendPacket(new Packet255KickDisconnect(s)); + this.networkManager.d(); + + // CraftBukkit start + leaveMessage = event.getLeaveMessage(); + if (leaveMessage != null && leaveMessage.length() > 0) { + this.minecraftServer.getPlayerList().sendMessage(ChatMessage.d(leaveMessage)); + } + // CraftBukkit end + + this.minecraftServer.getPlayerList().disconnect(this.player); + this.disconnected = true; + } + } + + public void a(Packet27PlayerInput packet27playerinput) { + this.player.a(packet27playerinput.d(), packet27playerinput.f(), packet27playerinput.g(), packet27playerinput.h()); + } + + public void a(Packet10Flying packet10flying) { + WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); + + this.g = true; + if (!this.player.viewingCredits) { + double d0; + + if (!this.checkMovement) { + d0 = packet10flying.y - this.z; + if (packet10flying.x == this.y && d0 * d0 < 0.01D && packet10flying.z == this.p) { + this.checkMovement = true; + } + } + + // CraftBukkit start + Player player = this.getPlayer(); + Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location. + Location to = player.getLocation().clone(); // Start off the To location as the Players current location. + + // If the packet contains movement information then we update the To location with the correct XYZ. + if (packet10flying.hasPos && !(packet10flying.hasPos && packet10flying.y == -999.0D && packet10flying.stance == -999.0D)) { + to.setX(packet10flying.x); + to.setY(packet10flying.y); + to.setZ(packet10flying.z); + } + + // If the packet contains look information then we update the To location with the correct Yaw & Pitch. + if (packet10flying.hasLook) { + to.setYaw(packet10flying.yaw); + to.setPitch(packet10flying.pitch); + } + + // Prevent 40 event-calls for less than a single pixel of movement >.> + double delta = Math.pow(this.lastPosX - to.getX(), 2) + Math.pow(this.lastPosY - to.getY(), 2) + Math.pow(this.lastPosZ - to.getZ(), 2); + float deltaAngle = Math.abs(this.lastYaw - to.getYaw()) + Math.abs(this.lastPitch - to.getPitch()); + + if ((delta > 1f / 256 || deltaAngle > 10f) && (this.checkMovement && !this.player.dead)) { + this.lastPosX = to.getX(); + this.lastPosY = to.getY(); + this.lastPosZ = to.getZ(); + this.lastYaw = to.getYaw(); + this.lastPitch = to.getPitch(); + + // Skip the first time we do this + if (from.getX() != Double.MAX_VALUE) { + PlayerMoveEvent event = new PlayerMoveEvent(player, from, to); + this.server.getPluginManager().callEvent(event); + + // If the event is cancelled we move the player back to their old location. + if (event.isCancelled()) { + this.player.playerConnection.sendPacket(new Packet13PlayerLookMove(from.getX(), from.getY() + 1.6200000047683716D, from.getY(), from.getZ(), from.getYaw(), from.getPitch(), false)); + return; + } + + /* If a Plugin has changed the To destination then we teleport the Player + there to avoid any 'Moved wrongly' or 'Moved too quickly' errors. + We only do this if the Event was not cancelled. */ + if (!to.equals(event.getTo()) && !event.isCancelled()) { + this.player.getBukkitEntity().teleport(event.getTo(), PlayerTeleportEvent.TeleportCause.UNKNOWN); + return; + } + + /* Check to see if the Players Location has some how changed during the call of the event. + This can happen due to a plugin teleporting the player instead of using .setTo() */ + if (!from.equals(this.getPlayer().getLocation()) && this.justTeleported) { + this.justTeleported = false; + return; + } + } + } + + if (Double.isNaN(packet10flying.x) || Double.isNaN(packet10flying.y) || Double.isNaN(packet10flying.z) || Double.isNaN(packet10flying.stance)) { + player.teleport(player.getWorld().getSpawnLocation(), PlayerTeleportEvent.TeleportCause.UNKNOWN); + System.err.println(player.getName() + " was caught trying to crash the server with an invalid position."); + player.kickPlayer("Nope!"); + return; + } + + if (this.checkMovement && !this.player.dead) { + // CraftBukkit end + double d1; + double d2; + double d3; + + if (this.player.vehicle != null) { + float f = this.player.yaw; + float f1 = this.player.pitch; + + this.player.vehicle.V(); + d1 = this.player.locX; + d2 = this.player.locY; + d3 = this.player.locZ; + if (packet10flying.hasLook) { + f = packet10flying.yaw; + f1 = packet10flying.pitch; + } + + this.player.onGround = packet10flying.g; + this.player.h(); + this.player.X = 0.0F; + this.player.setLocation(d1, d2, d3, f, f1); + if (this.player.vehicle != null) { + this.player.vehicle.V(); + } + + this.minecraftServer.getPlayerList().d(this.player); + if (this.checkMovement) { + this.y = this.player.locX; + this.z = this.player.locY; + this.p = this.player.locZ; + } + + worldserver.playerJoinedWorld(this.player); + return; + } + + if (this.player.isSleeping()) { + this.player.h(); + this.player.setLocation(this.y, this.z, this.p, this.player.yaw, this.player.pitch); + worldserver.playerJoinedWorld(this.player); + return; + } + + d0 = this.player.locY; + this.y = this.player.locX; + this.z = this.player.locY; + this.p = this.player.locZ; + d1 = this.player.locX; + d2 = this.player.locY; + d3 = this.player.locZ; + float f2 = this.player.yaw; + float f3 = this.player.pitch; + + if (packet10flying.hasPos && packet10flying.y == -999.0D && packet10flying.stance == -999.0D) { + packet10flying.hasPos = false; + } + + double d4; + + if (packet10flying.hasPos) { + d1 = packet10flying.x; + d2 = packet10flying.y; + d3 = packet10flying.z; + d4 = packet10flying.stance - packet10flying.y; + if (!this.player.isSleeping() && (d4 > 1.65D || d4 < 0.1D)) { + this.disconnect("Illegal stance"); + this.minecraftServer.getLogger().warning(this.player.getName() + " had an illegal stance: " + d4); + return; + } + + if (Math.abs(packet10flying.x) > 3.2E7D || Math.abs(packet10flying.z) > 3.2E7D) { + // CraftBukkit - teleport to previous position instead of kicking, players get stuck + this.a(this.y, this.z, this.p, this.player.yaw, this.player.pitch); + return; + } + } + + if (packet10flying.hasLook) { + f2 = packet10flying.yaw; + f3 = packet10flying.pitch; + } + + this.player.h(); + this.player.X = 0.0F; + this.player.setLocation(this.y, this.z, this.p, f2, f3); + if (!this.checkMovement) { + return; + } + + d4 = d1 - this.player.locX; + double d5 = d2 - this.player.locY; + double d6 = d3 - this.player.locZ; + // CraftBukkit start - min to max + double d7 = Math.max(Math.abs(d4), Math.abs(this.player.motX)); + double d8 = Math.max(Math.abs(d5), Math.abs(this.player.motY)); + double d9 = Math.max(Math.abs(d6), Math.abs(this.player.motZ)); + // CraftBukkit end + double d10 = d7 * d7 + d8 * d8 + d9 * d9; + + if (d10 > 100.0D && this.checkMovement && (!this.minecraftServer.K() || !this.minecraftServer.J().equals(this.player.getName()))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports + this.minecraftServer.getLogger().warning(this.player.getName() + " moved too quickly! " + d4 + "," + d5 + "," + d6 + " (" + d7 + ", " + d8 + ", " + d9 + ")"); + this.a(this.y, this.z, this.p, this.player.yaw, this.player.pitch); + return; + } + + float f4 = 0.0625F; + boolean flag = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).isEmpty(); + + if (this.player.onGround && !packet10flying.g && d5 > 0.0D) { + this.player.a(0.2F); + } + + this.player.move(d4, d5, d6); + this.player.onGround = packet10flying.g; + this.player.checkMovement(d4, d5, d6); + double d11 = d5; + + d4 = d1 - this.player.locX; + d5 = d2 - this.player.locY; + if (d5 > -0.5D || d5 < 0.5D) { + d5 = 0.0D; + } + + d6 = d3 - this.player.locZ; + d10 = d4 * d4 + d5 * d5 + d6 * d6; + boolean flag1 = false; + + if (d10 > 0.0625D && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative()) { + flag1 = true; + this.minecraftServer.getLogger().warning(this.player.getName() + " moved wrongly!"); + } + + this.player.setLocation(d1, d2, d3, f2, f3); + boolean flag2 = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).isEmpty(); + + if (flag && (flag1 || !flag2) && !this.player.isSleeping()) { + this.a(this.y, this.z, this.p, f2, f3); + return; + } + + AxisAlignedBB axisalignedbb = this.player.boundingBox.clone().grow((double) f4, (double) f4, (double) f4).a(0.0D, -0.55D, 0.0D); + + if (!this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly && !worldserver.c(axisalignedbb)) { // CraftBukkit - check abilities instead of creative mode + if (d11 >= -0.03125D) { + ++this.f; + if (this.f > 80) { + this.minecraftServer.getLogger().warning(this.player.getName() + " was kicked for floating too long!"); + this.disconnect("Flying is not enabled on this server"); + return; + } + } + } else { + this.f = 0; + } + + this.player.onGround = packet10flying.g; + this.minecraftServer.getPlayerList().d(this.player); + if (this.player.playerInteractManager.isCreative()) return; // CraftBukkit - fixed fall distance accumulating while being in Creative mode. + this.player.b(this.player.locY - d0, packet10flying.g); + } else if (this.e % 20 == 0) { + this.a(this.y, this.z, this.p, this.player.yaw, this.player.pitch); + } + } + } + + public void a(double d0, double d1, double d2, float f, float f1) { + // CraftBukkit start - Delegate to teleport(Location) + Player player = this.getPlayer(); + Location from = player.getLocation(); + Location to = new Location(this.getPlayer().getWorld(), d0, d1, d2, f, f1); + PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to, PlayerTeleportEvent.TeleportCause.UNKNOWN); + this.server.getPluginManager().callEvent(event); + + from = event.getFrom(); + to = event.isCancelled() ? from : event.getTo(); + + this.teleport(to); + } + + public void teleport(Location dest) { + double d0, d1, d2; + float f, f1; + + d0 = dest.getX(); + d1 = dest.getY(); + d2 = dest.getZ(); + f = dest.getYaw(); + f1 = dest.getPitch(); + + // TODO: make sure this is the best way to address this. + if (Float.isNaN(f)) { + f = 0; + } + + if (Float.isNaN(f1)) { + f1 = 0; + } + + this.lastPosX = d0; + this.lastPosY = d1; + this.lastPosZ = d2; + this.lastYaw = f; + this.lastPitch = f1; + this.justTeleported = true; + // CraftBukkit end + + this.checkMovement = false; + this.y = d0; + this.z = d1; + this.p = d2; + this.player.setLocation(d0, d1, d2, f, f1); + this.player.playerConnection.sendPacket(new Packet13PlayerLookMove(d0, d1 + 1.6200000047683716D, d1, d2, f, f1, false)); + } + + public void a(Packet14BlockDig packet14blockdig) { + if (this.player.dead) return; // CraftBukkit + + WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); + + if (packet14blockdig.e == 4) { + // CraftBukkit start + // If the ticks aren't the same then the count starts from 0 and we update the lastDropTick. + if (this.lastDropTick != MinecraftServer.currentTick) { + this.dropCount = 0; + this.lastDropTick = MinecraftServer.currentTick; + } else { + // Else we increment the drop count and check the amount. + this.dropCount++; + if (this.dropCount >= 20) { + this.minecraftServer.getLogger().warning(this.player.getName() + " dropped their items too quickly!"); + this.disconnect("You dropped your items too quickly (Hacking?)"); + return; + } + } + // CraftBukkit end + this.player.a(false); + } else if (packet14blockdig.e == 3) { + this.player.a(true); + } else if (packet14blockdig.e == 5) { + this.player.bs(); + } else { + boolean flag = false; + + if (packet14blockdig.e == 0) { + flag = true; + } + + if (packet14blockdig.e == 1) { + flag = true; + } + + if (packet14blockdig.e == 2) { + flag = true; + } + + int i = packet14blockdig.a; + int j = packet14blockdig.b; + int k = packet14blockdig.c; + + if (flag) { + double d0 = this.player.locX - ((double) i + 0.5D); + double d1 = this.player.locY - ((double) j + 0.5D) + 1.5D; + double d2 = this.player.locZ - ((double) k + 0.5D); + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + + if (d3 > 36.0D) { + return; + } + + if (j >= this.minecraftServer.getMaxBuildHeight()) { + return; + } + } + + if (packet14blockdig.e == 0) { + // CraftBukkit start + if (!this.minecraftServer.a(worldserver, i, j, k, this.player)) { + this.player.playerInteractManager.dig(i, j, k, packet14blockdig.face); + } else { + CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, i, j, k, packet14blockdig.face, this.player.inventory.getItemInHand()); + this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver)); + // Update any tile entity data for this block + TileEntity tileentity = worldserver.getTileEntity(i, j, k); + if (tileentity != null) { + this.player.playerConnection.sendPacket(tileentity.getUpdatePacket()); + } + // CraftBukkit end + } + } else if (packet14blockdig.e == 2) { + this.player.playerInteractManager.a(i, j, k); + if (worldserver.getTypeId(i, j, k) != 0) { + this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver)); + } + } else if (packet14blockdig.e == 1) { + this.player.playerInteractManager.c(i, j, k); + if (worldserver.getTypeId(i, j, k) != 0) { + this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver)); + } + } + } + } + + public void a(Packet15Place packet15place) { + WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); + + // CraftBukkit start + if (this.player.dead) return; + + // This is a horrible hack needed because the client sends 2 packets on 'right mouse click' + // aimed at a block. We shouldn't need to get the second packet if the data is handled + // but we cannot know what the client will do, so we might still get it + // + // If the time between packets is small enough, and the 'signature' similar, we discard the + // second one. This sadly has to remain until Mojang makes their packets saner. :( + // -- Grum + + if (packet15place.getFace() == 255) { + if (packet15place.getItemStack() != null && packet15place.getItemStack().id == this.lastMaterial && this.lastPacket != null && packet15place.timestamp - this.lastPacket < 100) { + this.lastPacket = null; + return; + } + } else { + this.lastMaterial = packet15place.getItemStack() == null ? -1 : packet15place.getItemStack().id; + this.lastPacket = packet15place.timestamp; + } + + // CraftBukkit - if rightclick decremented the item, always send the update packet. + // this is not here for CraftBukkit's own functionality; rather it is to fix + // a notch bug where the item doesn't update correctly. + boolean always = false; + + // CraftBukkit end + + ItemStack itemstack = this.player.inventory.getItemInHand(); + boolean flag = false; + int i = packet15place.d(); + int j = packet15place.f(); + int k = packet15place.g(); + int l = packet15place.getFace(); + + if (packet15place.getFace() == 255) { + if (itemstack == null) { + return; + } + + // CraftBukkit start + int itemstackAmount = itemstack.count; + org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemstack); + if (event.useItemInHand() != Event.Result.DENY) { + this.player.playerInteractManager.useItem(this.player, this.player.world, itemstack); + } + + // CraftBukkit - notch decrements the counter by 1 in the above method with food, + // snowballs and so forth, but he does it in a place that doesn't cause the + // inventory update packet to get sent + always = (itemstack.count != itemstackAmount); + // CraftBukkit end + } else if (packet15place.f() >= this.minecraftServer.getMaxBuildHeight() - 1 && (packet15place.getFace() == 1 || packet15place.f() >= this.minecraftServer.getMaxBuildHeight())) { + this.player.playerConnection.sendPacket(new Packet3Chat(ChatMessage.b("build.tooHigh", new Object[] { Integer.valueOf(this.minecraftServer.getMaxBuildHeight())}).a(EnumChatFormat.RED))); + flag = true; + } else { + // CraftBukkit start - Check if we can actually do something over this large a distance + Location eyeLoc = this.getPlayer().getEyeLocation(); + if (Math.pow(eyeLoc.getX() - i, 2) + Math.pow(eyeLoc.getY() - j, 2) + Math.pow(eyeLoc.getZ() - k, 2) > PLACE_DISTANCE_SQUARED) { + return; + } + + this.player.playerInteractManager.interact(this.player, worldserver, itemstack, i, j, k, l, packet15place.j(), packet15place.k(), packet15place.l()); + // CraftBukkit end + + flag = true; + } + + if (flag) { + this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver)); + if (l == 0) { + --j; + } + + if (l == 1) { + ++j; + } + + if (l == 2) { + --k; + } + + if (l == 3) { + ++k; + } + + if (l == 4) { + --i; + } + + if (l == 5) { + ++i; + } + + this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver)); + } + + itemstack = this.player.inventory.getItemInHand(); + if (itemstack != null && itemstack.count == 0) { + this.player.inventory.items[this.player.inventory.itemInHandIndex] = null; + itemstack = null; + } + + if (itemstack == null || itemstack.n() == 0) { + this.player.h = true; + this.player.inventory.items[this.player.inventory.itemInHandIndex] = ItemStack.b(this.player.inventory.items[this.player.inventory.itemInHandIndex]); + Slot slot = this.player.activeContainer.a((IInventory) this.player.inventory, this.player.inventory.itemInHandIndex); + + this.player.activeContainer.b(); + this.player.h = false; + // CraftBukkit - TODO CHECK IF NEEDED -- new if structure might not need 'always'. Kept it in for now, but may be able to remove in future + if (!ItemStack.matches(this.player.inventory.getItemInHand(), packet15place.getItemStack()) || always) { + this.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, slot.g, this.player.inventory.getItemInHand())); + } + } + } + + public void a(String s, Object[] aobject) { + if (this.disconnected) return; // CraftBukkit - Rarely it would send a disconnect line twice + + this.minecraftServer.getLogger().info(this.player.getName() + " lost connection: " + s); + // CraftBukkit start - We need to handle custom quit messages + String quitMessage = this.minecraftServer.getPlayerList().disconnect(this.player); + if ((quitMessage != null) && (quitMessage.length() > 0)) { + this.minecraftServer.getPlayerList().sendMessage(ChatMessage.d(quitMessage)); + } + // CraftBukkit end + this.disconnected = true; + if (this.minecraftServer.K() && this.player.getName().equals(this.minecraftServer.J())) { + this.minecraftServer.getLogger().info("Stopping singleplayer server as player logged out"); + this.minecraftServer.safeShutdown(); + } + } + + public void onUnhandledPacket(Packet packet) { + if (this.disconnected) return; // CraftBukkit + this.minecraftServer.getLogger().warning(this.getClass() + " wasn\'t prepared to deal with a " + packet.getClass()); + this.disconnect("Protocol error, unexpected packet"); + } + + public void sendPacket(Packet packet) { + if (packet instanceof Packet3Chat) { + Packet3Chat packet3chat = (Packet3Chat) packet; + int i = this.player.getChatFlags(); + + if (i == 2) { + return; + } + + if (i == 1 && !packet3chat.isServer()) { + return; + } + + // CraftBukkit start + String message = packet3chat.message; + for (final String line : org.bukkit.craftbukkit.v1_6_R2.TextWrapper.wrapText(message)) { + this.networkManager.queue(new Packet3Chat(line)); + } + return; + // CraftBukkit end + } + + // CraftBukkit start + if (packet == null) { + return; + } else if (packet instanceof Packet6SpawnPosition) { + Packet6SpawnPosition packet6 = (Packet6SpawnPosition) packet; + this.player.compassTarget = new Location(this.getPlayer().getWorld(), packet6.x, packet6.y, packet6.z); + } + // CraftBukkit end + + try { + this.networkManager.queue(packet); + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.a(throwable, "Sending packet"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Packet being sent"); + + crashreportsystemdetails.a("Packet ID", (Callable) (new CrashReportConnectionPacketID(this, packet))); + crashreportsystemdetails.a("Packet class", (Callable) (new CrashReportConnectionPacketClass(this, packet))); + throw new ReportedException(crashreport); + } + } + + public void a(Packet16BlockItemSwitch packet16blockitemswitch) { + // CraftBukkit start + if (this.player.dead) return; + + if (packet16blockitemswitch.itemInHandIndex >= 0 && packet16blockitemswitch.itemInHandIndex < PlayerInventory.getHotbarSize()) { + PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex); + this.server.getPluginManager().callEvent(event); + if (event.isCancelled()) { + this.sendPacket(new Packet16BlockItemSwitch(this.player.inventory.itemInHandIndex)); + return; + } + // CraftBukkit end + + this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex; + } else { + this.minecraftServer.getLogger().warning(this.player.getName() + " tried to set an invalid carried item"); + this.disconnect("Nope!"); // CraftBukkit + } + } + + public void a(Packet3Chat packet3chat) { + if (this.player.getChatFlags() == 2) { + this.sendPacket(new Packet3Chat(ChatMessage.e("chat.cannotSend").a(EnumChatFormat.RED))); + } else { + String s = packet3chat.message; + + if (s.length() > 100) { + // CraftBukkit start + if (packet3chat.a_()) { + Waitable waitable = new Waitable() { + @Override + protected Object evaluate() { + PlayerConnection.this.disconnect("Chat message too long"); + return null; + } + }; + + this.minecraftServer.processQueue.add(waitable); + + try { + waitable.get(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } catch (ExecutionException e) { + throw new RuntimeException(e); + } + } else { + this.disconnect("Chat message too long"); + } + // CraftBukkit end + } else { + s = StringUtils.normalizeSpace(s); + + for (int i = 0; i < s.length(); ++i) { + if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { + // CraftBukkit start + if (packet3chat.a_()) { + Waitable waitable = new Waitable() { + @Override + protected Object evaluate() { + PlayerConnection.this.disconnect("Illegal characters in chat"); + return null; + } + }; + + this.minecraftServer.processQueue.add(waitable); + + try { + waitable.get(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } catch (ExecutionException e) { + throw new RuntimeException(e); + } + } else { + this.disconnect("Illegal characters in chat"); + } + // CraftBukkit end + return; + } + } + + // CraftBukkit start + if (this.player.getChatFlags() == 1 && !s.startsWith("/")) { + this.sendPacket(new Packet3Chat("Cannot send chat message.")); + return; + } + + this.chat(s, packet3chat.a_()); + + // This section stays because it is only applicable to packets + if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getName())) { // CraftBukkit use thread-safe spam + if (packet3chat.a_()) { + Waitable waitable = new Waitable() { + @Override + protected Object evaluate() { + PlayerConnection.this.disconnect("disconnect.spam"); + return null; + } + }; + + this.minecraftServer.processQueue.add(waitable); + + try { + waitable.get(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } catch (ExecutionException e) { + throw new RuntimeException(e); + } + } else { + this.disconnect("disconnect.spam"); + } + } + } + } + } + + public void chat(String s, boolean async) { + if (!this.player.dead) { + if (s.length() == 0) { + this.minecraftServer.getLogger().warning(this.player.getName() + " tried to send an empty message"); + return; + } + + if (getPlayer().isConversing()) { + getPlayer().acceptConversationInput(s); + return; + } + + if (s.startsWith("/")) { + this.handleCommand(s); + return; + } else { + Player player = this.getPlayer(); + AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet()); + this.server.getPluginManager().callEvent(event); + + if (PlayerChatEvent.getHandlerList().getRegisteredListeners().length != 0) { + // Evil plugins still listening to deprecated event + final PlayerChatEvent queueEvent = new PlayerChatEvent(player, event.getMessage(), event.getFormat(), event.getRecipients()); + queueEvent.setCancelled(event.isCancelled()); + Waitable waitable = new Waitable() { + @Override + protected Object evaluate() { + org.bukkit.Bukkit.getPluginManager().callEvent(queueEvent); + + if (queueEvent.isCancelled()) { + return null; + } + + String message = String.format(queueEvent.getFormat(), queueEvent.getPlayer().getDisplayName(), queueEvent.getMessage()); + PlayerConnection.this.minecraftServer.console.sendMessage(message); + if (((LazyPlayerSet) queueEvent.getRecipients()).isLazy()) { + for (Object player : PlayerConnection.this.minecraftServer.getPlayerList().players) { + ((EntityPlayer) player).sendMessage(ChatMessage.d(message)); + } + } else { + for (Player player : queueEvent.getRecipients()) { + player.sendMessage(message); + } + } + return null; + }}; + if (async) { + minecraftServer.processQueue.add(waitable); + } else { + waitable.run(); + } + try { + waitable.get(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); // This is proper habit for java. If we aren't handling it, pass it on! + } catch (ExecutionException e) { + throw new RuntimeException("Exception processing chat event", e.getCause()); + } + } else { + if (event.isCancelled()) { + return; + } + + s = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()); + minecraftServer.console.sendMessage(s); + if (((LazyPlayerSet) event.getRecipients()).isLazy()) { + for (Object recipient : minecraftServer.getPlayerList().players) { + ((EntityPlayer) recipient).sendMessage(ChatMessage.d(s)); + } + } else { + for (Player recipient : event.getRecipients()) { + recipient.sendMessage(s); + } + } + } + } + } + + return; + } + // CraftBukkit end + + private void handleCommand(String s) { + // CraftBukkit start + CraftPlayer player = this.getPlayer(); + + PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(player, s, new LazyPlayerSet()); + this.server.getPluginManager().callEvent(event); + + if (event.isCancelled()) { + return; + } + + try { + this.minecraftServer.getLogger().info(event.getPlayer().getName() + " issued server command: " + event.getMessage()); // CraftBukkit + if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) { + return; + } + } catch (org.bukkit.command.CommandException ex) { + player.sendMessage(org.bukkit.ChatColor.RED + "An internal error occurred while attempting to perform this command"); + java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + return; + } + // CraftBukkit end + + /* CraftBukkit start - No longer needed as we have already handled it in server.dispatchServerCommand above. + this.minecraftServer.getCommandHandler().a(this.player, s); + // CraftBukkit end */ + } + + public void a(Packet18ArmAnimation packet18armanimation) { + if (this.player.dead) return; // CraftBukkit + + if (packet18armanimation.b == 1) { + // CraftBukkit start - Raytrace to look for 'rogue armswings' + float f = 1.0F; + float f1 = this.player.lastPitch + (this.player.pitch - this.player.lastPitch) * f; + float f2 = this.player.lastYaw + (this.player.yaw - this.player.lastYaw) * f; + double d0 = this.player.lastX + (this.player.locX - this.player.lastX) * (double) f; + double d1 = this.player.lastY + (this.player.locY - this.player.lastY) * (double) f + 1.62D - (double) this.player.height; + double d2 = this.player.lastZ + (this.player.locZ - this.player.lastZ) * (double) f; + Vec3D vec3d = this.player.world.getVec3DPool().create(d0, d1, d2); + + float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F); + float f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F); + float f5 = -MathHelper.cos(-f1 * 0.017453292F); + float f6 = MathHelper.sin(-f1 * 0.017453292F); + float f7 = f4 * f5; + float f8 = f3 * f5; + double d3 = 5.0D; + Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); + MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, true); + + if (movingobjectposition == null || movingobjectposition.type != EnumMovingObjectType.TILE) { + CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.inventory.getItemInHand()); + } + + // Arm swing animation + PlayerAnimationEvent event = new PlayerAnimationEvent(this.getPlayer()); + this.server.getPluginManager().callEvent(event); + + if (event.isCancelled()) return; + // CraftBukkit end + + this.player.aU(); + } + } + + public void a(Packet19EntityAction packet19entityaction) { + // CraftBukkit start + if (this.player.dead) return; + + if (packet19entityaction.animation == 1 || packet19entityaction.animation == 2) { + PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getPlayer(), packet19entityaction.animation == 1); + this.server.getPluginManager().callEvent(event); + + if (event.isCancelled()) { + return; + } + } + + if (packet19entityaction.animation == 4 || packet19entityaction.animation == 5) { + PlayerToggleSprintEvent event = new PlayerToggleSprintEvent(this.getPlayer(), packet19entityaction.animation == 4); + this.server.getPluginManager().callEvent(event); + + if (event.isCancelled()) { + return; + } + } + // CraftBukkit end + + if (packet19entityaction.animation == 1) { + this.player.setSneaking(true); + } else if (packet19entityaction.animation == 2) { + this.player.setSneaking(false); + } else if (packet19entityaction.animation == 4) { + this.player.setSprinting(true); + } else if (packet19entityaction.animation == 5) { + this.player.setSprinting(false); + } else if (packet19entityaction.animation == 3) { + this.player.a(false, true, true); + // this.checkMovement = false; // CraftBukkit - this is handled in teleport + } else if (packet19entityaction.animation == 6) { + if (this.player.vehicle != null && this.player.vehicle instanceof EntityHorse) { + ((EntityHorse) this.player.vehicle).u(packet19entityaction.c); + } + } else if (packet19entityaction.animation == 7 && this.player.vehicle != null && this.player.vehicle instanceof EntityHorse) { + ((EntityHorse) this.player.vehicle).f(this.player); + } + } + + public void a(Packet255KickDisconnect packet255kickdisconnect) { + this.networkManager.a("disconnect.quitting", new Object[0]); + } + + public int lowPriorityCount() { + return this.networkManager.e(); + } + + public void a(Packet7UseEntity packet7useentity) { + if (this.player.dead) return; // CraftBukkit + + WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); + Entity entity = worldserver.getEntity(packet7useentity.target); + + if (entity != null) { + boolean flag = this.player.o(entity); + double d0 = 36.0D; + + if (!flag) { + d0 = 9.0D; + } + + if (this.player.e(entity) < d0) { + ItemStack itemInHand = this.player.inventory.getItemInHand(); // CraftBukkit + if (packet7useentity.action == 0) { + // CraftBukkit start + boolean triggerTagUpdate = itemInHand != null && itemInHand.id == Item.NAME_TAG.id && entity instanceof EntityInsentient; + boolean triggerChestUpdate = itemInHand != null && itemInHand.id == Block.CHEST.id && entity instanceof EntityHorse; + boolean triggerLeashUpdate = itemInHand != null && itemInHand.id == Item.LEASH.id && entity instanceof EntityInsentient; + PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) this.getPlayer(), entity.getBukkitEntity()); + this.server.getPluginManager().callEvent(event); + + if (triggerLeashUpdate && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().id != Item.LEASH.id)) { + // Refresh the current leash state + this.sendPacket(new Packet39AttachEntity(1, entity, ((EntityInsentient) entity).bI())); + } + + if (triggerTagUpdate && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().id != Item.NAME_TAG.id)) { + // Refresh the current entity metadata + this.sendPacket(new Packet40EntityMetadata(entity.id, entity.datawatcher, true)); + } + + if (triggerChestUpdate && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().id != Block.CHEST.id)) { + this.sendPacket(new Packet40EntityMetadata(entity.id, entity.datawatcher, true)); + } + + if (event.isCancelled()) { + return; + } + // CraftBukkit end + this.player.p(entity); + // CraftBukkit start - Update the client if the item is an infinite one + if (itemInHand != null && itemInHand.count <= -1) { + this.player.updateInventory(this.player.activeContainer); + } + } else if (packet7useentity.action == 1) { + // CraftBukkit - Check for player + if ((entity instanceof EntityItem) || (entity instanceof EntityExperienceOrb) || (entity instanceof EntityArrow) || (entity == this.player)) { + String type = entity.getClass().getSimpleName(); + disconnect("Attacking an " + type + " is not permitted"); + System.out.println("Player " + player.getName() + " tried to attack an " + type + ", so I have disconnected them for exploiting."); + return; + } + + this.player.attack(entity); + + if (itemInHand != null && itemInHand.count <= -1) { + this.player.updateInventory(this.player.activeContainer); + } + // CraftBukkit end + } + } + } + } + + public void a(Packet205ClientCommand packet205clientcommand) { + if (packet205clientcommand.a == 1) { + if (this.player.viewingCredits) { + this.minecraftServer.getPlayerList().changeDimension(this.player, 0, PlayerTeleportEvent.TeleportCause.END_PORTAL); // CraftBukkit - reroute logic through custom portal management + } else if (this.player.p().getWorldData().isHardcore()) { + if (this.minecraftServer.K() && this.player.getName().equals(this.minecraftServer.J())) { + this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!"); + this.minecraftServer.R(); + } else { + BanEntry banentry = new BanEntry(this.player.getName()); + + banentry.setReason("Death in Hardcore"); + this.minecraftServer.getPlayerList().getNameBans().add(banentry); + this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!"); + } + } else { + if (this.player.getHealth() > 0.0F) { + return; + } + + this.player = this.minecraftServer.getPlayerList().moveToWorld(this.player, 0, false); + } + } + } + + public boolean b() { + return true; + } + + public void a(Packet9Respawn packet9respawn) {} + + public void handleContainerClose(Packet101CloseWindow packet101closewindow) { + if (this.player.dead) return; // CraftBukkit + + if (packet101closewindow.a == player.activeContainer.windowId) + { + CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit + + this.player.k(); + } + } + + public void a(Packet102WindowClick packet102windowclick) { + if (this.player.dead) return; // CraftBukkit + + if (this.player.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.c(this.player)) { + // CraftBukkit start - Call InventoryClickEvent + if (packet102windowclick.slot < -1 && packet102windowclick.slot != -999) { + return; + } + + InventoryView inventory = this.player.activeContainer.getBukkitView(); + SlotType type = CraftInventoryView.getSlotType(inventory, packet102windowclick.slot); + + InventoryClickEvent event = null; + ClickType click = ClickType.UNKNOWN; + InventoryAction action = InventoryAction.UNKNOWN; + + ItemStack itemstack = null; + + if (packet102windowclick.slot == -1) { + type = SlotType.OUTSIDE; // override + click = packet102windowclick.button == 0 ? ClickType.WINDOW_BORDER_LEFT : ClickType.WINDOW_BORDER_RIGHT; + action = InventoryAction.NOTHING; + } else if (packet102windowclick.shift == 0) { + if (packet102windowclick.button == 0) { + click = ClickType.LEFT; + } else if (packet102windowclick.button == 1) { + click = ClickType.RIGHT; + } + if (packet102windowclick.button == 0 || packet102windowclick.button == 1) { + action = InventoryAction.NOTHING; // Don't want to repeat ourselves + if (packet102windowclick.slot == -999) { + if (player.inventory.getCarried() != null) { + action = packet102windowclick.button == 0 ? InventoryAction.DROP_ALL_CURSOR : InventoryAction.DROP_ONE_CURSOR; + } + } else { + Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot); + if (slot != null) { + ItemStack clickedItem = slot.getItem(); + ItemStack cursor = player.inventory.getCarried(); + if (clickedItem == null) { + if (cursor != null) { + action = packet102windowclick.button == 0 ? InventoryAction.PLACE_ALL : InventoryAction.PLACE_ONE; + } + } else if (slot.a(player)) { // Should be Slot.isPlayerAllowed + if (cursor == null) { + action = packet102windowclick.button == 0 ? InventoryAction.PICKUP_ALL : InventoryAction.PICKUP_HALF; + } else if (slot.isAllowed(cursor)) { // Should be Slot.isItemAllowed + if (clickedItem.doMaterialsMatch(cursor) && ItemStack.equals(clickedItem, cursor)) { + int toPlace = packet102windowclick.button == 0 ? cursor.count : 1; + toPlace = Math.min(toPlace, clickedItem.getMaxStackSize() - clickedItem.count); + toPlace = Math.min(toPlace, slot.inventory.getMaxStackSize() - clickedItem.count); + if (toPlace == 1) { + action = InventoryAction.PLACE_ONE; + } else if (toPlace == cursor.count) { + action = InventoryAction.PLACE_ALL; + } else if (toPlace < 0) { + action = toPlace != -1 ? InventoryAction.PICKUP_SOME : InventoryAction.PICKUP_ONE; // this happens with oversized stacks + } else if (toPlace != 0) { + action = InventoryAction.PLACE_SOME; + } + } else if (cursor.count <= slot.a()) { // Should be Slot.getMaxStackSize() + action = InventoryAction.SWAP_WITH_CURSOR; + } + } else if (cursor.id == clickedItem.id && (!cursor.usesData() || cursor.getData() == clickedItem.getData()) && ItemStack.equals(cursor, clickedItem)) { + if (clickedItem.count >= 0) { + if (clickedItem.count + cursor.count <= cursor.getMaxStackSize()) { + // As of 1.5, this is result slots only + action = InventoryAction.PICKUP_ALL; + } + } + } + } + } + } + } + } else if (packet102windowclick.shift == 1) { + if (packet102windowclick.button == 0) { + click = ClickType.SHIFT_LEFT; + } else if (packet102windowclick.button == 1) { + click = ClickType.SHIFT_RIGHT; + } + if (packet102windowclick.button == 0 || packet102windowclick.button == 1) { + if (packet102windowclick.slot < 0) { + action = InventoryAction.NOTHING; + } else { + Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot); + if (slot != null && slot.a(this.player) && slot.e()) { // Should be Slot.hasItem() + action = InventoryAction.MOVE_TO_OTHER_INVENTORY; + } else { + action = InventoryAction.NOTHING; + } + } + } + } else if (packet102windowclick.shift == 2) { + if (packet102windowclick.button >= 0 && packet102windowclick.button < 9) { + click = ClickType.NUMBER_KEY; + Slot clickedSlot = this.player.activeContainer.getSlot(packet102windowclick.slot); + if (clickedSlot.a(player)) { + ItemStack hotbar = this.player.inventory.getItem(packet102windowclick.button); + boolean canCleanSwap = hotbar == null || (clickedSlot.inventory == player.inventory && clickedSlot.isAllowed(hotbar)); // the slot will accept the hotbar item + if (clickedSlot.e()) { + if (canCleanSwap) { + action = InventoryAction.HOTBAR_SWAP; + } else { + int firstEmptySlot = player.inventory.j(); // Should be Inventory.firstEmpty() + if (firstEmptySlot > -1) { + action = InventoryAction.HOTBAR_MOVE_AND_READD; + } else { + action = InventoryAction.NOTHING; // This is not sane! Mojang: You should test for other slots of same type + } + } + } else if (!clickedSlot.e() && hotbar != null && clickedSlot.isAllowed(hotbar)) { + action = InventoryAction.HOTBAR_SWAP; + } else { + action = InventoryAction.NOTHING; + } + } else { + action = InventoryAction.NOTHING; + } + // Special constructor for number key + event = new InventoryClickEvent(inventory, type, packet102windowclick.slot, click, action, packet102windowclick.button); + } + } else if (packet102windowclick.shift == 3) { + if (packet102windowclick.button == 2) { + click = ClickType.MIDDLE; + if (packet102windowclick.slot == -999) { + action = InventoryAction.NOTHING; + } else { + Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot); + if (slot != null && slot.e() && player.abilities.canInstantlyBuild && player.inventory.getCarried() == null) { + action = InventoryAction.CLONE_STACK; + } else { + action = InventoryAction.NOTHING; + } + } + } else { + click = ClickType.UNKNOWN; + action = InventoryAction.UNKNOWN; + } + } else if (packet102windowclick.shift == 4) { + if (packet102windowclick.slot >= 0) { + if (packet102windowclick.button == 0) { + click = ClickType.DROP; + Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot); + if (slot != null && slot.e() && slot.a(player) && slot.getItem() != null && slot.getItem().id != 0) { + action = InventoryAction.DROP_ONE_SLOT; + } else { + action = InventoryAction.NOTHING; + } + } else if (packet102windowclick.button == 1) { + click = ClickType.CONTROL_DROP; + Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot); + if (slot != null && slot.e() && slot.a(player) && slot.getItem() != null && slot.getItem().id != 0) { + action = InventoryAction.DROP_ALL_SLOT; + } else { + action = InventoryAction.NOTHING; + } + } + } else { + // Sane default (because this happens when they are holding nothing. Don't ask why.) + click = ClickType.LEFT; + if (packet102windowclick.button == 1) { + click = ClickType.RIGHT; + } + action = InventoryAction.NOTHING; + } + } else if (packet102windowclick.shift == 5) { + itemstack = this.player.activeContainer.clickItem(packet102windowclick.slot, packet102windowclick.button, 5, this.player); + } else if (packet102windowclick.shift == 6) { + click = ClickType.DOUBLE_CLICK; + action = InventoryAction.NOTHING; + if (packet102windowclick.slot >= 0 && this.player.inventory.getCarried() != null) { + ItemStack cursor = this.player.inventory.getCarried(); + action = InventoryAction.NOTHING; + // Quick check for if we have any of the item + if (inventory.getTopInventory().contains(cursor.id) || inventory.getBottomInventory().contains(cursor.id)) { + action = InventoryAction.COLLECT_TO_CURSOR; + } + } + } + // TODO check on updates + + if (packet102windowclick.shift != 5) { + if (click == ClickType.NUMBER_KEY) { + event = new InventoryClickEvent(inventory, type, packet102windowclick.slot, click, action, packet102windowclick.button); + } else { + event = new InventoryClickEvent(inventory, type, packet102windowclick.slot, click, action); + } + + org.bukkit.inventory.Inventory top = inventory.getTopInventory(); + if (packet102windowclick.slot == 0 && top instanceof CraftingInventory) { + org.bukkit.inventory.Recipe recipe = ((CraftingInventory) top).getRecipe(); + if (recipe != null) { + if (click == ClickType.NUMBER_KEY) { + event = new CraftItemEvent(recipe, inventory, type, packet102windowclick.slot, click, action, packet102windowclick.button); + } else { + event = new CraftItemEvent(recipe, inventory, type, packet102windowclick.slot, click, action); + } + } + } + + server.getPluginManager().callEvent(event); + + switch (event.getResult()) { + case ALLOW: + case DEFAULT: + itemstack = this.player.activeContainer.clickItem(packet102windowclick.slot, packet102windowclick.button, packet102windowclick.shift, this.player); + break; + case DENY: + /* Needs enum constructor in InventoryAction + if (action.modifiesOtherSlots()) { + + } else { + if (action.modifiesCursor()) { + this.player.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.player.inventory.getCarried())); + } + if (action.modifiesClicked()) { + this.player.playerConnection.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, packet102windowclick.slot, this.player.activeContainer.getSlot(packet102windowclick.slot).getItem())); + } + }*/ + switch (action) { + // Modified other slots + case PICKUP_ALL: + case MOVE_TO_OTHER_INVENTORY: + case HOTBAR_MOVE_AND_READD: + case HOTBAR_SWAP: + case COLLECT_TO_CURSOR: + case UNKNOWN: + this.player.updateInventory(this.player.activeContainer); + break; + // Modified cursor and clicked + case PICKUP_SOME: + case PICKUP_HALF: + case PICKUP_ONE: + case PLACE_ALL: + case PLACE_SOME: + case PLACE_ONE: + case SWAP_WITH_CURSOR: + this.player.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.player.inventory.getCarried())); + this.player.playerConnection.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, packet102windowclick.slot, this.player.activeContainer.getSlot(packet102windowclick.slot).getItem())); + break; + // Modified clicked only + case DROP_ALL_SLOT: + case DROP_ONE_SLOT: + this.player.playerConnection.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, packet102windowclick.slot, this.player.activeContainer.getSlot(packet102windowclick.slot).getItem())); + break; + // Modified cursor only + case DROP_ALL_CURSOR: + case DROP_ONE_CURSOR: + case CLONE_STACK: + this.player.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.player.inventory.getCarried())); + break; + // Nothing + case NOTHING: + break; + } + return; + } + } + // CraftBukkit end + + if (ItemStack.matches(packet102windowclick.item, itemstack)) { + this.player.playerConnection.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true)); + this.player.h = true; + this.player.activeContainer.b(); + this.player.broadcastCarriedItem(); + this.player.h = false; + } else { + this.r.a(this.player.activeContainer.windowId, Short.valueOf(packet102windowclick.d)); + this.player.playerConnection.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, false)); + this.player.activeContainer.a(this.player, false); + ArrayList arraylist = new ArrayList(); + + for (int i = 0; i < this.player.activeContainer.c.size(); ++i) { + arraylist.add(((Slot) this.player.activeContainer.c.get(i)).getItem()); + } + + this.player.a(this.player.activeContainer, arraylist); + + // CraftBukkit start - Send a Set Slot to update the crafting result slot + if (type == SlotType.RESULT && itemstack != null) { + this.player.playerConnection.sendPacket((Packet) (new Packet103SetSlot(this.player.activeContainer.windowId, 0, itemstack))); + } + // CraftBukkit end + } + } + } + + public void a(Packet108ButtonClick packet108buttonclick) { + if (this.player.activeContainer.windowId == packet108buttonclick.a && this.player.activeContainer.c(this.player)) { + this.player.activeContainer.a((EntityHuman) this.player, packet108buttonclick.b); + this.player.activeContainer.b(); + } + } + + public void a(Packet107SetCreativeSlot packet107setcreativeslot) { + if (this.player.playerInteractManager.isCreative()) { + boolean flag = packet107setcreativeslot.slot < 0; + ItemStack itemstack = packet107setcreativeslot.b; + boolean flag1 = packet107setcreativeslot.slot >= 1 && packet107setcreativeslot.slot < 36 + PlayerInventory.getHotbarSize(); + // CraftBukkit + boolean flag2 = itemstack == null || itemstack.id < Item.byId.length && itemstack.id >= 0 && Item.byId[itemstack.id] != null && !invalidItems.contains(itemstack.id); + boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0; + + // CraftBukkit start - Call click event + if (flag || (flag1 && !ItemStack.matches(this.player.defaultContainer.getSlot(packet107setcreativeslot.slot).getItem(), packet107setcreativeslot.b))) { // Insist on valid slot + + org.bukkit.entity.HumanEntity player = this.player.getBukkitEntity(); + InventoryView inventory = new CraftInventoryView(player, player.getInventory(), this.player.defaultContainer); + org.bukkit.inventory.ItemStack item = CraftItemStack.asBukkitCopy(packet107setcreativeslot.b); // Should be packet107setcreativeslot.newitem + + SlotType type = SlotType.QUICKBAR; + if (flag) { + type = SlotType.OUTSIDE; + } else if (packet107setcreativeslot.slot < 36) { + if (packet107setcreativeslot.slot >= 5 && packet107setcreativeslot.slot < 9) { + type = SlotType.ARMOR; + } else { + type = SlotType.CONTAINER; + } + } + InventoryCreativeEvent event = new InventoryCreativeEvent(inventory, type, flag ? -999 : packet107setcreativeslot.slot, item); + server.getPluginManager().callEvent(event); + + itemstack = CraftItemStack.asNMSCopy(event.getCursor()); + + switch (event.getResult()) { + case ALLOW: + // Plugin cleared the id / stacksize checks + flag2 = flag3 = true; + break; + case DEFAULT: + break; + case DENY: + // Reset the slot + if (packet107setcreativeslot.slot >= 0) { + this.player.playerConnection.sendPacket(new Packet103SetSlot(this.player.defaultContainer.windowId, packet107setcreativeslot.slot, this.player.defaultContainer.getSlot(packet107setcreativeslot.slot).getItem())); + this.player.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, null)); + } + return; + } + } + // CraftBukkit end + + if (flag1 && flag2 && flag3) { + if (itemstack == null) { + this.player.defaultContainer.setItem(packet107setcreativeslot.slot, (ItemStack) null); + } else { + this.player.defaultContainer.setItem(packet107setcreativeslot.slot, itemstack); + } + + this.player.defaultContainer.a(this.player, true); + } else if (flag && flag2 && flag3 && this.x < 200) { + this.x += 20; + EntityItem entityitem = this.player.drop(itemstack); + + if (entityitem != null) { + entityitem.c(); + } + } + } + } + + public void a(Packet106Transaction packet106transaction) { + if (this.player.dead) return; // CraftBukkit + Short oshort = (Short) this.r.get(this.player.activeContainer.windowId); + + if (oshort != null && packet106transaction.b == oshort.shortValue() && this.player.activeContainer.windowId == packet106transaction.a && !this.player.activeContainer.c(this.player)) { + this.player.activeContainer.a(this.player, true); + } + } + + public void a(Packet130UpdateSign packet130updatesign) { + if (this.player.dead) return; // CraftBukkit + + WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); + + if (worldserver.isLoaded(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z)) { + TileEntity tileentity = worldserver.getTileEntity(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z); + + if (tileentity instanceof TileEntitySign) { + TileEntitySign tileentitysign = (TileEntitySign) tileentity; + + if (!tileentitysign.a() || tileentitysign.b() != this.player) { + this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign"); + this.sendPacket(new Packet130UpdateSign(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z, tileentitysign.lines)); // CraftBukkit + return; + } + } + + int i; + int j; + + for (j = 0; j < 4; ++j) { + boolean flag = true; + + if (packet130updatesign.lines[j].length() > 15) { + flag = false; + } else { + for (i = 0; i < packet130updatesign.lines[j].length(); ++i) { + if (SharedConstants.allowedCharacters.indexOf(packet130updatesign.lines[j].charAt(i)) < 0) { + flag = false; + } + } + } + + if (!flag) { + packet130updatesign.lines[j] = "!?"; + } + } + + if (tileentity instanceof TileEntitySign) { + j = packet130updatesign.x; + int k = packet130updatesign.y; + + i = packet130updatesign.z; + TileEntitySign tileentitysign1 = (TileEntitySign) tileentity; + + // CraftBukkit start + Player player = this.server.getPlayer(this.player); + SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.v1_6_R2.block.CraftBlock) player.getWorld().getBlockAt(j, k, i), this.server.getPlayer(this.player), packet130updatesign.lines); + this.server.getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + for (int l = 0; l < 4; ++l) { + tileentitysign1.lines[l] = event.getLine(l); + if(tileentitysign1.lines[l] == null) { + tileentitysign1.lines[l] = ""; + } + } + tileentitysign1.isEditable = false; + } + // CraftBukkit end + + tileentitysign1.update(); + worldserver.notify(j, k, i); + } + } + } + + public void a(Packet0KeepAlive packet0keepalive) { + if (packet0keepalive.a == this.h) { + int i = (int) (System.nanoTime() / 1000000L - this.i); + + this.player.ping = (this.player.ping * 3 + i) / 4; + } + } + + public boolean a() { + return true; + } + + public void a(Packet202Abilities packet202abilities) { + // CraftBukkit start + if (this.player.abilities.canFly && this.player.abilities.isFlying != packet202abilities.f()) { + PlayerToggleFlightEvent event = new PlayerToggleFlightEvent(this.server.getPlayer(this.player), packet202abilities.f()); + this.server.getPluginManager().callEvent(event); + if (!event.isCancelled()) { + this.player.abilities.isFlying = packet202abilities.f(); // Actually set the player's flying status + } + else { + this.player.updateAbilities(); // Tell the player their ability was reverted + } + } + // CraftBukkit end + } + + public void a(Packet203TabComplete packet203tabcomplete) { + StringBuilder stringbuilder = new StringBuilder(); + + String s; + + for (Iterator iterator = this.minecraftServer.a(this.player, packet203tabcomplete.d()).iterator(); iterator.hasNext(); stringbuilder.append(s)) { + s = (String) iterator.next(); + if (stringbuilder.length() > 0) { + stringbuilder.append('\0'); // CraftBukkit - fix decompile issue + } + } + + this.player.playerConnection.sendPacket(new Packet203TabComplete(stringbuilder.toString())); + } + + public void a(Packet204LocaleAndViewDistance packet204localeandviewdistance) { + this.player.a(packet204localeandviewdistance); + } + + public void a(Packet250CustomPayload packet250custompayload) { + DataInputStream datainputstream; + ItemStack itemstack; + ItemStack itemstack1; + + // CraftBukkit start - Ignore empty payloads + if (packet250custompayload.length <= 0) { + return; + } + // CraftBukkit end + + if ("MC|BEdit".equals(packet250custompayload.tag)) { + try { + datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data)); + itemstack = Packet.c(datainputstream); + if (!ItemBookAndQuill.a(itemstack.getTag())) { + throw new IOException("Invalid book tag!"); + } + + itemstack1 = this.player.inventory.getItemInHand(); + if (itemstack != null && itemstack.id == Item.BOOK_AND_QUILL.id && itemstack.id == itemstack1.id) { + CraftEventFactory.handleEditBookEvent(player, itemstack); // CraftBukkit + } + // CraftBukkit start + } catch (Throwable exception) { + this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|BEdit data", exception); + this.disconnect("Invalid book data!"); + // CraftBukkit end + } + } else if ("MC|BSign".equals(packet250custompayload.tag)) { + try { + datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data)); + itemstack = Packet.c(datainputstream); + if (!ItemWrittenBook.a(itemstack.getTag())) { + throw new IOException("Invalid book tag!"); + } + + itemstack1 = this.player.inventory.getItemInHand(); + if (itemstack != null && itemstack.id == Item.WRITTEN_BOOK.id && itemstack1.id == Item.BOOK_AND_QUILL.id) { + CraftEventFactory.handleEditBookEvent(player, itemstack); // CraftBukkit + } + // CraftBukkit start + } catch (Throwable exception1) { + this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|BSign data", exception1); + this.disconnect("Invalid book data!"); + // CraftBukkit end + } + } else { + int i; + + if ("MC|TrSel".equals(packet250custompayload.tag)) { + try { + datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data)); + i = datainputstream.readInt(); + Container container = this.player.activeContainer; + + if (container instanceof ContainerMerchant) { + ((ContainerMerchant) container).e(i); + } + } catch (Exception exception2) { + // CraftBukkit start + this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|TrSel data", exception2); + this.disconnect("Invalid trade data!"); + // CraftBukkit end + } + } else { + int j; + + if ("MC|AdvCdm".equals(packet250custompayload.tag)) { + if (!this.minecraftServer.getEnableCommandBlock()) { + this.player.sendMessage(ChatMessage.e("advMode.notEnabled")); + } else if (this.player.a(2, "") && this.player.abilities.canInstantlyBuild) { + try { + datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data)); + i = datainputstream.readInt(); + j = datainputstream.readInt(); + int k = datainputstream.readInt(); + String s = Packet.a((DataInput) datainputstream, 256); + TileEntity tileentity = this.player.world.getTileEntity(i, j, k); + + if (tileentity != null && tileentity instanceof TileEntityCommand) { + ((TileEntityCommand) tileentity).a(s); + this.player.world.notify(i, j, k); + this.player.sendMessage(ChatMessage.b("advMode.setCommand.success", new Object[] { s})); + } + } catch (Exception exception3) { + // CraftBukkit start + this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|AdvCdm data", exception3); + this.disconnect("Invalid CommandBlock data!"); + // CraftBukkit end + } + } else { + this.player.sendMessage(ChatMessage.e("advMode.notAllowed")); + } + } else if ("MC|Beacon".equals(packet250custompayload.tag)) { + if (this.player.activeContainer instanceof ContainerBeacon) { + try { + datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data)); + i = datainputstream.readInt(); + j = datainputstream.readInt(); + ContainerBeacon containerbeacon = (ContainerBeacon) this.player.activeContainer; + Slot slot = containerbeacon.getSlot(0); + + if (slot.e()) { + slot.a(1); + TileEntityBeacon tileentitybeacon = containerbeacon.e(); + + tileentitybeacon.d(i); + tileentitybeacon.e(j); + tileentitybeacon.update(); + } + } catch (Exception exception4) { + // CraftBukkit start + this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|Beacon data", exception4); + this.disconnect("Invalid beacon data!"); + // CraftBukkit end + } + } + } else if ("MC|ItemName".equals(packet250custompayload.tag) && this.player.activeContainer instanceof ContainerAnvil) { + ContainerAnvil containeranvil = (ContainerAnvil) this.player.activeContainer; + + if (packet250custompayload.data != null && packet250custompayload.data.length >= 1) { + String s1 = SharedConstants.a(new String(packet250custompayload.data)); + + if (s1.length() <= 30) { + containeranvil.a(s1); + } + } else { + containeranvil.a(""); + } + } + // CraftBukkit start + else if (packet250custompayload.tag.equals("REGISTER")) { + try { + String channels = new String(packet250custompayload.data, "UTF8"); + for (String channel : channels.split("\0")) { + getPlayer().addChannel(channel); + } + } catch (UnsupportedEncodingException ex) { + throw new AssertionError(ex); + } + } else if (packet250custompayload.tag.equals("UNREGISTER")) { + try { + String channels = new String(packet250custompayload.data, "UTF8"); + for (String channel : channels.split("\0")) { + getPlayer().removeChannel(channel); + } + } catch (UnsupportedEncodingException ex) { + throw new AssertionError(ex); + } + } else { + server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packet250custompayload.tag, packet250custompayload.data); + } + // CraftBukkit end + } + } + } + + public boolean c() { + return this.disconnected; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R2/entity/CraftPlayer.java b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R2/entity/CraftPlayer.java new file mode 100644 index 000000000..841ddb5f9 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R2/entity/CraftPlayer.java @@ -0,0 +1,1081 @@ +package org.bukkit.craftbukkit.v1_6_R2.entity; + +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.MapMaker; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.SocketAddress; +import java.util.Collection; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; + +import net.minecraft.server.v1_6_R2.*; + +import org.apache.commons.lang.Validate; +import org.apache.commons.lang.NotImplementedException; + +import org.bukkit.*; +import org.bukkit.Achievement; +import org.bukkit.Material; +import org.bukkit.Statistic; +import org.bukkit.World; +import org.bukkit.configuration.serialization.DelegateDeserialization; +import org.bukkit.conversations.Conversation; +import org.bukkit.conversations.ConversationAbandonedEvent; +import org.bukkit.conversations.ManuallyAbandonedConversationCanceller; +import org.bukkit.craftbukkit.v1_6_R2.conversations.ConversationTracker; +import org.bukkit.craftbukkit.v1_6_R2.CraftEffect; +import org.bukkit.craftbukkit.v1_6_R2.CraftOfflinePlayer; +import org.bukkit.craftbukkit.v1_6_R2.CraftServer; +import org.bukkit.craftbukkit.v1_6_R2.CraftSound; +import org.bukkit.craftbukkit.v1_6_R2.CraftWorld; +import org.bukkit.craftbukkit.v1_6_R2.map.CraftMapView; +import org.bukkit.craftbukkit.v1_6_R2.map.RenderData; +import org.bukkit.craftbukkit.v1_6_R2.scoreboard.CraftScoreboard; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerGameModeChangeEvent; +import org.bukkit.event.player.PlayerRegisterChannelEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.event.player.PlayerUnregisterChannelEvent; +import org.bukkit.inventory.InventoryView.Property; +import org.bukkit.map.MapView; +import org.bukkit.metadata.MetadataValue; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.messaging.Messenger; +import org.bukkit.plugin.messaging.StandardMessenger; +import org.bukkit.scoreboard.Scoreboard; + +@DelegateDeserialization(CraftOfflinePlayer.class) +public class CraftPlayer extends CraftHumanEntity implements Player { + private long firstPlayed = 0; + private long lastPlayed = 0; + private boolean hasPlayedBefore = false; + private final ConversationTracker conversationTracker = new ConversationTracker(); + private final Set channels = new HashSet(); + private final Map hiddenPlayers = new MapMaker().softValues().makeMap(); + private int hash = 0; + private double health = 20; + private boolean scaledHealth = false; + private double healthScale = 20; + + public CraftPlayer(CraftServer server, EntityPlayer entity) { + super(server, entity); + + firstPlayed = System.currentTimeMillis(); + } + + @Override + public boolean isOp() { + return server.getHandle().isOp(getName()); + } + + @Override + public void setOp(boolean value) { + if (value == isOp()) return; + + if (value) { + server.getHandle().addOp(getName()); + } else { + server.getHandle().removeOp(getName()); + } + + perm.recalculatePermissions(); + } + + public boolean isOnline() { + for (Object obj : server.getHandle().players) { + EntityPlayer player = (EntityPlayer) obj; + if (player.getName().equalsIgnoreCase(getName())) { + return true; + } + } + return false; + } + + public InetSocketAddress getAddress() { + if (getHandle().playerConnection == null) return null; + + SocketAddress addr = getHandle().playerConnection.networkManager.getSocketAddress(); + if (addr instanceof InetSocketAddress) { + return (InetSocketAddress) addr; + } else { + return null; + } + } + + @Override + public double getEyeHeight() { + return getEyeHeight(false); + } + + @Override + public double getEyeHeight(boolean ignoreSneaking) { + if (ignoreSneaking) { + return 1.62D; + } else { + if (isSneaking()) { + return 1.54D; + } else { + return 1.62D; + } + } + } + + public void sendRawMessage(String message) { + if (getHandle().playerConnection == null) return; + + getHandle().playerConnection.sendPacket(new Packet3Chat(ChatMessage.d(message))); + } + + public void sendMessage(String message) { + if (!conversationTracker.isConversingModaly()) { + this.sendRawMessage(message); + } + } + + public void sendMessage(String[] messages) { + for (String message : messages) { + sendMessage(message); + } + } + + public String getDisplayName() { + return getHandle().displayName; + } + + public void setDisplayName(final String name) { + getHandle().displayName = name; + } + + public String getPlayerListName() { + return getHandle().listName; + } + + public void setPlayerListName(String name) { + String oldName = getHandle().listName; + + if (name == null) { + name = getName(); + } + + if (oldName.equals(name)) { + return; + } + + if (name.length() > 16) { + throw new IllegalArgumentException("Player list names can only be a maximum of 16 characters long"); + } + + // Collisions will make for invisible people + for (int i = 0; i < server.getHandle().players.size(); ++i) { + if (((EntityPlayer) server.getHandle().players.get(i)).listName.equals(name)) { + throw new IllegalArgumentException(name + " is already assigned as a player list name for someone"); + } + } + + getHandle().listName = name; + + // Change the name on the client side + Packet201PlayerInfo oldpacket = new Packet201PlayerInfo(oldName, false, 9999); + Packet201PlayerInfo packet = new Packet201PlayerInfo(name, true, getHandle().ping); + for (int i = 0; i < server.getHandle().players.size(); ++i) { + EntityPlayer entityplayer = (EntityPlayer) server.getHandle().players.get(i); + if (entityplayer.playerConnection == null) continue; + + if (entityplayer.getBukkitEntity().canSee(this)) { + entityplayer.playerConnection.sendPacket(oldpacket); + entityplayer.playerConnection.sendPacket(packet); + } + } + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof OfflinePlayer)) { + return false; + } + OfflinePlayer other = (OfflinePlayer) obj; + if ((this.getName() == null) || (other.getName() == null)) { + return false; + } + + boolean nameEquals = this.getName().equalsIgnoreCase(other.getName()); + boolean idEquals = true; + + if (other instanceof CraftPlayer) { + idEquals = this.getEntityId() == ((CraftPlayer) other).getEntityId(); + } + + return nameEquals && idEquals; + } + + public void kickPlayer(String message) { + if (getHandle().playerConnection == null) return; + + getHandle().playerConnection.disconnect(message == null ? "" : message); + } + + public void setCompassTarget(Location loc) { + if (getHandle().playerConnection == null) return; + + // Do not directly assign here, from the packethandler we'll assign it. + getHandle().playerConnection.sendPacket(new Packet6SpawnPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); + } + + public Location getCompassTarget() { + return getHandle().compassTarget; + } + + public void chat(String msg) { + if (getHandle().playerConnection == null) return; + + getHandle().playerConnection.chat(msg, false); + } + + public boolean performCommand(String command) { + return server.dispatchCommand(this, command); + } + + public void playNote(Location loc, byte instrument, byte note) { + if (getHandle().playerConnection == null) return; + + int id = getHandle().world.getTypeId(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); + getHandle().playerConnection.sendPacket(new Packet54PlayNoteBlock(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), id, instrument, note)); + } + + public void playNote(Location loc, Instrument instrument, Note note) { + if (getHandle().playerConnection == null) return; + + int id = getHandle().world.getTypeId(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); + getHandle().playerConnection.sendPacket(new Packet54PlayNoteBlock(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), id, instrument.getType(), note.getId())); + } + + public void playSound(Location loc, Sound sound, float volume, float pitch) { + if (sound == null) { + return; + } + playSound(loc, CraftSound.getSound(sound), volume, pitch); + } + + public void playSound(Location loc, String sound, float volume, float pitch) { + if (loc == null || sound == null || getHandle().playerConnection == null) return; + + double x = loc.getBlockX() + 0.5; + double y = loc.getBlockY() + 0.5; + double z = loc.getBlockZ() + 0.5; + + Packet62NamedSoundEffect packet = new Packet62NamedSoundEffect(sound, x, y, z, volume, pitch); + getHandle().playerConnection.sendPacket(packet); + } + + public void playEffect(Location loc, Effect effect, int data) { + if (getHandle().playerConnection == null) return; + + int packetData = effect.getId(); + Packet61WorldEvent packet = new Packet61WorldEvent(packetData, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), data, false); + getHandle().playerConnection.sendPacket(packet); + } + + public void playEffect(Location loc, Effect effect, T data) { + if (data != null) { + Validate.isTrue(data.getClass().equals(effect.getData()), "Wrong kind of data for this effect!"); + } else { + Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!"); + } + + int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data); + playEffect(loc, effect, datavalue); + } + + public void sendBlockChange(Location loc, Material material, byte data) { + sendBlockChange(loc, material.getId(), data); + } + + public void sendBlockChange(Location loc, int material, byte data) { + if (getHandle().playerConnection == null) return; + + Packet53BlockChange packet = new Packet53BlockChange(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), ((CraftWorld) loc.getWorld()).getHandle()); + + packet.material = material; + packet.data = data; + getHandle().playerConnection.sendPacket(packet); + } + + public boolean sendChunkChange(Location loc, int sx, int sy, int sz, byte[] data) { + if (getHandle().playerConnection == null) return false; + + /* + int x = loc.getBlockX(); + int y = loc.getBlockY(); + int z = loc.getBlockZ(); + + int cx = x >> 4; + int cz = z >> 4; + + if (sx <= 0 || sy <= 0 || sz <= 0) { + return false; + } + + if ((x + sx - 1) >> 4 != cx || (z + sz - 1) >> 4 != cz || y < 0 || y + sy > 128) { + return false; + } + + if (data.length != (sx * sy * sz * 5) / 2) { + return false; + } + + Packet51MapChunk packet = new Packet51MapChunk(x, y, z, sx, sy, sz, data); + + getHandle().playerConnection.sendPacket(packet); + + return true; + */ + + throw new NotImplementedException("Chunk changes do not yet work"); // TODO: Chunk changes. + } + + public void sendMap(MapView map) { + if (getHandle().playerConnection == null) return; + + RenderData data = ((CraftMapView) map).render(this); + for (int x = 0; x < 128; ++x) { + byte[] bytes = new byte[131]; + bytes[1] = (byte) x; + for (int y = 0; y < 128; ++y) { + bytes[y + 3] = data.buffer[y * 128 + x]; + } + Packet131ItemData packet = new Packet131ItemData((short) Material.MAP.getId(), map.getId(), bytes); + getHandle().playerConnection.sendPacket(packet); + } + } + + @Override + public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) { + EntityPlayer entity = getHandle(); + + if (getHealth() == 0 || entity.dead) { + return false; + } + + if (entity.playerConnection == null || entity.playerConnection.disconnected) { + return false; + } + + if (entity.vehicle != null || entity.passenger != null) { + return false; + } + + // From = Players current Location + Location from = this.getLocation(); + // To = Players new Location if Teleport is Successful + Location to = location; + // Create & Call the Teleport Event. + PlayerTeleportEvent event = new PlayerTeleportEvent(this, from, to, cause); + server.getPluginManager().callEvent(event); + + // Return False to inform the Plugin that the Teleport was unsuccessful/cancelled. + if (event.isCancelled()) { + return false; + } + + // Update the From Location + from = event.getFrom(); + // Grab the new To Location dependent on whether the event was cancelled. + to = event.getTo(); + // Grab the To and From World Handles. + WorldServer fromWorld = ((CraftWorld) from.getWorld()).getHandle(); + WorldServer toWorld = ((CraftWorld) to.getWorld()).getHandle(); + + // Close any foreign inventory + if (getHandle().activeContainer != getHandle().defaultContainer) { + getHandle().closeInventory(); + } + + // Check if the fromWorld and toWorld are the same. + if (fromWorld == toWorld) { + entity.playerConnection.teleport(to); + } else { + server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, true); + } + return true; + } + + public void setSneaking(boolean sneak) { + getHandle().setSneaking(sneak); + } + + public boolean isSneaking() { + return getHandle().isSneaking(); + } + + public boolean isSprinting() { + return getHandle().isSprinting(); + } + + public void setSprinting(boolean sprinting) { + getHandle().setSprinting(sprinting); + } + + public void loadData() { + server.getHandle().playerFileData.load(getHandle()); + } + + public void saveData() { + server.getHandle().playerFileData.save(getHandle()); + } + + @Deprecated + public void updateInventory() { + getHandle().updateInventory(getHandle().activeContainer); + } + + public void setSleepingIgnored(boolean isSleeping) { + getHandle().fauxSleeping = isSleeping; + ((CraftWorld) getWorld()).getHandle().checkSleepStatus(); + } + + public boolean isSleepingIgnored() { + return getHandle().fauxSleeping; + } + + public void awardAchievement(Achievement achievement) { + sendStatistic(achievement.getId(), 1); + } + + public void incrementStatistic(Statistic statistic) { + incrementStatistic(statistic, 1); + } + + public void incrementStatistic(Statistic statistic, int amount) { + sendStatistic(statistic.getId(), amount); + } + + public void incrementStatistic(Statistic statistic, Material material) { + incrementStatistic(statistic, material, 1); + } + + public void incrementStatistic(Statistic statistic, Material material, int amount) { + if (!statistic.isSubstatistic()) { + throw new IllegalArgumentException("Given statistic is not a substatistic"); + } + if (statistic.isBlock() != material.isBlock()) { + throw new IllegalArgumentException("Given material is not valid for this substatistic"); + } + + int mat = material.getId(); + + if (!material.isBlock()) { + mat -= 255; + } + + sendStatistic(statistic.getId() + mat, amount); + } + + private void sendStatistic(int id, int amount) { + if (getHandle().playerConnection == null) return; + + while (amount > Byte.MAX_VALUE) { + sendStatistic(id, Byte.MAX_VALUE); + amount -= Byte.MAX_VALUE; + } + + getHandle().playerConnection.sendPacket(new Packet200Statistic(id, amount)); + } + + public void setPlayerTime(long time, boolean relative) { + getHandle().timeOffset = time; + getHandle().relativeTime = relative; + } + + public long getPlayerTimeOffset() { + return getHandle().timeOffset; + } + + public long getPlayerTime() { + return getHandle().getPlayerTime(); + } + + public boolean isPlayerTimeRelative() { + return getHandle().relativeTime; + } + + public void resetPlayerTime() { + setPlayerTime(0, true); + } + + public void setPlayerWeather(WeatherType type) { + getHandle().setPlayerWeather(type, true); + } + + public WeatherType getPlayerWeather() { + return getHandle().getPlayerWeather(); + } + + public void resetPlayerWeather() { + getHandle().resetPlayerWeather(); + } + + public boolean isBanned() { + return server.getHandle().getNameBans().isBanned(getName().toLowerCase()); + } + + public void setBanned(boolean value) { + if (value) { + BanEntry entry = new BanEntry(getName().toLowerCase()); + server.getHandle().getNameBans().add(entry); + } else { + server.getHandle().getNameBans().remove(getName().toLowerCase()); + } + + server.getHandle().getNameBans().save(); + } + + public boolean isWhitelisted() { + return server.getHandle().getWhitelisted().contains(getName().toLowerCase()); + } + + public void setWhitelisted(boolean value) { + if (value) { + server.getHandle().addWhitelist(getName().toLowerCase()); + } else { + server.getHandle().removeWhitelist(getName().toLowerCase()); + } + } + + @Override + public void setGameMode(GameMode mode) { + if (getHandle().playerConnection == null) return; + + if (mode == null) { + throw new IllegalArgumentException("Mode cannot be null"); + } + + if (mode != getGameMode()) { + PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(this, mode); + server.getPluginManager().callEvent(event); + if (event.isCancelled()) { + return; + } + + getHandle().playerInteractManager.setGameMode(EnumGamemode.a(mode.getValue())); + getHandle().playerConnection.sendPacket(new Packet70Bed(3, mode.getValue())); + } + } + + @Override + public GameMode getGameMode() { + return GameMode.getByValue(getHandle().playerInteractManager.getGameMode().a()); + } + + public void giveExp(int exp) { + getHandle().giveExp(exp); + } + + public void giveExpLevels(int levels) { + getHandle().levelDown(levels); + } + + public float getExp() { + return getHandle().exp; + } + + public void setExp(float exp) { + getHandle().exp = exp; + getHandle().lastSentExp = -1; + } + + public int getLevel() { + return getHandle().expLevel; + } + + public void setLevel(int level) { + getHandle().expLevel = level; + getHandle().lastSentExp = -1; + } + + public int getTotalExperience() { + return getHandle().expTotal; + } + + public void setTotalExperience(int exp) { + getHandle().expTotal = exp; + } + + public float getExhaustion() { + return getHandle().getFoodData().exhaustionLevel; + } + + public void setExhaustion(float value) { + getHandle().getFoodData().exhaustionLevel = value; + } + + public float getSaturation() { + return getHandle().getFoodData().saturationLevel; + } + + public void setSaturation(float value) { + getHandle().getFoodData().saturationLevel = value; + } + + public int getFoodLevel() { + return getHandle().getFoodData().foodLevel; + } + + public void setFoodLevel(int value) { + getHandle().getFoodData().foodLevel = value; + } + + public Location getBedSpawnLocation() { + World world = getServer().getWorld(getHandle().spawnWorld); + ChunkCoordinates bed = getHandle().getBed(); + + if (world != null && bed != null) { + bed = EntityHuman.getBed(((CraftWorld) world).getHandle(), bed, getHandle().isRespawnForced()); + if (bed != null) { + return new Location(world, bed.x, bed.y, bed.z); + } + } + return null; + } + + public void setBedSpawnLocation(Location location) { + setBedSpawnLocation(location, false); + } + + public void setBedSpawnLocation(Location location, boolean override) { + if (location == null) { + getHandle().setRespawnPosition(null, override); + } else { + getHandle().setRespawnPosition(new ChunkCoordinates(location.getBlockX(), location.getBlockY(), location.getBlockZ()), override); + getHandle().spawnWorld = location.getWorld().getName(); + } + } + + public void hidePlayer(Player player) { + hidePlayer(player, false, true); + } + + public void hidePlayer(Player player, boolean override, boolean hideList) { + Validate.notNull(player, "hidden player cannot be null"); + if (getHandle().playerConnection == null) return; + if (equals(player)) return; + if (!override && hiddenPlayers.containsKey(player.getName())) return; + hiddenPlayers.put(player.getName(), player); + + //remove this player from the hidden player's EntityTrackerEntry + EntityTracker tracker = ((WorldServer) entity.world).tracker; + EntityPlayer other = ((CraftPlayer) player).getHandle(); + EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntities.get(other.id); + if (entry != null) { + entry.clear(getHandle()); + } + + //remove the hidden player from this player user list + if (hideList) + getHandle().playerConnection.sendPacket(new Packet201PlayerInfo(player.getPlayerListName(), false, 9999)); + } + + public void showPlayer(Player player) { + Validate.notNull(player, "shown player cannot be null"); + if (getHandle().playerConnection == null) return; + if (equals(player)) return; + if (!hiddenPlayers.containsKey(player.getName())) return; + hiddenPlayers.remove(player.getName()); + + EntityTracker tracker = ((WorldServer) entity.world).tracker; + EntityPlayer other = ((CraftPlayer) player).getHandle(); + EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntities.get(other.id); + if (entry != null && !entry.trackedPlayers.contains(getHandle())) { + entry.updatePlayer(getHandle()); + } + + getHandle().playerConnection.sendPacket(new Packet201PlayerInfo(player.getPlayerListName(), true, getHandle().ping)); + } + + public boolean canSee(Player player) { + return !hiddenPlayers.containsKey(player.getName()); + } + + public Map serialize() { + Map result = new LinkedHashMap(); + + result.put("name", getName()); + + return result; + } + + public Player getPlayer() { + return this; + } + + @Override + public EntityPlayer getHandle() { + return (EntityPlayer) entity; + } + + public void setHandle(final EntityPlayer entity) { + super.setHandle(entity); + } + + @Override + public String toString() { + return "CraftPlayer{" + "name=" + getName() + '}'; + } + + @Override + public int hashCode() { + if (hash == 0 || hash == 485) { + hash = 97 * 5 + (this.getName() != null ? this.getName().toLowerCase().hashCode() : 0); + } + return hash; + } + + public long getFirstPlayed() { + return firstPlayed; + } + + public long getLastPlayed() { + return lastPlayed; + } + + public boolean hasPlayedBefore() { + return hasPlayedBefore; + } + + public void setFirstPlayed(long firstPlayed) { + this.firstPlayed = firstPlayed; + } + + public void readExtraData(NBTTagCompound nbttagcompound) { + hasPlayedBefore = true; + if (nbttagcompound.hasKey("bukkit")) { + NBTTagCompound data = nbttagcompound.getCompound("bukkit"); + + if (data.hasKey("firstPlayed")) { + firstPlayed = data.getLong("firstPlayed"); + lastPlayed = data.getLong("lastPlayed"); + } + + if (data.hasKey("newExp")) { + EntityPlayer handle = getHandle(); + handle.newExp = data.getInt("newExp"); + handle.newTotalExp = data.getInt("newTotalExp"); + handle.newLevel = data.getInt("newLevel"); + handle.expToDrop = data.getInt("expToDrop"); + handle.keepLevel = data.getBoolean("keepLevel"); + } + } + } + + public void setExtraData(NBTTagCompound nbttagcompound) { + if (!nbttagcompound.hasKey("bukkit")) { + nbttagcompound.setCompound("bukkit", new NBTTagCompound()); + } + + NBTTagCompound data = nbttagcompound.getCompound("bukkit"); + EntityPlayer handle = getHandle(); + data.setInt("newExp", handle.newExp); + data.setInt("newTotalExp", handle.newTotalExp); + data.setInt("newLevel", handle.newLevel); + data.setInt("expToDrop", handle.expToDrop); + data.setBoolean("keepLevel", handle.keepLevel); + data.setLong("firstPlayed", getFirstPlayed()); + data.setLong("lastPlayed", System.currentTimeMillis()); + } + + public boolean beginConversation(Conversation conversation) { + return conversationTracker.beginConversation(conversation); + } + + public void abandonConversation(Conversation conversation) { + conversationTracker.abandonConversation(conversation, new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller())); + } + + public void abandonConversation(Conversation conversation, ConversationAbandonedEvent details) { + conversationTracker.abandonConversation(conversation, details); + } + + public void acceptConversationInput(String input) { + conversationTracker.acceptConversationInput(input); + } + + public boolean isConversing() { + return conversationTracker.isConversing(); + } + + public void sendPluginMessage(Plugin source, String channel, byte[] message) { + StandardMessenger.validatePluginMessage(server.getMessenger(), source, channel, message); + if (getHandle().playerConnection == null) return; + + if (channels.contains(channel)) { + Packet250CustomPayload packet = new Packet250CustomPayload(); + packet.tag = channel; + packet.length = message.length; + packet.data = message; + getHandle().playerConnection.sendPacket(packet); + } + } + + public void setTexturePack(String url) { + Validate.notNull(url, "Texture pack URL cannot be null"); + + byte[] message = (url + "\0" + "16").getBytes(); + Validate.isTrue(message.length <= Messenger.MAX_MESSAGE_SIZE, "Texture pack URL is too long"); + + getHandle().playerConnection.sendPacket(new Packet250CustomPayload("MC|TPack", message)); + } + + public void addChannel(String channel) { + if (channels.add(channel)) { + server.getPluginManager().callEvent(new PlayerRegisterChannelEvent(this, channel)); + } + } + + public void removeChannel(String channel) { + if (channels.remove(channel)) { + server.getPluginManager().callEvent(new PlayerUnregisterChannelEvent(this, channel)); + } + } + + public Set getListeningPluginChannels() { + return ImmutableSet.copyOf(channels); + } + + public void sendSupportedChannels() { + if (getHandle().playerConnection == null) return; + Set listening = server.getMessenger().getIncomingChannels(); + + if (!listening.isEmpty()) { + Packet250CustomPayload packet = new Packet250CustomPayload(); + + packet.tag = "REGISTER"; + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + + for (String channel : listening) { + try { + stream.write(channel.getBytes("UTF8")); + stream.write((byte) 0); + } catch (IOException ex) { + Logger.getLogger(CraftPlayer.class.getName()).log(Level.SEVERE, "Could not send Plugin Channel REGISTER to " + getName(), ex); + } + } + + packet.data = stream.toByteArray(); + packet.length = packet.data.length; + + getHandle().playerConnection.sendPacket(packet); + } + } + + @Override + public EntityType getType() { + return EntityType.PLAYER; + } + + @Override + public void setMetadata(String metadataKey, MetadataValue newMetadataValue) { + server.getPlayerMetadata().setMetadata(this, metadataKey, newMetadataValue); + } + + @Override + public List getMetadata(String metadataKey) { + return server.getPlayerMetadata().getMetadata(this, metadataKey); + } + + @Override + public boolean hasMetadata(String metadataKey) { + return server.getPlayerMetadata().hasMetadata(this, metadataKey); + } + + @Override + public void removeMetadata(String metadataKey, Plugin owningPlugin) { + server.getPlayerMetadata().removeMetadata(this, metadataKey, owningPlugin); + } + + @Override + public boolean setWindowProperty(Property prop, int value) { + Container container = getHandle().activeContainer; + if (container.getBukkitView().getType() != prop.getType()) { + return false; + } + getHandle().setContainerData(container, prop.getId(), value); + return true; + } + + public void disconnect(String reason) { + conversationTracker.abandonAllConversations(); + perm.clearPermissions(); + } + + public boolean isFlying() { + return getHandle().abilities.isFlying; + } + + public void setFlying(boolean value) { + if (!getAllowFlight() && value) { + throw new IllegalArgumentException("Cannot make player fly if getAllowFlight() is false"); + } + + getHandle().abilities.isFlying = value; + getHandle().updateAbilities(); + } + + public boolean getAllowFlight() { + return getHandle().abilities.canFly; + } + + public void setAllowFlight(boolean value) { + if (isFlying() && !value) { + getHandle().abilities.isFlying = false; + } + + getHandle().abilities.canFly = value; + getHandle().updateAbilities(); + } + + @Override + public int getNoDamageTicks() { + if (getHandle().invulnerableTicks > 0) { + return Math.max(getHandle().invulnerableTicks, getHandle().noDamageTicks); + } else { + return getHandle().noDamageTicks; + } + } + + public void setFlySpeed(float value) { + validateSpeed(value); + EntityPlayer player = getHandle(); + player.abilities.flySpeed = value / 2f; + player.updateAbilities(); + + } + + public void setWalkSpeed(float value) { + validateSpeed(value); + EntityPlayer player = getHandle(); + player.abilities.walkSpeed = value / 2f; + player.updateAbilities(); + } + + public float getFlySpeed() { + return getHandle().abilities.flySpeed * 2f; + } + + public float getWalkSpeed() { + return getHandle().abilities.walkSpeed * 2f; + } + + private void validateSpeed(float value) { + if (value < 0) { + if (value < -1f) { + throw new IllegalArgumentException(value + " is too low"); + } + } else { + if (value > 1f) { + throw new IllegalArgumentException(value + " is too high"); + } + } + } + + @Override + public void setMaxHealth(double amount) { + super.setMaxHealth(amount); + this.health = Math.min(this.health, health); + getHandle().triggerHealthUpdate(); + } + + @Override + public void resetMaxHealth() { + super.resetMaxHealth(); + getHandle().triggerHealthUpdate(); + } + + public CraftScoreboard getScoreboard() { + return this.server.getScoreboardManager().getPlayerBoard(this); + } + + public void setScoreboard(Scoreboard scoreboard) { + Validate.notNull(scoreboard, "Scoreboard cannot be null"); + PlayerConnection playerConnection = getHandle().playerConnection; + if (playerConnection == null) { + throw new IllegalStateException("Cannot set scoreboard yet"); + } + if (playerConnection.disconnected) { + throw new IllegalStateException("Cannot set scoreboard for invalid CraftPlayer"); + } + + this.server.getScoreboardManager().setPlayerBoard(this, scoreboard); + } + + public void setHealthScale(double value) { + Validate.isTrue((float) value > 0F, "Must be greater than 0"); + healthScale = value; + scaledHealth = true; + updateScaledHealth(); + } + + public double getHealthScale() { + return healthScale; + } + + public void setHealthScaled(boolean scale) { + if (scaledHealth != (scaledHealth = scale)) { + updateScaledHealth(); + } + } + + public boolean isHealthScaled() { + return scaledHealth; + } + + public float getScaledHealth() { + return (float) (isHealthScaled() ? getHealth() * getHealthScale() / getMaxHealth() : getHealth()); + } + + @Override + public double getHealth() { + return health; + } + + public void setRealHealth(double health) { + this.health = health; + } + + public void updateScaledHealth() { + AttributeMapServer attributemapserver = (AttributeMapServer) getHandle().aW(); + Set set = attributemapserver.b(); + + injectScaledMaxHealth(set, true); + + getHandle().getDataWatcher().watch(6, (float) getScaledHealth()); + getHandle().playerConnection.sendPacket(new Packet8UpdateHealth(getScaledHealth(), getHandle().getFoodData().a(), getHandle().getFoodData().e())); + getHandle().playerConnection.sendPacket(new Packet44UpdateAttributes(getHandle().id, set)); + + set.clear(); + getHandle().maxHealthCache = getMaxHealth(); + } + + public void injectScaledMaxHealth(Collection collection, boolean force) { + if (!scaledHealth && !force) { + return; + } + for (Object genericInstance : collection) { + IAttribute attribute = ((AttributeInstance) genericInstance).a(); + if (attribute.a().equals("generic.maxHealth")) { + collection.remove(genericInstance); + break; + } + continue; + } + collection.add(new AttributeModifiable(getHandle().aW(), (new AttributeRanged("generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R2/inventory/CraftInventoryCustom.java b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R2/inventory/CraftInventoryCustom.java new file mode 100644 index 000000000..7bdb12046 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R2/inventory/CraftInventoryCustom.java @@ -0,0 +1,18 @@ +package org.bukkit.craftbukkit.v1_6_R2.inventory; + +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.inventory.InventoryHolder; + +public class CraftInventoryCustom extends CraftInventory { + public CraftInventoryCustom(InventoryHolder owner, InventoryType type) { + super(new MinecraftInventory(owner, type)); + } + + public CraftInventoryCustom(InventoryHolder owner, int size) { + super(new MinecraftInventory(owner, size)); + } + + public CraftInventoryCustom(InventoryHolder owner, int size, String title) { + super(new MinecraftInventory(owner, size, title)); + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R2/inventory/CraftItemStack.java b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R2/inventory/CraftItemStack.java new file mode 100644 index 000000000..7b11a5372 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R2/inventory/CraftItemStack.java @@ -0,0 +1,398 @@ +package org.bukkit.craftbukkit.v1_6_R2.inventory; + +import static org.bukkit.craftbukkit.v1_6_R2.inventory.CraftMetaItem.ENCHANTMENTS; +import static org.bukkit.craftbukkit.v1_6_R2.inventory.CraftMetaItem.ENCHANTMENTS_ID; +import static org.bukkit.craftbukkit.v1_6_R2.inventory.CraftMetaItem.ENCHANTMENTS_LVL; + +import java.util.Map; + +import net.minecraft.server.v1_6_R2.EnchantmentManager; +import net.minecraft.server.v1_6_R2.NBTTagCompound; +import net.minecraft.server.v1_6_R2.NBTTagList; + +import org.apache.commons.lang.Validate; +import org.bukkit.Material; +import org.bukkit.configuration.serialization.DelegateDeserialization; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import com.google.common.collect.ImmutableMap; + +@DelegateDeserialization(ItemStack.class) +public class CraftItemStack extends ItemStack { + + public static net.minecraft.server.v1_6_R2.ItemStack asNMSCopy(ItemStack original) { + if (original instanceof CraftItemStack) { + CraftItemStack stack = (CraftItemStack) original; + return stack.handle == null ? null : stack.handle.cloneItemStack(); + } + if (original == null || original.getTypeId() <= 0) { + return null; + } + net.minecraft.server.v1_6_R2.ItemStack stack = new net.minecraft.server.v1_6_R2.ItemStack(original.getTypeId(), original.getAmount(), original.getDurability()); + if (original.hasItemMeta()) { + setItemMeta(stack, original.getItemMeta()); + } + return stack; + } + + public static net.minecraft.server.v1_6_R2.ItemStack copyNMSStack(net.minecraft.server.v1_6_R2.ItemStack original, int amount) { + net.minecraft.server.v1_6_R2.ItemStack stack = original.cloneItemStack(); + stack.count = amount; + return stack; + } + + /** + * Copies the NMS stack to return as a strictly-Bukkit stack + */ + public static ItemStack asBukkitCopy(net.minecraft.server.v1_6_R2.ItemStack original) { + if (original == null) { + return new ItemStack(Material.AIR); + } + ItemStack stack = new ItemStack(original.id, original.count, (short) original.getData()); + if (hasItemMeta(original)) { + stack.setItemMeta(getItemMeta(original)); + } + return stack; + } + + public static CraftItemStack asCraftMirror(net.minecraft.server.v1_6_R2.ItemStack original) { + return new CraftItemStack(original); + } + + public static CraftItemStack asCraftCopy(ItemStack original) { + if (original instanceof CraftItemStack) { + CraftItemStack stack = (CraftItemStack) original; + return new CraftItemStack(stack.handle == null ? null : stack.handle.cloneItemStack()); + } + return new CraftItemStack(original); + } + + public static CraftItemStack asNewCraftStack(net.minecraft.server.v1_6_R2.Item item) { + return asNewCraftStack(item, 1); + } + + public static CraftItemStack asNewCraftStack(net.minecraft.server.v1_6_R2.Item item, int amount) { + return new CraftItemStack(item.id, amount, (short) 0, null); + } + + net.minecraft.server.v1_6_R2.ItemStack handle; + + /** + * Mirror + */ + private CraftItemStack(net.minecraft.server.v1_6_R2.ItemStack item) { + this.handle = item; + } + + protected CraftItemStack(ItemStack item) { + this(item.getTypeId(), item.getAmount(), item.getDurability(), item.hasItemMeta() ? item.getItemMeta() : null); + } + + protected CraftItemStack(int typeId, int amount, short durability, ItemMeta itemMeta) { + setTypeId(typeId); + setAmount(amount); + setDurability(durability); + setItemMeta(itemMeta); + } + + @Override + public int getTypeId() { + return handle != null ? handle.id : 0; + } + + @Override + public void setTypeId(int type) { + if (getTypeId() == type) { + return; + } else if (type == 0) { + handle = null; + } else if (handle == null) { + handle = new net.minecraft.server.v1_6_R2.ItemStack(type, 1, 0); + } else { + handle.id = type; + if (hasItemMeta()) { + // This will create the appropriate item meta, which will contain all the data we intend to keep + setItemMeta(handle, getItemMeta(handle)); + } + } + setData(null); + } + + @Override + public int getAmount() { + return handle != null ? handle.count : 0; + } + + @Override + public void setAmount(int amount) { + if (handle == null) { + return; + } + if (amount == 0) { + handle = null; + } else { + handle.count = amount; + } + } + + @Override + public void setDurability(final short durability) { + // Ignore damage if item is null + if (handle != null) { + handle.setData(durability); + } + } + + public net.minecraft.server.v1_6_R2.ItemStack getHandle() + { + return handle; + } + + @Override + public short getDurability() { + if (handle != null) { + return (short) handle.getData(); + } else { + return -1; + } + } + + @Override + public int getMaxStackSize() { + return (handle == null) ? Material.AIR.getMaxStackSize() : handle.getItem().getMaxStackSize(); + } + + @Override + public void addUnsafeEnchantment(Enchantment ench, int level) { + Validate.notNull(ench, "Cannot add null enchantment"); + + if (!makeTag(handle)) { + return; + } + NBTTagList list = getEnchantmentList(handle); + if (list == null) { + list = new NBTTagList(ENCHANTMENTS.NBT); + handle.tag.set(ENCHANTMENTS.NBT, list); + } + int size = list.size(); + + for (int i = 0; i < size; i++) { + NBTTagCompound tag = (NBTTagCompound) list.get(i); + short id = tag.getShort(ENCHANTMENTS_ID.NBT); + if (id == ench.getId()) { + tag.setShort(ENCHANTMENTS_LVL.NBT, (short) level); + return; + } + } + NBTTagCompound tag = new NBTTagCompound(); + tag.setShort(ENCHANTMENTS_ID.NBT, (short) ench.getId()); + tag.setShort(ENCHANTMENTS_LVL.NBT, (short) level); + list.add(tag); + } + + static boolean makeTag(net.minecraft.server.v1_6_R2.ItemStack item) { + if (item == null) { + return false; + } + if (item.tag != null) { + return true; + } + item.tag = new NBTTagCompound(); + return true; + } + + @Override + public boolean containsEnchantment(Enchantment ench) { + return getEnchantmentLevel(ench) > 0; + } + + @Override + public int getEnchantmentLevel(Enchantment ench) { + Validate.notNull(ench, "Cannot find null enchantment"); + if (handle == null) { + return 0; + } + return EnchantmentManager.getEnchantmentLevel(ench.getId(), handle); + } + + @Override + public int removeEnchantment(Enchantment ench) { + Validate.notNull(ench, "Cannot remove null enchantment"); + + NBTTagList list = getEnchantmentList(handle), listCopy; + if (list == null) { + return 0; + } + int index = Integer.MIN_VALUE; + int level = Integer.MIN_VALUE; + int size = list.size(); + + for (int i = 0; i < size; i++) { + NBTTagCompound enchantment = (NBTTagCompound) list.get(i); + int id = 0xffff & enchantment.getShort(ENCHANTMENTS_ID.NBT); + if (id == ench.getId()) { + index = i; + level = 0xffff & enchantment.getShort(ENCHANTMENTS_LVL.NBT); + break; + } + } + + if (index == Integer.MIN_VALUE) { + return 0; + } + if (size == 1) { + handle.tag.remove(ENCHANTMENTS.NBT); + if (handle.tag.isEmpty()) { + handle.tag = null; + } + return level; + } + + // This is workaround for not having an index removal + listCopy = new NBTTagList(ENCHANTMENTS.NBT); + for (int i = 0; i < size; i++) { + if (i != index) { + listCopy.add(list.get(i)); + } + } + handle.tag.set(ENCHANTMENTS.NBT, listCopy); + + return level; + } + + @Override + public Map getEnchantments() { + return getEnchantments(handle); + } + + static Map getEnchantments(net.minecraft.server.v1_6_R2.ItemStack item) { + ImmutableMap.Builder result = ImmutableMap.builder(); + NBTTagList list = (item == null) ? null : item.getEnchantments(); + + if (list == null) { + return result.build(); + } + + for (int i = 0; i < list.size(); i++) { + int id = 0xffff & ((NBTTagCompound) list.get(i)).getShort(ENCHANTMENTS_ID.NBT); + int level = 0xffff & ((NBTTagCompound) list.get(i)).getShort(ENCHANTMENTS_LVL.NBT); + + result.put(Enchantment.getById(id), level); + } + + return result.build(); + } + + static NBTTagList getEnchantmentList(net.minecraft.server.v1_6_R2.ItemStack item) { + return item == null ? null : item.getEnchantments(); + } + + @Override + public CraftItemStack clone() { + CraftItemStack itemStack = (CraftItemStack) super.clone(); + if (this.handle != null) { + itemStack.handle = this.handle.cloneItemStack(); + } + return itemStack; + } + + @Override + public ItemMeta getItemMeta() { + return getItemMeta(handle); + } + + public static ItemMeta getItemMeta(net.minecraft.server.v1_6_R2.ItemStack item) { + if (!hasItemMeta(item)) { + return CraftItemFactory.instance().getItemMeta(getType(item)); + } + switch (getType(item)) { + case WRITTEN_BOOK: + case BOOK_AND_QUILL: + return new CraftMetaBook(item.tag); + case SKULL_ITEM: + return new CraftMetaSkull(item.tag); + case LEATHER_HELMET: + case LEATHER_CHESTPLATE: + case LEATHER_LEGGINGS: + case LEATHER_BOOTS: + return new CraftMetaLeatherArmor(item.tag); + case POTION: + return new CraftMetaPotion(item.tag); + case MAP: + return new CraftMetaMap(item.tag); + case FIREWORK: + return new CraftMetaFirework(item.tag); + case FIREWORK_CHARGE: + return new CraftMetaCharge(item.tag); + case ENCHANTED_BOOK: + return new CraftMetaEnchantedBook(item.tag); + default: + return new CraftMetaItem(item.tag); + } + } + + static Material getType(net.minecraft.server.v1_6_R2.ItemStack item) { + Material material = Material.getMaterial(item == null ? 0 : item.id); + return material == null ? Material.AIR : material; + } + + @Override + public boolean setItemMeta(ItemMeta itemMeta) { + return setItemMeta(handle, itemMeta); + } + + public static boolean setItemMeta(net.minecraft.server.v1_6_R2.ItemStack item, ItemMeta itemMeta) { + if (item == null) { + return false; + } + if (itemMeta == null) { + item.tag = null; + return true; + } + if (!CraftItemFactory.instance().isApplicable(itemMeta, getType(item))) { + return false; + } + + NBTTagCompound tag = new NBTTagCompound(); + item.setTag(tag); + + ((CraftMetaItem) itemMeta).applyToItem(tag); + return true; + } + + @Override + public boolean isSimilar(ItemStack stack) { + if (stack == null) { + return false; + } + if (stack == this) { + return true; + } + if (!(stack instanceof CraftItemStack)) { + return stack.getClass() == ItemStack.class && stack.isSimilar(this); + } + + CraftItemStack that = (CraftItemStack) stack; + if (handle == that.handle) { + return true; + } + if (handle == null || that.handle == null) { + return false; + } + if (!(that.getTypeId() == getTypeId() && getDurability() == that.getDurability())) { + return false; + } + return hasItemMeta() ? that.hasItemMeta() && handle.tag.equals(that.handle.tag) : !that.hasItemMeta(); + } + + @Override + public boolean hasItemMeta() { + return hasItemMeta(handle); + } + + static boolean hasItemMeta(net.minecraft.server.v1_6_R2.ItemStack item) { + return !(item == null || item.tag == null || item.tag.isEmpty()); + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R2/inventory/MinecraftInventory.java b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R2/inventory/MinecraftInventory.java new file mode 100644 index 000000000..74ada2893 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R2/inventory/MinecraftInventory.java @@ -0,0 +1,141 @@ +package org.bukkit.craftbukkit.v1_6_R2.inventory; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftHumanEntity; +import org.bukkit.entity.HumanEntity; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.inventory.InventoryHolder; + +import net.minecraft.server.v1_6_R2.EntityHuman; +import net.minecraft.server.v1_6_R2.IInventory; +import net.minecraft.server.v1_6_R2.ItemStack; + +public class MinecraftInventory implements IInventory { + private final ItemStack[] items; + private int maxStack = MAX_STACK; + private final List viewers; + private String title; + private InventoryType type; + private final InventoryHolder owner; + + public MinecraftInventory(InventoryHolder owner, InventoryType type) { + this(owner, type.getDefaultSize(), type.getDefaultTitle()); + this.type = type; + } + + public MinecraftInventory(InventoryHolder owner, int size) { + this(owner, size, "Chest"); + } + + public MinecraftInventory(InventoryHolder owner, int size, String title) { + this.items = new ItemStack[size]; + this.title = title; + this.viewers = new ArrayList(); + this.owner = owner; + this.type = InventoryType.CHEST; + } + + public int getSize() { + return items.length; + } + + public ItemStack getItem(int i) { + return items[i]; + } + + public ItemStack splitStack(int i, int j) { + ItemStack stack = this.getItem(i); + ItemStack result; + if (stack == null) return null; + if (stack.count <= j) { + this.setItem(i, null); + result = stack; + } else { + result = CraftItemStack.copyNMSStack(stack, j); + stack.count -= j; + } + this.update(); + return result; + } + + public ItemStack splitWithoutUpdate(int i) { + ItemStack stack = this.getItem(i); + ItemStack result; + if (stack == null) return null; + if (stack.count <= 1) { + this.setItem(i, null); + result = stack; + } else { + result = CraftItemStack.copyNMSStack(stack, 1); + stack.count -= 1; + } + return result; + } + + public void setItem(int i, ItemStack itemstack) { + items[i] = itemstack; + if (itemstack != null && this.getMaxStackSize() > 0 && itemstack.count > this.getMaxStackSize()) { + itemstack.count = this.getMaxStackSize(); + } + } + + public void setName(String name) { + title = name; + } + + public String getName() { + return title; + } + + public int getMaxStackSize() { + return maxStack; + } + + public void setMaxStackSize(int size) { + maxStack = size; + } + + public void update() {} + + public boolean a(EntityHuman entityhuman) { + return true; + } + + public ItemStack[] getContents() { + return items; + } + + public void onOpen(CraftHumanEntity who) { + viewers.add(who); + } + + public void onClose(CraftHumanEntity who) { + viewers.remove(who); + } + + public List getViewers() { + return viewers; + } + + public InventoryType getType() { + return type; + } + + public void g() {} + + public InventoryHolder getOwner() { + return owner; + } + + public void startOpen() {} + + public boolean c() { + return false; + } + + public boolean b(int i, ItemStack itemstack) { + return true; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Core/.classpath b/Plugins/Nautilus.Core/.classpath new file mode 100644 index 000000000..82ee7e562 --- /dev/null +++ b/Plugins/Nautilus.Core/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/Plugins/Nautilus.Core/.externalToolBuilders/Nautilus.Core.launch b/Plugins/Nautilus.Core/.externalToolBuilders/Nautilus.Core.launch new file mode 100644 index 000000000..4446d5921 --- /dev/null +++ b/Plugins/Nautilus.Core/.externalToolBuilders/Nautilus.Core.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Core/.project b/Plugins/Nautilus.Core/.project new file mode 100644 index 000000000..11cd73fc0 --- /dev/null +++ b/Plugins/Nautilus.Core/.project @@ -0,0 +1,27 @@ + + + Nautilus.Core + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + auto,full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/Nautilus.Core.launch + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Nautilus.Core/.settings/org.eclipse.jdt.core.prefs b/Plugins/Nautilus.Core/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..107056a36 --- /dev/null +++ b/Plugins/Nautilus.Core/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/Plugins/Nautilus.Core/.settings/org.eclipse.m2e.core.prefs b/Plugins/Nautilus.Core/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 000000000..f897a7f1c --- /dev/null +++ b/Plugins/Nautilus.Core/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/Plugins/Nautilus.Core/Nautilus.Core.xml b/Plugins/Nautilus.Core/Nautilus.Core.xml new file mode 100644 index 000000000..65f79848c --- /dev/null +++ b/Plugins/Nautilus.Core/Nautilus.Core.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/INautilusPlugin.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/INautilusPlugin.class new file mode 100644 index 000000000..930e17dd3 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/INautilusPlugin.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/account/GameClass.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/account/GameClass.class new file mode 100644 index 000000000..4296748e9 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/account/GameClass.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/account/GameSalesPackage.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/account/GameSalesPackage.class new file mode 100644 index 000000000..73493472a Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/account/GameSalesPackage.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/event/AfkEvent.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/event/AfkEvent.class new file mode 100644 index 000000000..355a78791 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/event/AfkEvent.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/log/LogManager.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/log/LogManager.class new file mode 100644 index 000000000..821c9d053 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/log/LogManager.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/player/AfkMonitor.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/player/AfkMonitor.class new file mode 100644 index 000000000..5b8b25d14 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/player/AfkMonitor.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/player/Home.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/player/Home.class new file mode 100644 index 000000000..d32639ae8 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/player/Home.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/player/HomeManager.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/player/HomeManager.class new file mode 100644 index 000000000..f49b103eb Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/player/HomeManager.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/ColorUtil.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/ColorUtil.class new file mode 100644 index 000000000..bf6e8ceca Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/ColorUtil.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/GenericActionListener.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/GenericActionListener.class new file mode 100644 index 000000000..f010b4754 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/GenericActionListener.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/GenericRunnable.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/GenericRunnable.class new file mode 100644 index 000000000..f4d05e3e6 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/GenericRunnable.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/GenericRunnable3.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/GenericRunnable3.class new file mode 100644 index 000000000..d2811493e Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/GenericRunnable3.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/LagMeter.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/LagMeter.class new file mode 100644 index 000000000..c39963299 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/LagMeter.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/PacketUtils.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/PacketUtils.class new file mode 100644 index 000000000..9817f0167 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/PacketUtils.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/TimeStuff.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/TimeStuff.class new file mode 100644 index 000000000..d12680670 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/TimeStuff.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/TntUtil.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/TntUtil.class new file mode 100644 index 000000000..7c31ad1b3 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/TntUtil.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/ZipUtil.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/ZipUtil.class new file mode 100644 index 000000000..fe5bb3099 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/ZipUtil.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/ZombieSpeedUtil.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/ZombieSpeedUtil.class new file mode 100644 index 000000000..9369ab1e8 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/utils/ZombieSpeedUtil.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/AccountToken.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/AccountToken.class new file mode 100644 index 000000000..decc5cde2 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/AccountToken.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/ClientClanToken.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/ClientClanToken.class new file mode 100644 index 000000000..3b4fbdd54 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/ClientClanToken.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/ClientIgnoreToken.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/ClientIgnoreToken.class new file mode 100644 index 000000000..f6980355a Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/ClientIgnoreToken.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/ClientWikiToken.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/ClientWikiToken.class new file mode 100644 index 000000000..8de64776b Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/ClientWikiToken.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/FishClientToken.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/FishClientToken.class new file mode 100644 index 000000000..28c0533b8 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/FishClientToken.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/FishToken.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/FishToken.class new file mode 100644 index 000000000..1bb015616 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Account/FishToken.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Server/FieldBlockToken.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Server/FieldBlockToken.class new file mode 100644 index 000000000..e073a7efa Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Server/FieldBlockToken.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Server/FieldMonsterToken.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Server/FieldMonsterToken.class new file mode 100644 index 000000000..3f36c8922 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Server/FieldMonsterToken.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Server/FieldOreToken.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Server/FieldOreToken.class new file mode 100644 index 000000000..d46871494 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Server/FieldOreToken.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Server/WeaponToken.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Server/WeaponToken.class new file mode 100644 index 000000000..2fc9561ff Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Server/WeaponToken.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/GameClassWikiToken.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/GameClassWikiToken.class new file mode 100644 index 000000000..8f604bcc7 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/GameClassWikiToken.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/ItemWikiToken.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/ItemWikiToken.class new file mode 100644 index 000000000..f27b760a5 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/ItemWikiToken.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/ServerWikiToken.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/ServerWikiToken.class new file mode 100644 index 000000000..c5c36377a Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/ServerWikiToken.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/SkillWikiToken.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/SkillWikiToken.class new file mode 100644 index 000000000..8cd880200 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/SkillWikiToken.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/WeaponWikiToken.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/WeaponWikiToken.class new file mode 100644 index 000000000..2974443cd Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/WeaponWikiToken.class differ diff --git a/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/WikiRevisionToken.class b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/WikiRevisionToken.class new file mode 100644 index 000000000..687ca6be2 Binary files /dev/null and b/Plugins/Nautilus.Core/bin/nautilus/minecraft/core/webserver/token/Wiki/WikiRevisionToken.class differ diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/INautilusPlugin.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/INautilusPlugin.java new file mode 100644 index 000000000..2fcea2264 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/INautilusPlugin.java @@ -0,0 +1,16 @@ +package nautilus.minecraft.core; + +import org.bukkit.Server; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; + +public interface INautilusPlugin +{ + JavaPlugin GetPlugin(); + + String GetWebServerAddress(); + + Server GetRealServer(); + + PluginManager GetPluginManager(); +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/account/GameClass.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/account/GameClass.java new file mode 100644 index 000000000..f572fd371 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/account/GameClass.java @@ -0,0 +1,9 @@ +package nautilus.minecraft.core.account; + +public class GameClass +{ + public String Name; + public String Description; + public double Price; + public boolean Free; +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/account/GameSalesPackage.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/account/GameSalesPackage.java new file mode 100644 index 000000000..f644afe22 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/account/GameSalesPackage.java @@ -0,0 +1,8 @@ +package nautilus.minecraft.core.account; + +public class GameSalesPackage +{ + public int GameSalesPackageId; + public int Credits; + public int Points; +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/event/AfkEvent.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/event/AfkEvent.java new file mode 100644 index 000000000..2329a9d41 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/event/AfkEvent.java @@ -0,0 +1,30 @@ +package nautilus.minecraft.core.event; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class AfkEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private String _playerName; + + public AfkEvent(String playerName) + { + _playerName = playerName; + } + + public String GetPlayerName() + { + return _playerName; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/log/LogManager.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/log/LogManager.java new file mode 100644 index 000000000..8d4c4b1dc --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/log/LogManager.java @@ -0,0 +1,6 @@ +package nautilus.minecraft.core.log; + +public class LogManager +{ + +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/player/AfkMonitor.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/player/AfkMonitor.java new file mode 100644 index 000000000..a39140d53 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/player/AfkMonitor.java @@ -0,0 +1,123 @@ +package nautilus.minecraft.core.player; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map.Entry; + +import nautilus.minecraft.core.event.AfkEvent; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.inventory.InventoryOpenEvent; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class AfkMonitor implements Listener, Runnable +{ + private JavaPlugin _plugin; + private HashMap _playerList; + + public AfkMonitor(JavaPlugin plugin) + { + _plugin = plugin; + _playerList = new HashMap(); + + _plugin.getServer().getPluginManager().registerEvents(this, _plugin); + _plugin.getServer().getScheduler().scheduleSyncRepeatingTask(_plugin, this, 0L, 100L); + } + + public void run() + { + Iterator> afkIterator = _playerList.entrySet().iterator(); + + while (afkIterator.hasNext()) + { + Entry entry = afkIterator.next(); + + long timeDiff = System.currentTimeMillis() - entry.getValue(); + + if (timeDiff >= 165000 && timeDiff < 180000) + { + Player player = _plugin.getServer().getPlayerExact(entry.getKey()); + + if (player != null && player.isOnline()) + { + player.sendMessage(ChatColor.YELLOW + "You will be marked as AFK in a few seconds..."); + } + } + else if (timeDiff >= 180000) + { + _plugin.getServer().getPluginManager().callEvent(new AfkEvent(entry.getKey())); + Player player = _plugin.getServer().getPlayerExact(entry.getKey()); + + if (player != null && player.isOnline()) + { + player.sendMessage(ChatColor.RED + "You have been marked as AFK."); + } + + afkIterator.remove(); + } + } + } + + @EventHandler + public void OnPlayerJoin(PlayerJoinEvent event) + { + UpdatePlayer(event.getPlayer()); + } + + @EventHandler + public void OnPlayerLeave(PlayerQuitEvent event) + { + UpdatePlayer(event.getPlayer()); + } + + @EventHandler + public void OnPlayerMove(PlayerMoveEvent event) + { + UpdatePlayer(event.getPlayer()); + } + + @EventHandler + public void OnPlayerChat(AsyncPlayerChatEvent event) + { + UpdatePlayer(event.getPlayer()); + } + + @EventHandler + public void OnInventoryClick(InventoryClickEvent event) + { + UpdatePlayer((Player)event.getWhoClicked()); + } + + @EventHandler + public void OnInventoryOpen(InventoryOpenEvent event) + { + UpdatePlayer((Player)event.getPlayer()); + } + + @EventHandler + public void OnInventoryClose(InventoryCloseEvent event) + { + UpdatePlayer((Player)event.getPlayer()); + } + + @EventHandler + public void OnPlayerTeleport(PlayerTeleportEvent event) + { + UpdatePlayer(event.getPlayer()); + } + + protected void UpdatePlayer(Player player) + { + _playerList.put(player.getName(), System.currentTimeMillis()); + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/player/Home.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/player/Home.java new file mode 100644 index 000000000..d6c6d009f --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/player/Home.java @@ -0,0 +1,163 @@ +package nautilus.minecraft.core.player; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.World.Environment; + +public class Home +{ + private String _name; + private Location _location; + + public Home(String name, Location location) + { + _name = name; + _location = location; + } + + public Home(String name) + { + _name = name; + } + + public String GetName() + { + return _name; + } + + public Location GetLocation() + { + return _location; + } + + public void Save() + { + BufferedWriter fout = null; + + try + { + StringBuilder packedContents = new StringBuilder(); + + packedContents.append("home:"); + packedContents.append(_location.getX() + ":" + _location.getY() + ":" + _location.getZ()); + packedContents.append(":" + _location.getYaw() + ":" + _location.getPitch()); + packedContents.append(":" + (_location.getWorld().getEnvironment() == Environment.NORMAL ? "world" : "nether") + "\n"); + + fout = new BufferedWriter(new FileWriter("homes\\" + _name + ".txt")); + + fout.write(packedContents.toString()); + } + catch (IOException e) + { + e.printStackTrace(); + } + finally + { + if (fout != null) + { + try + { + fout.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + public void Load() + { + BufferedReader fileIn = null; + + try + { + fileIn = new BufferedReader(new FileReader("homes\\" + _name + ".txt")); + + String line = fileIn.readLine(); + + line = line.substring(line.indexOf(':') + 1); + + _location = ParseLocation(line); + + fileIn.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + finally + { + if (fileIn != null) + { + try + { + fileIn.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + public static Location ParseLocation(String line) + { + try + { + String [] parts = line.split(":"); + double x = Double.parseDouble(parts[0]); + double y = Double.parseDouble(parts[1]); + double z = Double.parseDouble(parts[2]); + float rotX = 0; + float rotY = 0; + org.bukkit.World world; + + if (parts.length > 3) + { + rotX = Float.parseFloat(parts[3]); + rotY = Float.parseFloat(parts[4]); + } + + List worlds = Bukkit.getServer().getWorlds(); + World normalWorld = worlds.get(0); + World netherWorld = worlds.get(0); + + for (World serverWorld : worlds) + { + if (serverWorld.getEnvironment() == Environment.NORMAL) + normalWorld = serverWorld; + else if (serverWorld.getEnvironment() == Environment.NETHER) + netherWorld = serverWorld; + } + + + if(parts.length == 6 && parts[5].contains("nether")) + { + world = netherWorld; + } + else + { + world = normalWorld; + } + + return new Location(world, x, y, z, rotX, rotY); + } + catch(NumberFormatException ex) + { + System.out.println("Can't parse location for line:" + line); + // Gulp, that was good. + return null; + } + } +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/player/HomeManager.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/player/HomeManager.java new file mode 100644 index 000000000..5f470c1a7 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/player/HomeManager.java @@ -0,0 +1,52 @@ +package nautilus.minecraft.core.player; + +import java.io.File; +import java.util.HashMap; + +import org.bukkit.entity.Player; + +public class HomeManager +{ + private HashMap _playerHomes; + + public HomeManager() + { + _playerHomes = new HashMap(); + LoadHomes(); + } + + public void SetHome(Player player) + { + String homeName = player.getName().toLowerCase(); + Home playerHome = new Home(homeName, player.getLocation()); + + _playerHomes.put(homeName, playerHome); + playerHome.Save(); + } + + public Home GetHome(Player player) + { + return _playerHomes.get(player.getName().toLowerCase()); + } + + public void LoadHomes() + { + File homeDir = new File("homes/"); + + if (!homeDir.exists()) + { + homeDir.mkdir(); + } + + for (File f : homeDir.listFiles()) + { + String fileName = f.getName(); + System.out.println(fileName); + Home home = new Home(fileName.substring(0, fileName.indexOf('.'))); + + home.Load(); + + _playerHomes.put(home.GetName(), home); + } + } +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/ColorUtil.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/ColorUtil.java new file mode 100644 index 000000000..8e26966f6 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/ColorUtil.java @@ -0,0 +1,18 @@ +package nautilus.minecraft.core.utils; + +import java.util.regex.Pattern; + +public class ColorUtil +{ + private static transient final Pattern REPLACE_COLOR_PATTERN = Pattern.compile("&([0-9a-f])"); + + public static String formatString(final String input) + { + if (input == null) + { + return null; + } + + return REPLACE_COLOR_PATTERN.matcher(input).replaceAll("\u00a7$1"); + } +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/GenericActionListener.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/GenericActionListener.java new file mode 100644 index 000000000..07841a4b6 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/GenericActionListener.java @@ -0,0 +1,19 @@ +package nautilus.minecraft.core.utils; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class GenericActionListener implements ActionListener +{ + protected T Object; + + public GenericActionListener(T t) + { + Object = t; + } + + public void actionPerformed(ActionEvent e) + { + // TODO Auto-generated method stub + } +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/GenericRunnable.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/GenericRunnable.java new file mode 100644 index 000000000..bf45f4731 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/GenericRunnable.java @@ -0,0 +1,16 @@ +package nautilus.minecraft.core.utils; + +public class GenericRunnable implements Runnable +{ + protected T t; + + public GenericRunnable(T t) + { + this.t = t; + } + + public void run() + { + + } +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/GenericRunnable3.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/GenericRunnable3.java new file mode 100644 index 000000000..361361ef0 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/GenericRunnable3.java @@ -0,0 +1,20 @@ +package nautilus.minecraft.core.utils; + +public class GenericRunnable3 implements Runnable +{ + protected T1 t1; + protected T2 t2; + protected T3 t3; + + public GenericRunnable3(T1 t1, T2 t2, T3 t3) + { + this.t1 = t1; + this.t2 = t2; + this.t3 = t3; + } + + public void run() + { + + } +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/LagMeter.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/LagMeter.java new file mode 100644 index 000000000..cb8057364 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/LagMeter.java @@ -0,0 +1,54 @@ +package nautilus.minecraft.core.utils; + +import org.bukkit.ChatColor; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class LagMeter implements Runnable, Listener +{ + private long _lastRun = -1; + private int _count; + private double _ticksPerSecond; + private double _ticksPerSecondAverage; + + public LagMeter(JavaPlugin plugin) + { + plugin.getServer().getPluginManager().registerEvents(this, plugin); + plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, this, 0, 20); + } + + @EventHandler + public void OnPlayerCommandPreProcess(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().trim().equalsIgnoreCase("/lag")) + { + event.getPlayer().sendMessage(ChatColor.GRAY + "Server is running at " + String.format("%.00f", _ticksPerSecondAverage * 20) + " TPS (" + String.format("%.00f", _ticksPerSecondAverage) + "% Max speed)"); + event.setCancelled(true); + } + } + + public void run() + { + if (_lastRun != -1) + { + _ticksPerSecond += (double)1000 / (System.currentTimeMillis() - _lastRun); + + if (_count % 5 == 0) + { + _ticksPerSecondAverage = _ticksPerSecond / 5; + _ticksPerSecond = 0; + } + + _count++; + } + + _lastRun = System.currentTimeMillis(); + } + + public double GetTicksPerSecond() + { + return _ticksPerSecond; + } +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/PacketUtils.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/PacketUtils.java new file mode 100644 index 000000000..da188e261 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/PacketUtils.java @@ -0,0 +1,234 @@ +package nautilus.minecraft.core.utils; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.server.v1_6_R2.DataWatcher; +import net.minecraft.server.v1_6_R2.MathHelper; +import net.minecraft.server.v1_6_R2.Packet20NamedEntitySpawn; +import net.minecraft.server.v1_6_R2.Packet24MobSpawn; +import net.minecraft.server.v1_6_R2.Packet29DestroyEntity; +import net.minecraft.server.v1_6_R2.Packet5EntityEquipment; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +public class PacketUtils +{ + public static void killCarcass(Player p1) + { + CraftPlayer p22 = (CraftPlayer) p1; + Packet29DestroyEntity p29 = new Packet29DestroyEntity(p22.getEntityId()); + + for (Player p2 : Bukkit.getServer().getOnlinePlayers()) + { + if (p2.getName().equals(p1.getName())) + continue; + + ((CraftPlayer) p2).getHandle().playerConnection.sendPacket(p29); + + System.out.println("Killing carcass of '" + p1.getName() + "'"); + } + } + + public static void undisguiseToAll(Player p1) + { + // Make packets out of loop! + CraftPlayer p22 = (CraftPlayer) p1; + Packet29DestroyEntity p29 = new Packet29DestroyEntity(p22.getEntityId()); + Packet20NamedEntitySpawn p20 = new Packet20NamedEntitySpawn(p22.getHandle()); + + if (p1.getItemInHand() != null && p1.getItemInHand().getType() != Material.FISHING_ROD) + p20.h = p1.getItemInHand().getTypeId(); + + List p5 = new ArrayList(); + net.minecraft.server.v1_6_R2.ItemStack[] armorContents = ((net.minecraft.server.v1_6_R2.Entity)p22.getHandle()).getEquipment(); + + for (short i=0; i < armorContents.length; i++) + { + net.minecraft.server.v1_6_R2.ItemStack armorSlot = armorContents[i]; + + if (armorSlot != null) + { + p5.add(new Packet5EntityEquipment(p22.getEntityId(), i, armorSlot)); + } + } + + for (Player p2 : Bukkit.getServer().getOnlinePlayers()) + { + if (!p1.getWorld().equals(p2.getWorld())) + { + continue; + } + if (p2 == p1) + { + continue; + } + + ((CraftPlayer) p2).getHandle().playerConnection.sendPacket(p29); + ((CraftPlayer) p2).getHandle().playerConnection.sendPacket(p20); + + for (Packet5EntityEquipment equipPacket : p5) + ((CraftPlayer) p2).getHandle().playerConnection.sendPacket(equipPacket); + } + } + + public static void disguiseToAll(Player p1, Byte id) + { + DataWatcher metadata = new DataWatcher(); + metadata.a(0, (byte) 0); + metadata.a(12, 0); + if (id == EntityType.SHEEP.getTypeId() || id == EntityType.PIG.getTypeId() || id == EntityType.ENDERMAN.getTypeId()) { + metadata.a(16, (byte) 0); + } else if (id == EntityType.SLIME.getTypeId()) { + metadata.a(16, (byte) 3); + } else if (id == EntityType.VILLAGER.getTypeId()) { + metadata.a(16, 0); + } + + if (id == EntityType.CREEPER.getTypeId() || id == EntityType.ENDERMAN.getTypeId()) { + metadata.a(17, (byte) 0); + } + if (id == EntityType.OCELOT.getTypeId()) { + metadata.a(18, (byte) 0); + } + + // Make packets out of loop! + Packet24MobSpawn p24 = packetMaker(p1, id, metadata); + + for (Player p2 : Bukkit.getServer().getOnlinePlayers()) + { + disguiseToPlayer(p2, p1, id, metadata, p24); + } + } + + public static void disguiseToPlayer(Player p1, Player disguised, Byte id) + { + DataWatcher metadata = new DataWatcher(); + metadata.a(0, (byte) 0); + metadata.a(12, 0); + if (id == EntityType.SHEEP.getTypeId() || id == EntityType.PIG.getTypeId() || id == EntityType.ENDERMAN.getTypeId()) { + metadata.a(16, (byte) 0); + } else if (id == EntityType.SLIME.getTypeId()) { + metadata.a(16, (byte) 3); + } else if (id == EntityType.VILLAGER.getTypeId()) { + metadata.a(16, 0); + } + + if (id == EntityType.CREEPER.getTypeId() || id == EntityType.ENDERMAN.getTypeId()) { + metadata.a(17, (byte) 0); + } + if (id == EntityType.OCELOT.getTypeId()) { + metadata.a(18, (byte) 0); + } + + // Make packets out of loop! + Packet24MobSpawn p24 = packetMaker(p1, id, metadata); + + disguiseToPlayer(p1, disguised, id, metadata, p24); + } + + public static void disguiseToPlayer(Player p1, Player disguised, Byte id, DataWatcher metadata, Packet24MobSpawn p24) + { + if (p1 == disguised) + { + return; + } + + ((CraftPlayer) p1).getHandle().playerConnection.sendPacket(p24); + } + + // Begin code for p2p disguising + public static void disguisep2pToAll(Player p, String name) + { + if (name.length() > 16) name = name.substring(0, 16); + + Packet20NamedEntitySpawn spawnPacket = packetMaker(p, name); + Packet29DestroyEntity killPacket = new Packet29DestroyEntity(p.getEntityId()); + + for (Player p1 : Bukkit.getServer().getOnlinePlayers()) + { + disguisep2pToPlayer(p1, p, killPacket, spawnPacket); + } + } + + public static void disguisep2pToPlayer(Player p1, Player disguised, String name) + { + if (name.length() > 16) name = name.substring(0, 16); + + disguisep2pToPlayer(p1, disguised, new Packet29DestroyEntity(disguised.getEntityId()), packetMaker(disguised, name)); + } + + public static void disguisep2pToPlayer(Player p1, Player disguised, Packet29DestroyEntity killPacket, Packet20NamedEntitySpawn spawnPacket) + { + if (p1.getName().equals(disguised.getName())) + return; + + ((CraftPlayer) p1).getHandle().playerConnection.sendPacket(killPacket); + ((CraftPlayer) p1).getHandle().playerConnection.sendPacket(spawnPacket); + System.out.println("Disguising '" + disguised.getName() + "' as '" + spawnPacket.b + "' for '" + p1.getName() + "'"); + } + + public static void undisguisep2pToAll(Player p) + { + Packet20NamedEntitySpawn p20 = packetMaker(p, p.getName()); + Packet29DestroyEntity p29 = new Packet29DestroyEntity(p.getEntityId()); + + for (Player p1 : Bukkit.getServer().getOnlinePlayers()) + { + if (p1.getName().equals(p.getName())) + continue; + + ((CraftPlayer) p1).getHandle().playerConnection.sendPacket(p29); + ((CraftPlayer) p1).getHandle().playerConnection.sendPacket(p20); + System.out.println("Revealing '" + p.getName() + "' for '" + p1.getName() + "'"); + } + } + + public static Packet20NamedEntitySpawn packetMaker(Player p, String name) + { + Packet20NamedEntitySpawn packet = new Packet20NamedEntitySpawn(((CraftPlayer)p).getHandle()); + packet.b = name; + return packet; + } + + public static Packet24MobSpawn packetMaker(Player p1, Byte id, DataWatcher metadata) + { + Location loc = p1.getLocation(); + int x = MathHelper.floor(loc.getX() *32D); + int y = MathHelper.floor(loc.getY() *32D); + int z = MathHelper.floor(loc.getZ() *32D); + + Packet24MobSpawn packet = new Packet24MobSpawn(); + packet.a = p1.getEntityId(); + packet.b = id; + packet.c = (int) x; + packet.d = (int) y; + packet.e = (int) z; + packet.f = (byte) ((int) loc.getYaw() * 256.0F / 360.0F); + packet.g = (byte) ((int) (loc.getPitch() * 256.0F / 360.0F)); + packet.h = packet.f; + try { + Field metadataField = packet.getClass().getDeclaredField("i"); + metadataField.setAccessible(true); + metadataField.set(packet, metadata); + } catch (Exception e) { + System.out.println("unable to set the metadata for a disguise!"); + e.printStackTrace(); + } + + // Chicken fix + if (id == EntityType.CHICKEN.getTypeId()) + { + packet.g = (byte) (packet.g * -1); + } + + return packet; + } +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/TimeStuff.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/TimeStuff.java new file mode 100644 index 000000000..081b5d134 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/TimeStuff.java @@ -0,0 +1,14 @@ +package nautilus.minecraft.core.utils; + +public class TimeStuff +{ + public static String GetTimespanString(long millis) + { + int secs = (int)(millis / 1000); + + if(secs < 60) + return secs + " seconds"; + else + return (secs / 60) + " minutes"; + } +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/TntUtil.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/TntUtil.java new file mode 100644 index 000000000..d01e4c278 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/TntUtil.java @@ -0,0 +1,75 @@ +package nautilus.minecraft.core.utils; + +import net.minecraft.server.v1_6_R2.MathHelper; + +import org.bukkit.World; +import org.bukkit.craftbukkit.v1_6_R2.CraftWorld; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity; +import org.bukkit.event.entity.EntityExplodeEvent; + +public class TntUtil +{ + public static void BypassWaterInExplosionEvent(EntityExplodeEvent event) + { + double d0; + double d1; + double d2; + + event.blockList().clear(); + + World world = event.getLocation().getWorld(); + + for (int i = 0; i < 16; ++i) + { + for (int j = 0; j < 16; ++j) + { + for (int k = 0; k < 16; ++k) + { + if (i == 0 || i == 15 || j == 0 || j == 15 || k == 0 || k == 15) + { + double d3 = (double) ((float) i / ((float) 16 - 1.0F) * 2.0F - 1.0F); + double d4 = (double) ((float) j / ((float) 16 - 1.0F) * 2.0F - 1.0F); + double d5 = (double) ((float) k / ((float) 16 - 1.0F) * 2.0F - 1.0F); + double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5); + + d3 /= d6; + d4 /= d6; + d5 /= d6; + float f1 = 4 * (0.7F + ((CraftWorld)world).getHandle().random.nextFloat() * 0.6F); + + d0 = event.getLocation().getX(); + d1 = event.getLocation().getY(); + d2 = event.getLocation().getZ(); + + for (float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F) + { + int l = MathHelper.floor(d0); + int i1 = MathHelper.floor(d1); + int j1 = MathHelper.floor(d2); + int k1 = world.getBlockTypeIdAt(l, i1, j1); + + if (k1 > 0 && k1 != 8 && k1 != 9 && k1 != 10 && k1 != 11) + { + f1 -= (net.minecraft.server.v1_6_R2.Block.byId[k1].a(((CraftEntity)event.getEntity()).getHandle()) + 0.3F) * f2; + } + + if (f1 > 0.0F && i1 < 256 && i1 >= 0 && k1 != 8 && k1 != 9 && k1 != 10 && k1 != 11) + { + org.bukkit.block.Block block = world.getBlockAt(l, i1, j1); + + if (block.getType() != org.bukkit.Material.AIR && !event.blockList().contains(block)) + { + event.blockList().add(block); + } + } + + d0 += d3 * (double) f2; + d1 += d4 * (double) f2; + d2 += d5 * (double) f2; + } + } + } + } + } + } +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/ZipUtil.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/ZipUtil.java new file mode 100644 index 000000000..dc02ef0cb --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/ZipUtil.java @@ -0,0 +1,117 @@ +package nautilus.minecraft.core.utils; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +public class ZipUtil +{ + public static void UnzipToDirectory(String zipFilePath, String outputDirectory) + { + FileInputStream fileInputStream = null; + ZipInputStream zipInputStream = null; + FileOutputStream fileOutputStream = null; + BufferedOutputStream bufferedOutputStream = null; + BufferedInputStream bufferedInputStream = null; + + try + { + fileInputStream = new FileInputStream(zipFilePath); + bufferedInputStream = new BufferedInputStream(fileInputStream); + zipInputStream = new ZipInputStream(bufferedInputStream); + ZipEntry entry; + + while ((entry = zipInputStream.getNextEntry()) != null) + { + int size; + byte[] buffer = new byte[2048]; + + fileOutputStream = new FileOutputStream(outputDirectory + File.separator + entry.getName()); + bufferedOutputStream = new BufferedOutputStream(fileOutputStream, buffer.length); + + while ((size = zipInputStream.read(buffer, 0, buffer.length)) != -1) + { + bufferedOutputStream.write(buffer, 0, size); + } + + bufferedOutputStream.flush(); + bufferedOutputStream.close(); + fileOutputStream.flush(); + fileOutputStream.close(); + } + + zipInputStream.close(); + bufferedInputStream.close(); + fileInputStream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + + if (fileInputStream != null) + { + try + { + fileInputStream.close(); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + } + + if (bufferedInputStream != null) + { + try + { + bufferedInputStream.close(); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + } + + if (zipInputStream != null) + { + try + { + zipInputStream.close(); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + } + + if (fileOutputStream != null) + { + try + { + fileOutputStream.close(); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + } + + if (bufferedOutputStream != null) + { + try + { + bufferedOutputStream.close(); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + } + } + } +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/ZombieSpeedUtil.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/ZombieSpeedUtil.java new file mode 100644 index 000000000..641e632a7 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/utils/ZombieSpeedUtil.java @@ -0,0 +1,49 @@ +package nautilus.minecraft.core.utils; + +import java.lang.reflect.Field; + +import net.minecraft.server.v1_6_R2.*; + +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftZombie; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.CreatureSpawnEvent; + +public class ZombieSpeedUtil +{ + @EventHandler + public void onCreatureSpawn(CreatureSpawnEvent event) + { + if (event.getEntity() instanceof CraftZombie) + { + EntityZombie zombie = ((CraftZombie)event.getEntity()).getHandle(); + + try + { + Field metadataField = EntityInsentient.class.getDeclaredField("goalSelector"); + metadataField.setAccessible(true); + + // Original speed is .23F + float modifier = 1.5F; + float modifiedSpeed = 0.23F * modifier; + + PathfinderGoalSelector goalSelector = new PathfinderGoalSelector(zombie.world != null && zombie.world.methodProfiler != null ? zombie.world.methodProfiler : null); + goalSelector.a(0, new PathfinderGoalFloat(zombie)); + goalSelector.a(1, new PathfinderGoalBreakDoor(zombie)); + goalSelector.a(2, new PathfinderGoalMeleeAttack(zombie, EntityHuman.class, modifiedSpeed, false)); + goalSelector.a(3, new PathfinderGoalMeleeAttack(zombie, EntityVillager.class, modifiedSpeed, true)); + goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(zombie, 0.23F)); + goalSelector.a(5, new PathfinderGoalMoveThroughVillage(zombie, 0.23F, false)); + goalSelector.a(6, new PathfinderGoalRandomStroll(zombie, 0.23F)); + goalSelector.a(7, new PathfinderGoalLookAtPlayer(zombie, EntityHuman.class, 8.0F)); + goalSelector.a(7, new PathfinderGoalRandomLookaround(zombie)); + + metadataField.set(zombie, goalSelector); + } + catch (Exception e) + { + System.out.println("Unable to modify goal selector"); + e.printStackTrace(); + } + } + } +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/AccountToken.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/AccountToken.java new file mode 100644 index 000000000..8e3df43cf --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/AccountToken.java @@ -0,0 +1,14 @@ +package nautilus.minecraft.core.webserver.token.Account; + +import java.util.Collection; + +public class AccountToken +{ + public long TotalPlayingTime; + public long LastLogin; + public int LoginCount; + public Collection IpAddresses; + public Collection MacAddresses; + public Collection IpAliases; + public Collection MacAliases; +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/ClientClanToken.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/ClientClanToken.java new file mode 100644 index 000000000..d0266ba36 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/ClientClanToken.java @@ -0,0 +1,7 @@ +package nautilus.minecraft.core.webserver.token.Account; + +public class ClientClanToken +{ + public String Name; + public String Role; +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/ClientIgnoreToken.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/ClientIgnoreToken.java new file mode 100644 index 000000000..32ea14507 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/ClientIgnoreToken.java @@ -0,0 +1,8 @@ +package nautilus.minecraft.core.webserver.token.Account; + +import java.util.Collection; + +public class ClientIgnoreToken +{ + public Collection Ignored; +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/ClientWikiToken.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/ClientWikiToken.java new file mode 100644 index 000000000..a2bc7aae6 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/ClientWikiToken.java @@ -0,0 +1,12 @@ +package nautilus.minecraft.core.webserver.token.Account; + +public class ClientWikiToken +{ + public String Name; + public int ArticlesActive = 0; + public int ArticlesDeprecated = 0; + public int ArticlesDenied = 0; + + public int VotesUp = 0; + public int VotesDown = 0; +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/FishClientToken.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/FishClientToken.java new file mode 100644 index 000000000..7a884ca89 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/FishClientToken.java @@ -0,0 +1,8 @@ +package nautilus.minecraft.core.webserver.token.Account; + +import java.util.List; + +public class FishClientToken +{ + public List FishTokens; +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/FishToken.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/FishToken.java new file mode 100644 index 000000000..a9eb13f92 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Account/FishToken.java @@ -0,0 +1,8 @@ +package nautilus.minecraft.core.webserver.token.Account; + +public class FishToken +{ + public String Name; + public double Size; + public String Catcher; +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Server/FieldBlockToken.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Server/FieldBlockToken.java new file mode 100644 index 000000000..6a652f831 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Server/FieldBlockToken.java @@ -0,0 +1,22 @@ +package nautilus.minecraft.core.webserver.token.Server; + +public class FieldBlockToken +{ + public String Server; + + public String Location; + + public int BlockId; + + public byte BlockData; + + public int EmptyId; + + public byte EmptyData; + + public int StockMax; + + public double StockRegenTime; + + public String Loot; +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Server/FieldMonsterToken.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Server/FieldMonsterToken.java new file mode 100644 index 000000000..206f67579 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Server/FieldMonsterToken.java @@ -0,0 +1,20 @@ +package nautilus.minecraft.core.webserver.token.Server; + +public class FieldMonsterToken +{ + public String Name; + + public String Server; + + public String Type; + + public int MobMax; + + public double MobRate; + + public String Centre; + + public int Radius; + + public int Height; +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Server/FieldOreToken.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Server/FieldOreToken.java new file mode 100644 index 000000000..6b5f08fda --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Server/FieldOreToken.java @@ -0,0 +1,8 @@ +package nautilus.minecraft.core.webserver.token.Server; + +public class FieldOreToken +{ + public String Server; + + public String Location; +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Server/WeaponToken.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Server/WeaponToken.java new file mode 100644 index 000000000..cfb253c3f --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Server/WeaponToken.java @@ -0,0 +1,12 @@ +package nautilus.minecraft.core.webserver.token.Server; + +import mineplex.core.donation.repository.GameSalesPackageToken; + +public class WeaponToken +{ + public int WeaponId; + + public String Name; + + public GameSalesPackageToken SalesPackage; +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/GameClassWikiToken.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/GameClassWikiToken.java new file mode 100644 index 000000000..730e61ea2 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/GameClassWikiToken.java @@ -0,0 +1,8 @@ +package nautilus.minecraft.core.webserver.token.Wiki; + +import java.util.List; + +public class GameClassWikiToken +{ + public List Revisions; +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/ItemWikiToken.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/ItemWikiToken.java new file mode 100644 index 000000000..18ce88294 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/ItemWikiToken.java @@ -0,0 +1,11 @@ +package nautilus.minecraft.core.webserver.token.Wiki; + +import java.util.List; + +public class ItemWikiToken +{ + public short TypeId; + public short Data; + + public List Revisions; +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/ServerWikiToken.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/ServerWikiToken.java new file mode 100644 index 000000000..741a5fb73 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/ServerWikiToken.java @@ -0,0 +1,11 @@ +package nautilus.minecraft.core.webserver.token.Wiki; + +import java.util.List; + +public class ServerWikiToken +{ + public List GameClassWikis; + public List ItemWikis; + public List SkillWikis; + public List WeaponWikis; +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/SkillWikiToken.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/SkillWikiToken.java new file mode 100644 index 000000000..360a974b1 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/SkillWikiToken.java @@ -0,0 +1,8 @@ +package nautilus.minecraft.core.webserver.token.Wiki; + +import java.util.List; + +public class SkillWikiToken +{ + public List Revisions; +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/WeaponWikiToken.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/WeaponWikiToken.java new file mode 100644 index 000000000..66b1fb407 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/WeaponWikiToken.java @@ -0,0 +1,8 @@ +package nautilus.minecraft.core.webserver.token.Wiki; + +import java.util.List; + +public class WeaponWikiToken +{ + public List Revisions; +} diff --git a/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/WikiRevisionToken.java b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/WikiRevisionToken.java new file mode 100644 index 000000000..2f607a7d1 --- /dev/null +++ b/Plugins/Nautilus.Core/src/nautilus/minecraft/core/webserver/token/Wiki/WikiRevisionToken.java @@ -0,0 +1,10 @@ +package nautilus.minecraft.core.webserver.token.Wiki; + +public class WikiRevisionToken +{ + public String Title; + public String Body; + public int Revision; + public String Author; + public long SystemTime; +} diff --git a/Plugins/Nautilus.Game.Arcade/.classpath b/Plugins/Nautilus.Game.Arcade/.classpath new file mode 100644 index 000000000..89fdee623 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/.classpath @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.Arcade/.externalToolBuilders/Arcade Builder.launch b/Plugins/Nautilus.Game.Arcade/.externalToolBuilders/Arcade Builder.launch new file mode 100644 index 000000000..0d48570d7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/.externalToolBuilders/Arcade Builder.launch @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.Arcade/.project b/Plugins/Nautilus.Game.Arcade/.project new file mode 100644 index 000000000..3f89e9760 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/.project @@ -0,0 +1,26 @@ + + + Nautilus.Game.Arcade + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + + + LaunchConfigHandle + <project>/.externalToolBuilders/Arcade Builder.launch + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.core.prefs b/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7341ab168 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/Arcade.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/Arcade.class new file mode 100644 index 000000000..fbf97e31e Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/Arcade.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/Arcade.java.orig b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/Arcade.java.orig new file mode 100644 index 000000000..b2769299c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/Arcade.java.orig @@ -0,0 +1,452 @@ +package nautilus.game.arcade; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.InputStreamReader; + +import me.chiss.Core.Config.Config; +import mineplex.core.account.CoreClientManager; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.command.CommandCenter; +import mineplex.core.common.util.FileUtil; +import mineplex.core.common.util.UtilServer; +import mineplex.core.creature.Creature; +import mineplex.core.donation.DonationManager; +import mineplex.core.energy.Energy; +import mineplex.core.explosion.Explosion; +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Loot.LootFactory; +import me.chiss.Core.Module.ModuleManager; +import me.chiss.Core.Modules.*; +import me.chiss.Core.Plugin.IPlugin; +import me.chiss.Core.Scheduler.Scheduler; +import mineplex.core.message.MessageManager; +import mineplex.core.npc.NpcManager; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.pet.PetManager; +import mineplex.core.projectile.ProjectileManager; +import mineplex.core.punish.Punish; +import mineplex.core.recharge.Recharge; +import mineplex.core.spawn.Spawn; +import mineplex.core.teleport.Teleport; +import mineplex.core.updater.Updater; +import mineplex.minecraft.game.core.combat.CombatManager; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.damage.DamageManager; +import mineplex.minecraft.game.core.fire.Fire; + +import nautilus.game.arcade.game.GameServerConfig; +import nautilus.minecraft.core.INautilusPlugin; + +import org.bukkit.Location; +import org.bukkit.Server; +import org.bukkit.entity.Player; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; + +public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin +{ + private String WEB_CONFIG = "webServer"; + + //Modules + private ModuleManager _moduleManager; + private Config _config; + private CoreClientManager _clientManager; + private DonationManager _donationManager; + private DamageManager _damageManager; + private Utility _utility; + private BlockRegenerate _blockRegenerate; + private BlockRestore _blockRestore; + private Blood _blood; + private ConditionManager _condition; + private Creature _creature; + private Fire _fire; + private Logger _logger; + private LootFactory _lootFactory; + private Observer _observer; + private PetManager _petManager; + private me.chiss.Core.Server.Server _serverModule; + private Spawn _spawn; + private Teleport _teleport; + private ProjectileManager _throw; + + private ArcadeManager _gameManager; + + @Override + public void onEnable() + { + //Delete Old Games Folders + DeleteFolders(); + + //Configs + getConfig().addDefault(WEB_CONFIG, "http://api.mineplex.com/"); + getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); + saveConfig(); + + //Init Modules + GetModules(); + + _clientManager = CoreClientManager.Initialize(this, GetWebServerAddress()); + _donationManager = new DonationManager(this, GetWebServerAddress()); + CommandCenter.Initialize(this, _clientManager); + ItemStackFactory.Initialize(this, false); + Recharge.Initialize(this); + + ConditionManager conditionManager = new ConditionManager(this); + + Explosion explosion = new Explosion(this, new BlockRestore(this)); + explosion.SetDebris(false); + + new MessageManager(this, _clientManager); + + + GetBlood(); + GetCreature(); + GetSpawn(); + GetTeleport(); + + _damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, GetCreature())); + + //Arcade Manager + _gameManager = new ArcadeManager(this, ReadServerConfig(), _clientManager, _donationManager, conditionManager, _damageManager, GetCreature(), new PacketHandler(this)); + + //Unreferenced Modules + //new AntiStack(); + Scheduler.Initialize(this); + //new Information(this); + new Punish(this, GetWebServerAddress()); + //Updates + getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); + } + + + @Override + public void onDisable() + { + GetModules().onDisable(); + + for (Player player : UtilServer.getPlayers()) + player.kickPlayer("Server Shutdown"); + + if (_gameManager.GetGame() != null) + if (_gameManager.GetGame().WorldData != null) + _gameManager.GetGame().WorldData.Uninitialize(); + } + + public GameServerConfig ReadServerConfig() + { + GameServerConfig config = new GameServerConfig(); + + //Load Track Data + String line = null; + + try + { + File file = new File("ArcadeSettings.config"); + if (!file.exists()) + WriteServerConfig(GetDefaultConfig()); + + FileInputStream fstream = new FileInputStream("ArcadeSettings.config"); + DataInputStream in = new DataInputStream(fstream); + BufferedReader br = new BufferedReader(new InputStreamReader(in)); + + while ((line = br.readLine()) != null) + { + String[] tokens = line.split("="); + + if (tokens.length < 2) + continue; + + if (tokens[0].equals("SERVER_TYPE")) + { + config.ServerType = tokens[1]; + } + else if (tokens[0].equals("PLAYERS_MIN")) + { + config.MinPlayers = Integer.parseInt(tokens[1]); + } + else if (tokens[0].equals("PLAYERS_MAX")) + { + config.MaxPlayers = Integer.parseInt(tokens[1]); + } + //Games + else + { + try + { + GameType type = GameType.valueOf(tokens[0]); + boolean enabled = Boolean.valueOf(tokens[1]); + + if (enabled) + config.GameList.add(type); + } + catch (Exception e) + { + + } + } + + } + + in.close(); + } + catch (Exception e) + { + + } + + if (!config.IsValid()) + config = GetDefaultConfig(); + + WriteServerConfig(config); + return config; + } + + public GameServerConfig GetDefaultConfig() + { + GameServerConfig config = new GameServerConfig(); + + config.ServerType = "Minigames"; + config.MinPlayers = 8; + config.MaxPlayers = 16; + + return config; + } + + public void WriteServerConfig(GameServerConfig config) + { + try + { + FileWriter fstream = new FileWriter("ArcadeSettings.config"); + BufferedWriter out = new BufferedWriter(fstream); + + out.write("SERVER_TYPE=" + config.ServerType + "\n"); + out.write("PLAYERS_MIN=" + config.MinPlayers + "\n"); + out.write("PLAYERS_MAX=" + config.MaxPlayers + "\n"); + out.write("\n\nGames List;\n"); + + for (GameType type : GameType.values()) + { + out.write(type.toString() + "=" + config.GameList.contains(type) + "\n"); + } + + out.close(); + } + catch (Exception e) + { + + } + } + + private void DeleteFolders() + { + File curDir = new File("."); + + File[] filesList = curDir.listFiles(); + for(File file : filesList) + { + if (!file.isDirectory()) + continue; + + if (file.getName().length() < 4) + continue; + + if (!file.getName().substring(0, 4).equalsIgnoreCase("Game")) + continue; + + FileUtil.DeleteFolder(file); + + System.out.println("Deleted Old Game: " + file.getName()); + } + } + + @Override + public JavaPlugin GetPlugin() + { + return this; + } + + @Override + public String GetWebServerAddress() + { + String webServerAddress = getConfig().getString(WEB_CONFIG); + + return webServerAddress; + } + + @Override + public Server GetRealServer() + { + return getServer(); + } + + @Override + public PluginManager GetPluginManager() + { + return GetRealServer().getPluginManager(); + } + + @Override + public void Log(String moduleName, String data) + { + System.out.println(moduleName + " : " + data); + } + + @Override + public ModuleManager GetModules() + { + if (_moduleManager == null) + _moduleManager = new ModuleManager(); + + return _moduleManager; + } + + @Override + public Config GetConfig() + { + if (_config == null) + _config = new Config(this); + + return _config; + } + + @Override + public Utility GetUtility() + { + if (_utility == null) + _utility = new Utility(this); + + return _utility; + } + + @Override + public BlockRegenerate GetBlockRegenerate() + { + if (_blockRegenerate == null) + _blockRegenerate = new BlockRegenerate(this); + + return _blockRegenerate; + } + + @Override + public BlockRestore GetBlockRestore() + { + if (_blockRestore == null) + _blockRestore = new BlockRestore(this); + + return _blockRestore; + } + + @Override + public Blood GetBlood() + { + if (_blood == null) + _blood = new Blood(this); + + return _blood; + } + + @Override + public Creature GetCreature() + { + if (_creature == null) + _creature = new Creature(this); + + return _creature; + } + + + @Override + public Fire GetFire() + { + if (_fire == null) + _fire = new Fire(this, _condition, _damageManager); + + return _fire; + } + + @Override + public Logger GetLogger() + { + if (_logger == null) + _logger = new Logger(this); + + return _logger; + } + + @Override + public LootFactory GetLoot() + { + if (_lootFactory == null) + _lootFactory = new LootFactory(this); + + return _lootFactory; + } + + @Override + public Observer GetObserver() + { + if (_observer == null) + _observer = new Observer(this); + + return _observer; + } + + @Override + public me.chiss.Core.Server.Server GetServer() + { + if (_serverModule == null) + _serverModule = new me.chiss.Core.Server.Server(this, _clientManager); + + return _serverModule; + } + + @Override + public Spawn GetSpawn() + { + if (_spawn == null) + _spawn = new Spawn(this); + + return _spawn; + } + + @Override + public Teleport GetTeleport() + { + if (_teleport == null) + _teleport = new Teleport(this, _clientManager, GetSpawn()); + + return _teleport; + } + + @Override + public ProjectileManager GetThrow() + { + if (_throw == null) + _throw = new ProjectileManager(this); + + return _throw; + } + + @Override + public Location GetSpawnLocation() + { + return null; + } + + @Override + public PetManager GetPetManager() + { + return _petManager; + } + + @Override + public Energy GetEnergy() + { + return null; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/ArcadeFormat.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/ArcadeFormat.class new file mode 100644 index 000000000..400344ebb Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/ArcadeFormat.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/ArcadeManager.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/ArcadeManager.class new file mode 100644 index 000000000..354a69443 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/ArcadeManager.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/ArcadeManager.java.orig b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/ArcadeManager.java.orig new file mode 100644 index 000000000..cee354b26 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/ArcadeManager.java.orig @@ -0,0 +1,436 @@ +package nautilus.game.arcade; + +import java.io.File; +import java.util.ArrayList; + +import nautilus.game.arcade.addons.*; +import nautilus.game.arcade.command.*; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameServerConfig; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.managers.*; +import nautilus.game.arcade.shop.ArcadeShop; +import nautilus.game.arcade.world.FireworkHandler; + +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.minecraft.game.core.IRelation; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.DamageManager; +import mineplex.minecraft.game.core.fire.Fire; +import me.chiss.Core.Chat.Chat; +import mineplex.core.MiniPlugin; +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Plugin.IChat; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.*; +import mineplex.core.creature.Creature; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.portal.Portal; + +public class ArcadeManager extends MiniPlugin implements IRelation, IChat +{ + //Modules + private Chat _chat; + private CoreClientManager _clientManager; + private DisguiseManager _disguiseManager; + private DonationManager _donationManager; + private ConditionManager _conditionManager; + private Creature _creature; + private DamageManager _damageManager; + private Fire _fire; + private FireworkHandler _firework; + + private Portal _portal; + private ArcadeShop _arcadeShop; + + //Managers + private GameFactory _gameFactory; + private GameChatManager _gameChatManager; + private GameCreationManager _gameCreationManager; + private GameGemManager _gameGemManager; + private GameManager _gameManager; + private GameLobbyManager _gameLobbyManager; + private GameWorldManager _gameWorldManager; + + //Server Games + private GameServerConfig _serverConfig; + + //Games + private Game _game; + + public ArcadeManager(JavaPlugin plugin, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DamageManager damageManager, Creature creature, PacketHandler packetHandler) + { + super("Game Manager", plugin); + + _serverConfig = serverConfig; + + //Modules + _conditionManager = conditionManager; + + _clientManager = clientManager; + + _chat = new Chat(plugin, _clientManager, this); + + _creature = creature; + + _damageManager = damageManager; + _damageManager.UseDefaultWeaponDamage = true; + + _disguiseManager = new DisguiseManager(plugin, packetHandler); + + _donationManager = donationManager; + + _firework = new FireworkHandler(); + + _fire = new Fire(plugin, conditionManager, damageManager); + + _portal = new Portal(plugin); + + //Shop + _arcadeShop = new ArcadeShop(this, clientManager, donationManager); + + //Game Factory + _gameFactory = new GameFactory(this); + + //Managers + System.out.println("WOOF"); + _gameChatManager = new GameChatManager(this); + _gameCreationManager = new GameCreationManager(this); + _gameGemManager = new GameGemManager(this); + _gameManager = new GameManager(this); + _gameLobbyManager = new GameLobbyManager(this, packetHandler); + new GameFlagManager(this); + new GamePlayerManager(this); + _gameWorldManager = new GameWorldManager(this); + new MiscManager(this); + + //Game Addons + new CompassAddon(plugin, this); + new SoupAddon(plugin, this); + } + + @Override + public void AddCommands() + { + AddCommand(new GameCommand(this)); + AddCommand(new ParseCommand(this)); + AddCommand(new GemCommand(this)); + AddCommand(new WriteCommand(this)); + } + + public GameServerConfig GetServerConfig() + { + return _serverConfig; + } + + public ArrayList GetGameList() + { + return GetServerConfig().GameList; + } + + public Chat GetChat() + { + return _chat; + } + + public CoreClientManager GetClients() + { + return _clientManager; + } + + public ConditionManager GetCondition() + { + return _conditionManager; + } + + public Creature GetCreature() + { + return _creature; + } + + public DisguiseManager GetDisguise() + { + return _disguiseManager; + } + + public DamageManager GetDamage() + { + return _damageManager; + } + + public DonationManager GetDonation() + { + return _donationManager; + } + + public Fire GetFire() + { + return _fire; + } + + public FireworkHandler GetFirework() + { + return _firework; + } + + public GameLobbyManager GetLobby() + { + return _gameLobbyManager; + } + + public ArcadeShop GetShop() + { + return _arcadeShop; + } + + public GameCreationManager GetGameCreationManager() + { + return _gameCreationManager; + } + + public GameFactory GetGameFactory() + { + return _gameFactory; + } + + public GameManager GetGameManager() + { + return _gameManager; + } + + public GameGemManager GetGameGemManager() + { + return _gameGemManager; + } + + public GameWorldManager GetGameWorldManager() + { + return _gameWorldManager; + } + + public ChatColor GetColor(Player player) + { + if (_game == null) + return ChatColor.GRAY; + + GameTeam team = _game.GetTeam(player); + if (team == null) + return ChatColor.GRAY; + + return team.GetColor(); + } + + @Override + public void HandleChat(AsyncPlayerChatEvent event, String filteredMessage) + { + _gameChatManager.HandleChat(event, filteredMessage); + } + + @Override + public boolean CanHurt(String a, String b) + { + return CanHurt(UtilPlayer.searchExact(a), UtilPlayer.searchExact(b)); + } + + public boolean CanHurt(Player pA, Player pB) + { + if (pA == null || pB == null) + return false; + + if (!_game.Damage) + return false; + + if (!_game.DamagePvP) + return false; + + //Self Damage + if (pA.equals(pB)) + return _game.DamageSelf; + + GameTeam tA = _game.GetTeam(pA); + if (tA == null) + return false; + + GameTeam tB = _game.GetTeam(pB); + if (tB == null) + return false; + + if (tA.equals(tB) && !_game.DamageTeamSelf) + return false; + + if (!tA.equals(tB) && !_game.DamageTeamOther) + return false; + + return true; + } + + @Override + public boolean IsSafe(Player player) + { + if (_game == null) + return true; + + if (_game.IsPlaying(player)) + return false; + + return true; + } + + @EventHandler + public void MessageMOTD(ServerListPingEvent event) + { + if (_game == null || _game.GetState() == GameState.Recruit) + { + if (_game != null && _game.GetCountdown() != -1) + { + event.setMotd(ChatColor.GREEN + "Starting in " + _game.GetCountdown() + " Seconds"); + } + else + { + event.setMotd(ChatColor.GREEN + "Recruiting"); + } + + } + else + { + event.setMotd(ChatColor.YELLOW + "In Progress"); + } + } + + @EventHandler + public void MessageJoin(PlayerJoinEvent event) + { + event.setJoinMessage(F.sys("Join", event.getPlayer().getName())); + } + + @EventHandler + public void MessageQuit(PlayerQuitEvent event) + { + event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + event.getPlayer().getName())); + } + + + + public Game GetGame() + { + return _game; + } + + public void SetGame(Game game) + { + _game = game; + } + + public int GetPlayerMin() + { + return GetServerConfig().MinPlayers; + } + + public int GetPlayerFull() + { + return GetServerConfig().MaxPlayers; + } + + + + public void HubClock(Player player) + { + player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte)0, 1, (short)0, C.cGreen + "Return to Hub", + new String[] {"", ChatColor.RESET + "Click while holding this", ChatColor.RESET + "to return to the Hub."})); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void HubClockInteract(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (player.getItemInHand() == null) + return; + + if (player.getItemInHand().getType() != Material.WATCH) + return; + + if (_game != null && _game.IsAlive(player)) + return; + + _portal.SendPlayerToServer(player, "Lobby"); + } + + public boolean IsAlive(Player player) + { + if (_game == null) + return false; + + return _game.IsAlive(player); + } + + public void Clear(Player player) + { + player.setGameMode(GameMode.SURVIVAL); + UtilInv.Clear(player); + player.setFoodLevel(20); + player.setHealth(20); + player.setFireTicks(0); + player.setFallDistance(0); + player.setLevel(0); + player.setExp(0f); + ((CraftPlayer)player).getHandle().spectating = false; + ((CraftPlayer)player).getHandle().m = true; + + GetCondition().EndCondition(player, ConditionType.CLOAK, "Spectator"); + + HubClock(player); + + GetDisguise().Undisguise(player); + } + + public ArrayList LoadFiles(String gameName) + { + File folder = new File("maps" + File.separatorChar + gameName); + if (!folder.exists()) folder.mkdirs(); + + ArrayList maps = new ArrayList(); + + System.out.println("Searching Maps in: " + folder); + + for (File file : folder.listFiles()) + { + if (!file.isFile()) + continue; + + String name = file.getName(); + + if (name.length() < 5) + continue; + + name = name.substring(name.length()-4, name.length()); + + if (file.getName().equals(".zip")) + continue; + + maps.add(file.getName().substring(0, file.getName().length()-4)); + } + + for (String map : maps) + System.out.println("Found Map: " + map); + + return maps; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/GameFactory.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/GameFactory.class new file mode 100644 index 000000000..1ee0894dd Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/GameFactory.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/GameManager.java.orig b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/GameManager.java.orig new file mode 100644 index 000000000..d76c2067a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/GameManager.java.orig @@ -0,0 +1,1562 @@ +package nautilus.game.arcade; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; + +import nautilus.game.arcade.addons.CompassAddon; +import nautilus.game.arcade.addons.SoupAddon; +import nautilus.game.arcade.command.GameCommand; +import nautilus.game.arcade.command.GemCommand; +import nautilus.game.arcade.command.ParseCommand; +import nautilus.game.arcade.command.WriteCommand; +import nautilus.game.arcade.game.AsymTeamGame; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameServerConfig; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.lobby.LobbyManager; +import nautilus.game.arcade.shop.ArcadeShop; +import nautilus.game.arcade.shop.KitPackage; +import nautilus.game.arcade.world.FireworkHandler; +import nautilus.game.arcade.world.WorldData; +import net.minecraft.server.v1_6_R2.Packet40EntityMetadata; + +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.event.world.ChunkUnloadEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.FoodLevelChangeEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.PrepareItemCraftEvent; +import org.bukkit.inventory.CraftingInventory; + +import mineplex.minecraft.game.core.IRelation; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.minecraft.game.core.damage.DamageManager; +import mineplex.minecraft.game.core.fire.Fire; +import mineplex.core.shop.page.ConfirmationPage; +import me.chiss.Core.Chat.Chat; +import mineplex.core.MiniPlugin; +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Plugin.IChat; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.CurrencyType; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.creature.Creature; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.donation.Donor; +import mineplex.core.playerTagNamer.PacketHandler; +import mineplex.core.portal.Portal; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class GameManager extends MiniPlugin implements IRelation, IChat +{ + //Modules + private Chat _chat; + private CoreClientManager _clientManager; + private DisguiseManager _disguiseManager; + private DonationManager _donationManager; + private ConditionManager _conditionManager; + private Creature _creature; + private DamageManager _damageManager; + private Fire _fire; + private FireworkHandler _firework; + private LobbyManager _lobbyManager; + private Portal _portal; + private ArcadeShop _arcadeShop; + + private GameFactory _gameFactory; + + //Server Games + private GameServerConfig _serverConfig; + + //Games + private Game _game; + private ArrayList _ended = new ArrayList(); + private String _lastMap = ""; + private GameType _lastGame = GameType.SnowFight; + + private GameType _nextGame = null; + private HashMap _nextGameTeams = null; + + //Player Vars + private int _playerMin = 20; + private int _playerFull = 40; + + //Chunk Loader + private HashSet _worldLoader = new HashSet(); + + public GameManager(JavaPlugin plugin, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DamageManager damageManager, Creature creature, PacketHandler packetHandler) + { + super("Game Manager", plugin); + + _serverConfig = serverConfig; + + _playerMin = _serverConfig.MinPlayers; + _playerFull = _serverConfig.MaxPlayers; + + _damageManager = damageManager; + _damageManager.UseDefaultWeaponDamage = true; + + _disguiseManager = new DisguiseManager(plugin, packetHandler); + _donationManager = donationManager; + _conditionManager = conditionManager; + _clientManager = clientManager; + _creature = creature; + _firework = new FireworkHandler(); + _fire = new Fire(plugin, conditionManager, damageManager); + _chat = new Chat(plugin, _clientManager, this); + _lobbyManager = new LobbyManager(this, packetHandler); + _portal = new Portal(plugin); + _arcadeShop = new ArcadeShop(this, clientManager, donationManager); + + _gameFactory = new GameFactory(this); + + new CompassAddon(plugin, this); + new SoupAddon(plugin, this); + } + + @Override + public void AddCommands() + { + AddCommand(new GameCommand(this)); + AddCommand(new ParseCommand(this)); + AddCommand(new GemCommand(this)); + AddCommand(new WriteCommand(this)); + } + + public GameServerConfig GetServerConfig() + { + return _serverConfig; + } + + public ArrayList GetGameList() + { + return GetServerConfig().GameList; + } + + public Chat GetChat() + { + return _chat; + } + + public CoreClientManager GetClients() + { + return _clientManager; + } + + public ConditionManager GetCondition() + { + return _conditionManager; + } + + public DisguiseManager GetDisguise() + { + return _disguiseManager; + } + + public DamageManager GetDamage() + { + return _damageManager; + } + + public DonationManager GetDonation() + { + return _donationManager; + } + + public Fire GetFire() + { + return _fire; + } + + public FireworkHandler GetFirework() + { + return _firework; + } + + public Creature GetCreature() + { + return _creature; + } + + public LobbyManager GetLobby() + { + return _lobbyManager; + } + + public ChatColor GetColor(Player player) + { + if (_game == null) + return ChatColor.GRAY; + + GameTeam team = _game.GetTeam(player); + if (team == null) + return ChatColor.GRAY; + + return team.GetColor(); + } + + @EventHandler + public void CancelMe(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().startsWith("/me")) + { + event.getPlayer().sendMessage(F.main("Mirror", "You can't see /me messages, are you a vampire?")); + event.setCancelled(true); + } + } + + @Override + public void HandleChat(AsyncPlayerChatEvent event, String filteredMessage) + { + Player sender = event.getPlayer(); + + //Dead Prefix + String dead = ""; + if (_game != null) + if (_game.GetTeam(sender) != null) + if (!_game.IsAlive(sender)) + dead = C.cGray + "Dead "; + + Rank rank = _clientManager.Get(sender).GetRank(); + boolean ownsUltra = false; + + if (_game != null) + ownsUltra= _donationManager.Get(sender.getName()).OwnsUnknownPackage(GetServerConfig().ServerType + " ULTRA"); + + //Rank Prefix + String rankStr = ""; + if (rank != Rank.ALL) + rankStr = rank.Color + C.Bold + rank.Name.toUpperCase() + " "; + + if (ownsUltra && !rank.Has(Rank.ULTRA)) + rankStr = Rank.ULTRA.Color + C.Bold + Rank.ULTRA.Name.toUpperCase() + " "; + + //Base Format + event.setFormat(dead + rankStr + GetColor(sender) + "%1$s " + ChatColor.WHITE + "%2$s"); + + //Public/Private (Not If Player Dead) + if (_game != null && _game.GetState() == GameState.Live) + { + boolean globalMessage = false; + + //Team + GameTeam team = _game.GetTeam(sender); + + if (team != null) + { + //Team Chat + if (event.getMessage().charAt(0) == '@') + { + event.setMessage(event.getMessage().substring(1, event.getMessage().length())); + event.setFormat(C.cWhite + C.Bold + "Team" + " " + dead + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s"); + } + //All Chat + else + { + globalMessage = true; + event.setFormat(dead + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s"); + } + } + + if (globalMessage) + return; + + //Team Message Remove Recipient + Iterator recipientIterator = event.getRecipients().iterator(); + + while (recipientIterator.hasNext()) + { + Player receiver = recipientIterator.next(); + + if (_clientManager.Get(receiver).GetRank().Has(Rank.MODERATOR)) + continue; + + if (_game.GetTeam(receiver) != null && _game.GetTeam(sender) != _game.GetTeam(receiver)) + recipientIterator.remove(); + } + } + } + + @Override + public boolean CanHurt(String a, String b) + { + return CanHurt(UtilPlayer.searchExact(a), UtilPlayer.searchExact(b)); + } + + public boolean CanHurt(Player pA, Player pB) + { + if (pA == null || pB == null) + return false; + + if (!_game.Damage) + return false; + + if (!_game.DamagePvP) + return false; + + //Self Damage + if (pA.equals(pB)) + return _game.DamageSelf; + + GameTeam tA = _game.GetTeam(pA); + if (tA == null) + return false; + + GameTeam tB = _game.GetTeam(pB); + if (tB == null) + return false; + + if (tA.equals(tB) && !_game.DamageTeamSelf) + return false; + + if (!tA.equals(tB) && !_game.DamageTeamOther) + return false; + + return true; + } + + @Override + public boolean IsSafe(Player player) + { + if (_game == null) + return true; + + if (_game.IsPlaying(player)) + return false; + + return true; + } + + @EventHandler(priority = EventPriority.HIGH) + public void DeathEvent(CombatDeathEvent event) + { + if (event.GetLog().GetKiller() != null) + { + Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + + if (player != null) + event.GetLog().SetKillerColor(GetColor(player)+""); + } + + + if (event.GetEvent().getEntity() instanceof Player) + { + //Don't actually die + event.GetEvent().getEntity().setHealth(20); + + //Color + Player player = (Player)event.GetEvent().getEntity(); + + if (player != null) + event.GetLog().SetKilledColor(GetColor(player)+""); + } + } + + @EventHandler + public void PlayerJoin(PlayerJoinEvent event) + { + final Player player = event.getPlayer(); + + Clear(player); + + //Lobby Name + GetLobby().AddPlayerToScoreboards(player, null); + + //Lobby Spawn + if (_game == null || !_game.InProgress()) + { + player.teleport(GetLobby().GetSpawn()); + return; + } + + //Game Spawn + if (_game.IsAlive(player)) + { + player.teleport(_game.GetTeam(player).GetSpawn()); + } + else + { + _game.SetSpectator(player); + UtilPlayer.message(player, F.main("Game", _game.GetName() + " is in progress, please wait for next game!")); + } + + player.setScoreboard(_game.GetScoreboard()); + } + + @EventHandler + public void PlayerRespawn(PlayerRespawnEvent event) + { + if (_game == null || !_game.InProgress()) + { + event.setRespawnLocation(GetLobby().GetSpawn()); + return; + } + + Player player = event.getPlayer(); + + if (_game.IsAlive(player)) + { + event.setRespawnLocation(_game.GetTeam(player).GetSpawn()); + } + else + { + _game.SetSpectator(player); + + event.setRespawnLocation(_game.GetSpectatorLocation()); + } + } + + @EventHandler + public void Motd(ServerListPingEvent event) + { + if (_game == null || _game.GetState() == GameState.Recruit) + { + event.setMotd(ChatColor.GREEN + "Recruiting"); + } + else + { + event.setMotd(ChatColor.YELLOW + "In Progress"); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void ItemPickup(PlayerPickupItemEvent event) + { + if (_game == null || _game.GetState() != GameState.Live) + event.setCancelled(true); + + else if (!_game.IsAlive(event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOW) + public void ItemDrop(PlayerDropItemEvent event) + { + if (_game == null || _game.GetState() != GameState.Live) + event.setCancelled(true); + + else if (!_game.IsAlive(event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler + public void CancelFoodChange(FoodLevelChangeEvent event) + { + if (event.getEntityType() == EntityType.PLAYER && event.getEntity().getWorld().getName().equals("world")) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOW) + public void DamageEvent(CustomDamageEvent event) + { + if (_game == null) + { + event.SetCancelled("Game Null"); + return; + } + + LivingEntity damagee = event.GetDamageeEntity(); + LivingEntity damager = event.GetDamagerEntity(true); + + if (damagee != null && damagee.getWorld().getName().equals("world")) + { + event.SetCancelled("In Lobby"); + + if (event.GetCause() == DamageCause.VOID) + damagee.teleport(GetLobby().GetSpawn()); + + return; + } + + if (!_game.Damage) + { + event.SetCancelled("Damage Disabled"); + return; + } + + if (_game.GetState() != GameState.Live) + { + event.SetCancelled("Game not Live"); + return; + } + + if (damagee != null && damagee instanceof Player && !_game.IsAlive((Player)damagee)) + { + event.SetCancelled("Damagee Not Playing"); + return; + } + + if (damager != null && damager instanceof Player && !_game.IsAlive((Player)damager)) + { + event.SetCancelled("Damager Not Playing"); + return; + } + + //Entity vs Entity + if (damagee != null && damager != null) + { + //PvP + if (damagee instanceof Player && damager instanceof Player) + { + if (!CanHurt((Player)damagee, (Player)damager)) + { + event.SetCancelled("Damage Rules"); + return; + } + } + //PvE + else if (damager instanceof Player) + { + if (!_game.DamagePvE) + { + event.SetCancelled("PvE Disabled"); + return; + } + } + //EvP + else if (damagee instanceof Player) + { + if (!_game.DamageEvP) + { + event.SetCancelled("EvP Disabled"); + return; + } + } + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void DamageExplosion(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_EXPLOSION && event.GetCause() != DamageCause.BLOCK_EXPLOSION) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + if (CanHurt(damagee, damager)) + return; + + event.SetCancelled("Allied Explosion"); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void InteractActive(PlayerInteractEvent event) + { + event.setCancelled(false); + } + + @EventHandler(priority = EventPriority.LOW) + public void InteractCancel(PlayerInteractEvent event) + { + if (_game == null) + return; + + Player player = event.getPlayer(); + + if (!_game.IsAlive(player)) + { + event.setCancelled(true); + } + else if (event.getPlayer().getItemInHand().getType() == Material.INK_SACK && event.getPlayer().getItemInHand().getData().getData() == (byte)15) + { + if (event.getAction() == Action.RIGHT_CLICK_BLOCK) + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void InteractCancel(InventoryClickEvent event) + { + if (_game == null) + return; + + Player player = UtilPlayer.searchExact(event.getWhoClicked().getName()); + + if (_game.IsLive() && !_game.IsAlive(player)) + { + event.setCancelled(true); + player.closeInventory(); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void TeamInteract(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() == null) + return; + + Player player = event.getPlayer(); + + GameTeam team = GetLobby().GetClickedTeam(event.getRightClicked()); + + if (team == null) + return; + + TeamClick(player, team); + } + + @EventHandler + public void TeamDamage(CustomDamageEvent event) + { + Player player = event.GetDamagerPlayer(false); + if (player == null) return; + + LivingEntity target = event.GetDamageeEntity(); + + GameTeam team = GetLobby().GetClickedTeam(target); + + if (team == null) + return; + + TeamClick(player, team); + } + + public void TeamClick(final Player player, final GameTeam team) + { + if (_game == null) + return; + + if (_game.GetState() != GameState.Recruit) + return; + + if (!_game.HasTeam(team)) + return; + + _game.AddTeamPreference(player, team); + } + + @EventHandler(priority = EventPriority.HIGH) + public void KitInteract(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() == null) + return; + + Player player = event.getPlayer(); + + Kit kit = GetLobby().GetClickedKit(event.getRightClicked()); + + if (kit == null) + return; + + KitClick(player, kit, event.getRightClicked()); + } + + @EventHandler + public void KitDamage(CustomDamageEvent event) + { + Player player = event.GetDamagerPlayer(false); + if (player == null) return; + + LivingEntity target = event.GetDamageeEntity(); + + Kit kit = GetLobby().GetClickedKit(target); + + if (kit == null) + return; + + KitClick(player, kit, target); + } + + public void KitClick(final Player player, final Kit kit, final Entity entity) + { + kit.DisplayDesc(player); + + if (_game == null) + return; + + if (!_game.HasKit(kit)) + return; + + + CoreClient client = _clientManager.Get(player); + Donor donor = _donationManager.Get(player.getName()); + + if (kit.GetAvailability() == KitAvailability.Free || client.GetRank().Has(Rank.ULTRA) || donor.OwnsUnknownPackage(GetServerConfig().ServerType + " ULTRA") || donor.OwnsUnknownPackage(_game.GetName() + " " + kit.GetName())) + { + _game.SetKit(player, kit, true); + } + else if (kit.GetAvailability() == KitAvailability.Green && donor.GetBalance(CurrencyType.Gems) > kit.GetCost()) + { + _arcadeShop.OpenPageForPlayer(player, new ConfirmationPage(this, _arcadeShop, _clientManager, _donationManager, new Runnable() + { + public void run() + { + if (player.isOnline()) + { + _game.SetKit(player, kit, true); + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(new Packet40EntityMetadata(entity.getEntityId(), ((CraftEntity)entity).getHandle().getDataWatcher(), true)); + } + } + }, null, new KitPackage(_game.GetName(), kit), CurrencyType.Gems, player)); + } + else + { + player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f); + + if (kit.GetAvailability() == KitAvailability.Blue) + UtilPlayer.message(player, F.main("Kit", "You must purchase " + F.elem(C.cAqua + "Ultra") + " to use " + F.elem(kit.GetFormattedName() + " Kit") + ".")); + else + UtilPlayer.message(player, F.main("Kit", "You need more " + F.elem(C.cGreen + "Gems") + " for " + F.elem(kit.GetFormattedName() + " Kit") + ".")); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void HungerUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_game == null) + return; + + if (_game.HungerSet != -1) + for (Player player : _game.GetPlayers(true)) + player.setFoodLevel(_game.HungerSet); + + if (_game.HealthSet != -1) + for (Player player : _game.GetPlayers(true)) + player.setHealth(_game.HealthSet); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void BoundaryCheck(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_game == null || _game.GetState() != GameState.Live) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (player.getLocation().getX() > _game.WorldData.MaxX || + player.getLocation().getX() < _game.WorldData.MinX || + player.getLocation().getZ() > _game.WorldData.MaxZ || + player.getLocation().getZ() < _game.WorldData.MinZ || + (_game.WorldHeightLimit > 0 && player.getLocation().getY() > _game.WorldHeightLimit)) + { + if (!IsAlive(player)) + { + player.teleport(_game.GetSpectatorLocation()); + } + else + { + UtilPlayer.message(player, C.cRed + C.Bold + "WARNING: " + C.cWhite + C.Bold +"RETURN TO PLAYABLE AREA!"); + + GetDamage().NewDamageEvent(player, null, null, + DamageCause.VOID, 4, true, false, false, + "Void", "Void Damage"); + + player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f); + player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f); + } + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void ItemPickupEvent(PlayerPickupItemEvent event) + { + Player player = event.getPlayer(); + + if (_game == null) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + else + { + if (!_game.IsAlive(player)) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + else + { + if (_game.ItemPickup) + { + if (_game.ItemPickupDeny.contains(event.getItem().getItemStack().getTypeId())) + { + event.setCancelled(true); + } + } + else + { + if (!_game.ItemPickupAllow.contains(event.getItem().getItemStack().getTypeId())) + { + event.setCancelled(true); + } + } + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void ItemDropEvent(PlayerDropItemEvent event) + { + Player player = event.getPlayer(); + + if (_game == null) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + else + { + if (!_game.IsAlive(player)) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + else + { + if (_game.ItemDrop) + { + if (_game.ItemDropDeny.contains(event.getItemDrop().getItemStack().getTypeId())) + { + event.setCancelled(true); + } + } + else + { + if (!_game.ItemDropAllow.contains(event.getItemDrop().getItemStack().getTypeId())) + { + event.setCancelled(true); + } + } + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void BlockPlaceEvent(BlockPlaceEvent event) + { + Player player = event.getPlayer(); + + if (_game == null) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + else + { + if (!_game.IsAlive(player)) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + else + { + if (_game.BlockPlace) + { + if (_game.BlockPlaceDeny.contains(event.getBlock().getTypeId())) + { + event.setCancelled(true); + } + } + else + { + if (!_game.BlockPlaceAllow.contains(event.getBlock().getTypeId())) + { + event.setCancelled(true); + } + } + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void BlockBreakEvent(org.bukkit.event.block.BlockBreakEvent event) + { + Player player = event.getPlayer(); + + if (_game == null) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + else if (_game.GetState() == GameState.Live) + { + if (!_game.IsAlive(player)) + { + event.setCancelled(true); + } + else + { + if (_game.BlockBreak) + { + if (_game.BlockBreakDeny.contains(event.getBlock().getTypeId())) + { + event.setCancelled(true); + } + + } + else + { + if (!_game.BlockBreakAllow.contains(event.getBlock().getTypeId())) + { + event.setCancelled(true); + } + } + } + } + else + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void PrivateBlockPlace(BlockPlaceEvent event) + { + if (_game == null) + return; + + if (!_game.PrivateBlocks) + return; + + if (event.isCancelled()) + return; + + if (!UtilBlock.usable(event.getBlockPlaced())) + return; + + if (event.getBlockPlaced().getType() != Material.CHEST && + event.getBlockPlaced().getType() != Material.FURNACE && + event.getBlockPlaced().getType() != Material.BURNING_FURNACE && + event.getBlockPlaced().getType() != Material.WORKBENCH) + return; + + String privateKey = event.getPlayer().getName(); + + if (!_game.PrivateBlockCount.containsKey(privateKey)) + { + _game.PrivateBlockCount.put(privateKey, 0); + } + + if (_game.PrivateBlockCount.get(privateKey) == 4) + return; + + if (_game.PrivateBlockCount.get(privateKey) > 1) + { + if (!_donationManager.Get(privateKey).OwnsUnknownPackage(GetServerConfig().ServerType + " ULTRA") && !_clientManager.Get(privateKey).GetRank().Has(Rank.ULTRA)) + return; + } + + _game.PrivateBlockMap.put(event.getBlockPlaced().getLocation(), event.getPlayer()); + _game.PrivateBlockCount.put(event.getPlayer().getName(), _game.PrivateBlockCount.get(event.getPlayer().getName()) + 1); + event.getPlayer().sendMessage(F.main(_game.GetName(), "Can't touch this. Na na nana!")); + + if (_game.PrivateBlockCount.get(privateKey) == 4) + { + event.getPlayer().sendMessage(F.main(_game.GetName(), "Protected block limit reached. Stay classy Ultra ranker ;)")); + } + else if (_game.PrivateBlockCount.get(privateKey) == 2) + { + if (!_donationManager.Get(privateKey).OwnsUnknownPackage(GetServerConfig().ServerType + " ULTRA") && !_clientManager.Get(privateKey).GetRank().Has(Rank.ULTRA)) + { + event.getPlayer().sendMessage(F.main(_game.GetName(), "Protected block limit reached. Thieves are scary, get Ultra for 2 extra protected blocks!")); + } + } + } + + @EventHandler(priority = EventPriority.LOW) + public void PrivateBlockPlaceCancel(BlockPlaceEvent event) + { + if (_game == null) + return; + + if (!_game.PrivateBlocks) + return; + + if (event.isCancelled()) + return; + + Block block = event.getBlockPlaced(); + + if (block.getType() != Material.CHEST) + return; + + Player player = event.getPlayer(); + + BlockFace[] faces = new BlockFace[] {BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST}; + + for (BlockFace face : faces) + { + Block other = block.getRelative(face); + + if (other.getType() != Material.CHEST) + continue; + + if (!_game.PrivateBlockMap.containsKey(other.getLocation())) + continue; + + Player owner = _game.PrivateBlockMap.get(other.getLocation()); + + if (player.equals(owner)) + continue; + + //Allow Enemy Raiding + GameTeam ownerTeam = _game.GetTeam(owner); + GameTeam playerTeam = _game.GetTeam(player); + + if (ownerTeam != null && playerTeam != null && !ownerTeam.equals(playerTeam)) + continue; + + //Disallow + UtilPlayer.message(event.getPlayer(), F.main("Game", + "You cannot combine " + + F.elem(C.cPurple + ItemStackFactory.Instance.GetName(event.getBlock(), false)) + + " with " + F.elem(GetColor(owner) + owner.getName() + "."))); + + event.setCancelled(true); + return; + } + } + + @EventHandler(priority = EventPriority.NORMAL) + public void PrivateBlockBreak(org.bukkit.event.block.BlockBreakEvent event) + { + if (_game == null) + return; + + if (!_game.PrivateBlocks) + return; + + if (event.isCancelled()) + return; + + if (!_game.PrivateBlockMap.containsKey(event.getBlock().getLocation())) + return; + + Player owner = _game.PrivateBlockMap.get(event.getBlock().getLocation()); + Player player = event.getPlayer(); + + //Same Team (or no team) + if (owner.equals(player)) + { + _game.PrivateBlockMap.remove(event.getBlock().getLocation()); + } + else + { + //Allow Enemy Raiding + GameTeam ownerTeam = _game.GetTeam(owner); + GameTeam playerTeam = _game.GetTeam(player); + + if (ownerTeam != null && playerTeam != null && !ownerTeam.equals(playerTeam)) + return; + + //Disallow + UtilPlayer.message(event.getPlayer(), F.main("Game", + F.elem(C.cPurple + ItemStackFactory.Instance.GetName(event.getBlock(), false)) + + " belongs to " + F.elem(GetColor(owner) + owner.getName() + "."))); + + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void PrivateBlockUse(PlayerInteractEvent event) + { + if (_game == null) + return; + + if (!_game.PrivateBlocks) + return; + + if (event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (!UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getClickedBlock().getType() != Material.CHEST && + event.getClickedBlock().getType() != Material.FURNACE && + event.getClickedBlock().getType() != Material.BURNING_FURNACE) + return; + + if (!_game.PrivateBlockMap.containsKey(event.getClickedBlock().getLocation())) + return; + + Player owner = _game.PrivateBlockMap.get(event.getClickedBlock().getLocation()); + Player player = event.getPlayer(); + + if (owner.equals(player)) + { + return; + } + else + { + //Allow Enemy Raiding + GameTeam ownerTeam = _game.GetTeam(owner); + GameTeam playerTeam = _game.GetTeam(player); + + if (ownerTeam != null && playerTeam != null && !ownerTeam.equals(playerTeam)) + return; + + //Disallow + UtilPlayer.message(event.getPlayer(), F.main("Game", + F.elem(C.cPurple + ItemStackFactory.Instance.GetName(event.getClickedBlock(), false)) + + " belongs to " + F.elem(GetColor(owner) + owner.getName() + "."))); + + event.setCancelled(true); + } + } + + @EventHandler + public void PrepareMoveCancel(PlayerMoveEvent event) + { + if (_game == null || _game.GetState() != GameState.Prepare) + return; + + if (!_game.PrepareFreeze) + return; + + if (UtilMath.offset(event.getFrom(), event.getTo()) <= 0) + return; + + event.getFrom().setPitch(event.getTo().getPitch()); + event.getFrom().setYaw(event.getTo().getYaw()); + + event.setTo(event.getFrom()); + } + + @EventHandler(priority = EventPriority.HIGH) + public void CraftingDeny(PrepareItemCraftEvent event) + { + if (event.getRecipe().getResult() == null) + return; + + Material type = event.getRecipe().getResult().getType(); + + if (type != Material.GOLDEN_APPLE && + type != Material.GOLDEN_CARROT && + type != Material.FLINT_AND_STEEL) + return; + + if (!(event.getInventory() instanceof CraftingInventory)) + return; + + CraftingInventory inv = (CraftingInventory)event.getInventory(); + + /* + String name = ItemStackFactory.Instance.GetName(event.getRecipe().getResult(), true); + + //Feedback + ItemStack result = ItemStackFactory.Instance.CreateStack(36, (byte)0, 1, + "§r" + C.cGray + "Crafting of " + F.item(name) + " is disabled.", new String[] {}); + + inv.setResult(result); + */ + + inv.setResult(null); + } + + @EventHandler + public void WaterDamage(UpdateEvent event) + { + if (_game == null) + return; + + if (_game.WaterDamage <= 0) + return; + + if (!_game.IsLive()) + return; + + if (event.getType() != UpdateType.FAST) + return; + + for (GameTeam team : _game.GetTeamList()) + for (Player player : team.GetPlayers(true)) + if (player.getLocation().getBlock().isLiquid()) + { + //Damage Event + GetDamage().NewDamageEvent(player, null, null, + DamageCause.DROWNING, 4, true, false, false, + "Water", "Water Damage"); + + player.getWorld().playSound(player.getLocation(), + Sound.SPLASH, 2f, + 1f + (float) Math.random() / 2); + } + } + + @EventHandler + public void Join(PlayerJoinEvent event) + { + event.setJoinMessage(F.sys("Join", event.getPlayer().getName())); + } + + @EventHandler + public void Quit(PlayerQuitEvent event) + { + event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + event.getPlayer().getName())); + } + + @EventHandler(priority = EventPriority.LOW) + public void WorldCreature(CreatureSpawnEvent event) + { + if (_game == null) + return; + + if (!_game.CreatureAllow && !_game.CreatureAllowOverride) + { + if (_game.WorldData != null) + { + if (_game.WorldData.World != null) + { + if (event.getLocation().getWorld().equals(_game.WorldData.World)) + { + event.setCancelled(true); + } + } + } + } + } + + @EventHandler + public void WorldTime(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (_game == null) + return; + + if (_game.WorldTimeSet != -1) + { + if (_game.WorldData != null) + { + if (_game.WorldData.World != null) + { + _game.WorldData.World.setTime(_game.WorldTimeSet); + } + } + } + } + + @EventHandler + public void NextGame(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (GetGameList().isEmpty()) + return; + + if (_game == null && _ended.isEmpty()) + { + CreateGame(null); + } + + //Archive Game + if (_game != null) + { + if (_game.GetState() == GameState.Dead) + { + HandlerList.unregisterAll(_game); + + //Schedule Cleanup + _ended.add(_game); + + //Lobby Display + GetLobby().DisplayLast(_game); + + //Prepare Round 2 - If Applicable + if (_game instanceof AsymTeamGame) + { + if (((AsymTeamGame) _game).GetPastTeams() == null) + { + _nextGame = _game.GetType(); + _nextGameTeams = new HashMap(); + + for (GameTeam team : _game.GetTeamList()) + for (Player player : team.GetPlayers(false)) + _nextGameTeams.put(player.getName(), team.GetColor()); + } + } + + _game = null; + } + } + + //Clean Archived Games + Iterator gameIterator = _ended.iterator(); + + while (gameIterator.hasNext()) + { + Game game = gameIterator.next(); + + HandlerList.unregisterAll(game); + + //Cleaned + if (game.WorldData == null) + { + gameIterator.remove(); + continue; + } + + if (game.WorldData.World == null) + { + gameIterator.remove(); + continue; + } + + //Kick Players + if (UtilTime.elapsed(game.GetStateTime(), 10000)) + { + for (Player player : game.WorldData.World.getPlayers()) + player.kickPlayer("Dead World"); + } + + //Clean + if (game.WorldData.World.getPlayers().isEmpty()) + { + game.WorldData.Uninitialize(); + game.WorldData = null; + } + } + } + + private void CreateGame(GameType gameType) + { + HashMap pastTeams = null; + + //Round 2 + if (_nextGame != null && _nextGameTeams != null) + { + gameType = _nextGame; + pastTeams = _nextGameTeams; + + _nextGame = null; + _nextGameTeams = null; + } + + //Pick Game + if (gameType == null) + { + for (int i=0 ; i<50 ; i++) + { + gameType = GetGameList().get(UtilMath.r(GetGameList().size())); + + if (gameType != _lastGame) + break; + } + } + _lastGame = gameType; + + //Make Game + _game = _gameFactory.CreateGame(gameType, pastTeams); + + if (_game == null) + { + return; + } + + GetLobby().DisplayNext(_game, pastTeams); + + UtilServer.getServer().getPluginManager().registerEvents(_game, GetPlugin()); + } + + @EventHandler + public void LobbyLiquid(BlockFromToEvent event) + { + if (_game == null) + return; + + if (event.getBlock().getWorld().getName().equals("world")) + event.setCancelled(true); + } + + @EventHandler + public void LoadWorldChunks(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator worldIterator = _worldLoader.iterator(); + + long endTime = System.currentTimeMillis() + 25; + + while (worldIterator.hasNext()) + { + long timeLeft = endTime - System.currentTimeMillis(); + if (timeLeft <= 0) continue; + + final WorldData worldData = worldIterator.next(); + + if (worldData.World == null) + { + worldIterator.remove(); + } + else if (worldData.LoadChunks(timeLeft)) + { + worldData.Host.SetState(GameState.Recruit); + worldIterator.remove(); + } + } + } + /* + @EventHandler + public void ChunkLoad(ChunkPreLoadEvent event) + { + if (_game != null) + if (_game.WorldData != null) + _game.WorldData.ChunkLoad(event); + } + */ + @EventHandler + public void ChunkUnload(ChunkUnloadEvent event) + { + if (event.getWorld().getName().equals("world")) + { + event.setCancelled(true); + return; + } + + if (_game != null) + if (_game.WorldData != null) + _game.WorldData.ChunkUnload(event); + } + + public void RegisterWorld(WorldData worldData) + { + _worldLoader.add(worldData); + } + + public Game GetGame() + { + return _game; + } + + public void SetGame(Game game) + { + _game = game; + } + + public String GetLastMap() + { + return _lastMap; + } + + public void SetLastMap(String file) + { + _lastMap = file; + } + + public GameType GetLastGame() + { + return _lastGame; + } + + public int GetPlayerMin() + { + return _playerMin; + } + + public int GetPlayerFull() + { + return _playerFull; + } + + public void Clear(Player player) + { + player.setGameMode(GameMode.SURVIVAL); + UtilInv.Clear(player); + player.setFoodLevel(20); + player.setHealth(20); + player.setFireTicks(0); + player.setFallDistance(0); + player.setLevel(0); + player.setExp(0f); + ((CraftPlayer)player).getHandle().spectating = false; + ((CraftPlayer)player).getHandle().m = true; + + GetDisguise().Undisguise(player); + + GetCondition().EndCondition(player, ConditionType.CLOAK, "Spectator"); + + player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte)0, 1, (short)0, C.cGreen + "Return to Hub", + new String[] {"", ChatColor.RESET + "Click while holding this", ChatColor.RESET + "to return to the Hub."})); + } + + public boolean IsAlive(Player player) + { + if (_game == null) + return false; + + return _game.IsAlive(player); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void HubInteract(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (player.getItemInHand() == null) + return; + + if (player.getItemInHand().getType() != Material.WATCH) + return; + + if (_game != null && _game.IsAlive(player)) + return; + + _portal.SendPlayerToServer(player, "Lobby"); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/GameType.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/GameType.class new file mode 100644 index 000000000..985bdb9bf Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/GameType.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/addons/CompassAddon.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/addons/CompassAddon.class new file mode 100644 index 000000000..87b80debd Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/addons/CompassAddon.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/addons/SoupAddon.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/addons/SoupAddon.class new file mode 100644 index 000000000..5204c5018 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/addons/SoupAddon.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/GameCommand.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/GameCommand.class new file mode 100644 index 000000000..f7cb7a77f Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/GameCommand.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/GemCommand.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/GemCommand.class new file mode 100644 index 000000000..e4008087a Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/GemCommand.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/ParseCommand.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/ParseCommand.class new file mode 100644 index 000000000..81a5a328e Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/ParseCommand.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/StartCommand.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/StartCommand.class new file mode 100644 index 000000000..59a4809e2 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/StartCommand.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/StopCommand.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/StopCommand.class new file mode 100644 index 000000000..d2a22b231 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/StopCommand.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/WriteCommand.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/WriteCommand.class new file mode 100644 index 000000000..d2653df60 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/command/WriteCommand.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/events/GameStateChangeEvent.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/events/GameStateChangeEvent.class new file mode 100644 index 000000000..3a313e598 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/events/GameStateChangeEvent.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/events/PlayerDeathOutEvent.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/events/PlayerDeathOutEvent.class new file mode 100644 index 000000000..0327af299 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/events/PlayerDeathOutEvent.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/events/PlayerStateChangeEvent.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/events/PlayerStateChangeEvent.class new file mode 100644 index 000000000..6e76d75bc Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/events/PlayerStateChangeEvent.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/events/TeamGenerationEvent.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/events/TeamGenerationEvent.class new file mode 100644 index 000000000..06f4fe373 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/events/TeamGenerationEvent.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/AsymTeamGame.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/AsymTeamGame.class new file mode 100644 index 000000000..627843178 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/AsymTeamGame.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/Game$1.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/Game$1.class new file mode 100644 index 000000000..8c9d32625 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/Game$1.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/Game$GameState.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/Game$GameState.class new file mode 100644 index 000000000..b5333aa49 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/Game$GameState.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/Game.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/Game.class new file mode 100644 index 000000000..062e8765d Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/Game.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/Game.java.orig b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/Game.java.orig new file mode 100644 index 000000000..2de8ce204 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/Game.java.orig @@ -0,0 +1,896 @@ +package nautilus.game.arcade.game; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import nautilus.game.arcade.ArcadeFormat; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerStateChangeEvent; +import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.world.WorldData; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.scoreboard.DisplaySlot; +import org.bukkit.scoreboard.Objective; +import org.bukkit.scoreboard.Score; +import org.bukkit.scoreboard.Scoreboard; +import org.bukkit.scoreboard.Team; +import org.bukkit.util.Vector; + +public abstract class Game implements Listener +{ + public enum GameState + { + Loading, + Recruit, + Prepare, + Live, + End, + Dead + } + + public ArcadeManager Manager; + + //Game + private GameType _gameType; + private String[] _gameDesc; + + //Map + private ArrayList _files; + + //State + private GameState _gameState = GameState.Loading; + private long _gameStateTime = System.currentTimeMillis(); + + private int _countdown = -1; + private boolean _countdownForce = false; + + private int _playerCount = 0; + + private String _customWinLine = ""; + + //Kits + private Kit[] _kits; + + //Teams + private ArrayList _teamList = new ArrayList(); + + //Player Preferences + private NautHashMap _playerKit = new NautHashMap(); + private NautHashMap> _teamPreference = new NautHashMap>(); + private NautHashMap> _gemCount = new NautHashMap>(); + + //Scoreboard + private Scoreboard _scoreboard; + private Objective _sideObjective; + + //Loaded from Map Config + public WorldData WorldData = null; + + //Gameplay Flags + public boolean Damage = true; + public boolean DamagePvP = true; + public boolean DamagePvE = true; + public boolean DamageEvP = true; + public boolean DamageSelf = true; + public boolean DamageTeamSelf = false; + public boolean DamageTeamOther = true; + + public boolean BlockBreak = false; + public HashSet BlockBreakAllow = new HashSet(); + public HashSet BlockBreakDeny = new HashSet(); + + public boolean BlockPlace = false; + public HashSet BlockPlaceAllow = new HashSet(); + public HashSet BlockPlaceDeny = new HashSet(); + + public boolean ItemPickup = false; + public HashSet ItemPickupAllow = new HashSet(); + public HashSet ItemPickupDeny = new HashSet(); + + public boolean ItemDrop = false; + public HashSet ItemDropAllow = new HashSet(); + public HashSet ItemDropDeny = new HashSet(); + + public boolean PrivateBlocks = false; + + public boolean DeathOut = true; + public boolean DeathDropItems = true; + + public boolean CreatureAllow = false; + public boolean CreatureAllowOverride = false; + + public int WorldTimeSet = -1; + public int WorldHeightLimit = 0; + + public int HungerSet = -1; + public int HealthSet = -1; + + public int SpawnDistanceRequirement = 1; + + public boolean PrepareFreeze = true; + + public int WaterDamage = 0; + + public boolean RepairWeapons = true; + + //Addons + public boolean CompassEnabled = false; + public boolean SoupEnabled = true; + + //Gameplay Data + public HashMap PrivateBlockMap = new HashMap(); + public HashMap PrivateBlockCount = new HashMap(); + + public Location SpectatorSpawn = null; + + public boolean FirstKill = true; + + public String Winner = "Nobody"; + public GameTeam WinnerTeam = null; + + public Game(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc) + { + Manager = manager; + + //Game + _gameType = gameType; + _gameDesc = gameDesc; + + //Kits + _kits = kits; + + //Scoreboard + _scoreboard = Bukkit.getScoreboardManager().getNewScoreboard(); + + _sideObjective = _scoreboard.registerNewObjective("Obj"+UtilMath.r(999999999), "dummy"); + _sideObjective.setDisplaySlot(DisplaySlot.SIDEBAR); + _sideObjective.setDisplayName(C.Bold + GetName()); + + //Map + _files = Manager.LoadFiles(GetName()); + WorldData = new WorldData(this); + + System.out.println("Loading " + GetName() + "..."); + } + + public ArrayList GetFiles() + { + return _files; + } + + public String GetName() + { + return _gameType.GetName(); + } + + public GameType GetType() + { + return _gameType; + } + + public String[] GetDesc() + { + return _gameDesc; + } + + public void SetCustomWinLine(String line) + { + _customWinLine = line; + } + + public Scoreboard GetScoreboard() + { + return _scoreboard; + } + + public Objective GetObjectiveSide() + { + return _sideObjective; + } + + public ArrayList GetTeamList() + { + return _teamList; + } + + public int GetCountdown() + { + return _countdown; + } + + public void SetCountdown(int time) + { + _countdown = time; + } + + public boolean GetCountdownForce() + { + return _countdownForce; + } + + public void SetCountdownForce(boolean value) + { + _countdownForce = value; + } + + public int GetPlayerCountAtStart() + { + return _playerCount; + } + + public void SetPlayerCountAtStart(int count) + { + _playerCount = count; + } + + public NautHashMap> GetTeamPreferences() + { + return _teamPreference; + } + + public NautHashMap GetPlayerKits() + { + return _playerKit; + } + + public NautHashMap> GetPlayerGems() + { + return _gemCount; + } + + public GameState GetState() + { + return _gameState; + } + + public void SetState(GameState state) + { + _gameState = state; + _gameStateTime = System.currentTimeMillis(); + + //Event + GameStateChangeEvent stateEvent = new GameStateChangeEvent(this, state); + UtilServer.getServer().getPluginManager().callEvent(stateEvent); + + System.out.println(GetName() + " state set to " + state.toString()); + } + + public long GetStateTime() + { + return _gameStateTime; + } + + public boolean InProgress() + { + return GetState() == GameState.Prepare || GetState() == GameState.Live; + } + + public boolean IsLive() + { + return _gameState == GameState.Live; + } + + public void AddTeam(GameTeam team) + { + //Add + GetTeamList().add(team); + + //Set Spawn Data + team.SetSpawnRequirement(this.SpawnDistanceRequirement); + + + + System.out.println("Created Team: " + team.GetName()); + } + + public boolean HasTeam(GameTeam team) + { + for (GameTeam cur : GetTeamList()) + if (cur.equals(team)) + return true; + + return false; + } + + public void CreateScoreboardTeams() + { + System.out.println("Creating Scoreboard Teams."); + + //Base Groups + for (Rank rank : Rank.values()) + { + //Spectator + if (rank == Rank.ALL) + { + _scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(ChatColor.GRAY + ""); + } + else + { + _scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + ChatColor.GRAY); + } + } + + //Team Groups + for (GameTeam team : GetTeamList()) + { + for (Rank rank : Rank.values()) + { + if (rank == Rank.ALL) + { + _scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(team.GetColor() + ""); + } + else + { + _scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + team.GetColor()); + } + } + } + } + + public void RestrictKits() + { + //Null Default + } + + public void RegisterKits() + { + for (Kit kit : _kits) + { + UtilServer.getServer().getPluginManager().registerEvents(kit, Manager.GetPlugin()); + + for (Perk perk : kit.GetPerks()) + UtilServer.getServer().getPluginManager().registerEvents(perk, Manager.GetPlugin()); + } + + } + + public void DeregisterKits() + { + for (Kit kit : _kits) + { + HandlerList.unregisterAll(kit); + + for (Perk perk : kit.GetPerks()) + HandlerList.unregisterAll(perk); + } + } + + public void ParseData() + { + //Nothing by default, + //Use this to parse in extra location data from maps + } + + + + public void SetPlayerTeam(Player player, GameTeam team) + { + //Clean Old Team + GameTeam pastTeam = this.GetTeam(player); + if (pastTeam != null) + { + pastTeam.RemovePlayer(player); + } + + team.AddPlayer(player); + + //Ensure Valid Kit + ValidateKit(player, team); + + //Game Scoreboard + SetPlayerScoreboardTeam(player, team.GetName().toUpperCase()); + + //Lobby Scoreboard + Manager.GetLobby().AddPlayerToScoreboards(player, team.GetName().toUpperCase()); + } + + public void SetPlayerScoreboardTeam(Player player, String teamName) + { + for (Team team : GetScoreboard().getTeams()) + team.removePlayer(player); + + if (teamName == null) + teamName = ""; + + GetScoreboard().getTeam(Manager.GetClients().Get(player).GetRank().Name + teamName).addPlayer(player); + } + + public GameTeam ChooseTeam(Player player) + { + GameTeam team = null; + + //Random Team + for (int i=0 ; i<_teamList.size() ; i++) + { + if (team == null || _teamList.get(i).GetSize() < team.GetSize()) + { + team = _teamList.get(i); + } + } + + return team; + } + + public double GetKillsGems(Player killer, Player killed, boolean assist) + { + if (!DeathOut) + { + return 0.5; + } + + if (!assist) + { + return 4; + } + else + { + return 1; + } + } + + public HashMap GetGems(Player player) + { + if (!_gemCount.containsKey(player)) + _gemCount.put(player, new HashMap()); + + return _gemCount.get(player); + } + + public void AddGems(Player player, double gems, String reason, boolean countAmount) + { + if (!countAmount && gems < 1) + gems = 1; + + if (GetGems(player).containsKey(reason)) + { + GetGems(player).get(reason).AddGems(gems); + } + else + { + GetGems(player).put(reason, new GemData(gems, countAmount)); + } + } + + public void ValidateKit(Player player, GameTeam team) + { + //Kit + if (GetKit(player) == null || !team.KitAllowed(GetKit(player))) + { + for (Kit kit : _kits) + { + if (kit.GetAvailability() == KitAvailability.Hide || + kit.GetAvailability() == KitAvailability.Null) + continue; + + if (team.KitAllowed(kit)) + { + SetKit(player, kit, false); + break; + } + } + } + } + + public void SetKit(Player player, Kit kit, boolean announce) + { + GameTeam team = GetTeam(player); + if (team != null) + { + if (!team.KitAllowed(kit)) + { + player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f); + UtilPlayer.message(player, F.main("Kit", F.elem(team.GetFormattedName()) + " cannot use " + F.elem(kit.GetFormattedName() + " Kit") + ".")); + return; + } + } + + _playerKit.put(player, kit); + + if (announce) + { + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1f); + UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + ".")); + } + } + + public Kit GetKit(Player player) + { + return _playerKit.get(player); + } + + public Kit[] GetKits() + { + return _kits; + } + + public boolean HasKit(Kit kit) + { + for (Kit cur : GetKits()) + if (cur.equals(kit)) + return true; + + return false; + } + + public boolean SetPlayerState(Player player, PlayerState state) + { + GetScoreboard().resetScores(player); + + GameTeam team = GetTeam(player); + + if (team == null) + return false; + + team.SetPlayerState(player, state); + + //Event + PlayerStateChangeEvent playerStateEvent = new PlayerStateChangeEvent(this, player, PlayerState.OUT); + UtilServer.getServer().getPluginManager().callEvent(playerStateEvent); + + return true; + } + + public abstract void EndCheck(); + + public void RespawnPlayer(final Player player) + { + player.eject(); + player.teleport(GetTeam(player).GetSpawn()); + + Manager.Clear(player); + + //Re-Give Kit + Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() + { + public void run() + { + GetKit(player).ApplyKit(player); + } + }, 0); + } + + public boolean IsPlaying(Player player) + { + return GetTeam(player) != null; + } + + public boolean IsAlive(Player player) + { + GameTeam team = GetTeam(player); + + if (team == null) + return false; + + return team.IsAlive(player); + } + + public ArrayList GetPlayers(boolean aliveOnly) + { + ArrayList players = new ArrayList(); + + for (GameTeam team : _teamList) + players.addAll(team.GetPlayers(aliveOnly)); + + return players; + } + + public GameTeam GetTeam(Player player) + { + for (GameTeam team : _teamList) + if (team.HasPlayer(player)) + return team; + + return null; + } + + public GameTeam GetTeam(ChatColor color) + { + for (GameTeam team : _teamList) + if (team.GetColor() == color) + return team; + + return null; + } + + public Location GetSpectatorLocation() + { + if (SpectatorSpawn != null) + return SpectatorSpawn; + + Vector vec = new Vector(0,0,0); + double count = 0; + + for (GameTeam team : this.GetTeamList()) + { + for (Location spawn : team.GetSpawns()) + { + count++; + vec.add(spawn.toVector()); + } + } + + SpectatorSpawn = new Location(this.WorldData.World, 0,0,0); + + vec.multiply(1d/count); + + SpectatorSpawn.setX(vec.getX()); + SpectatorSpawn.setY(vec.getY()); + SpectatorSpawn.setZ(vec.getZ()); + + //Move Up - Out Of Blocks + while (!UtilBlock.airFoliage(SpectatorSpawn.getBlock()) || !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) + { + SpectatorSpawn.add(0, 1, 0); + } + + int Up = 0; + + //Move Up - Through Air + for (int i=0 ; i<15 ; i++) + { + if (UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) + { + SpectatorSpawn.add(0, 1, 0); + Up++; + } + else + { + break; + } + } + + //Move Down - Out Of Blocks + while (Up > 0 && !UtilBlock.airFoliage(SpectatorSpawn.getBlock()) || !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) + { + SpectatorSpawn.subtract(0, 1, 0); + Up--; + } + + SpectatorSpawn = SpectatorSpawn.getBlock().getLocation().add(0.5, 0.1, 0.5); + + while (SpectatorSpawn.getBlock().getTypeId() != 0 || SpectatorSpawn.getBlock().getRelative(BlockFace.UP).getTypeId() != 0) + SpectatorSpawn.add(0, 1, 0); + + return SpectatorSpawn; + } + + public void SetSpectator(Player player) + { + Manager.Clear(player); + + player.teleport(GetSpectatorLocation()); + player.setGameMode(GameMode.CREATIVE); + player.setFlying(true); + player.setFlySpeed(0.1f); + ((CraftPlayer)player).getHandle().spectating = true; + ((CraftPlayer)player).getHandle().m = false; + + Manager.GetCondition().Factory().Cloak("Spectator", player, player, 7777, true, true); + + if (GetTeam(player) != null && _scoreboard.getTeam(GetTeam(player).GetName().toUpperCase()) != null) + { + _scoreboard.getTeam(GetTeam(player).GetName().toUpperCase()).removePlayer(player); + } + + SetPlayerScoreboardTeam(player, "SPEC"); + } + + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (GameTeam team : this.GetTeamList()) + { + String name = team.GetColor() + team.GetName(); + if (name.length() > 16) + name = name.substring(0, 16); + + Score score = GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(name)); + score.setScore(team.GetPlayers(true).size()); + } + } + + public boolean DisplayDeathMessage() + { + if (this.DeathOut) + { + return true; + } + + return false; + } + + public boolean CanJoinTeam(GameTeam team) + { + return team.GetSize() < UtilServer.getPlayers().length/GetTeamList().size(); + } + + public GameTeam GetTeamPreference(Player player) + { + for (GameTeam team : _teamPreference.keySet()) + { + if (_teamPreference.get(team).contains(player)) + return team; + } + + return null; + } + + public void RemoveTeamPreference(Player player) + { + for (ArrayList queue : _teamPreference.values()) + queue.remove(player); + } + + public String GetTeamQueuePosition(Player player) + { + for (ArrayList queue : _teamPreference.values()) + { + for (int i=0 ; i places) + { + for (Player player : UtilServer.getPlayers()) + { + player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f); + + UtilPlayer.message(player, ""); + UtilPlayer.message(player, ArcadeFormat.Line); + + UtilPlayer.message(player, "§aGame - §f§l" + this.GetName()); + UtilPlayer.message(player, ""); + + if (places == null || places.isEmpty()) + { + UtilPlayer.message(player, ""); + UtilPlayer.message(player, ChatColor.WHITE + "§lNobody won the game..."); + UtilPlayer.message(player, ""); + } + else + { + if (places.size() >= 1) + { + Winner = places.get(0).getName(); + UtilPlayer.message(player, C.cRed + C.Bold + "1st Place" + C.cWhite + " - " + places.get(0).getName()); + } + + + if (places.size() >= 2) + UtilPlayer.message(player, C.cGold + C.Bold + "2nd Place" + C.cWhite + " - " + places.get(1).getName()); + + if (places.size() >= 3) + UtilPlayer.message(player, C.cYellow + C.Bold + "3rd Place" + C.cWhite + " - " + places.get(2).getName()); + } + + UtilPlayer.message(player, ""); + UtilPlayer.message(player, "§aMap - §f§l" + WorldData.MapName + C.cGray + " created by " + "§f§l" + WorldData.MapAuthor); + + UtilPlayer.message(player, ArcadeFormat.Line); + } + + Manager.GetChat().Silence(5000, false); + } + + public void Announce(String message) + { + for (Player player : UtilServer.getPlayers()) + { + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 1f); + + UtilPlayer.message(player, message); + } + } + + +} diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/GameServerConfig.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/GameServerConfig.class new file mode 100644 index 000000000..732ec39c3 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/GameServerConfig.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/GameTeam$PlayerState.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/GameTeam$PlayerState.class new file mode 100644 index 000000000..2f5ba98b3 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/GameTeam$PlayerState.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/GameTeam.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/GameTeam.class new file mode 100644 index 000000000..74c2dd218 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/GameTeam.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/GemData.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/GemData.class new file mode 100644 index 000000000..e97e7bcf1 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/GemData.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/SoloGame.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/SoloGame.class new file mode 100644 index 000000000..01f2110ef Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/SoloGame.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/TeamGame.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/TeamGame.class new file mode 100644 index 000000000..c3949f363 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/TeamGame.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/deathtag/DeathTag.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/deathtag/DeathTag.class new file mode 100644 index 000000000..4f5ec8268 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/deathtag/DeathTag.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/deathtag/kits/KitArcher.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/deathtag/kits/KitArcher.class new file mode 100644 index 000000000..5394841cf Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/deathtag/kits/KitArcher.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/dragons/DragonData.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/dragons/DragonData.class new file mode 100644 index 000000000..fb37e1e20 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/dragons/DragonData.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/dragons/Dragons.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/dragons/Dragons.class new file mode 100644 index 000000000..d3a5cd7b6 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/dragons/Dragons.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/dragons/kits/KitCoward.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/dragons/kits/KitCoward.class new file mode 100644 index 000000000..b75d60a61 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/dragons/kits/KitCoward.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/dragons/kits/KitMarksman.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/dragons/kits/KitMarksman.class new file mode 100644 index 000000000..7ae15fefd Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/dragons/kits/KitMarksman.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/dragons/kits/KitPyrotechnic.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/dragons/kits/KitPyrotechnic.class new file mode 100644 index 000000000..1ac3f91ac Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/dragons/kits/KitPyrotechnic.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/EvoScore.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/EvoScore.class new file mode 100644 index 000000000..690f0e966 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/EvoScore.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/Evolution$1.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/Evolution$1.class new file mode 100644 index 000000000..362c09e6a Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/Evolution$1.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/Evolution.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/Evolution.class new file mode 100644 index 000000000..eaa11e634 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/Evolution.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/kits/KitAgility.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/kits/KitAgility.class new file mode 100644 index 000000000..ad174410d Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/kits/KitAgility.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/kits/KitHealth.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/kits/KitHealth.class new file mode 100644 index 000000000..62e4ff86b Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/kits/KitHealth.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/kits/KitRecharge.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/kits/KitRecharge.class new file mode 100644 index 000000000..cf8e1f511 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/kits/KitRecharge.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitBlaze.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitBlaze.class new file mode 100644 index 000000000..38aecdd61 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitBlaze.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitChicken.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitChicken.class new file mode 100644 index 000000000..05dd5049c Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitChicken.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitCreeper.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitCreeper.class new file mode 100644 index 000000000..a6cf9c5d1 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitCreeper.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitEnderman.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitEnderman.class new file mode 100644 index 000000000..b199eb11e Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitEnderman.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitGolem.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitGolem.class new file mode 100644 index 000000000..8a61c6f86 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitGolem.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitSkeleton.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitSkeleton.class new file mode 100644 index 000000000..bb04d4963 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitSkeleton.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitSlime.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitSlime.class new file mode 100644 index 000000000..cee52b8ce Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitSlime.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitSnowman.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitSnowman.class new file mode 100644 index 000000000..9122c7f68 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitSnowman.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitSpider.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitSpider.class new file mode 100644 index 000000000..c71b1f9f6 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitSpider.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitWolf.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitWolf.class new file mode 100644 index 000000000..63347dc60 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/evolution/mobs/KitWolf.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/horsecharge/Horse.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/horsecharge/Horse.class new file mode 100644 index 000000000..9bf9a0a8e Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/horsecharge/Horse.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/horsecharge/kits/KitDefenceArcher.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/horsecharge/kits/KitDefenceArcher.class new file mode 100644 index 000000000..ab2be025b Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/horsecharge/kits/KitDefenceArcher.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/horsecharge/kits/KitHorseKnight.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/horsecharge/kits/KitHorseKnight.class new file mode 100644 index 000000000..2402a05fc Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/horsecharge/kits/KitHorseKnight.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/MineWare.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/MineWare.class new file mode 100644 index 000000000..b40dd8e34 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/MineWare.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/order/Order.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/order/Order.class new file mode 100644 index 000000000..b3ef992ff Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/order/Order.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/order/OrderCraft.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/order/OrderCraft.class new file mode 100644 index 000000000..f6d3d5e91 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/order/OrderCraft.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/order/OrderGather.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/order/OrderGather.class new file mode 100644 index 000000000..0c3b7de55 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/order/OrderGather.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/order/OrderPlace.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/order/OrderPlace.class new file mode 100644 index 000000000..213414f49 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/order/OrderPlace.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/ActionMilkCow.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/ActionMilkCow.class new file mode 100644 index 000000000..4d0903ea3 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/ActionMilkCow.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/ActionShearSheep.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/ActionShearSheep.class new file mode 100644 index 000000000..b1f4ccda1 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/ActionShearSheep.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/CraftLadder.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/CraftLadder.class new file mode 100644 index 000000000..c13142876 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/CraftLadder.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/CraftStoneShovel.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/CraftStoneShovel.class new file mode 100644 index 000000000..9804c7061 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/CraftStoneShovel.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/DamageChicken.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/DamageChicken.class new file mode 100644 index 000000000..f099dd3f8 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/DamageChicken.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/DamageFall.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/DamageFall.class new file mode 100644 index 000000000..c4ae18d36 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/DamageFall.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/DamageGhast.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/DamageGhast.class new file mode 100644 index 000000000..c3db33533 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/DamageGhast.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/GatherCobble.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/GatherCobble.class new file mode 100644 index 000000000..71485fda0 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/GatherCobble.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/GatherRedFlower.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/GatherRedFlower.class new file mode 100644 index 000000000..ebc7714b9 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/GatherRedFlower.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/GatherSand.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/GatherSand.class new file mode 100644 index 000000000..41c8e1a9e Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/GatherSand.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/GatherYellowFlower.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/GatherYellowFlower.class new file mode 100644 index 000000000..a419c0365 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/GatherYellowFlower.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/PlaceDoor.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/PlaceDoor.class new file mode 100644 index 000000000..bcf7bbb49 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/PlaceDoor.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/RideBoat.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/RideBoat.class new file mode 100644 index 000000000..64a2431a7 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/RideBoat.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/RidePig.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/RidePig.class new file mode 100644 index 000000000..14541099b Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/RidePig.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/StandAlone.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/StandAlone.class new file mode 100644 index 000000000..f8e641551 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/StandAlone.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/StandShelter.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/StandShelter.class new file mode 100644 index 000000000..dc7481752 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/StandShelter.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/StandStone.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/StandStone.class new file mode 100644 index 000000000..9ab37d9be Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/StandStone.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/StandWater.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/StandWater.class new file mode 100644 index 000000000..84077d455 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/mineware/random/StandWater.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/Quiver$1.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/Quiver$1.class new file mode 100644 index 000000000..78da32713 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/Quiver$1.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/Quiver.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/Quiver.class new file mode 100644 index 000000000..e0bec1ade Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/Quiver.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/QuiverScore.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/QuiverScore.class new file mode 100644 index 000000000..dc4f2e7d6 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/QuiverScore.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/kits/KitBrawler.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/kits/KitBrawler.class new file mode 100644 index 000000000..d71d6dbcc Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/kits/KitBrawler.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/kits/KitElementalist.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/kits/KitElementalist.class new file mode 100644 index 000000000..83b79b86c Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/kits/KitElementalist.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/kits/KitLeaper.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/kits/KitLeaper.class new file mode 100644 index 000000000..4884c4dc8 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/quiver/kits/KitLeaper.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/runner/Runner$1.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/runner/Runner$1.class new file mode 100644 index 000000000..0de19eed7 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/runner/Runner$1.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/runner/Runner.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/runner/Runner.class new file mode 100644 index 000000000..062c3bed9 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/runner/Runner.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/runner/kits/KitArcher.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/runner/kits/KitArcher.class new file mode 100644 index 000000000..a48d666f5 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/runner/kits/KitArcher.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/runner/kits/KitFrosty.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/runner/kits/KitFrosty.class new file mode 100644 index 000000000..860b8a741 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/runner/kits/KitFrosty.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/runner/kits/KitLeaper.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/runner/kits/KitLeaper.class new file mode 100644 index 000000000..17e3aea22 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/runner/kits/KitLeaper.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/snowfight/SnowFight.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/snowfight/SnowFight.class new file mode 100644 index 000000000..e95f12656 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/snowfight/SnowFight.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/spleef/Spleef$1.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/spleef/Spleef$1.class new file mode 100644 index 000000000..64b0f44a3 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/spleef/Spleef$1.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/spleef/Spleef.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/spleef/Spleef.class new file mode 100644 index 000000000..cd66a8f65 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/spleef/Spleef.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/spleef/kits/KitArcher.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/spleef/kits/KitArcher.class new file mode 100644 index 000000000..4be51a379 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/spleef/kits/KitArcher.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/spleef/kits/KitBrawler.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/spleef/kits/KitBrawler.class new file mode 100644 index 000000000..b97ea43b0 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/spleef/kits/KitBrawler.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/spleef/kits/KitLeaper.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/spleef/kits/KitLeaper.class new file mode 100644 index 000000000..1a5edd4ac Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/spleef/kits/KitLeaper.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/turfforts/TurfForts$1.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/turfforts/TurfForts$1.class new file mode 100644 index 000000000..859ab0eda Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/turfforts/TurfForts$1.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/turfforts/TurfForts.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/turfforts/TurfForts.class new file mode 100644 index 000000000..061f3fa9a Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/turfforts/TurfForts.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/turfforts/kits/KitInfiltrator.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/turfforts/kits/KitInfiltrator.class new file mode 100644 index 000000000..fff1b1b56 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/turfforts/kits/KitInfiltrator.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/turfforts/kits/KitMarksman.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/turfforts/kits/KitMarksman.class new file mode 100644 index 000000000..4adb60ea6 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/turfforts/kits/KitMarksman.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/turfforts/kits/KitShredder.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/turfforts/kits/KitShredder.class new file mode 100644 index 000000000..ab2573d52 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/turfforts/kits/KitShredder.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/undeadescape/GiantData.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/undeadescape/GiantData.class new file mode 100644 index 000000000..e5f611814 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/undeadescape/GiantData.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/undeadescape/UndeadEscape$1.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/undeadescape/UndeadEscape$1.class new file mode 100644 index 000000000..75b23bcd8 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/undeadescape/UndeadEscape$1.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/undeadescape/UndeadEscape.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/undeadescape/UndeadEscape.class new file mode 100644 index 000000000..cc0179864 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/minigames/undeadescape/UndeadEscape.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/Bridge.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/Bridge.class new file mode 100644 index 000000000..876f2013a Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/Bridge.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/BridgePart.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/BridgePart.class new file mode 100644 index 000000000..5ecac4df7 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/BridgePart.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitApple.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitApple.class new file mode 100644 index 000000000..79dac49d5 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitApple.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitArcher.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitArcher.class new file mode 100644 index 000000000..9f76daa94 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitArcher.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitBeserker.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitBeserker.class new file mode 100644 index 000000000..364001e3c Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitBeserker.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitBomber.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitBomber.class new file mode 100644 index 000000000..b6c87c792 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitBomber.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitMammoth.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitMammoth.class new file mode 100644 index 000000000..69bf907bd Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitMammoth.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitMiner.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitMiner.class new file mode 100644 index 000000000..fdaa6e851 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/bridge/kits/KitMiner.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/CastleSiege$1.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/CastleSiege$1.class new file mode 100644 index 000000000..ed0bdeb05 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/CastleSiege$1.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/CastleSiege.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/CastleSiege.class new file mode 100644 index 000000000..b558a8dd6 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/CastleSiege.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanElementalist.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanElementalist.class new file mode 100644 index 000000000..da4797023 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanElementalist.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanKnight.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanKnight.class new file mode 100644 index 000000000..29d5ebe87 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanKnight.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanMarksman.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanMarksman.class new file mode 100644 index 000000000..2d3a213f3 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanMarksman.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanPeasant.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanPeasant.class new file mode 100644 index 000000000..88186081f Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanPeasant.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadArcher.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadArcher.class new file mode 100644 index 000000000..7e473eb93 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadArcher.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadGhoul.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadGhoul.class new file mode 100644 index 000000000..743feebe1 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadGhoul.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadZombie.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadZombie.class new file mode 100644 index 000000000..81fa44cec Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadZombie.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/smash/SuperSmash.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/smash/SuperSmash.class new file mode 100644 index 000000000..dca71141d Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/smash/SuperSmash.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/smash/kits/KitEnderman.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/smash/kits/KitEnderman.class new file mode 100644 index 000000000..e8d6d5fda Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/smash/kits/KitEnderman.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/smash/kits/KitSkeleton.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/smash/kits/KitSkeleton.class new file mode 100644 index 000000000..a3bc9f857 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/smash/kits/KitSkeleton.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/smash/kits/KitSlime.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/smash/kits/KitSlime.class new file mode 100644 index 000000000..df50a4fa7 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/smash/kits/KitSlime.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/ZombieData.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/ZombieData.class new file mode 100644 index 000000000..076092f24 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/ZombieData.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/ZombieSurvival$1.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/ZombieSurvival$1.class new file mode 100644 index 000000000..1ab3768c5 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/ZombieSurvival$1.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/ZombieSurvival.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/ZombieSurvival.class new file mode 100644 index 000000000..9af1eba35 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/ZombieSurvival.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorArcher.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorArcher.class new file mode 100644 index 000000000..abd00ec84 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorArcher.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorKnight.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorKnight.class new file mode 100644 index 000000000..e2d1af88d Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorKnight.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorRogue.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorRogue.class new file mode 100644 index 000000000..67d8600fd Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorRogue.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitUndeadAlpha.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitUndeadAlpha.class new file mode 100644 index 000000000..dd52517bc Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitUndeadAlpha.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitUndeadZombie.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitUndeadZombie.class new file mode 100644 index 000000000..504fea1be Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitUndeadZombie.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/Kit.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/Kit.class new file mode 100644 index 000000000..3c28096c3 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/Kit.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/KitAvailability.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/KitAvailability.class new file mode 100644 index 000000000..a39c546c9 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/KitAvailability.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/NullKit.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/NullKit.class new file mode 100644 index 000000000..74690fb5b Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/NullKit.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/Perk.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/Perk.class new file mode 100644 index 000000000..2ebc8cf6a Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/Perk.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkApple.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkApple.class new file mode 100644 index 000000000..d7fa9910d Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkApple.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkArrowRebound.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkArrowRebound.class new file mode 100644 index 000000000..9c7a45b22 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkArrowRebound.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkAxeman.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkAxeman.class new file mode 100644 index 000000000..e449507f3 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkAxeman.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkBarrage.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkBarrage.class new file mode 100644 index 000000000..d407160e2 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkBarrage.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkBlink.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkBlink.class new file mode 100644 index 000000000..b154db0ae Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkBlink.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkBomber.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkBomber.class new file mode 100644 index 000000000..2e072b69b Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkBomber.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkConstructor.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkConstructor.class new file mode 100644 index 000000000..98d254bdc Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkConstructor.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkDigger.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkDigger.class new file mode 100644 index 000000000..c1e9e3b0e Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkDigger.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkDoubleJump.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkDoubleJump.class new file mode 100644 index 000000000..1bb7af6cd Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkDoubleJump.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkExplode.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkExplode.class new file mode 100644 index 000000000..e69dbbb6e Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkExplode.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkFallDamage.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkFallDamage.class new file mode 100644 index 000000000..0adb56eed Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkFallDamage.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkFlamingSword.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkFlamingSword.class new file mode 100644 index 000000000..ef29d6aef Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkFlamingSword.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkFletcher.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkFletcher.class new file mode 100644 index 000000000..2ebb3c297 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkFletcher.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkFood.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkFood.class new file mode 100644 index 000000000..b44cef2e7 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkFood.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkIronSkin.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkIronSkin.class new file mode 100644 index 000000000..4f9afc98a Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkIronSkin.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkKnockback.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkKnockback.class new file mode 100644 index 000000000..8a82feb86 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkKnockback.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkLeaper.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkLeaper.class new file mode 100644 index 000000000..1586054dc Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkLeaper.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkMammoth.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkMammoth.class new file mode 100644 index 000000000..c1d657890 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkMammoth.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkNull.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkNull.class new file mode 100644 index 000000000..ed9ce2cb2 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkNull.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkOreFinder.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkOreFinder.class new file mode 100644 index 000000000..bd74ae8bf Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkOreFinder.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkQuickshot.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkQuickshot.class new file mode 100644 index 000000000..347e7502a Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkQuickshot.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkRecharge.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkRecharge.class new file mode 100644 index 000000000..eac592c85 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkRecharge.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkRegeneration.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkRegeneration.class new file mode 100644 index 000000000..b961b3a42 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkRegeneration.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkSlam.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkSlam.class new file mode 100644 index 000000000..091145732 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkSlam.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkSmasher.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkSmasher.class new file mode 100644 index 000000000..881abe03a Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkSmasher.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkSparkler.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkSparkler.class new file mode 100644 index 000000000..689779e1b Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkSparkler.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkSpeed.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkSpeed.class new file mode 100644 index 000000000..159aa6f2a Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkSpeed.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkStrength.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkStrength.class new file mode 100644 index 000000000..90b9f7a1b Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkStrength.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkVampire.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkVampire.class new file mode 100644 index 000000000..4e844f441 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkVampire.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkWeb.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkWeb.class new file mode 100644 index 000000000..baf90931a Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/PerkWeb.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/data/ReboundData.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/data/ReboundData.class new file mode 100644 index 000000000..550a79ca8 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/data/ReboundData.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/event/PerkLeapEvent.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/event/PerkLeapEvent.class new file mode 100644 index 000000000..87e0d05ba Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/kit/perks/event/PerkLeapEvent.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameChatManager.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameChatManager.class new file mode 100644 index 000000000..62c337452 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameChatManager.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameCreationManager.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameCreationManager.class new file mode 100644 index 000000000..4c604db3a Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameCreationManager.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameFlagManager.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameFlagManager.class new file mode 100644 index 000000000..4283c349a Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameFlagManager.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameGemManager.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameGemManager.class new file mode 100644 index 000000000..f68f0e868 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameGemManager.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameLobbyManager.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameLobbyManager.class new file mode 100644 index 000000000..39e9233ef Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameLobbyManager.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameManager.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameManager.class new file mode 100644 index 000000000..1b56a5871 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameManager.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GamePlayerManager$1.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GamePlayerManager$1.class new file mode 100644 index 000000000..99b91c96a Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GamePlayerManager$1.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GamePlayerManager.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GamePlayerManager.class new file mode 100644 index 000000000..0bf21c3c4 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GamePlayerManager.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameWorldManager.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameWorldManager.class new file mode 100644 index 000000000..203dddf32 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/GameWorldManager.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/LobbyEnt.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/LobbyEnt.class new file mode 100644 index 000000000..70ab94ea6 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/LobbyEnt.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/MiscManager.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/MiscManager.class new file mode 100644 index 000000000..8b81a99f7 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/managers/MiscManager.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/ore/OreHider.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/ore/OreHider.class new file mode 100644 index 000000000..6fc6bcfbe Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/ore/OreHider.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/ore/OreObsfucation.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/ore/OreObsfucation.class new file mode 100644 index 000000000..c85e80518 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/ore/OreObsfucation.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/player/ArcadePlayer.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/player/ArcadePlayer.class new file mode 100644 index 000000000..e8fe80084 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/player/ArcadePlayer.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/shop/ArcadeShop.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/shop/ArcadeShop.class new file mode 100644 index 000000000..1e5674df5 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/shop/ArcadeShop.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/shop/KitPackage.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/shop/KitPackage.class new file mode 100644 index 000000000..a553224ed Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/shop/KitPackage.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/world/FireworkHandler.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/world/FireworkHandler.class new file mode 100644 index 000000000..1474316ec Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/world/FireworkHandler.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/world/WorldData$1$1.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/world/WorldData$1$1.class new file mode 100644 index 000000000..593078089 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/world/WorldData$1$1.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/world/WorldData$1.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/world/WorldData$1.class new file mode 100644 index 000000000..83e3da0c6 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/world/WorldData$1.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/world/WorldData.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/world/WorldData.class new file mode 100644 index 000000000..3d9e998ab Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/world/WorldData.class differ diff --git a/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/world/WorldParser.class b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/world/WorldParser.class new file mode 100644 index 000000000..abd442ee5 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/bin/nautilus/game/arcade/world/WorldParser.class differ diff --git a/Plugins/Nautilus.Game.Arcade/plugin.yml b/Plugins/Nautilus.Game.Arcade/plugin.yml new file mode 100644 index 000000000..808eefbe4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/plugin.yml @@ -0,0 +1,3 @@ +name: Arcade +main: nautilus.game.arcade.Arcade +version: 0.1 \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java new file mode 100644 index 000000000..6f781339a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -0,0 +1,448 @@ +package nautilus.game.arcade; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.InputStreamReader; + +import me.chiss.Core.Config.Config; +import mineplex.core.account.CoreClientManager; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.command.CommandCenter; +import mineplex.core.common.util.FileUtil; +import mineplex.core.common.util.UtilServer; +import mineplex.core.creature.Creature; +import mineplex.core.donation.DonationManager; +import mineplex.core.energy.Energy; +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Loot.LootFactory; +import me.chiss.Core.Module.ModuleManager; +import me.chiss.Core.Modules.*; +import me.chiss.Core.Plugin.IPlugin; +import me.chiss.Core.Scheduler.Scheduler; +import mineplex.core.message.MessageManager; +import mineplex.core.npc.NpcManager; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.pet.PetManager; +import mineplex.core.projectile.ProjectileManager; +import mineplex.core.punish.Punish; +import mineplex.core.recharge.Recharge; +import mineplex.core.spawn.Spawn; +import mineplex.core.teleport.Teleport; +import mineplex.core.updater.Updater; +import mineplex.minecraft.game.core.combat.CombatManager; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.damage.DamageManager; +import mineplex.minecraft.game.core.fire.Fire; + +import nautilus.game.arcade.game.GameServerConfig; +import nautilus.minecraft.core.INautilusPlugin; + +import org.bukkit.Location; +import org.bukkit.Server; +import org.bukkit.entity.Player; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; + +public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin +{ + private String WEB_CONFIG = "webServer"; + + //Modules + private ModuleManager _moduleManager; + private Config _config; + private CoreClientManager _clientManager; + private DonationManager _donationManager; + private DamageManager _damageManager; + private Utility _utility; + private BlockRegenerate _blockRegenerate; + private BlockRestore _blockRestore; + private Blood _blood; + private ConditionManager _condition; + private Creature _creature; + private Fire _fire; + private Logger _logger; + private LootFactory _lootFactory; + private Observer _observer; + private PetManager _petManager; + private me.chiss.Core.Server.Server _serverModule; + private Spawn _spawn; + private Teleport _teleport; + private ProjectileManager _throw; + + private ArcadeManager _gameManager; + + @Override + public void onEnable() + { + //Delete Old Games Folders + DeleteFolders(); + + //Configs + getConfig().addDefault(WEB_CONFIG, "http://api.mineplex.com/"); + getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); + saveConfig(); + + //Init Modules + GetModules(); + + _clientManager = CoreClientManager.Initialize(this, GetWebServerAddress()); + _donationManager = new DonationManager(this, GetWebServerAddress()); + CommandCenter.Initialize(this, _clientManager); + ItemStackFactory.Initialize(this, false); + Recharge.Initialize(this); + + ConditionManager conditionManager = new ConditionManager(this); + + new MessageManager(this, _clientManager); + + + GetBlood(); + GetCreature(); + GetSpawn(); + GetTeleport(); + + _damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, GetCreature())); + + //Arcade Manager + _gameManager = new ArcadeManager(this, ReadServerConfig(), _clientManager, _donationManager, conditionManager, _damageManager, GetCreature(), new PacketHandler(this)); + + //Unreferenced Modules + //new AntiStack(); + Scheduler.Initialize(this); + //new Information(this); + new Punish(this, GetWebServerAddress()); + //Updates + getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); + } + + + @Override + public void onDisable() + { + GetModules().onDisable(); + + for (Player player : UtilServer.getPlayers()) + player.kickPlayer("Server Shutdown"); + + if (_gameManager.GetGame() != null) + if (_gameManager.GetGame().WorldData != null) + _gameManager.GetGame().WorldData.Uninitialize(); + } + + public GameServerConfig ReadServerConfig() + { + GameServerConfig config = new GameServerConfig(); + + //Load Track Data + String line = null; + + try + { + File file = new File("ArcadeSettings.config"); + if (!file.exists()) + WriteServerConfig(GetDefaultConfig()); + + FileInputStream fstream = new FileInputStream("ArcadeSettings.config"); + DataInputStream in = new DataInputStream(fstream); + BufferedReader br = new BufferedReader(new InputStreamReader(in)); + + while ((line = br.readLine()) != null) + { + String[] tokens = line.split("="); + + if (tokens.length < 2) + continue; + + if (tokens[0].equals("SERVER_TYPE")) + { + config.ServerType = tokens[1]; + } + else if (tokens[0].equals("PLAYERS_MIN")) + { + config.MinPlayers = Integer.parseInt(tokens[1]); + } + else if (tokens[0].equals("PLAYERS_MAX")) + { + config.MaxPlayers = Integer.parseInt(tokens[1]); + } + //Games + else + { + try + { + GameType type = GameType.valueOf(tokens[0]); + boolean enabled = Boolean.valueOf(tokens[1]); + + if (enabled) + config.GameList.add(type); + } + catch (Exception e) + { + + } + } + + } + + in.close(); + } + catch (Exception e) + { + + } + + if (!config.IsValid()) + config = GetDefaultConfig(); + + WriteServerConfig(config); + return config; + } + + public GameServerConfig GetDefaultConfig() + { + GameServerConfig config = new GameServerConfig(); + + config.ServerType = "Minigames"; + config.MinPlayers = 8; + config.MaxPlayers = 16; + + return config; + } + + public void WriteServerConfig(GameServerConfig config) + { + try + { + FileWriter fstream = new FileWriter("ArcadeSettings.config"); + BufferedWriter out = new BufferedWriter(fstream); + + out.write("SERVER_TYPE=" + config.ServerType + "\n"); + out.write("PLAYERS_MIN=" + config.MinPlayers + "\n"); + out.write("PLAYERS_MAX=" + config.MaxPlayers + "\n"); + out.write("\n\nGames List;\n"); + + for (GameType type : GameType.values()) + { + out.write(type.toString() + "=" + config.GameList.contains(type) + "\n"); + } + + out.close(); + } + catch (Exception e) + { + + } + } + + private void DeleteFolders() + { + File curDir = new File("."); + + File[] filesList = curDir.listFiles(); + for(File file : filesList) + { + if (!file.isDirectory()) + continue; + + if (file.getName().length() < 4) + continue; + + if (!file.getName().substring(0, 4).equalsIgnoreCase("Game")) + continue; + + FileUtil.DeleteFolder(file); + + System.out.println("Deleted Old Game: " + file.getName()); + } + } + + @Override + public JavaPlugin GetPlugin() + { + return this; + } + + @Override + public String GetWebServerAddress() + { + String webServerAddress = getConfig().getString(WEB_CONFIG); + + return webServerAddress; + } + + @Override + public Server GetRealServer() + { + return getServer(); + } + + @Override + public PluginManager GetPluginManager() + { + return GetRealServer().getPluginManager(); + } + + @Override + public void Log(String moduleName, String data) + { + System.out.println(moduleName + " : " + data); + } + + @Override + public ModuleManager GetModules() + { + if (_moduleManager == null) + _moduleManager = new ModuleManager(); + + return _moduleManager; + } + + @Override + public Config GetConfig() + { + if (_config == null) + _config = new Config(this); + + return _config; + } + + @Override + public Utility GetUtility() + { + if (_utility == null) + _utility = new Utility(this); + + return _utility; + } + + @Override + public BlockRegenerate GetBlockRegenerate() + { + if (_blockRegenerate == null) + _blockRegenerate = new BlockRegenerate(this); + + return _blockRegenerate; + } + + @Override + public BlockRestore GetBlockRestore() + { + if (_blockRestore == null) + _blockRestore = new BlockRestore(this); + + return _blockRestore; + } + + @Override + public Blood GetBlood() + { + if (_blood == null) + _blood = new Blood(this); + + return _blood; + } + + @Override + public Creature GetCreature() + { + if (_creature == null) + _creature = new Creature(this); + + return _creature; + } + + + @Override + public Fire GetFire() + { + if (_fire == null) + _fire = new Fire(this, _condition, _damageManager); + + return _fire; + } + + @Override + public Logger GetLogger() + { + if (_logger == null) + _logger = new Logger(this); + + return _logger; + } + + @Override + public LootFactory GetLoot() + { + if (_lootFactory == null) + _lootFactory = new LootFactory(this); + + return _lootFactory; + } + + @Override + public Observer GetObserver() + { + if (_observer == null) + _observer = new Observer(this); + + return _observer; + } + + @Override + public me.chiss.Core.Server.Server GetServer() + { + if (_serverModule == null) + _serverModule = new me.chiss.Core.Server.Server(this, _clientManager); + + return _serverModule; + } + + @Override + public Spawn GetSpawn() + { + if (_spawn == null) + _spawn = new Spawn(this); + + return _spawn; + } + + @Override + public Teleport GetTeleport() + { + if (_teleport == null) + _teleport = new Teleport(this, _clientManager, GetSpawn()); + + return _teleport; + } + + @Override + public ProjectileManager GetThrow() + { + if (_throw == null) + _throw = new ProjectileManager(this); + + return _throw; + } + + @Override + public Location GetSpawnLocation() + { + return null; + } + + @Override + public PetManager GetPetManager() + { + return _petManager; + } + + @Override + public Energy GetEnergy() + { + return null; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java.orig b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java.orig new file mode 100644 index 000000000..b2769299c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java.orig @@ -0,0 +1,452 @@ +package nautilus.game.arcade; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.InputStreamReader; + +import me.chiss.Core.Config.Config; +import mineplex.core.account.CoreClientManager; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.command.CommandCenter; +import mineplex.core.common.util.FileUtil; +import mineplex.core.common.util.UtilServer; +import mineplex.core.creature.Creature; +import mineplex.core.donation.DonationManager; +import mineplex.core.energy.Energy; +import mineplex.core.explosion.Explosion; +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Loot.LootFactory; +import me.chiss.Core.Module.ModuleManager; +import me.chiss.Core.Modules.*; +import me.chiss.Core.Plugin.IPlugin; +import me.chiss.Core.Scheduler.Scheduler; +import mineplex.core.message.MessageManager; +import mineplex.core.npc.NpcManager; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.pet.PetManager; +import mineplex.core.projectile.ProjectileManager; +import mineplex.core.punish.Punish; +import mineplex.core.recharge.Recharge; +import mineplex.core.spawn.Spawn; +import mineplex.core.teleport.Teleport; +import mineplex.core.updater.Updater; +import mineplex.minecraft.game.core.combat.CombatManager; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.damage.DamageManager; +import mineplex.minecraft.game.core.fire.Fire; + +import nautilus.game.arcade.game.GameServerConfig; +import nautilus.minecraft.core.INautilusPlugin; + +import org.bukkit.Location; +import org.bukkit.Server; +import org.bukkit.entity.Player; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; + +public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin +{ + private String WEB_CONFIG = "webServer"; + + //Modules + private ModuleManager _moduleManager; + private Config _config; + private CoreClientManager _clientManager; + private DonationManager _donationManager; + private DamageManager _damageManager; + private Utility _utility; + private BlockRegenerate _blockRegenerate; + private BlockRestore _blockRestore; + private Blood _blood; + private ConditionManager _condition; + private Creature _creature; + private Fire _fire; + private Logger _logger; + private LootFactory _lootFactory; + private Observer _observer; + private PetManager _petManager; + private me.chiss.Core.Server.Server _serverModule; + private Spawn _spawn; + private Teleport _teleport; + private ProjectileManager _throw; + + private ArcadeManager _gameManager; + + @Override + public void onEnable() + { + //Delete Old Games Folders + DeleteFolders(); + + //Configs + getConfig().addDefault(WEB_CONFIG, "http://api.mineplex.com/"); + getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); + saveConfig(); + + //Init Modules + GetModules(); + + _clientManager = CoreClientManager.Initialize(this, GetWebServerAddress()); + _donationManager = new DonationManager(this, GetWebServerAddress()); + CommandCenter.Initialize(this, _clientManager); + ItemStackFactory.Initialize(this, false); + Recharge.Initialize(this); + + ConditionManager conditionManager = new ConditionManager(this); + + Explosion explosion = new Explosion(this, new BlockRestore(this)); + explosion.SetDebris(false); + + new MessageManager(this, _clientManager); + + + GetBlood(); + GetCreature(); + GetSpawn(); + GetTeleport(); + + _damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, GetCreature())); + + //Arcade Manager + _gameManager = new ArcadeManager(this, ReadServerConfig(), _clientManager, _donationManager, conditionManager, _damageManager, GetCreature(), new PacketHandler(this)); + + //Unreferenced Modules + //new AntiStack(); + Scheduler.Initialize(this); + //new Information(this); + new Punish(this, GetWebServerAddress()); + //Updates + getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); + } + + + @Override + public void onDisable() + { + GetModules().onDisable(); + + for (Player player : UtilServer.getPlayers()) + player.kickPlayer("Server Shutdown"); + + if (_gameManager.GetGame() != null) + if (_gameManager.GetGame().WorldData != null) + _gameManager.GetGame().WorldData.Uninitialize(); + } + + public GameServerConfig ReadServerConfig() + { + GameServerConfig config = new GameServerConfig(); + + //Load Track Data + String line = null; + + try + { + File file = new File("ArcadeSettings.config"); + if (!file.exists()) + WriteServerConfig(GetDefaultConfig()); + + FileInputStream fstream = new FileInputStream("ArcadeSettings.config"); + DataInputStream in = new DataInputStream(fstream); + BufferedReader br = new BufferedReader(new InputStreamReader(in)); + + while ((line = br.readLine()) != null) + { + String[] tokens = line.split("="); + + if (tokens.length < 2) + continue; + + if (tokens[0].equals("SERVER_TYPE")) + { + config.ServerType = tokens[1]; + } + else if (tokens[0].equals("PLAYERS_MIN")) + { + config.MinPlayers = Integer.parseInt(tokens[1]); + } + else if (tokens[0].equals("PLAYERS_MAX")) + { + config.MaxPlayers = Integer.parseInt(tokens[1]); + } + //Games + else + { + try + { + GameType type = GameType.valueOf(tokens[0]); + boolean enabled = Boolean.valueOf(tokens[1]); + + if (enabled) + config.GameList.add(type); + } + catch (Exception e) + { + + } + } + + } + + in.close(); + } + catch (Exception e) + { + + } + + if (!config.IsValid()) + config = GetDefaultConfig(); + + WriteServerConfig(config); + return config; + } + + public GameServerConfig GetDefaultConfig() + { + GameServerConfig config = new GameServerConfig(); + + config.ServerType = "Minigames"; + config.MinPlayers = 8; + config.MaxPlayers = 16; + + return config; + } + + public void WriteServerConfig(GameServerConfig config) + { + try + { + FileWriter fstream = new FileWriter("ArcadeSettings.config"); + BufferedWriter out = new BufferedWriter(fstream); + + out.write("SERVER_TYPE=" + config.ServerType + "\n"); + out.write("PLAYERS_MIN=" + config.MinPlayers + "\n"); + out.write("PLAYERS_MAX=" + config.MaxPlayers + "\n"); + out.write("\n\nGames List;\n"); + + for (GameType type : GameType.values()) + { + out.write(type.toString() + "=" + config.GameList.contains(type) + "\n"); + } + + out.close(); + } + catch (Exception e) + { + + } + } + + private void DeleteFolders() + { + File curDir = new File("."); + + File[] filesList = curDir.listFiles(); + for(File file : filesList) + { + if (!file.isDirectory()) + continue; + + if (file.getName().length() < 4) + continue; + + if (!file.getName().substring(0, 4).equalsIgnoreCase("Game")) + continue; + + FileUtil.DeleteFolder(file); + + System.out.println("Deleted Old Game: " + file.getName()); + } + } + + @Override + public JavaPlugin GetPlugin() + { + return this; + } + + @Override + public String GetWebServerAddress() + { + String webServerAddress = getConfig().getString(WEB_CONFIG); + + return webServerAddress; + } + + @Override + public Server GetRealServer() + { + return getServer(); + } + + @Override + public PluginManager GetPluginManager() + { + return GetRealServer().getPluginManager(); + } + + @Override + public void Log(String moduleName, String data) + { + System.out.println(moduleName + " : " + data); + } + + @Override + public ModuleManager GetModules() + { + if (_moduleManager == null) + _moduleManager = new ModuleManager(); + + return _moduleManager; + } + + @Override + public Config GetConfig() + { + if (_config == null) + _config = new Config(this); + + return _config; + } + + @Override + public Utility GetUtility() + { + if (_utility == null) + _utility = new Utility(this); + + return _utility; + } + + @Override + public BlockRegenerate GetBlockRegenerate() + { + if (_blockRegenerate == null) + _blockRegenerate = new BlockRegenerate(this); + + return _blockRegenerate; + } + + @Override + public BlockRestore GetBlockRestore() + { + if (_blockRestore == null) + _blockRestore = new BlockRestore(this); + + return _blockRestore; + } + + @Override + public Blood GetBlood() + { + if (_blood == null) + _blood = new Blood(this); + + return _blood; + } + + @Override + public Creature GetCreature() + { + if (_creature == null) + _creature = new Creature(this); + + return _creature; + } + + + @Override + public Fire GetFire() + { + if (_fire == null) + _fire = new Fire(this, _condition, _damageManager); + + return _fire; + } + + @Override + public Logger GetLogger() + { + if (_logger == null) + _logger = new Logger(this); + + return _logger; + } + + @Override + public LootFactory GetLoot() + { + if (_lootFactory == null) + _lootFactory = new LootFactory(this); + + return _lootFactory; + } + + @Override + public Observer GetObserver() + { + if (_observer == null) + _observer = new Observer(this); + + return _observer; + } + + @Override + public me.chiss.Core.Server.Server GetServer() + { + if (_serverModule == null) + _serverModule = new me.chiss.Core.Server.Server(this, _clientManager); + + return _serverModule; + } + + @Override + public Spawn GetSpawn() + { + if (_spawn == null) + _spawn = new Spawn(this); + + return _spawn; + } + + @Override + public Teleport GetTeleport() + { + if (_teleport == null) + _teleport = new Teleport(this, _clientManager, GetSpawn()); + + return _teleport; + } + + @Override + public ProjectileManager GetThrow() + { + if (_throw == null) + _throw = new ProjectileManager(this); + + return _throw; + } + + @Override + public Location GetSpawnLocation() + { + return null; + } + + @Override + public PetManager GetPetManager() + { + return _petManager; + } + + @Override + public Energy GetEnergy() + { + return null; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeFormat.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeFormat.java new file mode 100644 index 000000000..3d817a2fa --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeFormat.java @@ -0,0 +1,8 @@ +package nautilus.game.arcade; + +import mineplex.core.common.util.C; + +public class ArcadeFormat +{ + public static String Line = C.cDGreen + C.Strike + "============================================="; +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java new file mode 100644 index 000000000..a8ea48ce4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -0,0 +1,459 @@ +package nautilus.game.arcade; + +import java.io.File; +import java.util.ArrayList; + +import nautilus.game.arcade.addons.*; +import nautilus.game.arcade.command.*; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameServerConfig; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.managers.*; +import nautilus.game.arcade.shop.ArcadeShop; +import nautilus.game.arcade.world.FireworkHandler; + +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.minecraft.game.core.IRelation; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.DamageManager; +import mineplex.minecraft.game.core.fire.Fire; +import me.chiss.Core.Chat.Chat; +import mineplex.core.MiniPlugin; +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Plugin.IChat; +import mineplex.core.account.CoreClientManager; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.util.*; +import mineplex.core.creature.Creature; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.explosion.Explosion; +import mineplex.core.portal.Portal; +import mineplex.core.projectile.ProjectileManager; + +public class ArcadeManager extends MiniPlugin implements IRelation, IChat +{ + //Modules + private BlockRestore _blockRestore; + private Chat _chat; + private CoreClientManager _clientManager; + private DisguiseManager _disguiseManager; + private DonationManager _donationManager; + private ConditionManager _conditionManager; + private Creature _creature; + private DamageManager _damageManager; + private Explosion _explosionManager; + private Fire _fire; + private FireworkHandler _firework; + private ProjectileManager _projectileManager; + + private Portal _portal; + private ArcadeShop _arcadeShop; + + //Managers + private GameFactory _gameFactory; + private GameChatManager _gameChatManager; + private GameCreationManager _gameCreationManager; + private GameGemManager _gameGemManager; + private GameManager _gameManager; + private GameLobbyManager _gameLobbyManager; + private GameWorldManager _gameWorldManager; + + //Server Games + private GameServerConfig _serverConfig; + + //Games + private Game _game; + + public ArcadeManager(JavaPlugin plugin, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DamageManager damageManager, Creature creature, PacketHandler packetHandler) + { + super("Game Manager", plugin); + + _serverConfig = serverConfig; + + //Modules + _blockRestore = new BlockRestore(plugin); + + _explosionManager = new Explosion(plugin, _blockRestore); + _explosionManager.SetDebris(false); + + _conditionManager = conditionManager; + + _clientManager = clientManager; + + _chat = new Chat(plugin, _clientManager, this); + + _creature = creature; + + _damageManager = damageManager; + _damageManager.UseDefaultWeaponDamage = true; + + _disguiseManager = new DisguiseManager(plugin, packetHandler); + + _donationManager = donationManager; + + _firework = new FireworkHandler(); + + _projectileManager = new ProjectileManager(plugin); + + _fire = new Fire(plugin, conditionManager, damageManager); + + _portal = new Portal(plugin); + + //Shop + _arcadeShop = new ArcadeShop(this, clientManager, donationManager); + + //Game Factory + _gameFactory = new GameFactory(this); + + //Managers + _gameChatManager = new GameChatManager(this); + _gameCreationManager = new GameCreationManager(this); + _gameGemManager = new GameGemManager(this); + _gameManager = new GameManager(this); + _gameLobbyManager = new GameLobbyManager(this, packetHandler); + new GameFlagManager(this); + new GamePlayerManager(this); + _gameWorldManager = new GameWorldManager(this); + new MiscManager(this); + + //Game Addons + new CompassAddon(plugin, this); + new SoupAddon(plugin, this); + } + + @Override + public void AddCommands() + { + AddCommand(new GameCommand(this)); + AddCommand(new ParseCommand(this)); + AddCommand(new GemCommand(this)); + AddCommand(new WriteCommand(this)); + } + + public GameServerConfig GetServerConfig() + { + return _serverConfig; + } + + public ArrayList GetGameList() + { + return GetServerConfig().GameList; + } + + public Chat GetChat() + { + return _chat; + } + + public BlockRestore GetBlockRestore() + { + return _blockRestore; + } + + public CoreClientManager GetClients() + { + return _clientManager; + } + + public ConditionManager GetCondition() + { + return _conditionManager; + } + + public Creature GetCreature() + { + return _creature; + } + + public DisguiseManager GetDisguise() + { + return _disguiseManager; + } + + public DamageManager GetDamage() + { + return _damageManager; + } + + public DonationManager GetDonation() + { + return _donationManager; + } + + public Fire GetFire() + { + return _fire; + } + + public FireworkHandler GetFirework() + { + return _firework; + } + + public ProjectileManager GetProjectile() + { + return _projectileManager; + } + + public GameLobbyManager GetLobby() + { + return _gameLobbyManager; + } + + public ArcadeShop GetShop() + { + return _arcadeShop; + } + + public GameCreationManager GetGameCreationManager() + { + return _gameCreationManager; + } + + public GameFactory GetGameFactory() + { + return _gameFactory; + } + + public GameManager GetGameManager() + { + return _gameManager; + } + + public GameGemManager GetGameGemManager() + { + return _gameGemManager; + } + + public GameWorldManager GetGameWorldManager() + { + return _gameWorldManager; + } + + public ChatColor GetColor(Player player) + { + if (_game == null) + return ChatColor.GRAY; + + GameTeam team = _game.GetTeam(player); + if (team == null) + return ChatColor.GRAY; + + return team.GetColor(); + } + + @Override + public void HandleChat(AsyncPlayerChatEvent event, String filteredMessage) + { + _gameChatManager.HandleChat(event, filteredMessage); + } + + @Override + public boolean CanHurt(String a, String b) + { + return CanHurt(UtilPlayer.searchExact(a), UtilPlayer.searchExact(b)); + } + + public boolean CanHurt(Player pA, Player pB) + { + if (pA == null || pB == null) + return false; + + if (!_game.Damage) + return false; + + if (!_game.DamagePvP) + return false; + + //Self Damage + if (pA.equals(pB)) + return _game.DamageSelf; + + GameTeam tA = _game.GetTeam(pA); + if (tA == null) + return false; + + GameTeam tB = _game.GetTeam(pB); + if (tB == null) + return false; + + if (tA.equals(tB) && !_game.DamageTeamSelf) + return false; + + if (!tA.equals(tB) && !_game.DamageTeamOther) + return false; + + return true; + } + + @Override + public boolean IsSafe(Player player) + { + if (_game == null) + return true; + + if (_game.IsPlaying(player)) + return false; + + return true; + } + + @EventHandler + public void MessageMOTD(ServerListPingEvent event) + { + if (_game == null || _game.GetState() == GameState.Recruit) + { + if (_game != null && _game.GetCountdown() != -1) + { + event.setMotd(ChatColor.GREEN + "Starting in " + _game.GetCountdown() + " Seconds"); + } + else + { + event.setMotd(ChatColor.GREEN + "Recruiting"); + } + + } + else + { + event.setMotd(ChatColor.YELLOW + "In Progress"); + } + } + + @EventHandler + public void MessageJoin(PlayerJoinEvent event) + { + event.setJoinMessage(F.sys("Join", event.getPlayer().getName())); + } + + @EventHandler + public void MessageQuit(PlayerQuitEvent event) + { + event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + event.getPlayer().getName())); + } + + + + public Game GetGame() + { + return _game; + } + + public void SetGame(Game game) + { + _game = game; + } + + public int GetPlayerMin() + { + return GetServerConfig().MinPlayers; + } + + public int GetPlayerFull() + { + return GetServerConfig().MaxPlayers; + } + + + + public void HubClock(Player player) + { + player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte)0, 1, (short)0, C.cGreen + "Return to Hub", + new String[] {"", ChatColor.RESET + "Click while holding this", ChatColor.RESET + "to return to the Hub."})); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void HubClockInteract(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (player.getItemInHand() == null) + return; + + if (player.getItemInHand().getType() != Material.WATCH) + return; + + if (_game != null && _game.IsAlive(player)) + return; + + _portal.SendPlayerToServer(player, "Lobby"); + } + + public boolean IsAlive(Player player) + { + if (_game == null) + return false; + + return _game.IsAlive(player); + } + + public void Clear(Player player) + { + player.setGameMode(GameMode.SURVIVAL); + player.setAllowFlight(false); + UtilInv.Clear(player); + player.setFoodLevel(20); + player.setHealth(20); + player.setFireTicks(0); + player.setFallDistance(0); + player.setLevel(0); + player.setExp(0f); + ((CraftPlayer)player).getHandle().spectating = false; + ((CraftPlayer)player).getHandle().m = true; + + GetCondition().EndCondition(player, ConditionType.CLOAK, "Spectator"); + + HubClock(player); + + GetDisguise().Undisguise(player); + } + + public ArrayList LoadFiles(String gameName) + { + File folder = new File("maps" + File.separatorChar + gameName); + if (!folder.exists()) folder.mkdirs(); + + ArrayList maps = new ArrayList(); + + System.out.println("Searching Maps in: " + folder); + + for (File file : folder.listFiles()) + { + if (!file.isFile()) + continue; + + String name = file.getName(); + + if (name.length() < 5) + continue; + + name = name.substring(name.length()-4, name.length()); + + if (file.getName().equals(".zip")) + continue; + + maps.add(file.getName().substring(0, file.getName().length()-4)); + } + + for (String map : maps) + System.out.println("Found Map: " + map); + + return maps; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java.orig b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java.orig new file mode 100644 index 000000000..cee354b26 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java.orig @@ -0,0 +1,436 @@ +package nautilus.game.arcade; + +import java.io.File; +import java.util.ArrayList; + +import nautilus.game.arcade.addons.*; +import nautilus.game.arcade.command.*; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameServerConfig; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.managers.*; +import nautilus.game.arcade.shop.ArcadeShop; +import nautilus.game.arcade.world.FireworkHandler; + +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.minecraft.game.core.IRelation; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.DamageManager; +import mineplex.minecraft.game.core.fire.Fire; +import me.chiss.Core.Chat.Chat; +import mineplex.core.MiniPlugin; +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Plugin.IChat; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.*; +import mineplex.core.creature.Creature; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.portal.Portal; + +public class ArcadeManager extends MiniPlugin implements IRelation, IChat +{ + //Modules + private Chat _chat; + private CoreClientManager _clientManager; + private DisguiseManager _disguiseManager; + private DonationManager _donationManager; + private ConditionManager _conditionManager; + private Creature _creature; + private DamageManager _damageManager; + private Fire _fire; + private FireworkHandler _firework; + + private Portal _portal; + private ArcadeShop _arcadeShop; + + //Managers + private GameFactory _gameFactory; + private GameChatManager _gameChatManager; + private GameCreationManager _gameCreationManager; + private GameGemManager _gameGemManager; + private GameManager _gameManager; + private GameLobbyManager _gameLobbyManager; + private GameWorldManager _gameWorldManager; + + //Server Games + private GameServerConfig _serverConfig; + + //Games + private Game _game; + + public ArcadeManager(JavaPlugin plugin, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DamageManager damageManager, Creature creature, PacketHandler packetHandler) + { + super("Game Manager", plugin); + + _serverConfig = serverConfig; + + //Modules + _conditionManager = conditionManager; + + _clientManager = clientManager; + + _chat = new Chat(plugin, _clientManager, this); + + _creature = creature; + + _damageManager = damageManager; + _damageManager.UseDefaultWeaponDamage = true; + + _disguiseManager = new DisguiseManager(plugin, packetHandler); + + _donationManager = donationManager; + + _firework = new FireworkHandler(); + + _fire = new Fire(plugin, conditionManager, damageManager); + + _portal = new Portal(plugin); + + //Shop + _arcadeShop = new ArcadeShop(this, clientManager, donationManager); + + //Game Factory + _gameFactory = new GameFactory(this); + + //Managers + System.out.println("WOOF"); + _gameChatManager = new GameChatManager(this); + _gameCreationManager = new GameCreationManager(this); + _gameGemManager = new GameGemManager(this); + _gameManager = new GameManager(this); + _gameLobbyManager = new GameLobbyManager(this, packetHandler); + new GameFlagManager(this); + new GamePlayerManager(this); + _gameWorldManager = new GameWorldManager(this); + new MiscManager(this); + + //Game Addons + new CompassAddon(plugin, this); + new SoupAddon(plugin, this); + } + + @Override + public void AddCommands() + { + AddCommand(new GameCommand(this)); + AddCommand(new ParseCommand(this)); + AddCommand(new GemCommand(this)); + AddCommand(new WriteCommand(this)); + } + + public GameServerConfig GetServerConfig() + { + return _serverConfig; + } + + public ArrayList GetGameList() + { + return GetServerConfig().GameList; + } + + public Chat GetChat() + { + return _chat; + } + + public CoreClientManager GetClients() + { + return _clientManager; + } + + public ConditionManager GetCondition() + { + return _conditionManager; + } + + public Creature GetCreature() + { + return _creature; + } + + public DisguiseManager GetDisguise() + { + return _disguiseManager; + } + + public DamageManager GetDamage() + { + return _damageManager; + } + + public DonationManager GetDonation() + { + return _donationManager; + } + + public Fire GetFire() + { + return _fire; + } + + public FireworkHandler GetFirework() + { + return _firework; + } + + public GameLobbyManager GetLobby() + { + return _gameLobbyManager; + } + + public ArcadeShop GetShop() + { + return _arcadeShop; + } + + public GameCreationManager GetGameCreationManager() + { + return _gameCreationManager; + } + + public GameFactory GetGameFactory() + { + return _gameFactory; + } + + public GameManager GetGameManager() + { + return _gameManager; + } + + public GameGemManager GetGameGemManager() + { + return _gameGemManager; + } + + public GameWorldManager GetGameWorldManager() + { + return _gameWorldManager; + } + + public ChatColor GetColor(Player player) + { + if (_game == null) + return ChatColor.GRAY; + + GameTeam team = _game.GetTeam(player); + if (team == null) + return ChatColor.GRAY; + + return team.GetColor(); + } + + @Override + public void HandleChat(AsyncPlayerChatEvent event, String filteredMessage) + { + _gameChatManager.HandleChat(event, filteredMessage); + } + + @Override + public boolean CanHurt(String a, String b) + { + return CanHurt(UtilPlayer.searchExact(a), UtilPlayer.searchExact(b)); + } + + public boolean CanHurt(Player pA, Player pB) + { + if (pA == null || pB == null) + return false; + + if (!_game.Damage) + return false; + + if (!_game.DamagePvP) + return false; + + //Self Damage + if (pA.equals(pB)) + return _game.DamageSelf; + + GameTeam tA = _game.GetTeam(pA); + if (tA == null) + return false; + + GameTeam tB = _game.GetTeam(pB); + if (tB == null) + return false; + + if (tA.equals(tB) && !_game.DamageTeamSelf) + return false; + + if (!tA.equals(tB) && !_game.DamageTeamOther) + return false; + + return true; + } + + @Override + public boolean IsSafe(Player player) + { + if (_game == null) + return true; + + if (_game.IsPlaying(player)) + return false; + + return true; + } + + @EventHandler + public void MessageMOTD(ServerListPingEvent event) + { + if (_game == null || _game.GetState() == GameState.Recruit) + { + if (_game != null && _game.GetCountdown() != -1) + { + event.setMotd(ChatColor.GREEN + "Starting in " + _game.GetCountdown() + " Seconds"); + } + else + { + event.setMotd(ChatColor.GREEN + "Recruiting"); + } + + } + else + { + event.setMotd(ChatColor.YELLOW + "In Progress"); + } + } + + @EventHandler + public void MessageJoin(PlayerJoinEvent event) + { + event.setJoinMessage(F.sys("Join", event.getPlayer().getName())); + } + + @EventHandler + public void MessageQuit(PlayerQuitEvent event) + { + event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + event.getPlayer().getName())); + } + + + + public Game GetGame() + { + return _game; + } + + public void SetGame(Game game) + { + _game = game; + } + + public int GetPlayerMin() + { + return GetServerConfig().MinPlayers; + } + + public int GetPlayerFull() + { + return GetServerConfig().MaxPlayers; + } + + + + public void HubClock(Player player) + { + player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte)0, 1, (short)0, C.cGreen + "Return to Hub", + new String[] {"", ChatColor.RESET + "Click while holding this", ChatColor.RESET + "to return to the Hub."})); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void HubClockInteract(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (player.getItemInHand() == null) + return; + + if (player.getItemInHand().getType() != Material.WATCH) + return; + + if (_game != null && _game.IsAlive(player)) + return; + + _portal.SendPlayerToServer(player, "Lobby"); + } + + public boolean IsAlive(Player player) + { + if (_game == null) + return false; + + return _game.IsAlive(player); + } + + public void Clear(Player player) + { + player.setGameMode(GameMode.SURVIVAL); + UtilInv.Clear(player); + player.setFoodLevel(20); + player.setHealth(20); + player.setFireTicks(0); + player.setFallDistance(0); + player.setLevel(0); + player.setExp(0f); + ((CraftPlayer)player).getHandle().spectating = false; + ((CraftPlayer)player).getHandle().m = true; + + GetCondition().EndCondition(player, ConditionType.CLOAK, "Spectator"); + + HubClock(player); + + GetDisguise().Undisguise(player); + } + + public ArrayList LoadFiles(String gameName) + { + File folder = new File("maps" + File.separatorChar + gameName); + if (!folder.exists()) folder.mkdirs(); + + ArrayList maps = new ArrayList(); + + System.out.println("Searching Maps in: " + folder); + + for (File file : folder.listFiles()) + { + if (!file.isFile()) + continue; + + String name = file.getName(); + + if (name.length() < 5) + continue; + + name = name.substring(name.length()-4, name.length()); + + if (file.getName().equals(".zip")) + continue; + + maps.add(file.getName().substring(0, file.getName().length()-4)); + } + + for (String map : maps) + System.out.println("Found Map: " + map); + + return maps; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameFactory.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameFactory.java new file mode 100644 index 000000000..7913be489 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameFactory.java @@ -0,0 +1,48 @@ +package nautilus.game.arcade; + +import java.util.HashMap; + +import org.bukkit.ChatColor; + +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.minigames.dragons.Dragons; +import nautilus.game.arcade.game.minigames.evolution.Evolution; +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.quiver.Quiver; +import nautilus.game.arcade.game.minigames.snowfight.SnowFight; +import nautilus.game.arcade.game.minigames.runner.Runner; +import nautilus.game.arcade.game.minigames.spleef.Spleef; +import nautilus.game.arcade.game.minigames.turfforts.TurfForts; +import nautilus.game.arcade.game.minigames.undeadescape.UndeadEscape; +import nautilus.game.arcade.game.standalone.bridge.Bridge; +import nautilus.game.arcade.game.standalone.castlesiege.CastleSiege; +import nautilus.game.arcade.game.standalone.smash.SuperSmash; +import nautilus.game.arcade.game.standalone.zombiesurvival.ZombieSurvival; + +public class GameFactory +{ + private ArcadeManager _manager; + + public GameFactory(ArcadeManager gameManager) + { + _manager = gameManager; + } + + public Game CreateGame(GameType gameType, HashMap pastTeams) + { + if (gameType == GameType.Bridge) return new Bridge(_manager); + else if (gameType == GameType.Dragons) return new Dragons(_manager); + else if (gameType == GameType.CastleSiege) return new CastleSiege(_manager, pastTeams); + else if (gameType == GameType.MineWare) return new MineWare(_manager); + else if (gameType == GameType.Evolution) return new Evolution(_manager); + else if (gameType == GameType.Quiver) return new Quiver(_manager); + else if (gameType == GameType.Runner) return new Runner(_manager); + else if (gameType == GameType.SnowFight) return new SnowFight(_manager); + else if (gameType == GameType.Smash) return new SuperSmash(_manager); + else if (gameType == GameType.Spleef) return new Spleef(_manager); + else if (gameType == GameType.TurfForts) return new TurfForts(_manager); + else if (gameType == GameType.UndeadEscape) return new UndeadEscape(_manager); + else if (gameType == GameType.ZombieSurvival) return new ZombieSurvival(_manager); + else return null; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameManager.java.orig b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameManager.java.orig new file mode 100644 index 000000000..d76c2067a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameManager.java.orig @@ -0,0 +1,1562 @@ +package nautilus.game.arcade; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; + +import nautilus.game.arcade.addons.CompassAddon; +import nautilus.game.arcade.addons.SoupAddon; +import nautilus.game.arcade.command.GameCommand; +import nautilus.game.arcade.command.GemCommand; +import nautilus.game.arcade.command.ParseCommand; +import nautilus.game.arcade.command.WriteCommand; +import nautilus.game.arcade.game.AsymTeamGame; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameServerConfig; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.lobby.LobbyManager; +import nautilus.game.arcade.shop.ArcadeShop; +import nautilus.game.arcade.shop.KitPackage; +import nautilus.game.arcade.world.FireworkHandler; +import nautilus.game.arcade.world.WorldData; +import net.minecraft.server.v1_6_R2.Packet40EntityMetadata; + +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.event.world.ChunkUnloadEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.FoodLevelChangeEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.PrepareItemCraftEvent; +import org.bukkit.inventory.CraftingInventory; + +import mineplex.minecraft.game.core.IRelation; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.minecraft.game.core.damage.DamageManager; +import mineplex.minecraft.game.core.fire.Fire; +import mineplex.core.shop.page.ConfirmationPage; +import me.chiss.Core.Chat.Chat; +import mineplex.core.MiniPlugin; +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Plugin.IChat; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.CurrencyType; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.creature.Creature; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.donation.Donor; +import mineplex.core.playerTagNamer.PacketHandler; +import mineplex.core.portal.Portal; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class GameManager extends MiniPlugin implements IRelation, IChat +{ + //Modules + private Chat _chat; + private CoreClientManager _clientManager; + private DisguiseManager _disguiseManager; + private DonationManager _donationManager; + private ConditionManager _conditionManager; + private Creature _creature; + private DamageManager _damageManager; + private Fire _fire; + private FireworkHandler _firework; + private LobbyManager _lobbyManager; + private Portal _portal; + private ArcadeShop _arcadeShop; + + private GameFactory _gameFactory; + + //Server Games + private GameServerConfig _serverConfig; + + //Games + private Game _game; + private ArrayList _ended = new ArrayList(); + private String _lastMap = ""; + private GameType _lastGame = GameType.SnowFight; + + private GameType _nextGame = null; + private HashMap _nextGameTeams = null; + + //Player Vars + private int _playerMin = 20; + private int _playerFull = 40; + + //Chunk Loader + private HashSet _worldLoader = new HashSet(); + + public GameManager(JavaPlugin plugin, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DamageManager damageManager, Creature creature, PacketHandler packetHandler) + { + super("Game Manager", plugin); + + _serverConfig = serverConfig; + + _playerMin = _serverConfig.MinPlayers; + _playerFull = _serverConfig.MaxPlayers; + + _damageManager = damageManager; + _damageManager.UseDefaultWeaponDamage = true; + + _disguiseManager = new DisguiseManager(plugin, packetHandler); + _donationManager = donationManager; + _conditionManager = conditionManager; + _clientManager = clientManager; + _creature = creature; + _firework = new FireworkHandler(); + _fire = new Fire(plugin, conditionManager, damageManager); + _chat = new Chat(plugin, _clientManager, this); + _lobbyManager = new LobbyManager(this, packetHandler); + _portal = new Portal(plugin); + _arcadeShop = new ArcadeShop(this, clientManager, donationManager); + + _gameFactory = new GameFactory(this); + + new CompassAddon(plugin, this); + new SoupAddon(plugin, this); + } + + @Override + public void AddCommands() + { + AddCommand(new GameCommand(this)); + AddCommand(new ParseCommand(this)); + AddCommand(new GemCommand(this)); + AddCommand(new WriteCommand(this)); + } + + public GameServerConfig GetServerConfig() + { + return _serverConfig; + } + + public ArrayList GetGameList() + { + return GetServerConfig().GameList; + } + + public Chat GetChat() + { + return _chat; + } + + public CoreClientManager GetClients() + { + return _clientManager; + } + + public ConditionManager GetCondition() + { + return _conditionManager; + } + + public DisguiseManager GetDisguise() + { + return _disguiseManager; + } + + public DamageManager GetDamage() + { + return _damageManager; + } + + public DonationManager GetDonation() + { + return _donationManager; + } + + public Fire GetFire() + { + return _fire; + } + + public FireworkHandler GetFirework() + { + return _firework; + } + + public Creature GetCreature() + { + return _creature; + } + + public LobbyManager GetLobby() + { + return _lobbyManager; + } + + public ChatColor GetColor(Player player) + { + if (_game == null) + return ChatColor.GRAY; + + GameTeam team = _game.GetTeam(player); + if (team == null) + return ChatColor.GRAY; + + return team.GetColor(); + } + + @EventHandler + public void CancelMe(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().startsWith("/me")) + { + event.getPlayer().sendMessage(F.main("Mirror", "You can't see /me messages, are you a vampire?")); + event.setCancelled(true); + } + } + + @Override + public void HandleChat(AsyncPlayerChatEvent event, String filteredMessage) + { + Player sender = event.getPlayer(); + + //Dead Prefix + String dead = ""; + if (_game != null) + if (_game.GetTeam(sender) != null) + if (!_game.IsAlive(sender)) + dead = C.cGray + "Dead "; + + Rank rank = _clientManager.Get(sender).GetRank(); + boolean ownsUltra = false; + + if (_game != null) + ownsUltra= _donationManager.Get(sender.getName()).OwnsUnknownPackage(GetServerConfig().ServerType + " ULTRA"); + + //Rank Prefix + String rankStr = ""; + if (rank != Rank.ALL) + rankStr = rank.Color + C.Bold + rank.Name.toUpperCase() + " "; + + if (ownsUltra && !rank.Has(Rank.ULTRA)) + rankStr = Rank.ULTRA.Color + C.Bold + Rank.ULTRA.Name.toUpperCase() + " "; + + //Base Format + event.setFormat(dead + rankStr + GetColor(sender) + "%1$s " + ChatColor.WHITE + "%2$s"); + + //Public/Private (Not If Player Dead) + if (_game != null && _game.GetState() == GameState.Live) + { + boolean globalMessage = false; + + //Team + GameTeam team = _game.GetTeam(sender); + + if (team != null) + { + //Team Chat + if (event.getMessage().charAt(0) == '@') + { + event.setMessage(event.getMessage().substring(1, event.getMessage().length())); + event.setFormat(C.cWhite + C.Bold + "Team" + " " + dead + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s"); + } + //All Chat + else + { + globalMessage = true; + event.setFormat(dead + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s"); + } + } + + if (globalMessage) + return; + + //Team Message Remove Recipient + Iterator recipientIterator = event.getRecipients().iterator(); + + while (recipientIterator.hasNext()) + { + Player receiver = recipientIterator.next(); + + if (_clientManager.Get(receiver).GetRank().Has(Rank.MODERATOR)) + continue; + + if (_game.GetTeam(receiver) != null && _game.GetTeam(sender) != _game.GetTeam(receiver)) + recipientIterator.remove(); + } + } + } + + @Override + public boolean CanHurt(String a, String b) + { + return CanHurt(UtilPlayer.searchExact(a), UtilPlayer.searchExact(b)); + } + + public boolean CanHurt(Player pA, Player pB) + { + if (pA == null || pB == null) + return false; + + if (!_game.Damage) + return false; + + if (!_game.DamagePvP) + return false; + + //Self Damage + if (pA.equals(pB)) + return _game.DamageSelf; + + GameTeam tA = _game.GetTeam(pA); + if (tA == null) + return false; + + GameTeam tB = _game.GetTeam(pB); + if (tB == null) + return false; + + if (tA.equals(tB) && !_game.DamageTeamSelf) + return false; + + if (!tA.equals(tB) && !_game.DamageTeamOther) + return false; + + return true; + } + + @Override + public boolean IsSafe(Player player) + { + if (_game == null) + return true; + + if (_game.IsPlaying(player)) + return false; + + return true; + } + + @EventHandler(priority = EventPriority.HIGH) + public void DeathEvent(CombatDeathEvent event) + { + if (event.GetLog().GetKiller() != null) + { + Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + + if (player != null) + event.GetLog().SetKillerColor(GetColor(player)+""); + } + + + if (event.GetEvent().getEntity() instanceof Player) + { + //Don't actually die + event.GetEvent().getEntity().setHealth(20); + + //Color + Player player = (Player)event.GetEvent().getEntity(); + + if (player != null) + event.GetLog().SetKilledColor(GetColor(player)+""); + } + } + + @EventHandler + public void PlayerJoin(PlayerJoinEvent event) + { + final Player player = event.getPlayer(); + + Clear(player); + + //Lobby Name + GetLobby().AddPlayerToScoreboards(player, null); + + //Lobby Spawn + if (_game == null || !_game.InProgress()) + { + player.teleport(GetLobby().GetSpawn()); + return; + } + + //Game Spawn + if (_game.IsAlive(player)) + { + player.teleport(_game.GetTeam(player).GetSpawn()); + } + else + { + _game.SetSpectator(player); + UtilPlayer.message(player, F.main("Game", _game.GetName() + " is in progress, please wait for next game!")); + } + + player.setScoreboard(_game.GetScoreboard()); + } + + @EventHandler + public void PlayerRespawn(PlayerRespawnEvent event) + { + if (_game == null || !_game.InProgress()) + { + event.setRespawnLocation(GetLobby().GetSpawn()); + return; + } + + Player player = event.getPlayer(); + + if (_game.IsAlive(player)) + { + event.setRespawnLocation(_game.GetTeam(player).GetSpawn()); + } + else + { + _game.SetSpectator(player); + + event.setRespawnLocation(_game.GetSpectatorLocation()); + } + } + + @EventHandler + public void Motd(ServerListPingEvent event) + { + if (_game == null || _game.GetState() == GameState.Recruit) + { + event.setMotd(ChatColor.GREEN + "Recruiting"); + } + else + { + event.setMotd(ChatColor.YELLOW + "In Progress"); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void ItemPickup(PlayerPickupItemEvent event) + { + if (_game == null || _game.GetState() != GameState.Live) + event.setCancelled(true); + + else if (!_game.IsAlive(event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOW) + public void ItemDrop(PlayerDropItemEvent event) + { + if (_game == null || _game.GetState() != GameState.Live) + event.setCancelled(true); + + else if (!_game.IsAlive(event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler + public void CancelFoodChange(FoodLevelChangeEvent event) + { + if (event.getEntityType() == EntityType.PLAYER && event.getEntity().getWorld().getName().equals("world")) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOW) + public void DamageEvent(CustomDamageEvent event) + { + if (_game == null) + { + event.SetCancelled("Game Null"); + return; + } + + LivingEntity damagee = event.GetDamageeEntity(); + LivingEntity damager = event.GetDamagerEntity(true); + + if (damagee != null && damagee.getWorld().getName().equals("world")) + { + event.SetCancelled("In Lobby"); + + if (event.GetCause() == DamageCause.VOID) + damagee.teleport(GetLobby().GetSpawn()); + + return; + } + + if (!_game.Damage) + { + event.SetCancelled("Damage Disabled"); + return; + } + + if (_game.GetState() != GameState.Live) + { + event.SetCancelled("Game not Live"); + return; + } + + if (damagee != null && damagee instanceof Player && !_game.IsAlive((Player)damagee)) + { + event.SetCancelled("Damagee Not Playing"); + return; + } + + if (damager != null && damager instanceof Player && !_game.IsAlive((Player)damager)) + { + event.SetCancelled("Damager Not Playing"); + return; + } + + //Entity vs Entity + if (damagee != null && damager != null) + { + //PvP + if (damagee instanceof Player && damager instanceof Player) + { + if (!CanHurt((Player)damagee, (Player)damager)) + { + event.SetCancelled("Damage Rules"); + return; + } + } + //PvE + else if (damager instanceof Player) + { + if (!_game.DamagePvE) + { + event.SetCancelled("PvE Disabled"); + return; + } + } + //EvP + else if (damagee instanceof Player) + { + if (!_game.DamageEvP) + { + event.SetCancelled("EvP Disabled"); + return; + } + } + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void DamageExplosion(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_EXPLOSION && event.GetCause() != DamageCause.BLOCK_EXPLOSION) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + if (CanHurt(damagee, damager)) + return; + + event.SetCancelled("Allied Explosion"); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void InteractActive(PlayerInteractEvent event) + { + event.setCancelled(false); + } + + @EventHandler(priority = EventPriority.LOW) + public void InteractCancel(PlayerInteractEvent event) + { + if (_game == null) + return; + + Player player = event.getPlayer(); + + if (!_game.IsAlive(player)) + { + event.setCancelled(true); + } + else if (event.getPlayer().getItemInHand().getType() == Material.INK_SACK && event.getPlayer().getItemInHand().getData().getData() == (byte)15) + { + if (event.getAction() == Action.RIGHT_CLICK_BLOCK) + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void InteractCancel(InventoryClickEvent event) + { + if (_game == null) + return; + + Player player = UtilPlayer.searchExact(event.getWhoClicked().getName()); + + if (_game.IsLive() && !_game.IsAlive(player)) + { + event.setCancelled(true); + player.closeInventory(); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void TeamInteract(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() == null) + return; + + Player player = event.getPlayer(); + + GameTeam team = GetLobby().GetClickedTeam(event.getRightClicked()); + + if (team == null) + return; + + TeamClick(player, team); + } + + @EventHandler + public void TeamDamage(CustomDamageEvent event) + { + Player player = event.GetDamagerPlayer(false); + if (player == null) return; + + LivingEntity target = event.GetDamageeEntity(); + + GameTeam team = GetLobby().GetClickedTeam(target); + + if (team == null) + return; + + TeamClick(player, team); + } + + public void TeamClick(final Player player, final GameTeam team) + { + if (_game == null) + return; + + if (_game.GetState() != GameState.Recruit) + return; + + if (!_game.HasTeam(team)) + return; + + _game.AddTeamPreference(player, team); + } + + @EventHandler(priority = EventPriority.HIGH) + public void KitInteract(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() == null) + return; + + Player player = event.getPlayer(); + + Kit kit = GetLobby().GetClickedKit(event.getRightClicked()); + + if (kit == null) + return; + + KitClick(player, kit, event.getRightClicked()); + } + + @EventHandler + public void KitDamage(CustomDamageEvent event) + { + Player player = event.GetDamagerPlayer(false); + if (player == null) return; + + LivingEntity target = event.GetDamageeEntity(); + + Kit kit = GetLobby().GetClickedKit(target); + + if (kit == null) + return; + + KitClick(player, kit, target); + } + + public void KitClick(final Player player, final Kit kit, final Entity entity) + { + kit.DisplayDesc(player); + + if (_game == null) + return; + + if (!_game.HasKit(kit)) + return; + + + CoreClient client = _clientManager.Get(player); + Donor donor = _donationManager.Get(player.getName()); + + if (kit.GetAvailability() == KitAvailability.Free || client.GetRank().Has(Rank.ULTRA) || donor.OwnsUnknownPackage(GetServerConfig().ServerType + " ULTRA") || donor.OwnsUnknownPackage(_game.GetName() + " " + kit.GetName())) + { + _game.SetKit(player, kit, true); + } + else if (kit.GetAvailability() == KitAvailability.Green && donor.GetBalance(CurrencyType.Gems) > kit.GetCost()) + { + _arcadeShop.OpenPageForPlayer(player, new ConfirmationPage(this, _arcadeShop, _clientManager, _donationManager, new Runnable() + { + public void run() + { + if (player.isOnline()) + { + _game.SetKit(player, kit, true); + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(new Packet40EntityMetadata(entity.getEntityId(), ((CraftEntity)entity).getHandle().getDataWatcher(), true)); + } + } + }, null, new KitPackage(_game.GetName(), kit), CurrencyType.Gems, player)); + } + else + { + player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f); + + if (kit.GetAvailability() == KitAvailability.Blue) + UtilPlayer.message(player, F.main("Kit", "You must purchase " + F.elem(C.cAqua + "Ultra") + " to use " + F.elem(kit.GetFormattedName() + " Kit") + ".")); + else + UtilPlayer.message(player, F.main("Kit", "You need more " + F.elem(C.cGreen + "Gems") + " for " + F.elem(kit.GetFormattedName() + " Kit") + ".")); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void HungerUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_game == null) + return; + + if (_game.HungerSet != -1) + for (Player player : _game.GetPlayers(true)) + player.setFoodLevel(_game.HungerSet); + + if (_game.HealthSet != -1) + for (Player player : _game.GetPlayers(true)) + player.setHealth(_game.HealthSet); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void BoundaryCheck(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_game == null || _game.GetState() != GameState.Live) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (player.getLocation().getX() > _game.WorldData.MaxX || + player.getLocation().getX() < _game.WorldData.MinX || + player.getLocation().getZ() > _game.WorldData.MaxZ || + player.getLocation().getZ() < _game.WorldData.MinZ || + (_game.WorldHeightLimit > 0 && player.getLocation().getY() > _game.WorldHeightLimit)) + { + if (!IsAlive(player)) + { + player.teleport(_game.GetSpectatorLocation()); + } + else + { + UtilPlayer.message(player, C.cRed + C.Bold + "WARNING: " + C.cWhite + C.Bold +"RETURN TO PLAYABLE AREA!"); + + GetDamage().NewDamageEvent(player, null, null, + DamageCause.VOID, 4, true, false, false, + "Void", "Void Damage"); + + player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f); + player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f); + } + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void ItemPickupEvent(PlayerPickupItemEvent event) + { + Player player = event.getPlayer(); + + if (_game == null) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + else + { + if (!_game.IsAlive(player)) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + else + { + if (_game.ItemPickup) + { + if (_game.ItemPickupDeny.contains(event.getItem().getItemStack().getTypeId())) + { + event.setCancelled(true); + } + } + else + { + if (!_game.ItemPickupAllow.contains(event.getItem().getItemStack().getTypeId())) + { + event.setCancelled(true); + } + } + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void ItemDropEvent(PlayerDropItemEvent event) + { + Player player = event.getPlayer(); + + if (_game == null) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + else + { + if (!_game.IsAlive(player)) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + else + { + if (_game.ItemDrop) + { + if (_game.ItemDropDeny.contains(event.getItemDrop().getItemStack().getTypeId())) + { + event.setCancelled(true); + } + } + else + { + if (!_game.ItemDropAllow.contains(event.getItemDrop().getItemStack().getTypeId())) + { + event.setCancelled(true); + } + } + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void BlockPlaceEvent(BlockPlaceEvent event) + { + Player player = event.getPlayer(); + + if (_game == null) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + else + { + if (!_game.IsAlive(player)) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + else + { + if (_game.BlockPlace) + { + if (_game.BlockPlaceDeny.contains(event.getBlock().getTypeId())) + { + event.setCancelled(true); + } + } + else + { + if (!_game.BlockPlaceAllow.contains(event.getBlock().getTypeId())) + { + event.setCancelled(true); + } + } + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void BlockBreakEvent(org.bukkit.event.block.BlockBreakEvent event) + { + Player player = event.getPlayer(); + + if (_game == null) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + else if (_game.GetState() == GameState.Live) + { + if (!_game.IsAlive(player)) + { + event.setCancelled(true); + } + else + { + if (_game.BlockBreak) + { + if (_game.BlockBreakDeny.contains(event.getBlock().getTypeId())) + { + event.setCancelled(true); + } + + } + else + { + if (!_game.BlockBreakAllow.contains(event.getBlock().getTypeId())) + { + event.setCancelled(true); + } + } + } + } + else + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void PrivateBlockPlace(BlockPlaceEvent event) + { + if (_game == null) + return; + + if (!_game.PrivateBlocks) + return; + + if (event.isCancelled()) + return; + + if (!UtilBlock.usable(event.getBlockPlaced())) + return; + + if (event.getBlockPlaced().getType() != Material.CHEST && + event.getBlockPlaced().getType() != Material.FURNACE && + event.getBlockPlaced().getType() != Material.BURNING_FURNACE && + event.getBlockPlaced().getType() != Material.WORKBENCH) + return; + + String privateKey = event.getPlayer().getName(); + + if (!_game.PrivateBlockCount.containsKey(privateKey)) + { + _game.PrivateBlockCount.put(privateKey, 0); + } + + if (_game.PrivateBlockCount.get(privateKey) == 4) + return; + + if (_game.PrivateBlockCount.get(privateKey) > 1) + { + if (!_donationManager.Get(privateKey).OwnsUnknownPackage(GetServerConfig().ServerType + " ULTRA") && !_clientManager.Get(privateKey).GetRank().Has(Rank.ULTRA)) + return; + } + + _game.PrivateBlockMap.put(event.getBlockPlaced().getLocation(), event.getPlayer()); + _game.PrivateBlockCount.put(event.getPlayer().getName(), _game.PrivateBlockCount.get(event.getPlayer().getName()) + 1); + event.getPlayer().sendMessage(F.main(_game.GetName(), "Can't touch this. Na na nana!")); + + if (_game.PrivateBlockCount.get(privateKey) == 4) + { + event.getPlayer().sendMessage(F.main(_game.GetName(), "Protected block limit reached. Stay classy Ultra ranker ;)")); + } + else if (_game.PrivateBlockCount.get(privateKey) == 2) + { + if (!_donationManager.Get(privateKey).OwnsUnknownPackage(GetServerConfig().ServerType + " ULTRA") && !_clientManager.Get(privateKey).GetRank().Has(Rank.ULTRA)) + { + event.getPlayer().sendMessage(F.main(_game.GetName(), "Protected block limit reached. Thieves are scary, get Ultra for 2 extra protected blocks!")); + } + } + } + + @EventHandler(priority = EventPriority.LOW) + public void PrivateBlockPlaceCancel(BlockPlaceEvent event) + { + if (_game == null) + return; + + if (!_game.PrivateBlocks) + return; + + if (event.isCancelled()) + return; + + Block block = event.getBlockPlaced(); + + if (block.getType() != Material.CHEST) + return; + + Player player = event.getPlayer(); + + BlockFace[] faces = new BlockFace[] {BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST}; + + for (BlockFace face : faces) + { + Block other = block.getRelative(face); + + if (other.getType() != Material.CHEST) + continue; + + if (!_game.PrivateBlockMap.containsKey(other.getLocation())) + continue; + + Player owner = _game.PrivateBlockMap.get(other.getLocation()); + + if (player.equals(owner)) + continue; + + //Allow Enemy Raiding + GameTeam ownerTeam = _game.GetTeam(owner); + GameTeam playerTeam = _game.GetTeam(player); + + if (ownerTeam != null && playerTeam != null && !ownerTeam.equals(playerTeam)) + continue; + + //Disallow + UtilPlayer.message(event.getPlayer(), F.main("Game", + "You cannot combine " + + F.elem(C.cPurple + ItemStackFactory.Instance.GetName(event.getBlock(), false)) + + " with " + F.elem(GetColor(owner) + owner.getName() + "."))); + + event.setCancelled(true); + return; + } + } + + @EventHandler(priority = EventPriority.NORMAL) + public void PrivateBlockBreak(org.bukkit.event.block.BlockBreakEvent event) + { + if (_game == null) + return; + + if (!_game.PrivateBlocks) + return; + + if (event.isCancelled()) + return; + + if (!_game.PrivateBlockMap.containsKey(event.getBlock().getLocation())) + return; + + Player owner = _game.PrivateBlockMap.get(event.getBlock().getLocation()); + Player player = event.getPlayer(); + + //Same Team (or no team) + if (owner.equals(player)) + { + _game.PrivateBlockMap.remove(event.getBlock().getLocation()); + } + else + { + //Allow Enemy Raiding + GameTeam ownerTeam = _game.GetTeam(owner); + GameTeam playerTeam = _game.GetTeam(player); + + if (ownerTeam != null && playerTeam != null && !ownerTeam.equals(playerTeam)) + return; + + //Disallow + UtilPlayer.message(event.getPlayer(), F.main("Game", + F.elem(C.cPurple + ItemStackFactory.Instance.GetName(event.getBlock(), false)) + + " belongs to " + F.elem(GetColor(owner) + owner.getName() + "."))); + + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void PrivateBlockUse(PlayerInteractEvent event) + { + if (_game == null) + return; + + if (!_game.PrivateBlocks) + return; + + if (event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (!UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getClickedBlock().getType() != Material.CHEST && + event.getClickedBlock().getType() != Material.FURNACE && + event.getClickedBlock().getType() != Material.BURNING_FURNACE) + return; + + if (!_game.PrivateBlockMap.containsKey(event.getClickedBlock().getLocation())) + return; + + Player owner = _game.PrivateBlockMap.get(event.getClickedBlock().getLocation()); + Player player = event.getPlayer(); + + if (owner.equals(player)) + { + return; + } + else + { + //Allow Enemy Raiding + GameTeam ownerTeam = _game.GetTeam(owner); + GameTeam playerTeam = _game.GetTeam(player); + + if (ownerTeam != null && playerTeam != null && !ownerTeam.equals(playerTeam)) + return; + + //Disallow + UtilPlayer.message(event.getPlayer(), F.main("Game", + F.elem(C.cPurple + ItemStackFactory.Instance.GetName(event.getClickedBlock(), false)) + + " belongs to " + F.elem(GetColor(owner) + owner.getName() + "."))); + + event.setCancelled(true); + } + } + + @EventHandler + public void PrepareMoveCancel(PlayerMoveEvent event) + { + if (_game == null || _game.GetState() != GameState.Prepare) + return; + + if (!_game.PrepareFreeze) + return; + + if (UtilMath.offset(event.getFrom(), event.getTo()) <= 0) + return; + + event.getFrom().setPitch(event.getTo().getPitch()); + event.getFrom().setYaw(event.getTo().getYaw()); + + event.setTo(event.getFrom()); + } + + @EventHandler(priority = EventPriority.HIGH) + public void CraftingDeny(PrepareItemCraftEvent event) + { + if (event.getRecipe().getResult() == null) + return; + + Material type = event.getRecipe().getResult().getType(); + + if (type != Material.GOLDEN_APPLE && + type != Material.GOLDEN_CARROT && + type != Material.FLINT_AND_STEEL) + return; + + if (!(event.getInventory() instanceof CraftingInventory)) + return; + + CraftingInventory inv = (CraftingInventory)event.getInventory(); + + /* + String name = ItemStackFactory.Instance.GetName(event.getRecipe().getResult(), true); + + //Feedback + ItemStack result = ItemStackFactory.Instance.CreateStack(36, (byte)0, 1, + "§r" + C.cGray + "Crafting of " + F.item(name) + " is disabled.", new String[] {}); + + inv.setResult(result); + */ + + inv.setResult(null); + } + + @EventHandler + public void WaterDamage(UpdateEvent event) + { + if (_game == null) + return; + + if (_game.WaterDamage <= 0) + return; + + if (!_game.IsLive()) + return; + + if (event.getType() != UpdateType.FAST) + return; + + for (GameTeam team : _game.GetTeamList()) + for (Player player : team.GetPlayers(true)) + if (player.getLocation().getBlock().isLiquid()) + { + //Damage Event + GetDamage().NewDamageEvent(player, null, null, + DamageCause.DROWNING, 4, true, false, false, + "Water", "Water Damage"); + + player.getWorld().playSound(player.getLocation(), + Sound.SPLASH, 2f, + 1f + (float) Math.random() / 2); + } + } + + @EventHandler + public void Join(PlayerJoinEvent event) + { + event.setJoinMessage(F.sys("Join", event.getPlayer().getName())); + } + + @EventHandler + public void Quit(PlayerQuitEvent event) + { + event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + event.getPlayer().getName())); + } + + @EventHandler(priority = EventPriority.LOW) + public void WorldCreature(CreatureSpawnEvent event) + { + if (_game == null) + return; + + if (!_game.CreatureAllow && !_game.CreatureAllowOverride) + { + if (_game.WorldData != null) + { + if (_game.WorldData.World != null) + { + if (event.getLocation().getWorld().equals(_game.WorldData.World)) + { + event.setCancelled(true); + } + } + } + } + } + + @EventHandler + public void WorldTime(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (_game == null) + return; + + if (_game.WorldTimeSet != -1) + { + if (_game.WorldData != null) + { + if (_game.WorldData.World != null) + { + _game.WorldData.World.setTime(_game.WorldTimeSet); + } + } + } + } + + @EventHandler + public void NextGame(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (GetGameList().isEmpty()) + return; + + if (_game == null && _ended.isEmpty()) + { + CreateGame(null); + } + + //Archive Game + if (_game != null) + { + if (_game.GetState() == GameState.Dead) + { + HandlerList.unregisterAll(_game); + + //Schedule Cleanup + _ended.add(_game); + + //Lobby Display + GetLobby().DisplayLast(_game); + + //Prepare Round 2 - If Applicable + if (_game instanceof AsymTeamGame) + { + if (((AsymTeamGame) _game).GetPastTeams() == null) + { + _nextGame = _game.GetType(); + _nextGameTeams = new HashMap(); + + for (GameTeam team : _game.GetTeamList()) + for (Player player : team.GetPlayers(false)) + _nextGameTeams.put(player.getName(), team.GetColor()); + } + } + + _game = null; + } + } + + //Clean Archived Games + Iterator gameIterator = _ended.iterator(); + + while (gameIterator.hasNext()) + { + Game game = gameIterator.next(); + + HandlerList.unregisterAll(game); + + //Cleaned + if (game.WorldData == null) + { + gameIterator.remove(); + continue; + } + + if (game.WorldData.World == null) + { + gameIterator.remove(); + continue; + } + + //Kick Players + if (UtilTime.elapsed(game.GetStateTime(), 10000)) + { + for (Player player : game.WorldData.World.getPlayers()) + player.kickPlayer("Dead World"); + } + + //Clean + if (game.WorldData.World.getPlayers().isEmpty()) + { + game.WorldData.Uninitialize(); + game.WorldData = null; + } + } + } + + private void CreateGame(GameType gameType) + { + HashMap pastTeams = null; + + //Round 2 + if (_nextGame != null && _nextGameTeams != null) + { + gameType = _nextGame; + pastTeams = _nextGameTeams; + + _nextGame = null; + _nextGameTeams = null; + } + + //Pick Game + if (gameType == null) + { + for (int i=0 ; i<50 ; i++) + { + gameType = GetGameList().get(UtilMath.r(GetGameList().size())); + + if (gameType != _lastGame) + break; + } + } + _lastGame = gameType; + + //Make Game + _game = _gameFactory.CreateGame(gameType, pastTeams); + + if (_game == null) + { + return; + } + + GetLobby().DisplayNext(_game, pastTeams); + + UtilServer.getServer().getPluginManager().registerEvents(_game, GetPlugin()); + } + + @EventHandler + public void LobbyLiquid(BlockFromToEvent event) + { + if (_game == null) + return; + + if (event.getBlock().getWorld().getName().equals("world")) + event.setCancelled(true); + } + + @EventHandler + public void LoadWorldChunks(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator worldIterator = _worldLoader.iterator(); + + long endTime = System.currentTimeMillis() + 25; + + while (worldIterator.hasNext()) + { + long timeLeft = endTime - System.currentTimeMillis(); + if (timeLeft <= 0) continue; + + final WorldData worldData = worldIterator.next(); + + if (worldData.World == null) + { + worldIterator.remove(); + } + else if (worldData.LoadChunks(timeLeft)) + { + worldData.Host.SetState(GameState.Recruit); + worldIterator.remove(); + } + } + } + /* + @EventHandler + public void ChunkLoad(ChunkPreLoadEvent event) + { + if (_game != null) + if (_game.WorldData != null) + _game.WorldData.ChunkLoad(event); + } + */ + @EventHandler + public void ChunkUnload(ChunkUnloadEvent event) + { + if (event.getWorld().getName().equals("world")) + { + event.setCancelled(true); + return; + } + + if (_game != null) + if (_game.WorldData != null) + _game.WorldData.ChunkUnload(event); + } + + public void RegisterWorld(WorldData worldData) + { + _worldLoader.add(worldData); + } + + public Game GetGame() + { + return _game; + } + + public void SetGame(Game game) + { + _game = game; + } + + public String GetLastMap() + { + return _lastMap; + } + + public void SetLastMap(String file) + { + _lastMap = file; + } + + public GameType GetLastGame() + { + return _lastGame; + } + + public int GetPlayerMin() + { + return _playerMin; + } + + public int GetPlayerFull() + { + return _playerFull; + } + + public void Clear(Player player) + { + player.setGameMode(GameMode.SURVIVAL); + UtilInv.Clear(player); + player.setFoodLevel(20); + player.setHealth(20); + player.setFireTicks(0); + player.setFallDistance(0); + player.setLevel(0); + player.setExp(0f); + ((CraftPlayer)player).getHandle().spectating = false; + ((CraftPlayer)player).getHandle().m = true; + + GetDisguise().Undisguise(player); + + GetCondition().EndCondition(player, ConditionType.CLOAK, "Spectator"); + + player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte)0, 1, (short)0, C.cGreen + "Return to Hub", + new String[] {"", ChatColor.RESET + "Click while holding this", ChatColor.RESET + "to return to the Hub."})); + } + + public boolean IsAlive(Player player) + { + if (_game == null) + return false; + + return _game.IsAlive(player); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void HubInteract(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (player.getItemInHand() == null) + return; + + if (player.getItemInHand().getType() != Material.WATCH) + return; + + if (_game != null && _game.IsAlive(player)) + return; + + _portal.SendPlayerToServer(player, "Lobby"); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java new file mode 100644 index 000000000..2d248eb02 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -0,0 +1,35 @@ +package nautilus.game.arcade; + +public enum GameType +{ + //Mini + DeathTag("Death Tag"), + Dragons("Dragons"), + MineWare("MineWare"), + Horse("Horseback"), + Evolution("Evolution"), + Smash("Super Smash Mobs"), + Spleef("Super Spleef"), + UndeadEscape("Undead Escape"), + Quiver("One in the Quiver"), + Runner("Runner"), + SnowFight("Snow Fight"), + TurfForts("Turf Forts"), + ZombieSurvival("Zombie Survival"), + + //Stand + CastleSiege("Castle Siege"), + Bridge("The Bridges"); + + String _name; + + GameType(String name) + { + _name = name; + } + + public String GetName() + { + return _name; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/CompassAddon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/CompassAddon.java new file mode 100644 index 000000000..701362e69 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/CompassAddon.java @@ -0,0 +1,177 @@ +package nautilus.game.arcade.addons; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.GameTeam; + +public class CompassAddon extends MiniPlugin +{ + public ArcadeManager Manager; + + public CompassAddon(JavaPlugin plugin, ArcadeManager manager) + { + super("Compass Addon", plugin); + + Manager = manager; + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if (Manager.GetGame() == null) + return; + + if (!Manager.GetGame().IsLive()) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (!Manager.GetGame().CompassEnabled && Manager.GetGame().IsAlive(player)) + continue; + + GameTeam team = Manager.GetGame().GetTeam(player); + + Player target = null; + GameTeam targetTeam = null; + double bestDist = 0; + + for (Player other : Manager.GetGame().GetPlayers(true)) + { + GameTeam otherTeam = Manager.GetGame().GetTeam(other); + + //Same Team (Not Solo Game) && Alive + //NPE + if (Manager.GetGame().GetTeamList().size() > 1 && team.equals(otherTeam) && Manager.GetGame().IsAlive(player)) + continue; + + double dist = UtilMath.offset(player, other); + + if (target == null || dist < bestDist) + { + target = other; + targetTeam = otherTeam; + bestDist = dist; + } + } + + if (target != null) + { + if (!player.getInventory().contains(Material.COMPASS)) + player.getInventory().addItem(new ItemStack(Material.COMPASS)); + + player.setCompassTarget(target.getLocation()); + + for (int i : player.getInventory().all(Material.COMPASS).keySet()) + { + ItemStack stack = player.getInventory().getItem(i); + + double heightDiff = target.getLocation().getY() - player.getLocation().getY(); + + ItemMeta itemMeta = stack.getItemMeta(); + itemMeta.setDisplayName( + " " + C.cWhite + C.Bold + "Nearest Player: " + targetTeam.GetColor() + target.getName() + + " " + C.cWhite + C.Bold + "Distance: " + targetTeam.GetColor() + UtilMath.trim(1, bestDist) + + " " + C.cWhite + C.Bold + "Height: " + targetTeam.GetColor() + UtilMath.trim(1, heightDiff)); + stack.setItemMeta(itemMeta); + + player.getInventory().setItem(i, stack); + } + } + } + } + + @EventHandler + public void DropItem(PlayerDropItemEvent event) + { + if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.COMPASS, (byte)0)) + return; + + //Cancel + event.setCancelled(true); + + //Inform + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot drop " + F.item("Target Compass") + ".")); + } + + @EventHandler + public void DeathRemove(PlayerDeathEvent event) + { + HashSet remove = new HashSet(); + + for (org.bukkit.inventory.ItemStack item : event.getDrops()) + if (UtilInv.IsItem(item, Material.COMPASS, (byte)0)) + remove.add(item); + + for (org.bukkit.inventory.ItemStack item : remove) + event.getDrops().remove(item); + } + + @EventHandler + public void InventoryClick(InventoryClickEvent event) + { + UtilInv.DisallowMovementOf(event, "Target Compass", Material.COMPASS, (byte)0, true); + } + + @EventHandler + public void PlayerInteract(PlayerInteractEvent event) + { + if (Manager.GetGame() == null) + return; + + Player player = event.getPlayer(); + + if (Manager.GetGame().IsAlive(player)) + return; + + GameTeam team = Manager.GetGame().GetTeam(player); + + Player target = null; + double bestDist = 0; + + for (Player other : Manager.GetGame().GetPlayers(true)) + { + GameTeam otherTeam = Manager.GetGame().GetTeam(other); + + //Same Team (Not Solo Game) && Alive + if (Manager.GetGame().GetTeamList().size() > 1 && (team != null && team.equals(otherTeam)) && Manager.GetGame().IsAlive(player)) + continue; + + double dist = UtilMath.offset(player, other); + + if (target == null || dist < bestDist) + { + target = other; + bestDist = dist; + } + } + + if (target != null) + { + player.teleport(target.getLocation().add(0, 1, 0)); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/SoupAddon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/SoupAddon.java new file mode 100644 index 000000000..899c6f982 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/SoupAddon.java @@ -0,0 +1,63 @@ +package nautilus.game.arcade.addons; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import nautilus.game.arcade.ArcadeManager; + +public class SoupAddon extends MiniPlugin +{ + public ArcadeManager Manager; + + public SoupAddon(JavaPlugin plugin, ArcadeManager manager) + { + super("Soup Addon", plugin); + + Manager = manager; + } + + @EventHandler + public void EatSoup(PlayerInteractEvent event) + { + if (Manager.GetGame() == null) + return; + + if (!Manager.GetGame().IsLive()) + return; + + if (!Manager.GetGame().SoupEnabled) + return; + + Player player = event.getPlayer(); + + if (!UtilGear.isMat(player.getItemInHand(), Material.MUSHROOM_SOUP)) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.EAT, 2f, 1f); + player.getWorld().playEffect(player.getEyeLocation(), Effect.STEP_SOUND, 39); + player.getWorld().playEffect(player.getEyeLocation(), Effect.STEP_SOUND, 40); + + //Healing + Manager.GetCondition().Factory().Custom("Mushroom Soup", player, player, ConditionType.REGENERATION, 5, 1, false, Material.MUSHROOM_SOUP, (byte)0, true); + + //Food + UtilPlayer.hunger(player, 3); + + event.setCancelled(true); + player.setItemInHand(null); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GameCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GameCommand.java new file mode 100644 index 000000000..481758382 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GameCommand.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.command; + +import org.bukkit.entity.Player; + +import nautilus.game.arcade.ArcadeManager; +import mineplex.core.command.MultiCommandBase; +import mineplex.core.common.Rank; + +public class GameCommand extends MultiCommandBase +{ + public GameCommand(ArcadeManager plugin) + { + super(plugin, Rank.ADMIN, "game"); + + AddCommand(new StartCommand(Plugin)); + AddCommand(new StopCommand(Plugin)); + } + + @Override + protected void Help(Player caller, String[] args) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GemCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GemCommand.java new file mode 100644 index 000000000..5d3bc8296 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GemCommand.java @@ -0,0 +1,46 @@ +package nautilus.game.arcade.command; + +import org.bukkit.entity.Player; + +import nautilus.game.arcade.ArcadeManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +public class GemCommand extends CommandBase +{ + public GemCommand(ArcadeManager plugin) + { + super(plugin, Rank.OWNER, "gem"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (!caller.getName().equals("Chiss")) + return; + + if (args.length < 2) + { + UtilPlayer.message(caller, F.main("Gem", "Missing Args")); + return; + } + + Player target = UtilPlayer.searchOnline(caller, args[0], true); + if (target == null) return; + + try + { + int gems = Integer.parseInt(args[1]); + Plugin.GetDonation().RewardGems(target.getName(), gems); + + UtilPlayer.message(caller, F.main("Gem", "You gave " + F.elem(gems + " Blue/Green Gems") + " to " + F.name(target.getName()) + ".")); + UtilPlayer.message(target, F.main("Gem", F.name(caller.getName()) + " gave you " + F.elem(gems + " Blue/Green Gems") + ".")); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main("Gem", "Invalid Gem Amount")); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/ParseCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/ParseCommand.java new file mode 100644 index 000000000..1610dcbf4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/ParseCommand.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.command; + +import org.bukkit.entity.Player; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.world.WorldParser; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; + +public class ParseCommand extends CommandBase +{ + public ParseCommand(ArcadeManager plugin) + { + super(plugin, Rank.ADMIN, "parse"); + } + + @Override + public void Execute(Player caller, String[] args) + { + caller.sendMessage("Parsing World"); + WorldParser parser = new WorldParser(); + parser.Parse(caller, args); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StartCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StartCommand.java new file mode 100644 index 000000000..d4f170373 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StartCommand.java @@ -0,0 +1,26 @@ +package nautilus.game.arcade.command; + +import org.bukkit.entity.Player; + +import nautilus.game.arcade.ArcadeManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; + +public class StartCommand extends CommandBase +{ + public StartCommand(ArcadeManager plugin) + { + super(plugin, Rank.ADMIN, "start"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (Plugin.GetGame() == null) + return; + + Plugin.GetGameManager().StateCountdown(Plugin.GetGame(), 10, true); + + caller.sendMessage("Force Starting Game!"); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StopCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StopCommand.java new file mode 100644 index 000000000..4d0d123b4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StopCommand.java @@ -0,0 +1,31 @@ +package nautilus.game.arcade.command; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game.GameState; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; + +public class StopCommand extends CommandBase +{ + public StopCommand(ArcadeManager plugin) + { + super(plugin, Rank.ADMIN, "stop"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (Plugin.GetGame() == null) + return; + + HandlerList.unregisterAll(Plugin.GetGame()); + Plugin.GetGame().SetState(GameState.Dead); + Plugin.GetGame().WorldData.Uninitialize(); + Plugin.SetGame(null); + + caller.sendMessage("Stopped Game!"); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/WriteCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/WriteCommand.java new file mode 100644 index 000000000..1718baec5 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/WriteCommand.java @@ -0,0 +1,74 @@ +package nautilus.game.arcade.command; + +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; + +import nautilus.game.arcade.ArcadeManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; + +public class WriteCommand extends CommandBase +{ + public WriteCommand(ArcadeManager plugin) + { + super(plugin, Rank.ADMIN, "write"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 6) + { + caller.sendMessage("/write X Y Z BlockFace Line "); + return; + } + + //Loc + int x = 0; + int y = 0; + int z = 0; + try + { + x = Integer.parseInt(args[0]); + y = Integer.parseInt(args[1]); + z = Integer.parseInt(args[2]); + } + catch (Exception e) + { + caller.sendMessage("Invalid Co-Ordinates"); + return; + } + + //BlockFace + BlockFace face = BlockFace.NORTH; + try + { + face = BlockFace.valueOf(args[3].toUpperCase()); + } + catch (Exception e) + { + caller.sendMessage("Invalid BlockFace"); + return; + } + + //Line + int line = 0; + try + { + line = Integer.parseInt(args[4]); + } + catch (Exception e) + { + caller.sendMessage("Invalid Line"); + return; + } + + //Text + String text = ""; + for (int i=5 ; i < args.length ; i++) + text += args[i] + " "; + text = text.substring(0, text.length()-1); + + Plugin.GetLobby().WriteLine(caller, x, y, z, face, line, text); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/events/GameStateChangeEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/events/GameStateChangeEvent.java new file mode 100644 index 000000000..611239094 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/events/GameStateChangeEvent.java @@ -0,0 +1,40 @@ +package nautilus.game.arcade.events; + +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class GameStateChangeEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private Game _game; + private GameState _to; + + public GameStateChangeEvent(Game game, GameState to) + { + _game = game; + _to = to; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public Game GetGame() + { + return _game; + } + + public GameState GetState() + { + return _to; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/events/PlayerDeathOutEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/events/PlayerDeathOutEvent.java new file mode 100644 index 000000000..84c534c8c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/events/PlayerDeathOutEvent.java @@ -0,0 +1,54 @@ +package nautilus.game.arcade.events; + +import nautilus.game.arcade.game.Game; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class PlayerDeathOutEvent extends Event implements Cancellable +{ + private static final HandlerList handlers = new HandlerList(); + private Game _game; + private Player _player; + private boolean _cancelled = false; + + public PlayerDeathOutEvent(Game game, Player player) + { + _game = game; + _player = player; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public Game GetGame() + { + return _game; + } + + public Player GetPlayer() + { + return _player; + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/events/PlayerStateChangeEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/events/PlayerStateChangeEvent.java new file mode 100644 index 000000000..6c6cdc906 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/events/PlayerStateChangeEvent.java @@ -0,0 +1,48 @@ +package nautilus.game.arcade.events; + +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam.PlayerState; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class PlayerStateChangeEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private Game _game; + private Player _player; + private PlayerState _state; + + public PlayerStateChangeEvent(Game game, Player player, PlayerState state) + { + _game = game; + _player = player; + _state = state; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public Game GetGame() + { + return _game; + } + + public Player GetPlayer() + { + return _player; + } + + public PlayerState GetState() + { + return _state; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/events/TeamGenerationEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/events/TeamGenerationEvent.java new file mode 100644 index 000000000..b96c6273e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/events/TeamGenerationEvent.java @@ -0,0 +1,60 @@ +package nautilus.game.arcade.events; + +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam.PlayerState; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class TeamGenerationEvent extends Event implements Cancellable +{ + private static final HandlerList handlers = new HandlerList(); + private Game _game; + private Player _player; + private PlayerState _state; + private boolean _cancelled = false; + + public TeamGenerationEvent(Game game) + { + _game = game; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public Game GetGame() + { + return _game; + } + + public Player GetPlayer() + { + return _player; + } + + public PlayerState GetState() + { + return _state; + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/AsymTeamGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/AsymTeamGame.java new file mode 100644 index 000000000..03fc43e4f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/AsymTeamGame.java @@ -0,0 +1,61 @@ +package nautilus.game.arcade.game; + +import java.util.HashMap; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.kit.Kit; + +public abstract class AsymTeamGame extends TeamGame +{ + private HashMap _pastTeams = null; + + public AsymTeamGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc, HashMap pastTeams) + { + super(manager, gameType, kits, gameDesc); + + _pastTeams = pastTeams; + } + + public HashMap GetPastTeams() + { + return _pastTeams; + } + + @EventHandler(priority = EventPriority.HIGH) + public void GameStateChange(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Recruit) + return; + + if (GetPastTeams() != null) + { + this.SetCountdown(30); + this.SetCountdownForce(true); + } + } + + @Override + public GameTeam ChooseTeam(Player player) + { + //Get Past Team + ChatColor pastTeam = null; + if (_pastTeams != null) + pastTeam = _pastTeams.get(player.getName()); + + GameTeam newTeam = null; + + for (int i=0 ; i _files; + + //State + private GameState _gameState = GameState.Loading; + private long _gameStateTime = System.currentTimeMillis(); + + private int _countdown = -1; + private boolean _countdownForce = false; + + private int _playerCount = 0; + + private String _customWinLine = ""; + + //Kits + private Kit[] _kits; + + //Teams + private ArrayList _teamList = new ArrayList(); + + //Player Preferences + private NautHashMap _playerKit = new NautHashMap(); + private NautHashMap> _teamPreference = new NautHashMap>(); + private NautHashMap> _gemCount = new NautHashMap>(); + + //Scoreboard + private Scoreboard _scoreboard; + private Objective _sideObjective; + + //Loaded from Map Config + public WorldData WorldData = null; + + //Gameplay Flags + public boolean Damage = true; + public boolean DamagePvP = true; + public boolean DamagePvE = true; + public boolean DamageEvP = true; + public boolean DamageSelf = true; + public boolean DamageTeamSelf = false; + public boolean DamageTeamOther = true; + + public boolean BlockBreak = false; + public HashSet BlockBreakAllow = new HashSet(); + public HashSet BlockBreakDeny = new HashSet(); + + public boolean BlockPlace = false; + public HashSet BlockPlaceAllow = new HashSet(); + public HashSet BlockPlaceDeny = new HashSet(); + + public boolean ItemPickup = false; + public HashSet ItemPickupAllow = new HashSet(); + public HashSet ItemPickupDeny = new HashSet(); + + public boolean ItemDrop = false; + public HashSet ItemDropAllow = new HashSet(); + public HashSet ItemDropDeny = new HashSet(); + + public boolean PrivateBlocks = false; + + public boolean DeathOut = true; + public boolean DeathDropItems = true; + + public boolean CreatureAllow = false; + public boolean CreatureAllowOverride = false; + + public int WorldTimeSet = -1; + public int WorldHeightLimit = 0; + + public int HungerSet = -1; + public int HealthSet = -1; + + public int SpawnDistanceRequirement = 1; + + public boolean PrepareFreeze = true; + + public int WaterDamage = 0; + + public boolean RepairWeapons = true; + + //Addons + public boolean CompassEnabled = false; + public boolean SoupEnabled = true; + + //Gameplay Data + public HashMap PrivateBlockMap = new HashMap(); + public HashMap PrivateBlockCount = new HashMap(); + + public Location SpectatorSpawn = null; + + public boolean FirstKill = true; + + public String Winner = "Nobody"; + public GameTeam WinnerTeam = null; + + public Game(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc) + { + Manager = manager; + + //Game + _gameType = gameType; + _gameDesc = gameDesc; + + //Kits + _kits = kits; + + //Scoreboard + _scoreboard = Bukkit.getScoreboardManager().getNewScoreboard(); + + _sideObjective = _scoreboard.registerNewObjective("Obj"+UtilMath.r(999999999), "dummy"); + _sideObjective.setDisplaySlot(DisplaySlot.SIDEBAR); + _sideObjective.setDisplayName(C.Bold + GetName()); + + //Map + _files = Manager.LoadFiles(GetName()); + WorldData = new WorldData(this); + + System.out.println("Loading " + GetName() + "..."); + } + + public ArrayList GetFiles() + { + return _files; + } + + public String GetName() + { + return _gameType.GetName(); + } + + public GameType GetType() + { + return _gameType; + } + + public String[] GetDesc() + { + return _gameDesc; + } + + public void SetCustomWinLine(String line) + { + _customWinLine = line; + } + + public Scoreboard GetScoreboard() + { + return _scoreboard; + } + + public Objective GetObjectiveSide() + { + return _sideObjective; + } + + public ArrayList GetTeamList() + { + return _teamList; + } + + public int GetCountdown() + { + return _countdown; + } + + public void SetCountdown(int time) + { + _countdown = time; + } + + public boolean GetCountdownForce() + { + return _countdownForce; + } + + public void SetCountdownForce(boolean value) + { + _countdownForce = value; + } + + public int GetPlayerCountAtStart() + { + return _playerCount; + } + + public void SetPlayerCountAtStart(int count) + { + _playerCount = count; + } + + public NautHashMap> GetTeamPreferences() + { + return _teamPreference; + } + + public NautHashMap GetPlayerKits() + { + return _playerKit; + } + + public NautHashMap> GetPlayerGems() + { + return _gemCount; + } + + public GameState GetState() + { + return _gameState; + } + + public void SetState(GameState state) + { + _gameState = state; + _gameStateTime = System.currentTimeMillis(); + + //Event + GameStateChangeEvent stateEvent = new GameStateChangeEvent(this, state); + UtilServer.getServer().getPluginManager().callEvent(stateEvent); + + System.out.println(GetName() + " state set to " + state.toString()); + } + + public long GetStateTime() + { + return _gameStateTime; + } + + public boolean InProgress() + { + return GetState() == GameState.Prepare || GetState() == GameState.Live; + } + + public boolean IsLive() + { + return _gameState == GameState.Live; + } + + public void AddTeam(GameTeam team) + { + //Add + GetTeamList().add(team); + + //Set Spawn Data + team.SetSpawnRequirement(this.SpawnDistanceRequirement); + + + + System.out.println("Created Team: " + team.GetName()); + } + + public boolean HasTeam(GameTeam team) + { + for (GameTeam cur : GetTeamList()) + if (cur.equals(team)) + return true; + + return false; + } + + public void CreateScoreboardTeams() + { + System.out.println("Creating Scoreboard Teams."); + + //Base Groups + for (Rank rank : Rank.values()) + { + //Spectator + if (rank == Rank.ALL) + { + _scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(ChatColor.GRAY + ""); + } + else + { + _scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + ChatColor.GRAY); + } + } + + //Team Groups + for (GameTeam team : GetTeamList()) + { + for (Rank rank : Rank.values()) + { + if (rank == Rank.ALL) + { + _scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(team.GetColor() + ""); + } + else + { + _scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + team.GetColor()); + } + } + } + } + + public void RestrictKits() + { + //Null Default + } + + public void RegisterKits() + { + for (Kit kit : _kits) + { + UtilServer.getServer().getPluginManager().registerEvents(kit, Manager.GetPlugin()); + + for (Perk perk : kit.GetPerks()) + UtilServer.getServer().getPluginManager().registerEvents(perk, Manager.GetPlugin()); + } + + } + + public void DeregisterKits() + { + for (Kit kit : _kits) + { + HandlerList.unregisterAll(kit); + + for (Perk perk : kit.GetPerks()) + HandlerList.unregisterAll(perk); + } + } + + public void ParseData() + { + //Nothing by default, + //Use this to parse in extra location data from maps + } + + + + public void SetPlayerTeam(Player player, GameTeam team) + { + //Clean Old Team + GameTeam pastTeam = this.GetTeam(player); + if (pastTeam != null) + { + pastTeam.RemovePlayer(player); + } + + team.AddPlayer(player); + + //Ensure Valid Kit + ValidateKit(player, team); + + //Game Scoreboard + SetPlayerScoreboardTeam(player, team.GetName().toUpperCase()); + + //Lobby Scoreboard + Manager.GetLobby().AddPlayerToScoreboards(player, team.GetName().toUpperCase()); + } + + public void SetPlayerScoreboardTeam(Player player, String teamName) + { + for (Team team : GetScoreboard().getTeams()) + team.removePlayer(player); + + if (teamName == null) + teamName = ""; + + GetScoreboard().getTeam(Manager.GetClients().Get(player).GetRank().Name + teamName).addPlayer(player); + } + + public GameTeam ChooseTeam(Player player) + { + GameTeam team = null; + + //Random Team + for (int i=0 ; i<_teamList.size() ; i++) + { + if (team == null || _teamList.get(i).GetSize() < team.GetSize()) + { + team = _teamList.get(i); + } + } + + return team; + } + + public double GetKillsGems(Player killer, Player killed, boolean assist) + { + if (!DeathOut) + { + return 0.5; + } + + if (!assist) + { + return 4; + } + else + { + return 1; + } + } + + public HashMap GetGems(Player player) + { + if (!_gemCount.containsKey(player)) + _gemCount.put(player, new HashMap()); + + return _gemCount.get(player); + } + + public void AddGems(Player player, double gems, String reason, boolean countAmount) + { + if (!countAmount && gems < 1) + gems = 1; + + if (GetGems(player).containsKey(reason)) + { + GetGems(player).get(reason).AddGems(gems); + } + else + { + GetGems(player).put(reason, new GemData(gems, countAmount)); + } + } + + public void ValidateKit(Player player, GameTeam team) + { + //Kit + if (GetKit(player) == null || !team.KitAllowed(GetKit(player))) + { + for (Kit kit : _kits) + { + if (kit.GetAvailability() == KitAvailability.Hide || + kit.GetAvailability() == KitAvailability.Null) + continue; + + if (team.KitAllowed(kit)) + { + SetKit(player, kit, false); + break; + } + } + } + } + + public void SetKit(Player player, Kit kit, boolean announce) + { + GameTeam team = GetTeam(player); + if (team != null) + { + if (!team.KitAllowed(kit)) + { + player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f); + UtilPlayer.message(player, F.main("Kit", F.elem(team.GetFormattedName()) + " cannot use " + F.elem(kit.GetFormattedName() + " Kit") + ".")); + return; + } + } + + _playerKit.put(player, kit); + + if (announce) + { + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1f); + UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + ".")); + } + } + + public Kit GetKit(Player player) + { + return _playerKit.get(player); + } + + public Kit[] GetKits() + { + return _kits; + } + + public boolean HasKit(Kit kit) + { + for (Kit cur : GetKits()) + if (cur.equals(kit)) + return true; + + return false; + } + + public boolean HasKit(Player player, Kit kit) + { + if (GetKit(player) == null) + return false; + + return GetKit(player).equals(kit); + } + + public boolean SetPlayerState(Player player, PlayerState state) + { + GetScoreboard().resetScores(player); + + GameTeam team = GetTeam(player); + + if (team == null) + return false; + + team.SetPlayerState(player, state); + + //Event + PlayerStateChangeEvent playerStateEvent = new PlayerStateChangeEvent(this, player, PlayerState.OUT); + UtilServer.getServer().getPluginManager().callEvent(playerStateEvent); + + return true; + } + + public abstract void EndCheck(); + + public void RespawnPlayer(final Player player) + { + player.eject(); + player.teleport(GetTeam(player).GetSpawn()); + + Manager.Clear(player); + + //Re-Give Kit + Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() + { + public void run() + { + GetKit(player).ApplyKit(player); + } + }, 0); + } + + public boolean IsPlaying(Player player) + { + return GetTeam(player) != null; + } + + public boolean IsAlive(Player player) + { + GameTeam team = GetTeam(player); + + if (team == null) + return false; + + return team.IsAlive(player); + } + + public ArrayList GetPlayers(boolean aliveOnly) + { + ArrayList players = new ArrayList(); + + for (GameTeam team : _teamList) + players.addAll(team.GetPlayers(aliveOnly)); + + return players; + } + + public GameTeam GetTeam(Player player) + { + for (GameTeam team : _teamList) + if (team.HasPlayer(player)) + return team; + + return null; + } + + public GameTeam GetTeam(ChatColor color) + { + for (GameTeam team : _teamList) + if (team.GetColor() == color) + return team; + + return null; + } + + public Location GetSpectatorLocation() + { + if (SpectatorSpawn != null) + return SpectatorSpawn; + + Vector vec = new Vector(0,0,0); + double count = 0; + + for (GameTeam team : this.GetTeamList()) + { + for (Location spawn : team.GetSpawns()) + { + count++; + vec.add(spawn.toVector()); + } + } + + SpectatorSpawn = new Location(this.WorldData.World, 0,0,0); + + vec.multiply(1d/count); + + SpectatorSpawn.setX(vec.getX()); + SpectatorSpawn.setY(vec.getY()); + SpectatorSpawn.setZ(vec.getZ()); + + //Move Up - Out Of Blocks + while (!UtilBlock.airFoliage(SpectatorSpawn.getBlock()) || !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) + { + SpectatorSpawn.add(0, 1, 0); + } + + int Up = 0; + + //Move Up - Through Air + for (int i=0 ; i<15 ; i++) + { + if (UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) + { + SpectatorSpawn.add(0, 1, 0); + Up++; + } + else + { + break; + } + } + + //Move Down - Out Of Blocks + while (Up > 0 && !UtilBlock.airFoliage(SpectatorSpawn.getBlock()) || !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) + { + SpectatorSpawn.subtract(0, 1, 0); + Up--; + } + + SpectatorSpawn = SpectatorSpawn.getBlock().getLocation().add(0.5, 0.1, 0.5); + + while (SpectatorSpawn.getBlock().getTypeId() != 0 || SpectatorSpawn.getBlock().getRelative(BlockFace.UP).getTypeId() != 0) + SpectatorSpawn.add(0, 1, 0); + + return SpectatorSpawn; + } + + public void SetSpectator(Player player) + { + Manager.Clear(player); + + player.teleport(GetSpectatorLocation()); + player.setGameMode(GameMode.CREATIVE); + player.setFlying(true); + player.setFlySpeed(0.1f); + ((CraftPlayer)player).getHandle().spectating = true; + ((CraftPlayer)player).getHandle().m = false; + + Manager.GetCondition().Factory().Cloak("Spectator", player, player, 7777, true, true); + + if (GetTeam(player) != null && _scoreboard.getTeam(GetTeam(player).GetName().toUpperCase()) != null) + { + _scoreboard.getTeam(GetTeam(player).GetName().toUpperCase()).removePlayer(player); + } + + SetPlayerScoreboardTeam(player, "SPEC"); + } + + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (GameTeam team : this.GetTeamList()) + { + String name = team.GetColor() + team.GetName(); + if (name.length() > 16) + name = name.substring(0, 16); + + Score score = GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(name)); + score.setScore(team.GetPlayers(true).size()); + } + } + + public boolean DisplayDeathMessage() + { + if (this.DeathOut) + { + return true; + } + + return false; + } + + public boolean CanJoinTeam(GameTeam team) + { + return team.GetSize() < UtilServer.getPlayers().length/GetTeamList().size(); + } + + public GameTeam GetTeamPreference(Player player) + { + for (GameTeam team : _teamPreference.keySet()) + { + if (_teamPreference.get(team).contains(player)) + return team; + } + + return null; + } + + public void RemoveTeamPreference(Player player) + { + for (ArrayList queue : _teamPreference.values()) + queue.remove(player); + } + + public String GetTeamQueuePosition(Player player) + { + for (ArrayList queue : _teamPreference.values()) + { + for (int i=0 ; i places) + { + for (Player player : UtilServer.getPlayers()) + { + player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f); + + UtilPlayer.message(player, ""); + UtilPlayer.message(player, ArcadeFormat.Line); + + UtilPlayer.message(player, "§aGame - §f§l" + this.GetName()); + UtilPlayer.message(player, ""); + + if (places == null || places.isEmpty()) + { + UtilPlayer.message(player, ""); + UtilPlayer.message(player, ChatColor.WHITE + "§lNobody won the game..."); + UtilPlayer.message(player, ""); + } + else + { + if (places.size() >= 1) + { + Winner = places.get(0).getName(); + UtilPlayer.message(player, C.cRed + C.Bold + "1st Place" + C.cWhite + " - " + places.get(0).getName()); + } + + + if (places.size() >= 2) + UtilPlayer.message(player, C.cGold + C.Bold + "2nd Place" + C.cWhite + " - " + places.get(1).getName()); + + if (places.size() >= 3) + UtilPlayer.message(player, C.cYellow + C.Bold + "3rd Place" + C.cWhite + " - " + places.get(2).getName()); + } + + UtilPlayer.message(player, ""); + UtilPlayer.message(player, "§aMap - §f§l" + WorldData.MapName + C.cGray + " created by " + "§f§l" + WorldData.MapAuthor); + + UtilPlayer.message(player, ArcadeFormat.Line); + } + + Manager.GetChat().Silence(5000, false); + } + + public void Announce(String message) + { + for (Player player : UtilServer.getPlayers()) + { + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 1f); + + UtilPlayer.message(player, message); + } + } + + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java.orig b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java.orig new file mode 100644 index 000000000..2de8ce204 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java.orig @@ -0,0 +1,896 @@ +package nautilus.game.arcade.game; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import nautilus.game.arcade.ArcadeFormat; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerStateChangeEvent; +import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.world.WorldData; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.scoreboard.DisplaySlot; +import org.bukkit.scoreboard.Objective; +import org.bukkit.scoreboard.Score; +import org.bukkit.scoreboard.Scoreboard; +import org.bukkit.scoreboard.Team; +import org.bukkit.util.Vector; + +public abstract class Game implements Listener +{ + public enum GameState + { + Loading, + Recruit, + Prepare, + Live, + End, + Dead + } + + public ArcadeManager Manager; + + //Game + private GameType _gameType; + private String[] _gameDesc; + + //Map + private ArrayList _files; + + //State + private GameState _gameState = GameState.Loading; + private long _gameStateTime = System.currentTimeMillis(); + + private int _countdown = -1; + private boolean _countdownForce = false; + + private int _playerCount = 0; + + private String _customWinLine = ""; + + //Kits + private Kit[] _kits; + + //Teams + private ArrayList _teamList = new ArrayList(); + + //Player Preferences + private NautHashMap _playerKit = new NautHashMap(); + private NautHashMap> _teamPreference = new NautHashMap>(); + private NautHashMap> _gemCount = new NautHashMap>(); + + //Scoreboard + private Scoreboard _scoreboard; + private Objective _sideObjective; + + //Loaded from Map Config + public WorldData WorldData = null; + + //Gameplay Flags + public boolean Damage = true; + public boolean DamagePvP = true; + public boolean DamagePvE = true; + public boolean DamageEvP = true; + public boolean DamageSelf = true; + public boolean DamageTeamSelf = false; + public boolean DamageTeamOther = true; + + public boolean BlockBreak = false; + public HashSet BlockBreakAllow = new HashSet(); + public HashSet BlockBreakDeny = new HashSet(); + + public boolean BlockPlace = false; + public HashSet BlockPlaceAllow = new HashSet(); + public HashSet BlockPlaceDeny = new HashSet(); + + public boolean ItemPickup = false; + public HashSet ItemPickupAllow = new HashSet(); + public HashSet ItemPickupDeny = new HashSet(); + + public boolean ItemDrop = false; + public HashSet ItemDropAllow = new HashSet(); + public HashSet ItemDropDeny = new HashSet(); + + public boolean PrivateBlocks = false; + + public boolean DeathOut = true; + public boolean DeathDropItems = true; + + public boolean CreatureAllow = false; + public boolean CreatureAllowOverride = false; + + public int WorldTimeSet = -1; + public int WorldHeightLimit = 0; + + public int HungerSet = -1; + public int HealthSet = -1; + + public int SpawnDistanceRequirement = 1; + + public boolean PrepareFreeze = true; + + public int WaterDamage = 0; + + public boolean RepairWeapons = true; + + //Addons + public boolean CompassEnabled = false; + public boolean SoupEnabled = true; + + //Gameplay Data + public HashMap PrivateBlockMap = new HashMap(); + public HashMap PrivateBlockCount = new HashMap(); + + public Location SpectatorSpawn = null; + + public boolean FirstKill = true; + + public String Winner = "Nobody"; + public GameTeam WinnerTeam = null; + + public Game(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc) + { + Manager = manager; + + //Game + _gameType = gameType; + _gameDesc = gameDesc; + + //Kits + _kits = kits; + + //Scoreboard + _scoreboard = Bukkit.getScoreboardManager().getNewScoreboard(); + + _sideObjective = _scoreboard.registerNewObjective("Obj"+UtilMath.r(999999999), "dummy"); + _sideObjective.setDisplaySlot(DisplaySlot.SIDEBAR); + _sideObjective.setDisplayName(C.Bold + GetName()); + + //Map + _files = Manager.LoadFiles(GetName()); + WorldData = new WorldData(this); + + System.out.println("Loading " + GetName() + "..."); + } + + public ArrayList GetFiles() + { + return _files; + } + + public String GetName() + { + return _gameType.GetName(); + } + + public GameType GetType() + { + return _gameType; + } + + public String[] GetDesc() + { + return _gameDesc; + } + + public void SetCustomWinLine(String line) + { + _customWinLine = line; + } + + public Scoreboard GetScoreboard() + { + return _scoreboard; + } + + public Objective GetObjectiveSide() + { + return _sideObjective; + } + + public ArrayList GetTeamList() + { + return _teamList; + } + + public int GetCountdown() + { + return _countdown; + } + + public void SetCountdown(int time) + { + _countdown = time; + } + + public boolean GetCountdownForce() + { + return _countdownForce; + } + + public void SetCountdownForce(boolean value) + { + _countdownForce = value; + } + + public int GetPlayerCountAtStart() + { + return _playerCount; + } + + public void SetPlayerCountAtStart(int count) + { + _playerCount = count; + } + + public NautHashMap> GetTeamPreferences() + { + return _teamPreference; + } + + public NautHashMap GetPlayerKits() + { + return _playerKit; + } + + public NautHashMap> GetPlayerGems() + { + return _gemCount; + } + + public GameState GetState() + { + return _gameState; + } + + public void SetState(GameState state) + { + _gameState = state; + _gameStateTime = System.currentTimeMillis(); + + //Event + GameStateChangeEvent stateEvent = new GameStateChangeEvent(this, state); + UtilServer.getServer().getPluginManager().callEvent(stateEvent); + + System.out.println(GetName() + " state set to " + state.toString()); + } + + public long GetStateTime() + { + return _gameStateTime; + } + + public boolean InProgress() + { + return GetState() == GameState.Prepare || GetState() == GameState.Live; + } + + public boolean IsLive() + { + return _gameState == GameState.Live; + } + + public void AddTeam(GameTeam team) + { + //Add + GetTeamList().add(team); + + //Set Spawn Data + team.SetSpawnRequirement(this.SpawnDistanceRequirement); + + + + System.out.println("Created Team: " + team.GetName()); + } + + public boolean HasTeam(GameTeam team) + { + for (GameTeam cur : GetTeamList()) + if (cur.equals(team)) + return true; + + return false; + } + + public void CreateScoreboardTeams() + { + System.out.println("Creating Scoreboard Teams."); + + //Base Groups + for (Rank rank : Rank.values()) + { + //Spectator + if (rank == Rank.ALL) + { + _scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(ChatColor.GRAY + ""); + } + else + { + _scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + ChatColor.GRAY); + } + } + + //Team Groups + for (GameTeam team : GetTeamList()) + { + for (Rank rank : Rank.values()) + { + if (rank == Rank.ALL) + { + _scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(team.GetColor() + ""); + } + else + { + _scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + team.GetColor()); + } + } + } + } + + public void RestrictKits() + { + //Null Default + } + + public void RegisterKits() + { + for (Kit kit : _kits) + { + UtilServer.getServer().getPluginManager().registerEvents(kit, Manager.GetPlugin()); + + for (Perk perk : kit.GetPerks()) + UtilServer.getServer().getPluginManager().registerEvents(perk, Manager.GetPlugin()); + } + + } + + public void DeregisterKits() + { + for (Kit kit : _kits) + { + HandlerList.unregisterAll(kit); + + for (Perk perk : kit.GetPerks()) + HandlerList.unregisterAll(perk); + } + } + + public void ParseData() + { + //Nothing by default, + //Use this to parse in extra location data from maps + } + + + + public void SetPlayerTeam(Player player, GameTeam team) + { + //Clean Old Team + GameTeam pastTeam = this.GetTeam(player); + if (pastTeam != null) + { + pastTeam.RemovePlayer(player); + } + + team.AddPlayer(player); + + //Ensure Valid Kit + ValidateKit(player, team); + + //Game Scoreboard + SetPlayerScoreboardTeam(player, team.GetName().toUpperCase()); + + //Lobby Scoreboard + Manager.GetLobby().AddPlayerToScoreboards(player, team.GetName().toUpperCase()); + } + + public void SetPlayerScoreboardTeam(Player player, String teamName) + { + for (Team team : GetScoreboard().getTeams()) + team.removePlayer(player); + + if (teamName == null) + teamName = ""; + + GetScoreboard().getTeam(Manager.GetClients().Get(player).GetRank().Name + teamName).addPlayer(player); + } + + public GameTeam ChooseTeam(Player player) + { + GameTeam team = null; + + //Random Team + for (int i=0 ; i<_teamList.size() ; i++) + { + if (team == null || _teamList.get(i).GetSize() < team.GetSize()) + { + team = _teamList.get(i); + } + } + + return team; + } + + public double GetKillsGems(Player killer, Player killed, boolean assist) + { + if (!DeathOut) + { + return 0.5; + } + + if (!assist) + { + return 4; + } + else + { + return 1; + } + } + + public HashMap GetGems(Player player) + { + if (!_gemCount.containsKey(player)) + _gemCount.put(player, new HashMap()); + + return _gemCount.get(player); + } + + public void AddGems(Player player, double gems, String reason, boolean countAmount) + { + if (!countAmount && gems < 1) + gems = 1; + + if (GetGems(player).containsKey(reason)) + { + GetGems(player).get(reason).AddGems(gems); + } + else + { + GetGems(player).put(reason, new GemData(gems, countAmount)); + } + } + + public void ValidateKit(Player player, GameTeam team) + { + //Kit + if (GetKit(player) == null || !team.KitAllowed(GetKit(player))) + { + for (Kit kit : _kits) + { + if (kit.GetAvailability() == KitAvailability.Hide || + kit.GetAvailability() == KitAvailability.Null) + continue; + + if (team.KitAllowed(kit)) + { + SetKit(player, kit, false); + break; + } + } + } + } + + public void SetKit(Player player, Kit kit, boolean announce) + { + GameTeam team = GetTeam(player); + if (team != null) + { + if (!team.KitAllowed(kit)) + { + player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f); + UtilPlayer.message(player, F.main("Kit", F.elem(team.GetFormattedName()) + " cannot use " + F.elem(kit.GetFormattedName() + " Kit") + ".")); + return; + } + } + + _playerKit.put(player, kit); + + if (announce) + { + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1f); + UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + ".")); + } + } + + public Kit GetKit(Player player) + { + return _playerKit.get(player); + } + + public Kit[] GetKits() + { + return _kits; + } + + public boolean HasKit(Kit kit) + { + for (Kit cur : GetKits()) + if (cur.equals(kit)) + return true; + + return false; + } + + public boolean SetPlayerState(Player player, PlayerState state) + { + GetScoreboard().resetScores(player); + + GameTeam team = GetTeam(player); + + if (team == null) + return false; + + team.SetPlayerState(player, state); + + //Event + PlayerStateChangeEvent playerStateEvent = new PlayerStateChangeEvent(this, player, PlayerState.OUT); + UtilServer.getServer().getPluginManager().callEvent(playerStateEvent); + + return true; + } + + public abstract void EndCheck(); + + public void RespawnPlayer(final Player player) + { + player.eject(); + player.teleport(GetTeam(player).GetSpawn()); + + Manager.Clear(player); + + //Re-Give Kit + Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() + { + public void run() + { + GetKit(player).ApplyKit(player); + } + }, 0); + } + + public boolean IsPlaying(Player player) + { + return GetTeam(player) != null; + } + + public boolean IsAlive(Player player) + { + GameTeam team = GetTeam(player); + + if (team == null) + return false; + + return team.IsAlive(player); + } + + public ArrayList GetPlayers(boolean aliveOnly) + { + ArrayList players = new ArrayList(); + + for (GameTeam team : _teamList) + players.addAll(team.GetPlayers(aliveOnly)); + + return players; + } + + public GameTeam GetTeam(Player player) + { + for (GameTeam team : _teamList) + if (team.HasPlayer(player)) + return team; + + return null; + } + + public GameTeam GetTeam(ChatColor color) + { + for (GameTeam team : _teamList) + if (team.GetColor() == color) + return team; + + return null; + } + + public Location GetSpectatorLocation() + { + if (SpectatorSpawn != null) + return SpectatorSpawn; + + Vector vec = new Vector(0,0,0); + double count = 0; + + for (GameTeam team : this.GetTeamList()) + { + for (Location spawn : team.GetSpawns()) + { + count++; + vec.add(spawn.toVector()); + } + } + + SpectatorSpawn = new Location(this.WorldData.World, 0,0,0); + + vec.multiply(1d/count); + + SpectatorSpawn.setX(vec.getX()); + SpectatorSpawn.setY(vec.getY()); + SpectatorSpawn.setZ(vec.getZ()); + + //Move Up - Out Of Blocks + while (!UtilBlock.airFoliage(SpectatorSpawn.getBlock()) || !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) + { + SpectatorSpawn.add(0, 1, 0); + } + + int Up = 0; + + //Move Up - Through Air + for (int i=0 ; i<15 ; i++) + { + if (UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) + { + SpectatorSpawn.add(0, 1, 0); + Up++; + } + else + { + break; + } + } + + //Move Down - Out Of Blocks + while (Up > 0 && !UtilBlock.airFoliage(SpectatorSpawn.getBlock()) || !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) + { + SpectatorSpawn.subtract(0, 1, 0); + Up--; + } + + SpectatorSpawn = SpectatorSpawn.getBlock().getLocation().add(0.5, 0.1, 0.5); + + while (SpectatorSpawn.getBlock().getTypeId() != 0 || SpectatorSpawn.getBlock().getRelative(BlockFace.UP).getTypeId() != 0) + SpectatorSpawn.add(0, 1, 0); + + return SpectatorSpawn; + } + + public void SetSpectator(Player player) + { + Manager.Clear(player); + + player.teleport(GetSpectatorLocation()); + player.setGameMode(GameMode.CREATIVE); + player.setFlying(true); + player.setFlySpeed(0.1f); + ((CraftPlayer)player).getHandle().spectating = true; + ((CraftPlayer)player).getHandle().m = false; + + Manager.GetCondition().Factory().Cloak("Spectator", player, player, 7777, true, true); + + if (GetTeam(player) != null && _scoreboard.getTeam(GetTeam(player).GetName().toUpperCase()) != null) + { + _scoreboard.getTeam(GetTeam(player).GetName().toUpperCase()).removePlayer(player); + } + + SetPlayerScoreboardTeam(player, "SPEC"); + } + + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (GameTeam team : this.GetTeamList()) + { + String name = team.GetColor() + team.GetName(); + if (name.length() > 16) + name = name.substring(0, 16); + + Score score = GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(name)); + score.setScore(team.GetPlayers(true).size()); + } + } + + public boolean DisplayDeathMessage() + { + if (this.DeathOut) + { + return true; + } + + return false; + } + + public boolean CanJoinTeam(GameTeam team) + { + return team.GetSize() < UtilServer.getPlayers().length/GetTeamList().size(); + } + + public GameTeam GetTeamPreference(Player player) + { + for (GameTeam team : _teamPreference.keySet()) + { + if (_teamPreference.get(team).contains(player)) + return team; + } + + return null; + } + + public void RemoveTeamPreference(Player player) + { + for (ArrayList queue : _teamPreference.values()) + queue.remove(player); + } + + public String GetTeamQueuePosition(Player player) + { + for (ArrayList queue : _teamPreference.values()) + { + for (int i=0 ; i places) + { + for (Player player : UtilServer.getPlayers()) + { + player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f); + + UtilPlayer.message(player, ""); + UtilPlayer.message(player, ArcadeFormat.Line); + + UtilPlayer.message(player, "§aGame - §f§l" + this.GetName()); + UtilPlayer.message(player, ""); + + if (places == null || places.isEmpty()) + { + UtilPlayer.message(player, ""); + UtilPlayer.message(player, ChatColor.WHITE + "§lNobody won the game..."); + UtilPlayer.message(player, ""); + } + else + { + if (places.size() >= 1) + { + Winner = places.get(0).getName(); + UtilPlayer.message(player, C.cRed + C.Bold + "1st Place" + C.cWhite + " - " + places.get(0).getName()); + } + + + if (places.size() >= 2) + UtilPlayer.message(player, C.cGold + C.Bold + "2nd Place" + C.cWhite + " - " + places.get(1).getName()); + + if (places.size() >= 3) + UtilPlayer.message(player, C.cYellow + C.Bold + "3rd Place" + C.cWhite + " - " + places.get(2).getName()); + } + + UtilPlayer.message(player, ""); + UtilPlayer.message(player, "§aMap - §f§l" + WorldData.MapName + C.cGray + " created by " + "§f§l" + WorldData.MapAuthor); + + UtilPlayer.message(player, ArcadeFormat.Line); + } + + Manager.GetChat().Silence(5000, false); + } + + public void Announce(String message) + { + for (Player player : UtilServer.getPlayers()) + { + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 1f); + + UtilPlayer.message(player, message); + } + } + + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java new file mode 100644 index 000000000..664f28255 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java @@ -0,0 +1,18 @@ +package nautilus.game.arcade.game; + +import java.util.ArrayList; + +import nautilus.game.arcade.GameType; + +public class GameServerConfig +{ + public String ServerType = null; + public int MinPlayers = -1; + public int MaxPlayers = -1; + public ArrayList GameList = new ArrayList(); + + public boolean IsValid() + { + return ServerType != null && MinPlayers != -1 && MaxPlayers != -1; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java new file mode 100644 index 000000000..d8804eb98 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java @@ -0,0 +1,250 @@ +package nautilus.game.arcade.game; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Player; + +public class GameTeam +{ + public enum PlayerState + { + IN("In", ChatColor.GREEN), + OUT("Out", ChatColor.RED); + + private String name; + private ChatColor color; + + private PlayerState(String name, ChatColor color) + { + this.name = name; + this.color = color; + } + + public String GetName() + { + return name; + } + + public ChatColor GetColor() + { + return color; + } + } + + private String _name; + private ChatColor _color; + + private HashMap _players = new HashMap(); + + private ArrayList _spawns; + + private Creature _teamEntity = null; + + private HashSet _kitRestrict = new HashSet(); + + private int _spawnDistance = 0; + + public GameTeam(String name, ChatColor color, ArrayList spawns) + { + _name = name; + _color = color; + _spawns = spawns; + } + + public String GetName() + { + return _name; + } + + public ChatColor GetColor() + { + return _color; + } + + public ArrayList GetSpawns() + { + return _spawns; + } + + public Location GetSpawn() + { + ArrayList valid = new ArrayList(); + for (Location loc : _spawns) + { + double closestPlayer = -1; + + for (Player player : GetPlayers(true)) + { + double playerDist = UtilMath.offset(player.getLocation(), loc); + + if (closestPlayer == -1 || playerDist < closestPlayer) + closestPlayer = playerDist; + } + + if (closestPlayer > _spawnDistance) + { + valid.add(loc); + } + } + + if (valid.size() > 0) + valid.get(UtilMath.r(valid.size())); + + return _spawns.get(UtilMath.r(_spawns.size())); + } + + public void AddPlayer(Player player) + { + _players.put(player, PlayerState.IN); + + UtilPlayer.message(player, F.main("Team", _color + C.Bold + "You joined " + _name + " Team") + "."); + + for (Player other : UtilServer.getPlayers()) + { + if (other.equals(player)) + continue; + + other.hidePlayer(player); + other.showPlayer(player); + } + } + + public void RemovePlayer(Player player) + { + _players.remove(player); + } + + public boolean HasPlayer(Player player) + { + return _players.containsKey(player); + } + + public int GetSize() + { + return _players.size(); + } + + public void SetPlayerState(Player player, PlayerState state) + { + _players.put(player, state); + } + + public boolean IsTeamAlive() + { + for (PlayerState state : _players.values()) + if (state == PlayerState.IN) + return true; + + return false; + } + + public ArrayList GetPlayers(boolean playerIn) + { + ArrayList alive = new ArrayList(); + + for (Player player : _players.keySet()) + if (!playerIn || _players.get(player) == PlayerState.IN ) + alive.add(player); + + return alive; + } + + public String GetFormattedName() + { + return GetColor() + "§l" + GetName(); + } + + public void SpawnTeleport() + { + for (Player player : GetPlayers(true)) + { + player.leaveVehicle(); + player.eject(); + player.teleport(GetSpawn()); + } + } + + public HashSet GetRestrictedKits() + { + return _kitRestrict; + } + + public boolean KitAllowed(Kit kit) + { + if (kit.GetAvailability() == KitAvailability.Null) + return false; + + return !_kitRestrict.contains(kit); + } + + public boolean IsAlive(Player player) + { + if (!_players.containsKey(player)) + return false; + + return _players.get(player) == PlayerState.IN; + } + + public void SetColor(ChatColor color) + { + _color = color; + } + + public void SetName(String name) + { + _name = name; + } + + public byte GetColorData() + { + if (GetColor() == ChatColor.WHITE) return (byte)0; + if (GetColor() == ChatColor.GOLD) return (byte)1; + if (GetColor() == ChatColor.LIGHT_PURPLE) return (byte)2; + if (GetColor() == ChatColor.AQUA) return (byte)3; + if (GetColor() == ChatColor.YELLOW) return (byte)4; + if (GetColor() == ChatColor.GREEN) return (byte)5; + //if (GetColor() == ChatColor.PINK) return (byte)6; + if (GetColor() == ChatColor.DARK_GRAY) return (byte)7; + if (GetColor() == ChatColor.GRAY) return (byte)8; + if (GetColor() == ChatColor.DARK_AQUA) return (byte)9; + if (GetColor() == ChatColor.DARK_PURPLE) return (byte)10; + if (GetColor() == ChatColor.BLUE) return (byte)11; + //if (GetColor() == ChatColor.BROWN) return (byte)12; + if (GetColor() == ChatColor.DARK_GREEN) return (byte)13; + if (GetColor() == ChatColor.RED) return (byte)14; + else return (byte)15; + } + + public void SetTeamEntity(Creature ent) + { + _teamEntity = ent; + } + + public Creature GetTeamEntity() + { + return _teamEntity; + } + + public void SetSpawns(ArrayList spawns) + { + _spawns = spawns; + } + + public void SetSpawnRequirement(int value) + { + _spawnDistance = value; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GemData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GemData.java new file mode 100644 index 000000000..53c2659d4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GemData.java @@ -0,0 +1,23 @@ +package nautilus.game.arcade.game; + +public class GemData +{ + public double Gems; + public int Amount; + + public GemData(double gems, boolean amount) + { + Gems = gems; + + if (amount) + Amount = 1; + } + + public void AddGems(double gems) + { + Gems += gems; + + if (Amount > 0) + Amount++; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/SoloGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/SoloGame.java new file mode 100644 index 000000000..e7daedf94 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/SoloGame.java @@ -0,0 +1,126 @@ +package nautilus.game.arcade.game; + +import java.util.ArrayList; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerStateChangeEvent; +import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.kit.Kit; + +public abstract class SoloGame extends Game +{ + protected ArrayList _places = new ArrayList(); + + public SoloGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc) + { + super(manager, gameType, kits, gameDesc); + } + + @EventHandler + public void CustomTeamGeneration(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Recruit) + return; + + this.GetTeamList().get(0).SetColor(ChatColor.DARK_GREEN); + this.GetTeamList().get(0).SetName("Players"); + } + + @EventHandler + public void EndStateChange(PlayerStateChangeEvent event) + { + if (event.GetState() == PlayerState.OUT) + if (!_places.contains(event.GetPlayer())) + _places.add(0, event.GetPlayer()); + + else + _places.remove(event.GetPlayer()); + } + + @Override + public void EndCheck() + { + if (!IsLive()) + return; + + //Add Winner + if (GetPlayers(true).size() == 1) + { + SetPlayerState(GetPlayers(true).get(0), PlayerState.OUT); + return; + } + + if (GetPlayers(true).size() <= 0) + { + //Announce + AnnounceEnd(_places); + + //Gems + if (_places.size() >= 1) + AddGems(_places.get(0), 20, "1st Place", false); + + if (_places.size() >= 2) + AddGems(_places.get(1), 15, "2nd Place", false); + + if (_places.size() >= 3) + AddGems(_places.get(2), 10, "3rd Place", false); + + /* + int sections = _places.size()/10; + + + for (int i=0 ; i<5 ; i++) + { + for (int j=i*sections ; j < j*sections + sections ; j++) + { + AddGems(_places.get(j), 5-i, "Top " + ((i+1)*10) + "%", false); + } + } + */ + + for (Player player : GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false); + + //End + SetState(GameState.End); + + } + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (GetTeamList().isEmpty()) + return; + + GameTeam team = GetTeamList().get(0); + + GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(team.GetColor() + "Alive")).setScore(team.GetPlayers(true).size()); + GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(C.cRed + "Dead")).setScore(team.GetPlayers(false).size() - team.GetPlayers(true).size()); + } + + public ArrayList GetPlaces() + { + return _places; + } + + public int GetScoreboardScore(Player player) + { + return 0; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java new file mode 100644 index 000000000..fa471b069 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java @@ -0,0 +1,52 @@ +package nautilus.game.arcade.game; + +import java.util.ArrayList; + +import org.bukkit.entity.Player; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.kit.Kit; + +public abstract class TeamGame extends Game +{ + public TeamGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc) + { + super(manager, gameType, kits, gameDesc); + } + + public void EndCheck() + { + if (!IsLive()) + return; + + ArrayList teamsAlive = new ArrayList(); + + for (GameTeam team : this.GetTeamList()) + if (team.GetPlayers(true).size() > 0) + teamsAlive.add(team); + + if (teamsAlive.size() <= 1) + { + //Announce + if (teamsAlive.size() > 0) + AnnounceEnd(teamsAlive.get(0)); + + for (GameTeam team : GetTeamList()) + { + if (WinnerTeam != null && team.equals(WinnerTeam)) + { + for (Player player : team.GetPlayers(false)) + AddGems(player, 10, "Winning Team", false); + } + + for (Player player : team.GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false); + } + + //End + SetState(GameState.End); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/deathtag/DeathTag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/deathtag/DeathTag.java new file mode 100644 index 000000000..682b21fd0 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/deathtag/DeathTag.java @@ -0,0 +1,26 @@ +package nautilus.game.arcade.game.minigames.deathtag; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.game.minigames.deathtag.kits.*; +import nautilus.game.arcade.kit.Kit; + +public class DeathTag extends TeamGame +{ + public DeathTag(ArcadeManager manager) + { + super(manager, GameType.DeathTag, + + new Kit[] + { + new KitArcher(manager), + }, + + new String[] { + "Tag opponents by killing then.", + "Revive tagged allies by standing near them.", + "Win by Tagging all opponents." + }); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/deathtag/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/deathtag/kits/KitArcher.java new file mode 100644 index 000000000..d6609f2e9 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/deathtag/kits/KitArcher.java @@ -0,0 +1,56 @@ +package nautilus.game.arcade.game.minigames.deathtag.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitArcher extends Kit +{ + public KitArcher(ArcadeManager manager) + { + super(manager, "Archer", KitAvailability.Blue, + + new String[] + { + "BOWBOW" + }, + + new Perk[] + { + new PerkFletcher(2, 8, true), + new PerkBarrage(5, 250, true) + }, + EntityType.SKELETON, + new ItemStack(Material.BOW)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + } + + @Override + public void SpawnCustom(Creature ent) + { + ent.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); + ent.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE)); + ent.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS)); + ent.getEquipment().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/DragonData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/DragonData.java new file mode 100644 index 000000000..9b1a7eded --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/DragonData.java @@ -0,0 +1,152 @@ +package nautilus.game.arcade.game.minigames.dragons; + +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; + +import org.bukkit.Location; +import org.bukkit.entity.EnderDragon; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +public class DragonData +{ + public Dragons Host; + + public EnderDragon Dragon; + + public Entity TargetEntity = null; + + public Location Target = null; + public Location Location = null; + + public float Pitch = 0; + public Vector Velocity = new Vector(0,0,0); + + public double RangeBest = 1000; + public long RangeTime = 0; + + public DragonData(Dragons host, EnderDragon dragon) + { + Host = host; + + Dragon = dragon; + + Velocity = dragon.getLocation().getDirection().setY(0).normalize(); + Pitch = UtilAlg.GetPitch(dragon.getLocation().getDirection()); + + Location = dragon.getLocation(); + } + + public void Update() + { + Turn(); + + Location.add(Velocity); + Location.add(0, -Pitch, 0); + + Location.setPitch(-1 * Pitch); + Location.setYaw(180 + UtilAlg.GetYaw(Velocity)); + + Dragon.teleport(Location); + } + + private void Turn() + { + //Pitch + float desiredPitch = UtilAlg.GetPitch(UtilAlg.getTrajectory(Location, Target)); + if (desiredPitch < Pitch) Pitch = (float)(Pitch - 0.05); + if (desiredPitch > Pitch) Pitch = (float)(Pitch + 0.05); + if (Pitch > 0.5) Pitch = 0.5f; + if (Pitch < -0.5) Pitch = -0.5f; + + //Flat + Vector desired = UtilAlg.getTrajectory2d(Location, Target); + desired.subtract(UtilAlg.Normalize(new Vector(Velocity.getX(), 0, Velocity.getZ()))); + desired.multiply(0.075); + + Velocity.add(desired); + + //Speed + UtilAlg.Normalize(Velocity); + } + + public void Target() + { + if (TargetEntity != null) + { + if (!TargetEntity.isValid()) + { + TargetEntity = null; + } + else + { + Target = TargetEntity.getLocation().subtract(0, 8, 0); + } + + return; + } + + if (Target == null) + { + TargetSky(); + } + + if (UtilMath.offset(Location, Target) < 4) + { + //Target Player + if (Target.getY() >= Host.GetSpectatorLocation().getY()) + { + TargetPlayer(); + } + //Target Sky + else + { + TargetSky(); + } + } + + TargetTimeout(); + } + + public void TargetTimeout() + { + if (UtilMath.offset(Location, Target)+1 < RangeBest) + { + RangeTime = System.currentTimeMillis(); + RangeBest = UtilMath.offset(Location, Target); + } + else + { + if (UtilTime.elapsed(RangeTime, 10000)) + { + TargetSky(); + } + } + } + + public void TargetSky() + { + RangeBest = 9000; + RangeTime = System.currentTimeMillis(); + + Target = Host.GetSpectatorLocation().clone().add(50 - UtilMath.r(100), 20 + UtilMath.r(30), 50 - UtilMath.r(100)); + } + + public void TargetPlayer() + { + RangeBest = 9000; + RangeTime = System.currentTimeMillis(); + + Player player = Host.GetPlayers(true).get(UtilMath.r(Host.GetPlayers(true).size())); + Target = player.getLocation(); + + Target.add(UtilAlg.getTrajectory(Location, Target).multiply(4)); + } + + public void HitByArrow() + { + TargetSky(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/Dragons.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/Dragons.java new file mode 100644 index 000000000..959c55bd2 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/Dragons.java @@ -0,0 +1,230 @@ +package nautilus.game.arcade.game.minigames.dragons; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.bukkit.EntityEffect; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.EnderDragon; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.PlayerStateChangeEvent; +import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.game.minigames.dragons.kits.*; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkSparkler; + +public class Dragons extends SoloGame +{ + private HashMap _dragons = new HashMap(); + private ArrayList _dragonSpawns = new ArrayList(); + + private PerkSparkler _sparkler = null; + + public Dragons(ArcadeManager manager) + { + super(manager, GameType.Dragons, + + new Kit[] + { + new KitCoward(manager), + new KitMarksman(manager), + new KitPyrotechnic(manager) + }, + + new String[] + { + "You have angered the Dragons!", + "Survive as best you can!!!", + "Last player alive wins!" + }); + + this.DamagePvP = false; + this.HungerSet = 20; + this.WaterDamage = 4; + this.DeathDropItems = false; + } + + @Override + public void ParseData() + { + _dragonSpawns = WorldData.GetDataLocs("RED"); + } + + @EventHandler + public void SparklerAttract(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (_sparkler == null) + { + for (Kit kit : GetKits()) + { + for (Perk perk : kit.GetPerks()) + { + if (perk instanceof PerkSparkler) + { + _sparkler = (PerkSparkler)perk; + } + } + } + } + + for (Item item : _sparkler.GetItems()) + { + for (DragonData data : _dragons.values()) + { + if (UtilMath.offset(data.Location, item.getLocation()) < 48) + { + data.TargetEntity = item; + } + } + } + } + + @EventHandler + public void Death(PlayerStateChangeEvent event) + { + if (event.GetState() != PlayerState.OUT) + return; + + long time = (System.currentTimeMillis() - GetStateTime()); + double gems = time/10000d; + String reason = "Survived for " + UtilTime.MakeStr(time); + + this.AddGems(event.GetPlayer(), gems, reason, false); + } + + @EventHandler + public void DragonSpawn(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + if (GetState() != GameState.Live) + return; + + Iterator dragonIterator = _dragons.keySet().iterator(); + + while (dragonIterator.hasNext()) + { + EnderDragon ent = dragonIterator.next(); + + if (!ent.isValid()) + { + dragonIterator.remove(); + ent.remove(); + } + } + + if (_dragons.size() < 4) + { + if (_dragons.size() == 0) + { + for (Player player : UtilServer.getPlayers()) + { + Location loc = player.getLocation(); + loc.setPitch(UtilAlg.GetPitch(UtilAlg.getTrajectory(player.getLocation(), _dragonSpawns.get(0)))); + loc.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(player.getLocation(), _dragonSpawns.get(0)))); + player.teleport(loc); + } + } + + CreatureAllowOverride = true; + EnderDragon ent = GetSpectatorLocation().getWorld().spawn(_dragonSpawns.get(0), EnderDragon.class); + UtilEnt.Vegetate(ent); + CreatureAllowOverride = false; + + ent.getWorld().playSound(ent.getLocation(), Sound.ENDERDRAGON_GROWL, 20f, 1f); + + _dragons.put(ent, new DragonData(this, ent)); + } + } + + @EventHandler + public void DragonLocation(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (GetState() != GameState.Live) + return; + + //Dragon Update! + for (DragonData data : _dragons.values()) + { + data.Target(); + data.Update(); + } + } + + @EventHandler + public void DragonTargetCancel(EntityTargetEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void DragonArrowDamage(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + return; + + if (!_dragons.containsKey(event.GetDamageeEntity())) + return; + + _dragons.get(event.GetDamageeEntity()).HitByArrow(); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + if (event.GetDamagerEntity(true) == null) + return; + + event.SetCancelled("Dragon"); + event.AddMod("Dragon", "Damage Reduction", -1 * (event.GetDamageInitial()-1), false); + + event.SetKnockback(false); + + damagee.playEffect(EntityEffect.HURT); + + UtilAction.velocity(damagee, UtilAlg.getTrajectory(event.GetDamagerEntity(true), damagee), 1, false, 0, 0.6, 2, true); + } + + @EventHandler + public void FallDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() == DamageCause.FALL) + event.AddMod("Fall Reduction", "Fall Reduction", -1, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/kits/KitCoward.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/kits/KitCoward.java new file mode 100644 index 000000000..fe9135aae --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/kits/KitCoward.java @@ -0,0 +1,56 @@ +package nautilus.game.arcade.game.minigames.dragons.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitCoward extends Kit +{ + public KitCoward(ArcadeManager manager) + { + super(manager, "Coward", KitAvailability.Free, + + new String[] + { + "There's no shame in being afraid of dragons..." + }, + + new Perk[] + { + new PerkLeaper("Leap", 1.2, 1.0, 8000), + new PerkSpeed(0) + }, + EntityType.ZOMBIE, + new ItemStack(Material.IRON_AXE)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS)); + } + + @Override + public void SpawnCustom(Creature ent) + { + ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); + ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); + ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); + ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/kits/KitMarksman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/kits/KitMarksman.java new file mode 100644 index 000000000..ab9a0a9cf --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/kits/KitMarksman.java @@ -0,0 +1,55 @@ +package nautilus.game.arcade.game.minigames.dragons.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkBarrage; +import nautilus.game.arcade.kit.perks.PerkFletcher; + +public class KitMarksman extends Kit +{ + public KitMarksman(ArcadeManager manager) + { + super(manager, "Marksman", KitAvailability.Green, + new String[] + { + "Arrows send dragons running to the sky!" + }, + new Perk[] + { + new PerkBarrage(5, 250, true), + new PerkFletcher(4, 4, true), + }, + EntityType.ZOMBIE, + new ItemStack(Material.BOW)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + } + + @Override + public void SpawnCustom(Creature ent) + { + ent.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); + ent.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE)); + ent.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS)); + ent.getEquipment().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/kits/KitPyrotechnic.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/kits/KitPyrotechnic.java new file mode 100644 index 000000000..e3b0b20bb --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/dragons/kits/KitPyrotechnic.java @@ -0,0 +1,53 @@ +package nautilus.game.arcade.game.minigames.dragons.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitPyrotechnic extends Kit +{ + public KitPyrotechnic(ArcadeManager manager) + { + super(manager, "Pyrotechnic", KitAvailability.Blue, + + new String[] + { + "Dragons love sparklers, following them!" + }, + + new Perk[] + { + new PerkSparkler(20, 2) + }, + EntityType.ZOMBIE, + new ItemStack(Material.EMERALD)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.GOLD_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.GOLD_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.GOLD_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS)); + } + + @Override + public void SpawnCustom(Creature ent) + { + ent.getEquipment().setHelmet(new ItemStack(Material.GOLD_HELMET)); + ent.getEquipment().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE)); + ent.getEquipment().setLeggings(new ItemStack(Material.GOLD_LEGGINGS)); + ent.getEquipment().setBoots(new ItemStack(Material.GOLD_BOOTS)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/EvoScore.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/EvoScore.java new file mode 100644 index 000000000..3a3d95c20 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/EvoScore.java @@ -0,0 +1,15 @@ +package nautilus.game.arcade.game.minigames.evolution; + +import org.bukkit.entity.Player; + +public class EvoScore +{ + public org.bukkit.entity.Player Player; + public int Kills; + + public EvoScore(Player player, int i) + { + Player = player; + Kills = i; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/Evolution.java new file mode 100644 index 000000000..1e60b8b9f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/Evolution.java @@ -0,0 +1,320 @@ +package nautilus.game.arcade.game.minigames.evolution; + +import java.util.ArrayList; +import java.util.HashMap; + +import org.bukkit.Bukkit; +import org.bukkit.Color; +import org.bukkit.FireworkEffect; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.scoreboard.DisplaySlot; +import org.bukkit.scoreboard.Objective; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.minigames.evolution.kits.*; +import nautilus.game.arcade.game.minigames.evolution.mobs.*; +import nautilus.game.arcade.kit.Kit; + +public class Evolution extends SoloGame +{ + private ArrayList _ranks = new ArrayList(); + private ArrayList _lastScoreboard = new ArrayList(); + + private HashMap _bonusKit = new HashMap(); + + private Objective _scoreObj; + + public Evolution(ArcadeManager manager) + { + super(manager, GameType.Evolution, + + new Kit[] + { + new KitHealth(manager), + new KitAgility(manager), + new KitRecharge(manager), + + new KitGolem(manager), //Iron + new KitBlaze(manager), //Chainmail + new KitSlime(manager), //Chainmail + new KitCreeper(manager), //None + new KitEnderman(manager), //Chainmail + new KitSkeleton(manager), //Leather + new KitSpider(manager), //Chainmail + new KitSnowman(manager), //Leather + new KitWolf(manager), //Leather + new KitChicken(manager), + + }, + + new String[] + { + "You evolve when you get a kill.", + "Each evolution has unique skills.", + "", + "First to get through 10 evolutions wins!" + }); + + this.DamageTeamSelf = true; + + this.HungerSet = 20; + + this.DeathOut = false; + this.DeathDropItems = false; + + this.PrepareFreeze = false; + + this.SpawnDistanceRequirement = 16; + + _scoreObj = GetScoreboard().registerNewObjective("Evolutions", "dummy"); + _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void RegisterMobKits(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + } + + //Double Kit + @EventHandler(priority = EventPriority.MONITOR) + public void StoreBonusKits(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + + for (Player player : GetPlayers(true)) + { + _bonusKit.put(player, GetKit(player)); + UpgradeKit(player, true); + } + } + + @Override + public boolean HasKit(Player player, Kit kit) + { + if (GetKit(player) == null) + return false; + + if (GetKit(player).equals(kit)) + return true; + + //Bonus Kit + if (_bonusKit.containsKey(player)) + if (_bonusKit.get(player).equals(kit)) + return true; + + return false; + } + + @EventHandler + public void PlayerKillAward(CombatDeathEvent event) + { + Game game = Manager.GetGame(); + if (game == null) return; + + if (!(event.GetEvent().getEntity() instanceof Player)) + return; + + if (event.GetLog().GetKiller() == null) + return; + + final Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + if (killer == null) + return; + + if (killer.equals(event.GetEvent().getEntity())) + return; + + Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() + { + public void run() + { + UpgradeKit(killer, false); + } + }, 0); + } + + public void UpgradeKit(Player player, boolean first) + { + if (!Recharge.Instance.use(player, "Evolve", 500, false)) + return; + + //Remove Old Recharges + Recharge.Instance.Reset(player); + Recharge.Instance.useForce(player, "Evolve", 500); + + Kit kit = GetKit(player); + + for (int i=3 ; i0 ; j--) + { + if (_ranks.get(j).Kills > _ranks.get(j-1).Kills) + { + EvoScore temp = _ranks.get(j); + _ranks.set(j, _ranks.get(j-1)); + _ranks.set(j-1, temp); + } + } + } + } + + private void End() + { + SortScores(); + + //Set Places + _places.clear(); + for (int i=0 ; i<_ranks.size() ; i++) + _places.add(i, _ranks.get(i).Player); + + //Award Gems + if (_ranks.size() >= 1) + AddGems(_ranks.get(0).Player, 20, "1st Place", false); + + if (_ranks.size() >= 2) + AddGems(_ranks.get(1).Player, 15, "2nd Place", false); + + if (_ranks.size() >= 3) + AddGems(_ranks.get(2).Player, 10, "3rd Place", false); + + //Participation + for (Player player : GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false); + + SetState(GameState.End); + AnnounceEnd(_places); + } + + @Override + public void EndCheck() + { + + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + //Wipe Last + for (String string : _lastScoreboard) + { + GetScoreboard().resetScores(Bukkit.getOfflinePlayer(string)); + } + _lastScoreboard.clear(); + + + //Write New + for (Player player : GetPlayers(true)) + { + int score = GetScore(player); + + String out = score + " " + C.cGreen + player.getName(); + + if (out.length() >= 16) + out = out.substring(0, 15); + + _lastScoreboard.add(out); + + GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(score); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/kits/KitAgility.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/kits/KitAgility.java new file mode 100644 index 000000000..4ea1cc9e3 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/kits/KitAgility.java @@ -0,0 +1,38 @@ +package nautilus.game.arcade.game.minigames.evolution.kits; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkSpeed; + +public class KitAgility extends Kit +{ + public KitAgility(ArcadeManager manager) + { + super(manager, "Agility", KitAvailability.Free, + + new String[] + { + "You are extremely agile and can double jump!" + }, + + new Perk[] + { + new PerkDoubleJump("Double Jump", 0.8, 0.8, false), + new PerkSpeed(0), + }, + EntityType.ZOMBIE, + null); + } + + @Override + public void GiveItems(Player player) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/kits/KitHealth.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/kits/KitHealth.java new file mode 100644 index 000000000..7059ce2cf --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/kits/KitHealth.java @@ -0,0 +1,38 @@ +package nautilus.game.arcade.game.minigames.evolution.kits; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkRegeneration; +import nautilus.game.arcade.kit.perks.PerkVampire; + +public class KitHealth extends Kit +{ + public KitHealth(ArcadeManager manager) + { + super(manager, "Vitality", KitAvailability.Free, + + new String[] + { + "You have improved survivability." + }, + + new Perk[] + { + new PerkRegeneration(0), + new PerkVampire(6), + }, + EntityType.ZOMBIE, + null); + } + + @Override + public void GiveItems(Player player) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/kits/KitRecharge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/kits/KitRecharge.java new file mode 100644 index 000000000..263c45c5c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/kits/KitRecharge.java @@ -0,0 +1,37 @@ +package nautilus.game.arcade.game.minigames.evolution.kits; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkRecharge; + +public class KitRecharge extends Kit +{ + public KitRecharge(ArcadeManager manager) + { + super(manager, "Stamina", KitAvailability.Free, + + new String[] + { + "You are able to use your abilities more often!" + }, + + new Perk[] + { + new PerkRecharge(0.5), + }, + EntityType.ZOMBIE, + null); + + } + + @Override + public void GiveItems(Player player) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitBlaze.java new file mode 100644 index 000000000..72d07db5a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitBlaze.java @@ -0,0 +1,57 @@ +package nautilus.game.arcade.game.minigames.evolution.mobs; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguiseBlaze; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkFlamingSword; + +public class KitBlaze extends Kit +{ + public KitBlaze(ArcadeManager manager) + { + super(manager, "Blaze", KitAvailability.Hide, + + new String[] + { + "" + }, + + new Perk[] + { + new PerkFlamingSword() + }, + EntityType.SLIME, + null); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD)); + + UtilPlayer.message(player, C.Line); + UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); + UtilPlayer.message(player, F.elem("Hold Block") + " to use " + F.elem("Inferno")); + UtilPlayer.message(player, C.Line); + + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 4f, 1f); + + //Disguise + DisguiseBlaze disguise = new DisguiseBlaze(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitChicken.java new file mode 100644 index 000000000..d1998a94e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitChicken.java @@ -0,0 +1,74 @@ +package nautilus.game.arcade.game.minigames.evolution.mobs; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Egg; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguiseChicken; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkConstructor; +import nautilus.game.arcade.kit.perks.PerkFallDamage; + +public class KitChicken extends Kit +{ + public KitChicken(ArcadeManager manager) + { + super(manager, "Chicken", KitAvailability.Hide, + + new String[] + { + "" + }, + + new Perk[] + { + new PerkConstructor("Egg Pouch", 0.8, 8, Material.EGG, "Egg", false), + new PerkFallDamage(-2), + }, + EntityType.SLIME, + null); + + } + + @Override + public void GiveItems(Player player) + { + UtilPlayer.message(player, C.Line); + UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); + UtilPlayer.message(player, F.elem("Right-Click with Eggs") + " to use " + F.elem("Throw Egg")); + UtilPlayer.message(player, C.Line); + + player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_IDLE, 4f, 1f); + + //Disguise + DisguiseChicken disguise = new DisguiseChicken(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } + + @EventHandler + public void EggHit(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetProjectile() == null) + return; + + if (!(event.GetProjectile() instanceof Egg)) + return; + + event.AddMod("Chicken Kit", "Egg", 1, true); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitCreeper.java new file mode 100644 index 000000000..c6794d643 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitCreeper.java @@ -0,0 +1,59 @@ +package nautilus.game.arcade.game.minigames.evolution.mobs; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguiseCreeper; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkExplode; +import nautilus.game.arcade.kit.perks.PerkFood; + +public class KitCreeper extends Kit +{ + public KitCreeper(ArcadeManager manager) + { + super(manager, "Creeper", KitAvailability.Hide, + + new String[] + { + "" + }, + + new Perk[] + { + new PerkFood(1), + new PerkExplode("Detonate", 1, 6000) + }, + EntityType.SLIME, + null); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT)); + + UtilPlayer.message(player, C.Line); + UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); + UtilPlayer.message(player, F.elem("Attack") + " to use " + F.elem("Detonate")); + UtilPlayer.message(player, C.Line); + + player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 4f, 1f); + + //Disguise + DisguiseCreeper disguise = new DisguiseCreeper(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitEnderman.java new file mode 100644 index 000000000..8ea57fca7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitEnderman.java @@ -0,0 +1,52 @@ +package nautilus.game.arcade.game.minigames.evolution.mobs; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkBlink; + +public class KitEnderman extends Kit +{ + public KitEnderman(ArcadeManager manager) + { + super(manager, "Enderman", KitAvailability.Hide, + + new String[] + { + "" + }, + + new Perk[] + { + new PerkBlink("Blink", 12, 4000) + }, + EntityType.SLIME, + null); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + + UtilPlayer.message(player, C.Line); + UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); + UtilPlayer.message(player, F.elem("Right-Click with Axe") + " to use " + F.elem("Blink")); + UtilPlayer.message(player, C.Line); + + player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_IDLE, 4f, 1f); + + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitGolem.java new file mode 100644 index 000000000..61ee017ee --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitGolem.java @@ -0,0 +1,57 @@ +package nautilus.game.arcade.game.minigames.evolution.mobs; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguiseIronGolem; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkSlam; + +public class KitGolem extends Kit +{ + public KitGolem(ArcadeManager manager) + { + super(manager, "Iron Golem", KitAvailability.Hide, + + new String[] + { + "" + }, + + new Perk[] + { + new PerkSlam("Ground Pound", 1, 1.2, 10000), + }, + EntityType.SLIME, + null); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE)); + + UtilPlayer.message(player, C.Line); + UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); + UtilPlayer.message(player, F.elem("Right-Click with Axe") + " to use " + F.elem("Ground Pound")); + UtilPlayer.message(player, C.Line); + + player.getWorld().playSound(player.getLocation(), Sound.IRONGOLEM_DEATH, 4f, 1f); + + //Disguise + DisguiseIronGolem disguise = new DisguiseIronGolem(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitSkeleton.java new file mode 100644 index 000000000..63add5ea7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitSkeleton.java @@ -0,0 +1,59 @@ +package nautilus.game.arcade.game.minigames.evolution.mobs; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkBarrage; +import nautilus.game.arcade.kit.perks.PerkFletcher; + +public class KitSkeleton extends Kit +{ + public KitSkeleton(ArcadeManager manager) + { + super(manager, "Skeletal Archer", KitAvailability.Hide, + + new String[] + { + "" + }, + + new Perk[] + { + new PerkFletcher(3, 2, false), + new PerkBarrage(5, 250, true) + }, + EntityType.SLIME, + null); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + + UtilPlayer.message(player, C.Line); + UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); + UtilPlayer.message(player, F.elem("Charge Bow") + " to use " + F.elem("Barrage")); + UtilPlayer.message(player, C.Line); + + player.getWorld().playSound(player.getLocation(), Sound.SKELETON_IDLE, 4f, 1f); + + //Disguise + DisguiseSkeleton disguise = new DisguiseSkeleton(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitSlime.java new file mode 100644 index 000000000..8a83e52e9 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitSlime.java @@ -0,0 +1,60 @@ +package nautilus.game.arcade.game.minigames.evolution.mobs; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguiseSlime; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkFallDamage; +import nautilus.game.arcade.kit.perks.PerkLeaper; + +public class KitSlime extends Kit +{ + public KitSlime(ArcadeManager manager) + { + super(manager, "Slime", KitAvailability.Hide, + + new String[] + { + "" + }, + + new Perk[] + { + new PerkLeaper("Bounce", 2, 2, 8000), + new PerkFallDamage(-40) + }, + EntityType.SLIME, + null); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + + UtilPlayer.message(player, C.Line); + UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); + UtilPlayer.message(player, F.elem("Right-Click with Axe") + " to use " + F.elem("Bounce")); + UtilPlayer.message(player, C.Line); + + player.getWorld().playSound(player.getLocation(), Sound.SLIME_WALK, 4f, 1f); + + //Disguise + DisguiseSlime disguise = new DisguiseSlime(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + disguise.SetSize(3); + Manager.GetDisguise().Disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitSnowman.java new file mode 100644 index 000000000..41683821f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitSnowman.java @@ -0,0 +1,74 @@ +package nautilus.game.arcade.game.minigames.evolution.mobs; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.entity.Snowball; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguiseSnowman; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkConstructor; +import nautilus.game.arcade.kit.perks.PerkFallDamage; + +public class KitSnowman extends Kit +{ + public KitSnowman(ArcadeManager manager) + { + super(manager, "Snowman", KitAvailability.Hide, + + new String[] + { + "" + }, + + new Perk[] + { + new PerkConstructor("Snowballer", 0.5, 16, Material.SNOW_BALL, "Snowball", false), + new PerkFallDamage(-2), + }, + EntityType.SLIME, + null); + + } + + @Override + public void GiveItems(Player player) + { + UtilPlayer.message(player, C.Line); + UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); + UtilPlayer.message(player, F.elem("Right-Click with Snowball") + " to use " + F.elem("Throw Snowball")); + UtilPlayer.message(player, C.Line); + + player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 4f, 1f); + + //Disguise + DisguiseSnowman disguise = new DisguiseSnowman(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } + + @EventHandler + public void SnowballHit(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetProjectile() == null) + return; + + if (!(event.GetProjectile() instanceof Snowball)) + return; + + event.AddMod("Snowman Kit", "Snowball", 3, true); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitSpider.java new file mode 100644 index 000000000..126a499bc --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitSpider.java @@ -0,0 +1,57 @@ +package nautilus.game.arcade.game.minigames.evolution.mobs; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguiseSpider; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkWeb; + +public class KitSpider extends Kit +{ + public KitSpider(ArcadeManager manager) + { + super(manager, "Spider", KitAvailability.Hide, + + new String[] + { + "" + }, + + new Perk[] + { + new PerkWeb(2,8) + }, + EntityType.SLIME, + null); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); + + UtilPlayer.message(player, C.Line); + UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); + UtilPlayer.message(player, F.elem("Right-Click with Axe/Web") + " to use " + F.elem("Throw Web")); + UtilPlayer.message(player, C.Line); + + player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 4f, 1f); + + //Disguise + DisguiseSpider disguise = new DisguiseSpider(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitWolf.java new file mode 100644 index 000000000..134f50575 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/evolution/mobs/KitWolf.java @@ -0,0 +1,59 @@ +package nautilus.game.arcade.game.minigames.evolution.mobs; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguiseBat; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkLeaper; +import nautilus.game.arcade.kit.perks.PerkSpeed; + +public class KitWolf extends Kit +{ + public KitWolf(ArcadeManager manager) + { + super(manager, "Wolf", KitAvailability.Hide, + + new String[] + { + "" + }, + + new Perk[] + { + new PerkSpeed(2), + new PerkLeaper("Pounce", 1.2, 1, 4000) + }, + EntityType.SLIME, + null); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE)); + + UtilPlayer.message(player, C.Line); + UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); + UtilPlayer.message(player, F.elem("Right-Click with Axe") + " to use " + F.elem("Pounce")); + UtilPlayer.message(player, C.Line); + + player.getWorld().playSound(player.getLocation(), Sound.WOLF_BARK, 4f, 1f); + + //Disguise + DisguiseBat disguise = new DisguiseBat(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/horsecharge/Horse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/horsecharge/Horse.java new file mode 100644 index 000000000..d7f9e1e17 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/horsecharge/Horse.java @@ -0,0 +1,66 @@ +package nautilus.game.arcade.game.minigames.horsecharge; + +import java.util.HashMap; + +import org.bukkit.ChatColor; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.AsymTeamGame; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.minigames.horsecharge.kits.*; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.NullKit; + +public class Horse extends AsymTeamGame +{ + public Horse(ArcadeManager manager, HashMap pastTeams) + { + super(manager, GameType.Horse, + + new Kit[] + { + new KitHorseKnight(manager), + new NullKit(manager), + new KitDefenceArcher(manager), + }, + + new String[] + { + "Riders must charge the ruins", + "Archers must defend the ruins", + "Last team alive wins!", + "", + "Teams swap after game is over" + }, pastTeams); + + DeathDropItems = false; + } + + @Override + public void ParseData() + { + + } + + @Override + public void RestrictKits() + { + for (Kit kit : GetKits()) + { + for (GameTeam team : GetTeamList()) + { + if (team.GetColor() == ChatColor.RED) + { + if (kit.GetName().contains("Defence")) + team.GetRestrictedKits().add(kit); + } + else + { + if (kit.GetName().contains("Horseback")) + team.GetRestrictedKits().add(kit); + } + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/horsecharge/kits/KitDefenceArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/horsecharge/kits/KitDefenceArcher.java new file mode 100644 index 000000000..fe51cb27c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/horsecharge/kits/KitDefenceArcher.java @@ -0,0 +1,54 @@ +package nautilus.game.arcade.game.minigames.horsecharge.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitDefenceArcher extends Kit +{ + public KitDefenceArcher(ArcadeManager manager) + { + super(manager, "Horseback Marksman", KitAvailability.Free, + + new String[] + { + "Able to shoot arrows that can stop horses" + }, + + new Perk[] + { + new PerkFletcher(2, 4, true) + }, + EntityType.SKELETON, + new ItemStack(Material.BOW)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS)); + } + + @Override + public void SpawnCustom(Creature ent) + { + ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); + ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); + ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); + ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/horsecharge/kits/KitHorseKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/horsecharge/kits/KitHorseKnight.java new file mode 100644 index 000000000..235494d92 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/horsecharge/kits/KitHorseKnight.java @@ -0,0 +1,54 @@ +package nautilus.game.arcade.game.minigames.horsecharge.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitHorseKnight extends Kit +{ + public KitHorseKnight(ArcadeManager manager) + { + super(manager, "Horseback Knight", KitAvailability.Free, + + new String[] + { + "Rides a large warhorse, and can take a beating" + }, + + new Perk[] + { + new PerkIronSkin(1) + }, + EntityType.ZOMBIE, + new ItemStack(Material.IRON_SWORD)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS)); + } + + @Override + public void SpawnCustom(Creature ent) + { + ent.getEquipment().setHelmet(new ItemStack(Material.IRON_HELMET)); + ent.getEquipment().setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); + ent.getEquipment().setLeggings(new ItemStack(Material.IRON_LEGGINGS)); + ent.getEquipment().setBoots(new ItemStack(Material.IRON_BOOTS)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/MineWare.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/MineWare.java new file mode 100644 index 000000000..59234b425 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/MineWare.java @@ -0,0 +1,345 @@ +package nautilus.game.arcade.game.minigames.mineware; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Chicken; +import org.bukkit.entity.Cow; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Ghast; +import org.bukkit.entity.Pig; +import org.bukkit.entity.Player; +import org.bukkit.entity.Sheep; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.minigames.mineware.order.Order; +import nautilus.game.arcade.game.minigames.mineware.random.*; +import nautilus.game.arcade.game.minigames.spleef.kits.KitLeaper; +import nautilus.game.arcade.kit.Kit; + +public class MineWare extends SoloGame +{ + private HashMap _lives = new HashMap(); + + private Order _order = null; + private long _orderTime = 0; + private int _orderCount = 0; + + private ArrayList _orders = new ArrayList(); + private ArrayList _ordersCopy = new ArrayList(); + + private Location _ghastLoc = null; + private Location _ghastTarget = null; + private Ghast _ghast = null; + private ArrayList _mobLocs = new ArrayList(); + private ArrayList _mobs = new ArrayList(); + + public MineWare(ArcadeManager manager) + { + super(manager, GameType.MineWare, + + new Kit[] + { + new KitLeaper(manager), + }, + + new String[] + { + "Follow the orders given in chat!", + "First half to follow it win the round.", + "Other players lose one life.", + "Last player with lives wins!" + }); + + this.PrepareFreeze = false; + + this.DamagePvP = false; + this.DeathDropItems = false; + + this.BlockPlace = true; + this.BlockBreak = true; + + PopulateOrders(); + } + + @Override + public void ParseData() + { + _ghastLoc = WorldData.GetDataLocs("WHITE").get(0); + + while (_mobLocs.size() < 100) + { + Location loc = WorldData.GetRandomXZ(); + + while (UtilBlock.airFoliage(loc.getBlock())) + loc.add(0, -1, 0); + + Material mat = loc.getBlock().getType(); + + if (mat == Material.STONE || + mat == Material.GRASS || + mat == Material.SAND) + _mobLocs.add(loc); + } + } + + public void PopulateOrders() + { + _orders.add(new ActionMilkCow(this)); + _orders.add(new ActionShearSheep(this)); + + _orders.add(new CraftLadder(this)); + _orders.add(new CraftStoneShovel(this)); + + _orders.add(new DamageChicken(this)); + _orders.add(new DamageFall(this)); + _orders.add(new DamageGhast(this)); + + _orders.add(new GatherCobble(this)); + _orders.add(new GatherRedFlower(this)); + _orders.add(new GatherYellowFlower(this)); + _orders.add(new GatherSand(this)); + + _orders.add(new PlaceDoor(this)); + + _orders.add(new RideBoat(this)); + _orders.add(new RidePig(this)); + + _orders.add(new StandAlone(this)); + _orders.add(new StandShelter(this)); + _orders.add(new StandStone(this)); + _orders.add(new StandWater(this)); + } + + public Order GetOrder() + { + if (_ordersCopy.isEmpty()) + { + for (Order order : _orders) + { + _ordersCopy.add(order); + } + } + + return _ordersCopy.remove(UtilMath.r(_ordersCopy.size())); + } + + @EventHandler(priority = EventPriority.HIGH) + public void GameStateChange(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + return; + + for (Player player : GetPlayers(true)) + _lives.put(player, 10); + } + + @EventHandler + public void UpdateOrder(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + //New Order + if (_order == null) + { + if (!UtilTime.elapsed(_orderTime, 1000)) + return; + + _order = GetOrder(); + + if (_order == null) + { + SetState(GameState.Dead); + return; + } + + //Register + UtilServer.getServer().getPluginManager().registerEvents(_order, Manager.GetPlugin()); + _order.StartOrder(_orderCount++); + + Announce(C.cYellow + C.Bold + _order.GetOrder().toUpperCase()); + + GetObjectiveSide().setDisplayName( + ChatColor.WHITE + "§lMineWare " + C.cGreen + "§l" + + "Round " + _orderCount); + } + //Update Order + else + { + if (_order.Finish()) + { + _orderTime = System.currentTimeMillis(); + + if (_order.PlayerHasCompleted()) + { + for (Player player : GetPlayers(true)) + { + if (!_order.IsCompleted(player)) + { + LoseLife(player); + + if (IsAlive(player)) + _order.FailItems(player); + } + } + } + + + //Deregister + HandlerList.unregisterAll(_order); + _order.EndOrder(); + _order = null; + } + else + { + //Set Level + for (Player player : UtilServer.getPlayers()) + { + player.setLevel(_order.GetRemainingPlaces()); + player.setExp(_order.GetTimeLeftPercent()); + } + } + } + } + + private int GetLives(Player player) + { + if (!_lives.containsKey(player)) + return 0; + + if (!IsAlive(player)) + return 0; + + return _lives.get(player); + } + + private void LoseLife(Player player) + { + int lives = GetLives(player) - 1; + + if (lives > 0) + { + UtilPlayer.message(player, C.cRed + C.Bold + "You failed the task!"); + UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " lives left!"); + player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f); + + _lives.put(player, lives); + } + else + { + UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!"); + player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f); + + player.damage(5000); + + GetScoreboard().resetScores(player); + } + } + + @EventHandler + public void UpdateMobs(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!InProgress()) + return; + + Iterator mobIterator = _mobs.iterator(); + + while (mobIterator.hasNext()) + { + Creature mob = mobIterator.next(); + + if (!mob.isValid()) + { + mob.remove(); + mobIterator.remove(); + } + } + + if (_mobs.size() < 200) + { + Location loc = _mobLocs.get(UtilMath.r(_mobLocs.size())).clone().add(new Vector(0.5,1,0.5)); + double r = Math.random(); + + this.CreatureAllowOverride = true; + + if (r > 0.75) _mobs.add(loc.getWorld().spawn(loc, Pig.class)); + else if (r > 0.5) _mobs.add(loc.getWorld().spawn(loc, Cow.class)); + else if (r > 0.25) _mobs.add(loc.getWorld().spawn(loc, Chicken.class)); + else _mobs.add(loc.getWorld().spawn(loc, Sheep.class)); + + this.CreatureAllowOverride = false; + } + + if (_ghast == null || !_ghast.isValid()) + { + if (_ghast != null) + _ghast.remove(); + + this.CreatureAllowOverride = true; + _ghast = _ghastLoc.getWorld().spawn(_ghastLoc, Ghast.class); + this.CreatureAllowOverride = false; + + _ghast.setMaxHealth(10000); + _ghast.setHealth(_ghast.getMaxHealth()); + } + else + { + //New Target + if (_ghastTarget == null || UtilMath.offset(_ghast.getLocation(), _ghastTarget) < 5) + { + _ghastTarget = _ghastLoc.clone().add(40 - 80*Math.random(), -20*Math.random(), 40 - 80*Math.random()); + } + + _ghast.teleport(_ghast.getLocation().add(UtilAlg.getTrajectory(_ghast.getLocation(), _ghastTarget).multiply(0.1))); + } + } + + @EventHandler + public void GhastTarget(EntityTargetEvent event) + { + if (event.getEntity().equals(_ghast)) + event.setCancelled(true); + } + + @Override + public int GetScoreboardScore(Player player) + { + return GetLives(player); + } + + @EventHandler + public void ItemDrop(PlayerDropItemEvent event) + { + event.getItemDrop().remove(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/order/Order.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/order/Order.java new file mode 100644 index 000000000..a65aba829 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/order/Order.java @@ -0,0 +1,112 @@ +package nautilus.game.arcade.game.minigames.mineware.order; + +import java.util.HashSet; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import nautilus.game.arcade.game.minigames.mineware.MineWare; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; + +public abstract class Order implements Listener +{ + public MineWare Host; + + private String _order; + + private long _startTime; + private long _duration; + + private HashSet _completed = new HashSet(); + + public Order(MineWare host, String order) + { + Host = host; + + _order = order; + } + + public void StartOrder(int stage) + { + _completed.clear(); + + _startTime = System.currentTimeMillis(); + + _duration = 60000; + + SubInitialize(); + Initialize(); + } + + public void SubInitialize() + { + + } + + public void EndOrder() + { + Host.BlockBreakAllow.clear(); + Host.BlockPlaceAllow.clear(); + Host.ItemDropAllow.clear(); + Host.ItemPickupAllow.clear(); + Uninitialize(); + } + + public abstract void Initialize(); + public abstract void Uninitialize(); + + public String GetOrder() + { + return _order; + } + + public boolean Finish() + { + if (GetRemainingPlaces() <= 0) + return true; + + return UtilTime.elapsed(_startTime, _duration); + } + + public int GetTimeLeft() + { + return (int)((_duration - (System.currentTimeMillis() - _startTime))/1000); + } + + public void SetCompleted(Player player) + { + if (_completed.contains(player)) + return; + + _completed.add(player); + UtilPlayer.message(player, C.cGreen + C.Bold + "You completed the task!"); + player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f); + } + + public boolean IsCompleted(Player player) + { + return _completed.contains(player); + } + + public abstract void FailItems(Player player); + + public float GetTimeLeftPercent() + { + float a = (float)(_duration - (System.currentTimeMillis() - _startTime)); + float b = (float)(_duration); + return a/b; + } + + public int GetRemainingPlaces() + { + return (int) Math.max(0, (Host.GetPlayers(true).size()*0.5) - _completed.size()); + } + + public boolean PlayerHasCompleted() + { + return !_completed.isEmpty(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/order/OrderCraft.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/order/OrderCraft.java new file mode 100644 index 000000000..160097ba7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/order/OrderCraft.java @@ -0,0 +1,104 @@ +package nautilus.game.arcade.game.minigames.mineware.order; + +import java.util.HashMap; + +import mineplex.core.common.util.UtilInv; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.game.minigames.mineware.MineWare; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryType.SlotType; +import org.bukkit.inventory.CraftingInventory; +import org.bukkit.inventory.ItemStack; + +public abstract class OrderCraft extends Order +{ + private HashMap _counter = new HashMap(); + + private int _id; + private byte _data; + private int _req; + + public OrderCraft(MineWare host, String order, int id, int data, int required) + { + super(host, order); + + _id = id; + _data = (byte)data; + _req = required; + } + + @Override + public void SubInitialize() + { + _counter.clear(); + } + + @Override + public void FailItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(_id, _data, _req)); + } + + @EventHandler + public void Craft(InventoryClickEvent event) + { + if (event.getSlotType() != SlotType.RESULT) + return; + + if (!UtilInv.IsItem(event.getCurrentItem(), _id, _data)) + return; + + if (!(event.getWhoClicked() instanceof Player)) + return; + + Player player = (Player)event.getWhoClicked(); + + if (!event.isShiftClick()) + { + Add(player, event.getCurrentItem().getAmount()); + } + else + { + CraftingInventory inv = (CraftingInventory)event.getInventory(); + + int make = 128; + + //Find Lowest Amount + for (ItemStack item : inv.getMatrix()) + if (item != null && item.getType() != Material.AIR) + if (item.getAmount() < make) + make = item.getAmount(); + + make = make * event.getCurrentItem().getAmount(); + + Add(player, make); + } + + if (Has(player)) + SetCompleted(player); + } + + public void Add(Player player, int add) + { + if (!_counter.containsKey(player)) + _counter.put(player, add); + + else + _counter.put(player, _counter.get(player) + add); + + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1.5f); + } + + public boolean Has(Player player) + { + if (!_counter.containsKey(player)) + return false; + + return _counter.get(player) >= _req; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/order/OrderGather.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/order/OrderGather.java new file mode 100644 index 000000000..77cd9e50f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/order/OrderGather.java @@ -0,0 +1,81 @@ +package nautilus.game.arcade.game.minigames.mineware.order; + +import java.util.HashMap; + +import mineplex.core.common.util.UtilInv; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.game.minigames.mineware.MineWare; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerPickupItemEvent; + +public abstract class OrderGather extends Order +{ + private HashMap _counter = new HashMap(); + + private int _id; + private byte _data; + private int _req; + + public OrderGather(MineWare host, String order, int id, int data, int required) + { + super(host, order); + + _id = id; + _data = (byte)data; + _req = required; + } + + @Override + public void SubInitialize() + { + _counter.clear(); + Host.BlockBreakAllow.add(_id); + Host.ItemPickupAllow.add(_id); + } + + @Override + public void FailItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(_id, _data, _req)); + } + + @EventHandler + public void Pickup(PlayerPickupItemEvent event) + { + if (!UtilInv.IsItem(event.getItem().getItemStack(), _id, _data)) + return; + + if (Has(event.getPlayer())) + { + event.setCancelled(true); + return; + } + + Add(event.getPlayer(), event.getItem().getItemStack().getAmount()); + + if (Has(event.getPlayer())) + SetCompleted(event.getPlayer()); + } + + public void Add(Player player, int add) + { + if (!_counter.containsKey(player)) + _counter.put(player, add); + + else + _counter.put(player, _counter.get(player) + add); + + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1.5f); + } + + public boolean Has(Player player) + { + if (!_counter.containsKey(player)) + return false; + + return _counter.get(player) >= _req; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/order/OrderPlace.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/order/OrderPlace.java new file mode 100644 index 000000000..f5d8cdf42 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/order/OrderPlace.java @@ -0,0 +1,78 @@ +package nautilus.game.arcade.game.minigames.mineware.order; + +import java.util.HashMap; + +import nautilus.game.arcade.game.minigames.mineware.MineWare; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockPlaceEvent; + +public abstract class OrderPlace extends Order +{ + private HashMap _counter = new HashMap(); + + private int _id; + private byte _data; + private int _req; + + public OrderPlace(MineWare host, String order, int id, int data, int required) + { + super(host, order); + + _id = id; + _data = (byte)data; + _req = required; + } + + @Override + public void SubInitialize() + { + _counter.clear(); + Host.BlockPlaceAllow.add(_id); + } + + @Override + public void FailItems(Player player) + { + + } + + @EventHandler + public void Place(BlockPlaceEvent event) + { + if (event.isCancelled()) + return; + + if (event.getBlock().getTypeId() != _id) + return; + + if (_data != -1 && event.getBlock().getData() != _data) + return; + + Add(event.getPlayer(), 1); + + if (Has(event.getPlayer())) + SetCompleted(event.getPlayer()); + } + + public void Add(Player player, int add) + { + if (!_counter.containsKey(player)) + _counter.put(player, add); + + else + _counter.put(player, _counter.get(player) + add); + + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1.5f); + } + + public boolean Has(Player player) + { + if (!_counter.containsKey(player)) + return false; + + return _counter.get(player) >= _req; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/ActionMilkCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/ActionMilkCow.java new file mode 100644 index 000000000..97afdef61 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/ActionMilkCow.java @@ -0,0 +1,54 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import org.bukkit.Material; +import org.bukkit.entity.Cow; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.UtilGear; +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.Order; + +public class ActionMilkCow extends Order +{ + public ActionMilkCow(MineWare host) + { + super(host, "milk a cow"); + } + + @Override + public void Initialize() + { + for (Player player : Host.GetPlayers(true)) + { + if (!player.getInventory().contains(Material.BUCKET)) + player.getInventory().addItem(new ItemStack(Material.BUCKET)); + } + } + + @Override + public void Uninitialize() + { + + } + + @Override + public void FailItems(Player player) + { + + } + + @EventHandler + public void Update(PlayerInteractEntityEvent event) + { + if (!(event.getRightClicked() instanceof Cow)) + return; + + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), Material.BUCKET)) + return; + + SetCompleted(event.getPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/ActionShearSheep.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/ActionShearSheep.java new file mode 100644 index 000000000..e21030c38 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/ActionShearSheep.java @@ -0,0 +1,46 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerShearEntityEvent; +import org.bukkit.inventory.ItemStack; + +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.Order; + +public class ActionShearSheep extends Order +{ + public ActionShearSheep(MineWare host) + { + super(host, "shear a sheep"); + } + + @Override + public void Initialize() + { + for (Player player : Host.GetPlayers(true)) + { + if (!player.getInventory().contains(Material.SHEARS)) + player.getInventory().addItem(new ItemStack(Material.SHEARS)); + } + } + + @Override + public void Uninitialize() + { + + } + + @Override + public void FailItems(Player player) + { + + } + + @EventHandler + public void Update(PlayerShearEntityEvent event) + { + SetCompleted(event.getPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/CraftLadder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/CraftLadder.java new file mode 100644 index 000000000..58dcef43b --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/CraftLadder.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.OrderCraft; + +public class CraftLadder extends OrderCraft +{ + public CraftLadder(MineWare host) + { + super(host, "Craft some ladders", 65, -1, 1); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/CraftStoneShovel.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/CraftStoneShovel.java new file mode 100644 index 000000000..5bad3ea5d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/CraftStoneShovel.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.OrderCraft; + +public class CraftStoneShovel extends OrderCraft +{ + public CraftStoneShovel(MineWare host) + { + super(host, "Craft a stone shovel", 273, -1, 1); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/DamageChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/DamageChicken.java new file mode 100644 index 000000000..dde295ab8 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/DamageChicken.java @@ -0,0 +1,55 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import org.bukkit.entity.Chicken; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.Order; + +public class DamageChicken extends Order +{ + public DamageChicken(MineWare host) + { + super(host, "punch a chicken"); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } + + @Override + public void FailItems(Player player) + { + + } + + @EventHandler + public void Damage(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player player = event.GetDamagerPlayer(false); + if (player == null) return; + + LivingEntity ent = event.GetDamageeEntity(); + if (ent == null) return; + + if (!(ent instanceof Chicken)) + return; + + SetCompleted(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/DamageFall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/DamageFall.java new file mode 100644 index 000000000..99f407217 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/DamageFall.java @@ -0,0 +1,47 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.Order; + +public class DamageFall extends Order +{ + public DamageFall(MineWare host) + { + super(host, "Take fall damage"); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } + + @Override + public void FailItems(Player player) + { + + } + + @EventHandler + public void Damage(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.FALL) + return; + + Player player = event.GetDamageePlayer(); + if (player == null) return; + + SetCompleted(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/DamageGhast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/DamageGhast.java new file mode 100644 index 000000000..41e8232d3 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/DamageGhast.java @@ -0,0 +1,74 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import org.bukkit.Material; +import org.bukkit.entity.Ghast; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.Order; + +public class DamageGhast extends Order +{ + public DamageGhast(MineWare host) + { + super(host, "shoot the ghast"); + } + + @Override + public void Initialize() + { + for (Player player : Host.GetPlayers(true)) + { + if (!player.getInventory().contains(Material.BOW)) + player.getInventory().addItem(new ItemStack(Material.BOW)); + } + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player player : Host.GetPlayers(true)) + if (!player.getInventory().contains(Material.ARROW)) + player.getInventory().addItem(new ItemStack(Material.ARROW)); + } + + @Override + public void Uninitialize() + { + + } + + @Override + public void FailItems(Player player) + { + + } + + @EventHandler + public void Damage(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Player player = event.GetDamagerPlayer(true); + if (player == null) return; + + LivingEntity ent = event.GetDamageeEntity(); + if (ent == null) return; + + if (!(ent instanceof Ghast)) + return; + + SetCompleted(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/GatherCobble.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/GatherCobble.java new file mode 100644 index 000000000..88b88feed --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/GatherCobble.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.OrderGather; + +public class GatherCobble extends OrderGather +{ + public GatherCobble(MineWare host) + { + super(host, "Pick up 10 Cobblestone", 4, -1, 10); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/GatherRedFlower.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/GatherRedFlower.java new file mode 100644 index 000000000..34052dff9 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/GatherRedFlower.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.OrderGather; + +public class GatherRedFlower extends OrderGather +{ + public GatherRedFlower(MineWare host) + { + super(host, "Pick 3 Red Roses", 38, -1, 3); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/GatherSand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/GatherSand.java new file mode 100644 index 000000000..99d76396c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/GatherSand.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.OrderGather; + +public class GatherSand extends OrderGather +{ + public GatherSand(MineWare host) + { + super(host, "Pick up 16 Sand", 12, -1, 16); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/GatherYellowFlower.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/GatherYellowFlower.java new file mode 100644 index 000000000..a112e3d4b --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/GatherYellowFlower.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.OrderGather; + +public class GatherYellowFlower extends OrderGather +{ + public GatherYellowFlower(MineWare host) + { + super(host, "Pick 4 Yellow Flowers", 37, -1, 4); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/PlaceDoor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/PlaceDoor.java new file mode 100644 index 000000000..fe16504e3 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/PlaceDoor.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.OrderPlace; + +public class PlaceDoor extends OrderPlace +{ + public PlaceDoor(MineWare host) + { + super(host, "Place a wooden door", 64, -1, 1); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/RideBoat.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/RideBoat.java new file mode 100644 index 000000000..d1c36217d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/RideBoat.java @@ -0,0 +1,48 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import org.bukkit.entity.Boat; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.Order; + +public class RideBoat extends Order +{ + public RideBoat(MineWare host) + { + super(host, "Sit in a Boat"); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } + + @Override + public void FailItems(Player player) + { + + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player player : Host.GetPlayers(true)) + if (player.isInsideVehicle()) + if (player.getVehicle() instanceof Boat) + SetCompleted(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/RidePig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/RidePig.java new file mode 100644 index 000000000..2a394929f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/RidePig.java @@ -0,0 +1,54 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import org.bukkit.Material; +import org.bukkit.entity.Pig; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.Order; + +public class RidePig extends Order +{ + public RidePig(MineWare host) + { + super(host, "ride a pig"); + } + + @Override + public void Initialize() + { + for (Player player : Host.GetPlayers(true)) + { + if (!player.getInventory().contains(Material.SADDLE)) + player.getInventory().addItem(new ItemStack(Material.SADDLE)); + } + } + + @Override + public void Uninitialize() + { + + } + + @Override + public void FailItems(Player player) + { + + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player player : Host.GetPlayers(true)) + if (player.isInsideVehicle()) + if (player.getVehicle() instanceof Pig) + SetCompleted(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/StandAlone.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/StandAlone.java new file mode 100644 index 000000000..de105899e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/StandAlone.java @@ -0,0 +1,63 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.Order; + +public class StandAlone extends Order +{ + public StandAlone(MineWare host) + { + super(host, "Run away from everyone"); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } + + @Override + public void FailItems(Player player) + { + + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player player : Host.GetPlayers(true)) + { + boolean alone = true; + + for (Player other : Host.GetPlayers(true)) + { + if (other.equals(player)) + continue; + + if (UtilMath.offset(player, other) < 16) + { + alone = false; + break; + } + } + + if (alone) + SetCompleted(player); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/StandShelter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/StandShelter.java new file mode 100644 index 000000000..96c21911c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/StandShelter.java @@ -0,0 +1,63 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.Order; + +public class StandShelter extends Order +{ + public StandShelter(MineWare host) + { + super(host, "take shelter from rain"); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + Host.WorldData.World.setStorm(false); + } + + @Override + public void FailItems(Player player) + { + + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + Host.WorldData.World.setStorm(true); + + for (Player player : Host.GetPlayers(true)) + { + Block block = player.getLocation().add(0, 2, 0).getBlock(); + + while (block.getTypeId() == 0 && block.getLocation().getY() < 255) + { + block = block.getRelative(BlockFace.UP); + + if (block.getTypeId() != 0) + { + SetCompleted(player); + break; + } + } + } + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/StandStone.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/StandStone.java new file mode 100644 index 000000000..2229eadee --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/StandStone.java @@ -0,0 +1,48 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import org.bukkit.Material; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.Order; + +public class StandStone extends Order +{ + public StandStone(MineWare host) + { + super(host, "Stand on stone"); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } + + @Override + public void FailItems(Player player) + { + + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player player : Host.GetPlayers(true)) + if (player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.STONE) + SetCompleted(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/StandWater.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/StandWater.java new file mode 100644 index 000000000..d809a78ad --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/mineware/random/StandWater.java @@ -0,0 +1,46 @@ +package nautilus.game.arcade.game.minigames.mineware.random; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.minigames.mineware.MineWare; +import nautilus.game.arcade.game.minigames.mineware.order.Order; + +public class StandWater extends Order +{ + public StandWater(MineWare host) + { + super(host, "Go for a swim"); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } + + @Override + public void FailItems(Player player) + { + + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player player : Host.GetPlayers(true)) + if (player.getLocation().getBlock().isLiquid()) + SetCompleted(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/Quiver.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/Quiver.java new file mode 100644 index 000000000..19ef5ddbf --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/Quiver.java @@ -0,0 +1,332 @@ +package nautilus.game.arcade.game.minigames.quiver; + +import java.util.ArrayList; +import java.util.HashMap; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.scoreboard.DisplaySlot; +import org.bukkit.scoreboard.Objective; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.minigames.quiver.kits.*; +import nautilus.game.arcade.kit.Kit; + +public class Quiver extends SoloGame +{ + private ArrayList _ranks = new ArrayList(); + private ArrayList _lastScoreboard = new ArrayList(); + private HashMap _combo = new HashMap(); + private HashMap _bestCombo = new HashMap(); + private HashMap _deathTime = new HashMap(); + + private Objective _scoreObj; + + public Quiver(ArcadeManager manager) + { + super(manager, GameType.Quiver, + + new Kit[] + { + new KitLeaper(manager), + new KitBrawler(manager), + new KitElementalist(manager), + }, + + new String[] + { + "Bow and Arrow insta-kills.", + "You receive 1 Arrow per kill.", + "First player to 20 kills wins." + }); + + this.HungerSet = 20; + this.DeathDropItems = false; + this.DeathOut = false; + this.DamageSelf = false; + this.DamageTeamSelf = true; + this.PrepareFreeze = false; + this.SpawnDistanceRequirement = 16; + + _scoreObj = GetScoreboard().registerNewObjective("Kills", "dummy"); + _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); + } + + @EventHandler(priority = EventPriority.HIGH) + public void GameStateChange(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + + for (Player player : GetPlayers(true)) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow"))); + player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f); + } + + GetObjectiveSide().setDisplayName(C.cWhite + C.Bold + "First to " + C.cGold + C.Bold + "20 Kills"); + } + + @EventHandler + public void BowShoot(EntityShootBowEvent event) + { + if (!(event.getProjectile() instanceof Arrow)) + return; + + Arrow arrow = (Arrow)event.getProjectile(); + + if (arrow.getShooter() == null) + return; + + if (!(arrow.getShooter() instanceof Player)) + return; + + if (!_deathTime.containsKey(arrow.getShooter())) + return; + + if (UtilTime.elapsed(_deathTime.get(arrow.getShooter()), 1000)) + return; + + event.getProjectile().remove(); + + final Player player = (Player)arrow.getShooter(); + + Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() + { + public void run() + { + if (!player.getInventory().contains(Material.ARROW)) + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow"))); + } + }, 10); + + } + + @EventHandler + public void Death(CombatDeathEvent event) + { + if (event.GetEvent().getEntity() instanceof Player) + { + _deathTime.put((Player)event.GetEvent().getEntity(), System.currentTimeMillis()); + } + + if (event.GetLog().GetKiller() == null) + return; + + if (!event.GetLog().GetKiller().IsPlayer()) + return; + + Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + if (player == null) return; + + //New Arrow + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow"))); + player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f); + + //Score + AddKill(player); + } + + @EventHandler + public void ComboReset(CombatDeathEvent event) + { + if (!(event.GetEvent().getEntity() instanceof Player)) + return; + + Player player = (Player)event.GetEvent().getEntity(); + + if (!_combo.containsKey(player)) + return; + + int combo = _combo.remove(player); + + int best = 0; + if (_bestCombo.containsKey(player)) + best = _bestCombo.get(player); + + if (combo > best) + _bestCombo.put(player, combo); + } + + public void AddKill(Player player) + { + //Combo + int combo = 1; + if (_combo.containsKey(player)) + combo += _combo.get(player); + + _combo.put(player, combo); + + AnnounceCombo(player, combo); + + //Rank + for (QuiverScore score : _ranks) + { + if (score.Player.equals(player)) + { + score.Kills += 1; + _scoreObj.getScore(player).setScore(score.Kills); + EndCheck(); + return; + } + } + + _ranks.add(new QuiverScore(player, 1)); + _scoreObj.getScore(player).setScore(1); + } + + private void AnnounceCombo(Player player, int combo) + { + String killType = null; + if (combo == 20) killType = "PERFECT RUN"; + else if (combo == 13) killType = "GODLIKE"; + else if (combo == 11) killType = "UNSTOPPABLE"; + else if (combo == 9) killType = "ULTRA KILL"; + else if (combo == 7) killType = "MONSTER KILL"; + else if (combo == 5) killType = "MEGA KILL"; + else if (combo == 3) killType = "TRIPLE KILL"; + + if (killType == null) + return; + + //Announce + for (Player other : UtilServer.getPlayers()) + { + UtilPlayer.message(other, F.main("Game", C.cGreen + C.Bold + player.getName() + ChatColor.RESET + " got " + + F.elem(C.cAqua + C.Bold + killType +" (" + combo + " Kills)!"))); + other.playSound(other.getLocation(), Sound.ENDERDRAGON_GROWL, 1f + (combo/10f), 1f + (combo/10f)); + } + } + + private void SortScores() + { + for (int i=0 ; i<_ranks.size() ; i++) + { + for (int j=_ranks.size()-1 ; j>0 ; j--) + { + if (_ranks.get(j).Kills > _ranks.get(j-1).Kills) + { + QuiverScore temp = _ranks.get(j); + _ranks.set(j, _ranks.get(j-1)); + _ranks.set(j-1, temp); + } + } + } + } + + @EventHandler + public void ArrowDamage(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + return; + + event.AddMod("Projectile", "Instagib", 9001, false); + event.SetKnockback(false); + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + //Wipe Last + for (String string : _lastScoreboard) + { + GetScoreboard().resetScores(Bukkit.getOfflinePlayer(string)); + } + _lastScoreboard.clear(); + + SortScores(); + + //Write New + for (QuiverScore score : _ranks) + { + String out = score.Kills + " " + C.cGreen + score.Player.getName(); + + if (out.length() >= 16) + out = out.substring(0, 15); + + _lastScoreboard.add(out); + + GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(score.Kills); + } + } + + @EventHandler + public void PickupCancel(PlayerPickupItemEvent event) + { + event.setCancelled(true); + } + + @Override + public void EndCheck() + { + if (!IsLive()) + return; + + SortScores(); + + if ((!_ranks.isEmpty() && _ranks.get(0).Kills >= 20) || GetPlayers(true).size() <= 1) + { + //Set Places + _places.clear(); + for (int i=0 ; i<_ranks.size() ; i++) + _places.add(i, _ranks.get(i).Player); + + //Award Gems + if (_ranks.size() >= 1) + AddGems(_ranks.get(0).Player, 20, "1st Place", false); + + if (_ranks.size() >= 2) + AddGems(_ranks.get(1).Player, 15, "2nd Place", false); + + if (_ranks.size() >= 3) + AddGems(_ranks.get(2).Player, 10, "3rd Place", false); + + //Combo Gems + for (Player player : _bestCombo.keySet()) + { + int combo = _bestCombo.get(player); + + if (combo >= 20) AddGems(player, 40, "PERFECT - 20 Kill Combo", false); + else if (combo >= 13) AddGems(player, 24, "GODLIKE - 13 Kill Combo", false); + else if (combo >= 11) AddGems(player, 20, "UNSTOPPABLE - 11 Kill Combo", false); + else if (combo >= 9) AddGems(player, 16, "ULTRA KILL - 9 Kill Combo", false); + else if (combo >= 7) AddGems(player, 12, "MONSTER KILL - 7 Kill Combo", false); + else if (combo >= 5) AddGems(player, 8, "MEGA KILL - 5 Kill Combo", false); + else if (combo >= 3) AddGems(player, 4, "TRIPLE KILL - 3 Kill Combo", false); + } + + //Participation + for (Player player : GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false); + + SetState(GameState.End); + AnnounceEnd(_places); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/QuiverScore.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/QuiverScore.java new file mode 100644 index 000000000..c1ff54ffd --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/QuiverScore.java @@ -0,0 +1,15 @@ +package nautilus.game.arcade.game.minigames.quiver; + +import org.bukkit.entity.Player; + +public class QuiverScore +{ + public org.bukkit.entity.Player Player; + public int Kills; + + public QuiverScore(Player player, int i) + { + Player = player; + Kills = i; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/kits/KitBrawler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/kits/KitBrawler.java new file mode 100644 index 000000000..d208ef2eb --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/kits/KitBrawler.java @@ -0,0 +1,53 @@ +package nautilus.game.arcade.game.minigames.quiver.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitBrawler extends Kit +{ + public KitBrawler(ArcadeManager manager) + { + super(manager, "Brawler", KitAvailability.Green, + + new String[] + { + "Missed your arrow? Not a big deal." + }, + + new Perk[] + { + new PerkStrength(1) + }, + EntityType.ZOMBIE, + new ItemStack(Material.IRON_SWORD)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + + if (Manager.GetGame().GetState() == GameState.Live) + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow"))); + } + + @Override + public void SpawnCustom(Creature ent) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/kits/KitElementalist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/kits/KitElementalist.java new file mode 100644 index 000000000..91c58dc45 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/kits/KitElementalist.java @@ -0,0 +1,53 @@ +package nautilus.game.arcade.game.minigames.quiver.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitElementalist extends Kit +{ + public KitElementalist(ArcadeManager manager) + { + super(manager, "Enchanter", KitAvailability.Blue, + + new String[] + { + "3 Kills, 1 Arrow." + }, + + new Perk[] + { + new PerkArrowRebound(2, 1.2f) + }, + EntityType.ZOMBIE, + new ItemStack(Material.BOW)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + + if (Manager.GetGame().GetState() == GameState.Live) + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow"))); + } + + @Override + public void SpawnCustom(Creature ent) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/kits/KitLeaper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/kits/KitLeaper.java new file mode 100644 index 000000000..9ad6419d2 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/quiver/kits/KitLeaper.java @@ -0,0 +1,53 @@ +package nautilus.game.arcade.game.minigames.quiver.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitLeaper extends Kit +{ + public KitLeaper(ArcadeManager manager) + { + super(manager, "Leaper", KitAvailability.Free, + + new String[] + { + "Evade and kill using your powerful leap!" + }, + + new Perk[] + { + new PerkLeaper("Leap", 1.2, 1.0, 8000) + }, + EntityType.ZOMBIE, + new ItemStack(Material.IRON_AXE)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + + if (Manager.GetGame().GetState() == GameState.Live) + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow"))); + } + + @Override + public void SpawnCustom(Creature ent) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/runner/Runner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/runner/Runner.java new file mode 100644 index 000000000..e71a614e9 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/runner/Runner.java @@ -0,0 +1,309 @@ +package nautilus.game.arcade.game.minigames.runner; + +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftArrow; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilTime; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.minigames.runner.kits.*; +import nautilus.game.arcade.kit.Kit; +import net.minecraft.server.v1_6_R2.EntityArrow; + +public class Runner extends SoloGame implements IThrown +{ + private HashMap _blocks = new HashMap(); + + public Runner(ArcadeManager manager) + { + super(manager, GameType.Runner, + + new Kit[] + { + new KitLeaper(manager), + new KitArcher(manager), + new KitFrosty(manager) + }, + + new String[] + { + "Blocks fall from underneath you", + "Keep running to stay alive", + "Avoid falling blocks from above", + "Last player alive wins!" + }); + + this.DamagePvP = false; + this.HungerSet = 20; + this.WaterDamage = 4; + + this.PrepareFreeze = false; + } + + @EventHandler + public void ArrowDamage(ProjectileHitEvent event) + { + if (!(event.getEntity() instanceof Arrow)) + return; + + final Arrow arrow = (Arrow)event.getEntity(); + + Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() + { + public void run() + { + try + { + EntityArrow entityArrow = ((CraftArrow)arrow).getHandle(); + + Field fieldX = EntityArrow.class.getDeclaredField("d"); + Field fieldY = EntityArrow.class.getDeclaredField("e"); + Field fieldZ = EntityArrow.class.getDeclaredField("f"); + + fieldX.setAccessible(true); + fieldY.setAccessible(true); + fieldZ.setAccessible(true); + + int x = fieldX.getInt(entityArrow); + int y = fieldY.getInt(entityArrow); + int z = fieldZ.getInt(entityArrow); + + Block block = arrow.getWorld().getBlockAt(x, y, z); + + double radius = 2.5; + + for (Block other : UtilBlock.getInRadius(block.getLocation().add(0.5, 0.5, 0.5), radius).keySet()) + { + AddBlock(other); + } + + arrow.remove(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + }, 0); + } + + public void AddBlock(Block block) + { + if (block == null || block.getTypeId() == 0 || block.getTypeId() == 7 || block.isLiquid()) + return; + + if (block.getRelative(BlockFace.UP).getTypeId() != 0) + return; + + if (_blocks.containsKey(block)) + return; + + _blocks.put(block, System.currentTimeMillis()); + } + + @EventHandler + public void BlockBreak(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + //Add Blocks + for (Player player : GetPlayers(true)) + { + //Side Standing + double xMod = player.getLocation().getX() % 1; + if (player.getLocation().getX() < 0) + xMod += 1; + + double zMod = player.getLocation().getZ() % 1; + if (player.getLocation().getZ() < 0) + zMod += 1; + + int xMin = 0; + int xMax = 0; + int zMin = 0; + int zMax = 0; + + if (xMod < 0.3) xMin = -1; + if (xMod > 0.7) xMax = 1; + + if (zMod < 0.3) zMin = -1; + if (zMod > 0.7) zMax = 1; + + for (int x=xMin ; x<=xMax ; x++) + { + for (int z=zMin ; z<=zMax ; z++) + { + AddBlock(player.getLocation().add(x, -0.5, z).getBlock()); + } + } + } + + //Decay + HashSet readd = new HashSet(); + + Iterator blockIterator = _blocks.keySet().iterator(); + + while (blockIterator.hasNext()) + { + Block block = blockIterator.next(); + + if (!UtilTime.elapsed(_blocks.get(block), 120)) + continue; + + blockIterator.remove(); + + //Degrade + if (block.getTypeId() == 98) + { + if (block.getData() == 0) + { + readd.add(block); + block.setData((byte)2); + continue; + } + } + + //Degrade + if (block.getTypeId() == 35 || block.getTypeId() == 159) + { + if (block.getData() == 3) + { + readd.add(block); + block.setData((byte)5); + continue; + } + + if (block.getData() == 5) + { + readd.add(block); + block.setData((byte)4); + continue; + } + + if (block.getData() == 4) + { + readd.add(block); + block.setData((byte)1); + continue; + } + + if (block.getData() == 1) + { + readd.add(block); + block.setData((byte)14); + continue; + } + + else if (block.getData() != 14) + { + readd.add(block); + block.setData((byte)3); + continue; + } + } + + //Fall + int id = block.getTypeId(); + byte data = block.getData(); + MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); + FallingBlock ent = block.getWorld().spawnFallingBlock(block.getLocation(), id, data); + Manager.GetProjectile().AddThrow(ent, null, this, -1, true, false, false, false, 1d); + } + + //Re-add + for (Block block : readd) + { + _blocks.put(block, System.currentTimeMillis()); + } + } + + @EventHandler + public void BlockForm(EntityChangeBlockEvent event) + { + BlockSmash(event.getEntity()); + + event.setCancelled(true); + } + + public void BlockSmash(Entity ent) + { + if (!(ent instanceof FallingBlock)) + return; + + FallingBlock block = (FallingBlock)ent; + + int id = block.getBlockId(); + if (id == 35 || id == 159) + id = 152; + + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, id); + + ent.remove(); + } + + + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (target == null) + return; + + if (target instanceof Player) + { + if (!Manager.GetGame().IsAlive((Player)target)) + { + return; + } + } + + //Damage Event + Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + DamageCause.ENTITY_ATTACK, 6, true, true, false, + "Falling Block", "Falling Block"); + + BlockSmash(data.GetThrown()); + } + + @Override + public void Idle(ProjectileUser data) + { + // TODO Auto-generated method stub + + } + + @Override + public void Expire(ProjectileUser data) + { + // TODO Auto-generated method stub + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/runner/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/runner/kits/KitArcher.java new file mode 100644 index 000000000..1aaed7c67 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/runner/kits/KitArcher.java @@ -0,0 +1,40 @@ +package nautilus.game.arcade.game.minigames.runner.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitArcher extends Kit +{ + public KitArcher(ArcadeManager manager) + { + super(manager, "Archer", KitAvailability.Free, + + new String[] + { + "Fire arrows to cause blocks to fall!" + }, + + new Perk[] + { + new PerkQuickshot("Quickshot", 1.2, 6000) + }, + EntityType.SKELETON, + new ItemStack(Material.BOW)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/runner/kits/KitFrosty.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/runner/kits/KitFrosty.java new file mode 100644 index 000000000..241557bfa --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/runner/kits/KitFrosty.java @@ -0,0 +1,57 @@ +package nautilus.game.arcade.game.minigames.runner.kits; + +import org.bukkit.EntityEffect; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.entity.Snowball; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitFrosty extends Kit +{ + public KitFrosty(ArcadeManager manager) + { + super(manager, "Frosty", KitAvailability.Free, + + new String[] + { + "Slow enemies to send them to their death!" + }, + + new Perk[] + { + new PerkConstructor("Frost Balls", 0.5, 16, Material.SNOW_BALL, "Snowball", true) + }, + EntityType.SKELETON, + new ItemStack(Material.SNOW_BALL)); + + } + + @Override + public void GiveItems(Player player) + { + + } + + @EventHandler + public void SnowballHit(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + return; + + if (!(event.GetProjectile() instanceof Snowball)) + return; + + event.GetDamageeEntity().playEffect(EntityEffect.HURT); + + Manager.GetCondition().Factory().Slow("Snowball Slow", event.GetDamageeEntity(), event.GetProjectile().getShooter(), 2, 1, false, false, true, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/runner/kits/KitLeaper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/runner/kits/KitLeaper.java new file mode 100644 index 000000000..e821d39a0 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/runner/kits/KitLeaper.java @@ -0,0 +1,40 @@ +package nautilus.game.arcade.game.minigames.runner.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitLeaper extends Kit +{ + public KitLeaper(ArcadeManager manager) + { + super(manager, "Jumper", KitAvailability.Free, + + new String[] + { + "Leap to avoid falling to your death!" + }, + + new Perk[] + { + new PerkLeaper("Leap", 1.2, 1.2, 8000) + }, + EntityType.SKELETON, + new ItemStack(Material.STONE_AXE)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/snowfight/SnowFight.java new file mode 100644 index 000000000..3fd50d338 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/snowfight/SnowFight.java @@ -0,0 +1,229 @@ +package nautilus.game.arcade.game.minigames.snowfight; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.World; +import org.bukkit.World.Environment; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Snowball; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.NullKit; + +public class SnowFight extends TeamGame +{ + public SnowFight(ArcadeManager manager) + { + super(manager, GameType.SnowFight, + + new Kit[] + { + new NullKit(manager) + }, + + new String[] + { + "Just like... kill your enemies. with snow." + }); + } + + + @EventHandler + public void Weather(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + World world = UtilWorld.getWorldType(Environment.NORMAL); + + if (world == null) + return; + + world.setStorm(true); + world.setThundering(false); + world.setWeatherDuration(40); + world.setTime(4000); + } + + @EventHandler + public void BlockDamage(BlockDamageEvent event) + { + Player player = event.getPlayer(); + + if (!IsLive()) + return; + + if (!IsPlaying(player)) + return; + + if (!IsSnow(event.getBlock())) + return; + + if (player.getInventory().getHeldItemSlot() != 0) + return; + + //Item + SnowballCount(player, 1); + + //Snow Height + SnowDecrease(event.getBlock(), 1); + + //Effect + event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, 80); + } + + @EventHandler + public void InteractSnowball(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!IsLive()) + return; + + if (!IsPlaying(player)) + return; + + if (!UtilGear.isMat(player.getItemInHand(), Material.SNOW_BALL)) + return; + + event.setCancelled(true); + + if (UtilEvent.isAction(event, ActionType.L)) + SnowballThrow(player); + + else if (UtilEvent.isAction(event, ActionType.R_BLOCK)) + SnowballPlace(player, event.getClickedBlock(), 1); + } + + private void SnowballPlace(Player player, Block block, int above) + { + if (block.getTypeId() == 78 || UtilBlock.airFoliage(block)) + { + //Build + if (block.getTypeId() == 78) + { + block.setTypeIdAndData(78, (byte)(block.getData() + 1), true); + + if (block.getData() >= 7) + block.setTypeIdAndData(80, (byte)0, true); + } + else + { + block.setTypeIdAndData(78, (byte)0, true); + } + + //Sound + block.getWorld().playSound(block.getLocation(), Sound.STEP_SNOW, 1f, 0.6f); + + //Use Snow + SnowballCount(player, -1); + } + else if ((IsSnow(block) || UtilBlock.solid(block)) && above > 0) + { + SnowballPlace(player, block.getRelative(BlockFace.UP), above - 1); + } + } + + private void SnowballThrow(Player player) + { + //Throw + player.launchProjectile(Snowball.class); + + //Use Snow + SnowballCount(player, -1); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 3f, 1.5f); + } + + private void SnowballCount(Player player, int count) + { + if (player.getInventory().getItem(1) != null) + count += player.getInventory().getItem(1).getAmount(); + + if (count > 16) + count = 16; + + if (count > 0) + player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL, count)); + else + player.getInventory().setItem(1, null); + } + + private void SnowDecrease(Block block, int height) + { + if (height <= 0) + return; + + if (!IsSnow(block)) + return; + + //Shuffle Up + while (IsSnow(block.getRelative(BlockFace.UP))) + block = block.getRelative(BlockFace.UP); + + //Snow Block + int snowLevel = 8; + if (block.getTypeId() == 78) + snowLevel = block.getData() + 1; + + //Lower + if (height >= snowLevel) + { + block.setTypeIdAndData(0, (byte)0, true); + SnowDecrease(block.getRelative(BlockFace.DOWN), height-snowLevel); + } + else + { + block.setTypeIdAndData(78, (byte)(snowLevel-height-1), true); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void SnowballDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Projectile proj = event.GetProjectile(); + if (proj == null) return; + + if (!(proj instanceof Snowball)) + return; + + event.AddMod("Snowball", "Snowball", 3, true); + event.SetIgnoreRate(true); + + //Effect + proj.getWorld().playEffect(proj.getLocation(), Effect.STEP_SOUND, 80); + } + + private boolean IsSnow(Block block) + { + return block.getTypeId() == 78 || block.getTypeId() == 80; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/spleef/Spleef.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/spleef/Spleef.java new file mode 100644 index 000000000..ab70ebf15 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/spleef/Spleef.java @@ -0,0 +1,195 @@ +package nautilus.game.arcade.game.minigames.spleef; + +import java.lang.reflect.Field; + +import org.bukkit.Effect; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftArrow; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.entity.ProjectileHitEvent; + +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.minigames.spleef.kits.*; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.perks.event.PerkLeapEvent; +import net.minecraft.server.v1_6_R2.EntityArrow; + +public class Spleef extends SoloGame +{ + public Spleef(ArcadeManager manager) + { + super(manager, GameType.Spleef, + + new Kit[] + { + new KitLeaper(manager), + new KitBrawler(manager), + new KitArcher(manager) + }, + + new String[] + { + "Punch blocks to break them!", + "Some blocks take multiple hits.", + "Last player alive wins!" + }); + + this.DamagePvP = false; + this.HungerSet = 20; + this.WaterDamage = 4; + + this.PrepareFreeze = false; + } + + @EventHandler + public void ArrowDamage(ProjectileHitEvent event) + { + final Arrow arrow = (Arrow)event.getEntity(); + final double velocity = arrow.getVelocity().length(); + + if (!(arrow.getShooter() instanceof Player)) + return; + + final Player player = (Player)arrow.getShooter(); + + Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() + { + public void run() + { + try + { + EntityArrow entityArrow = ((CraftArrow)arrow).getHandle(); + + Field fieldX = EntityArrow.class.getDeclaredField("d"); + Field fieldY = EntityArrow.class.getDeclaredField("e"); + Field fieldZ = EntityArrow.class.getDeclaredField("f"); + + fieldX.setAccessible(true); + fieldY.setAccessible(true); + fieldZ.setAccessible(true); + + int x = fieldX.getInt(entityArrow); + int y = fieldY.getInt(entityArrow); + int z = fieldZ.getInt(entityArrow); + + Block block = arrow.getWorld().getBlockAt(x, y, z); + + double radius = 0.5 + velocity/1.6d; + + BlockFade(block, player); + + for (Block other : UtilBlock.getInRadius(block.getLocation().add(0.5, 0.5, 0.5), radius).keySet()) + { + BlockFade(other, player); + } + + arrow.remove(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + }, 0); + } + + @EventHandler(priority = EventPriority.LOW) + public void BlockDamage(BlockDamageEvent event) + { + if (!this.IsLive()) + return; + + if (!this.IsAlive(event.getPlayer())) + return; + + event.setCancelled(true); + } + + @EventHandler + public void LeapDamage(PerkLeapEvent event) + { + if (!UtilEnt.isGrounded(event.GetPlayer())) + return; + + for (Block block : UtilBlock.getInRadius(event.GetPlayer().getLocation().subtract(0, 1, 0), 3d, 0).keySet()) + { + BlockFade(block, event.GetPlayer()); + } + } + + @EventHandler + public void BlockFade(Block block, Player player) + { + this.AddGems(player, 0.02, "Spleef Blocks Broken", true); + + //Wool and Stained Clay + if (block.getTypeId() == 35 || block.getTypeId() == 159) + { + //Greens + if (block.getData() == 5 || block.getData() == 13) + block.setData((byte)4); + + //Yellow + else if (block.getData() == 4) + block.setData((byte)14); + + else + Break(block); + } + + //Stone + else if (block.getTypeId() == 1) + { + block.setTypeId(4); + } + + //Stone Brick + else if (block.getTypeId() == 98) + { + if (block.getData() == 0 || block.getData() == 1) + block.setData((byte)2); + + else + Break(block); + } + + //Grass + else if (block.getTypeId() == 2) + { + block.setTypeId(3); + } + + //Wood Planks + else if (block.getTypeId() == 5) + { + if (block.getData() == 1) + block.setData((byte)0); + + else if (block.getData() == 0) + block.setData((byte)2); + + else + Break(block); + } + + //Other + else if (block.getTypeId() != 7) + { + Break(block); + } + } + + public void Break(Block block) + { + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + block.setTypeId(0); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/spleef/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/spleef/kits/KitArcher.java new file mode 100644 index 000000000..3ee34f4ed --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/spleef/kits/KitArcher.java @@ -0,0 +1,41 @@ +package nautilus.game.arcade.game.minigames.spleef.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitArcher extends Kit +{ + public KitArcher(ArcadeManager manager) + { + super(manager, "Archer", KitAvailability.Blue, + + new String[] + { + "Arrows will damage spleef blocks in a small radius." + }, + + new Perk[] + { + new PerkFletcher(2, 2, false), + new PerkKnockback(0.3) + }, + EntityType.SKELETON, + new ItemStack(Material.BOW)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/spleef/kits/KitBrawler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/spleef/kits/KitBrawler.java new file mode 100644 index 000000000..c37297497 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/spleef/kits/KitBrawler.java @@ -0,0 +1,41 @@ +package nautilus.game.arcade.game.minigames.spleef.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitBrawler extends Kit +{ + public KitBrawler(ArcadeManager manager) + { + super(manager, "Brawler", KitAvailability.Green, + + new String[] + { + "Much stronger knockback than other kits." + }, + + new Perk[] + { + new PerkSmasher(), + new PerkKnockback(0.6) + }, + EntityType.ZOMBIE, + new ItemStack(Material.IRON_SWORD)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/spleef/kits/KitLeaper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/spleef/kits/KitLeaper.java new file mode 100644 index 000000000..b555cf9dd --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/spleef/kits/KitLeaper.java @@ -0,0 +1,41 @@ +package nautilus.game.arcade.game.minigames.spleef.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitLeaper extends Kit +{ + public KitLeaper(ArcadeManager manager) + { + super(manager, "Jumper", KitAvailability.Free, + + new String[] + { + "Leap to escape and damage blocks!" + }, + + new Perk[] + { + new PerkLeaper("Smashing Leap", 1.2, 1.2, 8000), + new PerkKnockback(0.3) + }, + EntityType.PIG_ZOMBIE, + new ItemStack(Material.STONE_AXE)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/TurfForts.java new file mode 100644 index 000000000..6bf164d9a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/TurfForts.java @@ -0,0 +1,595 @@ +package nautilus.game.arcade.game.minigames.turfforts; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftArrow; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.scoreboard.Score; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.game.minigames.turfforts.kits.*; +import nautilus.game.arcade.kit.Kit; +import net.minecraft.server.v1_6_R2.EntityArrow; +import net.minecraft.server.v1_6_R2.Item; + +public class TurfForts extends TeamGame +{ + private ArrayList _turf; + + private Location _red; + private Location _redBase; + + private Location _blue; + private Location _blueBase; + + private int xRed = 0; + private int zRed = 0; + + private long _phaseTime = 0; + private long _buildTime = 20000; + private long _fightTime = 90000; + private boolean _fight = false; + private int _lines = 0; + + private HashMap _enemyTurf = new HashMap(); + + public TurfForts(ArcadeManager manager) + { + super(manager, GameType.TurfForts, + + new Kit[] + { + + new KitMarksman(manager), + new KitInfiltrator(manager), + new KitShredder(manager), + }, + + new String[] + { + "You have 30 seconds to build your Fort!", + "", + "Each kill advances your turf forwards.", + "Take over all the turf to win!" + + }); + + this.HungerSet = 20; + this.DeathOut = false; + this.DeathDropItems = false; + this.BlockPlaceAllow.add(35); + this.BlockBreakAllow.add(35); + this.ItemDrop = false; + this.ItemPickup = false; + } + + @Override + public void ParseData() + { + _turf = WorldData.GetDataLocs("YELLOW"); + + _red = WorldData.GetDataLocs("RED").get(0); + _redBase = WorldData.GetDataLocs("PINK").get(0); + + _blue = WorldData.GetDataLocs("BLUE").get(0); + _blueBase = WorldData.GetDataLocs("LIGHT_BLUE").get(0); + + if (_red.getBlockX() > _blue.getBlockX()) xRed = 1; + else if (_red.getBlockX() < _blue.getBlockX()) xRed = -1; + + if (_red.getBlockZ() > _blue.getBlockZ()) zRed = 1; + else if (_red.getBlockZ() < _blue.getBlockZ()) zRed = -1; + + //Color Turf + for (Location loc : _turf) + { + if (UtilMath.offset(loc, _red) < UtilMath.offset(loc, _blue)) + MapUtil.QuickChangeBlockAt(loc, 159, (byte)14); + else + MapUtil.QuickChangeBlockAt(loc, 159, (byte)3); + } + } + + @EventHandler + public void PlayerKillAward(CombatDeathEvent event) + { + if (!(event.GetEvent().getEntity() instanceof Player)) + return; + + if (event.GetLog().GetKiller() == null) + return; + + Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + if (killer == null) + return; + + if (GetTeam(killer) == null) + return; + + if (GetTeam(killer).GetColor() == ChatColor.RED) + { + TurfMove(true); + } + else + { + TurfMove(false); + } + } + + private void TurfMove(boolean red) + { + for (int line=0 ; line _turf.get(0).getBlockY() + 5) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot build this high up.")); + event.setCancelled(true); + return; + } + + Block block = event.getBlock().getRelative(BlockFace.DOWN); + while (block.getTypeId() == 0) + block = block.getRelative(BlockFace.DOWN); + + if (block.getData() != team.GetColorData()) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "You can only build above " + F.elem(team.GetColor() + team.GetName()) + ".")); + event.setCancelled(true); + return; + } + } + + @EventHandler + public void BlockDamage(ProjectileHitEvent event) + { + if (event.getEntity().getShooter() == null) + return; + + if (!(event.getEntity() instanceof Arrow)) + return; + + if (!(event.getEntity().getShooter() instanceof Player)) + return; + + Player shooter = (Player)event.getEntity().getShooter(); + final GameTeam team = GetTeam(shooter); + if (team == null) + return; + + final Arrow arrow = (Arrow)event.getEntity(); + + Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() + { + public void run() + { + try + { + EntityArrow entityArrow = ((CraftArrow)arrow).getHandle(); + + Field fieldX = EntityArrow.class.getDeclaredField("d"); + Field fieldY = EntityArrow.class.getDeclaredField("e"); + Field fieldZ = EntityArrow.class.getDeclaredField("f"); + + fieldX.setAccessible(true); + fieldY.setAccessible(true); + fieldZ.setAccessible(true); + + int x = fieldX.getInt(entityArrow); + int y = fieldY.getInt(entityArrow); + int z = fieldZ.getInt(entityArrow); + + Block block = arrow.getWorld().getBlockAt(x, y, z); + + if (block.getTypeId() == 35) + { + if (block.getData() == 14 && team.GetColor() != ChatColor.RED) + { + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.REDSTONE_BLOCK.getId()); + } + else if (block.getData() == 3 && team.GetColor() != ChatColor.AQUA) + { + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.LAPIS_BLOCK.getId()); + } + + block.breakNaturally(); + } + + arrow.remove(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + }, 0); + } + + @EventHandler + public void Damage(CustomDamageEvent event) + { + if (!_fight) + { + event.SetCancelled("Build Time"); + } + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + event.AddMod("Turf Forts", "Nullify", -event.GetDamageInitial(), false); + + if (event.GetCause() == DamageCause.PROJECTILE) + { + if (GetKit(damager).GetName().contains("Shredder")) + { + event.AddMod("Turf Forts", "One Hit Kill", 15, false); + } + else + { + event.AddMod("Turf Forts", "One Hit Kill", 30, false); + } + } + else if (event.GetCause() == DamageCause.ENTITY_ATTACK) + { + if (UtilGear.isMat(damager.getItemInHand(), Material.IRON_SWORD)) + { + event.AddMod("Turf Forts", "One Hit Kill", 12, false); + } + else + { + event.AddMod("Turf Forts", "One Hit Kill", 6, false); + } + } + } + + @EventHandler + public void ScoreboardTitle(UpdateEvent event) + { + if (GetState() != GameState.Live) + return; + + //2x Initial Build + if (_phaseTime == 0) + _phaseTime = System.currentTimeMillis() + _buildTime; + + if (event.getType() != UpdateType.TICK) + return; + + long time; + if (!_fight) + { + time = _buildTime - (System.currentTimeMillis() - _phaseTime); + + long displayTime = Math.max(0, time); + GetObjectiveSide().setDisplayName(ChatColor.WHITE + C.Bold + "Build Time " + C.cGreen + C.Bold+ UtilTime.MakeStr(displayTime)); + + if (time <= 0) + { + _fight = true; + _lines++; + + Announce(" "); + Announce(C.cWhite + C.Bold + "1 Kill" + C.cWhite + C.Bold + " = " + C.cWhite + C.Bold + GetLinesPerKill() + " Turf Lines"); + Announce(C.cWhite + C.Bold + "90 Seconds of " + C.cYellow + C.Bold + "Combat Time" + C.cWhite + C.Bold + " has begun!"); + Announce(" "); + + _phaseTime = System.currentTimeMillis(); + } + } + + else + { + time = _fightTime - (System.currentTimeMillis() - _phaseTime); + + long displayTime = Math.max(0, time); + GetObjectiveSide().setDisplayName(ChatColor.WHITE + C.Bold + "Combat Time " + C.cGreen + C.Bold+ UtilTime.MakeStr(displayTime)); + + if (time <= 0) + { + _fight = false; + + Announce(" "); + Announce(C.cWhite + C.Bold + "20 Seconds of " + C.cGreen + C.Bold + "Build Time" + C.cWhite + C.Bold + " has begun!"); + Announce(" "); + + _phaseTime = System.currentTimeMillis(); + + for (GameTeam team : GetTeamList()) + { + for (Player player : team.GetPlayers(true)) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, team.GetColorData(), 16)); + } + } + } + } + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (GameTeam team : this.GetTeamList()) + { + String name = team.GetColor() + team.GetName(); + if (name.length() > 16) + name = name.substring(0, 16); + + int lines = 0; + if (team.GetColor() == ChatColor.RED) lines = GetRedLines(); + else lines = GetBlueLines(); + + Score score = GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(name)); + score.setScore(lines); + } + } + + public int GetRedLines() + { + if (!InProgress()) + return 0; + + if (xRed != 0) + { + return Math.abs(_redBase.getBlockX() - _red.getBlockX()); + } + + return Math.abs(_redBase.getBlockZ() - _red.getBlockZ()); + } + + public int GetBlueLines() + { + if (!InProgress()) + return 0; + + if (xRed != 0) + { + return Math.abs(_blueBase.getBlockX() - _blue.getBlockX()); + } + + return Math.abs(_blueBase.getBlockZ() - _blue.getBlockZ()); + } + + public int GetLinesPerKill() + { + return _lines; + //return Math.min(5, 1 + (int)((System.currentTimeMillis() - GetStateTime() - 30000) / 60000)); + } + + @EventHandler + public void Territory(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.FASTER) + return; + + for (GameTeam team : this.GetTeamList()) + { + for (Player player : team.GetPlayers(true)) + { + Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN); + while (block.getTypeId() == 0) + block = block.getRelative(BlockFace.DOWN); + + byte data = block.getData(); + + if ((team.GetColor() == ChatColor.RED && data == 3) || (team.GetColor() == ChatColor.AQUA && data == 14)) + { + + //Infiltrate + if (_fight && GetKit(player) != null && GetKit(player).GetName().contains("Infil")) + { + + if (!_enemyTurf.containsKey(player)) + { + _enemyTurf.put(player, System.currentTimeMillis()); + } + else + { + int time = (int) ((System.currentTimeMillis() - _enemyTurf.get(player))/2500); + + if (time > 0) + { + Manager.GetCondition().Factory().Slow("Infiltrator Slow", player, player, 0.9, time-1, false, false, false, false); + } + + } + + continue; + } + + if (Recharge.Instance.use(player, "Territory Knockback", 2000, false)) + { + UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), team.GetSpawn()), 2, false, 0, 0.8, 1, true); + + player.damage(10); + + player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f); + UtilPlayer.message(player, F.main("Game", "You cannot walk on the enemies turf!")); + } + + return; + } + else if ((team.GetColor() == ChatColor.RED && data == 14) || (team.GetColor() == ChatColor.AQUA && data == 3)) + { + _enemyTurf.remove(player); + } + } + } + } + + @EventHandler + public void ItemRemoval(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.FAST) + return; + + for (Entity ent : _red.getWorld().getEntities()) + { + if (!(ent instanceof Item)) + return; + + if (ent.getTicksLived() > 40) + ent.remove(); + } + } + + @Override + public void EndCheck() + { + if (!IsLive()) + return; + + if (GetRedLines() == 0) + { + AnnounceEnd(GetTeam(ChatColor.AQUA)); + } + else if (GetBlueLines() == 0) + { + AnnounceEnd(GetTeam(ChatColor.RED)); + } + else + return; + + for (GameTeam team : GetTeamList()) + { + if (WinnerTeam != null && team.equals(WinnerTeam)) + { + for (Player player : team.GetPlayers(false)) + AddGems(player, 10, "Winning Team", false); + } + + for (Player player : team.GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false); + } + + //End + SetState(GameState.End); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/kits/KitInfiltrator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/kits/KitInfiltrator.java new file mode 100644 index 000000000..b5781fc79 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/kits/KitInfiltrator.java @@ -0,0 +1,55 @@ +package nautilus.game.arcade.game.minigames.turfforts.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkConstructor; +import nautilus.game.arcade.kit.perks.PerkFletcher; + +public class KitInfiltrator extends Kit +{ + public KitInfiltrator(ArcadeManager manager) + { + super(manager, "Infiltrator", KitAvailability.Free, + new String[] + { + "Able to travel into the enemies turf, but you", + "must return to your turf fast, or receive Slow." + }, + new Perk[] + { + new PerkConstructor("Constructor", 4, 4, Material.WOOL, "Wool", false), + new PerkFletcher(12, 1, false), + }, + EntityType.ZOMBIE, + new ItemStack(Material.IRON_SWORD)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + + int amount = 4; + if (!Manager.GetGame().IsLive()) + amount = 48; + + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), amount)); + } + + @Override + public void SpawnCustom(Creature ent) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/kits/KitMarksman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/kits/KitMarksman.java new file mode 100644 index 000000000..18891f455 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/kits/KitMarksman.java @@ -0,0 +1,54 @@ +package nautilus.game.arcade.game.minigames.turfforts.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkConstructor; +import nautilus.game.arcade.kit.perks.PerkFletcher; + +public class KitMarksman extends Kit +{ + public KitMarksman(ArcadeManager manager) + { + super(manager, "Marksman", KitAvailability.Free, + new String[] + { + "Unrivaled in archery. One hit kills anyone." + }, + new Perk[] + { + new PerkConstructor("Constructor", 4, 8, Material.WOOL, "Wool", false), + new PerkFletcher(4, 2, false), + + }, + EntityType.ZOMBIE, + new ItemStack(Material.BOW)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + + int amount = 4; + if (!Manager.GetGame().IsLive()) + amount = 48; + + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), amount)); + } + + @Override + public void SpawnCustom(Creature ent) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/kits/KitShredder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/kits/KitShredder.java new file mode 100644 index 000000000..8c39ac81b --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/turfforts/kits/KitShredder.java @@ -0,0 +1,55 @@ +package nautilus.game.arcade.game.minigames.turfforts.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkBarrage; +import nautilus.game.arcade.kit.perks.PerkConstructor; +import nautilus.game.arcade.kit.perks.PerkFletcher; + +public class KitShredder extends Kit +{ + public KitShredder(ArcadeManager manager) + { + super(manager, "Shredder", KitAvailability.Free, + new String[] + { + "Arrows are weaker, but shred through forts." + }, + new Perk[] + { + new PerkConstructor("Constructor", 4, 6, Material.WOOL, "Wool", false), + new PerkFletcher(4, 2, false), + new PerkBarrage(5, 250, false), + }, + EntityType.ZOMBIE, + new ItemStack(Material.BOW)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + + int amount = 4; + if (!Manager.GetGame().IsLive()) + amount = 48; + + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), amount)); + } + + @Override + public void SpawnCustom(Creature ent) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/undeadescape/GiantData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/undeadescape/GiantData.java new file mode 100644 index 000000000..e41a84c1d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/undeadescape/GiantData.java @@ -0,0 +1,152 @@ +package nautilus.game.arcade.game.minigames.undeadescape; + +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; + +import org.bukkit.Location; +import org.bukkit.entity.EnderDragon; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +public class GiantData +{ + public UndeadEscape Host; + + public EnderDragon Dragon; + + public Entity TargetEntity = null; + + public Location Target = null; + public Location Location = null; + + public float Pitch = 0; + public Vector Velocity = new Vector(0,0,0); + + public double RangeBest = 1000; + public long RangeTime = 0; + + public GiantData(UndeadEscape host, EnderDragon dragon) + { + Host = host; + + Dragon = dragon; + + Velocity = dragon.getLocation().getDirection().setY(0).normalize(); + Pitch = UtilAlg.GetPitch(dragon.getLocation().getDirection()); + + Location = dragon.getLocation(); + } + + public void Update() + { + Turn(); + + Location.add(Velocity); + Location.add(0, -Pitch, 0); + + Location.setPitch(-1 * Pitch); + Location.setYaw(180 + UtilAlg.GetYaw(Velocity)); + + Dragon.teleport(Location); + } + + private void Turn() + { + //Pitch + float desiredPitch = UtilAlg.GetPitch(UtilAlg.getTrajectory(Location, Target)); + if (desiredPitch < Pitch) Pitch = (float)(Pitch - 0.05); + if (desiredPitch > Pitch) Pitch = (float)(Pitch + 0.05); + if (Pitch > 0.5) Pitch = 0.5f; + if (Pitch < -0.5) Pitch = -0.5f; + + //Flat + Vector desired = UtilAlg.getTrajectory2d(Location, Target); + desired.subtract(UtilAlg.Normalize(new Vector(Velocity.getX(), 0, Velocity.getZ()))); + desired.multiply(0.075); + + Velocity.add(desired); + + //Speed + UtilAlg.Normalize(Velocity); + } + + public void Target() + { + if (TargetEntity != null) + { + if (!TargetEntity.isValid()) + { + TargetEntity = null; + } + else + { + Target = TargetEntity.getLocation().subtract(0, 8, 0); + } + + return; + } + + if (Target == null) + { + TargetSky(); + } + + if (UtilMath.offset(Location, Target) < 4) + { + //Target Player + if (Target.getY() >= Host.GetSpectatorLocation().getY()) + { + TargetPlayer(); + } + //Target Sky + else + { + TargetSky(); + } + } + + TargetTimeout(); + } + + public void TargetTimeout() + { + if (UtilMath.offset(Location, Target)+1 < RangeBest) + { + RangeTime = System.currentTimeMillis(); + RangeBest = UtilMath.offset(Location, Target); + } + else + { + if (UtilTime.elapsed(RangeTime, 10000)) + { + TargetSky(); + } + } + } + + public void TargetSky() + { + RangeBest = 9000; + RangeTime = System.currentTimeMillis(); + + Target = Host.GetSpectatorLocation().clone().add(50 - UtilMath.r(100), 20 + UtilMath.r(30), 50 - UtilMath.r(100)); + } + + public void TargetPlayer() + { + RangeBest = 9000; + RangeTime = System.currentTimeMillis(); + + Player player = Host.GetPlayers(true).get(UtilMath.r(Host.GetPlayers(true).size())); + Target = player.getLocation(); + + Target.add(UtilAlg.getTrajectory(Location, Target).multiply(4)); + } + + public void HitByArrow() + { + TargetSky(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/undeadescape/UndeadEscape.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/undeadescape/UndeadEscape.java new file mode 100644 index 000000000..b534911e6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/minigames/undeadescape/UndeadEscape.java @@ -0,0 +1,245 @@ +package nautilus.game.arcade.game.minigames.undeadescape; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Creature; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.Giant; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.standalone.bridge.kits.KitBeserker; +import nautilus.game.arcade.kit.Kit; + +public class UndeadEscape extends SoloGame +{ + private Location _giantStart; + private Location _giantEnd; + + private Creature _giant = null; + + public UndeadEscape(ArcadeManager manager) + { + super(manager, GameType.UndeadEscape, + + new Kit[] + { + new KitBeserker(manager) + }, + + new String[] + { + "RUN!!!!!!!" + }); + + this.DamagePvP = false; + } + + @Override + public void ParseData() + { + if (!WorldData.GetDataLocs("BLACK").isEmpty()) + _giantStart = WorldData.GetDataLocs("BLACK").get(0); + + if (!WorldData.GetDataLocs("WHITE").isEmpty()) + _giantEnd = WorldData.GetDataLocs("WHITE").get(0); + } + + @EventHandler + public void GiantTarget(EntityTargetEvent event) + { + if (_giant == null) + return; + + if (event.getEntity().equals(_giant)) + event.setCancelled(true); + } + + @EventHandler + public void GiantDamage(EntityDamageEvent event) + { + if (_giant == null) + return; + + if (event.getEntity().equals(_giant)) + event.setCancelled(true); + } + + @EventHandler + public void GiantCombust(EntityCombustEvent event) + { + if (_giant == null) + return; + + if (event.getEntity().equals(_giant)) + event.setCancelled(true); + } + + @EventHandler + public void GiantMove(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (GetState() != GameState.Live) + return; + + if (!UtilTime.elapsed(GetStateTime(), 5000)) + return; + + if (_giant == null || !_giant.isValid()) + { + if (_giant != null) + _giant.remove(); + + CreatureAllowOverride = true; + _giant = _giantStart.getWorld().spawn(_giantStart, Giant.class); + CreatureAllowOverride = false; + } + + //Move + double rate = 0.075 + ((System.currentTimeMillis() - this.GetStateTime())/100000d); + + Location target = _giant.getLocation().add(UtilAlg.getTrajectory(_giantStart, _giantEnd).multiply(rate)); + _giant.teleport(target); + + /* + EntityCreature ec = ((CraftCreature)_giant).getHandle(); + Navigation nav = ec.getNavigation(); + Location loc = _giant.getLocation().add(UtilAlg.getTrajectory(_giantStart, _giantEnd).multiply(1)); + nav.a(loc.getX(), loc.getY(), loc.getZ(), 2f + Math.min(2f, (float)())); + */ + } + + @EventHandler + public void GiantGroan(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (GetState() != GameState.Live) + return; + + if (_giant == null) + return; + + if (Math.random() > 0.75) + return; + + _giant.getWorld().playSound(_giant.getEyeLocation(), Sound.ZOMBIE_IDLE, 5f, 0.5f + (float)(Math.random())); + } + + @EventHandler + public void GiantKill(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_giant == null) + return; + + for (Player player : GetPlayers(true)) + { + if (UtilMath.offset2d(player, _giant) < 7) + { + player.damage(50); + } + } + } + + @EventHandler + public void GiantBlocks(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (GetState() != GameState.Live) + return; + + if (_giant == null) + return; + + for (int x=-7 ; x<=7 ; x++) + { + for (int z=-7 ; z<=7 ; z++) + { + for (int y=0 ; y<=15 ; y++) + { + Block block = _giant.getWorld().getBlockAt( + _giant.getLocation().getBlockX()+x, + _giant.getLocation().getBlockY()+y, + _giant.getLocation().getBlockZ()+z); + + if (block.getTypeId() == 0) + continue; + + final Material mat = block.getType(); + final byte data = block.getData(); + final Location loc = block.getLocation().add(0.5, 0.5, 0.5); + + block.setTypeId(0); + + Manager.GetPlugin().getServer().getScheduler().runTaskLater(Manager.GetPlugin(), new Runnable() + { + public void run() + { + FallingBlock fall = loc.getWorld().spawnFallingBlock(loc, mat, data); + + Vector vec = UtilAlg.getTrajectory(_giant, fall); + if (vec.getY() < 0) vec.setY(vec.getY() * -1); + + vec.add(new Vector(0.2 - Math.random()*0.4,0.2 - Math.random()*0.4,0.2 - Math.random()*0.4)); + + UtilAction.velocity(fall, vec, 0.75 + 0.25*Math.random(), false, 0, 0.4 + 0.20*Math.random(), 10, false); + } + }, 1); + } + } + } + } + + @Override + public Location GetSpectatorLocation() + { + if (SpectatorSpawn == null) + { + SpectatorSpawn = new Location(this.WorldData.World, 0,0,0); + } + + Vector vec = new Vector(0,0,0); + double count = 0; + + for (Player player : GetPlayers(true)) + { + count++; + vec.add(player.getLocation().toVector()); + } + + vec.multiply(1d/count); + + SpectatorSpawn.setX(vec.getX()); + SpectatorSpawn.setY(vec.getY() + 10); + SpectatorSpawn.setZ(vec.getZ()); + + return SpectatorSpawn; + } + + //@Override + //public void EndCheck() + //{} +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/Bridge.java new file mode 100644 index 000000000..01771eb24 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/Bridge.java @@ -0,0 +1,964 @@ +package nautilus.game.arcade.game.standalone.bridge; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.Chest; +import org.bukkit.entity.Chicken; +import org.bukkit.entity.Cow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.Pig; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockFormEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.explosion.ExplosionEvent; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerDeathOutEvent; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.game.standalone.bridge.kits.*; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.ore.OreHider; +import nautilus.game.arcade.ore.OreObsfucation; + +public class Bridge extends TeamGame implements OreObsfucation +{ + //Bridge Timer + private int _bridgeTime = 600000; + private boolean _bridgesDown = false; + + //Wood Bridge + private ArrayList _woodBridge = new ArrayList(); + private HashMap _woodBridgeBlocks = null; + + //Lava Bridge + private ArrayList _lavaBridge = new ArrayList(); + private ArrayList _lavaSource = new ArrayList(); + + //Bridge Parts + private HashSet _bridgeParts = new HashSet(); + + //Animals + private long _lastAnimal = System.currentTimeMillis(); + private HashMap> _animalSet = new HashMap>(); + + //Mushroom + private long _lastMushroom = System.currentTimeMillis(); + + //Chset Loot + private ArrayList _chestLoot = new ArrayList(); + + //Ore + private OreHider _ore; + private double _oreDensity = 2.2; + + + //Map Flags + private int _buildHeight = -1; + private int _iceForm = -1; + + //Player Respawn + private HashSet _usedLife = new HashSet(); + + public Bridge(ArcadeManager manager) + { + super(manager, GameType.Bridge, + + new Kit[] + { + new KitApple(manager), + new KitBeserker(manager), + new KitMammoth(manager), + new KitMiner(manager), + new KitArcher(manager), + new KitBomber(manager), + }, + + new String[] { + "Gather resources and prepare for combat.", + "After 10 minutes, The Bridges will emerge.", + "Special loot is located in the center.", + "The last team alive wins!" + }); + + _ore = new OreHider(); + + // Flags + this.DamageSelf = true; + + this.ItemDrop = true; + this.ItemPickup = true; + + this.PrivateBlocks = true; + this.BlockBreak = true; + this.BlockPlace = true; + + this.WorldTimeSet = 2000; + + this.WaterDamage = 4; + + this.CompassEnabled = true; + } + + @EventHandler + public void PlayerOut(PlayerDeathOutEvent event) + { + if (_bridgesDown) + return; + + Player player = event.GetPlayer(); + + if (Manager.GetClients().Get(player).GetRank().Has(Rank.ULTRA) || Manager.GetDonation().Get(player.getName()).OwnsUnknownPackage(GetName() + " ULTRA")) + { + if (!_usedLife.contains(player.getName())) + { + _usedLife.add(player.getName()); + + UtilPlayer.message(player, F.main("Game", "You used your " + F.elem(C.cAqua + "Ultra Rank Revive") + ".")); + + event.setCancelled(true); + } + } + else + { + UtilPlayer.message(player, F.main("Game", "Purchase " + F.elem(C.cAqua + "Ultra Rank") + " to revive during pre-game!")); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void GameStateChange(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + + if (WaterDamage > 0) + Announce(F.main(C.cWhite + C.Bold + "WARNING", C.cRed + C.Bold + "Water is very hot/cold and will hurt you!")); + } + + @Override + public void ParseData() + { + if (!WorldData.GetDataLocs("WHITE").isEmpty()) + WaterDamage = 4; + + ParseLavaBridge(); + ParseWoodBridge(); + ParseIceBridge(); + + ParseChests(); + + ParseOre(WorldData.GetCustomLocs("73")); // Red + ParseOre(WorldData.GetCustomLocs("14")); // Yellow + ParseOre(WorldData.GetCustomLocs("129")); // Green + ParseOre(WorldData.GetCustomLocs("56")); // Blue + } + + private void ParseChests() + { + for (Location loc : WorldData.GetCustomLocs("54")) + { + if (loc.getBlock().getType() != Material.CHEST) + loc.getBlock().setType(Material.CHEST); + + Chest chest = (Chest) loc.getBlock().getState(); + + chest.getBlockInventory().clear(); + + int count = 2 + UtilMath.r(5); + for (int i = 0; i < count; i++) + { + chest.getBlockInventory().addItem(GetChestItem()); + } + } + } + + private ItemStack GetChestItem() + { + if (_chestLoot.isEmpty()) + { + for (int i = 0; i < 1; i++) + _chestLoot.add(new ItemStack(Material.DIAMOND_HELMET)); + for (int i = 0; i < 1; i++) + _chestLoot.add(new ItemStack(Material.DIAMOND_CHESTPLATE)); + for (int i = 0; i < 1; i++) + _chestLoot.add(new ItemStack(Material.DIAMOND_LEGGINGS)); + for (int i = 0; i < 1; i++) + _chestLoot.add(new ItemStack(Material.DIAMOND_BOOTS)); + for (int i = 0; i < 1; i++) + _chestLoot.add(new ItemStack(Material.DIAMOND_SWORD)); + for (int i = 0; i < 1; i++) + _chestLoot.add(new ItemStack(Material.DIAMOND_AXE)); + for (int i = 0; i < 1; i++) + _chestLoot.add(new ItemStack(Material.DIAMOND_PICKAXE)); + + for (int i = 0; i < 6; i++) + _chestLoot.add(new ItemStack(Material.IRON_HELMET)); + for (int i = 0; i < 6; i++) + _chestLoot.add(new ItemStack(Material.IRON_CHESTPLATE)); + for (int i = 0; i < 6; i++) + _chestLoot.add(new ItemStack(Material.IRON_LEGGINGS)); + for (int i = 0; i < 6; i++) + _chestLoot.add(new ItemStack(Material.IRON_BOOTS)); + for (int i = 0; i < 6; i++) + _chestLoot.add(new ItemStack(Material.IRON_SWORD)); + for (int i = 0; i < 6; i++) + _chestLoot.add(new ItemStack(Material.IRON_AXE)); + for (int i = 0; i < 6; i++) + _chestLoot.add(new ItemStack(Material.IRON_PICKAXE)); + + for (int i = 0; i < 18; i++) + _chestLoot.add(new ItemStack(Material.BOW)); + for (int i = 0; i < 24; i++) + _chestLoot.add(new ItemStack(Material.ARROW, 8)); + + for (int i = 0; i < 48; i++) + _chestLoot.add(new ItemStack(Material.MUSHROOM_SOUP)); + for (int i = 0; i < 24; i++) + _chestLoot.add(new ItemStack(Material.COOKED_CHICKEN, 2)); + } + + ItemStack stack = _chestLoot.get(UtilMath.r(_chestLoot.size())); + + int amount = 1; + + if (stack.getType().getMaxStackSize() > 1) + amount = stack.getAmount() + UtilMath.r(stack.getAmount()); + + return ItemStackFactory.Instance.CreateStack(stack.getTypeId(), amount); + } + + private void ParseOre(ArrayList teamOre) + { + int coal = (int) ((teamOre.size() / 32d) * _oreDensity); + int iron = (int) ((teamOre.size() / 24d) * _oreDensity); + int gold = (int) ((teamOre.size() / 64d) * _oreDensity); + int diamond = 1 + (int) ((teamOre.size() / 128d) * _oreDensity); + + int gravel = (int) ((teamOre.size() / 64d) * _oreDensity); + + int lowY = 256; + int highY = 0; + + for (Location loc : teamOre) + { + if (loc.getBlockY() < lowY) + lowY = loc.getBlockY(); + + if (loc.getBlockY() > highY) + highY = loc.getBlockY(); + + loc.getBlock().setTypeId(1); + } + + int varY = highY - lowY; + + //Gravel + for (int i = 0; i < gravel && !teamOre.isEmpty(); i++) + { + int attempts = 20; + int id = 0; + + while (attempts > 0) + { + id = UtilMath.r(teamOre.size()); + + double height = (double) (teamOre.get(id).getBlockY() - lowY) / (double) varY; + + if (height > 0.8) + break; + + else if (height > 0.6 && Math.random() > 0.4) + break; + + else if (height > 0.4 && Math.random() > 0.6) + break; + + else if (height > 0.2 && Math.random() > 0.8) + break; + } + + CreateOre(teamOre.remove(id), Material.GRAVEL, 6); + } + + //Coal + for (int i = 0; i < coal && !teamOre.isEmpty(); i++) + { + int attempts = 20; + int id = 0; + + while (attempts > 0) + { + id = UtilMath.r(teamOre.size()); + + double height = (double) (teamOre.get(id).getBlockY() - lowY) / (double) varY; + + if (height > 0.8) + break; + + else if (height > 0.6 && Math.random() > 0.4) + break; + + else if (height > 0.4 && Math.random() > 0.6) + break; + + else if (height > 0.2 && Math.random() > 0.8) + break; + } + + CreateOre(teamOre.remove(id), Material.COAL_ORE, 6); + } + + //Iron + for (int i = 0; i < iron && !teamOre.isEmpty(); i++) + { + int id = UtilMath.r(teamOre.size()); + + CreateOre(teamOre.remove(id), Material.IRON_ORE, 3); + } + + //Gold + for (int i = 0; i < gold && !teamOre.isEmpty(); i++) + { + int attempts = 20; + int id = 0; + + while (attempts > 0) + { + id = UtilMath.r(teamOre.size()); + + double height = (double) (teamOre.get(id).getBlockY() - lowY) + / (double) varY; + + if (height > 0.8 && Math.random() > 0.8) + break; + + else if (height > 0.6 && Math.random() > 0.7) + break; + + else if (height > 0.4 && Math.random() > 0.6) + break; + + else if (height > 0.2 && Math.random() > 0.4) + break; + + else if (Math.random() > 0.2) + break; + } + + CreateOre(teamOre.remove(id), Material.GOLD_ORE, 3); + } + + //Diamond + for (int i = 0; i < diamond && !teamOre.isEmpty(); i++) + { + int attempts = 20; + int id = 0; + + while (attempts > 0) + { + id = UtilMath.r(teamOre.size()); + + double height = (double) (teamOre.get(id).getBlockY() - lowY) + / (double) varY; + + if (height > 0.8) + continue; + + else if (height > 0.6 && Math.random() > 0.9) + break; + + else if (height > 0.4 && Math.random() > 0.7) + break; + + else if (height > 0.2 && Math.random() > 0.5) + break; + + else + break; + } + + CreateOre(teamOre.remove(id), Material.DIAMOND_ORE, 2); + } + } + + private void CreateOre(Location loc, Material type, int amount) + { + double bonus = Math.random() + 1; + + amount = (int) (amount * bonus); + + int attempts = 100; + while (amount > 0 && attempts > 0) + { + attempts--; + + loc.add(1 - UtilMath.r(3), 1 - UtilMath.r(3), 1 - UtilMath.r(3)); + + if (loc.getBlock().getTypeId() != 1) + continue; + + _ore.AddOre(loc, type); + + amount--; + } + } + + private void ParseWoodBridge() { + _woodBridge = new ArrayList(); + + // Load Wood In + for (Location loc : WorldData.GetDataLocs("BROWN")) { + _woodBridge.add(loc.getBlock().getLocation()); + } + + for (Location loc : WorldData.GetDataLocs("GRAY")) { + _woodBridge.add(loc.getBlock().getLocation()); + _woodBridge.add(loc.getBlock().getRelative(BlockFace.UP) + .getLocation()); + } + + // Determine Wood Block + _woodBridgeBlocks = new HashMap(); + + for (Location loc : _woodBridge) { + if (_woodBridge.contains(loc.getBlock().getRelative(BlockFace.DOWN) + .getLocation())) { + _woodBridgeBlocks.put(loc, 85); + } + + if (_woodBridge.contains(loc.getBlock().getRelative(BlockFace.UP) + .getLocation())) { + _woodBridgeBlocks.put(loc, 17); + } + + if (!_woodBridgeBlocks.containsKey(loc)) { + _woodBridgeBlocks.put(loc, 126); + } + } + } + + private void ParseLavaBridge() { + for (Location loc : WorldData.GetDataLocs("RED")) { + _lavaBridge.add(loc.getBlock().getLocation()); + } + + for (Location loc : WorldData.GetDataLocs("ORANGE")) { + _lavaBridge.add(loc.getBlock().getLocation()); + _lavaBridge.add(loc.getBlock().getRelative(BlockFace.UP) + .getLocation()); + } + + _lavaSource = WorldData.GetDataLocs("BLACK"); + } + + private void ParseIceBridge() + { + if (WorldData.GetCustomLocs("WATER_HEIGHT").isEmpty()) + return; + + _iceForm = WorldData.GetCustomLocs("WATER_HEIGHT").get(0).getBlockY(); + } + + @EventHandler + public void BridgeBuild(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.FASTEST) + return; + + if (!UtilTime.elapsed(this.GetStateTime(), _bridgeTime)) + return; + + _bridgesDown = true; + + BuildWood(); + BuildLava(); + BuildIce(); + } + + private void BuildIce() + { + if (_iceForm <= 0) + return; + + if (UtilTime.elapsed(this.GetStateTime(), _bridgeTime + 120000)) + { + WorldData.World.setStorm(false); + return; + } + + WorldData.World.setStorm(true); + + //Short Delay (so snow properly starts) + if (!UtilTime.elapsed(this.GetStateTime(), _bridgeTime + 6000)) + return; + + int xVar = WorldData.MaxX - WorldData.MinX; + int zVar = WorldData.MaxZ - WorldData.MinZ; + + //do area + BuildIceArea(WorldData.MinX, WorldData.MinX + xVar/2, WorldData.MinZ, WorldData.MinZ + zVar/2, Material.REDSTONE_BLOCK); + BuildIceArea(WorldData.MinX + xVar/2, WorldData.MaxX, WorldData.MinZ, WorldData.MinZ + zVar/2, Material.GOLD_BLOCK); + BuildIceArea(WorldData.MinX, WorldData.MinX + xVar/2, WorldData.MinZ + zVar/2, WorldData.MaxZ, Material.EMERALD_BLOCK); + BuildIceArea(WorldData.MinX + xVar/2, WorldData.MaxX, WorldData.MinZ + zVar/2, WorldData.MaxZ, Material.DIAMOND_BLOCK); + } + + private void BuildIceArea(int xLow, int xHigh, int zLow, int zHigh, Material mat) + { + int attempts = 1000; + int complete = 10; + + //Team A + while (attempts > 0 && complete > 0) + { + attempts--; + + int x = xLow + UtilMath.r(xHigh - xLow); + int z = zLow + UtilMath.r(zHigh - zLow); + + Block block = WorldData.World.getBlockAt(x, _iceForm, z); + + if (!block.isLiquid()) + continue; + + if (block.getRelative(BlockFace.NORTH).isLiquid() && + block.getRelative(BlockFace.EAST).isLiquid() && + block.getRelative(BlockFace.SOUTH).isLiquid() && + block.getRelative(BlockFace.WEST).isLiquid()) + continue; + + block.setType(Material.ICE); + + complete--; + } + } + + private void BuildLava() + { + for (int i = 0; i < 3; i++) + if (_lavaBridge != null && _lavaSource != null + && !_lavaBridge.isEmpty() && !_lavaSource.isEmpty()) { + // Random Block + Location bestLoc = _lavaBridge.get(UtilMath.r(_lavaBridge + .size())); + + if (bestLoc.getBlock().getRelative(BlockFace.DOWN) + .isLiquid()) + continue; + + _lavaBridge.remove(bestLoc); + + Location source = _lavaSource.get(UtilMath.r(_lavaSource + .size())); + + // Create Part + FallingBlock block = bestLoc.getWorld().spawnFallingBlock( + source, 10, (byte) 0); + BridgePart part = new BridgePart(block, bestLoc, true); + _bridgeParts.add(part); + + // Sound + source.getWorld().playSound(source, Sound.EXPLODE, + 5f * (float) Math.random(), + 0.5f + (float) Math.random()); + } + } + + private void BuildWood() + { + if (_woodBridgeBlocks != null && !_woodBridgeBlocks.isEmpty()) + { + ArrayList toDo = new ArrayList(); + + BlockFace[] faces = new BlockFace[] { BlockFace.NORTH, + BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST }; + + for (Location loc : _woodBridgeBlocks.keySet()) + { + if (_woodBridgeBlocks.get(loc) == 17) + { + int adjacent = 0; + + for (BlockFace face : faces) + if (loc.getBlock().getRelative(face).getTypeId() != 0) + adjacent++; + + if (adjacent > 0) + toDo.add(loc); + + } else if (_woodBridgeBlocks.get(loc) == 85) + { + if (loc.getBlock().getRelative(BlockFace.DOWN).getTypeId() == 0) + continue; + + toDo.add(loc); + } else if (_woodBridgeBlocks.get(loc) == 126) + { + int adjacent = 0; + + for (BlockFace face : faces) + if (loc.getBlock().getRelative(face).getTypeId() != 0) + adjacent++; + + if (adjacent > 0) + toDo.add(loc); + } + } + + if (toDo.size() == 0) + return; + + for (Location loc : toDo) + { + int id = _woodBridgeBlocks.remove(loc); + + Location source = loc.clone().add(0, 30, 0); + + // Create Part + FallingBlock block = loc.getWorld().spawnFallingBlock(source, + id, (byte) 0); + block.setVelocity(new Vector(0, -1, 0)); + BridgePart part = new BridgePart(block, loc, false); + _bridgeParts.add(part); + } + } + } + + @EventHandler + public void BridgeUpdate(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.TICK) + return; + + Iterator partIterator = _bridgeParts.iterator(); + + while (partIterator.hasNext()) + { + BridgePart part = partIterator.next(); + + if (part.Update()) + partIterator.remove(); + } + } + + @EventHandler + public void BridgeForm(EntityChangeBlockEvent event) + { + for (BridgePart part : _bridgeParts) + if (part.Entity.equals(event.getEntity())) + event.setCancelled(true); + } + + @EventHandler + public void BridgeItem(ItemSpawnEvent event) + { + for (BridgePart part : _bridgeParts) + if (part.ItemSpawn(event.getEntity())) + event.setCancelled(true); + } + + @EventHandler + public void IceForm(BlockFormEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void AnimalSpawn(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.SEC) + return; + + if (!UtilTime.elapsed(_lastAnimal, 30000)) + return; + + _lastAnimal = System.currentTimeMillis(); + + for (GameTeam team : GetTeamList()) + { + if (_animalSet.get(team) == null) + _animalSet.put(team, new HashSet()); + + // Clean + Iterator entIterator = _animalSet.get(team).iterator(); + + while (entIterator.hasNext()) + { + Entity ent = entIterator.next(); + + if (ent.isDead() || !ent.isValid()) + entIterator.remove(); + } + + // Too Many + if (_animalSet.get(team).size() > 4) + continue; + + // Spawn + double rand = Math.random(); + + Entity ent; + + CreatureAllowOverride = true; + if (rand > 0.66) + ent = team.GetSpawn().getWorld().spawn(team.GetSpawn(), Cow.class); + else if (rand > 0.33) + ent = team.GetSpawn().getWorld().spawn(team.GetSpawn(), Pig.class); + else + ent = team.GetSpawn().getWorld().spawn(team.GetSpawn(), Chicken.class); + CreatureAllowOverride = false; + + _animalSet.get(team).add(ent); + } + } + + @EventHandler + public void MushroomSpawn(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.SEC) + return; + + if (!UtilTime.elapsed(_lastMushroom, 20000)) + return; + + _lastMushroom = System.currentTimeMillis(); + + for (GameTeam team : GetTeamList()) + { + Block block = team.GetSpawn().getBlock(); + + while (!UtilBlock.airFoliage(block)) + { + block = block.getRelative(BlockFace.UP); + } + + while (UtilBlock.airFoliage(block)) + { + block = block.getRelative(BlockFace.DOWN); + } + + block = block.getRelative(BlockFace.UP); + + if (block.getTypeId() == 0) + { + if (Math.random() > 0.5) + block.setTypeId(39); + else + block.setTypeId(40); + } + } + } + + @EventHandler + public void OreReveal(ExplosionEvent event) + { + _ore.Explosion(event); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void OreReveal(BlockBreakEvent event) + { + if (event.isCancelled()) + return; + + _ore.BlockBreak(event); + } + + @EventHandler + public void OreRevealToggle(AsyncPlayerChatEvent event) + { + if (!Manager.GetClients().Get(event.getPlayer()).GetRank().Has(Rank.OWNER)) + return; + + if (event.getMessage().contains("toggleorevisibility")) + _ore.ToggleVisibility(); + } + + @EventHandler(priority = EventPriority.LOW) + public void BlockPlace(BlockPlaceEvent event) + { + if (event.isCancelled()) + return; + + if (!IsAlive(event.getPlayer())) + return; + + //Too High + if (event.getBlock().getLocation().getBlockY() > GetHeightLimit()) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", + "Cannot place blocks this high up.")); + event.setCancelled(true); + return; + } + + if (_bridgesDown) + return; + + //In Liquid + if (event.getBlockReplacedState().getTypeId() == 8 || + event.getBlockReplacedState().getTypeId() == 9 || + event.getBlockReplacedState().getTypeId() == 10 || + event.getBlockReplacedState().getTypeId() == 11) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", + "Cannot place blocks in liquids until Bridge is down.")); + event.setCancelled(true); + return; + } + + //Above Water/Void + for (int i = 1; i <= event.getBlock().getLocation().getY(); i++) + { + Block below = event.getBlock().getRelative(BlockFace.DOWN, i); + + if (below.isLiquid()) + { + UtilPlayer + .message( + event.getPlayer(), + F.main("Game", + "Cannot place blocks above water until Bridge is down.")); + event.setCancelled(true); + return; + } + + if (event.getBlock().getLocation().getY() - i <= 0) + { + UtilPlayer + .message( + event.getPlayer(), + F.main("Game", + "Cannot place blocks above void until Bridge is down.")); + event.setCancelled(true); + return; + } + + if (below.getTypeId() != 0) + break; + } + } + + @EventHandler + public void BridgeTimer(UpdateEvent event) + { + if (GetState() != GameState.Live) + return; + + if (event.getType() != UpdateType.TICK) + return; + + long time = _bridgeTime + - (System.currentTimeMillis() - this.GetStateTime()); + + if (time > 0) + GetObjectiveSide().setDisplayName( + ChatColor.WHITE + "§lBridges in " + C.cGreen + "§l" + + UtilTime.MakeStr(time)); + else + GetObjectiveSide().setDisplayName( + ChatColor.WHITE + "§lBridges are down!"); + } + + @EventHandler(priority = EventPriority.LOW) + public void ChestProtect(EntityExplodeEvent event) + { + Iterator blockIterator = event.blockList().iterator(); + + while (blockIterator.hasNext()) + { + Block block = blockIterator.next(); + + if (block.getType() == Material.CHEST + || block.getType() == Material.FURNACE + || block.getType() == Material.BURNING_FURNACE + || block.getType() == Material.WORKBENCH) + blockIterator.remove(); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void BucketEmpty(PlayerBucketEmptyEvent event) + { + if (WaterDamage <= 0) + return; + + if (event.getBucket() == Material.WATER_BUCKET) + { + UtilPlayer.message( + event.getPlayer(), + F.main("Game", "Cannot use " + F.elem("Water Bucket") + " on this map.")); + event.setCancelled(true); + } + } + + public int GetHeightLimit() + { + if (_buildHeight == -1) + { + _buildHeight = 0; + int amount = 0; + + for (GameTeam team : GetTeamList()) + for (Location loc : team.GetSpawns()) + { + _buildHeight += loc.getBlockY(); + amount++; + } + + + _buildHeight = _buildHeight / amount; + } + + return _buildHeight + 24; + } + + @Override + public OreHider GetOreHider() + { + return _ore; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/BridgePart.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/BridgePart.java new file mode 100644 index 000000000..a519e4857 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/BridgePart.java @@ -0,0 +1,84 @@ +package nautilus.game.arcade.game.standalone.bridge; + +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.Item; +import org.bukkit.util.Vector; + +public class BridgePart +{ + public FallingBlock Entity; + public Location Target; + public Location Initial; + + public boolean Velocity; + + public BridgePart(FallingBlock entity, Location target, boolean velocity) + { + Entity = entity; + Target = target; + Initial = entity.getLocation(); + Velocity = velocity; + } + + public boolean Update() + { + if (!Entity.isValid()) + { + MapUtil.QuickChangeBlockAt(Target, Entity.getBlockId(), Entity.getBlockData()); + return true; + } + + //Form + if (UtilMath.offset(Entity.getLocation(), Target) < 1 || Entity.getTicksLived() > 600 || Entity.getLocation().getY() < Target.getY()) + { + MapUtil.QuickChangeBlockAt(Target, Entity.getBlockId(), Entity.getBlockData()); + + Entity.remove(); + + Target.getBlock().getWorld().playEffect(Target, Effect.STEP_SOUND, Target.getBlock().getTypeId()); + + return true; + } + + if (!Velocity) + return false; + + //Perfect Align + if (UtilMath.offset2d(Entity.getLocation(), Target) < 0.1) + { + Location loc = Entity.getLocation(); + loc.setX(Target.getX()); + loc.setZ(Target.getZ()); + } + + + //Velocity + Vector dir = UtilAlg.getTrajectory(Entity.getLocation(), Target); + dir.add(new Vector(0, 0.6, 0)); + dir.normalize(); + dir.multiply(0.8); + + if (UtilMath.offset(Entity.getLocation(), Initial) < UtilMath.offset(Entity.getLocation(), Target)) + dir.add(new Vector(0, 0.6, 0)); + + Entity.setVelocity(dir); + + return false; + } + + public boolean ItemSpawn(Item item) + { + if (UtilMath.offset(Entity, item) < 1) + { + return true; + } + + return false; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitApple.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitApple.java new file mode 100644 index 000000000..a5a78550b --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitApple.java @@ -0,0 +1,39 @@ +package nautilus.game.arcade.game.standalone.bridge.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitApple extends Kit +{ + public KitApple(ArcadeManager manager) + { + super(manager, "Apple", KitAvailability.Free, + + new String[] + { + "Possess the rare skill of finding apples frequently!" + }, + + new Perk[] + { + new PerkApple(manager) + }, + EntityType.ZOMBIE, + new ItemStack(Material.APPLE)); + + } + + @Override + public void GiveItems(Player player) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitArcher.java new file mode 100644 index 000000000..ffd9e6bae --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitArcher.java @@ -0,0 +1,41 @@ +package nautilus.game.arcade.game.standalone.bridge.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitArcher extends Kit +{ + public KitArcher(ArcadeManager manager) + { + super(manager, "Archer", KitAvailability.Blue, + + new String[] + { + "Highly trained with a bow, probably an elf or something..." + }, + + new Perk[] + { + new PerkFletcher(20, 3, true), + new PerkBarrage(5, 250, true), + }, + EntityType.ZOMBIE, + new ItemStack(Material.BOW)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitBeserker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitBeserker.java new file mode 100644 index 000000000..f85e1ea1a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitBeserker.java @@ -0,0 +1,41 @@ +package nautilus.game.arcade.game.standalone.bridge.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitBeserker extends Kit +{ + public KitBeserker(ArcadeManager manager) + { + super(manager, "Beserker", KitAvailability.Free, + + new String[] + { + "Agile warrior trained in the ways axe combat." + }, + + new Perk[] + { + new PerkLeaper("Beserker Leap", 1.2, 1.2, 8000), + new PerkAxeman(), + }, + EntityType.ZOMBIE, + new ItemStack(Material.STONE_AXE)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitBomber.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitBomber.java new file mode 100644 index 000000000..c3bd8464d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitBomber.java @@ -0,0 +1,39 @@ +package nautilus.game.arcade.game.standalone.bridge.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitBomber extends Kit +{ + public KitBomber(ArcadeManager manager) + { + super(manager, "Bomber", KitAvailability.Blue, + + new String[] + { + "Crazy bomb throwing guy." + }, + + new Perk[] + { + new PerkBomber(30, 2) + }, + EntityType.ZOMBIE, + new ItemStack(Material.TNT)); + + } + + @Override + public void GiveItems(Player player) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitMammoth.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitMammoth.java new file mode 100644 index 000000000..b8cb4a97f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitMammoth.java @@ -0,0 +1,41 @@ +package nautilus.game.arcade.game.standalone.bridge.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitMammoth extends Kit +{ + public KitMammoth(ArcadeManager manager) + { + super(manager, "Brawler", KitAvailability.Green, + + new String[] + { + "Giant and muscular, easily smacks others around." + }, + + new Perk[] + { + new PerkMammoth(), + new PerkIronSkin(1) + }, + EntityType.ZOMBIE, + new ItemStack(Material.IRON_SWORD)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitMiner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitMiner.java new file mode 100644 index 000000000..695eba7cd --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/bridge/kits/KitMiner.java @@ -0,0 +1,41 @@ +package nautilus.game.arcade.game.standalone.bridge.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitMiner extends Kit +{ + public KitMiner(ArcadeManager manager) + { + super(manager, "Miner", KitAvailability.Green, + + new String[] + { + "Master of ore prospecting and digging quickly." + }, + + new Perk[] + { + new PerkOreFinder(), + new PerkDigger(), + }, + EntityType.ZOMBIE, + new ItemStack(Material.STONE_PICKAXE)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/CastleSiege.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/CastleSiege.java new file mode 100644 index 000000000..4b0ac2f09 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/CastleSiege.java @@ -0,0 +1,622 @@ +package nautilus.game.arcade.game.standalone.castlesiege; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.FireworkEffect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftCreature; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.Player; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.ExplosionPrimeEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.AsymTeamGame; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.standalone.castlesiege.kits.*; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.NullKit; +import net.minecraft.server.v1_6_R2.EntityCreature; +import net.minecraft.server.v1_6_R2.Navigation; + +public class CastleSiege extends AsymTeamGame +{ + private long _tntSpawn = 0; + private ArrayList _tntSpawns = new ArrayList(); + private ArrayList _tntWeakness = new ArrayList(); + private HashMap _tntCarry = new HashMap(); + + private ArrayList _kingLocs; + private Creature _king; + private Location _kingLoc; + private String _kingName; + private Player _kingDamager = null; + + private ArrayList _peasantSpawns; + + public CastleSiege(ArcadeManager manager, HashMap pastTeams) + { + super(manager, GameType.CastleSiege, + + new Kit[] + { + + new KitHumanKnight(manager), + new KitHumanMarksman(manager), + new KitHumanElementalist(manager), + new KitHumanPeasant(manager), + new NullKit(manager), + new KitUndeadGhoul(manager), + new KitUndeadZombie(manager), + new KitUndeadArcher(manager), + }, + + new String[] + { + F.elem(C.cAqua + "Defenders") + C.cWhite + " must defend the King.", + F.elem(C.cAqua + "Defenders") + C.cWhite + " win when the sun rises.", + F.elem(C.cAqua + "Defenders") + C.cWhite + " respawn as peasants.", + "", + F.elem(C.cRed + "Undead") + C.cWhite + " must kill the King.", + F.elem(C.cRed + "Undead") + C.cWhite + " lose when the sun rises.", + + }, pastTeams); + + this.HungerSet = 20; + this.DeathOut = false; + this.DeathDropItems = false; + this.WorldTimeSet = 14000; //14000 + this.BlockPlaceAllow.add(85); + + _kingName = C.cYellow + C.Bold + "King Jonalon"; + + } + + @Override + public void ParseData() + { + _tntSpawns = WorldData.GetDataLocs("RED"); + _tntWeakness = WorldData.GetDataLocs("BLACK"); + + _kingLocs = WorldData.GetDataLocs("YELLOW"); + + _peasantSpawns = WorldData.GetDataLocs("GREEN"); + } + + @Override + public void RestrictKits() + { + for (Kit kit : GetKits()) + { + for (GameTeam team : GetTeamList()) + { + if (team.GetColor() == ChatColor.RED) + { + if (kit.GetName().contains("Castle")) + team.GetRestrictedKits().add(kit); + } + else + { + if (kit.GetName().contains("Undead")) + team.GetRestrictedKits().add(kit); + } + } + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void GameStateChange(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + return; + + //Spawn King + this.CreatureAllowOverride = true; + + _kingLoc = _kingLocs.get(UtilMath.r(_kingLocs.size())); + + _king = (Creature) _kingLoc.getWorld().spawnEntity(_kingLoc, EntityType.ZOMBIE); + + _king.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); + _king.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); + _king.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); + _king.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); + + _king.setCustomName(_kingName); + _king.setCustomNameVisible(true); + + _king.setRemoveWhenFarAway(false); + + this.CreatureAllowOverride = false; + + //Change to Peasant Spawns + this.GetTeam(ChatColor.AQUA).SetSpawns(_peasantSpawns); + } + + @EventHandler + public void KingTarget(EntityTargetEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void KingDamage(CustomDamageEvent event) + { + if (_king == null || !_king.isValid()) + return; + + if (!event.GetDamageeEntity().equals(_king)) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + GameTeam team = GetTeam(damager); + + if (team == null || team.GetColor() != ChatColor.RED) + { + event.SetCancelled("King Damage"); + return; + } + else + { + _kingDamager = damager; + } + } + + @EventHandler + public void KingUpdate(UpdateEvent event) + { + if (GetState() != GameState.Live) + return; + + if (event.getType() != UpdateType.SEC) + return; + + if (_king == null) + return; + + if (UtilMath.offset(_king.getLocation(), _kingLoc) > 6) + { + _king.teleport(_kingLoc); + } + else + { + EntityCreature ec = ((CraftCreature)_king).getHandle(); + Navigation nav = ec.getNavigation(); + nav.a(_kingLoc.getX(), _kingLoc.getY(), _kingLoc.getZ(), 0.8f); + } + } + + @EventHandler + public void PlayerDeath(PlayerDeathEvent event) + { + if (GetTeam(ChatColor.AQUA).HasPlayer(event.getEntity())) + SetKit(event.getEntity(), GetKits()[3], true); + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + //King + if (_king != null && _king.isValid()) + { + GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(C.cYellow + C.Bold + "Kings Health")).setScore((int) _king.getHealth()); + } + + //Teams + HashMap _scoreGroup = new HashMap(); + _scoreGroup.put(C.cAqua + "Peasants", 0); + _scoreGroup.put(C.cAqua + "Defenders", 0); + _scoreGroup.put(C.cRed + "Undead", 0); + + for (Player player : UtilServer.getPlayers()) + { + if (!IsAlive(player)) + continue; + + Kit kit = GetKit(player); + if (kit == null) continue; + + if (kit.GetName().contains("Castle")) + { + if (kit.GetName().contains("Peasant")) + { + _scoreGroup.put(C.cAqua + "Peasants", 1 + _scoreGroup.get(C.cAqua + "Peasants")); + } + else + { + _scoreGroup.put(C.cAqua + "Defenders", 1 + _scoreGroup.get(C.cAqua + "Defenders")); + } + } + else if (kit.GetName().contains("Undead")) + { + _scoreGroup.put(C.cRed + "Undead", 1 + _scoreGroup.get(C.cRed + "Undead")); + } + } + + for (String group : _scoreGroup.keySet()) + { + GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(group)).setScore(_scoreGroup.get(group)); + } + } + + @Override + public void EndCheck() + { + if (!IsLive()) + return; + + if (this.WorldTimeSet > 24100) + { + SetCustomWinLine(_kingName + ChatColor.RESET + " has survived the seige!"); + + SetState(GameState.End); + AnnounceEnd(GetTeam(ChatColor.AQUA)); + + for (GameTeam team : GetTeamList()) + { + if (WinnerTeam != null && team.equals(WinnerTeam)) + { + for (Player player : team.GetPlayers(false)) + { + AddGems(player, 10, "Winning Team", false); + } + } + + for (Player player : team.GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false); + } + } + + if (!_king.isValid()) + { + if (_kingDamager != null) + { + SetCustomWinLine(C.cRed + _kingDamager.getName() + C.cWhite + " slaughtered " + _kingName + ChatColor.RESET + "!"); + AddGems(_kingDamager, 20, "King Slayer", false); + } + else + SetCustomWinLine(_kingName + ChatColor.RESET + " has died!"); + + SetState(GameState.End); + AnnounceEnd(GetTeam(ChatColor.RED)); + + for (GameTeam team : GetTeamList()) + { + if (WinnerTeam != null && team.equals(WinnerTeam)) + { + for (Player player : team.GetPlayers(false)) + { + AddGems(player, 10, "Winning Team", false); + } + } + + for (Player player : team.GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false); + } + } + } + + @EventHandler + public void TNTSpawn(UpdateEvent event) + { + if (GetState() != GameState.Live) + return; + + if (event.getType() != UpdateType.SEC) + return; + + if (!UtilTime.elapsed(_tntSpawn, 40000)) + return; + + if (_tntSpawns.isEmpty()) + return; + + Location loc = _tntSpawns.get(UtilMath.r(_tntSpawns.size())); + + if (loc.getBlock().getTypeId() == 46) + return; + + loc.getBlock().setTypeId(46); + _tntSpawn = System.currentTimeMillis(); + } + + @EventHandler(priority = EventPriority.LOW) + public void TNTPickup(PlayerInteractEvent event) + { + if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.LEFT_CLICK_BLOCK) + return; + + if (event.getClickedBlock().getTypeId() != 46) + return; + + event.setCancelled(true); + + Player player = event.getPlayer(); + + if (!IsAlive(player)) + return; + + if (!GetTeam(ChatColor.RED).HasPlayer(player)) + return; + + if (_tntCarry.containsKey(player)) + return; + + event.getClickedBlock().setTypeId(0); + + FallingBlock tnt = player.getWorld().spawnFallingBlock(player.getEyeLocation(), 46, (byte)0); + + player.eject(); + player.setPassenger(tnt); + + _tntCarry.put(player, tnt); + + UtilPlayer.message(player, F.main("Game", "You picked up " + F.skill("TNT") + ".")); + UtilPlayer.message(player, F.main("Game", F.elem("Right-Click") + " to detonate yourself.")); + } + + @EventHandler(priority = EventPriority.NORMAL) + public void TNTUse(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_AIR) + return; + + Player player = event.getPlayer(); + + if (!_tntCarry.containsKey(player)) + return; + + event.setCancelled(true); + + for (Location loc : _tntSpawns) + { + if (UtilMath.offset(player.getLocation(), loc) < 16) + { + UtilPlayer.message(player, F.main("Game", "You cannot " + F.skill("Detonate") + " so far from the Castle.")); + return; + } + } + + _tntCarry.remove(player).remove(); + + TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class); + tnt.setFuseTicks(0); + UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Detonate") + ".")); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void TNTDeath(PlayerDeathEvent event) + { + Player player = event.getEntity(); + + if (!_tntCarry.containsKey(player)) + return; + + _tntCarry.remove(player).remove(); + + TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class); + tnt.setFuseTicks(0); + UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Detonate") + ".")); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void TNTDamageDivert(ProjectileHitEvent event) + { + for (Player player : _tntCarry.keySet()) + { + if (player.getPassenger() == null) + continue; + + double dist = UtilMath.offset(player.getPassenger().getLocation(), event.getEntity().getLocation().add(event.getEntity().getVelocity())); + + if (dist < 2) + { + int damage = (int) (9 * (event.getEntity().getVelocity().length() / 3d)); + + //Damage Event + Manager.GetDamage().NewDamageEvent(player, event.getEntity().getShooter(), event.getEntity(), + DamageCause.CUSTOM, damage, true, false, false, + null, GetName()); + + event.getEntity().remove(); + } + } + } + + + @EventHandler + public void TNTExpire(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + Iterator tntIterator = _tntCarry.keySet().iterator(); + + while (tntIterator.hasNext()) + { + Player player = tntIterator.next(); + FallingBlock block = _tntCarry.get(player); + + if (player.isDead() || !block.isValid() || block.getTicksLived() > 600) + { + player.eject(); + block.remove(); + + TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class); + tnt.setFuseTicks(0); + + tntIterator.remove(); + continue; + } + + FireworkEffect effect = FireworkEffect.builder().withColor(Color.RED).with(Type.BURST).build(); + + try + { + Manager.GetFirework().playFirework(player.getEyeLocation(), effect); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + + @EventHandler + public void TNTWeakness(ExplosionPrimeEvent event) + { + Location weakness = null; + for (Location loc : _tntWeakness) + { + if (UtilMath.offset(loc, event.getEntity().getLocation()) < 4) + { + weakness = loc; + break; + } + } + + if (weakness == null) + return; + + _tntWeakness.remove(weakness); + + final Location extra = weakness; + + for (int i=0 ; i<10 ; i++) + { + Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() + { + public void run() + { + TNTPrimed tnt = extra.getWorld().spawn(extra.clone().add(3 - UtilMath.r(6), 5 + UtilMath.r(2), 3 - UtilMath.r(6)), TNTPrimed.class); + tnt.setFuseTicks(0); + tnt.setIsIncendiary(true); + } + }, i*3); + } + + weakness.getWorld().playSound(weakness, Sound.EXPLODE, 16f, 0.8f); + } + + @EventHandler(priority = EventPriority.HIGH) + public void AttackerBlockBreak(org.bukkit.event.block.BlockBreakEvent event) + { + GameTeam team = GetTeam(event.getPlayer()); + if (team == null) + return; + + if (team.GetColor() != ChatColor.RED) + return; + + if (event.getBlock().getTypeId() == 85) + event.setCancelled(false); + } + + @EventHandler + public void DefenderBlockPlace(org.bukkit.event.block.BlockPlaceEvent event) + { + GameTeam team = GetTeam(event.getPlayer()); + if (team == null) + return; + + if (team.GetColor() != ChatColor.AQUA) + return; + + if (event.getBlock().getTypeId() != 85) + return; + + for (Block block : UtilBlock.getSurrounding(event.getBlock())) + { + if (block.isLiquid()) + { + event.setCancelled(true); + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Barricade") + " in water.")); + } + } + + if (event.getBlockAgainst().getTypeId() == 85) + { + event.setCancelled(true); + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Barricade") + " on each other.")); + } + + if (_king != null && UtilMath.offset(_king.getLocation(), event.getBlock().getLocation().add(0.5, 0.5, 0.5)) < 4) + { + event.setCancelled(true); + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Barricade") + " near " + F.elem(C.cAqua + _kingName) + ".")); + } + } + + @EventHandler + public void DayTimer(UpdateEvent event) + { + if (GetState() != GameState.Live) + return; + + if (event.getType() != UpdateType.TICK) + return; + + WorldTimeSet = (WorldTimeSet+1); + + long timeLeft = 24000 - WorldTimeSet; + timeLeft = timeLeft / 20 * 1000; + + + if (timeLeft > 0) + GetObjectiveSide().setDisplayName( + ChatColor.WHITE + "§lSun Rise: " + C.cGreen + "§l" + + UtilTime.MakeStr(timeLeft)); + else + { + GetObjectiveSide().setDisplayName( + ChatColor.WHITE + "§lSun has risen!"); + + for (Player player : GetTeam(ChatColor.RED).GetPlayers(true)) + Manager.GetCondition().Factory().Ignite("Sun Damage", player, player, 5, false, false); + } + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanElementalist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanElementalist.java new file mode 100644 index 000000000..65e2dea0c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanElementalist.java @@ -0,0 +1,79 @@ +package nautilus.game.arcade.game.standalone.castlesiege.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkFlamingSword; + +public class KitHumanElementalist extends Kit +{ + public KitHumanElementalist(ArcadeManager manager) + { + super(manager, "Castle Elementalist", KitAvailability.Blue, + + new String[] + { + "Possesses a magical sword, able to incinerate enemies." + }, + + new Perk[] + { + new PerkFlamingSword() + }, + + EntityType.ZOMBIE, new ItemStack(Material.GOLD_SWORD)); + + } + + @EventHandler + public void FireItemResist(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (Manager.GetGame() == null) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!HasKit(player)) + continue; + + Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false); + } + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.GOLD_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.GOLD_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.GOLD_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS)); + } + + @Override + public void SpawnCustom(Creature ent) + { + ent.getEquipment().setHelmet(new ItemStack(Material.GOLD_HELMET)); + ent.getEquipment().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE)); + ent.getEquipment().setLeggings(new ItemStack(Material.GOLD_LEGGINGS)); + ent.getEquipment().setBoots(new ItemStack(Material.GOLD_BOOTS)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanKnight.java new file mode 100644 index 000000000..1a93f48fb --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanKnight.java @@ -0,0 +1,86 @@ +package nautilus.game.arcade.game.standalone.castlesiege.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitHumanKnight extends Kit +{ + public KitHumanKnight(ArcadeManager manager) + { + super(manager, "Castle Knight", KitAvailability.Free, + + new String[] + { + "Robust knight, also able to construct defenses." + }, + + new Perk[] + { + new PerkMammoth(), + new PerkConstructor("Constructor", 60, 2, Material.FENCE, "Castle Barricade", true) + }, + + EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); + + } + + @EventHandler + public void FireItemResist(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (Manager.GetGame() == null) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!HasKit(player)) + continue; + + Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false); + } + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, 64)); + + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.FENCE, (byte)0, 2, F.item("Castle Barricade"))); + + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + + + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS)); + } + + @Override + public void SpawnCustom(Creature ent) + { + ent.getEquipment().setHelmet(new ItemStack(Material.IRON_HELMET)); + ent.getEquipment().setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); + ent.getEquipment().setLeggings(new ItemStack(Material.IRON_LEGGINGS)); + ent.getEquipment().setBoots(new ItemStack(Material.IRON_BOOTS)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanMarksman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanMarksman.java new file mode 100644 index 000000000..3f81ee2c4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanMarksman.java @@ -0,0 +1,81 @@ +package nautilus.game.arcade.game.standalone.castlesiege.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkBarrage; +import nautilus.game.arcade.kit.perks.PerkFletcher; + +public class KitHumanMarksman extends Kit +{ + public KitHumanMarksman(ArcadeManager manager) + { + super(manager, "Castle Marksman", KitAvailability.Green, + new String[] + { + "Skilled human marksman, can fletch arrows." + }, + new Perk[] + { + new PerkBarrage(5, 250, true), + new PerkFletcher(2, 4, false), + }, + EntityType.ZOMBIE, + new ItemStack(Material.BOW)); + + } + + @EventHandler + public void FireItemResist(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (Manager.GetGame() == null) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!HasKit(player)) + continue; + + Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false); + } + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, 32)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + } + + @Override + public void SpawnCustom(Creature ent) + { + ent.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); + ent.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE)); + ent.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS)); + ent.getEquipment().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanPeasant.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanPeasant.java new file mode 100644 index 000000000..837e57536 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitHumanPeasant.java @@ -0,0 +1,68 @@ +package nautilus.game.arcade.game.standalone.castlesiege.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkStrength; + +public class KitHumanPeasant extends Kit +{ + public KitHumanPeasant(ArcadeManager manager) + { + super(manager, "Castle Peasant", KitAvailability.Hide, + + new String[] + { + "Old and not suited for combat..." + }, + + new Perk[] + { + new PerkStrength(2) + }, + + EntityType.ZOMBIE, new ItemStack(Material.IRON_HOE)); + + } + + @EventHandler + public void FireItemResist(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (Manager.GetGame() == null) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!HasKit(player)) + continue; + + Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false); + } + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_HOE)); + } + + @Override + public void SpawnCustom(Creature ent) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadArcher.java new file mode 100644 index 000000000..32df833ba --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadArcher.java @@ -0,0 +1,47 @@ +package nautilus.game.arcade.game.standalone.castlesiege.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkIronSkin; + +public class KitUndeadArcher extends Kit +{ + public KitUndeadArcher(ArcadeManager manager) + { + super(manager, "Undead Archer", KitAvailability.Blue, + + new String[] + { + "Makes use of arrows scavenged from human archers." + }, + + new Perk[] + { + new PerkIronSkin(1) + }, + EntityType.SKELETON, + new ItemStack(Material.BOW)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + + DisguiseSkeleton disguise = new DisguiseSkeleton(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadGhoul.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadGhoul.java new file mode 100644 index 000000000..5612bd79e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadGhoul.java @@ -0,0 +1,57 @@ +package nautilus.game.arcade.game.standalone.castlesiege.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.disguise.disguises.DisguisePigZombie; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitUndeadGhoul extends Kit +{ + public KitUndeadGhoul(ArcadeManager manager) + { + super(manager, "Undead Ghoul", KitAvailability.Free, + + new String[] + { + "Weak, but able to jump around with ease." + }, + + new Perk[] + { + new PerkLeaper("Ghoul Attack", 1.2, 0.8, 8000) + }, + EntityType.PIG_ZOMBIE, + new ItemStack(Material.STONE_AXE)); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); + + DisguisePigZombie disguise = new DisguisePigZombie(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } + + @EventHandler + public void PickupArrow(PlayerPickupItemEvent event) + { + if (!HasKit(event.getPlayer())) + return; + + if (event.getItem().getItemStack().getType() == Material.ARROW) + event.setCancelled(true); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadZombie.java new file mode 100644 index 000000000..08395244f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/castlesiege/kits/KitUndeadZombie.java @@ -0,0 +1,58 @@ +package nautilus.game.arcade.game.standalone.castlesiege.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.disguise.disguises.DisguiseZombie; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitUndeadZombie extends Kit +{ + public KitUndeadZombie(ArcadeManager manager) + { + super(manager, "Undead Zombie", KitAvailability.Green, + + new String[] + { + "Regenerates over time" + }, + + new Perk[] + { + new PerkRegeneration(1) + }, + EntityType.ZOMBIE, + new ItemStack(Material.STONE_AXE)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); + + DisguiseZombie disguise = new DisguiseZombie(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } + + @EventHandler + public void PickupArrow(PlayerPickupItemEvent event) + { + if (!HasKit(event.getPlayer())) + return; + + if (event.getItem().getItemStack().getType() == Material.ARROW) + event.setCancelled(true); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/SuperSmash.java new file mode 100644 index 000000000..9931a1a1e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/SuperSmash.java @@ -0,0 +1,142 @@ +package nautilus.game.arcade.game.standalone.smash; + +import java.util.ArrayList; +import java.util.HashMap; + +import org.bukkit.Bukkit; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerDeathOutEvent; +import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.standalone.smash.kits.*; +import nautilus.game.arcade.kit.Kit; + +public class SuperSmash extends SoloGame +{ + private HashMap _lives = new HashMap(); + + private ArrayList _lastScoreboard = new ArrayList(); + + public SuperSmash(ArcadeManager manager) + { + super(manager, GameType.Smash, + + new Kit[] + { + new KitSkeleton(manager), + new KitEnderman(manager), + }, + + new String[] + { + "Each player has 3 lives", + "Last player alive wins!" + + }); + + this.DeathDropItems = false; + + this.DamageTeamSelf = true; + + this.HungerSet = 20; + + this.PrepareFreeze = false; + } + + @EventHandler(priority = EventPriority.HIGH) + public void GameStateChange(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + return; + + for (Player player : GetPlayers(true)) + _lives.put(player, 3); + } + + @EventHandler + public void PlayerOut(PlayerDeathOutEvent event) + { + if (LoseLife(event.GetPlayer())) + event.setCancelled(true); + } + + private int GetLives(Player player) + { + if (!_lives.containsKey(player)) + return 0; + + if (!IsAlive(player)) + return 0; + + return _lives.get(player); + } + + private boolean LoseLife(Player player) + { + int lives = GetLives(player) - 1; + + if (lives > 0) + { + UtilPlayer.message(player, C.cRed + C.Bold + "You have died!"); + UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " lives left!"); + player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f); + + _lives.put(player, lives); + + return true; + } + else + { + UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!"); + player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f); + + return false; + } + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + //Wipe Last + for (String string : _lastScoreboard) + { + GetScoreboard().resetScores(Bukkit.getOfflinePlayer(string)); + } + _lastScoreboard.clear(); + + //Write New + for (Player player : GetPlayers(true)) + { + int lives = GetLives(player); + + String out; + if (lives == 3) out = lives + " " + C.cGreen + player.getName(); + else if (lives == 2) out = lives + " " + C.cYellow + player.getName(); + else if (lives == 1) out = lives + " " + C.cGold + player.getName(); + else if (lives == 0) out = lives + " " + C.cRed + player.getName(); + else + continue; + + if (out.length() >= 16) + out = out.substring(0, 15); + + _lastScoreboard.add(out); + + GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(lives); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitEnderman.java new file mode 100644 index 000000000..6e211e390 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitEnderman.java @@ -0,0 +1,54 @@ +package nautilus.game.arcade.game.standalone.smash.kits; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkBlink; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; + +public class KitEnderman extends Kit +{ + public KitEnderman(ArcadeManager manager) + { + super(manager, "Enderman", KitAvailability.Free, + + new String[] + { + "" + }, + + new Perk[] + { + new PerkDoubleJump("Double Jump", 0.8, 0.8, false), + new PerkBlink("Blink", 12, 4000) + }, + EntityType.ENDERMAN, + null); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + + UtilPlayer.message(player, C.Line); + UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); + UtilPlayer.message(player, F.elem("Right-Click with Axe") + " to use " + F.elem("Blink")); + UtilPlayer.message(player, C.Line); + + player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_IDLE, 4f, 1f); + + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSkeleton.java new file mode 100644 index 000000000..f535be2ad --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSkeleton.java @@ -0,0 +1,53 @@ +package nautilus.game.arcade.game.standalone.smash.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkBarrage; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkFletcher; +import nautilus.game.arcade.kit.perks.PerkLeaper; + +public class KitSkeleton extends Kit +{ + public KitSkeleton(ArcadeManager manager) + { + super(manager, "Skeletal Archer", KitAvailability.Free, + + new String[] + { + "Animated dead, specialising in escape and archery." + }, + + new Perk[] + { + new PerkDoubleJump("Double Jump", 0.8, 0.8, false), + new PerkLeaper("Leap", 1, 1, 3000), + new PerkFletcher(3, 2, false), + new PerkBarrage(5, 250, true) + }, + EntityType.SKELETON, + new ItemStack(Material.BOW)); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + + //Disguise + DisguiseSkeleton disguise = new DisguiseSkeleton(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSlime.java new file mode 100644 index 000000000..c9f6730c6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSlime.java @@ -0,0 +1,52 @@ +package nautilus.game.arcade.game.standalone.smash.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.disguise.disguises.DisguiseSlime; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkFallDamage; +import nautilus.game.arcade.kit.perks.PerkLeaper; + +public class KitSlime extends Kit +{ + public KitSlime(ArcadeManager manager) + { + super(manager, "Slime", KitAvailability.Hide, + + new String[] + { + "Bouncey and g" + }, + + new Perk[] + { + new PerkLeaper("Bounce", 2, 2, 8000), + new PerkFallDamage(-20), + new PerkDoubleJump("Double Jump", 1, 1, false) + }, + EntityType.SLIME, + null); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + + //Disguise + DisguiseSlime disguise = new DisguiseSlime(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + disguise.SetSize(3); + Manager.GetDisguise().Disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/ZombieData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/ZombieData.java new file mode 100644 index 000000000..692254020 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/ZombieData.java @@ -0,0 +1,20 @@ +package nautilus.game.arcade.game.standalone.zombiesurvival; + +import org.bukkit.Location; + +public class ZombieData +{ + public Location Target; + public long Time; + + public ZombieData(Location target) + { + SetTarget(target); + } + + public void SetTarget(Location target) + { + Target = target; + Time = System.currentTimeMillis(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/ZombieSurvival.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/ZombieSurvival.java new file mode 100644 index 000000000..ca2c8268c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/ZombieSurvival.java @@ -0,0 +1,388 @@ +package nautilus.game.arcade.game.standalone.zombiesurvival; + +import java.util.HashMap; +import java.util.Iterator; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftCreature; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Player; +import org.bukkit.entity.Zombie; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.PlayerDeathEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.standalone.zombiesurvival.kits.*; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.NullKit; +import net.minecraft.server.v1_6_R2.EntityCreature; +import net.minecraft.server.v1_6_R2.Navigation; + +public class ZombieSurvival extends SoloGame +{ + private GameTeam _survivors; + private GameTeam _undead; + + private HashMap _mobs = new HashMap(); + + public ZombieSurvival(ArcadeManager manager) + { + super(manager, GameType.ZombieSurvival, + + new Kit[] + { + new KitSurvivorKnight(manager), + new KitSurvivorRogue(manager), + new KitSurvivorArcher(manager), + new NullKit(manager), + new KitUndeadAlpha(manager), + new KitUndeadZombie(manager), + }, + + new String[] + { + "The Undead are attacking!", + "Run, fight or hide to survive!", + "When you die, you become Undead", + "The last Survivor alive wins!" + }); + + this.DeathOut = false; + this.DeathDropItems = false; + this.HungerSet = 20; + } + + @Override + public void ParseData() + { + if (!WorldData.GetDataLocs("WHITE").isEmpty()) + WorldHeightLimit = WorldData.GetDataLocs("WHITE").get(0).getBlockY(); + } + + @Override + public void RestrictKits() + { + for (Kit kit : GetKits()) + { + for (GameTeam team : GetTeamList()) + { + if (team.GetColor() == ChatColor.RED) + { + if (kit.GetName().contains("Survivor")) + team.GetRestrictedKits().add(kit); + } + else + { + if (kit.GetName().contains("Undead")) + team.GetRestrictedKits().add(kit); + } + } + } + } + + @Override + @EventHandler + public void CustomTeamGeneration(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Recruit) + return; + + _survivors = this.GetTeamList().get(0); + _survivors.SetName("Survivors"); + + //Undead Team + _undead = new GameTeam("Undead", ChatColor.RED, WorldData.GetDataLocs("RED")); + GetTeamList().add(_undead); + + RestrictKits(); + } + + @Override + public GameTeam ChooseTeam(Player player) + { + return _survivors; + } + + @EventHandler + public void UpdateChasers(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.FAST) + return; + + int req = 1 + _survivors.GetPlayers(true).size()/20; + + while (_undead.GetPlayers(true).size() < req && _survivors.GetPlayers(true).size() > 0) + { + Player player = _survivors.GetPlayers(true).get(UtilMath.r(_survivors.GetPlayers(true).size())); + SetChaser(player, true); + } + } + + @EventHandler + public void PlayerDeath(PlayerDeathEvent event) + { + if (_survivors.HasPlayer(event.getEntity())) + SetChaser(event.getEntity(), false); + } + + public void SetChaser(Player player, boolean forced) + { + if (!GetPlaces().contains(player)) + GetPlaces().add(0, player); + + SetPlayerTeam(player, _undead); + + //Kit + Kit newKit = this.GetKits()[4]; + if (forced) + newKit = this.GetKits()[5]; + SetKit(player, newKit, true); + newKit.ApplyKit(player); + + //Refresh + for (Player other : UtilServer.getPlayers()) + { + other.hidePlayer(player); + other.showPlayer(player); + } + + if (forced) + { + player.eject(); + player.teleport(_undead.GetSpawn()); + + AddGems(player, 10, "Forced Undead", false); + + Announce(F.main("Game", F.elem(_survivors.GetColor() + player.getName()) + " has become an " + + F.elem(_undead.GetColor() + "Alpha Zombie") + ".")); + + player.getWorld().strikeLightningEffect(player.getLocation()); + } + + UtilPlayer.message(player, C.cRed + C.Bold + "You have been Zombified! Braaaaaiiiinnnssss!"); + } + + @Override + public void RespawnPlayer(final Player player) + { + Manager.Clear(player); + + if (_undead.HasPlayer(player)) + { + player.eject(); + player.teleport(_undead.GetSpawn()); + } + + //Re-Give Kit + Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() + { + public void run() + { + GetKit(player).ApplyKit(player); + + //Refresh on Spawn + for (Player other : UtilServer.getPlayers()) + { + other.hidePlayer(player); + other.showPlayer(player); + } + } + }, 0); + } + + @EventHandler + public void UndeadUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if (!InProgress()) + return; + + Iterator mobIterator = _mobs.keySet().iterator(); + + while (mobIterator.hasNext()) + { + Creature mob = mobIterator.next(); + + if (!mob.isValid()) + { + mob.remove(); + mobIterator.remove(); + } + } + + if (_mobs.size() < 50) + { + this.CreatureAllowOverride = true; + Zombie zombie = _undead.GetSpawn().getWorld().spawn(_undead.GetSpawn(), Zombie.class); + _mobs.put(zombie, new ZombieData(GetTargetLocation())); + this.CreatureAllowOverride = false; + } + + mobIterator = _mobs.keySet().iterator(); + while (mobIterator.hasNext()) + { + Creature mob = mobIterator.next(); + Manager.GetCondition().Factory().Speed("Zombie Speed", mob, mob, 1.9, 1, false, false, true); + + ZombieData data = _mobs.get(mob); + + //New Target via Distance + if (UtilMath.offset(mob.getLocation(), data.Target) < 10 || + UtilMath.offset2d(mob.getLocation(), data.Target) < 6 || + UtilTime.elapsed(data.Time, 30000)) + { + data.SetTarget(GetTargetLocation()); + continue; + } + + //Untarget + if (mob.getTarget() != null) + { + if (UtilMath.offset2d(mob, mob.getTarget()) > 10) + { + mob.setTarget(null); + } + else + { + if (mob.getTarget() instanceof Player) + if (_undead.HasPlayer((Player)mob.getTarget())) + mob.setTarget(null); + } + } + //Move + else + { + //Move + EntityCreature ec = ((CraftCreature)mob).getHandle(); + Navigation nav = ec.getNavigation(); + + if (UtilMath.offset(mob.getLocation(), data.Target) > 20) + { + Location target = mob.getLocation(); + + target.add(UtilAlg.getTrajectory(mob.getLocation(), data.Target).multiply(20)); + + nav.a(target.getX(), target.getY(), target.getZ(), 1.2f); + } + else + { + nav.a(data.Target.getX(), data.Target.getY(), data.Target.getZ(), 1.2f); + } + + } + } + } + + public Location GetTargetLocation() + { + if (_survivors.GetPlayers(true).size() == 0) + { + return _survivors.GetSpawn(); + } + else + { + return _survivors.GetPlayers(true).get(UtilMath.r(_survivors.GetPlayers(true).size())).getLocation(); + } + } + + @EventHandler + public void UndeadTarget(EntityTargetEvent event) + { + if (event.getTarget() instanceof Player) + if (_undead.HasPlayer((Player)event.getTarget())) + event.setCancelled(true); + } + + @EventHandler + public void UndeadCombust(EntityCombustEvent event) + { + event.setCancelled(true); + } + + @Override + public void EndCheck() + { + if (!IsLive()) + return; + + if (_survivors.GetPlayers(true).size() <= 1) + { + if (_survivors.GetPlayers(true).size() == 1) + GetPlaces().add(0, GetPlayers(true).get(0)); + + if (GetPlaces().size() >= 1) + AddGems(GetPlaces().get(0), 15, "1st Place", false); + + if (GetPlaces().size() >= 2) + AddGems(GetPlaces().get(1), 10, "2nd Place", false); + + if (GetPlaces().size() >= 3) + AddGems(GetPlaces().get(2), 5, "3rd Place", false); + /* + int sections = GetPlaces().size()/10; + + for (int i=0 ; i<5 ; i++) + { + for (int j=i*sections ; j < j*sections + sections ; j++) + { + AddGems(GetPlaces().get(j), 5-i, "Top " + ((i+1)*10) + "%", false); + } + } + */ + + for (Player player : GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false); + + SetState(GameState.End); + AnnounceEnd(GetPlaces()); + } + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_survivors == null || _undead == null) + return; + + GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(_survivors.GetColor() + _survivors.GetName())).setScore(_survivors.GetPlayers(true).size()); + GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(_undead.GetColor() + _undead.GetName())).setScore(_undead.GetPlayers(true).size()); + } + + @Override + public boolean CanJoinTeam(GameTeam team) + { + if (team.GetColor() == ChatColor.RED) + { + return team.GetSize() < 1 + UtilServer.getPlayers().length/25; + } + + return true; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorArcher.java new file mode 100644 index 000000000..783b058b4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorArcher.java @@ -0,0 +1,56 @@ +package nautilus.game.arcade.game.standalone.zombiesurvival.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitSurvivorArcher extends Kit +{ + public KitSurvivorArcher(ArcadeManager manager) + { + super(manager, "Survivor Archer", KitAvailability.Blue, + + new String[] + { + "Survive with the help of your trusty bow!" + }, + + new Perk[] + { + new PerkFletcher(2, 8, true), + new PerkBarrage(5, 250, true) + }, + EntityType.SKELETON, + new ItemStack(Material.BOW)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + } + + @Override + public void SpawnCustom(Creature ent) + { + ent.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); + ent.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE)); + ent.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS)); + ent.getEquipment().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorKnight.java new file mode 100644 index 000000000..ebacf5b4a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorKnight.java @@ -0,0 +1,55 @@ +package nautilus.game.arcade.game.standalone.zombiesurvival.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitSurvivorKnight extends Kit +{ + public KitSurvivorKnight(ArcadeManager manager) + { + super(manager, "Survivor Knight", KitAvailability.Free, + + new String[] + { + "Smash and kill through Zombies" + }, + + new Perk[] + { + new PerkIronSkin(1), + new PerkMammoth() + }, + EntityType.ZOMBIE, + new ItemStack(Material.IRON_SWORD)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS)); + } + + @Override + public void SpawnCustom(Creature ent) + { + ent.getEquipment().setHelmet(new ItemStack(Material.IRON_HELMET)); + ent.getEquipment().setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); + ent.getEquipment().setLeggings(new ItemStack(Material.IRON_LEGGINGS)); + ent.getEquipment().setBoots(new ItemStack(Material.IRON_BOOTS)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorRogue.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorRogue.java new file mode 100644 index 000000000..a73dc273f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitSurvivorRogue.java @@ -0,0 +1,55 @@ +package nautilus.game.arcade.game.standalone.zombiesurvival.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitSurvivorRogue extends Kit +{ + public KitSurvivorRogue(ArcadeManager manager) + { + super(manager, "Survivor Rogue", KitAvailability.Green, + + new String[] + { + "You are weaker in combat, but very agile." + }, + + new Perk[] + { + new PerkLeaper("Leap", 1, 1, 8000), + new PerkSpeed(0) + }, + EntityType.ZOMBIE, + new ItemStack(Material.IRON_AXE)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS)); + } + + @Override + public void SpawnCustom(Creature ent) + { + ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); + ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); + ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); + ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitUndeadAlpha.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitUndeadAlpha.java new file mode 100644 index 000000000..905c31e8d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitUndeadAlpha.java @@ -0,0 +1,63 @@ +package nautilus.game.arcade.game.standalone.zombiesurvival.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.entity.Skeleton.SkeletonType; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitUndeadAlpha extends Kit +{ + public KitUndeadAlpha(ArcadeManager manager) + { + super(manager, "Alpha Undead", KitAvailability.Free, + + new String[] + { + "Leap at those undead" + }, + + new Perk[] + { + new PerkLeaper("Leap", 1, 1, 8000), + new PerkStrength(2), + new PerkIronSkin(2), + new PerkRegeneration(1) + }, + EntityType.SKELETON, + new ItemStack(Material.STONE_AXE)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); + + DisguiseSkeleton disguise = new DisguiseSkeleton(player); + disguise.SetSkeletonType(SkeletonType.WITHER); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } + + @Override + public void SpawnCustom(Creature ent) + { + if (ent instanceof Skeleton) + { + Skeleton skel = (Skeleton)ent; + skel.setSkeletonType(SkeletonType.WITHER); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitUndeadZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitUndeadZombie.java new file mode 100644 index 000000000..230e45e9b --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/zombiesurvival/kits/KitUndeadZombie.java @@ -0,0 +1,49 @@ +package nautilus.game.arcade.game.standalone.zombiesurvival.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitUndeadZombie extends Kit +{ + public KitUndeadZombie(ArcadeManager manager) + { + super(manager, "Undead", KitAvailability.Hide, + + new String[] + { + "Just a standard Zombie..." + }, + + new Perk[] + { + new PerkLeaper("Leap", 1, 1, 8000), + new PerkStrength(1), + new PerkIronSkin(1), + new PerkRegeneration(0) + }, + EntityType.ZOMBIE, + new ItemStack(Material.STONE_AXE)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); + + DisguiseSkeleton disguise = new DisguiseSkeleton(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java new file mode 100644 index 000000000..741f601ae --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java @@ -0,0 +1,156 @@ +package nautilus.game.arcade.kit; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.arcade.ArcadeFormat; +import nautilus.game.arcade.ArcadeManager; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; +import org.bukkit.inventory.ItemStack; + +public abstract class Kit implements Listener +{ + public ArcadeManager Manager; + + private String _kitName; + private String[] _kitDesc; + private KitAvailability _kitAvailability; + + private Perk[] _kitPerks; + + protected EntityType _entityType; + protected ItemStack _itemInHand; + + public Kit(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) + { + Manager = manager; + + _kitName = name; + _kitDesc = kitDesc; + _kitPerks = kitPerks; + + for (Perk perk : _kitPerks) + perk.SetHost(this); + + _kitAvailability = kitAvailability; + + _entityType = entityType; + _itemInHand = itemInHand; + } + + public String GetFormattedName() + { + return GetAvailability().GetColor() + "§l" + _kitName; + } + + public String GetName() + { + return _kitName; + } + + public ItemStack GetItemInHand() + { + return _itemInHand; + } + + public KitAvailability GetAvailability() + { + return _kitAvailability; + } + + public String[] GetDesc() + { + return _kitDesc; + } + + public Perk[] GetPerks() + { + return _kitPerks; + } + + public boolean HasKit(Player player) + { + if (Manager.GetGame() == null) + return false; + + return Manager.GetGame().HasKit(player, this); + } + + public void ApplyKit(Player player) + { + UtilInv.Clear(player); + + for (Perk perk : _kitPerks) + perk.Apply(player); + + GiveItems(player); + } + + public abstract void GiveItems(Player player); + + public Creature SpawnEntity(Location loc) + { + EntityType type = _entityType; + if (type == EntityType.PLAYER) + type = EntityType.ZOMBIE; + + Creature ent = (Creature)Manager.GetCreature().SpawnEntity(loc, type); + ent.setRemoveWhenFarAway(false); + ent.setCustomName(GetAvailability().GetColor() + GetName() + " Kit" + (GetAvailability() == KitAvailability.Blue ? ChatColor.GRAY + " (" + ChatColor.WHITE + "Ultra" + ChatColor.GRAY + ")" : "")); + ent.setCustomNameVisible(true); + ent.getEquipment().setItemInHand(_itemInHand); + + UtilEnt.Vegetate(ent); + + SpawnCustom(ent); + + return ent; + } + + public void SpawnCustom(Creature ent) { } + + public void DisplayDesc(Player player) + { + for (int i=0 ; i<3 ; i++) + UtilPlayer.message(player, ""); + + UtilPlayer.message(player, ArcadeFormat.Line); + + UtilPlayer.message(player, "§aKit - §f§l" + GetName()); + + //Desc + for (String line : GetDesc()) + { + UtilPlayer.message(player, C.cGray + " " + line); + } + + //Perk Descs + for (Perk perk : GetPerks()) + { + if (!perk.IsVisible()) + continue; + + UtilPlayer.message(player, ""); + UtilPlayer.message(player, C.cWhite + C.Bold + perk.GetName()); + for (String line : perk.GetDesc()) + { + UtilPlayer.message(player, C.cGray + " " + line); + } + } + + UtilPlayer.message(player, ArcadeFormat.Line); + + } + + public int GetCost() + { + return 2000; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/KitAvailability.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/KitAvailability.java new file mode 100644 index 000000000..0a6cd960d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/KitAvailability.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.kit; + +import org.bukkit.ChatColor; + +public enum KitAvailability +{ + Free(ChatColor.YELLOW), + Green(ChatColor.GREEN), + Blue(ChatColor.AQUA), + Hide(ChatColor.YELLOW), + Null(ChatColor.BLACK); + + ChatColor _color; + + KitAvailability(ChatColor color) + { + _color = color; + } + + public ChatColor GetColor() + { + return _color; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/NullKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/NullKit.java new file mode 100644 index 000000000..16ee2114a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/NullKit.java @@ -0,0 +1,40 @@ +package nautilus.game.arcade.kit; + +import org.bukkit.Location; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Player; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.perks.PerkNull; + +public class NullKit extends Kit +{ + public NullKit(ArcadeManager manager) + { + super(manager, "Null Kit", KitAvailability.Null, + + new String[] + { + "It does nothing!" + }, + + new Perk[] + { + new PerkNull() + }, + + null, null); + + } + + @Override + public void GiveItems(Player player) + { + + } + + @Override + public Creature SpawnEntity(Location loc) + { + return null; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java new file mode 100644 index 000000000..5b8af51b1 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java @@ -0,0 +1,57 @@ +package nautilus.game.arcade.kit; + +import nautilus.game.arcade.ArcadeManager; + +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; + +public abstract class Perk implements Listener +{ + public ArcadeManager Manager; + public Kit Kit; + + private String _perkName; + private String[] _perkDesc; + + private boolean _display; + + public Perk(String name, String[] perkDesc) + { + _perkName = name; + _perkDesc = perkDesc; + _display = true; + } + + public Perk(String name, String[] perkDesc, boolean display) + { + _perkName = name; + _perkDesc = perkDesc; + _display = display; + } + + public void SetHost(Kit kit) + { + Manager = kit.Manager; + Kit = kit; + } + + public String GetName() + { + return _perkName; + } + + public String[] GetDesc() + { + return _perkDesc; + } + + public boolean IsVisible() + { + return _display; + } + + public void Apply(Player player) + { + //Null Default + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java new file mode 100644 index 000000000..55d7e4d62 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java @@ -0,0 +1,131 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilInv; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Perk; +import net.minecraft.server.v1_6_R2.Item; + +public class PerkApple extends Perk implements IThrown +{ + + public PerkApple(ArcadeManager manager) + { + super("Apple Thrower", new String[] + { + C.cGray + "Receive 1 Apple every 10 seconds", + C.cYellow + "Left-Click" + C.cGray + " with Apple to " + C.cGreen + "Throw Apple", + }); + } + + @EventHandler + public void AppleSpawn(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (Manager.GetGame() == null) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!Kit.HasKit(player)) + continue; + + if (!Manager.GetGame().IsAlive(player)) + continue; + + if (!Recharge.Instance.use(player, "Apple Spawn", 10000, false)) + continue; + + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(260)); + player.playSound(player.getLocation(), Sound.ITEM_PICKUP, 2f, 1f); + } + } + + @EventHandler + public void ThrowApple(PlayerInteractEvent event) + { + if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (event.getPlayer().getItemInHand().getType() != Material.APPLE) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + event.setCancelled(true); + + UtilInv.remove(player, Material.APPLE, (byte)0, 1); + UtilInv.Update(player); + + org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.APPLE)); + UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 1d); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (target == null) + return; + + if (target instanceof Player) + { + if (!Manager.GetGame().IsAlive((Player)target)) + { + return; + } + } + + //Damage Event + Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + DamageCause.CUSTOM, 3, true, false, false, + UtilEnt.getName(data.GetThrower()), GetName()); + + //Effect + data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1.6f); + + //Re-Drop + if (data.GetThrown() instanceof Item) + data.GetThrown().getWorld().dropItem(data.GetThrown().getLocation(), ItemStackFactory.Instance.CreateStack(Material.APPLE)).setPickupDelay(60); + + data.GetThrown().remove(); + } + + @Override + public void Idle(ProjectileUser data) + { + + } + + @Override + public void Expire(ProjectileUser data) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArrowRebound.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArrowRebound.java new file mode 100644 index 000000000..90ac4f8ca --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArrowRebound.java @@ -0,0 +1,88 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashMap; + +import org.bukkit.Location; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.data.ReboundData; + +public class PerkArrowRebound extends Perk +{ + private HashMap _arrows = new HashMap(); + + private int _max = 0; + private float _maxPower = 1f; + + public PerkArrowRebound(int max, float maxPower) + { + super("Chain Arrows", new String[] + { + C.cGray + "Arrows bounce up to " + max + " times.", + }); + + _max = max; + _maxPower = maxPower; + } + + @EventHandler + public void ShootBow(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + Player player = (Player)event.getEntity(); + + if (!Kit.HasKit(player)) + return; + + _arrows.put(event.getProjectile(), new ReboundData(player, _max, null)); + } + + @EventHandler + public void Rebound(ProjectileHitEvent event) + { + ReboundData data = _arrows.remove(event.getEntity()); + if (data == null) return; + + if (data.Bounces <= 0) + return; + + Location arrowLoc = event.getEntity().getLocation().add(event.getEntity().getVelocity()); + + Player hit = UtilPlayer.getClosest(arrowLoc, data.Ignore); + if (hit == null) return; + + if (UtilMath.offset(hit.getLocation(), arrowLoc) > 1 && + UtilMath.offset(hit.getEyeLocation(), arrowLoc) > 1) + return; + + data.Ignore.add(hit); + + Player target = UtilPlayer.getClosest(event.getEntity().getLocation().add(event.getEntity().getVelocity()), data.Ignore); + if (target == null) return; + + Vector trajectory = UtilAlg.getTrajectory(hit, target); + trajectory.add(new Vector(0, UtilMath.offset(hit, target) / 100d, 0)); + + float power = (float) (0.8 + UtilMath.offset(hit, target) / 30d); + if (_maxPower > 0 && power > _maxPower) + power = _maxPower; + + Arrow ent = hit.getWorld().spawnArrow(hit.getEyeLocation().add(UtilAlg.getTrajectory(hit, target)), trajectory, power, 0f); + ent.setShooter(data.Shooter); + + _arrows.put(ent, new ReboundData(data.Shooter, data.Bounces-1, data.Ignore)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkAxeman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkAxeman.java new file mode 100644 index 000000000..6fca7d1e6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkAxeman.java @@ -0,0 +1,41 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.C; +import nautilus.game.arcade.kit.Perk; + +public class PerkAxeman extends Perk +{ + public PerkAxeman() + { + super("Axe Master", new String[] + { + C.cGray + "Deals +1 Damage with Axes", + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void AxeDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (damager.getItemInHand() == null) + return; + + if (!damager.getItemInHand().getType().toString().contains("_AXE")) + return; + + if (!Kit.HasKit(damager)) + return; + + event.AddMod(damager.getName(), GetName(), 1, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBarrage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBarrage.java new file mode 100644 index 000000000..68e2a6ad6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBarrage.java @@ -0,0 +1,225 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.WeakHashMap; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import nautilus.game.arcade.kit.Perk; + +public class PerkBarrage extends Perk +{ + private WeakHashMap _charge = new WeakHashMap(); + private WeakHashMap _chargeLast = new WeakHashMap(); + + private HashSet _firing = new HashSet(); + private HashSet _arrows = new HashSet(); + + private int _max; + private long _tick; + private boolean _remove; + + public PerkBarrage(int max, long tick, boolean remove) + { + super("Barrage", new String[] + { + C.cYellow + "Charge" + C.cGray + " your bow to use " + C.cGreen + "Barrage" + }); + + _max = max; + _tick = tick; + _remove = remove; + } + + @EventHandler + public void BarrageDrawBow(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.BOW) + return; + + if (!Kit.HasKit(player)) + return; + + if (!player.getInventory().contains(Material.ARROW)) + return; + + if (event.getClickedBlock() != null) + if (UtilBlock.usable(event.getClickedBlock())) + return; + + //Start Charge + _charge.put(player, 0); + _chargeLast.put(player, System.currentTimeMillis()); + _firing.remove(player); + } + + @EventHandler + public void BarrageCharge(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : UtilServer.getPlayers()) + { + //Not Charging + if (!_charge.containsKey(cur)) + continue; + + if (_firing.contains(cur)) + continue; + + //Max Charge + if (_charge.get(cur) >= _max) + continue; + + //Charge Interval + if (_charge.get(cur) == 0) + { + if (!UtilTime.elapsed(_chargeLast.get(cur), 1000)) + continue; + } + else + { + if (!UtilTime.elapsed(_chargeLast.get(cur), _tick)) + continue; + } + + //No Longer Holding Bow + if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW) + { + _charge.remove(cur); + _chargeLast.remove(cur); + continue; + } + + //Increase Charge + _charge.put(cur, _charge.get(cur) + 1); + _chargeLast.put(cur, System.currentTimeMillis()); + + //Effect + cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(cur))); + } + } + + @EventHandler + public void BarrageFireBow(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + if (!(event.getProjectile() instanceof Arrow)) + return; + + Player player = (Player)event.getEntity(); + + if (!_charge.containsKey(player)) + return; + + //Start Barrage + _firing.add(player); + _chargeLast.put(player, System.currentTimeMillis()); + } + + @EventHandler + public void BarrageArrows(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet remove = new HashSet(); + + for (Player cur : _firing) + { + if (!_charge.containsKey(cur) || !_chargeLast.containsKey(cur)) + { + remove.add(cur); + continue; + } + + if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW) + { + remove.add(cur); + continue; + } + + int arrows = _charge.get(cur); + if (arrows <= 0) + { + remove.add(cur); + continue; + } + + _charge.put(cur, arrows-1); + + //Fire Arrow + Vector random = new Vector((Math.random()-0.5)/10, (Math.random()-0.5)/10, (Math.random()-0.5)/10); + Projectile arrow = cur.launchProjectile(Arrow.class); + arrow.setVelocity(cur.getLocation().getDirection().add(random).multiply(3)); + _arrows.add(arrow); + cur.getWorld().playSound(cur.getLocation(), Sound.SHOOT_ARROW, 1f, 1f); + } + + for (Player cur : remove) + { + _charge.remove(cur); + _chargeLast.remove(cur); + _firing.remove(cur); + } + } + + @EventHandler + public void BarrageProjectileHit(ProjectileHitEvent event) + { + if (_remove) + if (_arrows.remove(event.getEntity())) + event.getEntity().remove(); + } + + @EventHandler + public void BarrageClean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Projectile arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid()) + arrowIterator.remove(); + } + } + + @EventHandler + public void Quit(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + + _charge.remove(player); + _chargeLast.remove(player); + _firing.remove(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java new file mode 100644 index 000000000..ab0ef8d75 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java @@ -0,0 +1,109 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.kit.Perk; + +public class PerkBlink extends Perk +{ + private String _name = ""; + private double _range; + private long _recharge; + + public PerkBlink(String name, double range, long recharge) + { + super("Leaper", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " with Axes to " + C.cGreen + name + }); + + _name = name; + _range = range; + _recharge = recharge; + } + + @EventHandler + public void Leap(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, _name, _recharge, true)) + return; + + //Smoke Trail + Block lastSmoke = player.getLocation().getBlock(); + + double curRange = 0; + while (curRange <= _range) + { + Location newTarget = player.getLocation().add(new Vector(0,0.2,0)).add(player.getLocation().getDirection().multiply(curRange)); + + if (!UtilBlock.airFoliage(newTarget.getBlock()) || + !UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP))) + break; + + //Progress Forwards + curRange += 0.2; + + //Smoke Trail + if (!lastSmoke.equals(newTarget.getBlock())) + lastSmoke.getWorld().playEffect(lastSmoke.getLocation(), Effect.SMOKE, 4); + + lastSmoke = newTarget.getBlock(); + } + + //Modify Range + curRange -= 0.4; + if (curRange < 0) + curRange = 0; + + //Destination + Location loc = player.getLocation().add(player.getLocation().getDirection().multiply(curRange).add(new Vector(0, 0.4, 0))); + + if (curRange > 0) + player.teleport(loc); + + player.setFallDistance(0); + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(_name) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.WITHER_SHOOT, 0.4f, 1.2f); + player.getWorld().playSound(player.getLocation(), Sound.SILVERFISH_KILL, 1f, 1.6f); + } +} + + diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java new file mode 100644 index 000000000..15a2a3699 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java @@ -0,0 +1,154 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.ExplosionPrimeEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import nautilus.game.arcade.kit.Perk; + +public class PerkBomber extends Perk +{ + private HashMap _tntMap = new HashMap(); + + private int _spawnRate; + private int _max; + + public PerkBomber(int spawnRate, int max) + { + super("Bomber", new String[] + { + C.cGray + "Receive 1 TNT every " + spawnRate + " seconds. Maximum of " + max + ".", + C.cYellow + "Click" + C.cGray + " with TNT to " + C.cGreen + "Throw TNT" + }); + + _spawnRate = spawnRate; + _max = max; + } + + public void Apply(Player player) + { + Recharge.Instance.use(player, GetName(), _spawnRate*1000, false); + } + + @EventHandler + public void TNTSpawn(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : UtilServer.getPlayers()) + { + if (!Kit.HasKit(cur)) + continue; + + if (!Manager.GetGame().IsAlive(cur)) + continue; + + if (!Recharge.Instance.use(cur, GetName(), _spawnRate*1000, false)) + continue; + + if (UtilInv.contains(cur, Material.TNT, (byte)0, _max)) + continue; + + //Add + cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, F.item("Throwing TNT"))); + + cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f); + } + } + + @EventHandler + public void TNTDrop(PlayerDropItemEvent event) + { + if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.TNT, (byte)0)) + return; + + //Cancel + event.setCancelled(true); + + //Inform + UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot drop " + F.item("Throwing TNT") + ".")); + } + + @EventHandler + public void TNTDeathRemove(PlayerDeathEvent event) + { + HashSet remove = new HashSet(); + + for (org.bukkit.inventory.ItemStack item : event.getDrops()) + if (UtilInv.IsItem(item, Material.TNT, (byte)0)) + remove.add(item); + + for (org.bukkit.inventory.ItemStack item : remove) + event.getDrops().remove(item); + } + + @EventHandler + public void TNTInvClick(InventoryClickEvent event) + { + UtilInv.DisallowMovementOf(event, "Throwing TNT", Material.TNT, (byte)0, true); + } + + @EventHandler + public void TNTThrow(PlayerInteractEvent event) + { + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK && + event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_AIR) + return; + + Player player = event.getPlayer(); + + if (!UtilInv.IsItem(player.getItemInHand(), Material.TNT, (byte)0)) + return; + + if (!Kit.HasKit(player)) + return; + + event.setCancelled(true); + + UtilInv.remove(player, Material.TNT, (byte)0, 1); + UtilInv.Update(player); + + TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class); + + UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.5, false, 0, 0.1, 10, false); + + _tntMap.put(tnt, player); + } + + @EventHandler + public void ExplosionPrime(ExplosionPrimeEvent event) + { + if (!_tntMap.containsKey(event.getEntity())) + return; + + Player player = _tntMap.remove(event.getEntity()); + + for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 14)) + { + Manager.GetCondition().Factory().Explosion("Throwing TNT", other, player, 50, 0.1, false, false); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkConstructor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkConstructor.java new file mode 100644 index 000000000..dc03c308c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkConstructor.java @@ -0,0 +1,122 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerDropItemEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.kit.Perk; + +public class PerkConstructor extends Perk +{ + private int _max = 0; + private double _time = 0; + + private Material _type; + private String _name = ""; + + public PerkConstructor(String perkName, double time, int max, Material mat, String name, boolean visible) + { + super(perkName, new String[] + { + C.cGray + "Receive 1 " + ItemStackFactory.Instance.GetName(mat, (byte)0, false) + " every " + time + " seconds. Maximum of " + max + ".", + }, visible); + + _time = time; + _max = max; + _type = mat; + + if (name == null) + _name = ItemStackFactory.Instance.GetName(mat, (byte)0, false); + else + _name = name; + } + + @EventHandler + public void Construct(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : UtilServer.getPlayers()) + { + if (!Kit.HasKit(cur)) + continue; + + if (!Manager.GetGame().IsAlive(cur)) + continue; + + if (!Recharge.Instance.use(cur, GetName(), (long) (_time * 1000), false)) + continue; + + if (UtilInv.contains(cur, _type, (byte)0, _max)) + continue; + + //Add + byte data = 0; + if (_type == Material.WOOL) + { + GameTeam team = Manager.GetGame().GetTeam(cur); + if (team != null) + data = team.GetColorData(); + + if (UtilInv.contains(cur, _type, data, _max)) + continue; + + cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, team.GetColorData(), 1)); + return; + } + + cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(_type, data, 1, F.item(_name))); + + cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f); + } + } + + @EventHandler + public void Drop(PlayerDropItemEvent event) + { + if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), _type, (byte)0)) + return; + + //Cancel + event.setCancelled(true); + + //Inform + UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot drop " + F.item(_name) + ".")); + } + + @EventHandler + public void DeathRemove(PlayerDeathEvent event) + { + HashSet remove = new HashSet(); + + for (org.bukkit.inventory.ItemStack item : event.getDrops()) + if (UtilInv.IsItem(item, _type, (byte)0)) + remove.add(item); + + for (org.bukkit.inventory.ItemStack item : remove) + event.getDrops().remove(item); + } + + @EventHandler + public void InvClick(InventoryClickEvent event) + { + UtilInv.DisallowMovementOf(event, _name, _type, (byte)0, true); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDigger.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDigger.java new file mode 100644 index 000000000..bb2e3291c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDigger.java @@ -0,0 +1,38 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import nautilus.game.arcade.kit.Perk; + +public class PerkDigger extends Perk +{ + public PerkDigger() + { + super("Digger", new String[] + { + C.cGray + "Permanent Fast Digging II", + }); + } + + @EventHandler + public void DigSpeed(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (Manager.GetGame() == null) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!Kit.HasKit(player)) + continue; + + Manager.GetCondition().Factory().DigFast(GetName(), player, player, 1.9, 1, false, false, true); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java new file mode 100644 index 000000000..8d400201e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java @@ -0,0 +1,83 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.Effect; +import org.bukkit.GameMode; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerToggleFlightEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkDoubleJump extends Perk +{ + private double _power; + private double _heightMax; + private boolean _control; + + public PerkDoubleJump(String name, double power, double heightLimit, boolean control) + { + super("Jumper", new String[] + { + C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + name + }); + + _power = power; + _heightMax = heightLimit; + _control = control; + } + + @EventHandler + public void FlightHop(PlayerToggleFlightEvent event) + { + Player player = event.getPlayer(); + + if (player.getGameMode() == GameMode.CREATIVE) + return; + + event.setCancelled(true); + player.setFlying(false); + + //Disable Flight + player.setAllowFlight(false); + + //Velocity + if (_control) + { + UtilAction.velocity(player, _power, 0.2, _heightMax, true); + } + else + { + UtilAction.velocity(player, player.getLocation().getDirection(), _power, true, _power, 0, _heightMax, true); + } + + //Sound + player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); + } + + @EventHandler + public void FlightUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (player.getGameMode() == GameMode.CREATIVE) + continue; + + if (!Kit.HasKit(player)) + continue; + + if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + player.setAllowFlight(true); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkExplode.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkExplode.java new file mode 100644 index 000000000..2c8165312 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkExplode.java @@ -0,0 +1,85 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashMap; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.kit.Perk; + +public class PerkExplode extends Perk +{ + private String _name; + private double _scale; + private long _recharge; + + public PerkExplode(String name, double scale, long recharge) + { + super("Explosive", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " with Axes to " + C.cGreen + name + }); + + _name = name; + _scale = scale; + _recharge = recharge; + } + + @EventHandler + public void Leap(PlayerInteractEvent event) + { + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK && + event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (event.getPlayer().getItemInHand().getType() != Material.TNT) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, _name, _recharge, true)) + return; + + //Remove + //Blast + HashMap hit = UtilPlayer.getInRadius(player.getLocation(), 8); + for (Player other : hit.keySet()) + { + //Velocity + UtilAction.velocity(other, UtilAlg.getTrajectory(player.getLocation(), + other.getEyeLocation()), _scale*2.4*hit.get(other), false, 0, 0.2+_scale*0.6*hit.get(other), 1.6, true); + + //Damage Event + Manager.GetDamage().NewDamageEvent(other, player, null, + DamageCause.CUSTOM, _scale*40*hit.get(other), false, true, false, + UtilEnt.getName(player), GetName()); + + //Inform + UtilPlayer.message(other, F.main(GetName(), F.name(UtilEnt.getName(player)) +" hit you with " + F.item(GetName()) + ".")); + } + + //Effect + player.getWorld().createExplosion(player.getLocation(), 0f); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFallDamage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFallDamage.java new file mode 100644 index 000000000..fcc4abbb6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFallDamage.java @@ -0,0 +1,49 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.common.util.C; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkFallDamage extends Perk +{ + private int _mod; + + public PerkFallDamage(int mod) + { + super("Feather Falling", new String[] + { + C.cGray + "You take " + mod + " damage from falling", + }); + + _mod = mod; + } + + @EventHandler(priority = EventPriority.HIGH) + public void DamageDecrease(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.FALL) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + if (!Kit.HasKit(damagee)) + return; + + int decrease = 0; + if (_mod < 0) + { + decrease = (int) -Math.min(Math.abs(_mod), event.GetDamageInitial()); + } + + event.AddMod(damagee.getName(), GetName(), decrease, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlamingSword.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlamingSword.java new file mode 100644 index 000000000..af94302ad --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlamingSword.java @@ -0,0 +1,128 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashMap; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkFlamingSword extends Perk +{ + private HashMap _active = new HashMap(); + + public PerkFlamingSword() + { + super("Flaming Sword", new String[] + { + "Attacks ignite opponents for 4 seconds.", + C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Inferno" + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void IgniteTarget(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!Kit.HasKit(damager)) + return; + + Manager.GetCondition().Factory().Ignite("Flaming Sword", event.GetDamageeEntity(), damager, 4, false, false); + } + + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), Material.GOLD_SWORD)) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, "Inferno", 4000, true)) + return; + + _active.put(player, System.currentTimeMillis()); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill("Inferno") + ".")); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : UtilServer.getPlayers()) + { + if (!_active.containsKey(cur)) + continue; + + if (!cur.isBlocking()) + { + _active.remove(cur); + continue; + } + + if (UtilTime.elapsed(_active.get(cur), 1500)) + { + _active.remove(cur); + continue; + } + + //Fire + Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.FIRE)); + Manager.GetFire().Add(fire, cur, 0.7, 0, 0.5, 1, "Inferno"); + + fire.teleport(cur.getEyeLocation()); + double x = 0.07 - (UtilMath.r(14)/100d); + double y = 0.07 - (UtilMath.r(14)/100d); + double z = 0.07 - (UtilMath.r(14)/100d); + fire.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(1.6)); + + //Effect + cur.getWorld().playSound(cur.getLocation(), Sound.GHAST_FIREBALL, 0.1f, 1f); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java new file mode 100644 index 000000000..c71bf3246 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java @@ -0,0 +1,149 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerDropItemEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import nautilus.game.arcade.kit.Perk; + +public class PerkFletcher extends Perk +{ + private HashSet _fletchArrows = new HashSet(); + + private int _max = 0; + private int _time = 0; + private boolean _remove; + + public PerkFletcher(int time, int max, boolean remove) + { + super("Fletcher", new String[] + { + C.cGray + "Receive 1 Arrow every " + time + " seconds. Maximum of " + max + ".", + }); + + _time = time; + _max = max; + _remove = remove; + } + + @EventHandler + public void FletchShootBow(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + Player player = (Player)event.getEntity(); + + if (!Kit.HasKit(player)) + return; + + for (int i=0 ; i<=8 ; i++) + if (player.getInventory().getItem(i) != null) + if (UtilInv.IsItem(player.getInventory().getItem(i), Material.ARROW, (byte)1)) + { + _fletchArrows.add(event.getProjectile()); + return; + } + } + + @EventHandler + public void FletchProjectileHit(ProjectileHitEvent event) + { + if (_remove) + if (_fletchArrows.remove(event.getEntity())) + event.getEntity().remove(); + } + + @EventHandler + public void Fletch(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : UtilServer.getPlayers()) + { + if (!Kit.HasKit(cur)) + continue; + + if (!Manager.GetGame().IsAlive(cur)) + continue; + + if (!Recharge.Instance.use(cur, GetName(), _time * 1000, false)) + continue; + + if (UtilInv.contains(cur, Material.ARROW, (byte)1, _max)) + continue; + + //Add + cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Fletched Arrow"))); + + cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f); + } + } + + @EventHandler + public void FletchDrop(PlayerDropItemEvent event) + { + if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.ARROW, (byte)1)) + return; + + //Cancel + event.setCancelled(true); + + //Inform + UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot drop " + F.item("Fletched Arrow") + ".")); + } + + @EventHandler + public void FletchDeathRemove(PlayerDeathEvent event) + { + HashSet remove = new HashSet(); + + for (org.bukkit.inventory.ItemStack item : event.getDrops()) + if (UtilInv.IsItem(item, Material.ARROW, (byte)1)) + remove.add(item); + + for (org.bukkit.inventory.ItemStack item : remove) + event.getDrops().remove(item); + } + + @EventHandler + public void FletchInvClick(InventoryClickEvent event) + { + UtilInv.DisallowMovementOf(event, "Fletched Arrow", Material.ARROW, (byte)1, true); + } + + @EventHandler + public void FletchClean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Iterator arrowIterator = _fletchArrows.iterator(); arrowIterator.hasNext();) + { + Entity arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid()) + arrowIterator.remove(); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFood.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFood.java new file mode 100644 index 000000000..03dca1660 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFood.java @@ -0,0 +1,43 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.core.common.util.C; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkFood extends Perk +{ + private int _amount; + + public PerkFood(int amount) + { + super("Strength", new String[] + { + C.cGray + "Your Hunger is permanently " + amount + "", + }); + + _amount = amount; + } + + @EventHandler(priority = EventPriority.HIGH) + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (Manager.GetGame() == null) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (Kit.HasKit(player)) + { + player.setFoodLevel(_amount); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronSkin.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronSkin.java new file mode 100644 index 000000000..732267cba --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronSkin.java @@ -0,0 +1,43 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.common.util.C; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkIronSkin extends Perk +{ + private int _reduction; + + public PerkIronSkin(int reduction) + { + super("Iron Skin", new String[] + { + C.cGray + "You take " + reduction + " less damage from attacks", + }); + + _reduction = reduction; + } + + @EventHandler(priority = EventPriority.HIGH) + public void DamageDecrease(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() == DamageCause.FIRE_TICK) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + if (!Kit.HasKit(damagee)) + return; + + event.AddMod(damagee.getName(), GetName(), -_reduction, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkKnockback.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkKnockback.java new file mode 100644 index 000000000..65b0b8c0e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkKnockback.java @@ -0,0 +1,53 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.EntityEffect; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.kit.Perk; + +public class PerkKnockback extends Perk +{ + private double _power; + + public PerkKnockback(double power) + { + super("Knockback", new String[] + { + C.cGray + "Attacks gives knockback with " + power + " power.", + }); + + _power = power; + } + + @EventHandler(priority = EventPriority.HIGH) + public void Knockback(CustomDamageEvent event) + { + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!Kit.HasKit(damager)) + return; + + if (!Manager.IsAlive(damager)) + return; + + event.SetKnockback(false); + + if (!Recharge.Instance.use(damager, "KB " + UtilEnt.getName(event.GetDamageeEntity()), 400, false)) + return; + + event.GetDamageeEntity().playEffect(EntityEffect.HURT); + + UtilAction.velocity(event.GetDamageeEntity(), + UtilAlg.getTrajectory(damager, event.GetDamageeEntity()), + _power, false, 0, 0.1, 10, true); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeaper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeaper.java new file mode 100644 index 000000000..a23a436d7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeaper.java @@ -0,0 +1,75 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.Effect; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.event.PerkLeapEvent; + +public class PerkLeaper extends Perk +{ + private String _name; + private double _power; + private double _heightMax; + private long _recharge; + + public PerkLeaper(String name, double power, double heightLimit, long recharge) + { + super("Leaper", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " with Axes to " + C.cGreen + name + }); + + _name = name; + _power = power; + _heightMax = heightLimit; + _recharge = recharge; + } + + @EventHandler + public void Leap(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, _name, _recharge, true)) + return; + + UtilAction.velocity(player, _power, 0.2, _heightMax, true); + player.setFallDistance(0); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(_name) + ".")); + + player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); + + PerkLeapEvent leapEvent = new PerkLeapEvent(player); + UtilServer.getServer().getPluginManager().callEvent(leapEvent); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMammoth.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMammoth.java new file mode 100644 index 000000000..f661b5e41 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMammoth.java @@ -0,0 +1,50 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.C; +import nautilus.game.arcade.kit.Perk; + +public class PerkMammoth extends Perk +{ + public PerkMammoth() + { + super("Mammoth", new String[] + { + C.cGray + "Take 75% knockback and deal 150% knockback", + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void KnockbackIncrease(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!Kit.HasKit(damager)) + return; + + event.AddKnockback(GetName(), 1.5d); + } + + @EventHandler(priority = EventPriority.HIGH) + public void KnockbackDecrease(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + if (!Kit.HasKit(damagee)) + return; + + event.AddKnockback(GetName(), 0.5d); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNull.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNull.java new file mode 100644 index 000000000..5f7816b84 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNull.java @@ -0,0 +1,15 @@ +package nautilus.game.arcade.kit.perks; + +import nautilus.game.arcade.kit.Perk; + +public class PerkNull extends Perk +{ + public PerkNull() + { + super("Null", new String[] + { + "Absolutely nothing!" + }); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOreFinder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOreFinder.java new file mode 100644 index 000000000..14606e3e1 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOreFinder.java @@ -0,0 +1,135 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashMap; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.ore.OreHider; +import nautilus.game.arcade.ore.OreObsfucation; + +public class PerkOreFinder extends Perk +{ + private HashMap _blockMap = new HashMap(); + + public PerkOreFinder() + { + super("Ore Finder", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " with Pickaxe to " + C.cGreen + "Locate Ore", + C.cGray + "Locates Ore of same type as your Pickaxe", + }); + + _blockMap.put(Material.STONE_PICKAXE, Material.COAL_ORE); + _blockMap.put(Material.IRON_PICKAXE, Material.IRON_ORE); + _blockMap.put(Material.GOLD_PICKAXE, Material.GOLD_ORE); + _blockMap.put(Material.DIAMOND_PICKAXE, Material.DIAMOND_ORE); + } + + @EventHandler + public void SearchOre(PlayerInteractEvent event) + { + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (Manager.GetGame() == null) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (event.getClickedBlock() != null) + if (UtilBlock.usable(event.getClickedBlock())) + return; + + Material type = event.getPlayer().getItemInHand().getType(); + + if (!_blockMap.containsKey(type)) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + String oreType = ItemStackFactory.Instance.GetName(_blockMap.get(type), (byte)0, false); + + if (!Recharge.Instance.use(player, "Ore Scanner", 30000, true)) + return; + + Block bestBlock = null; + double bestDist = 10; + + //Unhidden Ores + for (Block block : UtilBlock.getInRadius(player.getLocation(), 8d).keySet()) + { + if (block.getType() != _blockMap.get(type)) + continue; + + double dist = UtilMath.offset(block.getLocation(), player.getLocation()); + + if (bestBlock == null || dist < bestDist) + { + bestBlock = block; + bestDist = dist; + } + } + + //Hidden Ores + if (Manager.GetGame() instanceof OreObsfucation) + { + OreHider ore = ((OreObsfucation)Manager.GetGame()).GetOreHider(); + + for (Location loc : ore.GetHiddenOre().keySet()) + { + if (ore.GetHiddenOre().get(loc) != _blockMap.get(type)) + continue; + + double dist = UtilMath.offset(loc, player.getLocation()); + + if (dist > 8d) + continue; + + if (bestBlock == null || dist < bestDist) + { + bestBlock = loc.getBlock(); + bestDist = dist; + } + } + } + + UtilPlayer.message(player, F.main("Skill", "Scanning for " + F.skill(oreType) + "...")); + + if (bestBlock == null) + { + UtilPlayer.message(player, F.main("Skill", "No " + F.skill(oreType) + " found.")); + } + else + { + Vector vec = UtilAlg.getTrajectory(player.getEyeLocation(), bestBlock.getLocation().add(0.5, 0.5, 0.5)); + + Location loc = player.getLocation(); + loc.setPitch(UtilAlg.GetPitch(vec)); + loc.setYaw(UtilAlg.GetYaw(vec)); + + player.teleport(loc); + + UtilPlayer.message(player, F.main("Skill", "Located nearby " + F.skill(oreType) + "!")); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkQuickshot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkQuickshot.java new file mode 100644 index 000000000..79152bfee --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkQuickshot.java @@ -0,0 +1,66 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.Material; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.kit.Perk; + +public class PerkQuickshot extends Perk +{ + private String _name; + private double _power; + private long _recharge; + + public PerkQuickshot(String name, double power, long recharge) + { + super("Leaper", new String[] + { + C.cYellow + "Left-Click" + C.cGray + " with Bow to " + C.cGreen + name + }); + + _name = name; + _power = power; + _recharge = recharge; + } + + @EventHandler + public void Leap(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (event.getPlayer().getItemInHand().getType() != Material.BOW) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, _name, _recharge, true)) + return; + + Arrow arrow = player.launchProjectile(Arrow.class); + arrow.setVelocity(player.getLocation().getDirection().multiply(_power)); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(_name) + ".")); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRecharge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRecharge.java new file mode 100644 index 000000000..2ac681fd3 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRecharge.java @@ -0,0 +1,31 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.recharge.RechargeEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkRecharge extends Perk +{ + private double _reduction; + + public PerkRecharge(double reduction) + { + super("Recharge", new String[] + { + C.cGray + "Reduces ability cooldowns by " + (int)(reduction*100) + "%", + }); + + _reduction = reduction; + } + + @EventHandler + public void DigSpeed(RechargeEvent event) + { + if (!Kit.HasKit(event.GetPlayer())) + return; + + event.SetRecharge((long) (event.GetRecharge() * (1 - _reduction))); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRegeneration.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRegeneration.java new file mode 100644 index 000000000..90c42bf57 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRegeneration.java @@ -0,0 +1,42 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import nautilus.game.arcade.kit.Perk; + +public class PerkRegeneration extends Perk +{ + private int _level; + + public PerkRegeneration(int level) + { + super("Regeneration", new String[] + { + C.cGray + "Permanent Regeneration " + (level+1), + }); + + _level = level; + } + + @EventHandler + public void DigSpeed(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + if (Manager.GetGame() == null) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!Kit.HasKit(player)) + continue; + + Manager.GetCondition().Factory().Regen(GetName(), player, player, 8, _level, false, false, true); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlam.java new file mode 100644 index 000000000..c5674e205 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlam.java @@ -0,0 +1,100 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashMap; + +import org.bukkit.Effect; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.kit.Perk; + +public class PerkSlam extends Perk +{ + private String _name = "Leap"; + private double _vertical; + private double _horizontal; + private long _recharge; + + public PerkSlam(String name, double power, double heightLimit, long recharge) + { + super("Slam", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " with Axes to " + C.cGreen + name + }); + + _name = name; + _vertical = power; + _horizontal = heightLimit; + _recharge = recharge; + } + + @EventHandler + public void Leap(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, _name, _recharge, true)) + return; + + //Slam + HashMap targets = UtilEnt.getInRadius(player.getLocation(), 6); + for (LivingEntity cur : targets.keySet()) + { + if (cur.equals(player)) + continue; + + //Velocity + UtilAction.velocity(cur, + UtilAlg.getTrajectory2d(player.getLocation().toVector(), cur.getLocation().toVector()), + _horizontal * targets.get(cur), true, 0, 0.4 + _vertical * targets.get(cur), 0.4 + _vertical, true); + + //Condition + Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true); + + //Inform + if (cur instanceof Player) + UtilPlayer.message((Player)cur, F.main("Game", F.name(player.getName()) +" hit you with " + F.skill(_name) + ".")); + } + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f); + for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet()) + if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur)) + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId()); + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(_name) + ".")); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmasher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmasher.java new file mode 100644 index 000000000..eb665d9c4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmasher.java @@ -0,0 +1,77 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockDamageEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.kit.Perk; + +public class PerkSmasher extends Perk +{ + public PerkSmasher() + { + super("Smasher", new String[] + { + C.cGray + "Hitting blocks damages all surrounding blocks", + }); + } + + @EventHandler + public void BlockSmash(BlockDamageEvent event) + { + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (this.Manager.GetGame() == null) + return; + + if (!this.Manager.GetGame().IsAlive(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), 250, false)) + return; + + for (Block block : UtilBlock.getSurrounding(event.getBlock())) + { + BlockDamageEvent blockDamage = new BlockDamageEvent(event.getPlayer(), block, event.getPlayer().getItemInHand(), false); + Manager.GetPlugin().getServer().getPluginManager().callEvent(blockDamage); + } + + BlockDamageEvent blockDamage = new BlockDamageEvent(event.getPlayer(), event.getBlock(), event.getPlayer().getItemInHand(), false); + Manager.GetPlugin().getServer().getPluginManager().callEvent(blockDamage); + } + + @EventHandler + public void BlockSmash(BlockBreakEvent event) + { + if (event.isCancelled()) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (this.Manager.GetGame() == null) + return; + + if (!this.Manager.GetGame().IsAlive(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), 50, false)) + return; + + for (Block block : UtilBlock.getSurrounding(event.getBlock())) + { + BlockBreakEvent blockDamage = new BlockBreakEvent(block, player); + Manager.GetPlugin().getServer().getPluginManager().callEvent(blockDamage); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSparkler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSparkler.java new file mode 100644 index 000000000..a193e3730 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSparkler.java @@ -0,0 +1,181 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Color; +import org.bukkit.FireworkEffect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import nautilus.game.arcade.kit.Perk; + +public class PerkSparkler extends Perk +{ + private HashSet _items = new HashSet(); + + private int _spawnRate; + private int _max; + + public PerkSparkler(int spawnRate, int max) + { + super("", new String[] + { + C.cGray + "Receive 1 Sparkler every " + spawnRate + " seconds. Maximum of " + max + ".", + C.cYellow + "Click" + C.cGray + " with Sparkler to " + C.cGreen + "Throw Sparkler" + }); + + _spawnRate = spawnRate; + _max = max; + } + + public void Apply(Player player) + { + Recharge.Instance.use(player, GetName(), _spawnRate*1000, false); + } + + @EventHandler + public void SparklerSpawn(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : UtilServer.getPlayers()) + { + if (!Kit.HasKit(cur)) + continue; + + if (!Manager.GetGame().IsAlive(cur)) + continue; + + if (!Recharge.Instance.use(cur, GetName(), _spawnRate*1000, false)) + continue; + + if (UtilInv.contains(cur, Material.EMERALD, (byte)0, _max)) + continue; + + //Add + cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte)0, 1, F.item("Throwing Sparkler"))); + + cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f); + } + } + + @EventHandler + public void SparklerDrop(PlayerDropItemEvent event) + { + if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.EMERALD, (byte)0)) + return; + + //Cancel + event.setCancelled(true); + + //Inform + UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot drop " + F.item("Throwing Sparkler") + ".")); + } + + @EventHandler + public void SparklerDeathRemove(PlayerDeathEvent event) + { + HashSet remove = new HashSet(); + + for (org.bukkit.inventory.ItemStack item : event.getDrops()) + if (UtilInv.IsItem(item, Material.EMERALD, (byte)0)) + remove.add(item); + + for (org.bukkit.inventory.ItemStack item : remove) + event.getDrops().remove(item); + } + + @EventHandler + public void SparklerInvClick(InventoryClickEvent event) + { + UtilInv.DisallowMovementOf(event, "Throwing Sparkler", Material.EMERALD, (byte)0, true); + } + + @EventHandler + public void SparklerThrow(PlayerInteractEvent event) + { + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK && + event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_AIR) + return; + + Player player = event.getPlayer(); + + if (!UtilInv.IsItem(player.getItemInHand(), Material.EMERALD, (byte)0)) + return; + + if (!Kit.HasKit(player)) + return; + + event.setCancelled(true); + + UtilInv.remove(player, Material.EMERALD, (byte)0, 1); + UtilInv.Update(player); + + Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), + ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte)0, 1, F.item("Throwing Sparkler"))); + + item.setPickupDelay(2000); + + _items.add(item); + + UtilAction.velocity(item, player.getLocation().getDirection(), 0.8, false, 0, 0.1, 10, false); + } + + @EventHandler + public void Sparkle(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + Iterator itemIterator = _items.iterator(); + + while (itemIterator.hasNext()) + { + Item item = itemIterator.next(); + + if (!item.isValid() || item.getTicksLived() > 100) + { + item.remove(); + itemIterator.remove(); + continue; + } + + FireworkEffect effect = FireworkEffect.builder().withColor(Color.GREEN).with(Type.BURST).build(); + + try + { + Manager.GetFirework().playFirework(item.getLocation(), effect); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + + public HashSet GetItems() + { + return _items; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpeed.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpeed.java new file mode 100644 index 000000000..8d6e8a8f6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpeed.java @@ -0,0 +1,42 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import nautilus.game.arcade.kit.Perk; + +public class PerkSpeed extends Perk +{ + private int _level; + + public PerkSpeed(int level) + { + super("Speed", new String[] + { + C.cGray + "Permanent Speed " + (level+1), + }); + + _level = level; + } + + @EventHandler + public void DigSpeed(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + if (Manager.GetGame() == null) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!Kit.HasKit(player)) + continue; + + Manager.GetCondition().Factory().Speed(GetName(), player, player, 8, _level, false, false, true); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkStrength.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkStrength.java new file mode 100644 index 000000000..038948a2d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkStrength.java @@ -0,0 +1,39 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.core.common.util.C; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkStrength extends Perk +{ + private int _power; + + public PerkStrength(int power) + { + super("Strength", new String[] + { + C.cGray + "You deal " + power + " more damage", + }); + + _power = power; + } + + @EventHandler(priority = EventPriority.HIGH) + public void DamageDecrease(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + if (!Kit.HasKit(damager)) + return; + + event.AddMod(damager.getName(), GetName(), _power, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkVampire.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkVampire.java new file mode 100644 index 000000000..69ba0a124 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkVampire.java @@ -0,0 +1,44 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.kit.Perk; + +public class PerkVampire extends Perk +{ + private int _recover; + + public PerkVampire(int recover) + { + super("Vampire", new String[] + { + C.cGray + "You heal " + recover + "HP when you kill someone", + }); + + _recover = recover; + } + + @EventHandler + public void PlayerKillAward(CombatDeathEvent event) + { + Game game = Manager.GetGame(); + if (game == null) return; + + if (!(event.GetEvent().getEntity() instanceof Player)) + return; + + if (event.GetLog().GetKiller() == null) + return; + + Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + if (killer == null) + return; + + UtilPlayer.health(killer, _recover); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWeb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWeb.java new file mode 100644 index 000000000..9ec03b2f7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWeb.java @@ -0,0 +1,139 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import nautilus.game.arcade.kit.Perk; + +public class PerkWeb extends Perk implements IThrown +{ + private int _spawnRate; + private int _max; + + public PerkWeb(int spawnRate, int max) + { + super("Bomber", new String[] + { + C.cGray + "Receive 1 Web every " + spawnRate + " seconds. Maximum of " + max + ".", + C.cYellow + "Click" + C.cGray + " with Web to " + C.cGreen + "Throw Web" + }); + + _spawnRate = spawnRate; + _max = max; + } + + @EventHandler + public void Spawn(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : UtilServer.getPlayers()) + { + if (!Kit.HasKit(cur)) + continue; + + if (!Manager.GetGame().IsAlive(cur)) + continue; + + if (!Recharge.Instance.use(cur, GetName(), _spawnRate*1000, false)) + continue; + + if (UtilInv.contains(cur, Material.WEB, (byte)0, _max)) + continue; + + //Add + cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WEB)); + } + } + + @EventHandler + public void Throw(PlayerInteractEvent event) + { + if (event.getPlayer().getItemInHand() == null) + return; + + if (event.getPlayer().getItemInHand().getType() == Material.WEB) + { + if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK && + event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + } + else if (event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) + { + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + } + else + { + return; + } + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + event.setCancelled(true); + + UtilInv.remove(player, Material.WEB, (byte)0, 1); + UtilInv.Update(player); + + org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.WEB)); + UtilAction.velocity(ent, player.getLocation().getDirection(), 0.8, false, 0, 0.2, 10, false); + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 1d); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (target != null) + { + if (target instanceof Player) + { + if (!Manager.GetGame().IsAlive((Player)target)) + { + return; + } + } + } + + Web(data); + } + + @Override + public void Idle(ProjectileUser data) + { + Web(data); + } + + @Override + public void Expire(ProjectileUser data) + { + Web(data); + } + + public void Web(ProjectileUser data) + { + Location loc = data.GetThrown().getLocation(); + data.GetThrown().remove(); + + Manager.GetBlockRestore().Add(loc.getBlock(), 30, (byte)0, 4000); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/ReboundData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/ReboundData.java new file mode 100644 index 000000000..622e40fbb --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/ReboundData.java @@ -0,0 +1,23 @@ +package nautilus.game.arcade.kit.perks.data; + +import java.util.HashSet; + +import org.bukkit.entity.Player; + +public class ReboundData +{ + public Player Shooter; + public HashSet Ignore = new HashSet(); + public int Bounces; + + public ReboundData(Player shooter, int bounces, HashSet previousIgnore) + { + Shooter = shooter; + Bounces = bounces; + + if (previousIgnore != null) + Ignore = previousIgnore; + + Ignore.add(shooter); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/event/PerkLeapEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/event/PerkLeapEvent.java new file mode 100644 index 000000000..d96c2b84d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/event/PerkLeapEvent.java @@ -0,0 +1,31 @@ +package nautilus.game.arcade.kit.perks.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class PerkLeapEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private Player _player; + + public PerkLeapEvent(Player player) + { + _player = player; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public Player GetPlayer() + { + return _player; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java new file mode 100644 index 000000000..bb85fc387 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java @@ -0,0 +1,110 @@ +package nautilus.game.arcade.managers; + +import java.util.Iterator; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.Game.GameState; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; + +public class GameChatManager implements Listener +{ + ArcadeManager Manager; + + public GameChatManager(ArcadeManager manager) + { + Manager = manager; + + Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin()); + } + + @EventHandler + public void MeCancel(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().startsWith("/me")) + { + event.getPlayer().sendMessage(F.main("Mirror", "You can't see /me messages, are you a vampire?")); + event.setCancelled(true); + } + } + + public void HandleChat(AsyncPlayerChatEvent event, String filteredMessage) + { + Player sender = event.getPlayer(); + + //Dead Prefix + String dead = ""; + if (Manager.GetGame() != null) + if (Manager.GetGame().GetTeam(sender) != null) + if (!Manager.GetGame().IsAlive(sender)) + dead = C.cGray + "Dead "; + + Rank rank = Manager.GetClients().Get(sender).GetRank(); + boolean ownsUltra = false; + + if (Manager.GetGame() != null) + ownsUltra= Manager.GetDonation().Get(sender.getName()).OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA"); + + //Rank Prefix + String rankStr = ""; + if (rank != Rank.ALL) + rankStr = rank.Color + C.Bold + rank.Name.toUpperCase() + " "; + + if (ownsUltra && !rank.Has(Rank.ULTRA)) + rankStr = Rank.ULTRA.Color + C.Bold + Rank.ULTRA.Name.toUpperCase() + " "; + + //Base Format + event.setFormat(dead + rankStr + Manager.GetColor(sender) + "%1$s " + ChatColor.WHITE + "%2$s"); + + //Public/Private (Not If Player Dead) + if (Manager.GetGame() != null && Manager.GetGame().GetState() == GameState.Live) + { + boolean globalMessage = false; + + //Team + GameTeam team = Manager.GetGame().GetTeam(sender); + + if (team != null) + { + //Team Chat + if (event.getMessage().charAt(0) == '@') + { + event.setMessage(event.getMessage().substring(1, event.getMessage().length())); + event.setFormat(C.cWhite + C.Bold + "Team" + " " + dead + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s"); + } + //All Chat + else + { + globalMessage = true; + event.setFormat(dead + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s"); + } + } + + if (globalMessage) + return; + + //Team Message Remove Recipient + Iterator recipientIterator = event.getRecipients().iterator(); + + while (recipientIterator.hasNext()) + { + Player receiver = recipientIterator.next(); + + if (Manager.GetClients().Get(receiver).GetRank().Has(Rank.MODERATOR)) + continue; + + if (Manager.GetGame().GetTeam(receiver) != null && Manager.GetGame().GetTeam(sender) != Manager.GetGame().GetTeam(receiver)) + recipientIterator.remove(); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java new file mode 100644 index 000000000..d825691a7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java @@ -0,0 +1,177 @@ +package nautilus.game.arcade.managers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.AsymTeamGame; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.Game.GameState; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; + +public class GameCreationManager implements Listener +{ + ArcadeManager Manager; + + private ArrayList _ended = new ArrayList(); + + private GameType _nextGame = null; + private HashMap _nextGameTeams = null; + + private String _lastMap = ""; + private GameType _lastGame = GameType.SnowFight; + + public GameCreationManager(ArcadeManager manager) + { + Manager = manager; + + Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin()); + } + + public String GetLastMap() + { + return _lastMap; + } + + public void SetLastMap(String file) + { + _lastMap = file; + } + + @EventHandler + public void NextGame(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (Manager.GetGameList().isEmpty()) + return; + + if (Manager.GetGame() == null && _ended.isEmpty()) + { + CreateGame(null); + } + + //Archive Game + if (Manager.GetGame() != null) + { + if (Manager.GetGame().GetState() == GameState.Dead) + { + HandlerList.unregisterAll(Manager.GetGame()); + + //Schedule Cleanup + _ended.add(Manager.GetGame()); + + //Lobby Display + Manager.GetLobby().DisplayLast(Manager.GetGame()); + + //Prepare Round 2 - If Applicable + if (Manager.GetGame() instanceof AsymTeamGame) + { + if (((AsymTeamGame) Manager.GetGame()).GetPastTeams() == null) + { + _nextGame = Manager.GetGame().GetType(); + _nextGameTeams = new HashMap(); + + for (GameTeam team : Manager.GetGame().GetTeamList()) + for (Player player : team.GetPlayers(false)) + _nextGameTeams.put(player.getName(), team.GetColor()); + } + } + + Manager.SetGame(null); + } + } + + //Clean Archived Games + Iterator gameIterator = _ended.iterator(); + + while (gameIterator.hasNext()) + { + Game game = gameIterator.next(); + + HandlerList.unregisterAll(game); + + //Cleaned + if (game.WorldData == null) + { + gameIterator.remove(); + continue; + } + + if (game.WorldData.World == null) + { + gameIterator.remove(); + continue; + } + + //Kick Players + if (UtilTime.elapsed(game.GetStateTime(), 10000)) + { + for (Player player : game.WorldData.World.getPlayers()) + player.kickPlayer("Dead World"); + } + + //Clean + if (game.WorldData.World.getPlayers().isEmpty()) + { + game.WorldData.Uninitialize(); + game.WorldData = null; + } + } + } + + private void CreateGame(GameType gameType) + { + HashMap pastTeams = null; + + //Round 2 + if (_nextGame != null && _nextGameTeams != null) + { + gameType = _nextGame; + pastTeams = _nextGameTeams; + + _nextGame = null; + _nextGameTeams = null; + } + + //Pick Game + if (gameType == null) + { + for (int i=0 ; i<50 ; i++) + { + gameType = Manager.GetGameList().get(UtilMath.r(Manager.GetGameList().size())); + + if (gameType != _lastGame) + break; + } + } + + _lastGame = gameType; + + //Make Game + Manager.SetGame(Manager.GetGameFactory().CreateGame(gameType, pastTeams)); + + if (Manager.GetGame() == null) + { + return; + } + + Manager.GetLobby().DisplayNext(Manager.GetGame(), pastTeams); + + UtilServer.getServer().getPluginManager().registerEvents(Manager.GetGame(), Manager.GetPlugin()); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java new file mode 100644 index 000000000..2097cf2cc --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -0,0 +1,700 @@ +package nautilus.game.arcade.managers; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.PlayerDeathOutEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameTeam.PlayerState; + +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +public class GameFlagManager implements Listener +{ + ArcadeManager Manager; + + public GameFlagManager(ArcadeManager manager) + { + Manager = manager; + + Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin()); + } + + @EventHandler(priority = EventPriority.LOW) + public void DamageEvent(CustomDamageEvent event) + { + Game game = Manager.GetGame(); + if (game == null) + { + event.SetCancelled("Game Null"); + return; + } + + LivingEntity damagee = event.GetDamageeEntity(); + LivingEntity damager = event.GetDamagerEntity(true); + + if (damagee != null && damagee.getWorld().getName().equals("world")) + { + event.SetCancelled("In Lobby"); + + if (event.GetCause() == DamageCause.VOID) + damagee.teleport(Manager.GetLobby().GetSpawn()); + + return; + } + + if (!game.Damage) + { + event.SetCancelled("Damage Disabled"); + return; + } + + if (game.GetState() != GameState.Live) + { + event.SetCancelled("Game not Live"); + return; + } + + if (damagee != null && damagee instanceof Player && !game.IsAlive((Player)damagee)) + { + event.SetCancelled("Damagee Not Playing"); + return; + } + + if (damager != null && damager instanceof Player && !game.IsAlive((Player)damager)) + { + event.SetCancelled("Damager Not Playing"); + return; + } + + //Entity vs Entity + if (damagee != null && damager != null) + { + //PvP + if (damagee instanceof Player && damager instanceof Player) + { + if (!Manager.CanHurt((Player)damagee, (Player)damager)) + { + event.SetCancelled("Damage Rules"); + return; + } + } + //PvE + else if (damager instanceof Player) + { + if (!game.DamagePvE) + { + event.SetCancelled("PvE Disabled"); + return; + } + } + //EvP + else if (damagee instanceof Player) + { + if (!game.DamageEvP) + { + event.SetCancelled("EvP Disabled"); + return; + } + } + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void DamageExplosion(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_EXPLOSION && event.GetCause() != DamageCause.BLOCK_EXPLOSION) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + if (Manager.CanHurt(damagee, damager)) + return; + + event.SetCancelled("Allied Explosion"); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void PlayerDeath(PlayerDeathEvent event) + { + Game game = Manager.GetGame(); + if (game == null) return; + + final Player player = event.getEntity(); + + player.setFireTicks(0); + player.setFallDistance(0); + + //Drop Items + if (game.DeathDropItems) + for (ItemStack stack : event.getDrops()) + player.getWorld().dropItem(player.getLocation(), stack); + event.getDrops().clear(); + + //Player State + if (game.GetState() == GameState.Live && game.DeathOut) + { + //Event + PlayerDeathOutEvent outEvent = new PlayerDeathOutEvent(game, player); + UtilServer.getServer().getPluginManager().callEvent(outEvent); + + if (!outEvent.isCancelled()) + { + game.SetPlayerState(player, PlayerState.OUT); + } + } + + //Teleport + if (game.IsAlive(player)) + { + game.RespawnPlayer(player); + player.setVelocity(new Vector(0,0,0)); + } + else + { + game.SetSpectator(player); + player.setVelocity(new Vector(0,0,0)); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void ItemPickupEvent(PlayerPickupItemEvent event) + { + Player player = event.getPlayer(); + + Game game = Manager.GetGame(); + + if (game == null || !game.IsAlive(player) || game.GetState() != GameState.Live) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + { + event.setCancelled(true); + } + + return; + } + + + if (game.ItemPickup) + { + if (game.ItemPickupDeny.contains(event.getItem().getItemStack().getTypeId())) + { + event.setCancelled(true); + } + } + else + { + if (!game.ItemPickupAllow.contains(event.getItem().getItemStack().getTypeId())) + { + event.setCancelled(true); + } + } + + } + + @EventHandler(priority = EventPriority.LOWEST) + public void ItemDropEvent(PlayerDropItemEvent event) + { + Player player = event.getPlayer(); + + Game game = Manager.GetGame(); + if (game == null || !game.IsAlive(player) || game.GetState() != GameState.Live) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + { + event.setCancelled(true); + } + + return; + } + + if (game.ItemDrop) + { + if (game.ItemDropDeny.contains(event.getItemDrop().getItemStack().getTypeId())) + { + event.setCancelled(true); + } + } + else + { + if (!game.ItemDropAllow.contains(event.getItemDrop().getItemStack().getTypeId())) + { + event.setCancelled(true); + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void BlockPlaceEvent(BlockPlaceEvent event) + { + Player player = event.getPlayer(); + + Game game = Manager.GetGame(); + if (game == null) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + else + { + if (!game.IsAlive(player)) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + else + { + if (game.BlockPlace) + { + if (game.BlockPlaceDeny.contains(event.getBlock().getTypeId())) + { + event.setCancelled(true); + } + } + else + { + if (!game.BlockPlaceAllow.contains(event.getBlock().getTypeId())) + { + event.setCancelled(true); + } + } + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void BlockBreakEvent(org.bukkit.event.block.BlockBreakEvent event) + { + Player player = event.getPlayer(); + + Game game = Manager.GetGame(); + if (game == null) + { + if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + else if (game.GetState() == GameState.Live) + { + if (!game.IsAlive(player)) + { + event.setCancelled(true); + } + else + { + if (game.BlockBreak) + { + if (game.BlockBreakDeny.contains(event.getBlock().getTypeId())) + { + event.setCancelled(true); + } + + } + else + { + if (!game.BlockBreakAllow.contains(event.getBlock().getTypeId())) + { + event.setCancelled(true); + } + } + } + } + else + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void PrivateBlockPlace(BlockPlaceEvent event) + { + Game game = Manager.GetGame(); + if (game == null) return; + + if (!game.PrivateBlocks) + return; + + if (event.isCancelled()) + return; + + if (!UtilBlock.usable(event.getBlockPlaced())) + return; + + if (event.getBlockPlaced().getType() != Material.CHEST && + event.getBlockPlaced().getType() != Material.FURNACE && + event.getBlockPlaced().getType() != Material.BURNING_FURNACE && + event.getBlockPlaced().getType() != Material.WORKBENCH) + return; + + String privateKey = event.getPlayer().getName(); + + //Add Empty + if (!game.PrivateBlockCount.containsKey(privateKey)) + game.PrivateBlockCount.put(privateKey, 0); + + if (game.PrivateBlockCount.get(privateKey) == 4) + return; + + if (game.PrivateBlockCount.get(privateKey) > 1) + { + if (!Manager.GetDonation().Get(privateKey).OwnsUnknownPackage( + Manager.GetServerConfig().ServerType + " ULTRA") && + !Manager.GetClients().Get(privateKey).GetRank().Has(Rank.ULTRA)) + return; + } + + game.PrivateBlockMap.put(event.getBlockPlaced().getLocation(), event.getPlayer()); + game.PrivateBlockCount.put(event.getPlayer().getName(), game.PrivateBlockCount.get(event.getPlayer().getName()) + 1); + event.getPlayer().sendMessage(F.main(game.GetName(), "Can't touch this. Na na nana!")); + + if (game.PrivateBlockCount.get(privateKey) == 4) + { + event.getPlayer().sendMessage(F.main(game.GetName(), "Protected block limit reached. Stay classy Ultra ranker ;)")); + } + else if (game.PrivateBlockCount.get(privateKey) == 2) + { + if (!Manager.GetDonation().Get(privateKey).OwnsUnknownPackage( + Manager.GetServerConfig().ServerType + " ULTRA") && + !Manager.GetClients().Get(privateKey).GetRank().Has(Rank.ULTRA)) + { + event.getPlayer().sendMessage(F.main(game.GetName(), "Protected block limit reached. Thieves are scary, get Ultra for 2 extra protected blocks!")); + } + } + } + + @EventHandler(priority = EventPriority.LOW) + public void PrivateBlockPlaceCancel(BlockPlaceEvent event) + { + Game game = Manager.GetGame(); + if (game == null) return; + + if (!game.PrivateBlocks) + return; + + if (event.isCancelled()) + return; + + Block block = event.getBlockPlaced(); + + if (block.getType() != Material.CHEST) + return; + + Player player = event.getPlayer(); + + BlockFace[] faces = new BlockFace[] {BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST}; + + for (BlockFace face : faces) + { + Block other = block.getRelative(face); + + if (other.getType() != Material.CHEST) + continue; + + if (!game.PrivateBlockMap.containsKey(other.getLocation())) + continue; + + Player owner = game.PrivateBlockMap.get(other.getLocation()); + + if (player.equals(owner)) + continue; + + //Allow Enemy Raiding + GameTeam ownerTeam = game.GetTeam(owner); + GameTeam playerTeam = game.GetTeam(player); + + if (ownerTeam != null && playerTeam != null && !ownerTeam.equals(playerTeam)) + continue; + + //Disallow + UtilPlayer.message(event.getPlayer(), F.main("Game", + "You cannot combine " + + F.elem(C.cPurple + ItemStackFactory.Instance.GetName(event.getBlock(), false)) + + " with " + F.elem(Manager.GetColor(owner) + owner.getName() + "."))); + + event.setCancelled(true); + return; + } + } + + @EventHandler(priority = EventPriority.NORMAL) + public void PrivateBlockBreak(org.bukkit.event.block.BlockBreakEvent event) + { + Game game = Manager.GetGame(); + if (game == null) return; + + if (!game.PrivateBlocks) + return; + + if (event.isCancelled()) + return; + + if (!game.PrivateBlockMap.containsKey(event.getBlock().getLocation())) + return; + + Player owner = game.PrivateBlockMap.get(event.getBlock().getLocation()); + Player player = event.getPlayer(); + + //Same Team (or no team) + if (owner.equals(player)) + { + game.PrivateBlockMap.remove(event.getBlock().getLocation()); + } + else + { + //Allow Enemy Raiding + GameTeam ownerTeam = game.GetTeam(owner); + GameTeam playerTeam = game.GetTeam(player); + + if (ownerTeam != null && playerTeam != null && !ownerTeam.equals(playerTeam)) + return; + + //Disallow + UtilPlayer.message(event.getPlayer(), F.main("Game", + F.elem(C.cPurple + ItemStackFactory.Instance.GetName(event.getBlock(), false)) + + " belongs to " + F.elem(Manager.GetColor(owner) + owner.getName() + "."))); + + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void PrivateBlockUse(PlayerInteractEvent event) + { + Game game = Manager.GetGame(); + if (game == null) return; + + if (!game.PrivateBlocks) + return; + + if (event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (!UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getClickedBlock().getType() != Material.CHEST && + event.getClickedBlock().getType() != Material.FURNACE && + event.getClickedBlock().getType() != Material.BURNING_FURNACE) + return; + + if (!game.PrivateBlockMap.containsKey(event.getClickedBlock().getLocation())) + return; + + Player owner = game.PrivateBlockMap.get(event.getClickedBlock().getLocation()); + Player player = event.getPlayer(); + + if (owner.equals(player)) + { + return; + } + else + { + //Allow Enemy Raiding + GameTeam ownerTeam = game.GetTeam(owner); + GameTeam playerTeam = game.GetTeam(player); + + if (ownerTeam != null && playerTeam != null && !ownerTeam.equals(playerTeam)) + return; + + //Disallow + UtilPlayer.message(event.getPlayer(), F.main("Game", + F.elem(C.cPurple + ItemStackFactory.Instance.GetName(event.getClickedBlock(), false)) + + " belongs to " + F.elem(Manager.GetColor(owner) + owner.getName() + "."))); + + event.setCancelled(true); + } + } + + @EventHandler + public void PlayerMoveCancel(PlayerMoveEvent event) + { + Game game = Manager.GetGame(); + if (game == null || game.GetState() != GameState.Prepare) + return; + + if (!game.PrepareFreeze) + return; + + if (UtilMath.offset(event.getFrom(), event.getTo()) <= 0) + return; + + event.getFrom().setPitch(event.getTo().getPitch()); + event.getFrom().setYaw(event.getTo().getYaw()); + + event.setTo(event.getFrom()); + } + + @EventHandler + public void PlayerHealthFoodUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + Game game = Manager.GetGame(); + + //Not Playing + for (Player player : UtilServer.getPlayers()) + { + if (game == null || game.GetState() != GameState.Live || !game.IsAlive(player)) + { + player.setHealth(20); + player.setFoodLevel(20); + } + } + + if (game == null) + return; + + if (game.HungerSet != -1) + for (Player player : game.GetPlayers(true)) + player.setFoodLevel(game.HungerSet); + + if (game.HealthSet != -1) + for (Player player : game.GetPlayers(true)) + player.setHealth(game.HealthSet); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void PlayerBoundaryCheck(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + Game game = Manager.GetGame(); + if (game == null || game.GetState() != GameState.Live) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (player.getLocation().getX() > game.WorldData.MaxX || + player.getLocation().getX() < game.WorldData.MinX || + player.getLocation().getZ() > game.WorldData.MaxZ || + player.getLocation().getZ() < game.WorldData.MinZ || + (game.WorldHeightLimit > 0 && player.getLocation().getY() > game.WorldHeightLimit && game.IsAlive(player))) + { + if (!Manager.IsAlive(player)) + { + player.teleport(game.GetSpectatorLocation()); + } + else + { + UtilPlayer.message(player, C.cRed + C.Bold + "WARNING: " + C.cWhite + C.Bold +"RETURN TO PLAYABLE AREA!"); + + Manager.GetDamage().NewDamageEvent(player, null, null, + DamageCause.VOID, 4, true, false, false, + "Void", "Void Damage"); + + player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f); + player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f); + } + } + } + } + + @EventHandler(priority = EventPriority.LOW) + public void WorldCreature(CreatureSpawnEvent event) + { + Game game = Manager.GetGame(); + if (game == null) return; + + if (!game.CreatureAllow && !game.CreatureAllowOverride) + { + if (game.WorldData != null) + { + if (game.WorldData.World != null) + { + if (event.getLocation().getWorld().equals(game.WorldData.World)) + { + event.setCancelled(true); + } + } + } + } + } + + @EventHandler + public void WorldTime(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Game game = Manager.GetGame(); + if (game == null) return; + + if (game.WorldTimeSet != -1) + { + if (game.WorldData != null) + { + if (game.WorldData.World != null) + { + game.WorldData.World.setTime(game.WorldTimeSet); + } + } + } + } + + @EventHandler + public void WorldWaterDamage(UpdateEvent event) + { + Game game = Manager.GetGame(); + if (game == null) return; + + if (game.WaterDamage <= 0) + return; + + if (!game.IsLive()) + return; + + if (event.getType() != UpdateType.FAST) + return; + + for (GameTeam team : game.GetTeamList()) + for (Player player : team.GetPlayers(true)) + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + //Damage Event + Manager.GetDamage().NewDamageEvent(player, null, null, + DamageCause.DROWNING, 4, true, false, false, + "Water", "Water Damage"); + + player.getWorld().playSound(player.getLocation(), + Sound.SPLASH, 0.8f, + 1f + (float) Math.random() / 2); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java new file mode 100644 index 000000000..2e4beb866 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java @@ -0,0 +1,198 @@ +package nautilus.game.arcade.managers; + +import java.util.HashMap; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.minecraft.game.core.combat.CombatComponent; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import nautilus.game.arcade.ArcadeFormat; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GemData; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameTeam.PlayerState; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerQuitEvent; + +public class GameGemManager implements Listener +{ + ArcadeManager Manager; + + public GameGemManager(ArcadeManager manager) + { + Manager = manager; + + Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin()); + } + + @EventHandler + public void PlayerKillAward(CombatDeathEvent event) + { + Game game = Manager.GetGame(); + if (game == null) return; + + if (!(event.GetEvent().getEntity() instanceof Player)) + return; + + Player killed = (Player)event.GetEvent().getEntity(); + + if (event.GetLog().GetKiller() != null) + { + Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + + if (killer != null && !killer.equals(killed)) + { + //Kill + game.AddGems(killer, game.GetKillsGems(killer, killed, false), "Kills", true); + + //First Kill + if (game.FirstKill) + { + game.AddGems(killer, 10, "First Blood", false); + + game.FirstKill = false; + + game.Announce(F.main("Game", Manager.GetColor(killer) + killer.getName() + " drew first blood!")); + } + } + } + + for (CombatComponent log : event.GetLog().GetAttackers()) + { + if (event.GetLog().GetKiller() != null && log.equals(event.GetLog().GetKiller())) + continue; + + Player assist = UtilPlayer.searchExact(log.GetName()); + + //Assist + if (assist != null) + game.AddGems(assist, game.GetKillsGems(assist, killed, true), "Kill Assists", true); + } + } + + @EventHandler + public void PlayerQuit(PlayerQuitEvent event) + { + Game game = Manager.GetGame(); + if (game == null) return; + + RewardGems(game, event.getPlayer(), true); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void PlayerStateChange(PlayerStateChangeEvent event) + { + if (event.GetState() != PlayerState.OUT) + return; + + RewardGems(event.GetGame(), event.GetPlayer(), false); + } + + @EventHandler + public void GameStateChange(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Dead) + return; + + for (Player player : UtilServer.getPlayers()) + RewardGems(event.GetGame(), player, true); + } + + public void RewardGems(Game game, Player player, boolean give) + { + //Inform Gems + AnnounceGems(game, player, game.GetPlayerGems().get(player), give); + + //Give Gems + if (give) + GiveGems(player, game.GetPlayerGems().remove(player)); + } + + public void GiveGems(Player player, HashMap gems) + { + if (gems == null) + return; + + int total = 0; + + for (GemData data : gems.values()) + total += (int)data.Gems; + + if (total <= 0) + total = 1; + + if (Manager.GetClients().Get(player).GetRank().Has(Rank.ULTRA) || Manager.GetDonation().Get(player.getName()).OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA")) + total = total * 2; + + Manager.GetDonation().RewardGems(player.getName(), total); + } + + public void AnnounceGems(Game game, Player player, HashMap gems, boolean give) + { + if (gems == null) + return; + + player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f); + + UtilPlayer.message(player, ""); + UtilPlayer.message(player, ArcadeFormat.Line); + + UtilPlayer.message(player, "§aGame - §f§l" + game.GetName()); + UtilPlayer.message(player, ""); + + int earnedGems = 0; + + for (String type : gems.keySet()) + { + int gemCount = (int)gems.get(type).Gems; + if (gemCount <= 0) + gemCount = 1; + + earnedGems += gemCount; + + int amount = gems.get(type).Amount; + String amountStr = ""; + if (amount > 0) + amountStr = amount + " "; + + UtilPlayer.message(player, F.elem(C.cGreen + "+" + gemCount + " Gems") + " for " + F.elem(amountStr + type)); + } + + if (Manager.GetClients().Get(player).GetRank().Has(Rank.ULTRA) || Manager.GetDonation().Get(player.getName()).OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA")) + { + UtilPlayer.message(player, F.elem(C.cGreen + "+" + earnedGems + " Gems") + " for " + F.elem(C.cAqua + "Ultra Rank 2x Gems")); + earnedGems = earnedGems * 2; + } + + UtilPlayer.message(player, ""); + if (give) + { + UtilPlayer.message(player, F.elem(C.cWhite + "§lYou now have " + + C.cGreen + C.Bold + (Manager.GetDonation().Get(player.getName()).GetGems() + earnedGems) + " Gems")); + } + else + { + UtilPlayer.message(player, F.elem(C.cWhite + "§lGame is still in progress...")); + UtilPlayer.message(player, F.elem(C.cWhite + "§lYou may earn more " + C.cGreen + C.Bold + "Gems" + C.cWhite + C.Bold + " when its completed.")); + } + + + UtilPlayer.message(player, ArcadeFormat.Line); + } + + public double GetScale(Game game) + { + return 0.25 + (0.75 * ((double)game.GetPlayerCountAtStart() / (double)Manager.GetPlayerFull())); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java new file mode 100644 index 000000000..bfce228a5 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java @@ -0,0 +1,860 @@ +package nautilus.game.arcade.managers; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.DyeColor; +import org.bukkit.FireworkEffect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.entity.Sheep; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.scoreboard.DisplaySlot; +import org.bukkit.scoreboard.Objective; +import org.bukkit.scoreboard.Scoreboard; +import org.bukkit.scoreboard.Team; + +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.common.util.UtilText.TextAlign; +import mineplex.core.donation.Donor; +import mineplex.core.packethandler.IPacketRunnable; +import mineplex.core.packethandler.PacketArrayList; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.AsymTeamGame; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import net.minecraft.server.v1_6_R2.DataWatcher; +import net.minecraft.server.v1_6_R2.Packet; +import net.minecraft.server.v1_6_R2.Packet24MobSpawn; +import net.minecraft.server.v1_6_R2.Packet40EntityMetadata; +import net.minecraft.server.v1_6_R2.WatchableObject; + +public class GameLobbyManager implements IPacketRunnable, Listener +{ + public ArcadeManager Manager; + + private Location _gameText; + private Location _advText; + private Location _kitText; + private Location _teamText; + + + private Location _kitDisplay; + private Location _teamDisplay; + + private Location spawn; + + private HashMap _kits = new HashMap(); + private HashMap _kitBlocks = new HashMap(); + + private HashMap _teams = new HashMap(); + private HashMap _teamBlocks = new HashMap(); + + private long _fireworkStart; + private Color _fireworkColor; + + private int _advertiseStage = 0; + + //Scoreboard + private NautHashMap _scoreboardMap = new NautHashMap(); + private NautHashMap _gemMap = new NautHashMap(); + private NautHashMap _kitMap = new NautHashMap(); + + private Field _packet40Metadata; + private Field _packet24MobSpawn; + + private int _oldPlayerCount = 0; + + public GameLobbyManager(ArcadeManager manager, PacketHandler packetHandler) + { + Manager = manager; + packetHandler.AddPacketRunnable(this); + + World world = UtilWorld.getWorld("world"); + + spawn = new Location(world, 0, 104, 0); + + _gameText = new Location(world, 0, 130, 50); + _kitText = new Location(world, -40, 120, 0); + _teamText = new Location(world, 40, 120, 0); + _advText = new Location(world, 0, 140, -60); + + _kitDisplay = new Location(world, -17, 101, 0); + _teamDisplay = new Location(world, 18, 101, 0); + + try + { + _packet40Metadata = Packet40EntityMetadata.class.getDeclaredField("b"); + _packet24MobSpawn = Packet24MobSpawn.class.getDeclaredField("t"); + } + catch (NoSuchFieldException e) + { + e.printStackTrace(); + } + catch (SecurityException e) + { + e.printStackTrace(); + } + + _packet40Metadata.setAccessible(true); + _packet24MobSpawn.setAccessible(true); + + Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin()); + } + + private boolean HasScoreboard(Player player) + { + return _scoreboardMap.containsKey(player); + } + + public void CreateScoreboards() + { + for (Player player : UtilServer.getPlayers()) + CreateScoreboard(player); + } + + private void CreateScoreboard(Player player) + { + _scoreboardMap.put(player, Bukkit.getScoreboardManager().getNewScoreboard()); + + Scoreboard scoreboard = _scoreboardMap.get(player); + Objective objective = scoreboard.registerNewObjective("§l" + "Lobby", "dummy"); + objective.setDisplaySlot(DisplaySlot.SIDEBAR); + + for (Rank rank : Rank.values()) + { + if (rank == Rank.ALL) + { + scoreboard.registerNewTeam(rank.Name).setPrefix(""); + } + else + { + scoreboard.registerNewTeam(rank.Name).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + ChatColor.WHITE); + } + + if (Manager.GetGame() != null && !Manager.GetGame().GetTeamList().isEmpty()) + { + for (GameTeam team : Manager.GetGame().GetTeamList()) + { + if (rank == Rank.ALL) + { + scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(team.GetColor() + ""); + } + else + { + scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + team.GetColor()); + } + } + } + } + + for (Player otherPlayer : UtilServer.getPlayers()) + { + AddPlayerToScoreboards(otherPlayer, null); + } + } + + public Collection GetScoreboards() + { + return _scoreboardMap.values(); + } + + public void WriteLine(Player player, int x, int y, int z, BlockFace face, int line, String text) + { + Location loc = player.getLocation(); + loc.setX(x); + loc.setY(y); + loc.setZ(z); + + int id = 159; + byte data = 15; + + if (player.getItemInHand() != null && player.getItemInHand().getType().isBlock() && player.getItemInHand().getType() != Material.AIR) + { + id = player.getItemInHand().getTypeId(); + data = UtilInv.GetData(player.getItemInHand()); + } + + if (line > 0) + loc.add(0, line*-6, 0); + + UtilText.MakeText(text, loc, face, id, data, TextAlign.CENTER); + + player.sendMessage("Writing: " + text + " @ " + UtilWorld.locToStrClean(loc)); + } + + public void WriteGameLine(String text, int line, int id, byte data) + { + Location loc = _gameText.clone(); + + if (line > 0) + loc.add(0, line*-6, 0); + + BlockFace face = BlockFace.WEST; + + UtilText.MakeText(text, loc, face, id, data, TextAlign.CENTER); + } + + public void WriteAdvertiseLine(String text, int line, int id, byte data) + { + Location loc = _advText.clone(); + + if (line > 0) + loc.add(0, line*-6, 0); + + BlockFace face = BlockFace.EAST; + + UtilText.MakeText(text, loc, face, id, data, TextAlign.CENTER); + } + + public void WriteKitLine(String text, int line, int id, byte data) + { + Location loc = _kitText.clone(); + + if (line > 0) + loc.add(0, line*-6, 0); + + BlockFace face = BlockFace.NORTH; + + UtilText.MakeText(text, loc, face, id, data, TextAlign.CENTER); + } + + public void WriteTeamLine(String text, int line, int id, byte data) + { + Location loc = _teamText.clone(); + + if (line > 0) + loc.add(0, line*-6, 0); + + BlockFace face = BlockFace.SOUTH; + + UtilText.MakeText(text, loc, face, id, data, TextAlign.CENTER); + } + + public Location GetSpawn() + { + return spawn.clone().add(4 - Math.random()*8, 0, 4 - Math.random()*8); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void TeamGeneration(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Recruit) + return; + + CreateTeams(event.GetGame()); + } + + public void CreateTeams(Game game) + { + //Text + WriteTeamLine("Select", 0, 159, (byte)15); + WriteTeamLine("Team", 1, 159, (byte)4); + + //Remove Old Ents + for (Entity ent : _teams.keySet()) + ent.remove(); + _teams.clear(); + + //Remove Blocks + for (Block block : _teamBlocks.keySet()) + block.setType(_teamBlocks.get(block)); + _teamBlocks.clear(); + + //Display + ArrayList teams = game.GetTeamList(); + + //Positions + double space = 6; + double offset = (teams.size()-1)*space/2d; + + for (int i=0 ; i kits = new ArrayList(); + for (Kit kit : game.GetKits()) + { + if (kit.GetAvailability() != KitAvailability.Hide) + kits.add(kit); + } + + //Positions + double space = 4; + double offset = (kits.size()-1)*space/2d; + + for (int i=0 ; i blockMap) + { + //Coloring + Block block = loc.clone().add( 0.5, 0, 0.5).getBlock(); + blockMap.put(block, block.getType()); + MapUtil.QuickChangeBlockAt(block.getLocation(), id, data); + + block = loc.clone().add(-0.5, 0, 0.5).getBlock(); + blockMap.put(block, block.getType()); + MapUtil.QuickChangeBlockAt(block.getLocation(), id, data); + + block = loc.clone().add( 0.5, 0, -0.5).getBlock(); + blockMap.put(block, block.getType()); + MapUtil.QuickChangeBlockAt(block.getLocation(), id, data); + + block = loc.clone().add(-0.5, 0, -0.5).getBlock(); + blockMap.put(block, block.getType()); + MapUtil.QuickChangeBlockAt(block.getLocation(), id, data); + + //Top + block = loc.clone().add( 0.5, 1, 0.5).getBlock(); + blockMap.put(block, block.getType()); + MapUtil.QuickChangeBlockAt(block.getLocation(), 44, (byte)5); + + block = loc.clone().add(-0.5, 1, 0.5).getBlock(); + blockMap.put(block, block.getType()); + MapUtil.QuickChangeBlockAt(block.getLocation(), 44, (byte)5); + + block = loc.clone().add( 0.5, 1, -0.5).getBlock(); + blockMap.put(block, block.getType()); + MapUtil.QuickChangeBlockAt(block.getLocation(), 44, (byte)5); + + block = loc.clone().add(-0.5, 1, -0.5).getBlock(); + blockMap.put(block, block.getType()); + MapUtil.QuickChangeBlockAt(block.getLocation(), 44, (byte)5); + + //Floor + for (int x=-2 ; x<2 ; x++) + { + for (int z=-2 ; z<2 ; z++) + { + block = loc.clone().add(x, -1, z).getBlock(); + + blockMap.put(block, block.getType()); + MapUtil.QuickChangeBlockAt(block.getLocation(), id, data); + } + } + + //Outline + for (int x=-3 ; x<3 ; x++) + { + for (int z=-3 ; z<3 ; z++) + { + block = loc.clone().add(x, -1, z).getBlock(); + + if (blockMap.containsKey(block)) + continue; + + blockMap.put(block, block.getType()); + MapUtil.QuickChangeBlockAt(block.getLocation(), 35, (byte)15); + } + } + } + + @EventHandler + public void PlayerQuit(PlayerQuitEvent event) + { + _scoreboardMap.remove(event.getPlayer()); + _gemMap.remove(event.getPlayer()); + _kitMap.remove(event.getPlayer()); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() == UpdateType.FAST) + { + spawn.getWorld().setTime(6000); + spawn.getWorld().setStorm(false); + spawn.getWorld().setThundering(false); + } + + + if (event.getType() == UpdateType.TICK) + UpdateEnts(); + + if (event.getType() == UpdateType.FASTEST) + UpdateFirework(); + + if (event.getType() == UpdateType.SEC) + RemoveInvalidEnts(); + + if (event.getType() == UpdateType.SLOW) + UpdateAdvertise(); + + ScoreboardDisplay(event); + ScoreboardSet(event); + } + + private void RemoveInvalidEnts() + { + for (Entity ent : UtilWorld.getWorld("world").getEntities()) + { + if (ent instanceof Creature) + { + if (_kits.containsKey(ent)) + continue; + + if (_teams.containsKey(ent)) + continue; + + ent.remove(); + } + } + } + + private void UpdateAdvertise() + { + if (Manager.GetGame() == null) + return; + + if (_advertiseStage == 0) + { + WriteAdvertiseLine("MINEPLEX ULTRA RANK", 0, 159, (byte)4); + WriteAdvertiseLine("UNLOCKS EVERYTHING", 1, 159, (byte)15); + WriteAdvertiseLine("IN EVERY GAME", 2, 159, (byte)15); + + WriteAdvertiseLine("www.mineplex.com", 4, 159, (byte)15); + } + else if (_advertiseStage == 1) + { + WriteAdvertiseLine("BRIDGE ULTRA RANK", 0, 159, (byte)4); + WriteAdvertiseLine("UNLOCKS EVERY KIT", 1, 159, (byte)15); + WriteAdvertiseLine("IN THE BRIDGES", 2, 159, (byte)15); + + WriteAdvertiseLine("www.mineplex.com", 4, 159, (byte)15); + } + + + _advertiseStage = (_advertiseStage+1)%2; + } + + public void UpdateEnts() + { + for (Entity ent : _kits.keySet()) + ent.teleport(_kits.get(ent).GetLocation()); + + for (Entity ent : _teams.keySet()) + ent.teleport(_teams.get(ent).GetLocation()); + } + + public Kit GetClickedKit(Entity clicked) + { + for (LobbyEnt ent : _kits.values()) + if (clicked.equals(ent.GetEnt())) + return ent.GetKit(); + + return null; + } + + public GameTeam GetClickedTeam(Entity clicked) + { + for (LobbyEnt ent : _teams.values()) + if (clicked.equals(ent.GetEnt())) + return ent.GetTeam(); + + return null; + } + + public void RegisterFireworks(GameTeam winnerTeam) + { + if (winnerTeam != null) + { + _fireworkColor = Color.GREEN; + if (winnerTeam.GetColor() == ChatColor.RED) _fireworkColor = Color.RED; + if (winnerTeam.GetColor() == ChatColor.AQUA) _fireworkColor = Color.BLUE; + if (winnerTeam.GetColor() == ChatColor.YELLOW) _fireworkColor = Color.YELLOW; + + _fireworkStart = System.currentTimeMillis(); + } + } + + public void UpdateFirework() + { + if (UtilTime.elapsed(_fireworkStart, 10000)) + return; + + FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(_fireworkColor).with(Type.BALL_LARGE).trail(false).build(); + + try + { + Manager.GetFirework().playFirework(spawn.clone().add( + Math.random()*160-80, 30 + Math.random()*10, Math.random()*160-80), effect); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + @EventHandler + public void Combust(EntityCombustEvent event) + { + for (LobbyEnt ent : _kits.values()) + if (event.getEntity().equals(ent.GetEnt())) + { + event.setCancelled(true); + return; + } + } + + public void DisplayLast(Game game) + { + //Start Fireworks + RegisterFireworks(game.WinnerTeam); + } + + public void DisplayNext(Game game, HashMap pastTeams) + { + WriteGameLine("next game", 0, 159, (byte)4); + WriteGameLine(game.GetName(), 1, 159, (byte)14); + DisplayWaiting(); + + if (game instanceof AsymTeamGame) + { + if (pastTeams == null) WriteGameLine("Round 1 of 2", 2, 159, (byte)14); + else WriteGameLine("Round 2 of 2", 2, 159, (byte)14); + } + else WriteGameLine("", 2, 159, (byte)14); + + CreateKits(game); + CreateTeams(game); + } + + public void DisplayWaiting() + { + WriteGameLine("waiting for players", 3, 159, (byte)13); + } + + @EventHandler + public void ScoreboardDisplay(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (Manager.GetGame() != null && + (Manager.GetGame().GetState() != GameState.Loading && + Manager.GetGame().GetState() != GameState.Recruit)) + for (Player player : UtilServer.getPlayers()) + player.setScoreboard(Manager.GetGame().GetScoreboard()); + + else + { + for (Player player : UtilServer.getPlayers()) + { + if (!HasScoreboard(player)) + { + CreateScoreboard(player); + } + else + { + player.setScoreboard(_scoreboardMap.get(player)); + } + } + } + } + + @EventHandler + public void ScoreboardSet(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Entry entry : _scoreboardMap.entrySet()) + { + Objective objective = entry.getValue().getObjective("§l" + "Lobby"); + + if (Manager.GetGame() != null && Manager.GetGame().GetCountdown() >= 0) + { + if (Manager.GetGame().GetCountdown() > 0) + objective.setDisplayName(C.Bold + "§lStarting in " + C.cGreen + "§l" + Manager.GetGame().GetCountdown() + " Seconds"); + else if (Manager.GetGame().GetCountdown() == 0) + objective.setDisplayName(ChatColor.WHITE + "§lIn Progress..."); + } + else + { + objective.setDisplayName(ChatColor.GREEN + "§l" + "Waiting for Players"); + } + + int line = 14; + + objective.getScore(Bukkit.getOfflinePlayer(C.cYellow + "Max Players")).setScore(line--); + objective.getScore(Bukkit.getOfflinePlayer(Manager.GetPlayerFull() + " ")).setScore(line--); + objective.getScore(Bukkit.getOfflinePlayer(" ")).setScore(line--); + objective.getScore(Bukkit.getOfflinePlayer(C.cYellow + "Min Players")).setScore(line--); + objective.getScore(Bukkit.getOfflinePlayer(Manager.GetPlayerMin() + " ")).setScore(line--); + objective.getScore(Bukkit.getOfflinePlayer(" ")).setScore(line--); + objective.getScore(Bukkit.getOfflinePlayer(C.cYellow + "Players")).setScore(line--); + + // Remove old + entry.getValue().resetScores(Bukkit.getOfflinePlayer(_oldPlayerCount + " ")); + // Set new + objective.getScore(Bukkit.getOfflinePlayer(UtilServer.getPlayers().length + " ")).setScore(line--); + + if (Manager.GetGame() != null) + { + ChatColor teamColor = ChatColor.GRAY; + String kitName = "None"; + + if (Manager.GetGame().GetTeam(entry.getKey()) != null) + { + teamColor = Manager.GetGame().GetTeam(entry.getKey()).GetColor(); + } + + if (Manager.GetGame().GetKit(entry.getKey()) != null) + { + kitName = Manager.GetGame().GetKit(entry.getKey()).GetName() + ""; + } + + if (teamColor == null) + + //Shorten Kit Name + if (kitName.length() > 16) + kitName = kitName.substring(0, 16); + + // Remove old + entry.getValue().resetScores(Bukkit.getOfflinePlayer(C.cGray + C.Bold + "Kit")); + entry.getValue().resetScores(Bukkit.getOfflinePlayer(_kitMap.get(entry.getKey()) + "")); + + // Set new + objective.getScore(Bukkit.getOfflinePlayer(" ")).setScore(line--); + objective.getScore(Bukkit.getOfflinePlayer(teamColor + C.Bold + "Kit")).setScore(line--); + objective.getScore(Bukkit.getOfflinePlayer(kitName + "")).setScore(line--); + + _kitMap.put(entry.getKey(), kitName + ""); + } + + objective.getScore(Bukkit.getOfflinePlayer(" ")).setScore(line--); + objective.getScore(Bukkit.getOfflinePlayer(C.cGreen + C.Bold + "Gems")).setScore(line--); + + // Remove old + entry.getValue().resetScores(Bukkit.getOfflinePlayer(_gemMap.get(entry.getKey()) + " ")); + // Set new + objective.getScore(Bukkit.getOfflinePlayer(Manager.GetDonation().Get(entry.getKey().getName()).GetGems() + " ")).setScore(line--); + + _gemMap.put(entry.getKey(), Manager.GetDonation().Get(entry.getKey().getName()).GetGems()); + } + + _oldPlayerCount = UtilServer.getPlayers().length; + } + + private String GetKitCustomName(Player player, Game game, LobbyEnt ent) + { + CoreClient client = Manager.GetClients().Get(player); + Donor donor = Manager.GetDonation().Get(player.getName()); + + String entityName = ent.GetKit().GetName(); + + if (client.GetRank().Has(Rank.ULTRA) || donor.OwnsUnknownPackage(game.GetName() + " " + ent.GetKit().GetName()) || donor.OwnsUnknownPackage(game.GetName() + " ULTRA") || ent.GetKit().GetAvailability() == KitAvailability.Free) + { + entityName = ChatColor.GREEN + entityName; + } + else + { + entityName = ChatColor.RED + entityName; + + if (ent.GetKit().GetAvailability() != KitAvailability.Blue) + entityName += ChatColor.WHITE + " (" + ChatColor.GREEN + ent.GetKit().GetCost() + " Gems" + ChatColor.WHITE + ")"; + } + + if (ent.GetKit().GetAvailability() == KitAvailability.Blue) + { + entityName += ChatColor.WHITE + " (" + ChatColor.AQUA + "Ultra" + ChatColor.WHITE + ")"; + } + + return entityName; + } + + @SuppressWarnings("unchecked") + @Override + public boolean run(Packet packet, Player owner, PacketArrayList packetList) + { + int entityId = -1; + + if (packet instanceof Packet40EntityMetadata) + { + entityId = ((Packet40EntityMetadata)packet).a; + } + else if (packet instanceof Packet24MobSpawn) + { + //entityId = ((Packet24MobSpawn)packet).a; + } + + if (entityId != -1) + { + String customName = null; + + // Order important (_next and _prev overlap if games are same and will throw NPE on _game.GetName()) + for (LobbyEnt ent : _kits.values()) + { + if (ent.GetEnt().getEntityId() == entityId && Manager.GetGame() != null) + { + customName = GetKitCustomName(owner, Manager.GetGame(), ent); + break; + } + } + + if (customName != null) + { + try + { + if (packet instanceof Packet40EntityMetadata) + { + List watchables = new ArrayList(); + + for (WatchableObject watchableObject : (List)_packet40Metadata.get(packet)) + { + WatchableObject newWatch = new WatchableObject(watchableObject.c(), watchableObject.a(), watchableObject.b()); + + if (newWatch.a() == 10) + { + newWatch.a(customName); + } + + watchables.add(newWatch); + } + + Packet40EntityMetadata newPacket = new Packet40EntityMetadata(); + newPacket.a = entityId; + _packet40Metadata.set(newPacket, watchables); + + packetList.forceAdd(newPacket); + + return false; + } + else if (packet instanceof Packet24MobSpawn) + { + DataWatcher watcher = (DataWatcher)_packet24MobSpawn.get((Packet24MobSpawn)packet); + watcher.watch(10, customName); + watcher.watch(11, Byte.valueOf((byte)1)); + } + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + } + } + + return true; + } + + public void AddPlayerToScoreboards(Player player, String teamName) + { + for (Scoreboard scoreboard : GetScoreboards()) + { + for (Team team : scoreboard.getTeams()) + team.removePlayer(player); + } + + if (teamName == null) + teamName = ""; + + for (Scoreboard scoreboard : GetScoreboards()) + { + scoreboard.getTeam(Manager.GetClients().Get(player).GetRank().Name + teamName).addPlayer(player); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java new file mode 100644 index 000000000..f24b39a8d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -0,0 +1,509 @@ +package nautilus.game.arcade.managers; + +import java.util.Iterator; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.Game.GameState; + +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.FireworkEffect; +import org.bukkit.GameMode; +import org.bukkit.Sound; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerQuitEvent; + +public class GameManager implements Listener +{ + ArcadeManager Manager; + + public GameManager(ArcadeManager manager) + { + Manager = manager; + + Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin()); + } + + @EventHandler + public void StateUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + Game game = Manager.GetGame(); + if (game == null) return; + + if (game.GetState() == GameState.Loading) + { + if (UtilTime.elapsed(game.GetStateTime(), 30000)) + { + System.out.println("Game Load Expired."); + game.SetState(GameState.Dead); + } + } + else if (game.GetState() == GameState.Recruit) + { + //Stop Countdown! + if (game.GetCountdown() != -1 && + UtilServer.getPlayers().length < Manager.GetPlayerMin() && + !game.GetCountdownForce()) + { + game.SetCountdown(-1); + Manager.GetLobby().DisplayWaiting(); + } + + if (game.GetCountdown() != -1) + StateCountdown(game, -1, false); + + else if (UtilServer.getPlayers().length >= Manager.GetPlayerFull()) + StateCountdown(game, 20, false); + + else if (UtilServer.getPlayers().length >= Manager.GetPlayerMin()) + StateCountdown(game, 60, false); + } + else if (game.GetState() == GameState.Prepare) + { + if (UtilTime.elapsed(game.GetStateTime(), 9000)) + { + for (Player player : UtilServer.getPlayers()) + player.playSound(player.getLocation(), Sound.NOTE_PLING, 2f, 2f); + + if (game.GetPlayers(true).size() < 2) + { + game.Announce(C.cWhite + C.Bold + game.GetName() + " ended, not enough players!"); + game.SetState(GameState.Dead); + } + else + { + game.SetState(GameState.Live); + } + } + else + { + for (Player player : UtilServer.getPlayers()) + player.playSound(player.getLocation(), Sound.NOTE_STICKS, 1f, 1f); + } + } + else if (game.GetState() == GameState.Live) + { + if (UtilTime.elapsed(game.GetStateTime(), 1200000)) + { + game.SetState(GameState.End); + } + } + else if (game.GetState() == GameState.End) + { + if (UtilTime.elapsed(game.GetStateTime(), 10000)) + { + game.SetState(GameState.Dead); + } + } + } + + public void StateCountdown(Game game, int timer, boolean force) + { + //Always give time to pick team. + if (!game.GetCountdownForce() && !force && !UtilTime.elapsed(game.GetStateTime(), 15000)) + { + return; + } + + if (force) + game.SetCountdownForce(true); + + //Team Preference + TeamPreferenceJoin(game); + + //Team Swap + TeamPreferenceSwap(game); + + //Team Default + TeamDefaultJoin(game); + + //Team Inform STILL Queued + if (game.GetCountdown() == -1) + { + game.InformQueuePositions(); + game.AnnounceGame(); + } + + //Initialise Countdown + if (force) + game.SetCountdownForce(true); + + //Start Timer + if (game.GetCountdown() == -1) + game.SetCountdown(timer + 1); + + //Decrease Timer + if (game.GetCountdown() > timer + 1 && timer != -1) + game.SetCountdown(timer + 1); + + //Countdown-- + if (game.GetCountdown() > 0) + game.SetCountdown(game.GetCountdown() - 1); + + //Inform Countdown + if (game.GetCountdown() > 0) + { + Manager.GetLobby().WriteGameLine("starting in " + game.GetCountdown() + "...", 3, 159, (byte)13); + } + else + { + Manager.GetLobby().WriteGameLine("game in progress", 3, 159, (byte)13); + } + + if (game.GetCountdown() > 0 && game.GetCountdown() <= 10) + for (Player player : UtilServer.getPlayers()) + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 1f); + + //Countdown Ended + if (game.GetCountdown() == 0) + game.SetState(GameState.Prepare); + } + + @EventHandler + public void KitRegister(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + + event.GetGame().RegisterKits(); + } + + @EventHandler + public void KitDeregister(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Dead) + return; + + event.GetGame().DeregisterKits(); + + for (Player player : UtilServer.getPlayers()) + { + Manager.Clear(player); + Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, "Spectator"); + player.teleport(Manager.GetLobby().GetSpawn()); + } + } + + @EventHandler(priority = EventPriority.LOWEST) //BEFORE PARSE DATA + public void TeamGeneration(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Recruit) + return; + + Game game = event.GetGame(); + + for (String team : game.WorldData.SpawnLocs.keySet()) + { + ChatColor color; + + if (team.equalsIgnoreCase("RED")) color = ChatColor.RED; + else if (team.equalsIgnoreCase("YELLOW")) color = ChatColor.YELLOW; + else if (team.equalsIgnoreCase("GREEN")) color = ChatColor.GREEN; + else if (team.equalsIgnoreCase("BLUE")) color = ChatColor.AQUA; + else + { + color = ChatColor.DARK_GREEN; + + if (game.GetTeamList().size() == 0) if (game.WorldData.SpawnLocs.size() > 1) color = ChatColor.RED; + if (game.GetTeamList().size() == 1) color = ChatColor.YELLOW; + if (game.GetTeamList().size() == 2) color = ChatColor.GREEN; + if (game.GetTeamList().size() == 3) color = ChatColor.AQUA; + } + + GameTeam newTeam = new GameTeam(team, color, game.WorldData.SpawnLocs.get(team)); + game.AddTeam(newTeam); + } + + //Restrict Kits + game.RestrictKits(); + + //Parse Data + game.ParseData(); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void TeamScoreboardCreation(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Recruit) + return; + + event.GetGame().CreateScoreboardTeams(); + } + + public void TeamPreferenceJoin(Game game) + { + //Preferred Team No Longer Full + for (GameTeam team : game.GetTeamPreferences().keySet()) + { + Iterator queueIterator = game.GetTeamPreferences().get(team).iterator(); + + while (queueIterator.hasNext()) + { + Player player = queueIterator.next(); + + if (!game.CanJoinTeam(team)) + break; + + queueIterator.remove(); + + if (!game.IsPlaying(player)) + { + PlayerAdd(game, player, team); + } + else + { + game.SetPlayerTeam(player, team); + } + } + } + } + + public void TeamPreferenceSwap(Game game) + { + //Preferred Team No Longer Full + for (GameTeam team : game.GetTeamPreferences().keySet()) + { + Iterator queueIterator = game.GetTeamPreferences().get(team).iterator(); + + while (queueIterator.hasNext()) + { + Player player = queueIterator.next(); + + GameTeam currentTeam = game.GetTeam(player); + + //Not on team, cannot swap + if (currentTeam == null) + continue; + + // Other without concurrent (order doesn't matter as first case will fire + if (team == currentTeam) + { + queueIterator.remove(); + continue; + } + + for (Player other : team.GetPlayers(false)) + { + if (other.equals(player)) + continue; + + GameTeam otherPref = game.GetTeamPreference(other); + if (otherPref == null) + continue; + + if (otherPref.equals(currentTeam)) + { + UtilPlayer.message(player, F.main("Team", "You swapped team with " + F.elem(team.GetColor() + other.getName()) + ".")); + UtilPlayer.message(other, F.main("Team", "You swapped team with " + F.elem(currentTeam.GetColor() + player.getName()) + ".")); + + //Player Swap + queueIterator.remove(); + game.SetPlayerTeam(player, team); + + //Other Swap + game.SetPlayerTeam(other, currentTeam); + } + } + } + } + } + + public void TeamDefaultJoin(Game game) + { + //Team Default + for (Player player : UtilServer.getPlayers()) + { + if (player.isDead()) + { + player.kickPlayer("Kicked for being AFK"); + } + else if (!game.IsPlaying(player)) + { + PlayerAdd(game, player, null); + } + } + } + + @EventHandler + public void TeamQueueSizeUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Game game = Manager.GetGame(); + if (game == null) return; + + for (GameTeam team : game.GetTeamList()) + { + int amount = 0; + if (game.GetTeamPreferences().containsKey(team)) + { + amount = game.GetTeamPreferences().get(team).size(); + } + + if (game.GetCountdown() == -1) + { + team.GetTeamEntity().setCustomName(team.GetFormattedName() + " Team" + ChatColor.RESET + " " + amount + " Queued"); + } + else + { + team.GetTeamEntity().setCustomName(team.GetPlayers(false).size() + " Players " + team.GetFormattedName() + " Team" + ChatColor.RESET + " " + amount + " Queued"); + } + } + } + + public boolean PlayerAdd(Game game, Player player, GameTeam team) + { + if (team == null) + team = game.ChooseTeam(player); + + if (team == null) + return false; + + game.SetPlayerTeam(player, team); + + //Game Mode + player.setGameMode(GameMode.SURVIVAL); + + //Clear Inventory + UtilInv.Clear(player); + + return true; + } + + @EventHandler + public void PlayerPrepare(GameStateChangeEvent event) + { + Game game = event.GetGame(); + + if (event.GetState() != GameState.Prepare) + return; + + //Teleport + for (GameTeam team : game.GetTeamList()) + team.SpawnTeleport(); + + //Save Initial Player Count + game.SetPlayerCountAtStart(game.GetPlayers(true).size()); + + //Announce + game.AnnounceGame(); + + //Prepare Players + for (Player player : game.GetPlayers(true)) + { + Manager.Clear(player); + UtilInv.Clear(player); + + game.ValidateKit(player, game.GetTeam(player)); + + game.GetKit(player).ApplyKit(player); + } + } + + @EventHandler + public void PlayerClean(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Dead) + return; + + for (Player player : UtilServer.getPlayers()) + { + Manager.Clear(player); + player.eject(); + player.teleport(Manager.GetLobby().GetSpawn()); + } + } + + @EventHandler + public void PlayerQuit(PlayerQuitEvent event) + { + Game game = Manager.GetGame(); + if (game == null) return; + + GameTeam team = game.GetTeam(event.getPlayer()); + + if (team != null) + { + team.RemovePlayer(event.getPlayer()); + } + + //Remove Kit + game.RemoveTeamPreference(event.getPlayer()); + game.GetPlayerKits().remove(event.getPlayer()); + game.GetPlayerGems().remove(event.getPlayer()); + } + + @EventHandler + public void WorldFireworksUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) + return; + + Game game = Manager.GetGame(); + if (game == null) return; + + if (game.GetState() != GameState.End) + return; + + Color color = Color.GREEN; + + if (game.WinnerTeam != null) + { + if (game.WinnerTeam.GetColor() == ChatColor.RED) color = Color.RED; + else if (game.WinnerTeam.GetColor() == ChatColor.AQUA) color = Color.BLUE; + else if (game.WinnerTeam.GetColor() == ChatColor.YELLOW) color = Color.YELLOW; + else color = Color.LIME; + } + + FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(color).with(Type.BALL_LARGE).trail(false).build(); + + try + { + Manager.GetFirework().playFirework(game.GetSpectatorLocation().clone().add( + Math.random()*160-80, 10 + Math.random()*20, Math.random()*160-80), effect); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void EndUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + Game game = Manager.GetGame(); + if (game == null) return; + + game.EndCheck(); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void EndStateChange(PlayerStateChangeEvent event) + { + event.GetGame().EndCheck(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java new file mode 100644 index 000000000..99b2778ba --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java @@ -0,0 +1,281 @@ +package nautilus.game.arcade.managers; + +import java.util.ArrayList; + +import mineplex.core.account.CoreClient; +import mineplex.core.common.CurrencyType; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.donation.Donor; +import mineplex.core.shop.page.ConfirmationPage; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.shop.ArcadeShop; +import nautilus.game.arcade.shop.KitPackage; +import net.minecraft.server.v1_6_R2.Packet40EntityMetadata; + +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerRespawnEvent; + +public class GamePlayerManager implements Listener +{ + ArcadeManager Manager; + + public GamePlayerManager(ArcadeManager manager) + { + Manager = manager; + + Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin()); + } + + @EventHandler(priority = EventPriority.HIGH) + public void PlayerDeath(CombatDeathEvent event) + { + //Don't actually die + event.GetEvent().getEntity().setHealth(20); + + //Dont display message + if (Manager.GetGame() == null || !Manager.GetGame().DisplayDeathMessage()) + { + event.SetBroadcastDeath(false); + return; + } + + //Colors + if (event.GetLog().GetKiller() != null) + { + Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + if (player != null) + event.GetLog().SetKillerColor(Manager.GetColor(player)+""); + } + + + if (event.GetEvent().getEntity() instanceof Player) + { + Player player = (Player)event.GetEvent().getEntity(); + if (player != null) + event.GetLog().SetKilledColor(Manager.GetColor(player)+""); + } + } + + @EventHandler + public void PlayerJoin(PlayerJoinEvent event) + { + final Player player = event.getPlayer(); + + Manager.Clear(player); + + //Lobby Name + Manager.GetLobby().AddPlayerToScoreboards(player, null); + + //Lobby Spawn + if (Manager.GetGame() == null || !Manager.GetGame().InProgress()) + { + player.teleport(Manager.GetLobby().GetSpawn()); + return; + } + + //Game Spawn + if (Manager.GetGame().IsAlive(player)) + { + player.teleport(Manager.GetGame().GetTeam(player).GetSpawn()); + } + else + { + Manager.GetGame().SetSpectator(player); + UtilPlayer.message(player, F.main("Game", Manager.GetGame().GetName() + " is in progress, please wait for next game!")); + } + + player.setScoreboard(Manager.GetGame().GetScoreboard()); + } + + @EventHandler + public void PlayerRespawn(PlayerRespawnEvent event) + { + if (Manager.GetGame() == null || !Manager.GetGame().InProgress()) + { + event.setRespawnLocation(Manager.GetLobby().GetSpawn()); + return; + } + + Player player = event.getPlayer(); + + if (Manager.GetGame().IsAlive(player)) + { + event.setRespawnLocation(Manager.GetGame().GetTeam(player).GetSpawn()); + } + else + { + Manager.GetGame().SetSpectator(player); + + event.setRespawnLocation(Manager.GetGame().GetSpectatorLocation()); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void TeamInteract(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() == null) + return; + + Player player = event.getPlayer(); + + GameTeam team = Manager.GetLobby().GetClickedTeam(event.getRightClicked()); + + if (team == null) + return; + + TeamClick(player, team); + } + + @EventHandler + public void TeamDamage(CustomDamageEvent event) + { + Player player = event.GetDamagerPlayer(false); + if (player == null) return; + + LivingEntity target = event.GetDamageeEntity(); + + GameTeam team = Manager.GetLobby().GetClickedTeam(target); + + if (team == null) + return; + + TeamClick(player, team); + } + + public void TeamClick(final Player player, final GameTeam team) + { + if (Manager.GetGame() == null) + return; + + if (Manager.GetGame().GetState() != GameState.Recruit) + return; + + if (!Manager.GetGame().HasTeam(team)) + return; + + AddTeamPreference(Manager.GetGame(), player, team); + } + + public void AddTeamPreference(Game game, Player player, GameTeam team) + { + GameTeam past = game.GetTeamPreference(player); + + GameTeam current = game.GetTeam(player); + if (current != null && current.equals(team)) + { + game.RemoveTeamPreference(player); + UtilPlayer.message(player, F.main("Team", "You are already on " + F.elem(team.GetFormattedName()) + ".")); + return; + } + + if (past == null || !past.equals(team)) + { + if (past != null) + game.RemoveTeamPreference(player); + + if (!game.GetTeamPreferences().containsKey(team)) + game.GetTeamPreferences().put(team, new ArrayList()); + + game.GetTeamPreferences().get(team).add(player); + } + + UtilPlayer.message(player, F.main("Team", "You are " + F.elem(game.GetTeamQueuePosition(player)) + " in queue for " + F.elem(team.GetFormattedName() + " Team") + ".")); + } + + + @EventHandler(priority = EventPriority.HIGH) + public void KitInteract(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() == null) + return; + + Player player = event.getPlayer(); + + Kit kit = Manager.GetLobby().GetClickedKit(event.getRightClicked()); + + if (kit == null) + return; + + KitClick(player, kit, event.getRightClicked()); + } + + @EventHandler + public void KitDamage(CustomDamageEvent event) + { + Player player = event.GetDamagerPlayer(false); + if (player == null) return; + + LivingEntity target = event.GetDamageeEntity(); + + Kit kit = Manager.GetLobby().GetClickedKit(target); + + if (kit == null) + return; + + KitClick(player, kit, target); + } + + public void KitClick(final Player player, final Kit kit, final Entity entity) + { + kit.DisplayDesc(player); + + if (Manager.GetGame() == null) + return; + + if (!Manager.GetGame().HasKit(kit)) + return; + + + CoreClient client = Manager.GetClients().Get(player); + Donor donor = Manager.GetDonation().Get(player.getName()); + + if (kit.GetAvailability() == KitAvailability.Free || client.GetRank().Has(Rank.ULTRA) || donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || donor.OwnsUnknownPackage(Manager.GetGame().GetName() + " " + kit.GetName())) + { + Manager.GetGame().SetKit(player, kit, true); + } + else if (kit.GetAvailability() == KitAvailability.Green && donor.GetBalance(CurrencyType.Gems) > kit.GetCost()) + { + Manager.GetShop().OpenPageForPlayer(player, new ConfirmationPage( + Manager, Manager.GetShop(), Manager.GetClients(), Manager.GetDonation(), new Runnable() + { + public void run() + { + if (player.isOnline()) + { + Manager.GetGame().SetKit(player, kit, true); + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(new Packet40EntityMetadata(entity.getEntityId(), ((CraftEntity)entity).getHandle().getDataWatcher(), true)); + } + } + }, null, new KitPackage(Manager.GetGame().GetName(), kit), CurrencyType.Gems, player)); + } + else + { + player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f); + + if (kit.GetAvailability() == KitAvailability.Blue) + UtilPlayer.message(player, F.main("Kit", "You must purchase " + F.elem(C.cAqua + "Ultra") + " to use " + F.elem(kit.GetFormattedName() + " Kit") + ".")); + else + UtilPlayer.message(player, F.main("Kit", "You need more " + F.elem(C.cGreen + "Gems") + " for " + F.elem(kit.GetFormattedName() + " Kit") + ".")); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameWorldManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameWorldManager.java new file mode 100644 index 000000000..5f30ca95c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameWorldManager.java @@ -0,0 +1,86 @@ +package nautilus.game.arcade.managers; + +import java.util.HashSet; +import java.util.Iterator; + +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.world.WorldData; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.world.ChunkUnloadEvent; + +public class GameWorldManager implements Listener +{ + ArcadeManager Manager; + + private HashSet _worldLoader = new HashSet(); + + public GameWorldManager(ArcadeManager manager) + { + Manager = manager; + + Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin()); + } + + @EventHandler + public void LoadWorldChunks(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator worldIterator = _worldLoader.iterator(); + + long endTime = System.currentTimeMillis() + 25; + + while (worldIterator.hasNext()) + { + long timeLeft = endTime - System.currentTimeMillis(); + if (timeLeft <= 0) continue; + + final WorldData worldData = worldIterator.next(); + + if (worldData.World == null) + { + worldIterator.remove(); + } + else if (worldData.LoadChunks(timeLeft)) + { + worldData.Host.SetState(GameState.Recruit); + worldIterator.remove(); + } + } + } + + /* XXX This stops outside chunks from loading + @EventHandler + public void ChunkLoad(ChunkPreLoadEvent event) + { + if (Manager.GetGame() != null) + if (Manager.GetGame().WorldData != null) + Manager.GetGame().WorldData.ChunkLoad(event); + } + */ + + @EventHandler + public void ChunkUnload(ChunkUnloadEvent event) + { + if (event.getWorld().getName().equals("world")) + { + event.setCancelled(true); + return; + } + + if (Manager.GetGame() != null) + if (Manager.GetGame().WorldData != null) + Manager.GetGame().WorldData.ChunkUnload(event); + } + + public void RegisterWorld(WorldData worldData) + { + _worldLoader.add(worldData); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/LobbyEnt.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/LobbyEnt.java new file mode 100644 index 000000000..0c59f687e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/LobbyEnt.java @@ -0,0 +1,49 @@ +package nautilus.game.arcade.managers; + +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.kit.Kit; + +import org.bukkit.Location; +import org.bukkit.entity.Entity; + +public class LobbyEnt +{ + private Kit _kit; + private GameTeam _team; + private Entity _ent; + private Location _loc; + + public LobbyEnt(Entity ent, Location loc, Kit kit) + { + _ent = ent; + _loc = loc; + _kit = kit; + } + + public LobbyEnt(Entity ent, Location loc, GameTeam team) + { + _ent = ent; + _loc = loc; + _team = team; + } + + public Kit GetKit() + { + return _kit; + } + + public GameTeam GetTeam() + { + return _team; + } + + public Entity GetEnt() + { + return _ent; + } + + public Location GetLocation() + { + return _loc; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java new file mode 100644 index 000000000..cac64d1f8 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java @@ -0,0 +1,131 @@ +package nautilus.game.arcade.managers; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.PrepareItemCraftEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.CraftingInventory; + +public class MiscManager implements Listener +{ + ArcadeManager Manager; + + public MiscManager(ArcadeManager manager) + { + Manager = manager; + + Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin()); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void InteractActive(PlayerInteractEvent event) + { + event.setCancelled(false); + } + + @EventHandler(priority = EventPriority.LOW) + public void InteractClickCancel(PlayerInteractEvent event) + { + if (Manager.GetGame() == null) + return; + + Player player = event.getPlayer(); + + if (!Manager.GetGame().IsAlive(player)) + { + event.setCancelled(true); + } + else if (event.getPlayer().getItemInHand().getType() == Material.INK_SACK && event.getPlayer().getItemInHand().getData().getData() == (byte)15) + { + if (event.getAction() == Action.RIGHT_CLICK_BLOCK) + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void InventoryClickCancel(InventoryClickEvent event) + { + if (Manager.GetGame() == null) + return; + + Player player = UtilPlayer.searchExact(event.getWhoClicked().getName()); + + if (Manager.GetGame().IsLive() && !Manager.GetGame().IsAlive(player)) + { + event.setCancelled(true); + player.closeInventory(); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void CraftingDeny(PrepareItemCraftEvent event) + { + if (event.getRecipe().getResult() == null) + return; + + Material type = event.getRecipe().getResult().getType(); + + if (type != Material.GOLDEN_APPLE && + type != Material.GOLDEN_CARROT && + type != Material.FLINT_AND_STEEL) + return; + + if (!(event.getInventory() instanceof CraftingInventory)) + return; + + CraftingInventory inv = (CraftingInventory)event.getInventory(); + inv.setResult(null); + } + + @EventHandler + public void SpectatorMessage(UpdateEvent event) + { + if (Manager.GetGame() == null) + return; + + if (!Manager.GetGame().IsLive()) + return; + + if (event.getType() != UpdateType.SLOWER) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (Manager.IsAlive(player)) + continue; + + UtilPlayer.message(player, C.cYellow + C.Bold + "You are out of the game, but " + C.cGold + C.Bold + "DON'T QUIT" + C.cYellow + C.Bold + "!"); + UtilPlayer.message(player, C.cYellow + C.Bold + "The next game will be starting soon..."); + } + } + + @EventHandler + public void EnsureHubClock(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (Manager.GetGame() == null || !Manager.GetGame().IsAlive(player)) + { + if (!player.getInventory().contains(Material.WATCH)) + { + Manager.HubClock(player); + } + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ore/OreHider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ore/OreHider.java new file mode 100644 index 000000000..12379e07f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ore/OreHider.java @@ -0,0 +1,89 @@ +package nautilus.game.arcade.ore; + +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.explosion.ExplosionEvent; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.event.block.BlockBreakEvent; + +public class OreHider +{ + private NautHashMap _hidden = new NautHashMap(); + private boolean _visible = false; + + public void AddOre(Location loc, Material type) + { + boolean visible = false; + + for (Block block : UtilBlock.getSurrounding(loc.getBlock())) + { + if (!block.getType().isOccluding()) + { + visible = true; + break; + } + } + + if (visible) + { + loc.getBlock().setType(type); + } + else + { + _hidden.put(loc.getBlock().getLocation(), type); + } + } + + public void BlockBreak(BlockBreakEvent event) + { + for (Block block : UtilBlock.getSurrounding(event.getBlock())) + { + if (_hidden.containsKey(block.getLocation())) + { + block.setType(_hidden.remove(block.getLocation())); + } + } + } + + public void Explosion(ExplosionEvent event) + { + for (Block cur : event.GetBlocks()) + { + for (Block block : UtilBlock.getSurrounding(cur)) + { + if (_hidden.containsKey(block.getLocation())) + { + block.setType(_hidden.remove(block.getLocation())); + } + } + } + } + + public void ToggleVisibility() + { + if (!_visible) + { + for (Location loc : _hidden.keySet()) + { + loc.getBlock().setType(_hidden.get(loc)); + } + } + else + { + for (Location loc : _hidden.keySet()) + { + loc.getBlock().setType(Material.STONE); + } + } + + _visible = !_visible; + } + + public NautHashMap GetHiddenOre() + { + return _hidden; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ore/OreObsfucation.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ore/OreObsfucation.java new file mode 100644 index 000000000..8b40505f5 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ore/OreObsfucation.java @@ -0,0 +1,7 @@ +package nautilus.game.arcade.ore; + + +public interface OreObsfucation +{ + public OreHider GetOreHider(); +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/player/ArcadePlayer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/player/ArcadePlayer.java new file mode 100644 index 000000000..7b5021ae5 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/player/ArcadePlayer.java @@ -0,0 +1,6 @@ +package nautilus.game.arcade.player; + +public class ArcadePlayer +{ + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/shop/ArcadeShop.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/shop/ArcadeShop.java new file mode 100644 index 000000000..08bad8c30 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/shop/ArcadeShop.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.shop; + +import org.bukkit.entity.Player; + +import nautilus.game.arcade.ArcadeManager; +import mineplex.core.account.CoreClientManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.common.CurrencyType; +import mineplex.core.shop.ShopBase; +import mineplex.core.shop.page.ShopPageBase; + +public class ArcadeShop extends ShopBase +{ + public ArcadeShop(ArcadeManager plugin, CoreClientManager clientManager, DonationManager donationManager) + { + super(plugin, clientManager, donationManager, "Shop", CurrencyType.Gems); + } + + @Override + protected ShopPageBase> BuildPagesFor(Player player) + { + return null; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/shop/KitPackage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/shop/KitPackage.java new file mode 100644 index 000000000..af3095431 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/shop/KitPackage.java @@ -0,0 +1,23 @@ +package nautilus.game.arcade.shop; + +import org.bukkit.entity.Player; + +import nautilus.game.arcade.kit.Kit; +import mineplex.core.common.CurrencyType; +import mineplex.core.shop.item.SalesPackageBase; + +public class KitPackage extends SalesPackageBase +{ + public KitPackage(String gameName, Kit kit) + { + super(gameName + " " + kit.GetName(), kit.GetItemInHand().getType(), kit.GetDesc()); + KnownPackage = false; + CurrencyCostMap.put(CurrencyType.Gems, 2000); + } + + @Override + public void Sold(Player player, CurrencyType currencyType) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/FireworkHandler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/FireworkHandler.java new file mode 100644 index 000000000..00207e573 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/FireworkHandler.java @@ -0,0 +1,60 @@ +package nautilus.game.arcade.world; + +import java.lang.reflect.Method; + +import org.bukkit.FireworkEffect; +import org.bukkit.Location; +import org.bukkit.entity.Firework; +import org.bukkit.inventory.meta.FireworkMeta; + +public class FireworkHandler +{ + private Method world_getHandle = null; + private Method nms_world_broadcastEntityEffect = null; + private Method firework_getHandle = null; + + public void playFirework(Location loc, FireworkEffect fe) throws Exception + { + Firework fw = (Firework) loc.getWorld().spawn(loc, Firework.class); + + Object nms_world = null; + Object nms_firework = null; + + + if(world_getHandle == null) + { + world_getHandle = getMethod(loc.getWorld().getClass(), "getHandle"); + firework_getHandle = getMethod(fw.getClass(), "getHandle"); + } + + nms_world = world_getHandle.invoke(loc.getWorld(), (Object[]) null); + nms_firework = firework_getHandle.invoke(fw, (Object[]) null); + + if(nms_world_broadcastEntityEffect == null) + { + nms_world_broadcastEntityEffect = getMethod(nms_world.getClass(), "broadcastEntityEffect"); + } + + FireworkMeta data = (FireworkMeta) fw.getFireworkMeta(); + data.clearEffects(); + data.setPower(1); + data.addEffect(fe); + fw.setFireworkMeta(data); + + nms_world_broadcastEntityEffect.invoke(nms_world, new Object[] {nms_firework, (byte) 17}); + + fw.remove(); + } + + private static Method getMethod(Class cl, String method) + { + for(Method m : cl.getMethods()) + { + if(m.getName().equals(method)) + { + return m; + } + } + return null; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java new file mode 100644 index 000000000..551cba063 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java @@ -0,0 +1,446 @@ +package nautilus.game.arcade.world; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.HashMap; + +import mineplex.core.common.util.FileUtil; +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.WorldUtil; +import nautilus.game.arcade.game.Game; +import nautilus.minecraft.core.utils.ZipUtil; +import net.minecraft.server.v1_6_R2.ChunkPreLoadEvent; + +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.WorldCreator; +import org.bukkit.event.world.ChunkUnloadEvent; + +public class WorldData +{ + public Game Host; + + public int Id = -1; + + public String File = null; + public String Folder = null; + + public World World; + public int MinX = 0; + public int MinZ = 0; + public int MaxX = 0; + public int MaxZ = 0; + public int CurX = 0; + public int CurZ = 0; + + public String MapName = "Null"; + public String MapAuthor = "Null"; + + public HashMap> SpawnLocs = new HashMap>(); + private HashMap> DataLocs = new HashMap>(); + private HashMap> CustomLocs = new HashMap>(); + + public WorldData(Game game) + { + Host = game; + + Initialize(); + + Id = GetNewId(); + } + + public void Initialize() + { + final WorldData worldData = this; + + UtilServer.getServer().getScheduler().runTaskAsynchronously(Host.Manager.GetPlugin(), new Runnable() + { + public void run() + { + //Unzip + worldData.UnzipWorld(); + + //Load World Data Sync + UtilServer.getServer().getScheduler().runTask(Host.Manager.GetPlugin(), new Runnable() + { + public void run() + { + //Start World + World = WorldUtil.LoadWorld(new WorldCreator(GetFolder())); + + //Load World Data + worldData.LoadWorldConfig(); + } + }); + } + }); + } + + protected String GetFile() + { + if (File == null) + { + File = Host.GetFiles().get(UtilMath.r(Host.GetFiles().size())); + + //Don't allow repeat maps. + if (Host.GetFiles().size() > 1) + { + while (File.equals(Host.Manager.GetGameCreationManager().GetLastMap())) + { + File = Host.GetFiles().get(UtilMath.r(Host.GetFiles().size())); + } + } + } + + Host.Manager.GetGameCreationManager().SetLastMap(File); + + return File; + } + + protected String GetFolder() + { + if (Folder == null) + Folder = "Game" + Id + "_" + Host.GetName() + "_" + GetFile(); + + return Folder; + } + + protected void UnzipWorld() + { + String folder = GetFolder(); + new File(folder).mkdir(); + new File(folder + java.io.File.separator + "region").mkdir(); + new File(folder + java.io.File.separator + "data").mkdir(); + ZipUtil.UnzipToDirectory("maps/" + Host.GetName() + "/" + GetFile() + ".zip", folder); + } + + public void LoadWorldConfig() + { + //Load Track Data + String line = null; + + try + { + FileInputStream fstream = new FileInputStream(GetFolder() + java.io.File.separator + "WorldConfig.dat"); + DataInputStream in = new DataInputStream(fstream); + BufferedReader br = new BufferedReader(new InputStreamReader(in)); + + ArrayList currentTeam = null; + ArrayList currentData = null; + + int currentDirection = 0; + + while ((line = br.readLine()) != null) + { + String[] tokens = line.split(":"); + + if (tokens.length < 2) + continue; + + if (tokens[0].length() == 0) + continue; + + //Name & Author + if (tokens[0].equalsIgnoreCase("MAP_NAME")) + { + MapName = tokens[1]; + } + else if (tokens[0].equalsIgnoreCase("MAP_AUTHOR")) + { + MapAuthor = tokens[1]; + } + + //Spawn Locations + else if (tokens[0].equalsIgnoreCase("TEAM_NAME")) + { + SpawnLocs.put(tokens[1], new ArrayList()); + currentTeam = SpawnLocs.get(tokens[1]); + currentDirection = 0; + } + else if (tokens[0].equalsIgnoreCase("TEAM_DIRECTION")) + { + currentDirection = Integer.parseInt(tokens[1]); + } + else if (tokens[0].equalsIgnoreCase("TEAM_SPAWNS")) + { + for (int i=1 ; i()); + currentData = DataLocs.get(tokens[1]); + } + else if (tokens[0].equalsIgnoreCase("DATA_LOCS")) + { + for (int i=1 ; i()); + currentData = CustomLocs.get(tokens[1]); + } + else if (tokens[0].equalsIgnoreCase("CUSTOM_LOCS")) + { + for (int i=1 ; i= maxMilliseconds) + return false; + + World.getChunkAt(new Location(World, CurX, 0, CurZ)); + } + + CurZ = MinZ; + } + + return true; + } + + public void Uninitialize() + { + if (World == null) + return; + + //Wipe World + MapUtil.UnloadWorld(Host.Manager.GetPlugin(), World); + MapUtil.ClearWorldReferences(World.getName()); + FileUtil.DeleteFolder(new File(World.getName())); + + World = null; + } + + public void ChunkUnload(ChunkUnloadEvent event) + { + if (World == null) + return; + + if (!event.getWorld().equals(World)) + return; + + event.setCancelled(true); + } + + public void ChunkLoad(ChunkPreLoadEvent event) + { + if (World == null) + return; + + if (!event.GetWorld().equals(World)) + return; + + int x = event.GetX(); + int z = event.GetZ(); + + if (x >= MinX >> 4 && x <= MaxX >> 4 && z >= MinZ >> 4 && z <= MaxZ >> 4) + { + return; + } + + event.setCancelled(true); + } + + public int GetNewId() + { + File file = new File("GameId.dat"); + + //Write If Blank + if (!file.exists()) + { + try + { + FileWriter fstream = new FileWriter(file); + BufferedWriter out = new BufferedWriter(fstream); + + out.write("0"); + + out.close(); + } + catch (Exception e) + { + System.out.println("Error: Game World GetId Write Exception"); + } + } + + int id = 0; + + //Read + try + { + FileInputStream fstream = new FileInputStream(file); + DataInputStream in = new DataInputStream(fstream); + BufferedReader br = new BufferedReader(new InputStreamReader(in)); + String line = br.readLine(); + + id = Integer.parseInt(line); + + in.close(); + } + catch (Exception e) + { + System.out.println("Error: Game World GetId Read Exception"); + id = 0; + } + + try + { + FileWriter fstream = new FileWriter(file); + BufferedWriter out = new BufferedWriter(fstream); + + out.write("" + (id + 1)); + + out.close(); + } + catch (Exception e) + { + System.out.println("Error: Game World GetId Re-Write Exception"); + } + + return id; + } + + public ArrayList GetDataLocs(String data) + { + if (!DataLocs.containsKey(data)) + return new ArrayList(); + + return DataLocs.get(data); + } + + public ArrayList GetCustomLocs(String id) + { + if (!CustomLocs.containsKey(id)) + return new ArrayList(); + + return CustomLocs.get(id); + } + + public Location GetRandomXZ() + { + Location loc = new Location(World, 0, 250, 0); + + int xVar = MaxX - MinX; + int zVar = MaxZ - MinZ; + + loc.setX(MinX + UtilMath.r(xVar)); + loc.setZ(MinZ + UtilMath.r(zVar)); + + return loc; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldParser.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldParser.java new file mode 100644 index 000000000..955181f34 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldParser.java @@ -0,0 +1,248 @@ +package nautilus.game.arcade.world; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.material.Wool; + +public class WorldParser +{ + public void Parse(Player caller, String[] args) + { + HashSet dataId = new HashSet(); + + if (args != null) + for (String arg : args) + { + try + { + dataId.add(Integer.parseInt(arg)); + } + catch (Exception e) + { + caller.sendMessage("Invalid Data ID: " + arg); + } + } + + HashMap> TeamLocs = new HashMap>(); + HashMap> DataLocs = new HashMap>(); + HashMap> CustomLocs = new HashMap>(); + + Location cornerA = null; + Location cornerB = null; + + int processed = 0; + + caller.sendMessage("Scanning for Blocks..."); + for (int x=-500 ; x < 500 ; x++) + for (int z=-500 ; z < 500 ; z++) + for (int y=0 ; y < 256 ; y++) + { + processed++; + if (processed % 20000000 == 0) + caller.sendMessage("Processed: " + processed); + + Block block = caller.getWorld().getBlockAt(caller.getLocation().getBlockX()+x, caller.getLocation().getBlockY()+y, caller.getLocation().getBlockZ()+z); + + //ID DATA + if (dataId.contains(block.getTypeId())) + { + String key = ""+block.getTypeId(); + + if (!CustomLocs.containsKey(key)) + CustomLocs.put(key, new ArrayList()); + + CustomLocs.get(key).add(block.getLocation()); + continue; + } + + //Sign Post > Spawns + if (block.getTypeId() == 147) + { + Block wool = block.getRelative(BlockFace.DOWN); + if (wool == null) + continue; + + if (wool.getType() == Material.WOOL) + { + if (wool.getData() == 14) //RED > Spawn + { + if (!TeamLocs.containsKey("Red")) + TeamLocs.put("Red", new ArrayList()); + + TeamLocs.get("Red").add(wool.getLocation()); + + //Remove Blocks + block.setTypeId(0); + wool.setTypeId(0); + } + + if (wool.getData() == 4) //RED > Spawn + { + if (!TeamLocs.containsKey("Yellow")) + TeamLocs.put("Yellow", new ArrayList()); + + TeamLocs.get("Yellow").add(wool.getLocation()); + + //Remove Blocks + block.setTypeId(0); + wool.setTypeId(0); + } + + if (wool.getData() == 13) //RED > Spawn + { + if (!TeamLocs.containsKey("Green")) + TeamLocs.put("Green", new ArrayList()); + + TeamLocs.get("Green").add(wool.getLocation()); + + //Remove Blocks + block.setTypeId(0); + wool.setTypeId(0); + } + + if (wool.getData() == 11) //RED > Spawn + { + if (!TeamLocs.containsKey("Blue")) + TeamLocs.put("Blue", new ArrayList()); + + TeamLocs.get("Blue").add(wool.getLocation()); + + //Remove Blocks + block.setTypeId(0); + wool.setTypeId(0); + } + + if (wool.getData() == 0) //WHITE > Corner + { + if (cornerA == null) cornerA = wool.getLocation(); + else if (cornerB == null) cornerB = wool.getLocation(); + else caller.sendMessage("More than 2 Corner Locations found!"); + + //Remove Blocks + block.setTypeId(0); + wool.setTypeId(0); + } + } + } + + if (block.getTypeId() != 148) + continue; + + Block wool = block.getRelative(BlockFace.DOWN); + if (wool == null) + continue; + + if (wool.getType() != Material.WOOL) + continue; + + Wool woolData = new Wool(wool.getType(), wool.getData()); + + String dataType = woolData.getColor().name(); + + if (!DataLocs.containsKey(dataType)) + DataLocs.put(dataType, new ArrayList()); + + DataLocs.get(dataType).add(wool.getLocation()); + + //Remove Blocks + block.setTypeId(0); + wool.setTypeId(0); + } + + if (cornerA == null || cornerB == null) + { + caller.sendMessage("Missing Corner Locations!"); + return; + } + + //Save + try + { + FileWriter fstream = new FileWriter(caller.getWorld().getName() + File.separator + "WorldConfig.dat"); + BufferedWriter out = new BufferedWriter(fstream); + + out.write("MAP_NAME:"); + out.write("\n"); + out.write("MAP_AUTHOR:"); + out.write("\n"); + out.write("\n"); + out.write("MIN_X:"+Math.min(cornerA.getBlockX(), cornerB.getBlockX())); + out.write("\n"); + out.write("MAX_X:"+Math.max(cornerA.getBlockX(), cornerB.getBlockX())); + out.write("\n"); + out.write("MIN_Z:"+Math.min(cornerA.getBlockZ(), cornerB.getBlockZ())); + out.write("\n"); + out.write("MAX_Z:"+Math.max(cornerA.getBlockZ(), cornerB.getBlockZ())); + + //Teams + for (String team : TeamLocs.keySet()) + { + out.write("\n"); + out.write("\n"); + out.write("TEAM_NAME:" + team); + out.write("\n"); + out.write("TEAM_SPAWNS:" + LocationsToString(TeamLocs.get(team))); + } + + //Data + for (String data : DataLocs.keySet()) + { + out.write("\n"); + out.write("\n"); + out.write("DATA_NAME:" + data); + out.write("\n"); + out.write("DATA_LOCS:" + LocationsToString(DataLocs.get(data))); + } + + //Custom + for (String data : CustomLocs.keySet()) + { + out.write("\n"); + out.write("\n"); + out.write("CUSTOM_NAME:" + data); + out.write("\n"); + out.write("CUSTOM_LOCS:" + LocationsToString(CustomLocs.get(data))); + } + + out.close(); + } + catch (Exception e) + { + caller.sendMessage("Error: File Write Error"); + } + + + caller.sendMessage("World Data Saved."); + } + + public String LocationsToString(ArrayList locs) + { + String out = ""; + + for (Location loc : locs) + out += loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ() + ":"; + + return out; + } + + public String LocationSignsToString(HashMap locs) + { + String out = ""; + + for (Location loc : locs.keySet()) + out += locs.get(loc) + "@" + loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ() + ":"; + + return out; + } +} + diff --git a/Plugins/Nautilus.Game.CaptureThePig/.classpath b/Plugins/Nautilus.Game.CaptureThePig/.classpath new file mode 100644 index 000000000..fca7cbebb --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/.classpath @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.CaptureThePig/.externalToolBuilders/CaptureThePig.launch b/Plugins/Nautilus.Game.CaptureThePig/.externalToolBuilders/CaptureThePig.launch new file mode 100644 index 000000000..e9baad9df --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/.externalToolBuilders/CaptureThePig.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.CaptureThePig/.project b/Plugins/Nautilus.Game.CaptureThePig/.project new file mode 100644 index 000000000..5342dbc0b --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/.project @@ -0,0 +1,27 @@ + + + Nautilus.Game.CaptureThePig + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + auto,full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/CaptureThePig.launch + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Nautilus.Game.CaptureThePig/.settings/org.eclipse.jdt.core.prefs b/Plugins/Nautilus.Game.CaptureThePig/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7341ab168 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Nautilus.Game.CaptureThePig/CaptureThePig.xml b/Plugins/Nautilus.Game.CaptureThePig/CaptureThePig.xml new file mode 100644 index 000000000..bd6fff0bc --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/CaptureThePig.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/CaptureThePig.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/CaptureThePig.class new file mode 100644 index 000000000..8b1503ae5 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/CaptureThePig.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/CaptureThePigArena.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/CaptureThePigArena.class new file mode 100644 index 000000000..27871bd7c Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/CaptureThePigArena.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/CaptureThePigArenaParser.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/CaptureThePigArenaParser.class new file mode 100644 index 000000000..17eeafc75 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/CaptureThePigArenaParser.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/ICaptureThePigArena.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/ICaptureThePigArena.class new file mode 100644 index 000000000..4286e12bf Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/ICaptureThePigArena.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/property/BluePigPen.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/property/BluePigPen.class new file mode 100644 index 000000000..96ea90aa7 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/property/BluePigPen.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/property/PigSpawnLocation.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/property/PigSpawnLocation.class new file mode 100644 index 000000000..d66ec56d0 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/property/PigSpawnLocation.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/property/RedPigPen.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/property/RedPigPen.class new file mode 100644 index 000000000..d73f65bea Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/arena/property/RedPigPen.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/engine/CaptureThePigGameEngine.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/engine/CaptureThePigGameEngine.class new file mode 100644 index 000000000..ed49138af Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/engine/CaptureThePigGameEngine.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/engine/CaptureThePigNotifier.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/engine/CaptureThePigNotifier.class new file mode 100644 index 000000000..99097d1d4 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/engine/CaptureThePigNotifier.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/event/PigCapturedEvent.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/event/PigCapturedEvent.class new file mode 100644 index 000000000..b96fcd529 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/event/PigCapturedEvent.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/event/PigDroppedEvent.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/event/PigDroppedEvent.class new file mode 100644 index 000000000..674a5d8e3 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/event/PigDroppedEvent.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/event/PigEvent.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/event/PigEvent.class new file mode 100644 index 000000000..658e1f221 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/event/PigEvent.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/event/PigPickedUpEvent.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/event/PigPickedUpEvent.class new file mode 100644 index 000000000..79d8577e0 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/event/PigPickedUpEvent.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/event/PigStolenEvent.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/event/PigStolenEvent.class new file mode 100644 index 000000000..49cb9e609 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/event/PigStolenEvent.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/game/CaptureThePigGame.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/game/CaptureThePigGame.class new file mode 100644 index 000000000..973bd926d Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/game/CaptureThePigGame.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/game/CaptureThePigTeam.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/game/CaptureThePigTeam.class new file mode 100644 index 000000000..3d21d07e4 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/game/CaptureThePigTeam.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/game/ICaptureThePigGame.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/game/ICaptureThePigGame.class new file mode 100644 index 000000000..5eed85983 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/game/ICaptureThePigGame.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/game/ICaptureThePigTeam.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/game/ICaptureThePigTeam.class new file mode 100644 index 000000000..ea39b97ef Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/game/ICaptureThePigTeam.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/player/CaptureThePigPlayer.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/player/CaptureThePigPlayer.class new file mode 100644 index 000000000..f0489c0f2 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/player/CaptureThePigPlayer.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/player/ICaptureThePigPlayer.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/player/ICaptureThePigPlayer.class new file mode 100644 index 000000000..939289594 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/player/ICaptureThePigPlayer.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/repository/CaptureThePigRepository.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/repository/CaptureThePigRepository.class new file mode 100644 index 000000000..2ab8c4cd7 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/repository/CaptureThePigRepository.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/repository/ICaptureThePigRepository.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/repository/ICaptureThePigRepository.class new file mode 100644 index 000000000..700c71f01 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/repository/ICaptureThePigRepository.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/scoreboard/CaptureThePigScoreHandler.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/scoreboard/CaptureThePigScoreHandler.class new file mode 100644 index 000000000..9c1100abf Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/scoreboard/CaptureThePigScoreHandler.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/scoreboard/CaptureThePigTabScoreboard.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/scoreboard/CaptureThePigTabScoreboard.class new file mode 100644 index 000000000..ce23413ae Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/scoreboard/CaptureThePigTabScoreboard.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/scoreboard/ICaptureThePigScoreHandler.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/scoreboard/ICaptureThePigScoreHandler.class new file mode 100644 index 000000000..5422802ba Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/scoreboard/ICaptureThePigScoreHandler.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/scoreboard/PlayerSorter.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/scoreboard/PlayerSorter.class new file mode 100644 index 000000000..44f6a9a69 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/scoreboard/PlayerSorter.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/stats/CaptureThePigGameStatsToken.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/stats/CaptureThePigGameStatsToken.class new file mode 100644 index 000000000..7974766c0 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/stats/CaptureThePigGameStatsToken.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/stats/CaptureThePigPlayerStats.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/stats/CaptureThePigPlayerStats.class new file mode 100644 index 000000000..6c31db791 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/stats/CaptureThePigPlayerStats.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/stats/CaptureThePigPlayerStatsToken.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/stats/CaptureThePigPlayerStatsToken.class new file mode 100644 index 000000000..ece417017 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/stats/CaptureThePigPlayerStatsToken.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/stats/CaptureThePigStatsReporter.class b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/stats/CaptureThePigStatsReporter.class new file mode 100644 index 000000000..456f00232 Binary files /dev/null and b/Plugins/Nautilus.Game.CaptureThePig/bin/nautilus/game/capturethepig/stats/CaptureThePigStatsReporter.class differ diff --git a/Plugins/Nautilus.Game.CaptureThePig/plugin.yml b/Plugins/Nautilus.Game.CaptureThePig/plugin.yml new file mode 100644 index 000000000..5757697a4 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/plugin.yml @@ -0,0 +1,3 @@ +name: CaptureThePig +main: nautilus.game.capturethepig.CaptureThePig +version: 0.1 diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/CaptureThePig.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/CaptureThePig.java new file mode 100644 index 000000000..7b46aa0ab --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/CaptureThePig.java @@ -0,0 +1,56 @@ +package nautilus.game.capturethepig; + +import org.bukkit.entity.Player; + +import me.chiss.Core.Chat.Chat; +import me.chiss.Core.PlayerTagNamer.INameColorer; +import me.chiss.Core.Plugin.IRelation; +import nautilus.game.capturethepig.arena.CaptureThePigArenaParser; +import nautilus.game.capturethepig.arena.ICaptureThePigArena; +import nautilus.game.capturethepig.engine.CaptureThePigGameEngine; +import nautilus.game.capturethepig.engine.CaptureThePigNotifier; +import nautilus.game.capturethepig.repository.CaptureThePigRepository; +import nautilus.game.capturethepig.repository.ICaptureThePigRepository; +import nautilus.game.core.GamePlugin; +import nautilus.game.core.arena.ArenaManager; + +public class CaptureThePig extends GamePlugin +{ + private ICaptureThePigRepository _repository; + private CaptureThePigGameEngine _gameEngine; + + @Override + public void onEnable() + { + super.onEnable(); + + _gameEngine = new CaptureThePigGameEngine(this, HubConnection, ClientManager, DonationManager, ClassManager, ConditionManager, Energy, NpcManager, + new CaptureThePigNotifier(this), new ArenaManager(this, "CaptureThePig", new CaptureThePigArenaParser()), getServer().getWorlds().get(0)); + + new Chat(this, ClientManager, _gameEngine); + } + + @Override + public String GetServerName() + { + return "CTP"; + } + + @Override + public boolean CanHurt(Player a, Player b) + { + return _gameEngine.CanHurt(a, b); + } + + @Override + public boolean CanHurt(String a, String b) + { + return _gameEngine.CanHurt(a, b); + } + + @Override + public boolean IsSafe(Player a) + { + return _gameEngine.IsSafe(a); + } +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/CaptureThePigArena.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/CaptureThePigArena.java new file mode 100644 index 000000000..36ccb5418 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/CaptureThePigArena.java @@ -0,0 +1,58 @@ +package nautilus.game.capturethepig.arena; + +import org.bukkit.Location; +import org.bukkit.util.Vector; + +import nautilus.game.core.arena.Region; +import nautilus.game.core.arena.TeamArena; + +public class CaptureThePigArena extends TeamArena implements ICaptureThePigArena +{ + private Region _redPigPen; + private Region _bluePigPen; + + private Location _pigSpawnPoint; + + public CaptureThePigArena(String name) + { + super(name); + } + + @Override + public Region GetRedPigPen() + { + return _redPigPen; + } + + @Override + public Region GetBluePigPen() + { + return _bluePigPen; + } + + @Override + public Location GetPigSpawnPoint() + { + return _pigSpawnPoint; + } + + @Override + public void SetRedPigPen(Region pen) + { + Regions.add(pen); + _redPigPen = pen; + } + + @Override + public void SetBluePigPen(Region pen) + { + Regions.add(pen); + _bluePigPen = pen; + } + + @Override + public void SetPigSpawnPoint(Vector location) + { + _pigSpawnPoint = new Location(World, location.getX(), location.getY(), location.getZ()); + } +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/CaptureThePigArenaParser.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/CaptureThePigArenaParser.java new file mode 100644 index 000000000..dd78ce28d --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/CaptureThePigArenaParser.java @@ -0,0 +1,88 @@ +package nautilus.game.capturethepig.arena; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.util.HashMap; + +import nautilus.game.capturethepig.arena.property.*; +import nautilus.game.core.arena.IArenaParser; +import nautilus.game.core.arena.property.*; + +public class CaptureThePigArenaParser implements IArenaParser +{ + private HashMap> _properties; + + public CaptureThePigArenaParser() + { + _properties = new HashMap>(); + + AddProperty(new MapName()); + AddProperty(new BorderProperty()); + AddProperty(new Center()); + AddProperty(new Offset()); + AddProperty(new RedSpawnPoints()); + AddProperty(new RedSpawnRoom()); + AddProperty(new BlueSpawnPoints()); + AddProperty(new BlueSpawnRoom()); + + AddProperty(new RedPigPen()); + AddProperty(new BluePigPen()); + AddProperty(new PigSpawnLocation()); + } + + @Override + public ICaptureThePigArena Parse(String worldPath, FileReader fileReader) + { + try + { + ICaptureThePigArena arena = new CaptureThePigArena(worldPath.substring(worldPath.lastIndexOf(File.separator) + 1, worldPath.length())); + + BufferedReader input = new BufferedReader(fileReader); + String line = input.readLine(); + + while(line != null) + { + if(line.startsWith("#")) + { + line = input.readLine(); + continue; + } + + String[] parts = line.split(":"); + + if(parts.length < 2) + { + line = input.readLine(); + continue; + } + + String key = parts[0]; + String value = parts[1].toLowerCase().trim(); + + if (_properties.containsKey(key.toLowerCase())) + { + _properties.get(key.toLowerCase()).Parse(arena, value); + } + else + { + System.out.println("Invalid property found: " + key); + } + + line = input.readLine(); + } + + return arena; + } + catch(Exception ex) + { + System.out.println("An exception was thrown:" + ex.getMessage()); + } + + return null; + } + + private void AddProperty(IProperty property) + { + _properties.put(property.GetName(), property); + } +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/ICaptureThePigArena.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/ICaptureThePigArena.java new file mode 100644 index 000000000..a1f68e4a1 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/ICaptureThePigArena.java @@ -0,0 +1,20 @@ +package nautilus.game.capturethepig.arena; + +import org.bukkit.Location; +import org.bukkit.util.Vector; + +import nautilus.game.core.arena.ITeamArena; +import nautilus.game.core.arena.Region; + +public interface ICaptureThePigArena extends ITeamArena +{ + Region GetRedPigPen(); + Region GetBluePigPen(); + + Location GetPigSpawnPoint(); + + void SetRedPigPen(Region pen); + void SetBluePigPen(Region pen); + + void SetPigSpawnPoint(Vector location); +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/property/BluePigPen.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/property/BluePigPen.java new file mode 100644 index 000000000..d775920e1 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/property/BluePigPen.java @@ -0,0 +1,20 @@ +package nautilus.game.capturethepig.arena.property; + +import nautilus.game.capturethepig.arena.ICaptureThePigArena; +import nautilus.game.core.arena.property.RegionPropertyBase; + +public class BluePigPen extends RegionPropertyBase +{ + public BluePigPen() + { + super("bluepigpen"); + } + + @Override + public boolean Parse(ICaptureThePigArena arena, String value) + { + arena.SetBluePigPen(ParseRegion(value)); + + return true; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/property/PigSpawnLocation.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/property/PigSpawnLocation.java new file mode 100644 index 000000000..943a1a90d --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/property/PigSpawnLocation.java @@ -0,0 +1,19 @@ +package nautilus.game.capturethepig.arena.property; + +import nautilus.game.capturethepig.arena.ICaptureThePigArena; +import nautilus.game.core.arena.property.PropertyBase; + +public class PigSpawnLocation extends PropertyBase +{ + public PigSpawnLocation() + { + super("pigspawnlocation"); + } + + public boolean Parse(ICaptureThePigArena arena, String value) + { + arena.SetPigSpawnPoint(ParseVector(value)); + + return true; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/property/RedPigPen.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/property/RedPigPen.java new file mode 100644 index 000000000..e617ddf5f --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/arena/property/RedPigPen.java @@ -0,0 +1,20 @@ +package nautilus.game.capturethepig.arena.property; + +import nautilus.game.capturethepig.arena.ICaptureThePigArena; +import nautilus.game.core.arena.property.RegionPropertyBase; + +public class RedPigPen extends RegionPropertyBase +{ + public RedPigPen() + { + super("redpigpen"); + } + + @Override + public boolean Parse(ICaptureThePigArena arena, String value) + { + arena.SetRedPigPen(ParseRegion(value)); + + return true; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/engine/CaptureThePigGameEngine.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/engine/CaptureThePigGameEngine.java new file mode 100644 index 000000000..d23bbbb67 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/engine/CaptureThePigGameEngine.java @@ -0,0 +1,258 @@ +package nautilus.game.capturethepig.engine; + +import mineplex.minecraft.game.classcombat.Class.ClassManager; + +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import me.chiss.Core.Plugin.IPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.energy.Energy; +import mineplex.core.npc.NpcManager; +import mineplex.core.recharge.Recharge; +import mineplex.core.server.ServerTalker; + +import nautilus.game.capturethepig.arena.ICaptureThePigArena; +import nautilus.game.capturethepig.event.*; +import nautilus.game.capturethepig.game.CaptureThePigGame; +import nautilus.game.capturethepig.game.ICaptureThePigGame; +import nautilus.game.capturethepig.game.ICaptureThePigTeam; +import nautilus.game.capturethepig.player.ICaptureThePigPlayer; +import nautilus.game.capturethepig.repository.ICaptureThePigRepository; +import nautilus.game.capturethepig.scoreboard.CaptureThePigScoreHandler; +import nautilus.game.capturethepig.scoreboard.ICaptureThePigScoreHandler; +import nautilus.game.capturethepig.stats.CaptureThePigStatsReporter; +import nautilus.game.core.arena.ArenaManager; +import nautilus.game.core.engine.TeamGameEngine; + +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Pig; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class CaptureThePigGameEngine extends TeamGameEngine +{ + public CaptureThePigGameEngine(JavaPlugin plugin, ServerTalker hubConnection, CoreClientManager clientManager, DonationManager donationManager, ClassManager classManager, + ConditionManager conditionManager, Energy energy, NpcManager npcManager, CaptureThePigNotifier notifier, ArenaManager arenaManager, World world, Location spawnLocation, String webServerAddress) + { + super(plugin, hubConnection, clientManager, donationManager, classManager, conditionManager, energy, npcManager, arenaManager, new CaptureThePigScoreHandler(plugin, notifier), world, spawnLocation); + + new CaptureThePigStatsReporter(plugin, this, webServerAddress); + + TeamSize = 50; + MinQueuePlayersToStart = 1; + TimeToStart = 0; + AddToActiveGame = true; + BroadcastQueueJoinMessage = false; + } + + @Override + public void ActivateGame(ICaptureThePigGame game, ICaptureThePigArena arena) + { + super.ActivateGame(game, arena); + + for (ICaptureThePigPlayer dominatePlayer : game.GetPlayers()) + { + GameShop.ResetShopFor(dominatePlayer.GetPlayer()); + } + } + + @Override + public ICaptureThePigGame ScheduleNewGame() + { + return Scheduler.ScheduleNewGame(new CaptureThePigGame(Plugin, PlayerNamer.PacketHandler)); + } + + @Override + public String GetGameType() + { + return "Capture The Pig"; + } + + @EventHandler(priority = EventPriority.LOWEST) + public void TransferDamageToOwner(EntityDamageByEntityEvent event) + { + if (event.getEntity() instanceof Pig && event.getEntity().isInsideVehicle()) + { + EntityDamageByEntityEvent newEvent = new EntityDamageByEntityEvent(event.getDamager(), event.getEntity().getVehicle(), event.getCause(), event.getDamage()); + Plugin.getServer().getPluginManager().callEvent(newEvent); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void DisableDamageToPig(CustomDamageEvent event) + { + if (event.GetDamageeEntity() != null && event.GetDamageeEntity() instanceof Pig) + { + event.SetCancelled("Don't harm dat pig!"); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void PlayerDeath(CombatDeathEvent event) + { + if (event.GetEvent().getEntity() == null || !(event.GetEvent().getEntity() instanceof Player)) + return; + + Player player = (Player)event.GetEvent().getEntity(); + + if (!IsPlayerInActiveGame(player)) + return; + + ICaptureThePigGame game = GetGameForPlayer(player); + + if (!game.HasStarted()) + return; + + ICaptureThePigPlayer gamePlayer = game.GetPlayer(player); + ICaptureThePigTeam playerTeam = gamePlayer.GetTeam(); + + if (player.getPassenger() != null) + { + if (player.getPassenger() instanceof Pig) + { + RemovePigShuttle(gamePlayer); + + Plugin.getServer().getPluginManager().callEvent(new PigDroppedEvent(game, playerTeam)); + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onCTPPlayerInteractEntity(PlayerInteractEntityEvent event) + { + if (event.isCancelled() || !(event.getRightClicked() instanceof Pig)) + return; + + if (!IsPlayerInActiveGame(event.getPlayer())) + return; + + ICaptureThePigGame game = GetGameForPlayer(event.getPlayer()); + + if (!game.HasStarted()) + return; + + if (event.getRightClicked().isInsideVehicle() || event.getPlayer().getPassenger() != null && event.getPlayer().getPassenger() instanceof Pig) + return; + + ICaptureThePigPlayer player = game.GetPlayer(event.getPlayer()); + ICaptureThePigTeam playerTeam = player.GetTeam(); + ICaptureThePigTeam otherTeam = player.GetTeam() == game.GetRedTeam() ? game.GetBlueTeam() : game.GetRedTeam(); + + if (player.IsDead() || player.IsSpectating()) + return; + + if (otherTeam.GetPigPen().Contains(event.getRightClicked().getLocation().toVector())) + { + if (otherTeam.HasPig() && Recharge.Instance.use(player.GetPlayer(), "Pig Steal", 10000, true)) + { + CreatePigShuttle(player, otherTeam.RemovePig()); + + Plugin.getServer().getPluginManager().callEvent(new PigStolenEvent(game, player, otherTeam)); + } + } + else if (!playerTeam.HasPig()) + { + if (playerTeam.GetPig() == event.getRightClicked()) + playerTeam.ReturnPig(); + else + { + CreatePigShuttle(player, event.getRightClicked()); + Plugin.getServer().getPluginManager().callEvent(new PigPickedUpEvent(game, playerTeam)); + } + } + + event.setCancelled(true); + } + + @EventHandler + public void DropPig(PlayerCommandPreprocessEvent event) + { + if (event.isCancelled()) + return; + + if (!IsPlayerInActiveGame(event.getPlayer())) + return; + + if (event.getMessage().startsWith("/drop")) + { + ICaptureThePigGame game = GetGameForPlayer(event.getPlayer()); + + if (!game.HasStarted()) + return; + + ICaptureThePigPlayer player = game.GetPlayer(event.getPlayer()); + ICaptureThePigTeam playerTeam = player.GetTeam(); + + if (player.GetPlayer().getPassenger() != null) + { + if (player.GetPlayer().getPassenger() instanceof Pig) + { + RemovePigShuttle(player); + + Plugin.getServer().getPluginManager().callEvent(new PigDroppedEvent(game, playerTeam)); + + event.setCancelled(true); + } + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onCTPPlayerQuit(PlayerQuitEvent event) + { + if (!IsPlayerInActiveGame(event.getPlayer())) + return; + + ICaptureThePigGame game = GetGameForPlayer(event.getPlayer()); + + if (!game.HasStarted()) + return; + + ICaptureThePigPlayer player = game.GetPlayer(event.getPlayer()); + ICaptureThePigTeam playerTeam = player.GetTeam(); + + if (player.GetPlayer().getPassenger() != null) + { + if (player.GetPlayer().getPassenger() instanceof Pig) + { + RemovePigShuttle(player); + + Plugin.getServer().getPluginManager().callEvent(new PigDroppedEvent(game, playerTeam)); + } + } + } + + private void CreatePigShuttle(ICaptureThePigPlayer player, Entity removePig) + { + ConditionManager.Factory().Slow("Pig", player.GetPlayer(), player.GetPlayer(), 7200, 0, false, false, false, false); + + ConditionManager.SetIndicatorVisibility(player.GetPlayer(), false); + + player.GetPlayer().eject(); + player.GetPlayer().setPassenger(removePig); + } + + private Pig RemovePigShuttle(ICaptureThePigPlayer player) + { + Entity pig = player.GetPlayer().getPassenger(); + player.GetPlayer().eject(); + + ConditionManager.EndCondition(player.GetPlayer(), ConditionType.SLOW, "Pig"); + ConditionManager.Factory().Vulnerable("Pig", player.GetPlayer(), player.GetPlayer(), 2, 0, false, false, false); + + ConditionManager.SetIndicatorVisibility(player.GetPlayer(), true); + + return (Pig)pig; + } +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/engine/CaptureThePigNotifier.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/engine/CaptureThePigNotifier.java new file mode 100644 index 000000000..6fc08f00c --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/engine/CaptureThePigNotifier.java @@ -0,0 +1,77 @@ +package nautilus.game.capturethepig.engine; + +import org.bukkit.Sound; +import org.bukkit.event.EventHandler; + +import nautilus.game.capturethepig.arena.ICaptureThePigArena; +import nautilus.game.capturethepig.event.PigCapturedEvent; +import nautilus.game.capturethepig.event.PigDroppedEvent; +import nautilus.game.capturethepig.event.PigPickedUpEvent; +import nautilus.game.capturethepig.event.PigStolenEvent; +import nautilus.game.capturethepig.game.ICaptureThePigGame; +import nautilus.game.capturethepig.game.ICaptureThePigTeam; +import nautilus.game.capturethepig.player.ICaptureThePigPlayer; +import nautilus.game.core.notifier.TeamPlayerNotifier; +import me.chiss.Core.Plugin.IPlugin; + +public class CaptureThePigNotifier extends TeamPlayerNotifier +{ + public CaptureThePigNotifier(IPlugin plugin) + { + super(plugin, "CTP"); + } + + @EventHandler + public void OnPigCaptured(PigCapturedEvent event) + { + ICaptureThePigTeam ownerTeam = event.GetCapturer().GetTeam(); + + BroadcastMessageToPlayers("Your team has captured a pig!", ownerTeam.GetPlayers()); + + for (ICaptureThePigPlayer player : ownerTeam.GetPlayers()) + { + player.playSound(player.getLocation(), Sound.ZOMBIE_METAL, .8F, 0F); + } + + BroadcastMessageToOtherGamePlayers(event.GetGame(), GetTeamString(event.GetCapturer().GetTeam()) + " captured a pig!", ownerTeam.GetPlayers()); + + for (ICaptureThePigPlayer player : ownerTeam.GetPlayers()) + { + player.playSound(player.getLocation(), Sound.BLAZE_DEATH, .8F, 0F); + } + } + + @EventHandler + public void OnPigPickedUp(PigPickedUpEvent event) + { + for (ICaptureThePigPlayer player : event.GetTeamOwner().GetPlayers()) + { + player.playSound(player.getLocation(), Sound.PIG_IDLE, 3F, 1F); + } + } + + @EventHandler + public void OnPigDropped(PigDroppedEvent event) + { + for (ICaptureThePigPlayer player : event.GetPreviousTeamOwner().GetPlayers()) + { + player.playSound(player.getLocation(), Sound.ZOMBIE_PIG_HURT, .4F, 0F); + } + } + + @EventHandler + public void OnPigStolen(PigStolenEvent event) + { + for (ICaptureThePigPlayer player : event.GetPreviousTeamOwner().GetPlayers()) + { + player.playSound(player.getLocation(), Sound.GHAST_SCREAM, 1F, .5F); + } + + BroadcastMessageToOtherGamePlayers(event.GetGame(), "Your pigs are being stolen!", event.GetThief().GetTeam().GetPlayers()); + + for (ICaptureThePigPlayer player : event.GetThief().GetTeam().GetPlayers()) + { + player.playSound(player.getLocation(), Sound.ZOMBIE_PIG_IDLE, 3F, 1F); + } + } +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/event/PigCapturedEvent.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/event/PigCapturedEvent.java new file mode 100644 index 000000000..b8238ad16 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/event/PigCapturedEvent.java @@ -0,0 +1,21 @@ +package nautilus.game.capturethepig.event; + +import nautilus.game.capturethepig.game.ICaptureThePigGame; +import nautilus.game.capturethepig.player.ICaptureThePigPlayer; + +public class PigCapturedEvent extends PigEvent +{ + private ICaptureThePigPlayer _capturer; + + public PigCapturedEvent(ICaptureThePigGame game, ICaptureThePigPlayer capturer) + { + super(game); + + _capturer = capturer; + } + + public ICaptureThePigPlayer GetCapturer() + { + return _capturer; + } +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/event/PigDroppedEvent.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/event/PigDroppedEvent.java new file mode 100644 index 000000000..7d1dd1936 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/event/PigDroppedEvent.java @@ -0,0 +1,21 @@ +package nautilus.game.capturethepig.event; + +import nautilus.game.capturethepig.game.ICaptureThePigGame; +import nautilus.game.capturethepig.game.ICaptureThePigTeam; + +public class PigDroppedEvent extends PigEvent +{ + private ICaptureThePigTeam _previousTeamOwner; + + public PigDroppedEvent(ICaptureThePigGame game, ICaptureThePigTeam previousTeamOwner) + { + super(game); + + _previousTeamOwner = previousTeamOwner; + } + + public ICaptureThePigTeam GetPreviousTeamOwner() + { + return _previousTeamOwner; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/event/PigEvent.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/event/PigEvent.java new file mode 100644 index 000000000..ed2b582c8 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/event/PigEvent.java @@ -0,0 +1,12 @@ +package nautilus.game.capturethepig.event; + +import nautilus.game.capturethepig.game.ICaptureThePigGame; +import nautilus.game.core.events.GameEvent; + +public class PigEvent extends GameEvent +{ + public PigEvent(ICaptureThePigGame game) + { + super(game); + } +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/event/PigPickedUpEvent.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/event/PigPickedUpEvent.java new file mode 100644 index 000000000..2334cdf2d --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/event/PigPickedUpEvent.java @@ -0,0 +1,21 @@ +package nautilus.game.capturethepig.event; + +import nautilus.game.capturethepig.game.ICaptureThePigGame; +import nautilus.game.capturethepig.game.ICaptureThePigTeam; + +public class PigPickedUpEvent extends PigEvent +{ + private ICaptureThePigTeam _teamOwner; + + public PigPickedUpEvent(ICaptureThePigGame game, ICaptureThePigTeam teamOwner) + { + super(game); + + _teamOwner = teamOwner; + } + + public ICaptureThePigTeam GetTeamOwner() + { + return _teamOwner; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/event/PigStolenEvent.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/event/PigStolenEvent.java new file mode 100644 index 000000000..1a6165281 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/event/PigStolenEvent.java @@ -0,0 +1,29 @@ +package nautilus.game.capturethepig.event; + +import nautilus.game.capturethepig.game.ICaptureThePigGame; +import nautilus.game.capturethepig.game.ICaptureThePigTeam; +import nautilus.game.capturethepig.player.ICaptureThePigPlayer; + +public class PigStolenEvent extends PigEvent +{ + private ICaptureThePigPlayer _thief; + private ICaptureThePigTeam _previousTeamOwner; + + public PigStolenEvent(ICaptureThePigGame game, ICaptureThePigPlayer thief, ICaptureThePigTeam previousTeamOwner) + { + super(game); + + _thief = thief; + _previousTeamOwner = previousTeamOwner; + } + + public ICaptureThePigPlayer GetThief() + { + return _thief; + } + + public ICaptureThePigTeam GetPreviousTeamOwner() + { + return _previousTeamOwner; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/game/CaptureThePigGame.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/game/CaptureThePigGame.java new file mode 100644 index 000000000..0067c6ee4 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/game/CaptureThePigGame.java @@ -0,0 +1,254 @@ +package nautilus.game.capturethepig.game; + +import java.util.AbstractMap; +import java.util.Iterator; +import java.util.Map.Entry; + +import me.chiss.Core.Condition.Condition.ConditionType; +import me.chiss.Core.PlayerTagNamer.PacketHandler; +import me.chiss.Core.Plugin.IPlugin; +import mineplex.core.common.util.NautHashMap; +import nautilus.game.capturethepig.arena.ICaptureThePigArena; +import nautilus.game.capturethepig.event.PigCapturedEvent; +import nautilus.game.capturethepig.player.CaptureThePigPlayer; +import nautilus.game.capturethepig.player.ICaptureThePigPlayer; +import nautilus.game.capturethepig.scoreboard.CaptureThePigTabScoreboard; +import nautilus.game.core.engine.TeamType; +import nautilus.game.core.events.team.TeamGameFinishedEvent; +import nautilus.game.core.game.TeamGame; +import net.minecraft.server.v1_6_R2.EntityCreature; +import net.minecraft.server.v1_6_R2.EntityPlayer; +import net.minecraft.server.v1_6_R2.Packet201PlayerInfo; +import net.minecraft.server.v1_6_R2.RandomPositionGenerator; +import net.minecraft.server.v1_6_R2.Vec3D; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPig; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Pig; +import org.bukkit.entity.Player; + +public class CaptureThePigGame extends TeamGame implements ICaptureThePigGame +{ + private CaptureThePigTabScoreboard _scoreboard; + + private int _lastUpdate; + + private NautHashMap _crazyPigs; + private NautHashMap> _capturedPigs; + + public CaptureThePigGame(IPlugin plugin, PacketHandler packetHandler) + { + super(plugin); + + ScoreLimit = 5; + _scoreboard = new CaptureThePigTabScoreboard(plugin, packetHandler, this); + _crazyPigs = new NautHashMap(); + _capturedPigs = new NautHashMap>(); + } + + @Override + protected ICaptureThePigTeam CreateTeam(TeamType teamType) + { + return new CaptureThePigTeam(teamType); + } + + @Override + protected ICaptureThePigPlayer CreateGamePlayer(Player player, int playerLives) + { + return new CaptureThePigPlayer(Plugin.GetPlugin(), player); + } + + @Override + public void Activate(ICaptureThePigArena arena) + { + super.Activate(arena); + + RedTeam.SetPigPen(arena.GetRedPigPen()); + BlueTeam.SetPigPen(arena.GetBluePigPen()); + + + RedTeam.SpawnPig((Pig)Plugin.GetCreature().SpawnEntity(RedTeam.GetPigPen().GetMidPoint().toLocation(arena.GetWorld()), EntityType.PIG)); + BlueTeam.SpawnPig((Pig)Plugin.GetCreature().SpawnEntity(BlueTeam.GetPigPen().GetMidPoint().toLocation(arena.GetWorld()), EntityType.PIG)); + + _scoreboard.Update(); + } + + @Override + public void Deactivate() + { + _scoreboard.Stop(); + + for (ICaptureThePigPlayer gamePlayer : Players.values()) + { + EntityPlayer entityPlayer = ((CraftPlayer)gamePlayer.GetPlayer()).getHandle(); + + for (Player player : Bukkit.getServer().getOnlinePlayers()) + { + entityPlayer.playerConnection.sendPacket(new Packet201PlayerInfo(player.getName(), true, 0)); + } + + if (!gamePlayer.isOnline()) + { + for (ICaptureThePigPlayer otherPlayer : Players.values()) + { + EntityPlayer otherEntityPlayer = ((CraftPlayer)otherPlayer.GetPlayer()).getHandle(); + otherEntityPlayer.playerConnection.sendPacket(new Packet201PlayerInfo(otherPlayer.getName(), false, 0)); + } + } + } + + for (ICaptureThePigPlayer gamePlayer : Spectators.values()) + { + EntityPlayer entityPlayer = ((CraftPlayer)gamePlayer.GetPlayer()).getHandle(); + + for (Player player : Bukkit.getServer().getOnlinePlayers()) + { + entityPlayer.playerConnection.sendPacket(new Packet201PlayerInfo(player.getName(), true, 0)); + } + } + + _scoreboard = null; + + super.Deactivate(); + } + + @Override + public void Update() + { + super.Update(); + + for (ICaptureThePigPlayer player : GetPlayers()) + { + if (player.GetPlayer().getPassenger() instanceof Pig) + { + if (player.GetTeam().GetPigPen().Contains(player.getLocation().toVector())) + { + if (player.GetTeam().HasPig()) + { + Pig pig = (Pig)player.GetPlayer().getPassenger(); + Plugin.GetPlugin().getServer().getPluginManager().callEvent(new PigCapturedEvent(this, player)); + _capturedPigs.put(pig, new AbstractMap.SimpleEntry(player.GetTeam().GetPig(), 0)); + player.GetPlayer().eject(); + player.GetTeam().CapturePig(pig); + + Plugin.GetCondition().EndCondition(player.GetPlayer(), ConditionType.SLOW, "Pig"); + Plugin.GetCondition().Factory().Vulnerable("Pig", player.GetPlayer(), player.GetPlayer(), 2, 0, false, false); + } + } + } + } + + UpdateCapturedPigs(); + UpdateCrazyPigs(); + + if (_lastUpdate % 10 == 0) + { + _scoreboard.Update(); + } + + _lastUpdate++; + + if (RedTeam.GetScore() >= ScoreLimit) + { + RedTeam.SetScore(ScoreLimit); + StopGame(); + Plugin.GetPlugin().getServer().getPluginManager().callEvent(new TeamGameFinishedEvent(this, RedTeam)); + _scoreboard.Update(); + } + else if (BlueTeam.GetScore() >= ScoreLimit) + { + BlueTeam.SetScore(ScoreLimit); + StopGame(); + Plugin.GetPlugin().getServer().getPluginManager().callEvent(new TeamGameFinishedEvent(this, BlueTeam)); + _scoreboard.Update(); + } + } + + public void AddCrazyPig(Pig pig) + { + _crazyPigs.put(pig, _lastUpdate); + } + + private void UpdateCapturedPigs() + { + Iterator>> capturedPigIterator = _capturedPigs.entrySet().iterator(); + + while (capturedPigIterator.hasNext()) + { + Entry> entry = capturedPigIterator.next(); + Pig pig = entry.getKey(); + Pig mate = entry.getValue().getKey(); + int capturedTicks = entry.getValue().getValue(); + + if (capturedTicks > 9) + { + capturedPigIterator.remove(); + ((Pig)Plugin.GetCreature().SpawnEntity(pig.getLocation(), EntityType.PIG)).setBaby(); + + if (RedTeam.HasPig()) + BlueTeam.SpawnPig((Pig)Plugin.GetCreature().SpawnEntity(pig.getLocation(), EntityType.PIG)); + else + RedTeam.SpawnPig((Pig)Plugin.GetCreature().SpawnEntity(pig.getLocation(), EntityType.PIG)); + + pig.remove(); + System.out.println("Had baby and spawned new pig."); + } + else + { + double aX = ((CraftPig)pig).getHandle().locX; + double aY = ((CraftPig)pig).getHandle().locY; + double aZ = ((CraftPig)pig).getHandle().locZ; + + double bX = ((CraftPig)mate).getHandle().locX; + double bY = ((CraftPig)mate).getHandle().locY; + double bZ = ((CraftPig)mate).getHandle().locZ; + + EntityCreature ec = ((CraftCreature)pig).getHandle(); + ec.getNavigation().a(bX + .5, bY, bZ + .5, .38f); + + ec = ((CraftCreature)mate).getHandle(); + ec.getNavigation().a(aX - .5, aY, aZ - .5, .38f); + + System.out.println("Spinning"); + } + } + + for (Pig key : _capturedPigs.keySet()) + { + _capturedPigs.get(key).setValue(_capturedPigs.get(key).getValue() + 1); + } + } + + private void UpdateCrazyPigs() + { + Iterator> crazyPigIterator = _crazyPigs.entrySet().iterator(); + + while (crazyPigIterator.hasNext()) + { + Entry entry = crazyPigIterator.next(); + Pig pig = entry.getKey(); + int crazyTicks = entry.getValue(); + EntityCreature pigCreature = ((CraftPig)pig).getHandle(); + + if (crazyTicks > 4) + crazyPigIterator.remove(); + else + { + Vec3D vec3d = RandomPositionGenerator.a(pigCreature, 5, 4); + + if (vec3d != null) + { + pigCreature.getNavigation().a(vec3d.c, vec3d.d, vec3d.e, 0.5F); + } + } + } + + for (Pig key : _crazyPigs.keySet()) + { + _crazyPigs.put(key, _crazyPigs.get(key) + 1); + } + } +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/game/CaptureThePigTeam.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/game/CaptureThePigTeam.java new file mode 100644 index 000000000..3ad2d57d2 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/game/CaptureThePigTeam.java @@ -0,0 +1,90 @@ +package nautilus.game.capturethepig.game; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Pig; +import org.bukkit.util.Vector; + +import nautilus.game.capturethepig.player.ICaptureThePigPlayer; +import nautilus.game.core.arena.Region; +import nautilus.game.core.engine.TeamType; +import nautilus.game.core.game.Team; + +public class CaptureThePigTeam extends Team implements ICaptureThePigTeam +{ + private Region _pigPen; + private Pig _pig; + + private boolean _hasPig = false; + + public CaptureThePigTeam(TeamType teamType) + { + super(teamType); + } + + @Override + public void AddPlayer(ICaptureThePigPlayer player) + { + player.SetTeam(this); + Players.add(player); + } + + @Override + public Region GetPigPen() + { + return _pigPen; + } + + @Override + public void SetPigPen(Region pigPen) + { + _pigPen = pigPen; + } + + @Override + public void CapturePig(Entity pig) + { + Vector mid = _pigPen.GetMidPoint(); + pig.teleport(new Location(pig.getWorld(), mid.getBlockX() + .5, _pigPen.GetMinimumPoint().getBlockY(), mid.getBlockZ() + .5)); + _pig.teleport(new Location(pig.getWorld(), mid.getBlockX() + .5, _pigPen.GetMinimumPoint().getBlockY(), mid.getBlockZ() + .5)); + } + + @Override + public boolean HasPig() + { + return _hasPig; + } + + @Override + public void ReturnPig() + { + _hasPig = true; + Vector mid = _pigPen.GetMidPoint(); + _pig.teleport(new Location(_pig.getWorld(), mid.getBlockX() + .5, _pigPen.GetMinimumPoint().getBlockY(), mid.getBlockZ() + .5)); + } + + @Override + public Entity RemovePig() + { + _hasPig = false; + return _pig; + } + + @Override + public void SpawnPig(Pig pig) + { + _hasPig = true; + _pig = pig; + Vector mid = _pigPen.GetMidPoint(); + _pig.teleport(new Location(pig.getWorld(), mid.getBlockX() + .5, _pigPen.GetMinimumPoint().getBlockY(), mid.getBlockZ() + .5)); + _pig.setCustomName(Enum.valueOf(ChatColor.class, GetTeamType().toString().toUpperCase()) + GetTeamType().toString()); + _pig.setCustomNameVisible(true); + } + + @Override + public Pig GetPig() + { + return _pig; + } +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/game/ICaptureThePigGame.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/game/ICaptureThePigGame.java new file mode 100644 index 000000000..e20bcb90e --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/game/ICaptureThePigGame.java @@ -0,0 +1,10 @@ +package nautilus.game.capturethepig.game; + +import nautilus.game.capturethepig.arena.ICaptureThePigArena; +import nautilus.game.capturethepig.player.ICaptureThePigPlayer; +import nautilus.game.core.game.ITeamGame; + +public interface ICaptureThePigGame extends ITeamGame +{ + +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/game/ICaptureThePigTeam.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/game/ICaptureThePigTeam.java new file mode 100644 index 000000000..60e1f64e7 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/game/ICaptureThePigTeam.java @@ -0,0 +1,20 @@ +package nautilus.game.capturethepig.game; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.Pig; + +import nautilus.game.capturethepig.player.ICaptureThePigPlayer; +import nautilus.game.core.arena.Region; +import nautilus.game.core.engine.ITeam; + +public interface ICaptureThePigTeam extends ITeam +{ + Region GetPigPen(); + void SetPigPen(Region pigPen); + void CapturePig(Entity pig); + Entity RemovePig(); + void ReturnPig(); + boolean HasPig(); + void SpawnPig(Pig pig); + Pig GetPig(); +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/player/CaptureThePigPlayer.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/player/CaptureThePigPlayer.java new file mode 100644 index 000000000..9d568c4ca --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/player/CaptureThePigPlayer.java @@ -0,0 +1,30 @@ +package nautilus.game.capturethepig.player; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import nautilus.game.capturethepig.game.ICaptureThePigTeam; +import nautilus.game.core.player.TeamGamePlayer; + +public class CaptureThePigPlayer extends TeamGamePlayer implements ICaptureThePigPlayer +{ + private int _captures; + + public CaptureThePigPlayer(JavaPlugin plugin, Player player) + { + super(plugin, player); + + SetLives(1); + } + + public void AddCapture() + { + _captures++; + } + + @Override + public int GetCaptures() + { + return _captures; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/player/ICaptureThePigPlayer.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/player/ICaptureThePigPlayer.java new file mode 100644 index 000000000..6c8287544 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/player/ICaptureThePigPlayer.java @@ -0,0 +1,10 @@ +package nautilus.game.capturethepig.player; + +import nautilus.game.capturethepig.game.ICaptureThePigTeam; +import nautilus.game.core.player.ITeamGamePlayer; + +public interface ICaptureThePigPlayer extends ITeamGamePlayer +{ + void AddCapture(); + int GetCaptures(); +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/repository/CaptureThePigRepository.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/repository/CaptureThePigRepository.java new file mode 100644 index 000000000..03502745b --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/repository/CaptureThePigRepository.java @@ -0,0 +1,34 @@ +package nautilus.game.capturethepig.repository; + +import java.util.List; + +import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; + +import mineplex.core.server.RemoteRepository; +import mineplex.core.server.remotecall.JsonWebCall; +import mineplex.core.server.util.Callback; +import mineplex.minecraft.donation.repository.token.PlayerUpdateToken; +import nautilus.game.capturethepig.stats.CaptureThePigGameStatsToken; + +public class CaptureThePigRepository extends RemoteRepository implements ICaptureThePigRepository +{ + public CaptureThePigRepository(String webServerAddress) + { + super(webServerAddress); + } + + @Override + public void SaveGameStats(final Callback> callback, final CaptureThePigGameStatsToken captureThePigGameStats) + { + Thread asyncThread = new Thread(new Runnable() + { + public void run() + { + List tokenList = new JsonWebCall(WebServerAddress + "CaptureThePig/UploadStats").Execute(new TypeToken>(){}.getType(), captureThePigGameStats); + callback.run(tokenList); + } + }); + + asyncThread.start(); + } +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/repository/ICaptureThePigRepository.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/repository/ICaptureThePigRepository.java new file mode 100644 index 000000000..2841a547f --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/repository/ICaptureThePigRepository.java @@ -0,0 +1,14 @@ +package nautilus.game.capturethepig.repository; + +import java.util.List; + +import mineplex.core.server.IRepository; +import mineplex.core.server.util.Callback; +import mineplex.minecraft.donation.repository.token.PlayerUpdateToken; +import nautilus.game.capturethepig.stats.CaptureThePigGameStatsToken; + + +public interface ICaptureThePigRepository extends IRepository +{ + void SaveGameStats(Callback> callback, CaptureThePigGameStatsToken captureThePigGameStats); +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/scoreboard/CaptureThePigScoreHandler.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/scoreboard/CaptureThePigScoreHandler.java new file mode 100644 index 000000000..5eeaf418d --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/scoreboard/CaptureThePigScoreHandler.java @@ -0,0 +1,35 @@ +package nautilus.game.capturethepig.scoreboard; + +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + +import nautilus.game.capturethepig.arena.ICaptureThePigArena; +import nautilus.game.capturethepig.engine.CaptureThePigNotifier; +import nautilus.game.capturethepig.event.PigCapturedEvent; +import nautilus.game.capturethepig.game.ICaptureThePigGame; +import nautilus.game.capturethepig.game.ICaptureThePigTeam; +import nautilus.game.capturethepig.player.ICaptureThePigPlayer; +import nautilus.game.core.scoreboard.TeamGameScoreHandler; + +public class CaptureThePigScoreHandler extends TeamGameScoreHandler implements ICaptureThePigScoreHandler +{ + public CaptureThePigScoreHandler(JavaPlugin plugin, CaptureThePigNotifier notifier) + { + super(plugin, notifier); + } + + @EventHandler + public void OnPigCaptured(PigCapturedEvent event) + { + ICaptureThePigTeam ownerTeam = event.GetCapturer().GetTeam(); + + event.GetCapturer().AddCapture(); + ownerTeam.AddPoint(); + } + + @Override + protected int GetKillModifierValue(ICaptureThePigPlayer killer, ICaptureThePigPlayer victim, int assists) + { + return 5 * victim.GetTeam().GetScore(); + } +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/scoreboard/CaptureThePigTabScoreboard.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/scoreboard/CaptureThePigTabScoreboard.java new file mode 100644 index 000000000..c3a64cd3b --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/scoreboard/CaptureThePigTabScoreboard.java @@ -0,0 +1,142 @@ +package nautilus.game.capturethepig.scoreboard; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.bukkit.ChatColor; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.NautHashMap; + +import mineplex.minecraft.game.classcombat.Class.ClassManager; +import mineplex.minecraft.game.classcombat.Class.ClientClass; + +import nautilus.game.capturethepig.game.ICaptureThePigGame; +import nautilus.game.capturethepig.game.ICaptureThePigTeam; +import nautilus.game.capturethepig.player.ICaptureThePigPlayer; +import nautilus.game.core.scoreboard.LineTracker; +import nautilus.game.core.scoreboard.TabScoreboard; +import nautilus.minecraft.core.utils.TimeStuff; + +public class CaptureThePigTabScoreboard extends TabScoreboard +{ + List _redSortedTeamPlayers = new ArrayList(); + List _blueSortedTeamPlayers = new ArrayList(); + + public CaptureThePigTabScoreboard(JavaPlugin plugin, CoreClientManager clientManager, ClassManager classManager, PacketHandler packetHandler, ICaptureThePigGame game) + { + super(plugin, clientManager, classManager, packetHandler, game); + } + + protected void SetRedTeamInfo() + { + RedColumn.get(0).SetLine(ChatColor.RED + " [RED]"); + RedColumn.get(1).SetLine(ChatColor.RED + "Score: " + ChatColor.WHITE + Game.GetRedTeam().GetScore()); + RedColumn.get(2).SetLine(ChatColor.RED + "[Top Players]"); + RedColumn.get(3).SetLine(ChatColor.RED + " [K/D/A C]"); + + _redSortedTeamPlayers.clear(); + _redSortedTeamPlayers.addAll(Game.GetRedTeam().GetPlayers()); + Collections.sort(_redSortedTeamPlayers, new PlayerSorter()); + + String spacer = ""; + for (int i=0; i < 8; i++) + { + int lineIndex = 4 + i * 2; + spacer += " "; + + if (i < _redSortedTeamPlayers.size()) + { + ICaptureThePigPlayer player = _redSortedTeamPlayers.get(i); + + ChatColor playerColor = !player.isOnline() ? ChatColor.DARK_GRAY : ChatColor.WHITE; + RedColumn.get(lineIndex).SetLine(playerColor + player.getName()); + RedColumn.get(lineIndex+1).SetLine(ChatColor.RED + "" + player.GetKills() + "/" + player.GetDeaths() + "/" + player.GetAssists() + " " + player.GetCaptures() + spacer); + } + else + { + RedColumn.get(lineIndex).SetLine(ChatColor.RED + "" + ChatColor.GREEN + spacer); + RedColumn.get(lineIndex+1).SetLine(ChatColor.RED + "" + ChatColor.BLUE + spacer); + } + } + } + + protected void SetMainInfo(ICaptureThePigPlayer player) + { + if (!player.isOnline()) + return; + + ClientClass clientPlayer = ClassManager.Get(player.GetPlayer()); + + if (!MainColumn.containsKey(player.getName())) + { + NautHashMap playerLines = new NautHashMap(); + + for (Integer i=0; i < 20; i++) + { + playerLines.put(i, new LineTracker(PacketHandler, "Game")); + } + + MainColumn.put(player.getName(), playerLines); + } + + NautHashMap playerLines = MainColumn.get(player.getName()); + + playerLines.get(0).SetLine(ChatColor.GREEN + " [Dominate]"); + playerLines.get(1).SetLine(ChatColor.GREEN + "Map:"); + playerLines.get(2).SetLine(Game.GetArena().GetName()); + playerLines.get(3).SetLine(ChatColor.GREEN + "Win Limit:"); + playerLines.get(4).SetLine(Game.GetWinLimit() + ""); + playerLines.get(5).SetLine(ChatColor.GREEN + "Duration:"); + playerLines.get(6).SetLine((Game.GetStartTime() == 0 ? "0" : TimeStuff.GetTimespanString(System.currentTimeMillis() - Game.GetStartTime()))); + playerLines.get(7).SetLine(ChatColor.GREEN + ""); + playerLines.get(8).SetLine(ChatColor.GREEN + " [Stats]"); + playerLines.get(9).SetLine(ChatColor.GREEN + "Class:" ); + playerLines.get(10).SetLine((clientPlayer.GetGameClass() == null ? "None" : clientPlayer.GetGameClass().GetName())); + playerLines.get(11).SetLine(ChatColor.GREEN + "Kills:"); + playerLines.get(12).SetLine(player.GetKills() + " "); + playerLines.get(13).SetLine(ChatColor.GREEN + "Deaths:"); + playerLines.get(14).SetLine(player.GetDeaths() + " "); + playerLines.get(15).SetLine(ChatColor.GREEN + "Assists:"); + playerLines.get(16).SetLine(player.GetAssists() + " "); + playerLines.get(17).SetLine(ChatColor.GREEN + "Captures:"); + playerLines.get(18).SetLine(player.GetCaptures() + " "); + playerLines.get(19).SetLine(ChatColor.GREEN + " "); + } + + protected void SetBlueTeamInfo() + { + BlueColumn.get(0).SetLine(ChatColor.BLUE + " [BLUE]"); + BlueColumn.get(1).SetLine(ChatColor.BLUE + "Score: " + ChatColor.WHITE + Game.GetBlueTeam().GetScore()); + BlueColumn.get(2).SetLine(ChatColor.BLUE + "[Top Players]"); + BlueColumn.get(3).SetLine(ChatColor.BLUE + " [K/D/A C]"); + + _blueSortedTeamPlayers.clear(); + _blueSortedTeamPlayers.addAll(Game.GetBlueTeam().GetPlayers()); + Collections.sort(_blueSortedTeamPlayers, new PlayerSorter()); + + String spacer = ""; + for (int i=0; i < 8; i++) + { + int lineIndex = 4 + i * 2; + spacer += " "; + + if (i < _blueSortedTeamPlayers.size()) + { + ICaptureThePigPlayer player = _blueSortedTeamPlayers.get(i); + + ChatColor playerColor = !player.isOnline() ? ChatColor.DARK_GRAY : ChatColor.WHITE; + BlueColumn.get(lineIndex).SetLine(playerColor + player.getName()); + BlueColumn.get(lineIndex+1).SetLine(ChatColor.BLUE + "" + player.GetKills() + "/" + player.GetDeaths() + "/" + player.GetAssists() + " " + player.GetCaptures() + spacer); + } + else + { + BlueColumn.get(lineIndex).SetLine(ChatColor.BLUE + " " + ChatColor.GREEN + spacer); + BlueColumn.get(lineIndex+1).SetLine(ChatColor.BLUE + " " + ChatColor.RED + spacer); + } + } + } +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/scoreboard/ICaptureThePigScoreHandler.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/scoreboard/ICaptureThePigScoreHandler.java new file mode 100644 index 000000000..04b2c4206 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/scoreboard/ICaptureThePigScoreHandler.java @@ -0,0 +1,10 @@ +package nautilus.game.capturethepig.scoreboard; + +import nautilus.game.capturethepig.game.ICaptureThePigTeam; +import nautilus.game.capturethepig.player.ICaptureThePigPlayer; +import nautilus.game.core.scoreboard.ITeamScoreHandler; + +public interface ICaptureThePigScoreHandler extends ITeamScoreHandler +{ + +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/scoreboard/PlayerSorter.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/scoreboard/PlayerSorter.java new file mode 100644 index 000000000..e12397cbf --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/scoreboard/PlayerSorter.java @@ -0,0 +1,34 @@ +package nautilus.game.capturethepig.scoreboard; + +import java.util.Comparator; + +import nautilus.game.capturethepig.player.ICaptureThePigPlayer; + +public class PlayerSorter implements Comparator +{ + public int compare(ICaptureThePigPlayer a, ICaptureThePigPlayer b) + { + if (a.GetCaptures() > b.GetCaptures()) + return -1; + + boolean capturesEqual = a.GetCaptures() == b.GetCaptures(); + + if (capturesEqual && a.GetKills() > b.GetKills()) + return -1; + + boolean killsEqual = a.GetKills() == b.GetKills(); + + if (capturesEqual && killsEqual && a.GetAssists() > b.GetAssists()) + return -1; + + boolean assistsEqual = a.GetAssists() == b.GetAssists(); + + if (capturesEqual && killsEqual && assistsEqual && a.GetDeaths() < b.GetDeaths()) + return -1; + + if (capturesEqual && killsEqual && assistsEqual && a.GetDeaths() == b.GetDeaths()) + return 0; + + return 1; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/stats/CaptureThePigGameStatsToken.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/stats/CaptureThePigGameStatsToken.java new file mode 100644 index 000000000..c641a0278 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/stats/CaptureThePigGameStatsToken.java @@ -0,0 +1,10 @@ +package nautilus.game.capturethepig.stats; + +import java.util.List; + +public class CaptureThePigGameStatsToken +{ + public long Length; + + public List PlayerStats; +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/stats/CaptureThePigPlayerStats.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/stats/CaptureThePigPlayerStats.java new file mode 100644 index 000000000..b8f5cae2c --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/stats/CaptureThePigPlayerStats.java @@ -0,0 +1,9 @@ +package nautilus.game.capturethepig.stats; + +public class CaptureThePigPlayerStats +{ + public int Captures; + public int Kills; + public int Deaths; + public int Assists; +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/stats/CaptureThePigPlayerStatsToken.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/stats/CaptureThePigPlayerStatsToken.java new file mode 100644 index 000000000..26dd1ca62 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/stats/CaptureThePigPlayerStatsToken.java @@ -0,0 +1,9 @@ +package nautilus.game.capturethepig.stats; + +public class CaptureThePigPlayerStatsToken +{ + public String Name; + public boolean Won; + public long TimePlayed; + public CaptureThePigPlayerStats PlayerStats; +} diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/stats/CaptureThePigStatsReporter.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/stats/CaptureThePigStatsReporter.java new file mode 100644 index 000000000..5ab456021 --- /dev/null +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/stats/CaptureThePigStatsReporter.java @@ -0,0 +1,94 @@ +package nautilus.game.capturethepig.stats; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.ChatColor; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; + +import nautilus.game.capturethepig.engine.CaptureThePigGameEngine; +import nautilus.game.capturethepig.game.ICaptureThePigGame; +import nautilus.game.capturethepig.game.ICaptureThePigTeam; +import nautilus.game.capturethepig.player.ICaptureThePigPlayer; +import nautilus.game.capturethepig.repository.ICaptureThePigRepository; +import nautilus.game.core.events.team.TeamGameFinishedEvent; +import me.chiss.Core.Plugin.IPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.donation.repository.token.PlayerUpdateToken; + +public class CaptureThePigStatsReporter implements Listener +{ + private JavaPlugin _plugin; + private CaptureThePigGameEngine _engine; + private ICaptureThePigRepository _repository; + + public CaptureThePigStatsReporter(JavaPlugin plugin, CaptureThePigGameEngine engine, ICaptureThePigRepository repository) + { + _plugin = plugin; + _engine = engine; + _plugin.getServer().getPluginManager().registerEvents(this, _plugin); + _repository = repository; + } + + @EventHandler + public void OnGameFinished(TeamGameFinishedEvent event) + { + CaptureThePigGameStatsToken gameStats = new CaptureThePigGameStatsToken(); + gameStats.Length = System.currentTimeMillis() - event.GetGame().GetStartTime(); + gameStats.PlayerStats = new ArrayList(event.GetGame().GetPlayers().size()); + + for (ICaptureThePigPlayer player : event.GetGame().GetPlayers()) + { + CaptureThePigPlayerStats stats = new CaptureThePigPlayerStats(); + + stats.Captures = player.GetPoints(); + stats.Kills = player.GetKills(); + stats.Deaths = player.GetDeaths(); + stats.Assists = player.GetAssists(); + + CaptureThePigPlayerStatsToken token = new CaptureThePigPlayerStatsToken(); + token.Name = player.getName(); + token.Won = event.GetGame().GetWinLimit() == player.GetTeam().GetScore(); + token.TimePlayed = player.GetTimePlayed(); + token.PlayerStats = stats; + + gameStats.PlayerStats.add(token); + } + + _repository.SaveGameStats(new Callback>() + { + public void run(List tokenList) + { + for (PlayerUpdateToken token : tokenList) + { + try + { + CoreClient client = _plugin.GetClients().GetNull(token.Name); + + if (client != null && client.GetPlayer().isOnline()) + { + client.Donor().AddPoints(token.Points); + + _engine.UpdatePlayerLobbyItemBalances(client); + + client.GetPlayer().sendMessage(F.main(_engine.GetGameType(), "You earned " + ChatColor.YELLOW + token.Points + C.cGray + " points for playing!")); + } + } + catch (Exception ex) + { + System.out.println("Error updating player with token : " + token.Name + "\n" + ex.getMessage()); + + for (StackTraceElement trace : ex.getStackTrace()) + { + System.out.println(trace); + } + } + } + } + }, gameStats); + } +} diff --git a/Plugins/Nautilus.Game.Core/.classpath b/Plugins/Nautilus.Game.Core/.classpath new file mode 100644 index 000000000..f1dec1b2a --- /dev/null +++ b/Plugins/Nautilus.Game.Core/.classpath @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.Core/.externalToolBuilders/Nautilus.Game.Core.launch b/Plugins/Nautilus.Game.Core/.externalToolBuilders/Nautilus.Game.Core.launch new file mode 100644 index 000000000..f4615444e --- /dev/null +++ b/Plugins/Nautilus.Game.Core/.externalToolBuilders/Nautilus.Game.Core.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.Core/.project b/Plugins/Nautilus.Game.Core/.project new file mode 100644 index 000000000..e934c4eb8 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/.project @@ -0,0 +1,27 @@ + + + Nautilus.Game.Core + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + auto,full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/Nautilus.Game.Core.launch + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Nautilus.Game.Core/.settings/org.eclipse.jdt.core.prefs b/Plugins/Nautilus.Game.Core/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..8000cd6ca --- /dev/null +++ b/Plugins/Nautilus.Game.Core/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/Plugins/Nautilus.Game.Core/Nautilus.Game.Core.xml b/Plugins/Nautilus.Game.Core/Nautilus.Game.Core.xml new file mode 100644 index 000000000..16038ca57 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/Nautilus.Game.Core.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/GamePlugin.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/GamePlugin.class new file mode 100644 index 000000000..eec622dd8 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/GamePlugin.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/Arena.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/Arena.class new file mode 100644 index 000000000..83b387a50 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/Arena.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/ArenaManager$1.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/ArenaManager$1.class new file mode 100644 index 000000000..7b7e0dd77 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/ArenaManager$1.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/ArenaManager.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/ArenaManager.class new file mode 100644 index 000000000..4e9592454 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/ArenaManager.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/IArena.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/IArena.class new file mode 100644 index 000000000..87e46ac95 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/IArena.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/IArenaParser.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/IArenaParser.class new file mode 100644 index 000000000..08eaa9c99 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/IArenaParser.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/IArenaReloadedListener.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/IArenaReloadedListener.class new file mode 100644 index 000000000..80b443a41 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/IArenaReloadedListener.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/ITeamArena.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/ITeamArena.class new file mode 100644 index 000000000..54f8eccca Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/ITeamArena.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/Region.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/Region.class new file mode 100644 index 000000000..2eff5d677 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/Region.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/RegionManager.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/RegionManager.class new file mode 100644 index 000000000..143d14b43 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/RegionManager.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/TeamArena.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/TeamArena.class new file mode 100644 index 000000000..28d099258 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/TeamArena.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/BlueShopPoints.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/BlueShopPoints.class new file mode 100644 index 000000000..b9c7134d5 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/BlueShopPoints.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/BlueSpawnPoints.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/BlueSpawnPoints.class new file mode 100644 index 000000000..164c974fe Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/BlueSpawnPoints.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/BlueSpawnRoom.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/BlueSpawnRoom.class new file mode 100644 index 000000000..95ea762f6 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/BlueSpawnRoom.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/BorderProperty.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/BorderProperty.class new file mode 100644 index 000000000..5325b4dd4 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/BorderProperty.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/Center.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/Center.class new file mode 100644 index 000000000..2d746a658 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/Center.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/IProperty.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/IProperty.class new file mode 100644 index 000000000..c462b44dc Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/IProperty.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/MapName.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/MapName.class new file mode 100644 index 000000000..bdde32a6c Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/MapName.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/Offset.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/Offset.class new file mode 100644 index 000000000..a7b3e1c80 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/Offset.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/PropertyBase.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/PropertyBase.class new file mode 100644 index 000000000..357cf9249 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/PropertyBase.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/RedShopPoints.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/RedShopPoints.class new file mode 100644 index 000000000..51aba4fe4 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/RedShopPoints.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/RedSpawnPoints.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/RedSpawnPoints.class new file mode 100644 index 000000000..aae01d35d Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/RedSpawnPoints.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/RedSpawnRoom.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/RedSpawnRoom.class new file mode 100644 index 000000000..8ea82032e Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/RedSpawnRoom.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/RegionPropertyBase.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/RegionPropertyBase.class new file mode 100644 index 000000000..29466117b Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/arena/property/RegionPropertyBase.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/GameEngine.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/GameEngine.class new file mode 100644 index 000000000..5d8d6b7b2 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/GameEngine.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/GameScheduler.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/GameScheduler.class new file mode 100644 index 000000000..e7657dff9 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/GameScheduler.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/IGameEngine.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/IGameEngine.class new file mode 100644 index 000000000..3fe3eeaf4 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/IGameEngine.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/ITeam.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/ITeam.class new file mode 100644 index 000000000..59e5bcc9e Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/ITeam.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/ITeamGameEngine.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/ITeamGameEngine.class new file mode 100644 index 000000000..c20dc1e84 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/ITeamGameEngine.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/TeamGameEngine$1.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/TeamGameEngine$1.class new file mode 100644 index 000000000..051bb81e6 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/TeamGameEngine$1.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/TeamGameEngine$2.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/TeamGameEngine$2.class new file mode 100644 index 000000000..af0db0bd7 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/TeamGameEngine$2.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/TeamGameEngine.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/TeamGameEngine.class new file mode 100644 index 000000000..e0d01b245 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/TeamGameEngine.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/TeamType.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/TeamType.class new file mode 100644 index 000000000..cea1348d7 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/engine/TeamType.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GameActivatedEvent.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GameActivatedEvent.class new file mode 100644 index 000000000..dde91d53a Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GameActivatedEvent.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GameDeactivatedEvent.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GameDeactivatedEvent.class new file mode 100644 index 000000000..27129eab8 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GameDeactivatedEvent.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GameEvent.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GameEvent.class new file mode 100644 index 000000000..ea8ba52b4 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GameEvent.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GameFinishedEvent.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GameFinishedEvent.class new file mode 100644 index 000000000..b84cec064 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GameFinishedEvent.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GamePlayerAfkEvent.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GamePlayerAfkEvent.class new file mode 100644 index 000000000..e4080a8c8 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GamePlayerAfkEvent.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GamePlayerAttackedPlayerEvent.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GamePlayerAttackedPlayerEvent.class new file mode 100644 index 000000000..dba4a573f Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GamePlayerAttackedPlayerEvent.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GamePlayerDeathEvent.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GamePlayerDeathEvent.class new file mode 100644 index 000000000..47717d4a5 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GamePlayerDeathEvent.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GamePlayerJoinedEvent.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GamePlayerJoinedEvent.class new file mode 100644 index 000000000..59b82e7df Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GamePlayerJoinedEvent.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GamePlayerQuitEvent.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GamePlayerQuitEvent.class new file mode 100644 index 000000000..a6fefc023 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GamePlayerQuitEvent.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GameStartedEvent.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GameStartedEvent.class new file mode 100644 index 000000000..3514eae6f Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/GameStartedEvent.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/team/TeamGameFinishedEvent.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/team/TeamGameFinishedEvent.class new file mode 100644 index 000000000..3b7b61bf8 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/events/team/TeamGameFinishedEvent.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/Game$1.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/Game$1.class new file mode 100644 index 000000000..5feac0b32 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/Game$1.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/Game$2.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/Game$2.class new file mode 100644 index 000000000..9ca494331 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/Game$2.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/Game.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/Game.class new file mode 100644 index 000000000..2f6bdb680 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/Game.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/IGame.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/IGame.class new file mode 100644 index 000000000..66bdd8746 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/IGame.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/ITeamGame.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/ITeamGame.class new file mode 100644 index 000000000..3984fb8b9 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/ITeamGame.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/Team.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/Team.class new file mode 100644 index 000000000..91a95d650 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/Team.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/TeamGame.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/TeamGame.class new file mode 100644 index 000000000..37f9b1503 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/game/TeamGame.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/notifier/IPlayerNotifier.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/notifier/IPlayerNotifier.class new file mode 100644 index 000000000..92fb0b51b Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/notifier/IPlayerNotifier.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/notifier/PlayerNotifier.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/notifier/PlayerNotifier.class new file mode 100644 index 000000000..607938125 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/notifier/PlayerNotifier.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/notifier/TeamPlayerNotifier.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/notifier/TeamPlayerNotifier.class new file mode 100644 index 000000000..08ed72d5d Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/notifier/TeamPlayerNotifier.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/player/GamePlayer.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/player/GamePlayer.class new file mode 100644 index 000000000..67e167b79 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/player/GamePlayer.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/player/IGamePlayer.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/player/IGamePlayer.class new file mode 100644 index 000000000..371ab95b5 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/player/IGamePlayer.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/player/ITeamGamePlayer.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/player/ITeamGamePlayer.class new file mode 100644 index 000000000..06daac693 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/player/ITeamGamePlayer.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/player/TeamGamePlayer.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/player/TeamGamePlayer.class new file mode 100644 index 000000000..6efaa2522 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/player/TeamGamePlayer.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/IScoreHandler.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/IScoreHandler.class new file mode 100644 index 000000000..7d99fc223 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/IScoreHandler.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/ITeamScoreHandler.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/ITeamScoreHandler.class new file mode 100644 index 000000000..1d1a6b3a7 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/ITeamScoreHandler.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/LineTracker.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/LineTracker.class new file mode 100644 index 000000000..a04e3884f Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/LineTracker.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/PlayerPointSorter.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/PlayerPointSorter.class new file mode 100644 index 000000000..078aef352 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/PlayerPointSorter.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/TabScoreboard.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/TabScoreboard.class new file mode 100644 index 000000000..b8addce80 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/TabScoreboard.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/TeamGameScoreHandler.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/TeamGameScoreHandler.class new file mode 100644 index 000000000..09d72c810 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/scoreboard/TeamGameScoreHandler.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastMinuteTimer$1.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastMinuteTimer$1.class new file mode 100644 index 000000000..443daac1a Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastMinuteTimer$1.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastMinuteTimer$2.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastMinuteTimer$2.class new file mode 100644 index 000000000..1c4ddcd63 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastMinuteTimer$2.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastMinuteTimer.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastMinuteTimer.class new file mode 100644 index 000000000..53929a552 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastMinuteTimer.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastSecondTimer$1.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastSecondTimer$1.class new file mode 100644 index 000000000..337f414e3 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastSecondTimer$1.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastSecondTimer.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastSecondTimer.class new file mode 100644 index 000000000..454d5967b Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastSecondTimer.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastTimer.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastTimer.class new file mode 100644 index 000000000..05956f5cb Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/BroadcastTimer.class differ diff --git a/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/NullChunkGenerator.class b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/NullChunkGenerator.class new file mode 100644 index 000000000..665a9eda0 Binary files /dev/null and b/Plugins/Nautilus.Game.Core/bin/nautilus/game/core/util/NullChunkGenerator.class differ diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/GamePlugin.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/GamePlugin.java new file mode 100644 index 000000000..9a8c3365b --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/GamePlugin.java @@ -0,0 +1,162 @@ +package nautilus.game.core; + +import java.util.HashSet; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.antistack.AntiStack; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.command.CommandCenter; +import mineplex.core.creature.Creature; +import mineplex.core.donation.DonationManager; +import mineplex.core.energy.Energy; +import mineplex.core.fakeEntity.FakeEntityManager; +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.MemoryFix.MemoryFix; +import me.chiss.Core.Module.ModuleManager; +import me.chiss.Core.Modules.*; +import mineplex.core.message.MessageManager; +import mineplex.core.movement.Movement; +import mineplex.core.npc.NpcManager; +import mineplex.core.projectile.ProjectileManager; +import mineplex.core.punish.Punish; +import mineplex.core.recharge.Recharge; +import mineplex.core.server.Server; +import mineplex.core.server.ServerListener; +import mineplex.core.server.ServerTalker; +import mineplex.core.spawn.Spawn; +import mineplex.core.teleport.Teleport; +import mineplex.core.updater.Updater; +import mineplex.minecraft.game.classcombat.Class.ClassManager; +import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.item.ItemFactory; +import mineplex.minecraft.game.classcombat.shop.ClassCombatCustomBuildShop; +import mineplex.minecraft.game.classcombat.shop.ClassCombatPurchaseShop; +import mineplex.minecraft.game.classcombat.shop.ClassCombatShop; +import mineplex.minecraft.game.classcombat.shop.ClassShopManager; +import mineplex.minecraft.game.core.IRelation; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.combat.*; +import mineplex.minecraft.game.core.damage.DamageManager; +import mineplex.minecraft.game.core.fire.Fire; +import mineplex.minecraft.game.core.mechanics.PistonJump; +import nautilus.game.core.util.NullChunkGenerator; + +import org.bukkit.Location; +import org.bukkit.generator.ChunkGenerator; +import org.bukkit.plugin.java.JavaPlugin; + +public abstract class GamePlugin extends JavaPlugin implements IRelation +{ + private String WEB_CONFIG = "webServer"; + + private BlockRestore _blockRestore; + protected ClassManager ClassManager; + protected CombatManager CombatManager; + protected ConditionManager ConditionManager; + protected CoreClientManager ClientManager; + private Creature _creature; + private DamageManager _damage; + protected DonationManager DonationManager; + protected Energy Energy; + private Fire _fire; + private ModuleManager _moduleManager; + protected NpcManager NpcManager; + protected SkillFactory SkillManager; + private Spawn _spawn; + private Teleport _teleport; + private ProjectileManager _throw; + + private ServerListener _serverListener; + private Location _spawnLocation; + + protected ServerTalker HubConnection; + + @Override + public void onEnable() + { + getConfig().addDefault(WEB_CONFIG, "http://api.mineplex.com/"); + getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); + saveConfig(); + + _spawnLocation = new Location(getServer().getWorlds().get(0), -7.5, 18.5, 24.5, 90, 0); + + ClientManager = CoreClientManager.Initialize(this, GetWebServerAddress()); + CommandCenter.Initialize(this, ClientManager); + + FakeEntityManager.Initialize(this); + ItemStackFactory.Initialize(this, true); + Recharge.Initialize(this); + + _moduleManager = new ModuleManager(); + + Updater updater = new Updater(this); + _creature = new Creature(this); + Energy = new Energy(this); + DonationManager = new DonationManager(this, GetWebServerAddress()); + ConditionManager = new SkillConditionManager(this); + CombatManager = new CombatManager(this); + _blockRestore = new BlockRestore(this); + _throw = new ProjectileManager(this); + _spawn = new Spawn(this); + _teleport = new Teleport(this, ClientManager, _spawn); + NpcManager = new NpcManager(this, _creature); + _damage = new DamageManager(this, CombatManager, NpcManager); + _fire = new Fire(this, ConditionManager, _damage); + new Punish(this, GetWebServerAddress()); + + + SkillManager = new SkillFactory(this, _damage, this, CombatManager, ConditionManager, _throw, _blockRestore, _fire, new Movement(this), _teleport, Energy, GetWebServerAddress()); + ClassManager = new ClassManager(this, ClientManager, DonationManager, SkillManager, GetWebServerAddress()); + new ItemFactory(this, _blockRestore, ClassManager, ConditionManager, _damage, Energy, _fire, _throw, GetWebServerAddress(), new HashSet()); + + new MessageManager(this, ClientManager); + + new Blood(this); + new JoinQuit(); + new Server(); + new AntiStack(this); + new MemoryFix(this); + new PistonJump(this); + + getServer().getScheduler().scheduleSyncRepeatingTask(this, updater, 1, 1); + + // _serverListener = new ServerListener(GetWebServerAddress(), getServer().getIp(), getServer().getPort() + 1); + // _serverListener.start(); + + //HubConnection = new ServerTalker(getConfig().getString(HUB_SERVER)); + // HubConnection.start(); + + //HubConnection.QueuePacket(new ServerReadyPacket(getServer().getIp() + ":" + getServer().getPort())); + + ClassShopManager shopManager = new ClassShopManager(this, ClassManager, SkillManager, null); + new ClassCombatShop(shopManager, ClientManager, DonationManager, "Select Class Here"); + new ClassCombatPurchaseShop(shopManager, ClientManager, DonationManager, "Purchase Skills Here"); + new ClassCombatCustomBuildShop(shopManager, ClientManager, DonationManager, "Customize Builds Here"); + } + + protected abstract String GetServerName(); + + @Override + public void onDisable() + { + _moduleManager.onDisable(); + _serverListener.Shutdown(); + } + + public String GetWebServerAddress() + { + return getConfig().getString(WEB_CONFIG); + } + + public Location GetSpawnLocation() + { + return _spawnLocation; + } + + @Override + public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) + { + return new NullChunkGenerator(); + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/Arena.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/Arena.java new file mode 100644 index 000000000..e58309d88 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/Arena.java @@ -0,0 +1,263 @@ +package nautilus.game.core.arena; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import mineplex.core.common.util.WorldUtil; +import net.minecraft.server.v1_6_R2.ChunkCoordinates; + +import org.bukkit.craftbukkit.v1_6_R2.CraftWorld; +import org.bukkit.World; +import org.bukkit.WorldCreator; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; +import org.bukkit.util.Vector; + +public class Arena implements IArena +{ + private Region _bounds; + + protected String Name; + protected World World; + protected List Regions; + protected Set Listeners = new HashSet(); + + protected int ChunkX; + protected int ChunkZ; + protected int MaxChunkX; + protected int MaxChunkZ; + protected int MinChunkX; + protected int MinChunkZ; + + protected int SpawnChunkX = -196; + protected int SpawnChunkZ = -196; + protected int SpawnMaxChunkX = 196; + protected int SpawnMaxChunkZ = 196; + + public Arena(String fileName) + { + Name = fileName; + + Regions = new ArrayList(); + + World = WorldUtil.LoadWorld(WorldCreator.name(fileName).environment(org.bukkit.World.Environment.NORMAL).generateStructures(false)); + } + + public String MapName; + public Vector Center; + public Vector Offset; + + public boolean LoadArena(long maxMilliseconds) + { + long startTime = System.currentTimeMillis(); + + ChunkCoordinates chunkcoordinates = new ChunkCoordinates(((CraftWorld)World).getHandle().worldData.c(), ((CraftWorld)World).getHandle().worldData.d(), ((CraftWorld)World).getHandle().worldData.e()); + for (; SpawnChunkX <= SpawnMaxChunkX; SpawnChunkX += 16) + { + for (; SpawnChunkZ <= SpawnMaxChunkZ; SpawnChunkZ += 16) + { + if (System.currentTimeMillis() - startTime >= maxMilliseconds) + return false; + + ((CraftWorld)World).getHandle().chunkProviderServer.getChunkAt(chunkcoordinates.x + SpawnChunkX >> 4, chunkcoordinates.z + SpawnChunkZ >> 4); + } + + SpawnChunkZ = -196; + } + + for (; ChunkX <= MaxChunkX; ChunkX++) + { + for (; ChunkZ <= MaxChunkZ; ChunkZ++) + { + if (System.currentTimeMillis() - startTime >= maxMilliseconds) + return false; + + World.loadChunk(ChunkX, ChunkZ, false); + } + + ChunkZ = MinChunkZ; + } + + return true; + } + + public void Deactivate() + { + _bounds = null; + World = null; + + Regions.clear(); + Regions = null; + + Listeners.clear(); + Listeners = null; + } + + public World GetWorld() + { + return World; + } + + public Region GetBounds() + { + return _bounds; + } + + public void SetBounds(Region region) + { + _bounds = region; + _bounds.SetPriority(-1); + Regions.add(_bounds); + + UpdateChunkVars(_bounds); + Vector midPoint = _bounds.GetMidPoint(); + World.setSpawnLocation(midPoint.getBlockX(), midPoint.getBlockY(), midPoint.getBlockZ()); + } + + public boolean IsInArena(Vector location) + { + return _bounds.Contains(location); + } + + public boolean IsChunkInArena(int x, int z) + { + return x >= MinChunkX && z >= MinChunkZ && x <= MaxChunkX && z <= MaxChunkZ; + } + + public boolean CanMove(String playerName, Vector from, Vector to) + { + boolean inRegions = false; + boolean canMove = false; + int priority = -999; + + for (Region region : Regions) + { + if (region.Contains(to)) + { + inRegions = true; + } + + if (region.GetPriority() > priority) + { + if (region.Contains(to)) + { + canMove = region.CanEnter(playerName); + priority = region.GetPriority(); + } + } + } + + if (!inRegions) + { + return false; + } + + return canMove; + } + + public boolean CanInteract(String playerName, Block block) + { + boolean inRegions = false; + boolean canInteract = false; + int priority = -999; + + for (Region region : Regions) + { + if (region.Contains(block.getLocation().toVector())) + { + inRegions = true; + } + + if (region.GetPriority() > priority) + { + if (region.Contains(block.getLocation().toVector())) + { + canInteract = region.CanChangeBlocks(playerName); + priority = region.GetPriority(); + } + } + } + + if (!inRegions) + { + return false; + } + + return canInteract; + } + + public void ClearRegionOwners() + { + for (Region region : Regions) + { + region.SetOwners(new ArrayList()); + } + } + + public void ClearItems() + { + List entities = World.getEntities(); + + for (Entity entity : entities) + { + if (entity instanceof Item) + { + if (_bounds.Contains(entity.getLocation().toVector())) + { + entity.remove(); + } + } + } + } + + public void UpdateChunkVars(Region region) + { + if (region.GetMinimumPoint().getBlockX() >> 4 < ChunkX) + ChunkX = region.GetMinimumPoint().getBlockX() >> 4; + + if (region.GetMaximumPoint().getBlockX() >> 4 > MaxChunkX) + MaxChunkX = region.GetMaximumPoint().getBlockX() >> 4; + + if (region.GetMinimumPoint().getBlockZ() >> 4 < ChunkZ) + ChunkZ = region.GetMinimumPoint().getBlockZ() >> 4; + + if (region.GetMaximumPoint().getBlockZ() >> 4 > MaxChunkZ) + MaxChunkZ = region.GetMaximumPoint().getBlockZ() >> 4; + + MinChunkX = ChunkX; + MinChunkZ = ChunkZ; + } + + + public void AddListener(IArenaReloadedListener listener) + { + Listeners.add(listener); + } + + @Override + public void SetMapName(String value) + { + MapName = value; + } + + @Override + public void SetCenter(Vector center) + { + Center = center; + } + + @Override + public void SetOffset(Vector offset) + { + Offset = offset; + } + + @Override + public String GetName() + { + return MapName; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/ArenaManager.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/ArenaManager.java new file mode 100644 index 000000000..a0dcfa005 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/ArenaManager.java @@ -0,0 +1,208 @@ +package nautilus.game.core.arena; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FilenameFilter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Random; + +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.FileUtil; +import mineplex.core.common.util.MapUtil; +import nautilus.minecraft.core.utils.ZipUtil; +import net.minecraft.server.v1_6_R2.ChunkPreLoadEvent; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; + +public class ArenaManager implements Listener, Runnable +{ + private JavaPlugin _plugin; + private String _gamemode; + private IArenaParser _arenaParser; + private HashMap _arenaWorldFolderMap; + private List _availableArenas; + private HashMap> _loadingArenas; + private HashMap> _delayArenaCallback; + + private Random _random; + private int _arenaCount; + + private HashMap _chunkWorldRegionMap; + + public ArenaManager(JavaPlugin plugin, String gamemode, IArenaParser arenaParser) + { + _plugin = plugin; + _gamemode = gamemode; + _arenaParser = arenaParser; + _availableArenas = new ArrayList(); + _loadingArenas = new HashMap>(); + _delayArenaCallback = new HashMap>(); + _chunkWorldRegionMap = new HashMap(); + _arenaWorldFolderMap = new HashMap(); + _random = new Random(); + + _plugin.getServer().getPluginManager().registerEvents(this, _plugin); + _plugin.getServer().getScheduler().scheduleSyncRepeatingTask(_plugin, this, 1, 1); + PopulateAvailableArenas(); + } + + @EventHandler + public void OnChunkLoad(ChunkPreLoadEvent event) + { + String key = event.GetWorld().getName(); + + if (_chunkWorldRegionMap.containsKey(key)) + { + ArenaType arena = _chunkWorldRegionMap.get(key); + + if (!arena.IsChunkInArena(event.GetX(), event.GetZ())) + { + event.setCancelled(true); + } + } + } + + public void RemoveArena(ArenaType arena) + { + if (_arenaWorldFolderMap.containsKey(arena)) + { + long arenaRemovalTime = System.currentTimeMillis(); + MapUtil.UnloadWorld(_plugin, arena.GetWorld()); + MapUtil.ClearWorldReferences(arena.GetWorld().getName()); + + FileUtil.DeleteFolder(arena.GetWorld().getWorldFolder()); + + _arenaWorldFolderMap.remove(arena); + _chunkWorldRegionMap.remove(arena.GetWorld().getName()); + + System.out.println("Removed world '" + arena.GetWorld().getName() + "' in " + (System.currentTimeMillis() - arenaRemovalTime) + "ms"); + arena.Deactivate(); + } + else + { + System.out.println("not in arenaWorldFolderMap"); + } + } + + public void GetNextArena(Callback callback) + { + String key = _availableArenas.get(_random.nextInt(_availableArenas.size())); + + String directory = _plugin.getDataFolder().getAbsoluteFile().getParentFile().getParentFile() + File.separator; + String name = directory + _arenaCount; + + new File(name).mkdir(); + new File(name + File.separator + "region").mkdir(); + + // TODO Queue/Optimize unzip - currently 50ms on production server. + ZipUtil.UnzipToDirectory(key, name); + + ArenaType arena = null; + + try + { + FileReader configReader = new FileReader(new File(name + File.separator + "arena.config").getAbsolutePath()); + arena = _arenaParser.Parse(name, configReader); + configReader.close(); + } + catch (FileNotFoundException e) + { + e.printStackTrace(); + } + catch (IOException e) + { + e.printStackTrace(); + } + + _arenaWorldFolderMap.put(arena, key); + + _loadingArenas.put(arena, callback); + _arenaCount++; + } + + private void PopulateAvailableArenas() + { + if(!_plugin.getDataFolder().exists()) + { + _plugin.getDataFolder().mkdir(); + } + + File dominateArenaDir = new File(_plugin.getDataFolder().getAbsoluteFile().getParentFile().getParentFile().getParentFile() + File.separator + "Arenas" + File.separator + _gamemode); + + if(!dominateArenaDir.getAbsoluteFile().getParentFile().exists()) + { + dominateArenaDir.getAbsoluteFile().getParentFile().mkdir(); + } + + if(!dominateArenaDir.exists()) + { + dominateArenaDir.mkdir(); + } + + FilenameFilter statsFilter = new FilenameFilter() + { + public boolean accept(File paramFile, String paramString) + { + if (paramString.endsWith("zip")) + { + return true; + } + + return false; + } + }; + + for (File f : dominateArenaDir.listFiles(statsFilter)) + { + _availableArenas.add(f.getAbsolutePath()); + System.out.println("Adding arena zip file : " + f); + } + } + + public void run() + { + Iterator arenaIterator = _delayArenaCallback.keySet().iterator(); + + while (arenaIterator.hasNext()) + { + ArenaType arena = arenaIterator.next(); + + _delayArenaCallback.get(arena).run(arena); + arenaIterator.remove(); + } + + long endTime = System.currentTimeMillis() + 25; + long timeLeft; + arenaIterator = _loadingArenas.keySet().iterator(); + + while (arenaIterator.hasNext()) + { + ArenaType arena = arenaIterator.next(); + + timeLeft = endTime - System.currentTimeMillis(); + if (timeLeft > 0) + { + if (arena.LoadArena(timeLeft)) + { + _chunkWorldRegionMap.put(arena.GetWorld().getName(), arena); + _delayArenaCallback.put(arena, _loadingArenas.get(arena)); + arenaIterator.remove(); + } + } + else + break; + } + } + + public boolean HasAvailableArena() + { + return _availableArenas.size() > 0; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/IArena.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/IArena.java new file mode 100644 index 000000000..cc3b61bce --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/IArena.java @@ -0,0 +1,24 @@ +package nautilus.game.core.arena; + +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.util.Vector; + +public interface IArena +{ + World GetWorld(); + Region GetBounds(); + boolean IsInArena(Vector location); + boolean IsChunkInArena(int x, int z); + boolean CanMove(String playerName, Vector from, Vector to); + boolean CanInteract(String playerName, Block withBlock); + + boolean LoadArena(long maxMilliseconds); + void Deactivate(); + String GetName(); + + void SetMapName(String value); + void SetBounds(Region boundsRegion); + void SetCenter(Vector center); + void SetOffset(Vector offset); +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/IArenaParser.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/IArenaParser.java new file mode 100644 index 000000000..a0d5b85ab --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/IArenaParser.java @@ -0,0 +1,8 @@ +package nautilus.game.core.arena; + +import java.io.FileReader; + +public interface IArenaParser +{ + ArenaType Parse(String fileName, FileReader fileReader); +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/IArenaReloadedListener.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/IArenaReloadedListener.java new file mode 100644 index 000000000..51c7a41a8 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/IArenaReloadedListener.java @@ -0,0 +1,7 @@ +package nautilus.game.core.arena; + + +public interface IArenaReloadedListener +{ + void ArenaReloaded(Arena arena); +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/ITeamArena.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/ITeamArena.java new file mode 100644 index 000000000..8c8585639 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/ITeamArena.java @@ -0,0 +1,27 @@ +package nautilus.game.core.arena; + +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.util.Vector; + +public interface ITeamArena extends IArena +{ + void AddRedSpawnPoint(Vector spawnPoint, float yaw); + List GetRedSpawnPoints(); + + void AddBlueSpawnPoint(Vector spawnPoint, float yaw); + List GetBlueSpawnPoints(); + + void SetBlueSpawnRoom(Region region); + void SetRedSpawnRoom(Region region); + + Region GetBlueSpawnRoom(); + Region GetRedSpawnRoom(); + + void AddBlueGameShopPoint(Vector spawnPoint, float yaw); + List GetBlueShopPoints(); + + void AddRedGameShopPoint(Vector spawnPoint, float yaw); + List GetRedShopPoints(); +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/Region.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/Region.java new file mode 100644 index 000000000..5e214c4b7 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/Region.java @@ -0,0 +1,163 @@ +package nautilus.game.core.arena; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.util.Vector; + +public class Region +{ + private String _name; + private transient Vector _pointOne; + private transient Vector _pointTwo; + + private List _owners; + + private Boolean _blockPassage = false; + private Boolean _blockChange = true; + + private int _priority; + + private int _minX; + private int _minY; + private int _minZ; + + private int _maxX; + private int _maxY; + private int _maxZ; + + public Region(String name, Vector pointOne, Vector pointTwo) + { + _name = name; + _pointOne = pointOne; + _pointTwo = pointTwo; + _priority = 0; + _owners = new ArrayList(); + + UpdateMinMax(); + } + + public Vector GetMaximumPoint() + { + return new Vector(_maxX, _maxY, _maxZ); + } + + public void AdjustRegion(Vector vector) + { + _minX += vector.getBlockX(); + _minY += vector.getBlockY(); + _minZ += vector.getBlockZ(); + + _maxX += vector.getBlockX(); + _maxY += vector.getBlockY(); + _maxZ += vector.getBlockZ(); + } + + public Vector GetMinimumPoint() + { + return new Vector(_minX, _minY, _minZ); + } + + public Vector GetMidPoint() + { + return new Vector((_maxX - _minX)/2 + _minX, (_maxY - _minY)/2 + _minY, (_maxZ - _minZ)/2 + _minZ); + } + + public void SetPriority(int priority) + { + _priority = priority; + } + + public int GetPriority() + { + return _priority; + } + + public Boolean Contains(Vector v) + { + return v.getBlockX() >= _minX && v.getBlockX() <= _maxX + && v.getBlockY() >= _minY && v.getBlockY() <= _maxY + && v.getBlockZ() >= _minZ && v.getBlockZ() <= _maxZ; + } + + public void AddOwner(String name) + { + if (!_owners.contains(name.toLowerCase())) + { + _owners.add(name.toLowerCase()); + } + } + + public void RemoveOwner(String name) + { + _owners.remove(name.toLowerCase()); + } + + public void SetOwners(List owners) + { + _owners = owners; + + for (String ownerName : _owners) + { + ownerName = ownerName.toLowerCase(); + } + } + + public void SetEnter(Boolean canEnter) + { + _blockPassage = !canEnter; + } + + public void SetChangeBlocks(Boolean canChangeBlocks) + { + _blockChange = !canChangeBlocks; + } + + public Boolean CanEnter(String playerName) + { + if (_blockPassage) + { + if (!_owners.contains(playerName.toLowerCase())) + { + return false; + } + } + + return true; + } + + public Boolean CanChangeBlocks(String playerName) + { + if (_blockChange) + { + if (!_owners.contains(playerName.toLowerCase())) + { + return false; + } + } + + return true; + } + + public String GetName() + { + return _name; + } + + private void UpdateMinMax() + { + _minX = Math.min(_pointOne.getBlockX(), _pointTwo.getBlockX()); + _minY = Math.min(_pointOne.getBlockY(), _pointTwo.getBlockY()); + _minZ = Math.min(_pointOne.getBlockZ(), _pointTwo.getBlockZ()); + + _maxX = Math.max(_pointOne.getBlockX(), _pointTwo.getBlockX()); + _maxY = Math.max(_pointOne.getBlockY(), _pointTwo.getBlockY()); + _maxZ = Math.max(_pointOne.getBlockZ(), _pointTwo.getBlockZ()); + } + + @Override + public String toString() + { + return "Maximum point: " + GetMaximumPoint() + " Minimum point: " + GetMinimumPoint(); + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/RegionManager.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/RegionManager.java new file mode 100644 index 000000000..b57b35539 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/RegionManager.java @@ -0,0 +1,114 @@ +package nautilus.game.core.arena; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.ObjectOutputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +public class RegionManager +{ + private String _dataFolder; + private Map _regions; + + public RegionManager(String dataFolder) + { + _dataFolder = dataFolder; + _regions = new HashMap(); + } + + public Region GetRegion(String name) + { + return _regions.get(name); + } + + public Boolean Contains(String name) + { + return _regions.containsKey(name); + } + + public List GetApplicableRegions(Vector v) + { + List applicableRegions = new ArrayList(); + + for (Region region : _regions.values()) + { + if (region.Contains(v)) + { + applicableRegions.add(region); + } + } + + return applicableRegions; + } + + void SaveRegion(Region region) + { + FileOutputStream fOS = null; + ObjectOutputStream obOut = null; + + File f = new File(_dataFolder + "/regions/" + region.GetName() + ".region"); + File dir = new File(_dataFolder + "/regions/"); + + if (!dir.exists()) + { + dir.mkdir(); + } + + try + { + if (f.exists()) + { + f.delete(); + } + + if (!f.exists()) + { + f.createNewFile(); + } + + fOS = new FileOutputStream(f); + obOut = new ObjectOutputStream(fOS); + obOut.writeObject(region); + obOut.close(); + } + catch (Exception e) + { + System.out.println("[ERROR] Failed to saving region - " + region.GetName() + " : " + e.getMessage()); + } + } + + public void CreateNewRegion(Player player, String name, Vector pointOne, Vector pointTwo) + { + if (_regions.get(name) != null) + { + player.sendMessage(ChatColor.DARK_RED + "That game region already exists. Use update command."); + return; + } + + //CreateRegion(new Region(this, name, pointOne, pointTwo)); + + player.sendMessage(ChatColor.DARK_GREEN + "Successfully create game region - " + name + "."); + } + + public void UpdateRegion(Player player, String name, Vector pointOne, Vector pointTwo) + { + if (_regions.get(name) == null) + { + player.sendMessage(ChatColor.DARK_RED + "That game region does not exist. Use create command."); + return; + } + + _regions.remove(name); + + //CreateRegion(new Region(this, name, pointOne, pointTwo)); + + player.sendMessage(ChatColor.DARK_GREEN + "Successfully updated game region - " + name + "."); + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/TeamArena.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/TeamArena.java new file mode 100644 index 000000000..4850933d4 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/TeamArena.java @@ -0,0 +1,127 @@ +package nautilus.game.core.arena; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.util.Vector; + +public class TeamArena extends Arena implements ITeamArena +{ + protected Region BlueSpawnRoom; + protected Region RedSpawnRoom; + protected List RedSpawnPoints; + protected List BlueSpawnPoints; + + protected List RedShopPoints; + protected List BlueShopPoints; + + public TeamArena(String name) + { + super(name); + + RedSpawnPoints = new ArrayList(); + BlueSpawnPoints = new ArrayList(); + + RedShopPoints = new ArrayList(); + BlueShopPoints = new ArrayList(); + } + + @Override + public void Deactivate() + { + super.Deactivate(); + + RedSpawnPoints.clear(); + RedSpawnPoints = null; + + BlueSpawnPoints.clear(); + BlueSpawnPoints = null; + + RedShopPoints.clear(); + RedShopPoints = null; + + BlueShopPoints.clear(); + BlueShopPoints = null; + } + + @Override + public boolean IsInArena(Vector location) + { + return super.IsInArena(location) || RedSpawnRoom.Contains(location) || BlueSpawnRoom.Contains(location); + } + + public void AddRedSpawnPoint(Vector spawnPoint, float yaw) + { + RedSpawnPoints.add(new Location(World, spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ(), yaw, 0f)); + } + + public List GetRedSpawnPoints() + { + return RedSpawnPoints; + } + + public void AddBlueSpawnPoint(Vector spawnPoint, float yaw) + { + BlueSpawnPoints.add(new Location(World, spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ(), yaw, 0f)); + } + + public List GetBlueSpawnPoints() + { + return BlueSpawnPoints; + } + + @Override + public void SetBlueSpawnRoom(Region region) + { + Regions.add(region); + BlueSpawnRoom = region; + + UpdateChunkVars(region); + } + + @Override + public void SetRedSpawnRoom(Region region) + { + Regions.add(region); + RedSpawnRoom = region; + + UpdateChunkVars(region); + } + + @Override + public Region GetBlueSpawnRoom() + { + return BlueSpawnRoom; + } + + @Override + public Region GetRedSpawnRoom() + { + return RedSpawnRoom; + } + + @Override + public void AddBlueGameShopPoint(Vector spawnPoint, float yaw) + { + BlueShopPoints.add(new Location(World, spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ(), yaw, 0f)); + } + + @Override + public void AddRedGameShopPoint(Vector spawnPoint, float yaw) + { + RedShopPoints.add(new Location(World, spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ(), yaw, 0f)); + } + + @Override + public List GetBlueShopPoints() + { + return BlueShopPoints; + } + + @Override + public List GetRedShopPoints() + { + return RedShopPoints; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/BlueShopPoints.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/BlueShopPoints.java new file mode 100644 index 000000000..d1294fb80 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/BlueShopPoints.java @@ -0,0 +1,21 @@ +package nautilus.game.core.arena.property; + +import nautilus.game.core.arena.ITeamArena; + +public class BlueShopPoints extends PropertyBase +{ + public BlueShopPoints() + { + super("blueshoppoints"); + } + + public boolean Parse(ArenaType arena, String value) + { + for (String vector : value.split(",")) + { + arena.AddBlueGameShopPoint(ParseVector(vector.trim()), Float.parseFloat(vector.trim().split(" ")[3]) * 90); + } + + return true; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/BlueSpawnPoints.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/BlueSpawnPoints.java new file mode 100644 index 000000000..ba0c34e2f --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/BlueSpawnPoints.java @@ -0,0 +1,21 @@ +package nautilus.game.core.arena.property; + +import nautilus.game.core.arena.ITeamArena; + +public class BlueSpawnPoints extends PropertyBase +{ + public BlueSpawnPoints() + { + super("bluespawnpoints"); + } + + public boolean Parse(ArenaType arena, String value) + { + for (String vector : value.split(",")) + { + arena.AddBlueSpawnPoint(ParseVector(vector.trim()), Float.parseFloat(vector.trim().split(" ")[3]) * 90); + } + + return true; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/BlueSpawnRoom.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/BlueSpawnRoom.java new file mode 100644 index 000000000..788df2891 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/BlueSpawnRoom.java @@ -0,0 +1,28 @@ +package nautilus.game.core.arena.property; + +import org.bukkit.Location; + +import nautilus.game.core.arena.ITeamArena; +import nautilus.game.core.arena.Region; + +public class BlueSpawnRoom extends RegionPropertyBase +{ + public BlueSpawnRoom() + { + super("bluespawnroom"); + } + + @Override + public boolean Parse(ArenaType arena, String value) + { + arena.SetBlueSpawnRoom(ParseRegion(value)); + return true; + } + + public boolean Parse(ArenaType arena, Location start, Location stop) + { + arena.SetBlueSpawnRoom(new Region("bluespawnroom", start.toVector(), stop.toVector())); + + return true; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/BorderProperty.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/BorderProperty.java new file mode 100644 index 000000000..7254dc5c9 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/BorderProperty.java @@ -0,0 +1,21 @@ +package nautilus.game.core.arena.property; + +import nautilus.game.core.arena.IArena; +import nautilus.game.core.arena.Region; + +public class BorderProperty extends RegionPropertyBase +{ + public BorderProperty() + { + super("border"); + } + + public boolean Parse(ArenaType arena, String value) + { + Region boundsRegion = ParseRegion(value); + + arena.SetBounds(boundsRegion); + + return true; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/Center.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/Center.java new file mode 100644 index 000000000..918fd452b --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/Center.java @@ -0,0 +1,19 @@ +package nautilus.game.core.arena.property; + +import nautilus.game.core.arena.IArena; + +public class Center extends PropertyBase +{ + public Center() + { + super("center"); + } + + @Override + public boolean Parse(ArenaType arena, String value) + { + arena.SetCenter(ParseVector(value)); + + return true; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/IProperty.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/IProperty.java new file mode 100644 index 000000000..1daa3d51b --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/IProperty.java @@ -0,0 +1,10 @@ +package nautilus.game.core.arena.property; + +import nautilus.game.core.arena.IArena; + +public interface IProperty +{ + String GetName(); + + boolean Parse(ArenaType arena, String value); +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/MapName.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/MapName.java new file mode 100644 index 000000000..e8c76f98e --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/MapName.java @@ -0,0 +1,18 @@ +package nautilus.game.core.arena.property; + +import nautilus.game.core.arena.IArena; + +public class MapName extends PropertyBase +{ + public MapName() + { + super("mapname"); + } + + @Override + public boolean Parse(ArenaType arena, String value) + { + arena.SetMapName(value); + return true; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/Offset.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/Offset.java new file mode 100644 index 000000000..8120ef1d8 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/Offset.java @@ -0,0 +1,19 @@ +package nautilus.game.core.arena.property; + +import nautilus.game.core.arena.IArena; + +public class Offset extends PropertyBase +{ + public Offset() + { + super("offset"); + } + + @Override + public boolean Parse(ArenaType arena, String value) + { + arena.SetOffset(ParseVector(value)); + + return true; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/PropertyBase.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/PropertyBase.java new file mode 100644 index 000000000..2f53e02e2 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/PropertyBase.java @@ -0,0 +1,39 @@ +package nautilus.game.core.arena.property; + +import nautilus.game.core.arena.IArena; + +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +public abstract class PropertyBase implements IProperty +{ + protected String Name; + + public PropertyBase(String name) + { + Name = name; + } + + public String GetName() + { + return Name; + } + + protected Vector ParseVector(String vectorString) + { + Vector vector = new Vector(); + + String [] parts = vectorString.split(" "); + + vector.setX(Double.parseDouble(parts[0])); + vector.setY(Double.parseDouble(parts[1])); + vector.setZ(Double.parseDouble(parts[2])); + + return vector; + } + + protected Vector ParseVector(Player player) + { + return player.getLocation().toVector(); + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/RedShopPoints.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/RedShopPoints.java new file mode 100644 index 000000000..2a2166d74 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/RedShopPoints.java @@ -0,0 +1,21 @@ +package nautilus.game.core.arena.property; + +import nautilus.game.core.arena.ITeamArena; + +public class RedShopPoints extends PropertyBase +{ + public RedShopPoints() + { + super("redshoppoints"); + } + + public boolean Parse(ArenaType arena, String value) + { + for (String vector : value.split(",")) + { + arena.AddRedGameShopPoint(ParseVector(vector.trim()), Float.parseFloat(vector.trim().split(" ")[3]) * 90); + } + + return true; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/RedSpawnPoints.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/RedSpawnPoints.java new file mode 100644 index 000000000..38c99ac9e --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/RedSpawnPoints.java @@ -0,0 +1,21 @@ +package nautilus.game.core.arena.property; + +import nautilus.game.core.arena.ITeamArena; + +public class RedSpawnPoints extends PropertyBase +{ + public RedSpawnPoints() + { + super("redspawnpoints"); + } + + public boolean Parse(ArenaType arena, String value) + { + for (String vector : value.split(",")) + { + arena.AddRedSpawnPoint(ParseVector(vector.trim()), Float.parseFloat(vector.trim().split(" ")[3]) * 90); + } + + return true; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/RedSpawnRoom.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/RedSpawnRoom.java new file mode 100644 index 000000000..f89956a36 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/RedSpawnRoom.java @@ -0,0 +1,28 @@ +package nautilus.game.core.arena.property; + +import org.bukkit.Location; + +import nautilus.game.core.arena.ITeamArena; +import nautilus.game.core.arena.Region; + +public class RedSpawnRoom extends RegionPropertyBase +{ + public RedSpawnRoom() + { + super("redspawnroom"); + } + + @Override + public boolean Parse(ArenaType arena, String value) + { + arena.SetRedSpawnRoom(ParseRegion(value)); + return true; + } + + public boolean Parse(ArenaType arena, Location start, Location stop) + { + arena.SetRedSpawnRoom(new Region("redspawnroom", start.toVector(), stop.toVector())); + + return true; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/RegionPropertyBase.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/RegionPropertyBase.java new file mode 100644 index 000000000..b92babbc0 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/property/RegionPropertyBase.java @@ -0,0 +1,24 @@ +package nautilus.game.core.arena.property; + +import nautilus.game.core.arena.IArena; +import nautilus.game.core.arena.Region; + +import org.bukkit.util.Vector; + +public abstract class RegionPropertyBase extends PropertyBase +{ + public RegionPropertyBase(String name) + { + super(name); + } + + protected Region ParseRegion(String value) + { + String [] parts = value.split(","); + + Vector pointOne = ParseVector(parts[0].trim()); + Vector pointTwo = ParseVector(parts[1].trim()); + + return new Region(parts.length == 3 ? parts[2].trim() : Name, pointOne, pointTwo); + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/GameEngine.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/GameEngine.java new file mode 100644 index 000000000..d3096b0dc --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/GameEngine.java @@ -0,0 +1,1543 @@ +package nautilus.game.core.engine; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; + +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.block.BlockGrowEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.FoodLevelChangeEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryType.SlotType; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerBucketFillEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerLoginEvent.Result; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.event.weather.WeatherChangeEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.World; + +import mineplex.core.server.ServerTalker; +import mineplex.core.server.event.PlayerGameAssignmentEvent; +import mineplex.core.server.packet.GameReadyPacket; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.creature.event.CreatureSpawnCustomEvent; +import mineplex.core.donation.DonationManager; +import mineplex.core.energy.*; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.minecraft.game.classcombat.Class.ClassManager; +import mineplex.minecraft.game.core.combat.CombatComponent; +import mineplex.minecraft.game.core.combat.CombatLog; +import mineplex.minecraft.game.classcombat.shop.ClassCombatCustomBuildShop; +import mineplex.minecraft.game.classcombat.shop.ClassCombatPurchaseShop; +import mineplex.minecraft.game.classcombat.shop.ClassCombatShop; +import mineplex.minecraft.game.core.IRelation; +import mineplex.minecraft.game.core.combat.event.ClearCombatEvent; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.condition.*; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.core.shop.item.ShopItem; +import me.chiss.Core.Events.ServerSaveEvent; +import nautilus.game.core.arena.ArenaManager; +import nautilus.game.core.arena.IArena; +import nautilus.game.core.events.GamePlayerAfkEvent; +import nautilus.game.core.events.GamePlayerAttackedPlayerEvent; +import nautilus.game.core.events.GamePlayerDeathEvent; +import nautilus.game.core.events.GamePlayerQuitEvent; +import nautilus.game.core.game.IGame; +import nautilus.game.core.player.IGamePlayer; +import nautilus.game.core.scoreboard.IScoreHandler; +import nautilus.minecraft.core.event.AfkEvent; +import nautilus.minecraft.core.player.AfkMonitor; +import net.minecraft.server.v1_6_R2.Item; +import net.minecraft.server.v1_6_R2.NBTTagCompound; +import net.minecraft.server.v1_6_R2.NBTTagList; +import net.minecraft.server.v1_6_R2.NBTTagString; + +public abstract class GameEngine, ScoreHandlerType extends IScoreHandler, ArenaType extends IArena, PlayerType extends IGamePlayer> implements IGameEngine, Listener, Runnable, IRelation +{ + protected int MaxGames = -1; + + protected JavaPlugin Plugin; + protected World World; + protected Location SpawnLocation; + protected CoreClientManager ClientManager; + protected ClassManager ClassManager; + protected ConditionManager ConditionManager; + protected Energy Energy; + protected ArenaManager ArenaManager; + protected GameScheduler Scheduler; + protected ScoreHandlerType ScoreHandler; + protected HashMap PlayerTaskIdMap; + + protected HashMap PendingPlayerRemoveMap; + protected HashMap PlayerGameMap; + protected HashMap SpectatorGameMap; + protected List ActiveGames; + protected List GamesInSetup; + protected AfkMonitor AfkMonitor; + + protected CraftItemStack StartBook; + protected ShopItem LobbyGem; + + protected ClassCombatShop GameShop; + protected ClassCombatPurchaseShop DonationShop; + protected ClassCombatCustomBuildShop CustomBuildShop; + + protected int LogoutPeriod = 30; + protected boolean AddToActiveGame; + + protected mineplex.core.portal.Portal Portal; + + protected HashSet ConnectingPlayersToAddToGame; + + protected ServerTalker HubConnection; + + public GameEngine(JavaPlugin plugin, ServerTalker hubConnection, CoreClientManager clientManager, DonationManager donationManager, ClassManager classFactory, + ConditionManager conditionManager, Energy energy, ArenaManager arenaManager, ScoreHandlerType scoreHandler, World world, Location spawnLocation) + { + Plugin = plugin; + HubConnection = hubConnection; + ClientManager = clientManager; + ClassManager = classFactory; + ConditionManager = conditionManager; + Energy = energy; + + World = world; + SpawnLocation = spawnLocation; + ArenaManager = arenaManager; + Scheduler = new GameScheduler(); + ScoreHandler = scoreHandler; + PlayerTaskIdMap = new HashMap(); + + PendingPlayerRemoveMap = new HashMap(); + PlayerGameMap = new HashMap(); + SpectatorGameMap = new HashMap(); + ActiveGames = new ArrayList(); + GamesInSetup = new ArrayList(); + AfkMonitor = new AfkMonitor(plugin); + + ConnectingPlayersToAddToGame = new HashSet(); + + Portal = new mineplex.core.portal.Portal(plugin); + + Plugin.getServer().getPluginManager().registerEvents(this, Plugin); + Plugin.getServer().getScheduler().scheduleSyncRepeatingTask(Plugin, this, 0L, 1200L); + + StartBook = CraftItemStack.asNewCraftStack(Item.WRITTEN_BOOK); + NBTTagCompound bookData = StartBook.getHandle().tag; + + if (bookData == null) + bookData = new NBTTagCompound("tag"); + + bookData.setString("title", ChatColor.GREEN + "" + ChatColor.BOLD + "Instructions"); + + NBTTagList nPages = new NBTTagList(); + nPages.add(new NBTTagString("1", ChatColor.DARK_GREEN + " DOMINATE" + + ChatColor.DARK_GRAY + "\n\n\n Table of Contents" + + ChatColor.DARK_GRAY + "\n\n1. " + ChatColor.BLUE + "Signup to play" + + ChatColor.DARK_GRAY + "\n2. " + ChatColor.BLUE + "Setting up a class" + + ChatColor.DARK_GRAY + "\n3. " + ChatColor.BLUE + "Choosing class" + + ChatColor.DARK_GRAY + "\n4. " + ChatColor.BLUE + "Skills" + + ChatColor.DARK_GRAY + "\n5. " + ChatColor.BLUE + "How to Play" + + ChatColor.DARK_GRAY + "\n6. " + ChatColor.BLUE + "Tips")); + nPages.add(new NBTTagString("a", ChatColor.DARK_GREEN + " SIGNUP" + + ChatColor.BLUE + "\n\nClick with dye in your hand. It will turn green." + + "\n\nGame will start when 10 players sign up." + + "\n\nIf you wish to leave queue, click with dye in your hand again. It will go back to gray")); + nPages.add(new NBTTagString("2", ChatColor.DARK_GREEN + " CLASS SETUP" + + ChatColor.BLUE + "\n\nRight-click on the Enchantment Table." + + "\n\nLeft-click class and Anvil to setup a custom build." + + "\n\nChoose skills, weapons and items.")); + nPages.add(new NBTTagString("3", ChatColor.DARK_GREEN + " CLASS IN-GAME" + + ChatColor.BLUE + "\n\nRight-click on the Enchantment Table." + + "\n\nLeft-click class." + + "\n\nLeft-click dye to select a custom build." + + "\n\nLeft-click anvil to edit build or workbench modify without saving build.")); + nPages.add(new NBTTagString("4", ChatColor.DARK_GREEN + " SKILLS" + + ChatColor.BLUE + "\n\nOpen inventory and mouse over the 'Skill Hotbar' to see how each skill works." + + "\n\nActive skills are attached to weapons." + + "\n\nPassive skills are active all the time.")); + nPages.add(new NBTTagString("5", ChatColor.DARK_GREEN + " HOW TO PLAY" + + ChatColor.BLUE + "\n\nEach control point is marked by a beacon." + + "\n\nTo capture, stand on the glass flooring of the point until the wool floor underneath the glass is your team's color.")); + nPages.add(new NBTTagString("6", ChatColor.DARK_GREEN + " TIPS" + + ChatColor.BLUE + "\n\n1. Gather emeralds for an additional " + ChatColor.DARK_GREEN + "+100" + ChatColor.BLUE + " to your score." + + "\n\n2. Defend control points for " + ChatColor.DARK_GREEN + "+2" + ChatColor.BLUE + " score per second" + + "\n\n3. Watch scoreboard by holding TAB to see what points the enemy team controls.")); + + bookData.set("pages", nPages); + + StartBook.getHandle().tag = bookData; + + LobbyGem = new ShopItem(Material.EYE_OF_ENDER, "Lobby Teleport", new String [] { "§rClick with this in hand to teleport back to lobby." }, 1, false, true); + } + + protected abstract void ActivateGame(GameType game, ArenaType arena); + + public abstract GameType ScheduleNewGame(); + + public abstract String GetGameType(); + + public void StopGame(GameType game) + { + for (PlayerType player : game.GetPlayers()) + { + RemovePlayerFromGame(game, player, !player.isOnline()); + + player.setFireTicks(0); + player.setHealth(20); + player.setFoodLevel(20); + player.getInventory().clear(); + player.getInventory().setArmorContents(null); + + player.SetDead(false); + player.SetSpectating(false); + + player.GetPlayer().eject(); + + if (player.GetPlayer().isInsideVehicle()) + player.GetPlayer().leaveVehicle(); + + player.teleport(SpawnLocation); + + ClearCombatEvent clearCombatEvent = new ClearCombatEvent(player.GetPlayer()); + Plugin.getServer().getPluginManager().callEvent(clearCombatEvent); + } + + for (PlayerType player : game.GetSpectators()) + { + RemoveSpectatorFromGame(player.GetPlayer(), !player.isOnline(), false); + + player.setFireTicks(0); + player.setHealth(20); + player.setFoodLevel(20); + player.getInventory().clear(); + player.getInventory().setArmorContents(null); + + player.SetDead(false); + player.SetSpectating(false); + + player.GetPlayer().eject(); + + if (player.GetPlayer().isInsideVehicle()) + player.GetPlayer().leaveVehicle(); + + player.teleport(SpawnLocation); + + ClearCombatEvent clearCombatEvent = new ClearCombatEvent(player.GetPlayer()); + Plugin.getServer().getPluginManager().callEvent(clearCombatEvent); + } + + ActiveGames.remove(game); + ArenaType arena = game.GetArena(); + + // Deactivate sets arena to null for memory purposes + game.Deactivate(); + + ArenaManager.RemoveArena(arena); + TryToActivateGames(); + + Plugin.getServer().shutdown(); + } + + public Boolean CanScheduleNewGame() + { + if (Scheduler.GetGames().size() > 0 && Scheduler.GetGames().get(Scheduler.GetGames().size()-1).GetPlayers().size() < 10) + { + return false; + } + + if (!ArenaManager.HasAvailableArena()) + { + return false; + } + + return true; + } + + protected abstract void TryToActivateGames(); + + protected boolean AddPlayerToGame(GameType game, Player player, Boolean notify) + { + PlayerType gamePlayer = game.AddPlayerToGame(player); + PlayerGameMap.put(gamePlayer.getName(), game); + + if (notify) + { + // TODO Notifier.NotifyPlayerJoinGame(game, gamePlayer); + } + + TryToActivateGames(); + + // TODO UpdateScoreboard(); + + return true; + } + + public void AddSpectatorToGame(GameType game, Player player, Location location) + { + if (IsPlayerInActiveGame(player)) + return; + + if (IsSpectatorInGame(player)) + { + if (SpectatorGameMap.get(player.getName()) != game) + RemoveSpectatorFromGame(player, false); + else + { + player.teleport(location); + return; + } + } + + PlayerType spectator = game.AddSpectatorToGame(player, location); + SpectatorGameMap.put(spectator.getName(), game); + } + + @Override + public boolean AddPlayerToGame(Player player, boolean notify) + { + GameType game = GetNextOpenGame(); + + if (game == null) + { + return false; + } + + return AddPlayerToGame(game, player, notify); + } + + @Override + public List GetGames() + { + return Scheduler.GetGames(); + } + + @Override + public List GetActiveGames() + { + return ActiveGames; + } + + @Override + public void RemovePlayerFromGame(Player player) + { + RemovePlayerFromGame(player, false); + } + + @Override + public void RemovePlayerFromGame(Player player, boolean quit) + { + GameType game = GetGameForPlayer(player); + PlayerType gamePlayer = game.GetPlayer(player); + + RemovePlayerFromGame(game, gamePlayer, quit); + + player.playSound(player.getLocation(), Sound.BLAZE_DEATH, .5F, .5F); + } + + protected void RemovePlayerFromGame(GameType game, PlayerType player, boolean quit) + { + PlayerGameMap.remove(player.getName()); + + if (!ActiveGames.contains(game)) + { + game.RemovePlayer(player); + Scheduler.CleanEmptyGames(); + } + } + + public void RemoveSpectatorFromGame(Player player, boolean quit) + { + RemoveSpectatorFromGame(player, quit, true); + } + + public void RemoveSpectatorFromGame(Player player, boolean quit, boolean removeAndTeleport) + { + GameType game = SpectatorGameMap.get(player.getName()); + SpectatorGameMap.remove(player.getName()); + + if (removeAndTeleport) + { + game.RemoveSpectator(game.GetSpectator(player)); + + player.eject(); + player.leaveVehicle(); + player.teleport(SpawnLocation); + } + } + + public GameType GetNextOpenGame() + { + if (ActiveGames.size() > 0 && AddToActiveGame && !IsGameFull(ActiveGames.get(0))) + { + return ActiveGames.get(0); + } + else if (Scheduler.GetGames().size() > 0) + { + return Scheduler.GetGames().get(Scheduler.GetGames().size() - 1); + } + + return ScheduleNewGame(); + } + + protected boolean IsGameFull(GameType gameType) + { + return false; + } + + @Override + public boolean IsPlayerInGame(Player player) + { + return PlayerGameMap.containsKey(player.getName()); + } + + public boolean IsPlayerInGame(String playerName) + { + return PlayerGameMap.containsKey(playerName); + } + + @EventHandler + public void MessageMOTD(ServerListPingEvent event) + { + if (ActiveGames.size() > 0 || GamesInSetup.size() > 0) + { + event.setMotd(ChatColor.YELLOW + "In Progress"); + } + else + { + event.setMotd(ChatColor.GREEN + "Recruiting"); + } + + event.setMaxPlayers(10); + } + + @EventHandler + public void PlayerGameRequest(PlayerGameAssignmentEvent event) + { + ConnectingPlayersToAddToGame.add(event.GetPlayerName()); + + if (ConnectingPlayersToAddToGame.size() >= 10) + { + HubConnection.QueuePacket(new GameReadyPacket(new ArrayList(ConnectingPlayersToAddToGame))); + } + } + + @Override + public boolean IsSpectatorInActiveGame(Player player) + { + return IsSpectatorInGame(player) && ActiveGames.contains(GetGameForSpectator(player)); + } + + @Override + public boolean IsPlayerInActiveGame(String playerName) + { + return IsPlayerInGame(playerName) && ActiveGames.contains(GetGameForPlayer(playerName)); + } + + @Override + public GameType GetGameForPlayer(Player player) + { + return GetGameForPlayer(player.getName()); + } + + @Override + public GameType GetGameForPlayer(String playerName) + { + if (PlayerGameMap.containsKey(playerName)) + return PlayerGameMap.get(playerName); + else + return SpectatorGameMap.get(playerName); + } + + @EventHandler + public void onCreatureSpawn(CreatureSpawnCustomEvent event) + { + event.setCancelled(true); + } + + @EventHandler(priority=EventPriority.NORMAL) + public void OnWeatherChange(WeatherChangeEvent event) + { + if (event.toWeatherState()) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onEntityDamage(EntityDamageEvent event) + { + if (event.getEntity() instanceof Player) + { + if (IsPlayerInActiveGame((Player)event.getEntity())) + { + GameType game = GetGameForPlayer((Player)event.getEntity()); + + if (game.HasStarted() && (event.getEntity().getLastDamageCause() == null || event.getEntity().getLastDamageCause().getEntity() instanceof Player)) + { + PlayerType victim = game.GetPlayer((Player) event.getEntity()); + PlayerType attacker = null; + + if (victim.IsDead() || victim.IsSpectating()) + event.setCancelled(true); + + if (event instanceof EntityDamageByEntityEvent) + { + EntityDamageByEntityEvent entityEvent = (EntityDamageByEntityEvent)event; + Entity damager = entityEvent.getDamager(); + + if(entityEvent != null) + { + if (damager instanceof Projectile) + { + damager = ((Projectile)entityEvent.getDamager()).getShooter(); + } + + if (damager instanceof Player) + { + if (IsPlayerInActiveGame((Player)damager)) + attacker = game.GetPlayer((Player)damager); + else if (IsSpectatorInGame((Player)damager)) + attacker = game.GetSpectator((Player)damager); + } + } + } + + if (attacker != null) + { + if (attacker.IsDead() || attacker.IsSpectating()) + { + event.setCancelled(true); + } + else + { + GamePlayerAttackedPlayerEvent customEvent = new GamePlayerAttackedPlayerEvent(game, attacker, victim); + Plugin.getServer().getPluginManager().callEvent(customEvent); + + if (customEvent.isCancelled()) + { + event.setCancelled(true); + } + } + } + } + else + { + event.setCancelled(true); + } + } + else + { + Player victim = (Player) event.getEntity(); + Player attacker = null; + + if (event instanceof EntityDamageByEntityEvent) + { + EntityDamageByEntityEvent entityEvent = (EntityDamageByEntityEvent)event; + Entity damager = entityEvent.getDamager(); + + if(entityEvent != null) + { + if (damager instanceof Projectile) + { + damager = ((Projectile)entityEvent.getDamager()).getShooter(); + } + + if (damager instanceof Player) + { + attacker = (Player) damager; + } + } + } + + if (attacker != null && victim.isOp() && attacker.isOp()) + { + return; + } + + event.setCancelled(true); + } + } + else + { + event.setCancelled(true); + } + } + + @EventHandler + public void onEntityTarget(EntityTargetEvent event) + { + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOW) + public void onEntityDeath(CombatDeathEvent event) + { + if (event.GetEvent().getEntity() instanceof Player) + { + Player victim = (Player) event.GetEvent().getEntity(); + + if (!IsPlayerInGame(victim)) + { + return; + } + + GameType game = GetGameForPlayer(victim); + + World.playSound(victim.getLocation(), Sound.BREATH, .5F, .3F); + + PlayerType gamekiller = null; + List assistants = new ArrayList(); + + if (!event.GetClientCombat().GetDeaths().isEmpty()) + { + CombatLog victimCombatLog = event.GetClientCombat().GetDeaths().getFirst(); + List attackers = victimCombatLog.GetAttackers(); + + for (CombatComponent component : attackers) + { + if (component == victimCombatLog.GetKiller()) + continue; + + if (!component.IsPlayer()) + continue; + + Player player = Bukkit.getPlayer(component.GetName()); + + if (player == null) + continue; + + PlayerType assistant = game.GetPlayer(player); + + if (assistant != null) + { + assistant.AddAssists(1); + assistants.add(assistant); + } + } + + if (victimCombatLog.GetKiller() != null && Bukkit.getPlayer(victimCombatLog.GetKiller().GetName()) != null) + { + gamekiller = game.GetPlayer(Bukkit.getPlayer(victimCombatLog.GetKiller().GetName())); + + if (gamekiller != null) + gamekiller.AddKills(1); + else + System.out.println("Null gameplayer for " + victimCombatLog.GetKiller().GetName()); + } + } + + PlayerType gameVictim = game.GetPlayer(victim); + gameVictim.AddDeaths(1); + + GamePlayerDeathEvent customEvent = new GamePlayerDeathEvent(game, gameVictim, gamekiller, assistants, event.GetEvent().getDrops(), event); + Plugin.getServer().getPluginManager().callEvent(customEvent); + event.GetEvent().getDrops().clear(); + } + + if (event.GetEvent() instanceof PlayerDeathEvent) + { + PlayerDeathEvent pDeathEvent = (PlayerDeathEvent)event.GetEvent(); + + pDeathEvent.setDeathMessage(""); + } + } + + @EventHandler + public void onBlockBreakEvent(BlockBreakEvent event) + { + if (IsPlayerInActiveGame(event.getPlayer()) || IsSpectatorInActiveGame(event.getPlayer())) + { + event.setCancelled(true); + } + else if (!event.getPlayer().isOp()) + { + event.getPlayer().teleport(SpawnLocation); + event.setCancelled(true); + } + } + + @EventHandler + public void onBlockPlaceEvent(BlockPlaceEvent event) + { + if (IsPlayerInActiveGame(event.getPlayer())) + { + event.setCancelled(true); + } + else if (!event.getPlayer().isOp()) + event.setCancelled(true); + } + + @EventHandler + public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) + { + if (IsPlayerInActiveGame(event.getPlayer())) + { + event.setCancelled(true); + } + else if (!event.getPlayer().isOp()) + event.setCancelled(true); + } + + @EventHandler + public void onPlayerBucketFill(PlayerBucketFillEvent event) + { + if (IsPlayerInActiveGame(event.getPlayer())) + { + event.setCancelled(true); + } + else if (!event.getPlayer().isOp()) + event.setCancelled(true); + } + + @EventHandler + public void BurnCancel(BlockBurnEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void SpreadCancel(BlockFromToEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void GrowCancel(BlockGrowEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void DecayCancel(LeavesDecayEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void onPlayerFoodBarChange(FoodLevelChangeEvent event) + { + if (!IsPlayerInActiveGame((Player)event.getEntity())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void onPlayerLogin(PlayerLoginEvent event) + { + if (event.getResult() != Result.KICK_BANNED && IsPlayerInGame(event.getPlayer())) + { + event.allow(); + } + + if (ActiveGames.size() > 0 || GamesInSetup.size() > 0) + { + event.disallow(Result.KICK_FULL, "Game in progress"); + } + } + + @EventHandler + public void onPlayerJoin(PlayerJoinEvent event) + { + final Player player = event.getPlayer(); + + if (IsPlayerInGame(player)) + { + GameType game = GetGameForPlayer(player); + + event.getPlayer().setNoDamageTicks(0); + game.UpdateReconnectedPlayer(event.getPlayer()); + + PlayerType gamePlayer = game.GetPlayer(player); + + if (ActiveGames.contains(game) && gamePlayer.GetPlayer().getWorld() != game.GetArena().GetWorld()) + { + gamePlayer.teleport(gamePlayer.GetLastInArenaPosition()); + } + + if (ActiveGames.contains(game)) + gamePlayer.StartTimePlay(); + + onGamePlayerJoin(game, gamePlayer); + } + else if (AddToActiveGame) + { + player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte)0, 1, (short)0, C.cGreen + "Return to Hub", + new String[] {"", ChatColor.RESET + "Click while holding this", ChatColor.RESET + "to return to the Hub."})); + + AddPlayerToGame(event.getPlayer(), false); + + player.setGameMode(GameMode.SURVIVAL); + player.getInventory().clear(); + player.getInventory().setArmorContents(new ItemStack[4]); + + player.teleport(SpawnLocation); + } + else + { + player.setGameMode(GameMode.SURVIVAL); + player.getInventory().clear(); + player.getInventory().setArmorContents(new ItemStack[4]); + + player.teleport(SpawnLocation); + + player.sendMessage(ChatColor.AQUA + "*************************************"); + player.sendMessage(C.cDGreen + " Welcome to " + GetGameType() + "!"); + player.sendMessage(C.cDGreen + " Right click book for instructions "); + player.sendMessage(ChatColor.AQUA + "*************************************"); + } + } + + @EventHandler + public void onPlayerAfk(AfkEvent event) + { + if (IsPlayerInActiveGame(event.GetPlayerName())) + { + GameType game = GetGameForPlayer(event.GetPlayerName()); + PlayerType gamePlayer = game.GetPlayer(event.GetPlayerName()); + + Plugin.getServer().getPluginManager().callEvent(new GamePlayerAfkEvent(game, gamePlayer)); + + /* + RemovePlayerFromGame(game, gamePlayer, !gamePlayer.isOnline()); + + if (gamePlayer.isOnline()) + gamePlayer.teleport(Plugin.GetSpawnLocation()); + */ + } + else + { + if (IsPlayerInGame(event.GetPlayerName())) + { + Player player = Bukkit.getPlayerExact(event.GetPlayerName()); + + if (player != null) + { + RemovePlayerFromGame(Bukkit.getPlayerExact(event.GetPlayerName())); + player.sendMessage(ChatColor.RED + "You were removed from the Play Queue for being afk."); + Portal.SendPlayerToServer(player, "Lobby"); + } + } + } + } + + @EventHandler(priority = EventPriority.NORMAL) + public void onPlayerDropItem(PlayerDropItemEvent event) + { + if (event.isCancelled()) + return; + + event.setCancelled(true); + } + + @EventHandler + public void onPlayerCommand(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().startsWith("/spectate") || event.getMessage().startsWith("/spec")) + { + if (IsPlayerInActiveGame(event.getPlayer())) + { + event.getPlayer().sendMessage(F.main("Dominate", ChatColor.RED + "You are already in a game, doh.")); + } + else + { + String messageSplit[] = event.getMessage().split(" "); + + if (messageSplit.length == 2) + { + Player player = UtilPlayer.searchOnline(event.getPlayer(), messageSplit[1], true); + + if (player != null) + { + if (IsPlayerInActiveGame(player)) + { + AddSpectatorToGame(GetGameForPlayer(player), event.getPlayer(), player.getLocation()); + } + else + { + event.getPlayer().sendMessage(F.main("Dominate", ChatColor.RED + player.getName() + " isn't in a game.")); + } + } + } + else if (this.IsSpectatorInGame(event.getPlayer())) + { + this.RemoveSpectatorFromGame(event.getPlayer(), false); + } + else + { + event.getPlayer().sendMessage(F.main("Dominate", ChatColor.RED + "Incorrect syntax. Example : '/spectate defek7' or '/spectate' to leave")); + } + } + + event.setCancelled(true); + } + else if (event.getMessage().trim().equalsIgnoreCase("/stopgame")) + { + if (ClientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.MODERATOR, true)) + { + GameType game = null; + + if (IsSpectatorInGame(event.getPlayer())) + { + game = GetGameForSpectator(event.getPlayer()); + } + else if (IsPlayerInActiveGame(event.getPlayer())) + { + game = GetGameForPlayer(event.getPlayer()); + } + + if (game != null) + { + for (PlayerType player : game.GetPlayers()) + { + player.sendMessage(ChatColor.RED + event.getPlayer().getName() + " stopped the game."); + } + + StopGame(game); + } + else + event.getPlayer().sendMessage(ChatColor.RED + "You must be in or spectating an active game to issue '/stopgame'."); + + event.setCancelled(true); + } + } + else if (event.getMessage().startsWith("/spawn")) + { + if (!IsPlayerInActiveGame(event.getPlayer()) && !IsSpectatorInActiveGame(event.getPlayer())) + { + event.getPlayer().teleport(SpawnLocation); + } + + event.setCancelled(true); + } + } + + @SuppressWarnings("deprecation") + @EventHandler(priority = EventPriority.NORMAL) + public void onPlayerPickupItem(PlayerPickupItemEvent event) + { + if (event.isCancelled()) + return; + + if (!IsPlayerInActiveGame(event.getPlayer()) || IsSpectatorInActiveGame(event.getPlayer()) || event.getItem().getItemStack().getType() == Material.BONE) + { + event.setCancelled(true); + } + else + { + PlayerType gamePlayer = GetGameForPlayer(event.getPlayer()).GetPlayer(event.getPlayer()); + + if (gamePlayer.IsDead() || gamePlayer.IsSpectating()) + { + event.setCancelled(true); + return; + } + + if (event.getItem().getItemStack().getType() != Material.ARROW) + { + event.setCancelled(true); + event.getItem().remove(); + return; + } + + PlayerInventory inventory = event.getPlayer().getInventory(); + int typeSlot = inventory.first(event.getItem().getItemStack().getType()); + ItemStack itemStack = event.getItem().getItemStack(); + + if (typeSlot != -1) + { + ItemStack firstFoundItemStack = inventory.getItem(typeSlot); + int pickupAmount = itemStack.getAmount(); + int maxAmount = (firstFoundItemStack.getType() == Material.NETHER_STAR ? 4 : (firstFoundItemStack.getType() == Material.ARROW ? 64 : 1)); + + while (typeSlot < 9) + { + ItemStack existingItemStack = inventory.getItem(typeSlot); + + if (existingItemStack != null && existingItemStack.getType() == itemStack.getType()) + { + int existingAmount = existingItemStack.getAmount() + pickupAmount; + + if (existingAmount > maxAmount) + { + pickupAmount = existingAmount - maxAmount; + existingAmount = maxAmount; + } + else + { + pickupAmount = 0; + } + + inventory.getItem(typeSlot).setAmount(existingAmount); + existingAmount = 0; + + if (pickupAmount == 0) + break; + } + + typeSlot++; + } + + if (pickupAmount > 0) + { + ItemStack newItemStack = firstFoundItemStack.clone(); + int existingAmount = pickupAmount; + maxAmount = (newItemStack.getType() == Material.NETHER_STAR ? 4 : (newItemStack.getType() == Material.ARROW ? 64 : 1)); + + while (inventory.firstEmpty() < 9) + { + if (existingAmount > maxAmount) + { + pickupAmount = existingAmount - maxAmount; + existingAmount = maxAmount; + } + else + { + pickupAmount = 0; + } + + newItemStack.setAmount(existingAmount); + inventory.setItem(inventory.firstEmpty(), newItemStack); + existingAmount = pickupAmount; + + if (pickupAmount == 0) + break; + + newItemStack = firstFoundItemStack.clone(); + } + } + + event.setCancelled(true); + + if (pickupAmount == 0) + event.getItem().remove(); + } + + if (inventory.firstEmpty() > 8) + { + event.setCancelled(true); + } + + event.getPlayer().updateInventory(); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void onPlayerQuit(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + + if (IsSpectatorInGame(player)) + { + RemoveSpectatorFromGame(player, true); + } + + if (IsPlayerInGame(player)) + { + GameType game = GetGameForPlayer(player); + PlayerType gamePlayer = game.GetPlayer(player); + + if (ActiveGames.contains(game) || GamesInSetup.contains(game)) + { + GamePlayerQuitEvent customEvent = new GamePlayerQuitEvent(game, gamePlayer); + Plugin.getServer().getPluginManager().callEvent(customEvent); + + gamePlayer.StopTimePlay(); + + //PendingPlayerRemoveMap.put(gamePlayer.getName(), System.currentTimeMillis() + LogoutPeriod * 1000); + } + else + { + RemovePlayerFromGame(player, true); + } + } + } + + private GameType GetGameForSpectator(Player player) + { + return SpectatorGameMap.get(player.getName()); + } + + private boolean IsSpectatorInGame(Player player) + { + return SpectatorGameMap.containsKey(player.getName()); + } + + @Override + public boolean IsPlayerInActiveGame(Player player) + { + return IsPlayerInGame(player) && ActiveGames.contains(GetGameForPlayer(player)); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onPlayerInventoryClick(InventoryClickEvent event) + { + if (IsPlayerInActiveGame((Player)event.getWhoClicked()) || IsSpectatorInActiveGame((Player)event.getWhoClicked())) + { + if (event.getSlotType() != SlotType.QUICKBAR || event.isShiftClick() || event.getCursor().getType() == event.getCurrentItem().getType()) + { + event.setCancelled(true); + } + } + } + + @EventHandler(priority = EventPriority.LOW) + public void onPlayerInteract(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (IsSpectatorInActiveGame(player)) + { + event.setCancelled(true); + return; + } + + if (event.getAction() == Action.PHYSICAL) + { + if (event.getClickedBlock().getType() == Material.SOIL) + { + event.setCancelled(true); + return; + } + } + + if (IsPlayerInActiveGame(player)) + { + if (player.getItemInHand() != null) + { + if (player.getItemInHand().getType() == Material.BUCKET) + { + event.setCancelled(true); + } + else if (player.getItemInHand().getType() == Material.FIREBALL || player.getItemInHand().getType() == Material.FIRE) + { + event.setCancelled(true); + } + } + } + else + { + if (player.isOp()) + { + if (player.getItemInHand().getType() == Material.GHAST_TEAR) + { + /* + final Packet20NamedEntitySpawn packet = new Packet20NamedEntitySpawn(((CraftPlayer)player).getHandle()); + packet.a = 9919; + packet.b = player.getName(); + packet.c = MathHelper.floor(player.getLocation().getX() * 32.0D); + packet.d = MathHelper.floor(player.getLocation().getY() * 32.0D); + packet.e = MathHelper.floor(player.getLocation().getZ() * 32.0D); + packet.f = (byte) ((int) (0 * 256.0F / 360.0F)); + packet.g = (byte) ((int) (0 * 256.0F / 360.0F)); + + DataWatcher dataWatcher = new DataWatcher(); + + dataWatcher.a(0, Byte.valueOf((byte) 32)); + dataWatcher.watch(0, Byte.valueOf((byte) 32)); + dataWatcher.a(1, Short.valueOf((short)300)); + dataWatcher.watch(1, Short.valueOf((short)300)); + dataWatcher.a(8, 8356754); + dataWatcher.watch(8, 8356754); + dataWatcher.a(9, (byte)0); + dataWatcher.watch(9, (byte)0); + dataWatcher.a(10, (byte)0); + dataWatcher.watch(10, (byte)0); + + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet); + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(new Packet5EntityEquipment(9919, 0, null)); + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(new Packet40EntityMetadata(9919, dataWatcher, false)); + + Packet23VehicleSpawn itemPacket = new Packet23VehicleSpawn(); + itemPacket.a = 9919 + 2 * new Random().nextInt(30); + itemPacket.b = (byte)0; + itemPacket.c = (byte)0; + itemPacket.d = (byte)0; + itemPacket.e = 0; + itemPacket.f = 0; + itemPacket.g = 0; + itemPacket.h = 0; + itemPacket.i = 0; + itemPacket.j = 2; + itemPacket.k = 1; + + dataWatcher = new DataWatcher(); + + dataWatcher.a(0, Byte.valueOf((byte) 0)); + dataWatcher.watch(0, Byte.valueOf((byte) 0)); + dataWatcher.a(1, Short.valueOf((short)300)); + dataWatcher.watch(1, Short.valueOf((short)300)); + dataWatcher.a(10, new net.minecraft.server.v1_4_6.ItemStack(net.minecraft.server.v1_4_6.Item.STONE_SWORD, 1)); + dataWatcher.watch(10, new net.minecraft.server.v1_4_6.ItemStack(net.minecraft.server.v1_4_6.Item.STONE_SWORD, 1)); + + Packet39AttachEntity vehiclePacket = new Packet39AttachEntity(); + vehiclePacket.a = itemPacket.a; + vehiclePacket.b = 9919; + + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(itemPacket); + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(vehiclePacket); + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(new Packet40EntityMetadata(itemPacket.a, dataWatcher, false)); + + vehiclePacket = new Packet39AttachEntity(); + vehiclePacket.a = 9919; + vehiclePacket.b = Bukkit.getPlayer("jRayx").getEntityId(); + + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(vehiclePacket); + */ + } + else if (player.getItemInHand().getType() == Material.WATCH) + { + Portal.SendPlayerToServer(player, "Lobby"); + } + if (player.getItemInHand().getType() == Material.BLAZE_ROD) + { + if (event.getAction() == Action.LEFT_CLICK_AIR) + { + player.setItemInHand(new ItemStack(Material.BLAZE_ROD, player.getItemInHand().getAmount() + 1)); + int index = player.getItemInHand().getAmount() - 1; + player.sendMessage("Sound." + Sound.values()[index]); + } + else if (event.getAction() == Action.RIGHT_CLICK_AIR) + { + player.setItemInHand(new ItemStack(Material.BLAZE_ROD, player.getItemInHand().getAmount() - 1)); + + int index = player.getItemInHand().getAmount() - 1; + player.sendMessage("Sound." + Sound.values()[index]); + } + } + + if (player.getItemInHand().getType() == Material.STICK) + { + if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_AIR) + { + player.damage(1d, Bukkit.getPlayer("Chiss")); + return; + } + } + + if (player.getItemInHand().getType() == Material.STRING) + { + if (event.getAction() == Action.LEFT_CLICK_AIR) + { + player.setItemInHand(new ItemStack(Material.STRING, player.getItemInHand().getAmount() + 1)); + } + else if (event.getAction() == Action.RIGHT_CLICK_AIR) + { + player.setItemInHand(new ItemStack(Material.STRING, player.getItemInHand().getAmount() - 1)); + } + } + + if (player.getItemInHand().getType() == Material.JUKEBOX) + { + if (player.getInventory().getItem(0).getAmount() - 1 > Sound.values().length) + { + player.getInventory().setItem(0, new ItemStack(Material.BLAZE_ROD, 0)); + } + else if (player.getInventory().getItem(0).getAmount() - 1 < 0) + { + player.getInventory().setItem(0, new ItemStack(Material.BLAZE_ROD, Sound.values().length)); + } + + if (player.getInventory().getItem(1).getAmount() - 1 > 30) + { + player.getInventory().setItem(1, new ItemStack(Material.STRING, 0)); + } + else if (player.getInventory().getItem(1).getAmount() - 1 < 0) + { + player.getInventory().setItem(1, new ItemStack(Material.STRING, 10)); + } + + int index = player.getInventory().getItem(0).getAmount() - 1; + float pitch = (player.getInventory().getItem(1).getAmount() - 1) * .1F; + + System.out.println("index: " + index + " pitch: " + pitch); + + player.getWorld().playSound(player.getLocation(), Sound.values()[index] , .3F, pitch); + player.sendMessage("Sound." + Sound.values()[index]); + } + } + + if (player.getItemInHand().getType() == Material.EYE_OF_ENDER) + { + Portal.SendPlayerToServer(player, "lobby"); + event.setCancelled(true); + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onPlayerMove(PlayerMoveEvent event) + { + Player player = event.getPlayer(); + + if (IsPlayerInActiveGame(player) || IsSpectatorInActiveGame(player)) + { + GameType game = GetGameForPlayer(player); + + if (game == null) + game = GetGameForSpectator(player); + + PlayerType gamePlayer = game.GetPlayer(player); + + if (gamePlayer == null) + gamePlayer = game.GetSpectator(player); + + if (!game.CanMove(gamePlayer, event.getFrom(), event.getTo())) + { + if (game.IsInArena(event.getFrom())) + { + gamePlayer.SetLastInArenaPosition(event.getFrom().getWorld(), event.getFrom().getX(), event.getFrom().getY(), event.getFrom().getZ()); + } + + player.eject(); + player.leaveVehicle(); + + gamePlayer.teleport(gamePlayer.GetLastInArenaPosition()); + + if (game.HasStarted() && !gamePlayer.IsDead()) + gamePlayer.GetPlayer().damage(4d); + } + else + gamePlayer.SetLastInArenaPosition(event.getTo().getWorld(), event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());; + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onPlayerTeleport(PlayerTeleportEvent event) + { + Player player = event.getPlayer(); + + if (IsPlayerInActiveGame(player) || IsSpectatorInActiveGame(player)) + { + GameType game = GetGameForPlayer(player); + + if (game == null) + game = GetGameForSpectator(player); + + PlayerType gamePlayer = game.GetPlayer(player); + + if (gamePlayer == null) + gamePlayer = game.GetSpectator(player); + + if (!game.CanMove(gamePlayer, event.getFrom(), event.getTo())) + { + if (game.IsInArena(event.getFrom())) + { + gamePlayer.SetLastInArenaPosition(event.getFrom().getWorld(), event.getFrom().getX(), event.getFrom().getY(), event.getFrom().getZ()); + } + + event.setCancelled(true); + gamePlayer.teleport(gamePlayer.GetLastInArenaPosition()); + } + else + { + gamePlayer.SetLastInArenaPosition(event.getTo().getWorld(), event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()); + } + } + else if (event.getTo() == SpawnLocation) + { + GivePlayerLobbyItems(player); + //ShowArmorSetsToPlayer(player); + } + } + + /* + @EventHandler + public void onPlayerVote(PlayerVoteEvent event) + { + System.out.println("Received player vote event : " + event.GetPlayerName()); + + CoreClient client = Plugin.GetClients().GetNull(event.GetPlayerName()); + + if (client != null) + { + client.Donor().AddPoints(event.GetPointsReceived()); + + client.GetPlayer().sendMessage(ChatColor.AQUA + "*************************************"); + client.GetPlayer().sendMessage(C.cDGreen + " Thanks for voting!"); + client.GetPlayer().sendMessage(C.cDGreen + " You received " + ChatColor.YELLOW + event.GetPointsReceived() + C.cDGreen + " points! "); + client.GetPlayer().sendMessage(ChatColor.AQUA + "*************************************"); + client.GetPlayer().playSound(client.GetPlayer().getLocation(), Sound.LEVEL_UP, .3f, 1f); + + + UpdatePlayerLobbyItemBalances(client); + + for (Player player : Plugin.GetPlugin().getServer().getOnlinePlayers()) + { + if (player == client.GetPlayer()) + continue; + + if (!IsPlayerInActiveGame(player)) + { + player.sendMessage(F.main("Vote", ChatColor.YELLOW + event.GetPlayerName() + ChatColor.GRAY + " voted at nautmc.com/Vote for " + ChatColor.YELLOW + event.GetPointsReceived() + C.cGray + " points! ")); + } + } + } + } + */ + + @EventHandler + public void onServerSaveEvent(ServerSaveEvent event) + { + event.setCancelled(true); + } + + public void onGamePlayerJoin(GameType game, PlayerType gamePlayer) + { + if (game.HasStarted()) + { + ScoreHandler.RewardForDeath(gamePlayer); + + if (!PlayerTaskIdMap.containsKey(gamePlayer.getName())) + { + game.RespawnPlayer(gamePlayer); + game.ResetPlayer(gamePlayer); + + gamePlayer.SetSpectating(false); + gamePlayer.SetDead(false); + + ConditionManager.EndCondition(gamePlayer.GetPlayer(), ConditionType.CLOAK, null); + ConditionManager.Factory().Regen("Respawn", gamePlayer.GetPlayer(), gamePlayer.GetPlayer(), 7, 1, false, true, true); + } + } + } + + protected void GivePlayerLobbyItems(Player player) + { + player.getInventory().clear(); + player.getInventory().setArmorContents(new ItemStack[4]); + + player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte)0, 1, (short)0, C.cGreen + "Return to Hub", + new String[] {"", ChatColor.RESET + "Click while holding this", ChatColor.RESET + "to return to the Hub."})); + /* + if (IsPlayerInGame(player)) + player.getInventory().addItem(QueuedItem.clone()); + else + player.getInventory().addItem(NotQueuedItem.clone()); + + + + UpdatePlayerLobbyItemBalances(client); + + for (Entry petToken : client.Donor().GetPets().entrySet()) + { + ItemStack petEgg = new ItemStack(Material.MONSTER_EGG, 1, (byte)petToken.getKey().getTypeId()); + ItemMeta meta = petEgg.getItemMeta(); + meta.setDisplayName(ChatColor.GREEN + petToken.getValue()); + + petEgg.setItemMeta(meta); + player.getInventory().addItem(petEgg); + } + + int nameTagCount = client.Donor().GetPetNameTagCount(); + + if (nameTagCount > 0) + { + ItemStack nameTags = new ItemStack(Material.SIGN, client.Donor().GetPetNameTagCount()); + ItemMeta meta = nameTags.getItemMeta(); + meta.setDisplayName(ChatColor.GREEN + "" + ChatColor.BOLD + "Name Tag"); + nameTags.setItemMeta(meta); + player.getInventory().addItem(nameTags); + } + */ + } + + public boolean IsInLobby(Player player) + { + return !IsPlayerInActiveGame(player) && !IsSpectatorInActiveGame(player); + } + + public boolean CanHurt(Player a, Player b) + { + if (IsPlayerInActiveGame(b) && IsPlayerInActiveGame(a)) + { + GameType game = GetGameForPlayer(b); + + if (game.HasStarted()) + { + PlayerType victim = game.GetPlayer(b); + + if (victim.IsDead() || victim.IsSpectating()) + return false; + } + } + + return true; + } + + public ChatColor GetColorOfFor(String other, Player player) + { + ChatColor prefixColor = null; + + if (IsPlayerInGame(other)) + { + prefixColor = ChatColor.GREEN; + } + else if (ClientManager.Get(other) != null && ClientManager.Get(other).GetRank().Has(player, Rank.ADMIN, false)) + { + prefixColor = ChatColor.DARK_RED; + } + else if (ClientManager.Get(other) != null && ClientManager.Get(other).GetRank().Has(player, Rank.MODERATOR, false)) + { + prefixColor = ChatColor.RED; + } + else + { + prefixColor = ChatColor.YELLOW; + } + + return prefixColor; + } + + public boolean CanHurt(String a, String b) + { + return CanHurt(Bukkit.getPlayerExact(a), Bukkit.getPlayerExact(b)); + } + + @Override + public boolean IsSafe(Player player) + { + return false; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/GameScheduler.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/GameScheduler.java new file mode 100644 index 000000000..a7a4a512c --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/GameScheduler.java @@ -0,0 +1,55 @@ +package nautilus.game.core.engine; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import nautilus.game.core.game.IGame; + +public class GameScheduler> +{ + private List _schedule; + + public GameScheduler() + { + _schedule = new ArrayList(); + } + + public List GetGames() + { + return _schedule; + } + + public boolean ContainsGame(GameType game) + { + return _schedule.contains(game); + } + + public GameType ScheduleNewGame(GameType game) + { + _schedule.add(game); + + return game; + } + + public void RemoveGame(GameType game) + { + _schedule.remove(game); + } + + public void CleanEmptyGames() + { + Iterator gameIterator = _schedule.iterator(); + + while (gameIterator.hasNext()) + { + GameType game = gameIterator.next(); + + if (game.GetPlayers().isEmpty()) + { + game.Deactivate(); + gameIterator.remove(); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/IGameEngine.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/IGameEngine.java new file mode 100644 index 000000000..a1f7fe9d7 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/IGameEngine.java @@ -0,0 +1,35 @@ +package nautilus.game.core.engine; + +import java.util.List; + +import nautilus.game.core.arena.IArena; +import nautilus.game.core.game.IGame; +import nautilus.game.core.player.IGamePlayer; + +import org.bukkit.Location; +import org.bukkit.entity.Player; + +public interface IGameEngine, ArenaType extends IArena, PlayerType extends IGamePlayer> +{ + boolean IsPlayerInGame(Player player); + boolean IsPlayerInActiveGame(Player player); + boolean IsPlayerInActiveGame(String playerName); + + GameType GetGameForPlayer(Player player); + GameType GetGameForPlayer(String playerName); + + void RemovePlayerFromGame(Player player); + void RemovePlayerFromGame(Player player, boolean quit); + + String GetGameType(); + + List GetGames(); + + GameType ScheduleNewGame(); + + boolean AddPlayerToGame(Player player, boolean notify); + List GetActiveGames(); + void AddSpectatorToGame(GameType game, Player player, Location location); + void RemoveSpectatorFromGame(Player player, boolean quit); + boolean IsSpectatorInActiveGame(Player player); +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/ITeam.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/ITeam.java new file mode 100644 index 000000000..633842eaf --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/ITeam.java @@ -0,0 +1,31 @@ +package nautilus.game.core.engine; + +import java.util.List; + +import org.bukkit.Location; + +import nautilus.game.core.arena.Region; +import nautilus.game.core.player.ITeamGamePlayer; + +public interface ITeam> +{ + TeamType GetTeamType(); + + void AddPlayer(PlayerType player); + + void RemovePlayer(PlayerType player); + + List GetPlayers(); + + void AddPoint(); + void AddPoints(int points); + + void SetScore(int scores); + int GetScore(); + + void ClearPlayers(); + + void SetSpawnRoom(Region spawnRoom); + + boolean IsInSpawnRoom(Location location); +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/ITeamGameEngine.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/ITeamGameEngine.java new file mode 100644 index 000000000..f52263b48 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/ITeamGameEngine.java @@ -0,0 +1,9 @@ +package nautilus.game.core.engine; + +import nautilus.game.core.arena.ITeamArena; +import nautilus.game.core.game.ITeamGame; +import nautilus.game.core.player.ITeamGamePlayer; + +public interface ITeamGameEngine, ArenaType extends ITeamArena, PlayerTeamType extends ITeam, PlayerType extends ITeamGamePlayer> extends IGameEngine +{ +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/TeamGameEngine.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/TeamGameEngine.java new file mode 100644 index 000000000..86936ef31 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/TeamGameEngine.java @@ -0,0 +1,695 @@ +package nautilus.game.core.engine; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scoreboard.DisplaySlot; +import org.bukkit.scoreboard.Objective; +import org.bukkit.scoreboard.Scoreboard; +import org.bukkit.scoreboard.Team; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.World; + +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.server.ServerTalker; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilServer; +import mineplex.core.donation.DonationManager; +import mineplex.core.energy.*; +import mineplex.core.npc.*; +import mineplex.minecraft.game.classcombat.Class.ClassManager; +import mineplex.minecraft.game.core.combat.CombatComponent; +import mineplex.minecraft.game.core.condition.*; +import me.chiss.Core.Plugin.IChat; +import nautilus.game.core.arena.ITeamArena; +import nautilus.game.core.arena.ArenaManager; +import nautilus.game.core.events.GamePlayerAttackedPlayerEvent; +import nautilus.game.core.events.GamePlayerDeathEvent; +import nautilus.game.core.events.team.TeamGameFinishedEvent; +import nautilus.game.core.game.ITeamGame; +import nautilus.game.core.player.ITeamGamePlayer; +import nautilus.game.core.scoreboard.ITeamScoreHandler; +import nautilus.minecraft.core.utils.GenericRunnable; +import net.minecraft.server.v1_6_R2.Packet; +import net.minecraft.server.v1_6_R2.Packet201PlayerInfo; + +public abstract class TeamGameEngine, ScoreHandlerType extends ITeamScoreHandler, ArenaType extends ITeamArena, PlayerTeamType extends ITeam, PlayerType extends ITeamGamePlayer> extends GameEngine implements ITeamGameEngine, IChat +{ + private int _gameQueueTickValue; + + protected int TeamSize = 1; + protected PacketHandler PacketHandler; + + protected boolean BroadcastQueueJoinMessage = true; + protected int MinQueuePlayersToStart = 4; + protected int TimeToStart = 2; + + protected NpcManager NpcManager; + + private List _shopEntities = new ArrayList(); + private NautHashMap _scoreboardMap = new NautHashMap(); + + public TeamGameEngine(JavaPlugin plugin, ServerTalker hubConnection, CoreClientManager clientManager, DonationManager donationManager, ClassManager classManager, + ConditionManager conditionManager, Energy energy, NpcManager npcManager, ArenaManager arenaManager, ScoreHandlerType scoreHandler, World world, Location spawnLocation) + { + super(plugin, hubConnection, clientManager, donationManager, classManager, conditionManager, energy, arenaManager, scoreHandler, world, spawnLocation); + + NpcManager = npcManager; + PacketHandler = new PacketHandler(plugin); + } + + protected void TryToActivateGames() + { + Iterator gameIterator = Scheduler.GetGames().iterator(); + + while (gameIterator.hasNext()) + { + GameType game = gameIterator.next(); + + if (game.GetPlayers().size() == TeamSize * 2 && ArenaManager.HasAvailableArena() && (MaxGames == -1 || ActiveGames.size() < MaxGames)) + { + SetupGame(game); + gameIterator.remove(); + _gameQueueTickValue = 0; + } + } + } + + protected boolean IsGameFull(GameType gameType) + { + return gameType.GetPlayers().size() >= TeamSize * 2; + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void PlayerJoin(PlayerJoinEvent event) + { + CreateScoreboard(event.getPlayer()); + } + + private void CreateScoreboard(Player player) + { + _scoreboardMap.put(player, Bukkit.getScoreboardManager().getNewScoreboard()); + + Scoreboard scoreboard = _scoreboardMap.get(player); + Objective objective = scoreboard.registerNewObjective("§l" + "Score", "dummy"); + objective.setDisplaySlot(DisplaySlot.SIDEBAR); + + for (Rank rank : Rank.values()) + { + if (rank == Rank.ALL) + { + scoreboard.registerNewTeam(rank.Name).setPrefix(""); + } + else + { + scoreboard.registerNewTeam(rank.Name).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + ChatColor.WHITE); + } + + if (rank == Rank.ALL) + { + scoreboard.registerNewTeam(rank.Name + "red".toUpperCase()).setPrefix(ChatColor.RED + ""); + scoreboard.registerNewTeam(rank.Name + "blue".toUpperCase()).setPrefix(ChatColor.BLUE + ""); + } + else + { + scoreboard.registerNewTeam(rank.Name + "red".toUpperCase()).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + ChatColor.RED); + scoreboard.registerNewTeam(rank.Name + "blue".toUpperCase()).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + ChatColor.BLUE); + } + } + + player.setScoreboard(scoreboard); + + for (Player otherPlayer : UtilServer.getPlayers()) + { + AddPlayerToScoreboards(otherPlayer, GetGameForPlayer(otherPlayer).IsActive() ? GetGameForPlayer(otherPlayer).GetPlayer(otherPlayer).GetTeam().GetTeamType().name() : null); + } + } + + public Collection GetScoreboards() + { + return _scoreboardMap.values(); + } + + public void AddPlayerToScoreboards(Player player, String teamName) + { + for (Scoreboard scoreboard : GetScoreboards()) + { + for (Team team : scoreboard.getTeams()) + team.removePlayer(player); + } + + if (teamName == null) + teamName = ""; + + for (Scoreboard scoreboard : GetScoreboards()) + { + scoreboard.getTeam(ClientManager.Get(player).GetRank().Name + teamName).addPlayer(player); + } + } + + @EventHandler + public void UpdateGameScoreboards(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + { + for (GameType activeGame : ActiveGames) + { + for (PlayerType player : activeGame.GetPlayers()) + { + Scoreboard scoreboard = _scoreboardMap.get(player.GetPlayer()); + + Objective objective = scoreboard.getObjective("§l" + "Score"); + objective.getScore(Bukkit.getOfflinePlayer(ChatColor.BLUE + "Blue")).setScore(activeGame.GetBlueTeam().GetScore()); + objective.getScore(Bukkit.getOfflinePlayer(ChatColor.RED + "Red")).setScore(activeGame.GetRedTeam().GetScore()); + + } + } + } + } + + @Override + public void run() + { + if (Scheduler.GetGames().size() > 0) + { + GameType game = Scheduler.GetGames().get(Scheduler.GetGames().size() - 1); + int players = game.GetPlayers().size(); + + if (players < TeamSize * 2 && players >= MinQueuePlayersToStart) + { + if (game.GetPlayers().size() % 2 != 0) + { + if (BroadcastQueueJoinMessage ) + { + for (Player gameplayer : game.GetBlueTeam().GetPlayers().get(0).GetPlayer().getWorld().getPlayers()) + { + gameplayer.sendMessage(F.main("Play Queue", "Waiting for teams to be even before start timer resumes.")); + } + } + } + else + { + _gameQueueTickValue++; + + if (_gameQueueTickValue > TimeToStart) + { + TeamSize = players/2; + TryToActivateGames(); + } + else if (BroadcastQueueJoinMessage) + { + for (Player gameplayer : game.GetBlueTeam().GetPlayers().get(0).GetPlayer().getWorld().getPlayers()) + { + String minuteMessage = (3 - _gameQueueTickValue) == 1 ? "minute" : "minutes"; + gameplayer.sendMessage(F.main("Play Queue", "Game will start in " + (3 - _gameQueueTickValue) + " " + minuteMessage + "!")); + } + } + } + } + } + } + + @EventHandler + public void onGamePlayerDeath(GamePlayerDeathEvent event) + { + GameType game = event.GetGame(); + + //Color Names + try + { + if (event.GetPlayer().GetTeam().GetTeamType() == TeamType.RED) + event.GetLog().SetKilledColor(C.cRed + ""); + else + event.GetLog().SetKilledColor(C.cBlue + ""); + } + catch (Exception e) + { + System.out.println("[SEVERE] TeamGameEngine.onGamePlayerDeath : Exception Setting Killed Color : " + e.getMessage()); + + for (StackTraceElement trace : e.getStackTrace()) + { + System.out.println(trace); + } + } + + try + { + if (event.GetLog().GetKiller() != null) + { + PlayerType killer = game.GetPlayer(event.GetLog().GetKiller().GetName()); + + if (killer.GetTeam().GetTeamType() == TeamType.RED) + event.GetLog().SetKillerColor(C.cRed + ""); + else + event.GetLog().SetKillerColor(C.cBlue + ""); + } + } + catch (Exception e) + { + System.out.println("[SEVERE] TeamGameEngine.onGamePlayerDeath : Exception Setting Killed Color : " + e.getMessage()); + + for (StackTraceElement trace : e.getStackTrace()) + { + System.out.println(trace); + } + } + + ScoreHandler.RewardForDeath(event.GetPlayer()); + + boolean first = true; + + try + { + for (CombatComponent source : event.GetLog().GetAttackers()) + { + if (source == null || !source.IsPlayer()) + continue; + + PlayerType attacker = game.GetPlayer(source.GetName()); + + if (attacker == null) + continue; + + if (first) + { + if (attacker.GetTeam() == event.GetPlayer().GetTeam()) + { + ScoreHandler.RewardForTeamKill(attacker, event.GetPlayer()); + } + else + { + ScoreHandler.RewardForKill(attacker, event.GetPlayer(), event.GetLog().GetAssists()); + } + + first = false; + } + else + { + ScoreHandler.RewardForAssist(attacker, event.GetPlayer()); + } + } + } + catch (Exception ex) + { + System.out.println("[SEVERE] TeamGameEngine.onGamePlayerDeath : Exception Handleing team kill/kill/assist : " + ex.getMessage()); + + for (StackTraceElement trace : ex.getStackTrace()) + { + System.out.println(trace); + } + } + + game.StartRespawnFor(event.GetPlayer()); + } + + private void AddPlayerToTeam(GameType game, Player player, PlayerTeamType team, Boolean notify) + { + PlayerType gamePlayer = game.AddPlayerToGame(player); + PlayerGameMap.put(gamePlayer.getName(), game); + + team.AddPlayer(gamePlayer); + + if (ActiveGames.contains(game)) + { + player.eject(); + + if (player.isInsideVehicle()) + player.leaveVehicle(); + + for (Player otherPlayer : Plugin.getServer().getOnlinePlayers()) + { + if (player != otherPlayer) + { + player.showPlayer(otherPlayer); + } + } + + game.ActivatePlayer(gamePlayer); + } + + TryToActivateGames(); + } + + @Override + public boolean AddPlayerToGame(Player player, boolean notify) + { + GameType game = GetNextOpenGame(); + + if (game == null) + { + return false; + } + + int redTeamSize = game.GetRedTeam().GetPlayers().size(); + int blueTeamSize = game.GetBlueTeam().GetPlayers().size(); + + if (blueTeamSize < redTeamSize) + { + AddPlayerToBlueTeam(game, player); + player.playSound(player.getLocation(), Sound.ZOMBIE_METAL, .5F, .5F); + } + else if (redTeamSize < blueTeamSize) + { + AddPlayerToRedTeam(game, player); + player.playSound(player.getLocation(), Sound.ZOMBIE_METAL, .5F, .5F); + } + else if (blueTeamSize < TeamSize) + { + AddPlayerToBlueTeam(game, player); + player.playSound(player.getLocation(), Sound.ZOMBIE_METAL, .5F, .5F); + } + else + { + System.out.println("Error neither blue nor red have < " + TeamSize + " players and " + player.getName() + " shouldn't be assigned to this game."); + return false; + } + + if (game.GetPlayers().size() < TeamSize*2 && BroadcastQueueJoinMessage) + { + for (Player gameplayer : player.getWorld().getPlayers()) + { + gameplayer.sendMessage(ChatColor.BLUE + "Play Queue> " + ChatColor.GRAY + "Only " + (TeamSize*2 - game.GetPlayers().size()) + " more players needed to start game!"); + } + } + + return true; + } + + public void AddPlayerToRedTeam(GameType game, Player player) + { + AddPlayerToRedTeam(game, player, true); + } + + public void AddPlayerToBlueTeam(GameType game, Player player) + { + AddPlayerToBlueTeam(game, player, true); + } + + public void AddPlayerToRedTeam(GameType game, Player player, Boolean notify) + { + AddPlayerToTeam(game, player, game.GetRedTeam(), notify); + } + + public void AddPlayerToBlueTeam(GameType game, Player player, Boolean notify) + { + AddPlayerToTeam(game, player, game.GetBlueTeam(), notify); + } + + public void SetupGame(final GameType game) + { + GamesInSetup.add(game); + + for (PlayerType gamePlayer : game.GetPlayers()) + { + if (IsSpectatorInActiveGame(gamePlayer.GetPlayer())) + RemoveSpectatorFromGame(gamePlayer.GetPlayer(), true); + + gamePlayer.sendMessage(ChatColor.BLUE + "Dominate>" + ChatColor.GRAY + " Preparing map..."); + } + + ArenaManager.GetNextArena(new Callback() + { + public void run(ArenaType arena) + { + ActivateGame(game, arena); + } + }); + } + + @Override + protected void RemovePlayerFromGame(GameType game, PlayerType player, boolean quit) + { + super.RemovePlayerFromGame(game, player, quit); + + if (!ActiveGames.contains(game) && game != null && game.GetRedTeam() != null && game.GetBlueTeam() != null) + { + int redTeamSize = game.GetRedTeam().GetPlayers().size(); + int blueTeamSize = game.GetBlueTeam().GetPlayers().size(); + + if (redTeamSize - blueTeamSize > 1) + { + PlayerType movingPlayer = game.GetRedTeam().GetPlayers().get(0); + + game.GetRedTeam().RemovePlayer(movingPlayer); + game.GetBlueTeam().AddPlayer(movingPlayer); + } + else if (blueTeamSize - redTeamSize > 1) + { + PlayerType movingPlayer = game.GetBlueTeam().GetPlayers().get(0); + + game.GetBlueTeam().RemovePlayer(movingPlayer); + game.GetRedTeam().AddPlayer(movingPlayer); + } + } + } + + @Override + public void ActivateGame(GameType game, ArenaType arena) + { + GamesInSetup.remove(game); + ActiveGames.add(game); + + List removeListPacket = new ArrayList(); + + for (PlayerType player : game.GetPlayers()) + { + if (player.isOnline()) + { + player.GetPlayer().eject(); + + if (player.GetPlayer().isInsideVehicle()) + player.GetPlayer().leaveVehicle(); + + removeListPacket.add(new Packet201PlayerInfo(player.getName(), false, -9999)); + } + } + + for (PlayerType player : game.GetPlayers()) + { + if (player.isOnline()) + { + for (Packet packet : removeListPacket) + { + ((CraftPlayer)player.GetPlayer()).getHandle().playerConnection.sendPacket(packet); + } + } + + AddPlayerToScoreboards(player.GetPlayer(), player.GetTeam().GetTeamType().name()); + } + + removeListPacket.clear(); + + game.Activate(arena); + + for (Location location : arena.GetBlueShopPoints()) + { + _shopEntities.add(NpcManager.AddNpc(EntityType.ZOMBIE, 0, ChatColor.BLUE + "Select Class Here", location)); + } + + for (Location location : arena.GetRedShopPoints()) + { + _shopEntities.add(NpcManager.AddNpc(EntityType.ZOMBIE, 0, ChatColor.RED + "Select Class Here", location)); + } + + for (PlayerType player : game.GetPlayers()) + { + for (Player otherPlayer : Plugin.getServer().getOnlinePlayers()) + { + if (player.GetPlayer() != otherPlayer) + { + player.GetPlayer().showPlayer(otherPlayer); + } + } + } + } + + @Override + public void StopGame(GameType game) + { + for (Entity entity : _shopEntities) + { + NpcManager.DeleteNpc(entity); + } + + super.StopGame(game); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onGameFinished(TeamGameFinishedEvent event) + { + for (PlayerType player : event.GetGame().GetPlayers()) + { + Portal.SendPlayerToServer(player.GetPlayer(), "Lobby"); + } + + Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Plugin, new GenericRunnable(event.GetGame()) + { + public void run() + { + StopGame(t); + } + }, 300L); + } + + @EventHandler + public void onGamePlayerAttackedPlayerEvent(GamePlayerAttackedPlayerEvent event) + { + PlayerType attacker = event.GetAttacker(); + PlayerType victim = event.GetVictim(); + + if (attacker.GetTeam() == victim.GetTeam()) + { + event.setCancelled(true); + } + else if (victim.IsDead() || attacker.IsDead()) + { + event.setCancelled(true); + } + } + + public void HandleChat(final AsyncPlayerChatEvent event, final String filteredMessage) + { + if (event.isCancelled()) + return; + + final Player sender = event.getPlayer(); + String message = event.getMessage(); + + if (message.length() < 1) + return; + + if (!IsPlayerInActiveGame(sender)) + { + Iterator recipientIterator = event.getRecipients().iterator(); + + while(recipientIterator.hasNext()) + { + Player otherPlayer = recipientIterator.next(); + + if (IsPlayerInActiveGame(otherPlayer)) + recipientIterator.remove(); + } + + StringBuilder playerNameBuilder = new StringBuilder(); + + if (ClientManager.Get(sender.getName()) != null) + { + CoreClient client = ClientManager.Get(sender.getName()); + + if (client.GetRank().Has(Rank.OWNER)) + { + playerNameBuilder.append(ChatColor.DARK_RED); + } + else if (client.GetRank().Has(Rank.MODERATOR)) + { + playerNameBuilder.append(ChatColor.RED); + } + else if (client.GetRank().Has(Rank.ULTRA)) + { + playerNameBuilder.append(ChatColor.GOLD); + } + else + { + playerNameBuilder.append(ChatColor.YELLOW); + } + } + + event.setFormat(playerNameBuilder.toString() + "%1$s " + C.cWhite + "%2$s"); + } + else + { + GameType senderGame = GetGameForPlayer(sender); + TeamType senderTeamType = senderGame.GetPlayer(sender).GetTeam().GetTeamType(); + + String teamColor = senderTeamType == TeamType.RED ? C.cRed : C.cBlue; + + boolean globalMessage = false; + if (message.charAt(0) == '!') + { + globalMessage = true; + event.setMessage(message.substring(1, message.length())); + event.setFormat(C.cDGray + "@" + C.cDAqua + "All" + " " + teamColor + "%1$s " + C.cWhite + "%2$s"); + } + else + { + event.setFormat(C.cDGray + "@" + C.cDAqua + "Team" + " " + teamColor + "%1$s " + C.cWhite + "%2$s"); + } + + Iterator recipientIterator = event.getRecipients().iterator(); + + while (recipientIterator.hasNext()) + { + Player receiver = recipientIterator.next(); + + if (!IsPlayerInActiveGame(receiver) || GetGameForPlayer(receiver) != senderGame) + { + recipientIterator.remove(); + continue; + } + + if (!globalMessage && senderTeamType != senderGame.GetPlayer(receiver).GetTeam().GetTeamType()) + recipientIterator.remove(); + } + } + } + + @Override + public boolean CanHurt(Player a, Player b) + { + if (IsPlayerInActiveGame(b) && IsPlayerInActiveGame(a)) + { + GameType game = GetGameForPlayer(b); + + if (game.HasStarted()) + { + PlayerType victim = game.GetPlayer(b); + PlayerType attacker = game.GetPlayer(a); + + if (victim.IsDead() || victim.IsSpectating()) + return false; + + if (attacker == null || attacker.GetTeam() == victim.GetTeam()) + return false; + } + } + + return true; + } + + @Override + public ChatColor GetColorOfFor(String other, Player player) + { + ChatColor prefixColor = super.GetColorOfFor(other, player); + + if (IsPlayerInActiveGame(other)) + { + PlayerTeamType playerTeam = GetGameForPlayer(other).GetPlayer(other).GetTeam(); + + prefixColor = (playerTeam.GetTeamType() == TeamType.RED ? ChatColor.RED : ChatColor.BLUE); + } + + return prefixColor; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/TeamType.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/TeamType.java new file mode 100644 index 000000000..a6c1bfeeb --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/TeamType.java @@ -0,0 +1,7 @@ +package nautilus.game.core.engine; + +public enum TeamType +{ + RED, + BLUE +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GameActivatedEvent.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GameActivatedEvent.java new file mode 100644 index 000000000..10665bbd9 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GameActivatedEvent.java @@ -0,0 +1,12 @@ +package nautilus.game.core.events; + +import nautilus.game.core.game.IGame; +import nautilus.game.core.player.IGamePlayer; + +public class GameActivatedEvent> extends GameEvent +{ + public GameActivatedEvent(GameType game) + { + super(game); + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GameDeactivatedEvent.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GameDeactivatedEvent.java new file mode 100644 index 000000000..594419191 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GameDeactivatedEvent.java @@ -0,0 +1,12 @@ +package nautilus.game.core.events; + +import nautilus.game.core.game.IGame; +import nautilus.game.core.player.IGamePlayer; + +public class GameDeactivatedEvent> extends GameEvent +{ + public GameDeactivatedEvent(GameType game) + { + super(game); + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GameEvent.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GameEvent.java new file mode 100644 index 000000000..0afdbeef1 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GameEvent.java @@ -0,0 +1,34 @@ +package nautilus.game.core.events; + +import nautilus.game.core.arena.IArena; +import nautilus.game.core.game.IGame; +import nautilus.game.core.player.IGamePlayer; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class GameEvent> extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private GameType _game; + + public GameEvent(GameType game) + { + _game = game; + } + + public GameType GetGame() + { + return _game; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GameFinishedEvent.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GameFinishedEvent.java new file mode 100644 index 000000000..3db38d787 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GameFinishedEvent.java @@ -0,0 +1,12 @@ +package nautilus.game.core.events; + +import nautilus.game.core.game.IGame; +import nautilus.game.core.player.IGamePlayer; + +public class GameFinishedEvent> extends GameEvent +{ + public GameFinishedEvent(GameType game) + { + super(game); + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GamePlayerAfkEvent.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GamePlayerAfkEvent.java new file mode 100644 index 000000000..55ac72f86 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GamePlayerAfkEvent.java @@ -0,0 +1,21 @@ +package nautilus.game.core.events; + +import nautilus.game.core.game.IGame; +import nautilus.game.core.player.IGamePlayer; + +public class GamePlayerAfkEvent, PlayerType extends IGamePlayer> extends GameEvent +{ + private PlayerType _player; + + public GamePlayerAfkEvent(GameType game, PlayerType player) + { + super(game); + + _player = player; + } + + public PlayerType GetPlayer() + { + return _player; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GamePlayerAttackedPlayerEvent.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GamePlayerAttackedPlayerEvent.java new file mode 100644 index 000000000..370233e28 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GamePlayerAttackedPlayerEvent.java @@ -0,0 +1,55 @@ +package nautilus.game.core.events; + +import nautilus.game.core.game.IGame; +import nautilus.game.core.player.IGamePlayer; + +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; + +public class GamePlayerAttackedPlayerEvent, PlayerType extends IGamePlayer> extends GameEvent implements Cancellable +{ + private static final HandlerList handlers = new HandlerList(); + private boolean _cancelled = false; + private PlayerType _attacker; + private PlayerType _victim; + + public GamePlayerAttackedPlayerEvent(GameType game, PlayerType attacker, PlayerType victim) + { + super(game); + + _attacker = attacker; + _victim = victim; + } + + public PlayerType GetAttacker() + { + return _attacker; + } + + public PlayerType GetVictim() + { + return _victim; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean cancel) + { + _cancelled = cancel; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GamePlayerDeathEvent.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GamePlayerDeathEvent.java new file mode 100644 index 000000000..c22cd98df --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GamePlayerDeathEvent.java @@ -0,0 +1,67 @@ +package nautilus.game.core.events; + +import java.util.List; + +import mineplex.minecraft.game.core.combat.CombatLog; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import nautilus.game.core.game.IGame; +import nautilus.game.core.player.IGamePlayer; + +import org.bukkit.event.HandlerList; +import org.bukkit.inventory.ItemStack; + +public class GamePlayerDeathEvent, PlayerType extends IGamePlayer> extends GameEvent +{ + private static final HandlerList handlers = new HandlerList(); + private PlayerType _player; + private PlayerType _killer; + private List _assistants; + private List _drops; + private CombatLog _log; + + public GamePlayerDeathEvent(GameType game, PlayerType player, PlayerType killer, List assistants, List drops, CombatDeathEvent combatDeath) + { + super(game); + + _player = player; + _killer = killer; + _assistants = assistants; + _drops = drops; + _log = combatDeath.GetLog(); + } + + public PlayerType GetPlayer() + { + return _player; + } + + public PlayerType GetKiller() + { + return _killer; + } + + public List GetAssistants() + { + return _assistants; + } + + public List GetDrops() + { + return _drops; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public CombatLog GetLog() + { + return _log; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GamePlayerJoinedEvent.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GamePlayerJoinedEvent.java new file mode 100644 index 000000000..9f2dd9aa4 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GamePlayerJoinedEvent.java @@ -0,0 +1,21 @@ +package nautilus.game.core.events; + +import nautilus.game.core.game.IGame; +import nautilus.game.core.player.IGamePlayer; + +public class GamePlayerJoinedEvent, PlayerType extends IGamePlayer> extends GameEvent +{ + private PlayerType _player; + + public GamePlayerJoinedEvent(GameType game, PlayerType player) + { + super(game); + + _player = player; + } + + public PlayerType GetPlayer() + { + return _player; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GamePlayerQuitEvent.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GamePlayerQuitEvent.java new file mode 100644 index 000000000..d3b2fba24 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GamePlayerQuitEvent.java @@ -0,0 +1,21 @@ +package nautilus.game.core.events; + +import nautilus.game.core.game.IGame; +import nautilus.game.core.player.IGamePlayer; + +public class GamePlayerQuitEvent, PlayerType extends IGamePlayer> extends GameEvent +{ + private PlayerType _player; + + public GamePlayerQuitEvent(GameType game, PlayerType player) + { + super(game); + + _player = player; + } + + public PlayerType GetPlayer() + { + return _player; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GameStartedEvent.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GameStartedEvent.java new file mode 100644 index 000000000..a322debdb --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/GameStartedEvent.java @@ -0,0 +1,12 @@ +package nautilus.game.core.events; + +import nautilus.game.core.game.IGame; +import nautilus.game.core.player.IGamePlayer; + +public class GameStartedEvent> extends GameEvent +{ + public GameStartedEvent(GameType game) + { + super(game); + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/team/TeamGameFinishedEvent.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/team/TeamGameFinishedEvent.java new file mode 100644 index 000000000..94e151cdb --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/events/team/TeamGameFinishedEvent.java @@ -0,0 +1,24 @@ +package nautilus.game.core.events.team; + +import nautilus.game.core.arena.ITeamArena; +import nautilus.game.core.engine.ITeam; +import nautilus.game.core.events.GameFinishedEvent; +import nautilus.game.core.game.ITeamGame; +import nautilus.game.core.player.ITeamGamePlayer; + +public class TeamGameFinishedEvent, PlayerTeamType extends ITeam, PlayerType extends ITeamGamePlayer> extends GameFinishedEvent +{ + private PlayerTeamType _winner; + + public TeamGameFinishedEvent(GameType game, PlayerTeamType winner) + { + super(game); + + _winner = winner; + } + + public PlayerTeamType GetWinningTeam() + { + return _winner; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/game/Game.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/game/Game.java new file mode 100644 index 000000000..cdf97dda6 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/game/Game.java @@ -0,0 +1,431 @@ +package nautilus.game.core.game; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.potion.PotionEffect; +import org.bukkit.util.Vector; + +import mineplex.core.energy.Energy; +import mineplex.minecraft.game.classcombat.Class.ClassManager; +import mineplex.minecraft.game.classcombat.Class.ClientClass; +import mineplex.minecraft.game.classcombat.Skill.ISkill; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import nautilus.game.core.arena.IArena; +import nautilus.game.core.notifier.PlayerNotifier; +import nautilus.game.core.player.IGamePlayer; +import nautilus.game.core.util.BroadcastSecondTimer; +import nautilus.minecraft.core.utils.GenericRunnable; + +public abstract class Game implements IGame, Listener, Runnable +{ + protected JavaPlugin Plugin; + protected ClassManager ClassManager; + protected ConditionManager ConditionManager; + protected Energy Energy; + protected ArenaType Arena; + protected Map Players; + protected Map Spectators; + protected int PlayerLives = 1; + protected int ScoreLimit; + protected long StartTime; + protected boolean HasStarted; + protected boolean CountdownRunning; + protected BroadcastSecondTimer StartTimer; + + protected HashMap PlayerTaskIdMap; + + protected int UpdaterTaskId; + + public Game(JavaPlugin plugin, ClassManager classManager, ConditionManager conditionManager, Energy energy) + { + Plugin = plugin; + ClassManager = classManager; + ConditionManager = conditionManager; + Energy = energy; + Players = new HashMap(); + Spectators = new HashMap(); + + PlayerTaskIdMap = new HashMap(); + + Plugin.getServer().getPluginManager().registerEvents(this, Plugin); + } + + public void run() + { + Update(); + } + + protected void Update() { } + + protected abstract PlayerType CreateGamePlayer(Player player, int playerLives); + + @Override + public void RemovePlayer(PlayerType player) + { + if (Players.containsKey(player.getName())) + { + Players.remove(player.getName()); + ClearPlayerSettings(player); + } + } + + @Override + public void RemoveSpectator(PlayerType player) + { + if (Spectators.containsKey(player.getName())) + { + Spectators.remove(player.getName()); + ClearSpectatorSettings(player); + } + } + + @Override + public boolean IsPlayerInGame(Player player) + { + return Players.containsKey(player.getName()); + } + + @Override + public boolean IsSpectatorInGame(Player player) + { + return Spectators.containsKey(player.getName()); + } + + @Override + public PlayerType AddPlayerToGame(Player player) + { + PlayerType gamePlayer = CreateGamePlayer(player, PlayerLives); + Players.put(gamePlayer.getName(), gamePlayer); + gamePlayer.SetClass(ClassManager.Get(player)); + + return gamePlayer; + } + + @Override + public PlayerType AddSpectatorToGame(Player player, Location to) + { + PlayerType gamePlayer = CreateGamePlayer(player, PlayerLives); + Spectators.put(gamePlayer.getName(), gamePlayer); + + gamePlayer.SetSpectating(true); + gamePlayer.teleport(to); + gamePlayer.getInventory().addItem(new ItemStack(Material.SHEARS, 1)); + + ConditionManager.Factory().Cloak("Spectator", player, player, 7200, false, true); + + return gamePlayer; + } + + @Override + public PlayerType GetPlayer(Player player) + { + return Players.get(player.getName()); + } + + @Override + public PlayerType GetPlayer(String playerName) + { + return Players.get(playerName); + } + + @Override + public PlayerType GetSpectator(Player player) + { + return Spectators.get(player.getName()); + } + + @Override + public Collection GetPlayers() + { + return Players.values(); + } + + @Override + public Collection GetSpectators() + { + return Spectators.values(); + } + + @Override + public void UpdateReconnectedPlayer(Player player) + { + Entry oldPlayerEntry = GetGamePlayer(player.getName()); + + if (oldPlayerEntry != null) + { + PlayerType oldPlayer = oldPlayerEntry.getValue(); + PlayerType newPlayer = CreateGamePlayer(player, oldPlayer.GetRemainingLives()); + + UpdateNewPlayerWithOldPlayer(newPlayer, oldPlayer); + + ClientClass client = ClassManager.Get(player); + + if (oldPlayer.GetClass().GetDefaultItems() != null) + { + for (Entry item : oldPlayer.GetClass().GetDefaultItems().entrySet()) + { + client.PutDefaultItem(item.getValue(), item.getKey()); + } + } + + if (oldPlayer.GetClass().GetDefaultArmor() != null) + { + client.SetDefaultHead(oldPlayer.GetClass().GetDefaultArmor()[3]); + client.SetDefaultChest(oldPlayer.GetClass().GetDefaultArmor()[2]); + client.SetDefaultLegs(oldPlayer.GetClass().GetDefaultArmor()[1]); + client.SetDefaultFeet(oldPlayer.GetClass().GetDefaultArmor()[0]); + } + + client.SetGameClass(oldPlayer.GetClass().GetGameClass()); + + if (oldPlayer.GetClass().GetDefaultSkills() != null) + { + client.ClearDefaultSkills(); + + for (ISkill skill : oldPlayer.GetClass().GetDefaultSkills()) + { + client.AddSkill(skill); + } + } + + Players.put(player.getName(), newPlayer); + } + } + + @Override + public List GetAssailants(Player player) + { + // TODO + return null; + } + + @Override + public boolean HasStarted() + { + return HasStarted; + } + + @Override + public boolean IsInArena(Location location) + { + return Arena.IsInArena(location.toVector()); + } + + @Override + public boolean CanMove(PlayerType player, Location from, Location to) + { + return !CountdownRunning || Arena.CanMove(player.getName(), from != null ? from.toVector() : null, to != null ? to.toVector() : null); + } + + @Override + public boolean CanInteract(PlayerType player, Block block) + { + return !CountdownRunning || Arena.CanInteract(player.getName(), block); + } + + public void StartRespawnFor(PlayerType player) + { + ResetPlayer(player); + + player.SetSpectating(true); + player.SetDead(true); + + ConditionManager.Factory().Cloak("Death", player.GetPlayer(), player.GetPlayer(), 10, false, true); + + PlayerTaskIdMap.put(player.getName(), Plugin.getServer().getScheduler().scheduleSyncDelayedTask(Plugin, new GenericRunnable(player.getName()) + { + public void run() + { + PlayerType player = GetPlayer(t); + + if (player != null && player.isOnline() && HasStarted) + { + ResetPlayer(player); + RespawnPlayer(player); + + player.SetSpectating(false); + player.SetDead(false); + } + + ConditionManager.EndCondition(player.GetPlayer(), ConditionType.CLOAK, null); + ConditionManager.Factory().Regen("Respawn", player.GetPlayer(), player.GetPlayer(), 7, 3, true, true, true); + + PlayerTaskIdMap.remove(player.getName()); + } + }, 200L)); + } + + public void ResetPlayer(PlayerType player) + { + player.setFireTicks(0); + player.setHealth(20); + player.setVelocity(new Vector(0,0,0)); + player.setFoodLevel(20); + player.GetPlayer().setFallDistance(0); + player.RemoveArrows(); + player.GetPlayer().eject(); + + player.getInventory().clear(); + player.getInventory().setArmorContents(new ItemStack[4]); + + for (PotionEffect potionEffect : player.GetPlayer().getActivePotionEffects()) + { + player.GetPlayer().addPotionEffect(new PotionEffect(potionEffect.getType(), 0, 0), true); + } + + if (player.GetPlayer().isOnline()) + { + Energy.Get(player.GetPlayer()).Energy = Energy.GetMax(player.GetPlayer()); + ClassManager.Get(player.GetPlayer()).ResetSkills(player.GetPlayer()); + } + } + + public void Activate(ArenaType arena) + { + Arena = arena; + StartTimer = new BroadcastSecondTimer(new PlayerNotifier, ArenaType, PlayerType>(Plugin, "Dominate"), this, 30, "Game starting", "Game starting...", new ActionListener() + { + public void actionPerformed(ActionEvent evt) + { + try + { + ReallyStartGame(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + }); + + StartTimer.Start(); + + CountdownRunning = true; + } + + public boolean IsActive() + { + return CountdownRunning || HasStarted; + } + + protected void ReallyStartGame() + { + StartTime = System.currentTimeMillis(); + HasStarted = true; + + for (Entity entity : Arena.GetWorld().getEntitiesByClasses(Item.class, Arrow.class)) + { + if (Arena.IsInArena(entity.getLocation().toVector())) + { + entity.remove(); + } + } + + UpdaterTaskId = Plugin.getServer().getScheduler().scheduleSyncRepeatingTask(Plugin, this, 0L, 10L); + } + + public void Deactivate() + { + for (PlayerType player : Players.values()) + { + ClearPlayerSettings(player); + } + + for (PlayerType spectator : Spectators.values()) + { + ClearSpectatorSettings(spectator); + } + + Players.clear(); + Spectators.clear(); + + if (StartTimer != null) + StartTimer.Deactivate(); + + Plugin.getServer().getScheduler().cancelTask(UpdaterTaskId); + HandlerList.unregisterAll(this); + + StartTimer = null; + Arena = null; + Plugin = null; + Players = null; + Spectators = null; + HasStarted = false; + } + + protected void ClearSpectatorSettings(PlayerType spectator) + { + ConditionManager.EndCondition(spectator.GetPlayer(), ConditionType.CLOAK, null); + spectator.SetSpectating(false); + } + + protected void ClearPlayerSettings(PlayerType player) { } + + protected Entry GetGamePlayer(String playerName) + { + for (Entry player : Players.entrySet()) + { + if (player.getKey().equalsIgnoreCase(playerName)) + { + return player; + } + } + + return null; + } + + @Override + public ArenaType GetArena() + { + return Arena; + } + + @Override + public long GetStartTime() + { + return StartTime; + } + + @Override + public int GetWinLimit() + { + return ScoreLimit; + } + + protected void UpdateNewPlayerWithOldPlayer(PlayerType newPlayer, PlayerType oldPlayer) + { + newPlayer.SetLives(oldPlayer.GetRemainingLives()); + newPlayer.AddKills(oldPlayer.GetKills()); + newPlayer.AddAssists(oldPlayer.GetAssists()); + newPlayer.AddDeaths(oldPlayer.GetDeaths()); + newPlayer.AddPoints(oldPlayer.GetPoints()); + newPlayer.SetLogoutTime(oldPlayer.GetLogoutTime()); + newPlayer.SetDead(oldPlayer.IsDead()); + newPlayer.SetSpectating(oldPlayer.IsSpectating()); + newPlayer.SetClass(oldPlayer.GetClass()); + Location lastInArenaPosition = oldPlayer.GetLastInArenaPosition(); + + if (lastInArenaPosition != null) + { + newPlayer.SetLastInArenaPosition(lastInArenaPosition.getWorld(), lastInArenaPosition.getX(), lastInArenaPosition.getY(), lastInArenaPosition.getZ()); + } + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/game/IGame.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/game/IGame.java new file mode 100644 index 000000000..f48075e5b --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/game/IGame.java @@ -0,0 +1,47 @@ +package nautilus.game.core.game; + +import java.util.Collection; +import java.util.List; + +import nautilus.game.core.arena.IArena; +import nautilus.game.core.player.IGamePlayer; + +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public interface IGame +{ + boolean IsPlayerInGame(Player player); + PlayerType GetPlayer(Player player); + PlayerType GetPlayer(String playerName); + PlayerType GetSpectator(Player player); + Collection GetPlayers(); + + void RemovePlayer(PlayerType player); + void RemoveSpectator(PlayerType player); + void UpdateReconnectedPlayer(Player player); + + List GetAssailants(Player player); + + boolean HasStarted(); + boolean CanMove(PlayerType player, Location from, Location to); + boolean CanInteract(PlayerType player, Block block); + PlayerType AddPlayerToGame(Player player); + PlayerType AddSpectatorToGame(Player player, Location to); + boolean IsInArena(Location location); + ArenaType GetArena(); + + void Activate(ArenaType arena); + boolean IsActive(); + void Deactivate(); + + void StartRespawnFor(PlayerType player); + void RespawnPlayer(PlayerType player); + void ResetPlayer(PlayerType player); + + long GetStartTime(); + int GetWinLimit(); + boolean IsSpectatorInGame(Player player); + Collection GetSpectators(); +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/game/ITeamGame.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/game/ITeamGame.java new file mode 100644 index 000000000..189f047fd --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/game/ITeamGame.java @@ -0,0 +1,13 @@ +package nautilus.game.core.game; + +import nautilus.game.core.arena.ITeamArena; +import nautilus.game.core.engine.ITeam; +import nautilus.game.core.player.ITeamGamePlayer; + +public interface ITeamGame, PlayerTeamType extends ITeam> extends IGame +{ + PlayerTeamType GetBlueTeam(); + PlayerTeamType GetRedTeam(); + + void ActivatePlayer(PlayerType player); +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/game/Team.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/game/Team.java new file mode 100644 index 000000000..c33450c0d --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/game/Team.java @@ -0,0 +1,87 @@ +package nautilus.game.core.game; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Location; + +import nautilus.game.core.arena.Region; +import nautilus.game.core.engine.ITeam; +import nautilus.game.core.engine.TeamType; +import nautilus.game.core.player.ITeamGamePlayer; + +public abstract class Team, PlayerTeamType extends ITeam> implements ITeam +{ + private int _score; + private TeamType _teamType; + private Region _spawnRoom; + + protected List Players; + + public Team(TeamType teamType) + { + _teamType = teamType; + Players = new ArrayList(); + } + + @Override + public TeamType GetTeamType() + { + return _teamType; + } + + @Override + public List GetPlayers() + { + return Players; + } + + @Override + public void RemovePlayer(PlayerType player) + { + player.SetTeam(null); + Players.remove(player); + } + + @Override + public void AddPoint() + { + _score++; + } + + @Override + public void AddPoints(int points) + { + _score += points; + } + + @Override + public void SetScore(int score) + { + _score = score; + } + + @Override + public int GetScore() + { + return _score; + } + + @Override + public void ClearPlayers() + { + Players.clear(); + } + + @Override + public void SetSpawnRoom(Region spawnRoom) + { + _spawnRoom = spawnRoom; + } + + @Override + public boolean IsInSpawnRoom(Location location) + { + return _spawnRoom.Contains(location.toVector()); + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/game/TeamGame.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/game/TeamGame.java new file mode 100644 index 000000000..d516c030d --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/game/TeamGame.java @@ -0,0 +1,235 @@ +package nautilus.game.core.game; + +import java.util.List; +import java.util.Random; + +import mineplex.core.energy.Energy; +import mineplex.minecraft.game.classcombat.Class.ClassManager; +import mineplex.minecraft.game.classcombat.Class.ClientClass; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import nautilus.game.core.arena.ITeamArena; +import nautilus.game.core.engine.ITeam; +import nautilus.game.core.engine.TeamType; +import nautilus.game.core.player.ITeamGamePlayer; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.plugin.java.JavaPlugin; + +public abstract class TeamGame, PlayerTeamType extends ITeam, ArenaType extends ITeamArena> extends Game implements ITeamGame +{ + private Random _random; + + protected PlayerTeamType RedTeam; + protected PlayerTeamType BlueTeam; + + public TeamGame(JavaPlugin plugin, ClassManager classManager, mineplex.minecraft.game.core.condition.ConditionManager conditionManager, Energy energy) + { + super(plugin, classManager, conditionManager, energy); + + _random = new Random(); + + RedTeam = CreateTeam(TeamType.RED); + BlueTeam = CreateTeam(TeamType.BLUE); + } + + protected abstract PlayerTeamType CreateTeam(TeamType teamType); + + @Override + public void Activate(ArenaType arena) + { + super.Activate(arena); + + RedTeam.SetSpawnRoom(arena.GetRedSpawnRoom()); + BlueTeam.SetSpawnRoom(arena.GetBlueSpawnRoom()); + + for (PlayerType player : Players.values()) + { + ActivatePlayer(player); + } + } + + public void ActivatePlayer(PlayerType player) + { + if (player.GetTeam() == BlueTeam) + { + Location spawnPoint = GetRandomSpawnPoint(Arena.GetBlueSpawnPoints()); + player.SetLastInArenaPosition(spawnPoint.getWorld(), spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ()); + player.teleport(spawnPoint); + } + else if (player.GetTeam() == RedTeam) + { + Location spawnPoint = GetRandomSpawnPoint(Arena.GetRedSpawnPoints()); + player.SetLastInArenaPosition(spawnPoint.getWorld(), spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ()); + player.teleport(spawnPoint); + } + + if (HasStarted) + { + ResetPlayer(player); + RespawnPlayer(player); + + player.SetSpectating(false); + player.SetDead(false); + } + else + { + player.SetSpectating(true); + player.SetDead(true); + } + } + + @Override + public void ClearPlayerSettings(PlayerType player) + { + super.ClearPlayerSettings(player); + + player.GetTeam().RemovePlayer(player); + } + + @Override + public void ReallyStartGame() + { + super.ReallyStartGame(); + + for (PlayerType player : Players.values()) + { + player.StartTimePlay(); + + ResetPlayer(player); + RespawnPlayer(player); + + player.SetSpectating(false); + player.SetDead(false); + } + } + + @Override + public boolean CanInteract(PlayerType player, Block block) + { + if (super.CanInteract(player, block)) + return true; + else if (player.GetTeam().IsInSpawnRoom(block.getLocation()) && player.GetTeam().IsInSpawnRoom(player.getLocation())) + return true; + + return false; + } + + @Override + public void Deactivate() + { + RedTeam.ClearPlayers(); + BlueTeam.ClearPlayers(); + + RedTeam = null; + BlueTeam = null; + _random = null; + + super.Deactivate(); + } + + @Override + public PlayerTeamType GetBlueTeam() + { + return BlueTeam; + } + + @Override + public PlayerTeamType GetRedTeam() + { + return RedTeam; + } + + protected Location GetRandomSpawnPoint(List spawnPoints) + { + Location randomSpawnPoint = spawnPoints.get(_random.nextInt(spawnPoints.size())); + return randomSpawnPoint; + } + + protected void SpawnPlayer(PlayerType player) + { + player.GetPlayer().eject(); + player.GetPlayer().leaveVehicle(); + + if (player.GetTeam() == RedTeam) + { + player.teleport(GetRandomSpawnPoint(Arena.GetRedSpawnPoints())); + } + else if (player.GetTeam() == GetBlueTeam()) + { + player.teleport(GetRandomSpawnPoint(Arena.GetBlueSpawnPoints())); + } + + player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, .5F, 0F); + } + + public void RespawnPlayer(PlayerType player) + { + if (!player.isOnline()) + return; + + SpawnPlayer(player); + + ClassManager.Get(player.getName()).ResetToDefaults(true, true); + } + + protected void StopGame() + { + for (PlayerType player : Players.values()) + { + player.StopTimePlay(); + + if (!player.isOnline()) + continue; + + player.GetPlayer().eject(); + + if (player.GetPlayer().isInsideVehicle()) + player.GetPlayer().leaveVehicle(); + + if (player.GetTeam() == BlueTeam) + { + player.teleport(GetRandomSpawnPoint(Arena.GetBlueSpawnPoints())); + } + else if (player.GetTeam() == RedTeam) + { + player.teleport(GetRandomSpawnPoint(Arena.GetRedSpawnPoints())); + } + + ResetPlayer(player); + + if (player.isOnline()) + { + ClientClass playerClass = ClassManager.Get(player.getName()); + playerClass.SetGameClass(null); + playerClass.ClearDefaults(); + } + + player.SetDead(true); + player.SetSpectating(true); + + if (PlayerTaskIdMap.containsKey(player.getName())) + { + Plugin.getServer().getScheduler().cancelTask(PlayerTaskIdMap.get(player.getName())); + ConditionManager.EndCondition(player.GetPlayer(), ConditionType.CLOAK, null); + + PlayerTaskIdMap.remove(player.getName()); + } + + player.playSound(player.getLocation(), Sound.WITHER_SPAWN, 1, .9f); + } + + Plugin.getServer().getScheduler().cancelTask(UpdaterTaskId); + } + + protected void UpdateNewPlayerWithOldPlayer(PlayerType newPlayer, PlayerType oldPlayer) + { + super.UpdateNewPlayerWithOldPlayer(newPlayer, oldPlayer); + + PlayerTeamType playerTeam = oldPlayer.GetTeam(); + + playerTeam.RemovePlayer(oldPlayer); + playerTeam.AddPlayer(newPlayer); + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/notifier/IPlayerNotifier.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/notifier/IPlayerNotifier.java new file mode 100644 index 000000000..2bb0a9946 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/notifier/IPlayerNotifier.java @@ -0,0 +1,10 @@ +package nautilus.game.core.notifier; + +import java.util.Collection; + +import nautilus.game.core.player.IGamePlayer; + +public interface IPlayerNotifier +{ + void BroadcastMessageToPlayers(String message, Collection players); +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/notifier/PlayerNotifier.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/notifier/PlayerNotifier.java new file mode 100644 index 000000000..8e2690346 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/notifier/PlayerNotifier.java @@ -0,0 +1,79 @@ +package nautilus.game.core.notifier; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.core.arena.IArena; +import nautilus.game.core.game.IGame; +import nautilus.game.core.player.IGamePlayer; + +public class PlayerNotifier, ArenaType extends IArena, PlayerType extends IGamePlayer> implements IPlayerNotifier, Listener +{ + protected JavaPlugin Plugin; + protected String ChatCategoryName; + + public PlayerNotifier(JavaPlugin plugin, String chatCategoryName) + { + Plugin = plugin; + ChatCategoryName = chatCategoryName; + + plugin.getServer().getPluginManager().registerEvents(this, Plugin); + } + + public void NotifyPlayerJoinGame(GameType game, PlayerType player) + { + BroadcastMessageToGamePlayers(game, player.getName() + " joined the game."); + } + + public void BroadcastMessageToPlayers(String message, Collection playersToSpam) + { + for (IGamePlayer player : playersToSpam) + { + UtilPlayer.message(player.GetPlayer(), F.main(ChatCategoryName, message)); + } + } + + public void BroadcastMessageToPlayer(String message, Player player) + { + UtilPlayer.message(player, F.main(ChatCategoryName, message)); + } + + public void BroadcastMessageToGamePlayers(GameType game, String message) + { + List playersToSpam = new ArrayList(game.GetPlayers()); + playersToSpam.addAll(game.GetSpectators()); + + BroadcastMessageToPlayers(message, playersToSpam); + } + + public void BroadcastMessageToOtherGamePlayers(GameType game, String message, Collection players) + { + List playersToSpam = new ArrayList(game.GetPlayers()); + + playersToSpam.addAll(game.GetSpectators()); + + for (PlayerType gamePlayer : players) + { + playersToSpam.remove(gamePlayer); + } + + BroadcastMessageToPlayers(message, playersToSpam); + } + + public void BroadcastMessageToOtherGamePlayers(GameType game, String message, PlayerType player) + { + List playersToSpam = new ArrayList(game.GetPlayers()); + playersToSpam.remove(player); + + playersToSpam.addAll(game.GetSpectators()); + + BroadcastMessageToPlayers(message, playersToSpam); + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/notifier/TeamPlayerNotifier.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/notifier/TeamPlayerNotifier.java new file mode 100644 index 000000000..09baaff32 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/notifier/TeamPlayerNotifier.java @@ -0,0 +1,51 @@ +package nautilus.game.core.notifier; + +import org.bukkit.ChatColor; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.core.arena.ITeamArena; +import nautilus.game.core.engine.ITeam; +import nautilus.game.core.engine.TeamType; +import nautilus.game.core.events.team.TeamGameFinishedEvent; +import nautilus.game.core.game.ITeamGame; +import nautilus.game.core.player.ITeamGamePlayer; + +public class TeamPlayerNotifier, ArenaType extends ITeamArena, PlayerTeamType extends ITeam, PlayerType extends ITeamGamePlayer> extends PlayerNotifier +{ + public TeamPlayerNotifier(JavaPlugin plugin, String chatCategoryName) + { + super(plugin, chatCategoryName); + } + + public void NotifyGameWin(GameType game, PlayerTeamType team) + { + BroadcastMessageToGamePlayers(game, "Congratulations " + team.GetTeamType() + " team for winning this match!"); + } + + public void NotifyPlayerJoinTeam(GameType game, PlayerType player) + { + BroadcastMessageToOtherGamePlayers(game, player.getName() + " joined the " + player.GetTeam().GetTeamType() + " team.", player); + UtilPlayer.message(player.GetPlayer(), F.main("Team", "You joined the " + player.GetTeam().GetTeamType() + " team.")); + } + + public void NotifyPlayerLeaveTeam(GameType game, PlayerType player) + { + BroadcastMessageToOtherGamePlayers(game, player.getName() + " left the " + player.GetTeam().GetTeamType() + " team.", player); + UtilPlayer.message(player.GetPlayer(), F.main("Team", "You left the " + player.GetTeam().GetTeamType() + " team.")); + } + + @EventHandler + public void onTeamGameFinished(TeamGameFinishedEvent event) + { + BroadcastMessageToGamePlayers(event.GetGame(), GetTeamString(event.GetWinningTeam()) + " has won the game!"); + } + + protected String GetTeamString(PlayerTeamType team) + { + String colorString = "" + (team.GetTeamType() == TeamType.RED ? ChatColor.RED : ChatColor.BLUE); + return ChatColor.WHITE + "[" + colorString + team.GetTeamType() + ChatColor.WHITE + "]" + ChatColor.GRAY; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/player/GamePlayer.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/player/GamePlayer.java new file mode 100644 index 000000000..8a381e920 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/player/GamePlayer.java @@ -0,0 +1,297 @@ +package nautilus.game.core.player; + +import mineplex.minecraft.game.classcombat.Class.ClientClass; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.World; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.inventory.PlayerInventory; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class GamePlayer implements IGamePlayer +{ + private Player _player; + + private int _lives; + private int _kills; + private int _assists; + private int _deaths; + private int _points; + private int _skillTokens; + private int _itemTokens; + private long _logoutTime; + private Location _lastInArenaPosition; + private boolean _isDead; + private boolean _isSpectating; + private long _timePlayed; + private long _lastTimePlayStart; + + private ClientClass _clientClass; + + public GamePlayer(JavaPlugin plugin, Player player) + { + _player = player; + } + + @Override + public int GetRemainingLives() + { + return _lives; + } + + @Override + public void SetLives(int getRemainingLives) + { + _lives = getRemainingLives; + } + + @Override + public int GetKills() + { + return _kills; + } + + @Override + public void AddKills(int kills) + { + _kills += kills; + } + + @Override + public int GetAssists() + { + return _assists; + } + + @Override + public void AddAssists(int assists) + { + _assists += assists; + } + + @Override + public int GetDeaths() + { + return _deaths; + } + + @Override + public void AddDeaths(int deaths) + { + _deaths += deaths; + } + + @Override + public int GetSkillTokens() + { + return _skillTokens; + } + + @Override + public void SetSkillTokens(int tokens) + { + _skillTokens = tokens; + } + + @Override + public int GetItemTokens() + { + return _itemTokens; + } + + @Override + public void SetItemTokens(int tokens) + { + _itemTokens = tokens; + } + + @Override + public int GetPoints() + { + return _points; + } + + @Override + public void AddPoints(int points) + { + _points += points; + } + + @Override + public void SetLogoutTime(long logoutTime) + { + _logoutTime = logoutTime; + } + + @Override + public long GetLogoutTime() + { + return _logoutTime; + } + + @Override + public boolean IsOut() + { + return _lives <= 0; + } + + @Override + public void SetLastInArenaPosition(World world, double x, double y, double z) + { + _lastInArenaPosition = new Location(world, x, y, z); + } + + @Override + public Location GetLastInArenaPosition() + { + return _lastInArenaPosition; + } + + @Override + public boolean IsDead() + { + return _isDead; + } + + @Override + public void SetDead(boolean dead) + { + _isDead = dead; + } + + @Override + public org.bukkit.entity.Player GetPlayer() + { + return _player; + } + + public void RemoveArrows() + { + // WHERE DID IT GO?????? ((CraftPlayer)_player).getHandle().r(0); + } + + @Override + public boolean IsSpectating() + { + return _isSpectating; + } + + @Override + public void SetSpectating(boolean spectating) + { + _isSpectating = spectating; + + // Fix for arrows hitting dead players. + ((CraftPlayer)_player).getHandle().spectating = spectating; + + if (spectating) + { + _player.setAllowFlight(true); + _player.setFlying(true); + } + else + { + _player.setAllowFlight(false); + _player.setFlying(false); + } + } + + @Override + public ClientClass GetClass() + { + return _clientClass; + } + + @Override + public void SetClass(ClientClass clientClass) + { + _clientClass = clientClass; + } + + @Override + public long GetTimePlayed() + { + return _timePlayed; + } + + @Override + public void StartTimePlay() + { + _lastTimePlayStart = System.currentTimeMillis(); + } + + @Override + public void StopTimePlay() + { + _timePlayed += System.currentTimeMillis() - _lastTimePlayStart; + } + + @Override + public String getName() + { + return _player.getName(); + } + + @Override + public void sendMessage(String string) + { + _player.sendMessage(string); + } + + @Override + public Location getLocation() + { + return _player.getLocation(); + } + + @Override + public boolean teleport(Location location) + { + return _player.teleport(location); + } + + @Override + public boolean isOnline() + { + return _player.isOnline(); + } + + @Override + public void setFireTicks(int i) + { + _player.setFireTicks(i); + } + + @Override + public void setHealth(double i) + { + _player.setHealth(i); + } + + @Override + public void setFoodLevel(int i) + { + _player.setFoodLevel(i); + } + + @Override + public void setVelocity(Vector vector) + { + _player.setVelocity(vector); + } + + @Override + public PlayerInventory getInventory() + { + return _player.getInventory(); + } + + @Override + public void playSound(Location location, Sound zombieMetal, float f, float g) + { + _player.playSound(location, zombieMetal, f, g); + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/player/IGamePlayer.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/player/IGamePlayer.java new file mode 100644 index 000000000..3a81000b1 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/player/IGamePlayer.java @@ -0,0 +1,61 @@ +package nautilus.game.core.player; + +import mineplex.minecraft.game.classcombat.Class.ClientClass; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.inventory.PlayerInventory; +import org.bukkit.util.Vector; + +public interface IGamePlayer +{ + int GetRemainingLives(); + void SetLives(int getRemainingLives); + int GetKills(); + void AddKills(int kills); + int GetAssists(); + void AddAssists(int assists); + int GetDeaths(); + void AddDeaths(int deaths); + + void SetLogoutTime(long logoutTime); + long GetLogoutTime(); + boolean IsDead(); + void SetDead(boolean dead); + boolean IsSpectating(); + void SetSpectating(boolean spectating); + Player GetPlayer(); + void RemoveArrows(); + + void StartTimePlay(); + void StopTimePlay(); + long GetTimePlayed(); + + String getName(); + void sendMessage(String string); + Location getLocation(); + boolean teleport(Location location); + boolean isOnline(); + + void setFireTicks(int i); + void setHealth(double i); + void setFoodLevel(int i); + boolean IsOut(); + void setVelocity(Vector vector); + void SetLastInArenaPosition(World world, double x, double y, double z); + Location GetLastInArenaPosition(); + PlayerInventory getInventory(); + void playSound(Location location, Sound zombieMetal, float f, float g); + + int GetPoints(); + void AddPoints(int points); + void SetSkillTokens(int skillTokens); + void SetItemTokens(int itemTokens); + int GetSkillTokens(); + int GetItemTokens(); + + ClientClass GetClass(); + void SetClass(ClientClass clientClass); +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/player/ITeamGamePlayer.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/player/ITeamGamePlayer.java new file mode 100644 index 000000000..a11421bc3 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/player/ITeamGamePlayer.java @@ -0,0 +1,9 @@ +package nautilus.game.core.player; + +import nautilus.game.core.engine.ITeam; + +public interface ITeamGamePlayer>> extends IGamePlayer +{ + Team GetTeam(); + void SetTeam(Team team); +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/player/TeamGamePlayer.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/player/TeamGamePlayer.java new file mode 100644 index 000000000..20dc3c83a --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/player/TeamGamePlayer.java @@ -0,0 +1,28 @@ +package nautilus.game.core.player; + +import nautilus.game.core.engine.ITeam; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +public class TeamGamePlayer>> extends GamePlayer implements ITeamGamePlayer +{ + protected Team Team; + + public TeamGamePlayer(JavaPlugin plugin, Player player) + { + super(plugin, player); + } + + @Override + public Team GetTeam() + { + return Team; + } + + @Override + public void SetTeam(Team team) + { + Team = team; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/IScoreHandler.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/IScoreHandler.java new file mode 100644 index 000000000..0e11f6311 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/IScoreHandler.java @@ -0,0 +1,8 @@ +package nautilus.game.core.scoreboard; + +import nautilus.game.core.player.IGamePlayer; + +public interface IScoreHandler +{ + void RewardForDeath(PlayerType player); +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/ITeamScoreHandler.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/ITeamScoreHandler.java new file mode 100644 index 000000000..a4d4d9d24 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/ITeamScoreHandler.java @@ -0,0 +1,13 @@ +package nautilus.game.core.scoreboard; + +import nautilus.game.core.engine.ITeam; +import nautilus.game.core.player.ITeamGamePlayer; + +public interface ITeamScoreHandler, PlayerTeamType extends ITeam> extends IScoreHandler +{ + void RewardForTeamKill(PlayerType killer, PlayerType victim); + + void RewardForKill(PlayerType killer, PlayerType victim, int assists); + + void RewardForAssist(PlayerType assistant, PlayerType victim); +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/LineTracker.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/LineTracker.java new file mode 100644 index 000000000..036336368 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/LineTracker.java @@ -0,0 +1,64 @@ +package nautilus.game.core.scoreboard; + +import net.minecraft.server.v1_6_R2.EntityPlayer; +import net.minecraft.server.v1_6_R2.Packet201PlayerInfo; + +public class LineTracker +{ + private String _line = null; + private String _oldLine = null; + private Packet201PlayerInfo _clearOldPacket; + private Packet201PlayerInfo _addNewPacket; + private Packet201PlayerInfo _clearNewPacket; + + public LineTracker() + { + _line = null; + } + + public void SetLine(String s) + { + if (s != null && s.length() > 16) + s = s.substring(0, 16); + + _oldLine = _line; + _line = s; + + if (_oldLine != null) + { + _clearOldPacket = new Packet201PlayerInfo(_oldLine, false, 0); + } + + if (_line != null) + { + _addNewPacket = new Packet201PlayerInfo(_line, true, 0); + _clearNewPacket = new Packet201PlayerInfo(_line, false, 0); + } + } + + public void DisplayLineToPlayer(EntityPlayer entityPlayer) + { + if (_oldLine != null) + { + entityPlayer.playerConnection.sendPacket(_clearOldPacket); + } + + if (_line != null) + { + entityPlayer.playerConnection.sendPacket(_addNewPacket); + } + } + + public void RemoveLineForPlayer(EntityPlayer entityPlayer) + { + if (_line != null) + { + entityPlayer.playerConnection.sendPacket(_clearNewPacket); + } + } + + public void ClearOldLine() + { + _oldLine = null; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/PlayerPointSorter.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/PlayerPointSorter.java new file mode 100644 index 000000000..6ef42a34b --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/PlayerPointSorter.java @@ -0,0 +1,16 @@ +package nautilus.game.core.scoreboard; + +import java.util.Comparator; + +import nautilus.game.core.player.IGamePlayer; + +public class PlayerPointSorter implements Comparator +{ + public int compare(PlayerType a, PlayerType b) + { + if (a.GetPoints() != b.GetPoints()) + return b.GetPoints() - a.GetPoints(); + + return a.getName().toLowerCase().compareTo(b.getName().toLowerCase()); + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/TabScoreboard.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/TabScoreboard.java new file mode 100644 index 000000000..3c20432f0 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/TabScoreboard.java @@ -0,0 +1,304 @@ +package nautilus.game.core.scoreboard; + +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.packethandler.IPacketRunnable; +import mineplex.core.packethandler.PacketArrayList; +import mineplex.core.packethandler.PacketHandler; +import mineplex.minecraft.game.classcombat.Class.ClassManager; +import mineplex.minecraft.game.classcombat.Class.ClientClass; +import nautilus.game.core.engine.ITeam; +import nautilus.game.core.game.ITeamGame; +import nautilus.game.core.player.ITeamGamePlayer; +import nautilus.minecraft.core.utils.TimeStuff; +import net.minecraft.server.v1_6_R2.EntityPlayer; +import net.minecraft.server.v1_6_R2.Packet; +import net.minecraft.server.v1_6_R2.Packet201PlayerInfo; + +public class TabScoreboard, PlayerType extends ITeamGamePlayer, TeamType extends ITeam> implements IPacketRunnable +{ + protected CoreClientManager ClientManager; + protected ClassManager ClassManager; + protected PacketHandler PacketHandler; + protected NautHashMap> MainColumn; + + protected GameType Game; + protected NautHashMap RedColumn; + protected NautHashMap BlueColumn; + + private boolean _updating = false; + + public TabScoreboard(JavaPlugin plugin, CoreClientManager clientManager, ClassManager classManager, PacketHandler packetHandler, GameType game) + { + ClientManager = clientManager; + ClassManager = classManager; + PacketHandler = packetHandler; + Game = game; + RedColumn = new NautHashMap(); + BlueColumn = new NautHashMap(); + MainColumn = new NautHashMap>(); + + for (Integer i=0; i < 20; i++) + { + RedColumn.put(i, new LineTracker()); + } + + for (Integer i=0; i < 20; i++) + { + BlueColumn.put(i, new LineTracker()); + } + + PacketHandler.AddPacketRunnable(this); + } + + public void Update() + { + SetRedTeamInfo(); + SetBlueTeamInfo(); + + for (PlayerType player : Game.GetPlayers()) + { + UpdateForPlayer(player); + + if (player.isOnline()) + SendPlayerScoreboard(player); + } + + for (PlayerType player : Game.GetSpectators()) + { + UpdateForPlayer(player); + SendPlayerScoreboard(player); + } + + for (Integer i=0; i < 20; i++) + { + RedColumn.get(i).ClearOldLine(); + } + + for (Integer i=0; i < 20; i++) + { + BlueColumn.get(i).ClearOldLine(); + } + } + + public void AddSpectator(PlayerType spectator) + { + UpdateForPlayer(spectator); + SendPlayerScoreboard(spectator); + } + + public void Stop() + { + for (Integer i=0; i < 20; i++) + { + RedColumn.get(i).SetLine(""); + } + + for (Integer i=0; i < 20; i++) + { + BlueColumn.get(i).SetLine(""); + } + + Packet201PlayerInfo clearPacket = new Packet201PlayerInfo("", false, 0); + + _updating = true; + for (PlayerType player : Game.GetPlayers()) + { + NautHashMap playerLines = MainColumn.get(player.getName()); + + // If player quit as game was preparing and never reconnected... + if (playerLines != null) + { + for (Integer i=0; i < 20; i++) + { + playerLines.get(i).SetLine(""); + } + + SendPlayerScoreboard(player); + + EntityPlayer entityPlayer = ((CraftPlayer)player.GetPlayer()).getHandle(); + + entityPlayer.playerConnection.sendPacket(clearPacket); + } + } + + for (PlayerType player : Game.GetSpectators()) + { + NautHashMap playerLines = MainColumn.get(player.getName()); + + for (Integer i=0; i < 20; i++) + { + playerLines.get(i).SetLine(""); + } + + SendPlayerScoreboard(player); + + EntityPlayer entityPlayer = ((CraftPlayer)player.GetPlayer()).getHandle(); + + entityPlayer.playerConnection.sendPacket(clearPacket); + } + _updating = false; + + PacketHandler.RemovePacketRunnable(this); + } + + public void UpdateForPlayer(PlayerType player) + { + SetMainInfo(player); + } + + protected void SetRedTeamInfo() + { + RedColumn.get(0).SetLine(ChatColor.RED + " [RED]"); + RedColumn.get(1).SetLine(ChatColor.RED + "Score: " + ChatColor.WHITE + Game.GetRedTeam().GetScore()); + RedColumn.get(8).SetLine(ChatColor.RED + " [Players]"); + RedColumn.get(9).SetLine(ChatColor.RED + " [K/D/A S]"); + + String spacer = ""; + for (int i=0; i < 5; i++) + { + int lineIndex = 10 + i * 2; + spacer += " "; + + if (i < Game.GetRedTeam().GetPlayers().size()) + { + PlayerType player = Game.GetRedTeam().GetPlayers().get(i); + + ChatColor playerColor = !player.isOnline() ? ChatColor.DARK_GRAY : ChatColor.WHITE; + RedColumn.get(lineIndex).SetLine(playerColor + player.getName()); + RedColumn.get(lineIndex+1).SetLine(ChatColor.RED + "" + player.GetKills() + "/" + player.GetDeaths() + "/" + player.GetAssists() + " " + player.GetPoints() + spacer); + } + else + { + RedColumn.get(lineIndex).SetLine(ChatColor.RED + "" + ChatColor.GREEN + spacer); + RedColumn.get(lineIndex+1).SetLine(ChatColor.RED + "" + ChatColor.BLUE + spacer); + } + } + } + + protected void SetMainInfo(PlayerType player) + { + if (!player.isOnline()) + return; + + ClientClass clientPlayer = ClassManager.Get(player.GetPlayer()); + + if (!MainColumn.containsKey(player.getName())) + { + NautHashMap playerLines = new NautHashMap(); + + for (Integer i=0; i < 20; i++) + { + playerLines.put(i, new LineTracker()); + } + + MainColumn.put(player.getName(), playerLines); + } + + NautHashMap playerLines = MainColumn.get(player.getName()); + + playerLines.get(0).SetLine(ChatColor.GREEN + " [Dominate]"); + playerLines.get(1).SetLine(ChatColor.GREEN + "Map:"); + playerLines.get(2).SetLine(Game.GetArena().GetName()); + playerLines.get(3).SetLine(ChatColor.GREEN + "Win Limit:"); + playerLines.get(4).SetLine(Game.GetWinLimit() + ""); + playerLines.get(5).SetLine(ChatColor.GREEN + "Duration:"); + playerLines.get(6).SetLine((Game.GetStartTime() == 0 ? "0" : TimeStuff.GetTimespanString(System.currentTimeMillis() - Game.GetStartTime()))); + playerLines.get(7).SetLine(ChatColor.GREEN + ""); + playerLines.get(8).SetLine(ChatColor.GREEN + " [Stats]"); + playerLines.get(9).SetLine(ChatColor.GREEN + "Class:" ); + playerLines.get(10).SetLine((clientPlayer.GetGameClass() == null ? "None" : clientPlayer.GetGameClass().GetName())); + playerLines.get(11).SetLine(ChatColor.GREEN + "Kills:"); + playerLines.get(12).SetLine(player.GetKills() + " "); + playerLines.get(13).SetLine(ChatColor.GREEN + "Deaths:"); + playerLines.get(14).SetLine(player.GetDeaths() + " "); + playerLines.get(15).SetLine(ChatColor.GREEN + "Assists:"); + playerLines.get(16).SetLine(player.GetAssists() + " "); + playerLines.get(17).SetLine(ChatColor.GREEN + "Score:"); + playerLines.get(18).SetLine(player.GetPoints() + " "); + playerLines.get(19).SetLine(ChatColor.GREEN + " "); + } + + protected void SetBlueTeamInfo() + { + BlueColumn.get(0).SetLine(ChatColor.BLUE + " [BLUE]"); + BlueColumn.get(1).SetLine(ChatColor.BLUE + "Score: " + ChatColor.WHITE + Game.GetBlueTeam().GetScore()); + BlueColumn.get(8).SetLine(ChatColor.BLUE + " [Players]"); + BlueColumn.get(9).SetLine(ChatColor.BLUE + " [K/D/A S]"); + + String spacer = ""; + for (int i=0; i < 5; i++) + { + int lineIndex = 10 + i * 2; + spacer += " "; + + if (i < Game.GetBlueTeam().GetPlayers().size()) + { + PlayerType player = Game.GetBlueTeam().GetPlayers().get(i); + + ChatColor playerColor = !player.isOnline() ? ChatColor.DARK_GRAY : ChatColor.WHITE; + BlueColumn.get(lineIndex).SetLine(playerColor + player.getName()); + BlueColumn.get(lineIndex+1).SetLine(ChatColor.BLUE + "" + player.GetKills() + "/" + player.GetDeaths() + "/" + player.GetAssists() + " " + player.GetPoints() + spacer); + } + else + { + BlueColumn.get(lineIndex).SetLine(ChatColor.BLUE + " " + ChatColor.GREEN + spacer); + BlueColumn.get(lineIndex+1).SetLine(ChatColor.BLUE + " " + ChatColor.RED + spacer); + } + } + } + + public void ClearScoreboardForSpectator(PlayerType player) + { + EntityPlayer entityPlayer = ((CraftPlayer)player.GetPlayer()).getHandle(); + NautHashMap playersLines = MainColumn.get(player.getName()); + + if (playersLines == null) + return; + + _updating = true; + for (Integer i=0; i < 20; i++) + { + RedColumn.get(i).RemoveLineForPlayer(entityPlayer); + playersLines.get(i).RemoveLineForPlayer(entityPlayer); + BlueColumn.get(i).RemoveLineForPlayer(entityPlayer); + } + _updating = false; + + MainColumn.remove(player.getName()); + } + + public void SendPlayerScoreboard(PlayerType player) + { + EntityPlayer entityPlayer = ((CraftPlayer)player.GetPlayer()).getHandle(); + NautHashMap playersLines = MainColumn.get(player.getName()); + + _updating = true; + for (int i=0; i < 20; i++) + { + RedColumn.get(i).DisplayLineToPlayer(entityPlayer); + playersLines.get(i).DisplayLineToPlayer(entityPlayer); + BlueColumn.get(i).DisplayLineToPlayer(entityPlayer); + + playersLines.get(i).ClearOldLine(); + } + _updating = false; + } + + @Override + public boolean run(Packet packet, Player owner, PacketArrayList packetList) + { + if (packet instanceof Packet201PlayerInfo) + { + if (Game.IsPlayerInGame(owner) && Game.IsActive()) + return _updating; + } + + return true; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/TeamGameScoreHandler.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/TeamGameScoreHandler.java new file mode 100644 index 000000000..3a8491cb3 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/TeamGameScoreHandler.java @@ -0,0 +1,60 @@ +package nautilus.game.core.scoreboard; + +import nautilus.game.core.arena.ITeamArena; +import nautilus.game.core.engine.ITeam; +import nautilus.game.core.game.ITeamGame; +import nautilus.game.core.notifier.TeamPlayerNotifier; +import nautilus.game.core.player.ITeamGamePlayer; + +import org.bukkit.ChatColor; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; + +public abstract class TeamGameScoreHandler, GameType extends ITeamGame, ArenaType extends ITeamArena, PlayerTeamType extends ITeam, PlayerType extends ITeamGamePlayer> implements ITeamScoreHandler, Listener +{ + protected NotifierType Notifier; + + public TeamGameScoreHandler(JavaPlugin plugin, NotifierType notifier) + { + Notifier = notifier; + + plugin.getServer().getPluginManager().registerEvents(this, plugin); + } + + public void Stop() + { + HandlerList.unregisterAll(this); + } + + public void RewardForDeath(PlayerType player) + { + player.AddPoints(-5); + Notifier.BroadcastMessageToPlayer("Your score was reduced by " + ChatColor.YELLOW + 5 + ChatColor.GRAY + " for dying!", player.GetPlayer()); + } + + public void RewardForTeamKill(PlayerType killer, PlayerType victim) + { + killer.AddPoints(-25); + + Notifier.BroadcastMessageToPlayer("You team killed " + victim.getName() + " and reduced your score by " + ChatColor.YELLOW + -25 + ChatColor.GRAY + "!", killer.GetPlayer()); + } + + public void RewardForKill(PlayerType killer, PlayerType victim, int assists) + { + int deathValue = 15; + int deathPoints = deathValue + GetKillModifierValue(killer, victim, assists); + + killer.AddPoints(deathPoints - (assists * 2)); + + Notifier.BroadcastMessageToPlayer("You killed " + victim.getName() + " for an additional +" + ChatColor.YELLOW + (deathPoints - (assists * 2)) + ChatColor.GRAY + " to your score!", killer.GetPlayer()); + } + + public void RewardForAssist(PlayerType assistant, PlayerType victim) + { + assistant.AddPoints(2); + Notifier.BroadcastMessageToPlayer("You helped kill " + victim.getName() + " for an additional +" + ChatColor.YELLOW + 2 + ChatColor.GRAY + " to your score!", assistant.GetPlayer()); + } + + protected abstract int GetKillModifierValue(PlayerType killer, PlayerType victim, int assists); +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/util/BroadcastMinuteTimer.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/util/BroadcastMinuteTimer.java new file mode 100644 index 000000000..5f2f885a3 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/util/BroadcastMinuteTimer.java @@ -0,0 +1,110 @@ +package nautilus.game.core.util; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.Timer; + +import nautilus.game.core.game.IGame; +import nautilus.game.core.notifier.IPlayerNotifier; +import nautilus.game.core.player.IGamePlayer; + +public class BroadcastMinuteTimer extends BroadcastTimer +{ + private BroadcastSecondTimer countdownTimer; + + public BroadcastMinuteTimer(IPlayerNotifier notifier, IGame game, int maxTime, String message, String endMessage, ActionListener listener) + { + super(notifier, game, maxTime, message, endMessage, listener); + + Timer = new Timer(60*1000, Listener); + Timer.setDelay(60*1000); + Timer.setInitialDelay(0); + + countdownTimer = new BroadcastSecondTimer(notifier, game, 60, message, EndMessage, new ActionListener() + { + public void actionPerformed(ActionEvent evt) + { + KickOffListener(); + } + }); + } + + public void LoadListener() + { + Listener = new ActionListener() + { + public void actionPerformed(ActionEvent evt) + { + if (Ticks % 5 == 0) + { + Notifier.BroadcastMessageToPlayers(Message + " in " + Ticks + " minutes.", Game.GetPlayers()); + } + else if (Ticks == 3) + { + Notifier.BroadcastMessageToPlayers(Message + " in 3 minutes.", Game.GetPlayers()); + } + else if (Ticks == 1) + { + Notifier.BroadcastMessageToPlayers(Message + " in 1 minute.", Game.GetPlayers()); + + Stop(); + countdownTimer.Start(); + } + + Ticks--; + } + }; + } + + @Override + public void SetTimeLeft(long time) + { + if (time > 60000) + { + Ticks = (int)(time / 60000); + + if (!IsRunning()) + Start(); + } + else + { + Ticks = 0; + Stop(); + countdownTimer.SetTimeLeft(time); + countdownTimer.Start(); + } + } + + @Override + public long GetTimeLeft() + { + long timeLeft = 0; + + if (Ticks > 0) + { + timeLeft = Ticks * 60 * 1000; + } + else if (countdownTimer.IsRunning()) + { + timeLeft = countdownTimer.GetTimeLeft(); + } + + return timeLeft; + } + + @Override + public Boolean IsRunning() + { + return Timer.isRunning() || countdownTimer.IsRunning(); + } + + @Override + public void Deactivate() + { + super.Deactivate(); + + countdownTimer.Deactivate(); + countdownTimer = null; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/util/BroadcastSecondTimer.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/util/BroadcastSecondTimer.java new file mode 100644 index 000000000..9d3045fc5 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/util/BroadcastSecondTimer.java @@ -0,0 +1,88 @@ +package nautilus.game.core.util; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.Timer; + +import nautilus.game.core.arena.IArena; +import nautilus.game.core.game.IGame; +import nautilus.game.core.notifier.IPlayerNotifier; +import nautilus.game.core.player.IGamePlayer; + +public class BroadcastSecondTimer extends BroadcastTimer +{ + public BroadcastSecondTimer(IPlayerNotifier notifier, IGame game, int maxTime, String message, String endMessage, ActionListener actionListener) + { + super(notifier, game, maxTime, message, endMessage, actionListener); + + Timer = new Timer(1000, Listener); + Timer.setDelay(1000); + Timer.setInitialDelay(0); + Timer.setRepeats(true); + } + + public void LoadListener() + { + Listener = new ActionListener() { + public void actionPerformed(ActionEvent evt) + { + if (Ticks <= 0) + { + if (EndMessage != null) + Notifier.BroadcastMessageToPlayers(EndMessage, Game.GetPlayers()); + + Stop(); + KickOffListener(); + } + else if (Ticks == 1) + { + Notifier.BroadcastMessageToPlayers(Message + " in 1 second.", Game.GetPlayers()); + } + else if (Ticks < 11) + { + Notifier.BroadcastMessageToPlayers(Message + " in " + Ticks + " seconds.", Game.GetPlayers()); + } + else if (Ticks == 15) + { + Notifier.BroadcastMessageToPlayers(Message + " in " + Ticks + " seconds.", Game.GetPlayers()); + } + else if (Ticks == 30) + { + Notifier.BroadcastMessageToPlayers(Message + " in " + Ticks + " seconds.", Game.GetPlayers()); + } + else if (Ticks == 45) + { + Notifier.BroadcastMessageToPlayers(Message + " in " + Ticks + " seconds.", Game.GetPlayers()); + } + + Ticks--; + } + }; + } + + @Override + public void SetTimeLeft(long time) + { + if (time > 1000) + { + Ticks = (int)(time / 1000); + + if (!IsRunning()) + Start(); + } + else + { + Ticks = 0; + } + + if (!IsRunning()) + Start(); + } + + @Override + public long GetTimeLeft() + { + return Ticks * 1000; + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/util/BroadcastTimer.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/util/BroadcastTimer.java new file mode 100644 index 000000000..9d740c1e1 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/util/BroadcastTimer.java @@ -0,0 +1,73 @@ +package nautilus.game.core.util; + +import java.awt.event.ActionListener; +import javax.swing.Timer; + +import nautilus.game.core.arena.IArena; +import nautilus.game.core.game.IGame; +import nautilus.game.core.notifier.IPlayerNotifier; +import nautilus.game.core.player.IGamePlayer; + +public abstract class BroadcastTimer +{ + protected IPlayerNotifier Notifier; + protected IGame Game; + protected Timer Timer; + protected String Message; + protected String EndMessage; + protected int Ticks = 5; + protected ActionListener OutsideListener; + protected ActionListener Listener; + + public BroadcastTimer(IPlayerNotifier notifier, IGame game, int maxTime, String message, String endMessage, ActionListener actionListener) + { + Notifier = notifier; + Game = game; + Message = message; + EndMessage = endMessage; + Ticks = maxTime; + OutsideListener = actionListener; + + LoadListener(); + } + + public void Start() + { + Timer.start(); + } + + public void Stop() + { + Timer.stop(); + } + + public void Deactivate() + { + Timer.stop(); + + Notifier = null; + Game = null; + Timer = null; + Message = null; + EndMessage = null; + OutsideListener = null; + Listener = null; + } + + protected void KickOffListener() + { + if (OutsideListener != null) + OutsideListener.actionPerformed(null); + } + + abstract void LoadListener(); + + public abstract void SetTimeLeft(long time); + + public abstract long GetTimeLeft(); + + public Boolean IsRunning() + { + return Timer.isRunning(); + } +} diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/util/NullChunkGenerator.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/util/NullChunkGenerator.java new file mode 100644 index 000000000..bd749d899 --- /dev/null +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/util/NullChunkGenerator.java @@ -0,0 +1,21 @@ +package nautilus.game.core.util; + +import java.util.Random; + +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.generator.ChunkGenerator; + +public class NullChunkGenerator extends ChunkGenerator +{ + public byte[] generate(World world, Random random, int cx, int cz) + { + return new byte[32768]; + } + + @Override + public Location getFixedSpawnLocation(World world, Random random) + { + return new Location(world, 256, 64, 256); + } +} diff --git a/Plugins/Nautilus.Game.Deathmatch/.classpath b/Plugins/Nautilus.Game.Deathmatch/.classpath new file mode 100644 index 000000000..116e98e84 --- /dev/null +++ b/Plugins/Nautilus.Game.Deathmatch/.classpath @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.Deathmatch/.project b/Plugins/Nautilus.Game.Deathmatch/.project new file mode 100644 index 000000000..eaef7055f --- /dev/null +++ b/Plugins/Nautilus.Game.Deathmatch/.project @@ -0,0 +1,17 @@ + + + Nautilus.Game.Deathmatch + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Nautilus.Game.Deathmatch/.settings/org.eclipse.jdt.core.prefs b/Plugins/Nautilus.Game.Deathmatch/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7341ab168 --- /dev/null +++ b/Plugins/Nautilus.Game.Deathmatch/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/Deathmatch.java b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/Deathmatch.java new file mode 100644 index 000000000..1e803e2fb --- /dev/null +++ b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/Deathmatch.java @@ -0,0 +1,45 @@ +package nautilus.game.deathmatch; + +import me.chiss.Core.PlayerTagNamer.INameColorer; +import me.chiss.Core.Plugin.IRelation; +import mineplex.core.server.IRepository; + +import nautilus.game.core.GamePlugin; +import nautilus.game.core.arena.ArenaManager; +import nautilus.game.deathmatch.repository.DeathmatchRepository; + +public class Deathmatch extends GamePlugin +{ + private DeathmatchRepository _repository; + + public void onEnable() + { + super.onEnable(); + + new DeathmatchEngine(this, HubConnection, _repository, new DeathmatchNotifier(this), new ArenaManager(this, "Deathmatch", new DeathmatchArenaParser()), getServer().getWorlds().get(0)); + } + + @Override + public IRelation GetRelation() + { + return null; + } + + @Override + public INameColorer GetNameColorer() + { + return null; + } + + @Override + protected String GetServerName() + { + return "DM"; + } + + @Override + protected IRepository GetRepository() + { + return _repository; + } +} diff --git a/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchArena.java b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchArena.java new file mode 100644 index 000000000..a5583c3a0 --- /dev/null +++ b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchArena.java @@ -0,0 +1,11 @@ +package nautilus.game.deathmatch; + +import nautilus.game.core.arena.Arena; + +public class DeathmatchArena extends Arena +{ + public DeathmatchArena(String fileName) + { + super(fileName); + } +} diff --git a/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchArenaParser.java b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchArenaParser.java new file mode 100644 index 000000000..93d4a0d95 --- /dev/null +++ b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchArenaParser.java @@ -0,0 +1,14 @@ +package nautilus.game.deathmatch; + +import java.io.FileReader; + +import nautilus.game.core.arena.IArenaParser; + +public class DeathmatchArenaParser implements IArenaParser +{ + @Override + public IDeathmatchArena Parse(String fileName, FileReader fileReader) + { + return null; + } +} diff --git a/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchEngine.java b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchEngine.java new file mode 100644 index 000000000..b23a328ce --- /dev/null +++ b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchEngine.java @@ -0,0 +1,44 @@ +package nautilus.game.deathmatch; + +import me.chiss.Core.Plugin.IPlugin; +import mineplex.core.server.ServerTalker; +import nautilus.game.core.engine.GameEngine; +import nautilus.game.deathmatch.repository.DeathmatchRepository; + +public class DeathmatchEngine extends GameEngine +{ + public DeathmatchEngine(IPlugin plugin, ServerTalker hubConnection, DeathmatchRepository repository, DeathmatchNotifier notifier, nautilus.game.core.arena.ArenaManager arenaManager, org.bukkit.World world) + { + super(plugin, hubConnection, repository, arenaManager, new DeathmatchScoreHandler(plugin.GetPlugin(), notifier), world); + } + + @Override + public void run() + { + } + + @Override + public DeathmatchGame ScheduleNewGame() + { + return null; + } + + @Override + public String GetGameType() + { + return "Deathmatch"; + } + + @Override + protected void TryToActivateGames() + { + // TODO Auto-generated method stub + } + + @Override + protected void ActivateGame(DeathmatchGame game, IDeathmatchArena arena) + { + // TODO Auto-generated method stub + + } +} diff --git a/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchGame.java b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchGame.java new file mode 100644 index 000000000..d73139d11 --- /dev/null +++ b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchGame.java @@ -0,0 +1,26 @@ +package nautilus.game.deathmatch; + +import me.chiss.Core.Plugin.IPlugin; +import nautilus.game.core.game.Game; + +import org.bukkit.entity.Player; + +public class DeathmatchGame extends Game implements IDeathmatchGame +{ + public DeathmatchGame(IPlugin plugin) + { + super(plugin); + } + + @Override + public void RespawnPlayer(DeathmatchPlayer player) + { + + } + + @Override + protected DeathmatchPlayer CreateGamePlayer(Player player, int playerLives) + { + return new DeathmatchPlayer(Plugin.GetPlugin(), player); + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchNotifier.java b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchNotifier.java new file mode 100644 index 000000000..f25c16bb3 --- /dev/null +++ b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchNotifier.java @@ -0,0 +1,12 @@ +package nautilus.game.deathmatch; + +import me.chiss.Core.Plugin.IPlugin; +import nautilus.game.core.notifier.PlayerNotifier; + +public class DeathmatchNotifier extends PlayerNotifier +{ + public DeathmatchNotifier(IPlugin plugin) + { + super(plugin, "Deathmatch"); + } +} diff --git a/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchPlayer.java b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchPlayer.java new file mode 100644 index 000000000..058745929 --- /dev/null +++ b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchPlayer.java @@ -0,0 +1,13 @@ +package nautilus.game.deathmatch; + +import org.bukkit.plugin.java.JavaPlugin; + +import nautilus.game.core.player.GamePlayer; + +public class DeathmatchPlayer extends GamePlayer +{ + public DeathmatchPlayer(JavaPlugin plugin, org.bukkit.entity.Player player) + { + super(plugin, player); + } +} diff --git a/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchScoreHandler.java b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchScoreHandler.java new file mode 100644 index 000000000..4d25defbb --- /dev/null +++ b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/DeathmatchScoreHandler.java @@ -0,0 +1,18 @@ +package nautilus.game.deathmatch; + +import org.bukkit.plugin.java.JavaPlugin; + +import nautilus.game.core.scoreboard.IScoreHandler; + +public class DeathmatchScoreHandler implements IScoreHandler +{ + public DeathmatchScoreHandler(JavaPlugin getPlugin, DeathmatchNotifier notifier) + { + // TODO Auto-generated constructor stub + } + + @Override + public void RewardForDeath(DeathmatchPlayer player) + { + } +} diff --git a/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/IDeathmatchArena.java b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/IDeathmatchArena.java new file mode 100644 index 000000000..9460a5d3d --- /dev/null +++ b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/IDeathmatchArena.java @@ -0,0 +1,8 @@ +package nautilus.game.deathmatch; + +import nautilus.game.core.arena.IArena; + +public interface IDeathmatchArena extends IArena +{ + +} diff --git a/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/IDeathmatchGame.java b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/IDeathmatchGame.java new file mode 100644 index 000000000..789e1c8ea --- /dev/null +++ b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/IDeathmatchGame.java @@ -0,0 +1,8 @@ +package nautilus.game.deathmatch; + +import nautilus.game.core.game.IGame; + +public interface IDeathmatchGame extends IGame +{ + +} diff --git a/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/repository/DeathmatchRepository.java b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/repository/DeathmatchRepository.java new file mode 100644 index 000000000..3cfe6b00d --- /dev/null +++ b/Plugins/Nautilus.Game.Deathmatch/src/nautilus/game/deathmatch/repository/DeathmatchRepository.java @@ -0,0 +1,11 @@ +package nautilus.game.deathmatch.repository; + +import mineplex.core.server.RemoteRepository; + +public class DeathmatchRepository extends RemoteRepository +{ + public DeathmatchRepository(String webServerAddress) + { + super(webServerAddress); + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Dominate/.classpath b/Plugins/Nautilus.Game.Dominate/.classpath new file mode 100644 index 000000000..462e8dcff --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/.classpath @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.Dominate/.externalToolBuilders/Dominate.launch b/Plugins/Nautilus.Game.Dominate/.externalToolBuilders/Dominate.launch new file mode 100644 index 000000000..5f925ad9f --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/.externalToolBuilders/Dominate.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.Dominate/.project b/Plugins/Nautilus.Game.Dominate/.project new file mode 100644 index 000000000..05fba8407 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/.project @@ -0,0 +1,27 @@ + + + Nautilus.Game.Dominate + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + auto,full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/Dominate.launch + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Nautilus.Game.Dominate/.settings/org.eclipse.jdt.core.prefs b/Plugins/Nautilus.Game.Dominate/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..8000cd6ca --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/Plugins/Nautilus.Game.Dominate/Dominate.xml b/Plugins/Nautilus.Game.Dominate/Dominate.xml new file mode 100644 index 000000000..c5ef2d53e --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/Dominate.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/Dominate.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/Dominate.class new file mode 100644 index 000000000..36259aec6 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/Dominate.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/DominateArena.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/DominateArena.class new file mode 100644 index 000000000..1891e98fd Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/DominateArena.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/DominateArenaParser.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/DominateArenaParser.class new file mode 100644 index 000000000..4a1555489 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/DominateArenaParser.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/IDominateArena.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/IDominateArena.class new file mode 100644 index 000000000..7cd9f7971 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/IDominateArena.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/IDominateArenaParser.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/IDominateArenaParser.class new file mode 100644 index 000000000..de6d695df Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/IDominateArenaParser.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/property/ControlPointAreas.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/property/ControlPointAreas.class new file mode 100644 index 000000000..8c00fc388 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/property/ControlPointAreas.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/property/PointPowerUps.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/property/PointPowerUps.class new file mode 100644 index 000000000..670ce62c4 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/property/PointPowerUps.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/property/ResupplyPowerUps.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/property/ResupplyPowerUps.class new file mode 100644 index 000000000..16154d082 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/arena/property/ResupplyPowerUps.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/ControlPoint.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/ControlPoint.class new file mode 100644 index 000000000..e31780348 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/ControlPoint.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/DominateGame.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/DominateGame.class new file mode 100644 index 000000000..a3ac7b519 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/DominateGame.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/DominateGameEngine.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/DominateGameEngine.class new file mode 100644 index 000000000..9dc5cd2aa Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/DominateGameEngine.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/DominateNotifier.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/DominateNotifier.class new file mode 100644 index 000000000..e9426dac3 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/DominateNotifier.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/DominateTeam.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/DominateTeam.class new file mode 100644 index 000000000..8d37a7bf7 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/DominateTeam.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/IControlPoint.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/IControlPoint.class new file mode 100644 index 000000000..7477bd133 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/IControlPoint.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/IDominateGame.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/IDominateGame.class new file mode 100644 index 000000000..bc93d6798 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/IDominateGame.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/IDominateGameEngine.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/IDominateGameEngine.class new file mode 100644 index 000000000..04d7cc2d4 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/IDominateGameEngine.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/IDominateTeam.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/IDominateTeam.class new file mode 100644 index 000000000..41c211942 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/IDominateTeam.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/IPowerUp.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/IPowerUp.class new file mode 100644 index 000000000..d4137b290 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/IPowerUp.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/PointPowerUp.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/PointPowerUp.class new file mode 100644 index 000000000..8f58e435d Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/PointPowerUp.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/PowerUp.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/PowerUp.class new file mode 100644 index 000000000..ff9fdb9aa Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/PowerUp.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/ResupplyPowerUp.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/ResupplyPowerUp.class new file mode 100644 index 000000000..1e13da671 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/engine/ResupplyPowerUp.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/events/ControlPointCapturedEvent.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/events/ControlPointCapturedEvent.class new file mode 100644 index 000000000..92aba7860 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/events/ControlPointCapturedEvent.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/events/ControlPointEnemyCapturingEvent.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/events/ControlPointEnemyCapturingEvent.class new file mode 100644 index 000000000..f125c4ca2 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/events/ControlPointEnemyCapturingEvent.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/events/ControlPointEvent.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/events/ControlPointEvent.class new file mode 100644 index 000000000..60a16a2f0 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/events/ControlPointEvent.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/events/ControlPointLostEvent.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/events/ControlPointLostEvent.class new file mode 100644 index 000000000..17ff51abc Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/events/ControlPointLostEvent.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/player/DominatePlayer.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/player/DominatePlayer.class new file mode 100644 index 000000000..bf603f6bf Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/player/DominatePlayer.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/player/IDominatePlayer.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/player/IDominatePlayer.class new file mode 100644 index 000000000..0f49761dd Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/player/IDominatePlayer.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/repository/DominateRepository$1$1.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/repository/DominateRepository$1$1.class new file mode 100644 index 000000000..5101dc069 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/repository/DominateRepository$1$1.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/repository/DominateRepository$1.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/repository/DominateRepository$1.class new file mode 100644 index 000000000..91860a6e6 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/repository/DominateRepository$1.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/repository/DominateRepository.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/repository/DominateRepository.class new file mode 100644 index 000000000..abde145d7 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/repository/DominateRepository.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/scoreboard/DominateScoreHandler.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/scoreboard/DominateScoreHandler.class new file mode 100644 index 000000000..a5b002fee Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/scoreboard/DominateScoreHandler.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/scoreboard/DominateTabScoreboard.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/scoreboard/DominateTabScoreboard.class new file mode 100644 index 000000000..836c0fdb1 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/scoreboard/DominateTabScoreboard.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/scoreboard/IDominateScoreHandler.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/scoreboard/IDominateScoreHandler.class new file mode 100644 index 000000000..f4409f3ad Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/scoreboard/IDominateScoreHandler.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominateGameStats.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominateGameStats.class new file mode 100644 index 000000000..9151d145a Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominateGameStats.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominateGameStatsToken.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominateGameStatsToken.class new file mode 100644 index 000000000..040b03f5d Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominateGameStatsToken.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominatePlayerStats.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominatePlayerStats.class new file mode 100644 index 000000000..5254e9bbe Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominatePlayerStats.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominatePlayerStatsToken.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominatePlayerStatsToken.class new file mode 100644 index 000000000..8ea318aa4 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominatePlayerStatsToken.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominateStatsReporter$1.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominateStatsReporter$1.class new file mode 100644 index 000000000..8121fa889 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominateStatsReporter$1.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominateStatsReporter.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominateStatsReporter.class new file mode 100644 index 000000000..8ec6e38d5 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominateStatsReporter.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominateTeamStats.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominateTeamStats.class new file mode 100644 index 000000000..190a67cb9 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/DominateTeamStats.class differ diff --git a/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/IDominateStatsReporter.class b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/IDominateStatsReporter.class new file mode 100644 index 000000000..1a089b125 Binary files /dev/null and b/Plugins/Nautilus.Game.Dominate/bin/nautilus/game/dominate/stats/IDominateStatsReporter.class differ diff --git a/Plugins/Nautilus.Game.Dominate/plugin.yml b/Plugins/Nautilus.Game.Dominate/plugin.yml new file mode 100644 index 000000000..049974044 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/plugin.yml @@ -0,0 +1,3 @@ +name: Dominate +main: nautilus.game.dominate.Dominate +version: 0.1 diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/Dominate.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/Dominate.java new file mode 100644 index 000000000..75b38eff3 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/Dominate.java @@ -0,0 +1,51 @@ +package nautilus.game.dominate; + +import org.bukkit.entity.Player; + +import me.chiss.Core.Chat.Chat; +import nautilus.game.core.GamePlugin; +import nautilus.game.core.arena.ArenaManager; +import nautilus.game.dominate.arena.DominateArenaParser; +import nautilus.game.dominate.arena.IDominateArena; +import nautilus.game.dominate.engine.DominateGameEngine; +import nautilus.game.dominate.engine.DominateNotifier; + +public class Dominate extends GamePlugin +{ + private DominateGameEngine _gameEngine; + + @Override + public void onEnable() + { + super.onEnable(); + + _gameEngine = new DominateGameEngine(this, HubConnection, ClientManager, DonationManager, ClassManager, ConditionManager, Energy, NpcManager, + new DominateNotifier(this), new ArenaManager(this, "Dominate", new DominateArenaParser()), getServer().getWorlds().get(0), GetSpawnLocation(), GetWebServerAddress()); + + new Chat(this, ClientManager, _gameEngine); + } + + @Override + public String GetServerName() + { + return "DOM"; + } + + @Override + public boolean CanHurt(Player a, Player b) + { + return _gameEngine.CanHurt(a, b); + } + + @Override + public boolean CanHurt(String a, String b) + { + return _gameEngine.CanHurt(a, b); + } + + @Override + public boolean IsSafe(Player a) + { + return _gameEngine.IsSafe(a); + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/DominateArena.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/DominateArena.java new file mode 100644 index 000000000..6204615f8 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/DominateArena.java @@ -0,0 +1,77 @@ +package nautilus.game.dominate.arena; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.util.Vector; + +import nautilus.game.core.arena.Region; +import nautilus.game.core.arena.TeamArena; + +public class DominateArena extends TeamArena implements IDominateArena +{ + private List _controlPointAreas; + private List _pointPowerUpPoints; + private List _resupplyPowerUpPoints; + + public DominateArena(String name) + { + super(name); + + _controlPointAreas = new ArrayList(); + _pointPowerUpPoints = new ArrayList(); + _resupplyPowerUpPoints = new ArrayList(); + } + + @Override + public void Deactivate() + { + super.Deactivate(); + + _controlPointAreas.clear(); + _controlPointAreas = null; + + _pointPowerUpPoints.clear(); + _pointPowerUpPoints = null; + + _resupplyPowerUpPoints.clear(); + _resupplyPowerUpPoints = null; + } + + @Override + public void AddControlPointArea(Region region) + { + Regions.add(region); + _controlPointAreas.add(region); + } + + @Override + public List GetControlPointAreas() + { + return _controlPointAreas; + } + + @Override + public void AddResupplyPowerUp(Vector parseVector) + { + _resupplyPowerUpPoints.add(parseVector); + } + + @Override + public List GetResupplyPowerUpPoints() + { + return _resupplyPowerUpPoints; + } + + @Override + public void AddPointPowerUp(Vector parseVector) + { + _pointPowerUpPoints.add(parseVector); + } + + @Override + public List GetPointPowerUpPoints() + { + return _pointPowerUpPoints; + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/DominateArenaParser.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/DominateArenaParser.java new file mode 100644 index 000000000..06815ede0 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/DominateArenaParser.java @@ -0,0 +1,102 @@ +package nautilus.game.dominate.arena; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.util.HashMap; + +import nautilus.game.core.arena.property.BlueShopPoints; +import nautilus.game.core.arena.property.BlueSpawnPoints; +import nautilus.game.core.arena.property.BlueSpawnRoom; +import nautilus.game.core.arena.property.BorderProperty; +import nautilus.game.core.arena.property.Center; +import nautilus.game.core.arena.property.IProperty; +import nautilus.game.core.arena.property.MapName; +import nautilus.game.core.arena.property.Offset; +import nautilus.game.core.arena.property.RedShopPoints; +import nautilus.game.core.arena.property.RedSpawnPoints; +import nautilus.game.core.arena.property.RedSpawnRoom; +import nautilus.game.dominate.arena.property.ControlPointAreas; +import nautilus.game.dominate.arena.property.PointPowerUps; +import nautilus.game.dominate.arena.property.ResupplyPowerUps; + +public class DominateArenaParser implements IDominateArenaParser +{ + private HashMap> _properties; + + public DominateArenaParser() + { + _properties = new HashMap>(); + + AddProperty(new MapName()); + AddProperty(new BorderProperty()); + AddProperty(new Center()); + AddProperty(new Offset()); + AddProperty(new RedSpawnPoints()); + AddProperty(new RedSpawnRoom()); + AddProperty(new RedShopPoints()); + AddProperty(new BlueSpawnPoints()); + AddProperty(new BlueSpawnRoom()); + AddProperty(new BlueShopPoints()); + + AddProperty(new ControlPointAreas()); + AddProperty(new PointPowerUps()); + AddProperty(new ResupplyPowerUps()); + } + + @Override + public IDominateArena Parse(String worldPath, FileReader fileReader) + { + try + { + IDominateArena arena = new DominateArena(worldPath.substring(worldPath.lastIndexOf(File.separator) + 1, worldPath.length())); + + BufferedReader input = new BufferedReader(fileReader); + String line = input.readLine(); + + while(line != null) + { + if(line.startsWith("#")) + { + line = input.readLine(); + continue; + } + + String[] parts = line.split(":"); + + if(parts.length < 2) + { + line = input.readLine(); + continue; + } + + String key = parts[0]; + String value = parts[1].trim(); + + if (_properties.containsKey(key.toLowerCase())) + { + _properties.get(key.toLowerCase()).Parse(arena, value); + } + else + { + System.out.println("Invalid property found: " + key); + } + + line = input.readLine(); + } + + return arena; + } + catch(Exception ex) + { + System.out.println("An exception was thrown:" + ex.getMessage()); + } + + return null; + } + + private void AddProperty(IProperty property) + { + _properties.put(property.GetName(), property); + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/IDominateArena.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/IDominateArena.java new file mode 100644 index 000000000..a9c769b61 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/IDominateArena.java @@ -0,0 +1,23 @@ +package nautilus.game.dominate.arena; + +import java.util.List; + +import org.bukkit.util.Vector; + +import nautilus.game.core.arena.ITeamArena; +import nautilus.game.core.arena.Region; + +public interface IDominateArena extends ITeamArena +{ + void AddControlPointArea(Region parseRegion); + + List GetControlPointAreas(); + + void AddResupplyPowerUp(Vector parseVector); + + void AddPointPowerUp(Vector parseVector); + + List GetResupplyPowerUpPoints(); + + List GetPointPowerUpPoints(); +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/IDominateArenaParser.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/IDominateArenaParser.java new file mode 100644 index 000000000..cc9f8802e --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/IDominateArenaParser.java @@ -0,0 +1,8 @@ +package nautilus.game.dominate.arena; + +import nautilus.game.core.arena.IArenaParser; + +public interface IDominateArenaParser extends IArenaParser +{ + +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/property/ControlPointAreas.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/property/ControlPointAreas.java new file mode 100644 index 000000000..8e0c2d135 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/property/ControlPointAreas.java @@ -0,0 +1,33 @@ +package nautilus.game.dominate.arena.property; + +import org.bukkit.Location; + +import nautilus.game.core.arena.Region; +import nautilus.game.core.arena.property.RegionPropertyBase; +import nautilus.game.dominate.arena.IDominateArena; + +public class ControlPointAreas extends RegionPropertyBase +{ + public ControlPointAreas() + { + super("controlpointareas"); + } + + @Override + public boolean Parse(IDominateArena arena, String value) + { + for (String region : value.split("&")) + { + arena.AddControlPointArea(ParseRegion(region)); + } + + return true; + } + + public boolean Parse(IDominateArena arena, String name, Location start, Location stop) + { + arena.AddControlPointArea(new Region(name, start.toVector(), stop.toVector())); + + return true; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/property/PointPowerUps.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/property/PointPowerUps.java new file mode 100644 index 000000000..53775f2d6 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/property/PointPowerUps.java @@ -0,0 +1,31 @@ +package nautilus.game.dominate.arena.property; + +import org.bukkit.entity.Player; + +import nautilus.game.core.arena.property.PropertyBase; +import nautilus.game.dominate.arena.IDominateArena; + +public class PointPowerUps extends PropertyBase +{ + public PointPowerUps() + { + super("pointpowerups"); + } + + public boolean Parse(IDominateArena arena, String value) + { + for (String vector : value.split(",")) + { + arena.AddPointPowerUp(ParseVector(vector.trim())); + } + + return true; + } + + public boolean Parse(IDominateArena arena, Player player) + { + arena.AddPointPowerUp(ParseVector(player)); + + return true; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/property/ResupplyPowerUps.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/property/ResupplyPowerUps.java new file mode 100644 index 000000000..72f05708b --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/arena/property/ResupplyPowerUps.java @@ -0,0 +1,31 @@ +package nautilus.game.dominate.arena.property; + +import org.bukkit.entity.Player; + +import nautilus.game.core.arena.property.PropertyBase; +import nautilus.game.dominate.arena.IDominateArena; + +public class ResupplyPowerUps extends PropertyBase +{ + public ResupplyPowerUps() + { + super("resupplypowerups"); + } + + public boolean Parse(IDominateArena arena, String value) + { + for (String vector : value.split(",")) + { + arena.AddResupplyPowerUp(ParseVector(vector.trim())); + } + + return true; + } + + public boolean Parse(IDominateArena arena, Player player) + { + arena.AddResupplyPowerUp(ParseVector(player)); + + return true; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/ControlPoint.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/ControlPoint.java new file mode 100644 index 000000000..f970b52d8 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/ControlPoint.java @@ -0,0 +1,748 @@ +package nautilus.game.dominate.engine; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +import mineplex.core.common.util.MapUtil; +import nautilus.game.core.arena.Region; +import nautilus.game.core.engine.TeamType; +import nautilus.game.core.events.GamePlayerDeathEvent; +import nautilus.game.core.events.GamePlayerJoinedEvent; +import nautilus.game.core.events.GamePlayerQuitEvent; +import nautilus.game.dominate.events.ControlPointCapturedEvent; +import nautilus.game.dominate.events.ControlPointEnemyCapturingEvent; +import nautilus.game.dominate.events.ControlPointLostEvent; +import nautilus.game.dominate.player.IDominatePlayer; + +import org.bukkit.ChatColor; +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class ControlPoint implements IControlPoint, Listener +{ + private JavaPlugin _plugin; + private IDominateGame _game; + private DominateNotifier _notifier; + private World _world; + private Region _captureRegion; + private IDominateTeam _capturingTeam = null; + private int _captureValue; + private int _captureThreshold; + private int _incrementValue; + private List _capturers; + private Boolean _captured; + private IDominateTeam _ownerTeam = null; + private int _pointValue; + private boolean _captureVisualChange; + private List _ownedLandVisualRegionBlocks; + private List _neutralLandVisualRegionBlocks; + private Random _random; + private Location _middlePoint; + private List _topCornerPoints; + + private boolean _captureTeamChanged; + private boolean _alternateColor; + boolean Locked; + String Message; + + private int _defaultPointValue = 3; + + public ControlPoint(JavaPlugin plugin, IDominateGame game, DominateNotifier notifier, World world, Region captureSquare, String message) + { + _plugin = plugin; + _game = game; + _notifier = notifier; + _world = world; + _captureRegion = captureSquare; + _capturers = new ArrayList(); + Message = ChatColor.GREEN + message + ChatColor.GRAY; + _captured = false; + _incrementValue = 0; + _captureValue = 0; + _captureThreshold = 20; + _pointValue = _defaultPointValue; + _neutralLandVisualRegionBlocks = new ArrayList(); + _ownedLandVisualRegionBlocks = new ArrayList(); + _random = new Random(); + _topCornerPoints = new ArrayList(); + + SetupVisuals(); + + _plugin.getServer().getPluginManager().registerEvents(this, _plugin); + } + + protected void SetupVisuals() + { + Vector minPoint = _captureRegion.GetMinimumPoint(); + Vector maxPoint = _captureRegion.GetMaximumPoint(); + + Vector middleVector = minPoint.getMidpoint(maxPoint.clone().setY(minPoint.getBlockY())); + _middlePoint = new Location(_world, middleVector.getBlockX(), middleVector.getBlockY(), middleVector.getBlockZ()); + + _topCornerPoints.add(new Location(_world, minPoint.getBlockX(), maxPoint.getBlockY(), minPoint.getBlockZ())); + _topCornerPoints.add(new Location(_world, maxPoint.getBlockX(), maxPoint.getBlockY(), minPoint.getBlockZ())); + _topCornerPoints.add(new Location(_world, minPoint.getBlockX(), maxPoint.getBlockY(), maxPoint.getBlockZ())); + _topCornerPoints.add(new Location(_world, maxPoint.getBlockX(), maxPoint.getBlockY(), maxPoint.getBlockZ())); + + for (Location cornerPoint : _topCornerPoints) + { + MapUtil.QuickChangeBlockAt(_world, cornerPoint.getBlockX(), cornerPoint.getBlockY(), cornerPoint.getBlockZ(), Material.WOOL, 0); + } + + int minX = minPoint.getBlockX() + 1; + int minY = minPoint.getBlockY(); + int minZ = minPoint.getBlockZ() + 1; + + int maxX = maxPoint.getBlockX() - 1; + int maxZ = maxPoint.getBlockZ() - 1; + + for (int x=minX; x <= maxX; x++) + { + if (Math.abs(x - middleVector.getBlockX()) >= 3) + continue; + + for (int z=minZ; z <= maxZ; z++) + { + if (Math.abs(z - middleVector.getBlockZ()) >= 3) + continue; + + if (_middlePoint.getBlockX() == x && _middlePoint.getBlockZ() == z) + { + MapUtil.QuickChangeBlockAt(_world, x, minY, z, Material.BEACON, 0); + continue; + } + + _neutralLandVisualRegionBlocks.add(new Vector(x, minY, z)); + MapUtil.QuickChangeBlockAt(_world, x, minY, z, Material.WOOL, 0); + } + } + + for (int x=_middlePoint.getBlockX()-1; x <= _middlePoint.getBlockX()+1; x++) + { + for (int z=_middlePoint.getBlockZ()-1; z <= _middlePoint.getBlockZ()+1; z++) + { + MapUtil.QuickChangeBlockAt(_world, x, minY - 1, z, Material.IRON_BLOCK, 0); + } + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onPlayerMove(PlayerMoveEvent event) + { + if (event.isCancelled()) + return; + + Player player = event.getPlayer(); + + if (_game.IsPlayerInGame(player)) + { + IDominatePlayer gamePlayer = _game.GetPlayer(player); + + if (_game.HasStarted() && !gamePlayer.IsSpectating()) + { + if (!IsLocationInControlPoint(event.getFrom()) && IsLocationInControlPoint(event.getTo())) + { + if (_capturers.contains(gamePlayer)) + { + System.out.println("Move tried to add existing player " + player.getName()); + } + else + { + AddCapturer(gamePlayer); + } + } + else if (IsLocationInControlPoint(event.getFrom()) && !IsLocationInControlPoint(event.getTo())) + { + RemoveCapturer(gamePlayer); + } + } + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onPlayerTeleport(PlayerTeleportEvent event) + { + if (event.isCancelled()) + return; + + Player player = event.getPlayer(); + + if (_game.IsPlayerInGame(player)) + { + IDominatePlayer gamePlayer = _game.GetPlayer(player); + + if (_game.HasStarted() && !gamePlayer.IsSpectating()) + { + if (!IsLocationInControlPoint(event.getFrom()) && IsLocationInControlPoint(event.getTo())) + { + if (_capturers.contains(gamePlayer)) + { + System.out.println("Teleport tried to add existing player " + player.getName()); + } + else + { + AddCapturer(gamePlayer); + } + } + else if (IsLocationInControlPoint(event.getFrom()) && !IsLocationInControlPoint(event.getTo())) + { + RemoveCapturer(gamePlayer); + } + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onGamePlayerDeath(GamePlayerDeathEvent event) + { + if (event.GetGame() == _game) + { + if (_game.HasStarted()) + { + if (IsLocationInControlPoint(event.GetPlayer().getLocation())) + { + RemoveCapturer(event.GetPlayer()); + } + } + } + } + + @EventHandler + public void onPlayerJoin(GamePlayerJoinedEvent event) + { + if (event.GetGame() == _game) + { + if (_game.HasStarted() && !event.GetPlayer().IsDead() && !event.GetPlayer().IsSpectating()) + { + if (IsLocationInControlPoint(event.GetPlayer().getLocation())) + { + if (_capturers.contains(event.GetPlayer())) + { + System.out.println("Join tried to add existing player " + event.GetPlayer().getName()); + } + else + { + AddCapturer(event.GetPlayer()); + } + } + } + } + } + + @EventHandler + public void onPlayerLeave(GamePlayerQuitEvent event) + { + if (event.GetGame() == _game) + { + if (_game.HasStarted()) + { + if (IsLocationInControlPoint(event.GetPlayer().getLocation())) + { + RemoveCapturer(event.GetPlayer()); + } + } + } + } + + protected boolean IsLocationInControlPoint(Location location) + { + return _captureRegion.Contains(location.toVector()); + } + + public boolean IsPlayerInControlPoint(IDominatePlayer player) + { + return IsLocationInControlPoint(player.getLocation()); + } + + public void AddCapturer(IDominatePlayer player) + { + _capturers.add(player); + + if (_ownerTeam == null) + { + if (_capturingTeam == null) + { + _capturingTeam = player.GetTeam(); + _captureValue = 0; + _captureTeamChanged = true; + } + + if (_capturingTeam == player.GetTeam()) + { + _incrementValue++; + _notifier.BroadcastMessageToPlayer("You are taking control of " + Message + "!", player.GetPlayer()); + } + else + { + Locked = true; + } + } + else if (_ownerTeam != player.GetTeam()) + { + _capturingTeam = player.GetTeam(); + _incrementValue++; + + if (_pointValue == _defaultPointValue) + { + _notifier.BroadcastMessageToPlayer("You are taking control of " + Message + "!", player.GetPlayer()); + _plugin.getServer().getPluginManager().callEvent(new ControlPointEnemyCapturingEvent(_game, this, _ownerTeam, player.GetTeam())); + } + else + { + Locked = true; + } + } + else + { + if (_pointValue <= 5) + { + _pointValue++; + _notifier.BroadcastMessageToPlayer("You are defending " + Message + ", " + ChatColor.YELLOW + "+1" + ChatColor.GRAY +" to capture score!", player.GetPlayer()); + } + + if (_capturingTeam != null) + { + Locked = true; + } + } + } + + public void UpdateLogic() + { + if (!Locked) + { + if (_ownerTeam == null) + { + if (_capturingTeam != null) + { + if (_captureValue <= _captureThreshold && _incrementValue > 0) + { + _captureValue += _incrementValue; + } + + if (_captureValue >= _captureThreshold) + { + _captured = true; + _captureValue = _captureThreshold; + _ownerTeam = _capturingTeam; + _ownerTeam.AddControlPoint(this); + _captureVisualChange = true; + + _capturingTeam = null; + _incrementValue = 0; + + _plugin.getServer().getPluginManager().callEvent(new ControlPointCapturedEvent(_game, this, _ownerTeam, _capturers)); + + for (IDominatePlayer player : _capturers) + { + if (_pointValue <= 5) + { + _pointValue++; + _notifier.BroadcastMessageToPlayer("You are defending " + Message + ", " + ChatColor.YELLOW + "+1" + ChatColor.GRAY + " to capture score!", player.GetPlayer()); + } + } + } + + UpdateVisual(); + } + } + else if (_capturingTeam != null) + { + if (_captureValue > 0) + { + _captureValue -= _incrementValue; + } + + if (_captureValue <= 0) + { + ControlPointLost(); + } + + UpdateVisual(); + } + } + } + + public void RemoveCapturer(IDominatePlayer player) + { + _capturers.remove(player); + + if (_capturers.size() == 0) + { + _capturingTeam = null; + _captureTeamChanged = true; + _incrementValue = 0; + _pointValue = _defaultPointValue; + + if (_ownerTeam == null) + { + _captureValue = 0; + } + + if (player.GetTeam() == _ownerTeam) + { + _notifier.BroadcastMessageToPlayer("You are no longer defending " + Message + "!", player.GetPlayer()); + } + + UpdateVisual(); + } + else + { + if (!Locked) + { + if (player.GetTeam() == _ownerTeam) + { + _notifier.BroadcastMessageToPlayer("You are no longer defending " + Message + "!", player.GetPlayer()); + + _pointValue = _defaultPointValue + _capturers.size(); + + if (_pointValue > 5) + { + _pointValue = 5; + } + } + else if (player.GetTeam() == _capturingTeam) + { + _incrementValue = _capturers.size(); + } + } + else + { + int capturingTeam = 0; + int teamB = 0; + + for (IDominatePlayer gamePlayer : _capturers) + { + if (gamePlayer.GetTeam() == _capturingTeam) + { + capturingTeam++; + } + else + { + teamB++; + } + } + + if (capturingTeam == 0 || teamB == 0) + { + Locked = false; + } + + _incrementValue = capturingTeam; + + if (capturingTeam == 0) + { + _capturingTeam = null; + } + + if (_ownerTeam != null) + { + _pointValue = _defaultPointValue + teamB; + + if (_pointValue > 5) + { + _pointValue = 5; + } + } + else + { + if (capturingTeam == 0) + { + _capturingTeam = _capturers.get(0).GetTeam(); + _captureTeamChanged = true; + _incrementValue = _capturers.size(); + _captureValue = 0; + + _notifier.BroadcastMessageToPlayers("You are taking control of " + Message + "!", _capturers); + } + } + } + } + } + + private void ControlPointLost() + { + if (_ownerTeam != null) + { + _plugin.getServer().getPluginManager().callEvent(new ControlPointLostEvent(_game, this, _ownerTeam, _capturers)); + _ownerTeam.RemoveControlPoint(this); + } + + _captureValue = 0; + _captured = false; + _ownerTeam = null; + _captureVisualChange = true; + } + + public void UpdateVisual() + { + try + { + _alternateColor = !_alternateColor; + + byte data = 0; + + if (_ownerTeam != null) + { + if (_ownerTeam.GetTeamType() == TeamType.RED) + { + data = 14; + } + else if (_ownerTeam.GetTeamType() == TeamType.BLUE) + { + data = 11; + } + } + else if (_capturingTeam != null) + { + if (_capturingTeam.GetTeamType() == TeamType.RED) + { + data = 14; + } + else if (_capturingTeam.GetTeamType() == TeamType.BLUE) + { + data = 11; + } + } + + if (_captureVisualChange) + { + byte topPointColor = data; + + if (_ownerTeam == null) + { + topPointColor = 0; + } + + for (Location cornerPoint : _topCornerPoints) + { + MapUtil.QuickChangeBlockAt(_world, cornerPoint.getBlockX(), cornerPoint.getBlockY(), cornerPoint.getBlockZ(), Material.WOOL, topPointColor); + } + + _captureVisualChange = false; + } + + if (_captureTeamChanged) + { + for (Vector blockVector : _neutralLandVisualRegionBlocks) + { + if (_middlePoint.getBlockX() == blockVector.getBlockX() && _middlePoint.getBlockZ() == blockVector.getBlockZ()) + continue; + + MapUtil.QuickChangeBlockAt(_world, blockVector.getBlockX(), blockVector.getBlockY(), blockVector.getBlockZ(), Material.WOOL, 0); + } + + for (Vector blockVector : _ownedLandVisualRegionBlocks) + { + if (_middlePoint.getBlockX() == blockVector.getBlockX() && _middlePoint.getBlockZ() == blockVector.getBlockZ()) + continue; + + MapUtil.QuickChangeBlockAt(_world, blockVector.getBlockX(), blockVector.getBlockY(), blockVector.getBlockZ(), Material.WOOL, data); + } + + _captureTeamChanged = false; + } + + float capturePercentage = (float)_captureValue / (float)_captureThreshold; + + byte captureProgressColorData = data; + int neutralLandBlockCount = _neutralLandVisualRegionBlocks.size(); + int ownedLandBlockCount = _ownedLandVisualRegionBlocks.size(); + + int captureBlocksToColorCount = (int)(capturePercentage * (neutralLandBlockCount + ownedLandBlockCount)); + + if (captureBlocksToColorCount > ownedLandBlockCount) + { + captureBlocksToColorCount -= ownedLandBlockCount; + + for (int i=0; i < captureBlocksToColorCount; i++) + { + Vector blockVector = _neutralLandVisualRegionBlocks.get(_random.nextInt(_neutralLandVisualRegionBlocks.size())); + _ownedLandVisualRegionBlocks.add(blockVector); + _neutralLandVisualRegionBlocks.remove(blockVector); + + if (_middlePoint.getBlockX() == blockVector.getBlockX() && _middlePoint.getBlockZ() == blockVector.getBlockZ()) + continue; + + MapUtil.QuickChangeBlockAt(_world, blockVector.getBlockX(), blockVector.getBlockY(), blockVector.getBlockZ(), Material.WOOL, captureProgressColorData); + } + + for (Location cornerPoint : _topCornerPoints) + { + _world.playEffect(cornerPoint, Effect.STEP_SOUND, captureProgressColorData == 14 ? 55 : 8); + } + } + else if (captureBlocksToColorCount < _ownedLandVisualRegionBlocks.size()) + { + captureBlocksToColorCount = _ownedLandVisualRegionBlocks.size() - captureBlocksToColorCount; + captureProgressColorData = 0; + + for (int i=0; i < captureBlocksToColorCount; i++) + { + Vector blockVector = _ownedLandVisualRegionBlocks.get(_random.nextInt(_ownedLandVisualRegionBlocks.size())); + _neutralLandVisualRegionBlocks.add(blockVector); + _ownedLandVisualRegionBlocks.remove(blockVector); + + if (_middlePoint.getBlockX() == blockVector.getBlockX() && _middlePoint.getBlockZ() == blockVector.getBlockZ()) + continue; + + MapUtil.QuickChangeBlockAt(_world, blockVector.getBlockX(), blockVector.getBlockY(), blockVector.getBlockZ(), Material.WOOL, captureProgressColorData); + } + + for (Location cornerPoint : _topCornerPoints) + { + _world.playEffect(cornerPoint, Effect.STEP_SOUND, 35); + } + } + } + catch(Exception ex) + { + System.out.println("Exception in ControlPoint.UpdateVisual(): " + ex.getMessage()); + System.out.println("Increment value = " + _incrementValue); + System.out.println("Capturing team = " + (_capturingTeam != null ? _capturingTeam.GetTeamType() : "None")); + System.out.println("Owner team = " + (_ownerTeam != null ? _ownerTeam.GetTeamType() : "None")); + System.out.println("Capturers size = " + _capturers.size()); + System.out.println("capturePercentage = " + ((float)_captureValue / (float)_captureThreshold)); + System.out.println("neutralLandBlockCount = " + _neutralLandVisualRegionBlocks.size()); + System.out.println("ownedLandBlockCount = " + _ownedLandVisualRegionBlocks.size()); + System.out.println("captureBlocksToColorCount = " + ((int)(((float)_captureValue / (float)_captureThreshold) * (_neutralLandVisualRegionBlocks.size() + _ownedLandVisualRegionBlocks.size())))); + } + + } + + @EventHandler(priority = EventPriority.LOWEST) + public void OnPlayerChat(AsyncPlayerChatEvent event) + { + Player player = event.getPlayer(); + + if (player.isOp() && event.getMessage().startsWith("!test cpinfo")) + { + player.sendMessage("Control Point Name: " + Message); + player.sendMessage("Increment value = " + _incrementValue); + player.sendMessage("Capturing team = " + (_capturingTeam != null ? _capturingTeam.GetTeamType() : "None")); + player.sendMessage("Owner team = " + (_ownerTeam != null ? _ownerTeam.GetTeamType() : "None")); + player.sendMessage("Capturers size = " + _capturers.size()); + player.sendMessage("capturePercentage = " + ((float)_captureValue / (float)_captureThreshold)); + player.sendMessage("neutralLandBlockCount = " + _neutralLandVisualRegionBlocks.size()); + player.sendMessage("ownedLandBlockCount = " + _ownedLandVisualRegionBlocks.size()); + player.sendMessage("captureBlocksToColorCount = " + ((int)(((float)_captureValue / (float)_captureThreshold) * (_neutralLandVisualRegionBlocks.size() + _ownedLandVisualRegionBlocks.size())))); + + player.sendMessage("Capturer list:"); + for (IDominatePlayer capturer : _capturers) + { + player.sendMessage(capturer.getName()); + } + } + } + + /* + private void UpdateVisualBlocks(Vector middle, IDominateTeam team, int blocks, int max) + { + Block block = _world.getBlockAt(middle.getBlockX(), middle.getBlockY(), middle.getBlockZ()); + byte data = 0; + + if (team == null) + { + data = 0; + } + else if (team.GetTeamType() == TeamType.RED) + { + data = 14; + } + else if (team.GetTeamType() == TeamType.BLUE) + { + data = 11; + } + + UpdateWoolBlock(block, data); + + for (int i = 1; i < max; i++) + { + if (i < max) + { + UpdateWoolBlock(_world.getBlockAt(middle.getBlockX() + i, middle.getBlockY(), middle.getBlockZ()), data); + UpdateWoolBlock(_world.getBlockAt(middle.getBlockX(), middle.getBlockY(), middle.getBlockZ() + i), data); + UpdateWoolBlock(_world.getBlockAt(middle.getBlockX() - i, middle.getBlockY(), middle.getBlockZ()), data); + UpdateWoolBlock(_world.getBlockAt(middle.getBlockX(), middle.getBlockY(), middle.getBlockZ() - i), data); + } + else + { + _world.getBlockAt(middle.getBlockX() + i, middle.getBlockY(), middle.getBlockZ()).setData((byte)0); + _world.getBlockAt(middle.getBlockX(), middle.getBlockY(), middle.getBlockZ() + i).setData((byte)0); + _world.getBlockAt(middle.getBlockX() - i, middle.getBlockY(), middle.getBlockZ()).setData((byte)0); + _world.getBlockAt(middle.getBlockX(), middle.getBlockY(), middle.getBlockZ() - i).setData((byte)0); + } + } + } + */ + + @Override + public String GetName() + { + return Message; + } + + @Override + public boolean Captured() + { + return _captured; + } + + @Override + public IDominateTeam GetOwnerTeam() + { + return _ownerTeam; + } + + @Override + public void Deactivate() + { + _plugin = null; + _game = null; + _notifier = null; + _world = null; + _captureRegion = null; + _capturingTeam = null; + _capturers = null; + _captured = null; + _ownerTeam = null; + _ownedLandVisualRegionBlocks = null; + _neutralLandVisualRegionBlocks = null; + _random = null; + _middlePoint = null; + _topCornerPoints = null; + + HandlerList.unregisterAll(this); + } + + @Override + public int GetPoints() + { + return _pointValue; + } + + @Override + public Location GetMiddlePoint() + { + return _middlePoint; + } + + @Override + public List GetCapturers() + { + return _capturers; + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/DominateGame.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/DominateGame.java new file mode 100644 index 000000000..76a245c1a --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/DominateGame.java @@ -0,0 +1,192 @@ +package nautilus.game.dominate.engine; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.energy.*; +import mineplex.core.packethandler.PacketHandler; +import mineplex.minecraft.game.core.condition.*; +import mineplex.minecraft.game.classcombat.Class.*; +import nautilus.game.core.arena.Region; +import nautilus.game.core.engine.TeamType; +import nautilus.game.core.events.team.TeamGameFinishedEvent; +import nautilus.game.core.game.TeamGame; +import nautilus.game.dominate.arena.IDominateArena; +import nautilus.game.dominate.player.DominatePlayer; +import nautilus.game.dominate.player.IDominatePlayer; +import nautilus.game.dominate.scoreboard.DominateTabScoreboard; + +public class DominateGame extends TeamGame implements IDominateGame +{ + private DominateNotifier _notifier; + private DominateTabScoreboard _scoreboard; + private List _controlPoints; + private List _powerUps; + + private int _lastUpdate; + + public DominateGame(JavaPlugin plugin, CoreClientManager clientManager, ClassManager classManager, ConditionManager conditionmanager, Energy energy, DominateNotifier notifier, PacketHandler packetHandler) + { + super(plugin, classManager, conditionmanager, energy); + + _notifier = notifier; + ScoreLimit = 15000; + _controlPoints = new ArrayList(); + _powerUps = new ArrayList(); + _scoreboard = new DominateTabScoreboard(plugin, clientManager, classManager, packetHandler, this); + } + + @Override + public IDominatePlayer AddSpectatorToGame(Player player, Location to) + { + IDominatePlayer spectator = super.AddSpectatorToGame(player, to); + + _scoreboard.AddSpectator(spectator); + + return spectator; + } + + @Override + public void ClearPlayerSettings(IDominatePlayer player) + { + super.ClearPlayerSettings(player); + + if (_scoreboard != null) + _scoreboard.ClearScoreboardForSpectator(player); + } + + @Override + public void RemoveSpectator(IDominatePlayer player) + { + super.RemoveSpectator(player); + + _scoreboard.ClearScoreboardForSpectator(player); + } + + @Override + public void Activate(IDominateArena arena) + { + super.Activate(arena); + + for (Region controlPointRegion : arena.GetControlPointAreas()) + { + IControlPoint controlPoint = new ControlPoint(Plugin, this, _notifier, Arena.GetWorld(), controlPointRegion, controlPointRegion.GetName()); + _controlPoints.add(controlPoint); + } + + for (Vector pointPowerUpPoint : arena.GetPointPowerUpPoints()) + { + IPowerUp pointPowerUp = new PointPowerUp(Plugin, this, _notifier, pointPowerUpPoint.toLocation(Arena.GetWorld()), (long)180000, 100); + _powerUps.add(pointPowerUp); + } + + for (Vector resupplyPowerUpPoint : arena.GetResupplyPowerUpPoints()) + { + IPowerUp resupplyPowerUp = new ResupplyPowerUp(Plugin, this, ClassManager, _notifier, resupplyPowerUpPoint.toLocation(Arena.GetWorld()), (long)60000); + _powerUps.add(resupplyPowerUp); + } + + _scoreboard.Update(); + } + + public void Update() + { + for (IControlPoint controlPoint : _controlPoints) + { + controlPoint.UpdateLogic(); + + if (controlPoint.Captured()) + { + controlPoint.GetOwnerTeam().AddPoints(controlPoint.GetPoints()); + + for (IDominatePlayer defender : controlPoint.GetCapturers()) + { + if (defender.GetTeam() == controlPoint.GetOwnerTeam()) + { + defender.AddPoints(1); + } + } + + Arena.GetWorld().playSound(controlPoint.GetMiddlePoint(), Sound.CHICKEN_EGG_POP, 0.1F, 0.9F); + } + } + + for (IPowerUp powerUp : _powerUps) + { + powerUp.Update(); + } + + if (RedTeam.GetScore() >= ScoreLimit) + { + RedTeam.SetScore(ScoreLimit); + StopGame(); + Plugin.getServer().getPluginManager().callEvent(new TeamGameFinishedEvent(this, RedTeam)); + _scoreboard.Update(); + } + else if (BlueTeam.GetScore() >= ScoreLimit) + { + BlueTeam.SetScore(ScoreLimit); + StopGame(); + Plugin.getServer().getPluginManager().callEvent(new TeamGameFinishedEvent(this, BlueTeam)); + _scoreboard.Update(); + } + + if (_lastUpdate % 10 == 0) + { + _scoreboard.Update(); + } + + _lastUpdate++; + } + + @Override + public void Deactivate() + { + _scoreboard.Stop(); + + for (IControlPoint controlPoint : _controlPoints) + { + controlPoint.Deactivate(); + } + + for (IPowerUp powerUp : _powerUps) + { + powerUp.Deactivate(); + } + + _controlPoints.clear(); + _powerUps.clear(); + + _scoreboard = null; + + _controlPoints = null; + _powerUps = null; + + super.Deactivate(); + } + + @Override + protected IDominateTeam CreateTeam(TeamType teamType) + { + return new DominateTeam(teamType); + } + + @Override + protected IDominatePlayer CreateGamePlayer(Player player, int playerLives) + { + return new DominatePlayer(Plugin, player); + } + + @Override + public List GetControlPoints() + { + return _controlPoints; + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/DominateGameEngine.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/DominateGameEngine.java new file mode 100644 index 000000000..7bb422c81 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/DominateGameEngine.java @@ -0,0 +1,63 @@ +package nautilus.game.dominate.engine; + +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.account.CoreClientManager; +import mineplex.minecraft.game.core.condition.*; +import mineplex.core.donation.DonationManager; +import mineplex.core.energy.Energy; +import mineplex.core.npc.*; +import mineplex.core.server.ServerTalker; +import mineplex.minecraft.game.classcombat.Class.ClassManager; +import mineplex.minecraft.game.classcombat.Class.ClientClass; +import nautilus.game.core.arena.ArenaManager; +import nautilus.game.core.engine.TeamGameEngine; +import nautilus.game.dominate.arena.IDominateArena; +import nautilus.game.dominate.player.IDominatePlayer; +import nautilus.game.dominate.scoreboard.DominateScoreHandler; +import nautilus.game.dominate.scoreboard.IDominateScoreHandler; +import nautilus.game.dominate.stats.DominateStatsReporter; + +public class DominateGameEngine extends TeamGameEngine implements IDominateGameEngine +{ + private DominateNotifier _notifier; + + public DominateGameEngine(JavaPlugin plugin, ServerTalker hubConnection, CoreClientManager clientManager, DonationManager donationManager, ClassManager classManager, + ConditionManager conditionManager, Energy energy, NpcManager npcManager, DominateNotifier notifier, ArenaManager arenaManager, World world, Location spawnLocation, String webServerAddress) + { + super(plugin, hubConnection, clientManager, donationManager, classManager, conditionManager, energy, npcManager, arenaManager, new DominateScoreHandler(plugin, notifier), world, spawnLocation); + + _notifier = notifier; + new DominateStatsReporter(plugin, donationManager, webServerAddress); + + TeamSize = 5; + AddToActiveGame = true; + } + + @Override + public void ActivateGame(IDominateGame game, IDominateArena arena) + { + super.ActivateGame(game, arena); + + for (IDominatePlayer dominatePlayer : game.GetPlayers()) + { + ClientClass clientClass = ClassManager.Get(dominatePlayer.GetPlayer()); + + clientClass.ResetToDefaults(true, true); + } + } + + @Override + public IDominateGame ScheduleNewGame() + { + return Scheduler.ScheduleNewGame(new DominateGame(Plugin, ClientManager, ClassManager, ConditionManager, Energy, _notifier, PacketHandler)); + } + + @Override + public String GetGameType() + { + return "Dominate"; + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/DominateNotifier.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/DominateNotifier.java new file mode 100644 index 000000000..dc7bf1d52 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/DominateNotifier.java @@ -0,0 +1,59 @@ +package nautilus.game.dominate.engine; + +import nautilus.game.core.notifier.TeamPlayerNotifier; +import nautilus.game.dominate.arena.IDominateArena; +import nautilus.game.dominate.events.ControlPointCapturedEvent; +import nautilus.game.dominate.events.ControlPointEnemyCapturingEvent; +import nautilus.game.dominate.events.ControlPointLostEvent; +import nautilus.game.dominate.player.IDominatePlayer; + +import org.bukkit.Sound; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + +public class DominateNotifier extends TeamPlayerNotifier +{ + public DominateNotifier(JavaPlugin plugin) + { + super(plugin, "Dominate"); + } + + @EventHandler + public void OnControlPointCaptured(ControlPointCapturedEvent event) + { + IDominateTeam ownerTeam = event.GetNewTeamOwner(); + + BroadcastMessageToPlayers("You now have control of " + event.GetControlPoint().GetName() + "!", ownerTeam.GetPlayers()); + + for (IDominatePlayer player : ownerTeam.GetPlayers()) + { + player.playSound(player.getLocation(), Sound.ZOMBIE_METAL, .4F, 0F); + } + + BroadcastMessageToOtherGamePlayers(event.GetGame(), GetTeamString(event.GetNewTeamOwner()) + " has captured " + event.GetControlPoint().GetName() + "!", ownerTeam.GetPlayers()); + } + + @EventHandler + public void OnControlPointLost(ControlPointLostEvent event) + { + BroadcastMessageToPlayers("You have lost control of " + event.GetControlPoint().GetName() + "!", event.GetPreviousTeamOwner().GetPlayers()); + + for (IDominatePlayer player : event.GetPreviousTeamOwner().GetPlayers()) + { + player.playSound(player.getLocation(), Sound.BLAZE_DEATH, .4F, 0F); + } + + BroadcastMessageToOtherGamePlayers(event.GetGame(), GetTeamString(event.GetPreviousTeamOwner()) + " has lost " + event.GetControlPoint().GetName() + "!", event.GetPreviousTeamOwner().GetPlayers()); + } + + @EventHandler + public void OnControlPointEnemyCapturing(ControlPointEnemyCapturingEvent event) + { + BroadcastMessageToPlayers(GetTeamString(event.GetEnemyTeam()) + " is capturing " + event.GetControlPoint().GetName() + "!", event.GetTeamOwner().GetPlayers()); + + for (IDominatePlayer player : event.GetTeamOwner().GetPlayers()) + { + player.playSound(player.getLocation(), Sound.GHAST_SCREAM2, .4F, 0.6F); + } + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/DominateTeam.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/DominateTeam.java new file mode 100644 index 000000000..421b44b73 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/DominateTeam.java @@ -0,0 +1,45 @@ +package nautilus.game.dominate.engine; + +import java.util.ArrayList; +import java.util.List; + +import nautilus.game.core.engine.TeamType; +import nautilus.game.core.game.Team; +import nautilus.game.dominate.player.IDominatePlayer; + +public class DominateTeam extends Team implements IDominateTeam +{ + private List _controlPoints; + + public DominateTeam(TeamType teamType) + { + super(teamType); + + _controlPoints = new ArrayList(); + } + + @Override + public void AddPlayer(IDominatePlayer player) + { + player.SetTeam(this); + Players.add(player); + } + + @Override + public void AddControlPoint(IControlPoint point) + { + _controlPoints.add(point); + } + + @Override + public void RemoveControlPoint(IControlPoint point) + { + _controlPoints.remove(point); + } + + @Override + public List GetControlPoints() + { + return _controlPoints; + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/IControlPoint.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/IControlPoint.java new file mode 100644 index 000000000..c4e4765fb --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/IControlPoint.java @@ -0,0 +1,27 @@ +package nautilus.game.dominate.engine; + +import java.util.List; + +import nautilus.game.dominate.player.IDominatePlayer; + +import org.bukkit.Location; + +public interface IControlPoint +{ + String GetName(); + + void UpdateLogic(); + + boolean Captured(); + IDominateTeam GetOwnerTeam(); + + void Deactivate(); + + void UpdateVisual(); + + int GetPoints(); + + Location GetMiddlePoint(); + + List GetCapturers(); +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/IDominateGame.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/IDominateGame.java new file mode 100644 index 000000000..2beb263fa --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/IDominateGame.java @@ -0,0 +1,12 @@ +package nautilus.game.dominate.engine; + +import java.util.List; + +import nautilus.game.core.game.ITeamGame; +import nautilus.game.dominate.arena.IDominateArena; +import nautilus.game.dominate.player.IDominatePlayer; + +public interface IDominateGame extends ITeamGame +{ + List GetControlPoints(); +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/IDominateGameEngine.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/IDominateGameEngine.java new file mode 100644 index 000000000..523620425 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/IDominateGameEngine.java @@ -0,0 +1,10 @@ +package nautilus.game.dominate.engine; + +import nautilus.game.core.engine.ITeamGameEngine; +import nautilus.game.dominate.arena.IDominateArena; +import nautilus.game.dominate.player.IDominatePlayer; + +public interface IDominateGameEngine extends ITeamGameEngine +{ + +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/IDominateTeam.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/IDominateTeam.java new file mode 100644 index 000000000..3f469c140 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/IDominateTeam.java @@ -0,0 +1,13 @@ +package nautilus.game.dominate.engine; + +import java.util.List; + +import nautilus.game.core.engine.ITeam; +import nautilus.game.dominate.player.IDominatePlayer; + +public interface IDominateTeam extends ITeam +{ + void RemoveControlPoint(IControlPoint point); + void AddControlPoint(IControlPoint point); + List GetControlPoints(); +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/IPowerUp.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/IPowerUp.java new file mode 100644 index 000000000..980edb36c --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/IPowerUp.java @@ -0,0 +1,8 @@ +package nautilus.game.dominate.engine; + +public interface IPowerUp +{ + void Update(); + + void Deactivate(); +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/PointPowerUp.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/PointPowerUp.java new file mode 100644 index 000000000..280584b5f --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/PointPowerUp.java @@ -0,0 +1,42 @@ +package nautilus.game.dominate.engine; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class PointPowerUp extends PowerUp +{ + private int _pointReward; + + public PointPowerUp(JavaPlugin plugin, IDominateGame game, DominateNotifier notifier, Location location, long interval, int pointReward) + { + super(plugin, game, notifier, location, interval); + + _pointReward = pointReward; + BlockType = Material.EMERALD_BLOCK; + } + + @Override + protected Item SpawnItem(Location location) + { + Item item = location.getWorld().dropItem(location, new ItemStack(Material.EMERALD, 1)); + item.setVelocity(new Vector(0,0,0)); + item.teleport(location); + return item; + } + + @Override + protected void RewardPlayer(Player player) + { + Game.GetPlayer(player).GetTeam().AddPoints((int)(_pointReward * 2.5)); + Game.GetPlayer(player).AddPoints(_pointReward); + Notifier.BroadcastMessageToPlayer("You added +" + ChatColor.YELLOW + _pointReward + ChatColor.GRAY + " to your score and +"+ ChatColor.YELLOW + (int)(_pointReward * 2.5) + ChatColor.GRAY + " to your team score!", player); + player.playSound(player.getLocation(), Sound.ORB_PICKUP, .4F, 0.9F); + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/PowerUp.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/PowerUp.java new file mode 100644 index 000000000..4663f2ccb --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/PowerUp.java @@ -0,0 +1,93 @@ +package nautilus.game.dominate.engine; + +import mineplex.core.common.util.MapUtil; +import net.minecraft.server.v1_6_R2.EntityItem; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public abstract class PowerUp implements Listener, IPowerUp +{ + private Location _location; + private Location _blockLocation; + private long _lastTimePickedUp = -1; + private long _interval; + + protected JavaPlugin Plugin; + protected DominateNotifier Notifier; + protected IDominateGame Game; + protected Item Item; + protected Material BlockType; + + public PowerUp(JavaPlugin plugin, IDominateGame game, DominateNotifier notifier, Location location, long interval) + { + Plugin = plugin; + Game = game; + Notifier = notifier; + + _location = location; + _blockLocation = _location.getBlock().getRelative(BlockFace.DOWN).getLocation(); + BlockType = Material.GOLD_BLOCK; + _interval = interval; + + Plugin.getServer().getPluginManager().registerEvents(this, Plugin); + } + + @EventHandler + public void OnPlayerPickUp(PlayerPickupItemEvent event) + { + if (event.getItem().equals(Item)) + { + if (Game.IsPlayerInGame(event.getPlayer()) && !((CraftPlayer)event.getPlayer()).getHandle().spectating) + { + RewardPlayer(event.getPlayer()); + _lastTimePickedUp = System.currentTimeMillis(); + Item.remove(); + + MapUtil.QuickChangeBlockAt(_blockLocation.getWorld(), _blockLocation.getBlockX(), _blockLocation.getBlockY(), _blockLocation.getBlockZ(), Material.IRON_BLOCK, 0); + } + + event.setCancelled(true); + } + } + + public void Update() + { + if (_lastTimePickedUp == -1 || System.currentTimeMillis() >= (_lastTimePickedUp + _interval)) + { + Item = SpawnItem(_location); + MapUtil.QuickChangeBlockAt(_blockLocation.getWorld(), _blockLocation.getBlockX(), _blockLocation.getBlockY(), _blockLocation.getBlockZ(), BlockType, 0); + _lastTimePickedUp = System.currentTimeMillis() + (15 * 60 * 1000); + } + + ((EntityItem)((CraftEntity)Item).getHandle()).age = 0; + } + + public void Deactivate() + { + _location = null; + _blockLocation = null; + + Plugin = null; + Notifier = null; + Game = null; + Item = null; + BlockType = null; + + HandlerList.unregisterAll(this); + } + + protected abstract Item SpawnItem(Location location); + + protected abstract void RewardPlayer(Player player); +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/ResupplyPowerUp.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/ResupplyPowerUp.java new file mode 100644 index 000000000..19ef710e1 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/ResupplyPowerUp.java @@ -0,0 +1,54 @@ +package nautilus.game.dominate.engine; + +import java.util.Map.Entry; + +import mineplex.minecraft.game.classcombat.Class.ClassManager; +import mineplex.minecraft.game.classcombat.Class.ClientClass; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class ResupplyPowerUp extends PowerUp +{ + private ClassManager _classManager; + + public ResupplyPowerUp(JavaPlugin plugin, IDominateGame game, ClassManager classManager, DominateNotifier notifier, Location location, long interval) + { + super(plugin, game, notifier, location, interval); + _classManager = classManager; + + BlockType = Material.GOLD_BLOCK; + } + + @Override + protected Item SpawnItem(Location location) + { + Item item = location.getWorld().dropItem(location, new ItemStack(Material.CHEST, 1)); + item.setVelocity(new Vector(0,0,0)); + item.teleport(location); + return item; + } + + @Override + protected void RewardPlayer(Player player) + { + ClientClass client = _classManager.Get(player); + + player.getInventory().clear(); + + for (Entry item : client.GetDefaultItems().entrySet()) + { + if (item.getValue() != null) + player.getInventory().setItem(item.getKey(), item.getValue().clone()); + } + + Notifier.BroadcastMessageToPlayer("You received supplies!", player); + player.playSound(player.getLocation(), Sound.MAGMACUBE_WALK, .4F, 0.9F); + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/events/ControlPointCapturedEvent.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/events/ControlPointCapturedEvent.java new file mode 100644 index 000000000..c52c1e6b8 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/events/ControlPointCapturedEvent.java @@ -0,0 +1,32 @@ +package nautilus.game.dominate.events; + +import java.util.List; + +import nautilus.game.dominate.engine.IControlPoint; +import nautilus.game.dominate.engine.IDominateGame; +import nautilus.game.dominate.engine.IDominateTeam; +import nautilus.game.dominate.player.IDominatePlayer; + +public class ControlPointCapturedEvent extends ControlPointEvent +{ + private IDominateTeam _newTeamOwner; + private List _playersInvolved; + + public ControlPointCapturedEvent(IDominateGame game, IControlPoint controlPoint, IDominateTeam newTeamOwner, List playersInvolved) + { + super(game, controlPoint); + + _newTeamOwner = newTeamOwner; + _playersInvolved = playersInvolved; + } + + public IDominateTeam GetNewTeamOwner() + { + return _newTeamOwner; + } + + public List GetPlayersInvolved() + { + return _playersInvolved; + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/events/ControlPointEnemyCapturingEvent.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/events/ControlPointEnemyCapturingEvent.java new file mode 100644 index 000000000..8938983d0 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/events/ControlPointEnemyCapturingEvent.java @@ -0,0 +1,29 @@ +package nautilus.game.dominate.events; + +import nautilus.game.dominate.engine.IControlPoint; +import nautilus.game.dominate.engine.IDominateGame; +import nautilus.game.dominate.engine.IDominateTeam; + +public class ControlPointEnemyCapturingEvent extends ControlPointEvent +{ + private IDominateTeam _teamOwner; + private IDominateTeam _enemyTeam; + + public ControlPointEnemyCapturingEvent(IDominateGame game, IControlPoint controlPoint, IDominateTeam teamOwner, IDominateTeam enemyTeam) + { + super(game, controlPoint); + + _teamOwner = teamOwner; + _enemyTeam = enemyTeam; + } + + public IDominateTeam GetTeamOwner() + { + return _teamOwner; + } + + public IDominateTeam GetEnemyTeam() + { + return _enemyTeam; + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/events/ControlPointEvent.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/events/ControlPointEvent.java new file mode 100644 index 000000000..452a4a110 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/events/ControlPointEvent.java @@ -0,0 +1,21 @@ +package nautilus.game.dominate.events; + +import nautilus.game.core.events.GameEvent; +import nautilus.game.dominate.engine.IControlPoint; +import nautilus.game.dominate.engine.IDominateGame; + +public class ControlPointEvent extends GameEvent +{ + private IControlPoint _controlPoint; + + public ControlPointEvent(IDominateGame game, IControlPoint controlPoint) + { + super(game); + _controlPoint = controlPoint; + } + + public IControlPoint GetControlPoint() + { + return _controlPoint; + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/events/ControlPointLostEvent.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/events/ControlPointLostEvent.java new file mode 100644 index 000000000..96a50d0ab --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/events/ControlPointLostEvent.java @@ -0,0 +1,32 @@ +package nautilus.game.dominate.events; + +import java.util.List; + +import nautilus.game.dominate.engine.IControlPoint; +import nautilus.game.dominate.engine.IDominateGame; +import nautilus.game.dominate.engine.IDominateTeam; +import nautilus.game.dominate.player.IDominatePlayer; + +public class ControlPointLostEvent extends ControlPointEvent +{ + private IDominateTeam _previousOwner; + private List _playersInvolved; + + public ControlPointLostEvent(IDominateGame game, IControlPoint controlPoint, IDominateTeam previousOwner, List playersInvolved) + { + super(game, controlPoint); + + _previousOwner = previousOwner; + _playersInvolved = playersInvolved; + } + + public IDominateTeam GetPreviousTeamOwner() + { + return _previousOwner; + } + + public List GetPlayersInvolved() + { + return _playersInvolved; + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/player/DominatePlayer.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/player/DominatePlayer.java new file mode 100644 index 000000000..2b665a755 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/player/DominatePlayer.java @@ -0,0 +1,17 @@ +package nautilus.game.dominate.player; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import nautilus.game.core.player.TeamGamePlayer; +import nautilus.game.dominate.engine.IDominateTeam; + +public class DominatePlayer extends TeamGamePlayer implements IDominatePlayer +{ + public DominatePlayer(JavaPlugin plugin, Player player) + { + super(plugin, player); + + SetLives(1); + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/player/IDominatePlayer.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/player/IDominatePlayer.java new file mode 100644 index 000000000..9ff97c441 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/player/IDominatePlayer.java @@ -0,0 +1,6 @@ +package nautilus.game.dominate.player; + +import nautilus.game.core.player.ITeamGamePlayer; +import nautilus.game.dominate.engine.IDominateTeam; + +public interface IDominatePlayer extends ITeamGamePlayer { } diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/repository/DominateRepository.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/repository/DominateRepository.java new file mode 100644 index 000000000..bc7ace428 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/repository/DominateRepository.java @@ -0,0 +1,34 @@ +package nautilus.game.dominate.repository; + +import java.util.List; + +import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; + +import mineplex.core.common.util.Callback; +import mineplex.core.donation.repository.token.PlayerUpdateToken; +import mineplex.core.server.remotecall.JsonWebCall; +import nautilus.game.dominate.stats.DominateGameStatsToken; + +public class DominateRepository +{ + private String _webServerAdddress; + + public DominateRepository(String webServerAddress) + { + _webServerAdddress = webServerAddress; + } + + public void SaveGameStats(final Callback> callback, final DominateGameStatsToken dominationGameStats) + { + Thread asyncThread = new Thread(new Runnable() + { + public void run() + { + List tokenList = new JsonWebCall(_webServerAdddress + "Dominate/UploadStats").Execute(new TypeToken>(){}.getType(), dominationGameStats); + callback.run(tokenList); + } + }); + + asyncThread.start(); + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/scoreboard/DominateScoreHandler.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/scoreboard/DominateScoreHandler.java new file mode 100644 index 000000000..eadaf629d --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/scoreboard/DominateScoreHandler.java @@ -0,0 +1,70 @@ +package nautilus.game.dominate.scoreboard; + +import org.bukkit.ChatColor; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + +import nautilus.game.core.scoreboard.TeamGameScoreHandler; +import nautilus.game.dominate.arena.IDominateArena; +import nautilus.game.dominate.engine.DominateNotifier; +import nautilus.game.dominate.engine.IDominateGame; +import nautilus.game.dominate.engine.IDominateTeam; +import nautilus.game.dominate.events.ControlPointCapturedEvent; +import nautilus.game.dominate.events.ControlPointLostEvent; +import nautilus.game.dominate.player.IDominatePlayer; + +public class DominateScoreHandler extends TeamGameScoreHandler implements IDominateScoreHandler +{ + public DominateScoreHandler(JavaPlugin plugin, DominateNotifier notifier) + { + super(plugin, notifier); + } + + public void RewardForDeath(IDominatePlayer player) + { + super.RewardForDeath(player); + player.GetTeam().AddPoints(-5); + } + + public void RewardForTeamKill(IDominatePlayer killer, IDominatePlayer victim) + { + super.RewardForTeamKill(killer, victim); + killer.GetTeam().AddPoints(-5); + } + + public void RewardForKill(IDominatePlayer killer, IDominatePlayer victim, int assists) + { + super.RewardForKill(killer, victim, assists); + killer.GetTeam().AddPoints(15 + GetKillModifierValue(killer, victim, assists)); + } + + @EventHandler + public void OnControlPointCaptured(ControlPointCapturedEvent event) + { + for (IDominatePlayer player : event.GetPlayersInvolved()) + { + player.AddPoints(25); + player.GetTeam().AddPoints(25); + } + + Notifier.BroadcastMessageToPlayers("You helped capture " + event.GetControlPoint().GetName() + " for an additional +" + ChatColor.YELLOW + 25 + ChatColor.GRAY + " to your score!", event.GetPlayersInvolved()); + } + + @EventHandler + public void OnControlPointLost(ControlPointLostEvent event) + { + for (IDominatePlayer player : event.GetPlayersInvolved()) + { + player.AddPoints(15); + player.GetTeam().AddPoints(15); + } + + Notifier.BroadcastMessageToPlayers("You helped steal " + event.GetControlPoint().GetName() + " for an additional +" + ChatColor.YELLOW + 15 + ChatColor.GRAY + " to your score!", event.GetPlayersInvolved()); + } + + @Override + protected int GetKillModifierValue(IDominatePlayer killer, IDominatePlayer victim, int assists) + { + return 5 * victim.GetTeam().GetControlPoints().size(); + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/scoreboard/DominateTabScoreboard.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/scoreboard/DominateTabScoreboard.java new file mode 100644 index 000000000..9f35afd2e --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/scoreboard/DominateTabScoreboard.java @@ -0,0 +1,71 @@ +package nautilus.game.dominate.scoreboard; + +import org.bukkit.ChatColor; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.packethandler.*; +import mineplex.minecraft.game.classcombat.Class.*; +import nautilus.game.core.scoreboard.TabScoreboard; +import nautilus.game.dominate.engine.IControlPoint; +import nautilus.game.dominate.engine.IDominateGame; +import nautilus.game.dominate.engine.IDominateTeam; +import nautilus.game.dominate.player.IDominatePlayer; + +public class DominateTabScoreboard extends TabScoreboard +{ + public DominateTabScoreboard(JavaPlugin plugin, CoreClientManager clientManager, ClassManager classManager, PacketHandler handler, IDominateGame game) + { + super(plugin, clientManager, classManager, handler, game); + } + + @Override + protected void SetRedTeamInfo() + { + super.SetRedTeamInfo(); + + RedColumn.get(2).SetLine(ChatColor.RED + "Control Points"); + + String spacer = ""; + for (int i=0; i < 5; i++) + { + int lineIndex = 3 + i; + spacer += " "; + + IControlPoint controlPoint = Game.GetControlPoints().get(i); + + if (controlPoint.Captured() && controlPoint.GetOwnerTeam() == Game.GetRedTeam()) + { + RedColumn.get(lineIndex).SetLine(ChatColor.stripColor(controlPoint.GetName()) + ChatColor.RED); + continue; + } + + RedColumn.get(lineIndex).SetLine(ChatColor.RED + "" + ChatColor.BLACK + " " + spacer); + } + } + + @Override + protected void SetBlueTeamInfo() + { + super.SetBlueTeamInfo(); + + BlueColumn.get(2).SetLine(ChatColor.BLUE + "Control Points"); + + String spacer = ""; + for (int i=0; i < 5; i++) + { + int lineIndex = 3 + i; + spacer += " "; + + IControlPoint controlPoint = Game.GetControlPoints().get(i); + + if (controlPoint.Captured() && controlPoint.GetOwnerTeam() == Game.GetBlueTeam()) + { + BlueColumn.get(lineIndex).SetLine(ChatColor.stripColor(controlPoint.GetName()) + ChatColor.BLUE); + continue; + } + + BlueColumn.get(lineIndex).SetLine(ChatColor.BLUE + "" + ChatColor.BLACK + " " + spacer); + } + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/scoreboard/IDominateScoreHandler.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/scoreboard/IDominateScoreHandler.java new file mode 100644 index 000000000..286258c45 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/scoreboard/IDominateScoreHandler.java @@ -0,0 +1,10 @@ +package nautilus.game.dominate.scoreboard; + +import nautilus.game.core.scoreboard.ITeamScoreHandler; +import nautilus.game.dominate.engine.IDominateTeam; +import nautilus.game.dominate.player.IDominatePlayer; + +public interface IDominateScoreHandler extends ITeamScoreHandler +{ + +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominateGameStats.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominateGameStats.java new file mode 100644 index 000000000..2bb751d06 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominateGameStats.java @@ -0,0 +1,17 @@ +package nautilus.game.dominate.stats; + +import java.util.HashMap; + +import nautilus.game.core.engine.TeamType; + +public class DominateGameStats +{ + public DominateGameStats() + { + PlayerStats = new HashMap(); + } + + public HashMap PlayerStats; + + public long Duration; +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominateGameStatsToken.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominateGameStatsToken.java new file mode 100644 index 000000000..312e08f63 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominateGameStatsToken.java @@ -0,0 +1,10 @@ +package nautilus.game.dominate.stats; + +import java.util.List; + +public class DominateGameStatsToken +{ + public long Duration; + + public List PlayerStats; +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominatePlayerStats.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominatePlayerStats.java new file mode 100644 index 000000000..ab9109c8d --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominatePlayerStats.java @@ -0,0 +1,9 @@ +package nautilus.game.dominate.stats; + +public class DominatePlayerStats +{ + public int Points; + public int Kills; + public int Deaths; + public int Assists; +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominatePlayerStatsToken.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominatePlayerStatsToken.java new file mode 100644 index 000000000..9b82fd97f --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominatePlayerStatsToken.java @@ -0,0 +1,8 @@ +package nautilus.game.dominate.stats; + +public class DominatePlayerStatsToken +{ + public String Name; + public boolean Won; + public DominatePlayerStats PlayerStats; +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominateStatsReporter.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominateStatsReporter.java new file mode 100644 index 000000000..63b249b44 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominateStatsReporter.java @@ -0,0 +1,123 @@ +package nautilus.game.dominate.stats; + +import java.util.ArrayList; +import java.util.List; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.donation.DonationManager; +import mineplex.core.donation.Donor; +import mineplex.core.donation.repository.token.PlayerUpdateToken; +import nautilus.game.core.engine.TeamType; +import nautilus.game.core.events.GamePlayerAfkEvent; +import nautilus.game.core.events.team.TeamGameFinishedEvent; +import nautilus.game.dominate.engine.IDominateGame; +import nautilus.game.dominate.engine.IDominateTeam; +import nautilus.game.dominate.player.IDominatePlayer; +import nautilus.game.dominate.repository.DominateRepository; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; + +public class DominateStatsReporter implements Listener +{ + private JavaPlugin _plugin; + private DonationManager _donationManager; + private DominateRepository _repository; + + public DominateStatsReporter(JavaPlugin plugin, DonationManager donationManager, String webServer) + { + _plugin = plugin; + _donationManager = donationManager; + _plugin.getServer().getPluginManager().registerEvents(this, _plugin); + _repository = new DominateRepository(webServer); + } + + @EventHandler + public void OnGamePlayerAFK(GamePlayerAfkEvent event) + { + /* + DominateGameStats gameStats = _dominateGameStatsMap.get(event.GetGame()); + IDominateGame game = event.GetGame(); + + for (IDominatePlayer player : game.GetPlayers()) + { + if (player != event.GetPlayer()) + continue; + + DominatePlayerStats playerStats = null; + + if (player.GetTeam().GetTeamType() == TeamType.RED) + { + playerStats = gameStats.TeamStats.get(TeamType.RED).PlayerStats.get(player.getName()); + } + else if (player.GetTeam().GetTeamType() == TeamType.BLUE) + { + playerStats = gameStats.TeamStats.get(TeamType.BLUE).PlayerStats.get(player.getName()); + } + + playerStats.AFK = true; + break; + } + */ + } + + @EventHandler + public void OnGameFinished(TeamGameFinishedEvent event) + { + DominateGameStatsToken gameStats = new DominateGameStatsToken(); + gameStats.Duration = event.GetGame().GetStartTime() - System.currentTimeMillis(); + gameStats.PlayerStats = new ArrayList(); + boolean redTeamWon = event.GetGame().GetRedTeam().GetScore() > event.GetGame().GetBlueTeam().GetScore(); + + for (IDominatePlayer player : event.GetGame().GetPlayers()) + { + DominatePlayerStatsToken playerStats = new DominatePlayerStatsToken(); + playerStats.Name = player.getName(); + playerStats.PlayerStats = new DominatePlayerStats(); + + playerStats.Won = (redTeamWon == (player.GetTeam().GetTeamType() == TeamType.RED)); + playerStats.PlayerStats.Kills = player.GetKills(); + playerStats.PlayerStats.Deaths = player.GetDeaths(); + playerStats.PlayerStats.Assists = player.GetAssists(); + playerStats.PlayerStats.Points = player.GetPoints(); + + gameStats.PlayerStats.add(playerStats); + } + + _repository.SaveGameStats(new Callback>() + { + public void run(List tokenList) + { + for (PlayerUpdateToken token : tokenList) + { + try + { + Player player = _plugin.getServer().getPlayerExact(token.Name); + Donor donor = _donationManager.Get(token.Name); + + if (player != null && player.isOnline()) + { + donor.AddGems(token.Gems); + + player.sendMessage(F.main("Dominate", "You earned " + ChatColor.YELLOW + token.Gems + C.cGray + " gems for playing!")); + } + } + catch (Exception ex) + { + System.out.println("Error updating player with token : " + token.Name + "\n" + ex.getMessage()); + + for (StackTraceElement trace : ex.getStackTrace()) + { + System.out.println(trace); + } + } + } + } + }, gameStats); + } +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominateTeamStats.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominateTeamStats.java new file mode 100644 index 000000000..7bab7d1d1 --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/DominateTeamStats.java @@ -0,0 +1,16 @@ +package nautilus.game.dominate.stats; + +import java.util.HashMap; + +public class DominateTeamStats +{ + public DominateTeamStats() + { + PlayerStats = new HashMap(); + } + + public String Name; + public int Points; + + public HashMap PlayerStats; +} diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/IDominateStatsReporter.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/IDominateStatsReporter.java new file mode 100644 index 000000000..d6793afee --- /dev/null +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/stats/IDominateStatsReporter.java @@ -0,0 +1,6 @@ +package nautilus.game.dominate.stats; + +public interface IDominateStatsReporter +{ + +} diff --git a/Plugins/Nautilus.Game.Lobby/.classpath b/Plugins/Nautilus.Game.Lobby/.classpath new file mode 100644 index 000000000..02e972ee1 --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.Lobby/.externalToolBuilders/Lobby.launch b/Plugins/Nautilus.Game.Lobby/.externalToolBuilders/Lobby.launch new file mode 100644 index 000000000..1e2eca927 --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/.externalToolBuilders/Lobby.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.Lobby/.project b/Plugins/Nautilus.Game.Lobby/.project new file mode 100644 index 000000000..625ffcdc9 --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/.project @@ -0,0 +1,27 @@ + + + Nautilus.Game.Lobby + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + auto,full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/Lobby.launch + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Nautilus.Game.Lobby/.settings/org.eclipse.jdt.core.prefs b/Plugins/Nautilus.Game.Lobby/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7341ab168 --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Nautilus.Game.Lobby/Lobby.xml b/Plugins/Nautilus.Game.Lobby/Lobby.xml new file mode 100644 index 000000000..d55310224 --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/Lobby.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.Lobby/plugin.yml b/Plugins/Nautilus.Game.Lobby/plugin.yml new file mode 100644 index 000000000..02acb7c6f --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/plugin.yml @@ -0,0 +1,3 @@ +name: Lobby +main: nautilus.game.lobby.Lobby +version: 0.1 diff --git a/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/Lobby.java b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/Lobby.java new file mode 100644 index 000000000..32660458d --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/Lobby.java @@ -0,0 +1,860 @@ +package nautilus.game.lobby; + +import java.util.HashSet; +import java.util.Map.Entry; + +import me.chiss.Core.MemoryFix.MemoryFix; +import nautilus.game.lobby.ServerMenu.ServerInfoManager; +import nautilus.game.lobby.gamequeue.QueueManager; +import nautilus.game.lobby.gamequeue.menu.QueueMenu; +import nautilus.minecraft.core.INautilusPlugin; + +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.block.BlockGrowEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.FoodLevelChangeEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerBucketFillEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.weather.WeatherChangeEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; + +import me.chiss.Core.Chat.Chat; +import me.chiss.Core.Clans.Clans; +import me.chiss.Core.Class.ClassFactory; +import mineplex.core.Fire; +import mineplex.core.Rank; +import mineplex.core.Recharge; +import me.chiss.Core.Combat.CombatManager; +import me.chiss.Core.Commands.CommandCenter; +import me.chiss.Core.Commands.CommandManager; +import me.chiss.Core.Condition.ConditionManager; +import me.chiss.Core.Config.Config; +import me.chiss.Core.Damage.DamageManager; +import me.chiss.Core.Field.Field; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.message.Message; +import mineplex.core.npc.NpcManager; +import mineplex.core.projectile.ProjectileManager; +import me.chiss.Core.Loot.LootFactory; +import me.chiss.Core.Module.ModuleManager; +import me.chiss.Core.Modules.*; +import me.chiss.Core.NAC.NAC; +import me.chiss.Core.Pet.PetFactory; +import me.chiss.Core.Pet.PetManager; +import me.chiss.Core.Pet.PetShop; +import me.chiss.Core.PlayerTagNamer.INameColorer; +import me.chiss.Core.PlayerTagNamer.PlayerNamer; +import me.chiss.Core.PlayerTagNamer.TabLobbyList; +import me.chiss.Core.Plugin.IChat; +import me.chiss.Core.Plugin.IPlugin; +import me.chiss.Core.Plugin.IRelation; +import me.chiss.Core.Portal.Portal; +import me.chiss.Core.Shop.CustomBuildShop; +import me.chiss.Core.Shop.DonatorShop; +import me.chiss.Core.Shop.salespackage.ShopItem; +import me.chiss.Core.Spawn.Spawn; +import me.chiss.Core.Teleport.Teleport; +import mineplex.core.server.RemoteRepository; +import mineplex.core.server.ServerListener; +import mineplex.core.server.event.PlayerServerAssignmentEvent; +import mineplex.core.server.event.PlayerVoteEvent; +import mineplex.core.updater.Updater; +import mineplex.core.antistack.AntiStack; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.util.C; +import mineplex.core.creature.Creature; +import mineplex.core.creature.event.CreatureSpawnCustomEvent; +import mineplex.core.energy.Energy; +import mineplex.core.explosion.Explosion; +import me.chiss.Core.Weapon.WeaponFactory; +import mineplex.minecraft.account.CoreClient; +import mineplex.minecraft.account.CoreClientManager; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.core.classcombat.item.ItemFactory; +import mineplex.minecraft.game.core.mechanics.Gameplay; +import mineplex.minecraft.game.core.mechanics.Weapon; +import mineplex.minecraft.punish.Punish; +import mineplex.minecraft.punish.PunishChatEvent; + +public class Lobby extends JavaPlugin implements INautilusPlugin, IPlugin, Listener, IChat, INameColorer +{ + private String WEB_CONFIG = "webServer"; + + private ModuleManager _moduleManager; + private Config _config; + private CoreClientManager _clientManager; + private Utility _utility; + private BlockRegenerate _blockRegenerate; + private BlockRestore _blockRestore; + private Blood _blood; + private Clans _clans; + private ClassFactory _classFactory; + private ConditionManager _condition; + private Creature _creature; + private DamageManager _damage; + private Energy _energy; + private Field _field; + private Explosion _explosion; + private Fire _fire; + private Ignore _ignore; + private Logger _logger; + private Observer _observer; + private PetManager _petManager; + private Recharge _recharge; + private me.chiss.Core.Server.Server _serverModule; + private SkillFactory _skillFactory; + private Spawn _spawn; + private Teleport _teleport; + private Weapon _weapon; + private Wiki _wiki; + + //Interfaces + private IRelation _relation; + + //Repo + private RemoteRepository _repository; + + private DonatorShop _donationShop; + private CustomBuildShop _customBuildShop; + + private Location _spawnLocation; + private ServerListener _serverListener; + + private Portal _portal; + + @Override + public void onEnable() + { + getConfig().addDefault(WEB_CONFIG, "http://bettermc.com/"); + getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); + saveConfig(); + + //Repo + _repository = new RemoteRepository(GetWebServerAddress()); + + CommandCenter.Initialize(this); + + CombatManager.Initialize(this); + + //Init Modules + GetModules(); + + new Punish(this, GetWebServerAddress()); + GetBlood(); + GetClasses(); + GetClients(); + GetCreature(); + GetCondition(); + GetDamage(); + GetField(); + GetEnergy(); + GetExplosion(); + GetFire(); + + new Give(this); + + new Message(this); + + new NAC(this, _repository); + + GetObserver(); + GetServer(); + GetSkills(); + //GetSpawn(); + GetTeleport(); + GetWeapon(); + //GetWiki(); + + //Unreferenced Modules + new AntiStack(this); + new Chat(this, this, _repository); + new CommandManager(this); + new Compass(this); + new Explosion(this); + new Firework(this); + new Gameplay(this); + new mineplex.minecraft.game.core.mechanics.Gameplay(this); + new NpcManager(this); + new PlayerInfo(this); + new Tester(this); + new MemoryFix(this); + + _petManager = new PetManager(this, _repository, GetCreature(), GetClients()); + + new PetShop(this, _repository, GetClients(), new PetFactory(_repository), GetPetManager()); + + new LootFactory(this); + + //Updates + getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); + + new TabLobbyList(this, new PlayerNamer(this, GetNameColorer()).PacketHandler, true); + + _portal = new Portal(this); + new ServerInfoManager(this, _portal); + + getServer().getPluginManager().registerEvents(this, this); + + ItemStackFactory.Initialize(this); + WeaponFactory.Initialize(this, GetWebServerAddress()); + ItemFactory.Initialize(this, _repository, new HashSet()); + new QueueMenu(new QueueManager(this, GetWebServerAddress())); + + _donationShop = new DonatorShop(this, _repository, GetClients(), GetClasses(), GetSkills(), WeaponFactory.Instance, ItemFactory.Instance); + _customBuildShop = new CustomBuildShop(this, _repository, GetClients(), GetClasses(), GetSkills(), WeaponFactory.Instance, ItemFactory.Instance); + + _spawnLocation = new Location(this.getServer().getWorlds().get(0), 40.5, 18, 44.5, 180f, 0f); + + _serverListener = new ServerListener(GetWebServerAddress(), getServer().getIp(), getServer().getPort() + 1); + _serverListener.start(); + } + + public void HandleChat(final AsyncPlayerChatEvent event, final String filteredMessage) + { + PunishChatEvent chatEvent = new PunishChatEvent(event.getPlayer()); + + getServer().getPluginManager().callEvent(chatEvent); + + if (chatEvent.isCancelled()) + return; + + final Player sender = event.getPlayer(); + String message = event.getMessage(); + + if (message.length() < 1) + return; + + StringBuilder playerNameBuilder = new StringBuilder(); + + if (GetClients().GetNull(sender.getName()) != null) + { + + CoreClient client = GetClients().GetNull(sender.getName()); + String prefixChar = "*"; + + if (client.NAC().IsUsing()) + { + playerNameBuilder.append(ChatColor.GREEN + prefixChar); + } + else + { + playerNameBuilder.append(ChatColor.DARK_GRAY + prefixChar); + } + + if (client.Rank().Has(Rank.OWNER, false)) + { + playerNameBuilder.append(ChatColor.DARK_RED); + } + else if (client.Rank().Has(Rank.MODERATOR, false)) + { + playerNameBuilder.append(ChatColor.RED); + } + else if (client.Rank().Has(Rank.DIAMOND, false)) + { + playerNameBuilder.append(ChatColor.AQUA); + } + else if (client.Rank().Has(Rank.EMERALD, false)) + { + playerNameBuilder.append(ChatColor.GREEN); + } + else if (client.Donor().HasDonated()) + { + playerNameBuilder.append(ChatColor.GOLD); + } + else + { + playerNameBuilder.append(ChatColor.YELLOW); + } + + event.setFormat(playerNameBuilder.toString() + "%1$s " + C.cWhite + "%2$s"); + + GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable() + { + public void run() + { + for (Player player : event.getRecipients()) + { + CoreClient client = GetClients().GetNull(sender.getName()); + + if (client != null) + { + player.sendMessage(String.format(event.getFormat(), event.getPlayer().getDisplayName(), client.Game().GetFilterChat() ? filteredMessage : event.getMessage())); + } + } + } + }); + } + } + + @EventHandler + public void PlayerAssignedToServer(PlayerServerAssignmentEvent event) + { + _portal.SendPlayerToServer(getServer().getPlayer(event.GetPlayerName()), event.GetServerName()); + } + + @EventHandler + public void OnEntityDamage(EntityDamageEvent event) + { + event.setCancelled(true); + + if (event.getCause() == DamageCause.VOID) + { + event.getEntity().teleport(GetSpawnLocation()); + + if (event.getEntity() instanceof Player) + GivePlayerLobbyItems((Player)event.getEntity()); + } + } + + @EventHandler + public void onBlockBreakEvent(BlockBreakEvent event) + { + if (!event.getPlayer().isOp()) + { + event.getPlayer().teleport(GetSpawnLocation()); + event.setCancelled(true); + } + } + + @EventHandler + public void onBlockPlaceEvent(BlockPlaceEvent event) + { + if (!event.getPlayer().isOp()) + event.setCancelled(true); + } + + @EventHandler + public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) + { + if (!event.getPlayer().isOp()) + event.setCancelled(true); + } + + @EventHandler + public void onPlayerBucketFill(PlayerBucketFillEvent event) + { + if (!event.getPlayer().isOp()) + event.setCancelled(true); + } + + @EventHandler + public void PreventDrop(PlayerDropItemEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void BurnCancel(BlockBurnEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void SpreadCancel(BlockFromToEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void GrowCancel(BlockGrowEvent event) + { + event.setCancelled(true); + } + + @EventHandler(priority=EventPriority.NORMAL) + public void OnWeatherChange(WeatherChangeEvent event) + { + if (event.toWeatherState()) + { + event.setCancelled(true); + } + } + + @EventHandler + public void DecayCancel(LeavesDecayEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void onPlayerFoodBarChange(FoodLevelChangeEvent event) + { + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOW) + public void onPlayerInteractEntity(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() instanceof LivingEntity && ((LivingEntity)event.getRightClicked()).isCustomNameVisible() && ((LivingEntity)event.getRightClicked()).getCustomName() != null) + { + if (ChatColor.stripColor(((LivingEntity)event.getRightClicked()).getCustomName()).equalsIgnoreCase("Right-Click to Join - Domination")) + { + _portal.SendPlayerToServer(event.getPlayer(), "dom"); + } + else if (ChatColor.stripColor(((LivingEntity)event.getRightClicked()).getCustomName()).equalsIgnoreCase("Right-Click to Join - Tutorial")) + { + _portal.SendPlayerToServer(event.getPlayer(), "tut"); + } + else if (ChatColor.stripColor(((LivingEntity)event.getRightClicked()).getCustomName()).equalsIgnoreCase("Right-Click to Join - Survival Pvp")) + { + _portal.SendPlayerToServer(event.getPlayer(), "pvp"); + } + else if (ChatColor.stripColor(((LivingEntity)event.getRightClicked()).getCustomName()).equalsIgnoreCase("Right-Click to Join - MarioKart64")) + { + _portal.SendPlayerToServer(event.getPlayer(), "mk64"); + } + } + } + + @EventHandler(priority = EventPriority.LOW) + public void onPlayerInteract(PlayerInteractEvent event) + { + if (event.getAction() == Action.PHYSICAL) + { + if (event.getClickedBlock().getType() == Material.SOIL) + { + event.setCancelled(true); + return; + } + } + + if (event.getAction() == Action.RIGHT_CLICK_BLOCK) + { + if (_donationShop.ShouldOpenShop(event.getClickedBlock())) + { + _donationShop.OpenShopForPlayer(event.getPlayer()); + event.setCancelled(true); + } + else if (_customBuildShop.ShouldOpenShop(event.getClickedBlock())) + { + _customBuildShop.OpenShopForPlayer(event.getPlayer()); + event.setCancelled(true); + } + } + } + + @EventHandler + public void onCreatureSpawn(CreatureSpawnCustomEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void OnPlayerJoin(PlayerJoinEvent event) + { + event.getPlayer().teleport(GetSpawnLocation()); + event.getPlayer().setGameMode(GameMode.SURVIVAL); + GivePlayerLobbyItems(event.getPlayer()); + } + + @EventHandler + public void OnPlayerQuit(PlayerQuitEvent event) + { + event.setQuitMessage(null); + } + + protected void GivePlayerLobbyItems(Player player) + { + CoreClient client = GetClients().Get(player); + + player.getInventory().clear(); + player.getInventory().setArmorContents(new ItemStack[4]); + + UpdatePlayerLobbyItemBalances(client); + + for (Entry petToken : client.Donor().GetPets().entrySet()) + { + ItemStack petEgg = new ItemStack(Material.MONSTER_EGG, 1, (byte)petToken.getKey().getTypeId()); + ItemMeta meta = petEgg.getItemMeta(); + meta.setDisplayName(ChatColor.GREEN + petToken.getValue()); + + petEgg.setItemMeta(meta); + player.getInventory().addItem(petEgg); + } + + int nameTagCount = client.Donor().GetPetNameTagCount(); + + if (nameTagCount > 0) + { + ItemStack nameTags = new ItemStack(Material.SIGN, client.Donor().GetPetNameTagCount()); + ItemMeta meta = nameTags.getItemMeta(); + meta.setDisplayName(ChatColor.GREEN + "" + ChatColor.BOLD + "Name Tag"); + nameTags.setItemMeta(meta); + player.getInventory().addItem(nameTags); + } + } + + public void UpdatePlayerLobbyItemBalances(CoreClient client) + { + + } + + @EventHandler + public void onPlayerVote(PlayerVoteEvent event) + { + CoreClient client = GetClients().GetNull(event.GetPlayerName()); + + if (client != null) + { + UpdatePlayerLobbyItemBalances(client); + } + } + + @Override + public void onDisable() + { + GetModules().onDisable(); + _serverListener.Shutdown(); + } + + @Override + public JavaPlugin GetPlugin() + { + return this; + } + + @Override + public String GetWebServerAddress() + { + return getConfig().getString(WEB_CONFIG); + } + + @Override + public org.bukkit.Server GetRealServer() + { + return getServer(); + } + + @Override + public PluginManager GetPluginManager() + { + return GetRealServer().getPluginManager(); + } + + @Override + public void Log(String moduleName, String data) + { + System.out.println(moduleName + " : " + data); + } + + @Override + public IRelation GetRelation() + { + return _relation; + } + + @Override + public ModuleManager GetModules() + { + if (_moduleManager == null) + _moduleManager = new ModuleManager(); + + return _moduleManager; + } + + @Override + public Config GetConfig() + { + if (_config == null) + _config = new Config(this); + + return _config; + } + + @Override + public CoreClientManager GetClients() + { + if (_clientManager == null) + _clientManager = new CoreClientManager(this, new me.chiss.Core.Plugin.Logger(), _repository); + + return _clientManager; + } + + @Override + public Utility GetUtility() + { + if (_utility == null) + _utility = new Utility(this); + + return _utility; + } + + @Override + public BlockRegenerate GetBlockRegenerate() + { + if (_blockRegenerate == null) + _blockRegenerate = new BlockRegenerate(this); + + return _blockRegenerate; + } + + @Override + public BlockRestore GetBlockRestore() + { + if (_blockRestore == null) + _blockRestore = new BlockRestore(this); + + return _blockRestore; + } + + @Override + public Blood GetBlood() + { + if (_blood == null) + _blood = new Blood(this); + + return _blood; + } + + @Override + public Clans GetClans() + { + if (_clans == null) + _clans = new Clans(this, _repository, "Lobby"); + + return _clans; + } + + @Override + public ClassFactory GetClasses() + { + if (_classFactory == null) + _classFactory = new ClassFactory(this, _repository, GetSkills()); + + return _classFactory; + } + + @Override + public ConditionManager GetCondition() + { + if (_condition == null) + _condition = new ConditionManager(this); + + return _condition; + } + + @Override + public Creature GetCreature() + { + if (_creature == null) + _creature = new Creature(this); + + return _creature; + } + + @Override + public DamageManager GetDamage() + { + if (_damage == null) + _damage = new DamageManager(this, CombatManager.Instance); + + return _damage; + } + + @Override + public Energy GetEnergy() + { + if (_energy == null) + _energy = new Energy(this); + + return _energy; + } + + @Override + public Explosion GetExplosion() + { + if (_explosion == null) + _explosion = new Explosion(this); + + return _explosion; + } + + @Override + public Field GetField() + { + if (_field == null) + _field = new Field(this, _repository, "Lobby"); + + return _field; + } + + @Override + public Fire GetFire() + { + if (_fire == null) + _fire = new Fire(this); + + return _fire; + } + + @Override + public Ignore GetIgnore() + { + if (_ignore == null) + _ignore = new Ignore(this, _repository); + + return _ignore; + } + + @Override + public Logger GetLogger() + { + if (_logger == null) + _logger = new Logger(this); + + return _logger; + } + + @Override + public Observer GetObserver() + { + if (_observer == null) + _observer = new Observer(this); + + return _observer; + } + + @Override + public Recharge GetRecharge() + { + if (_recharge == null) + _recharge = new Recharge(this); + + return _recharge; + } + + @Override + public me.chiss.Core.Server.Server GetServer() + { + if (_serverModule == null) + _serverModule = new me.chiss.Core.Server.Server(this); + + return _serverModule; + } + + @Override + public SkillFactory GetSkills() + { + if (_skillFactory == null) + _skillFactory = new SkillFactory(this, _repository); + + return _skillFactory; + } + + @Override + public Spawn GetSpawn() + { + if (_spawn == null) + _spawn = new Spawn(this); + + return _spawn; + } + + @Override + public Teleport GetTeleport() + { + if (_teleport == null) + _teleport = new Teleport(this); + + return _teleport; + } + + @Override + public ProjectileManager GetThrow() + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + @Override + public Weapon GetWeapon() + { + if (_weapon == null) + _weapon = new Weapon(this); + + return _weapon; + } + + @Override + public Wiki GetWiki() + { + if (_wiki == null) + _wiki = new Wiki(this, _repository); + + return _wiki; + } + + @Override + public Location GetSpawnLocation() + { + return _spawnLocation; + } + + @Override + public INameColorer GetNameColorer() + { + return this; + } + + @Override + public PetManager GetPetManager() + { + return _petManager; + } + + @Override + public LootFactory GetLoot() + { + // TODO Auto-generated method stub + return null; + } + + @Override + public ChatColor GetColorOfFor(String other, Player player) + { + ChatColor prefixColor = null; + + if (GetClients().GetNull(other) != null && GetClients().Get(other).Rank().Has(Rank.ADMIN, false)) + { + prefixColor = ChatColor.DARK_RED; + } + else if (GetClients().GetNull(other) != null && GetClients().Get(other).Rank().Has(Rank.MODERATOR, false)) + { + prefixColor = ChatColor.RED; + } + else if (GetClients().GetNull(other) != null && GetClients().Get(other).Donor().HasDonated()) + { + prefixColor = ChatColor.YELLOW; + } + else + { + prefixColor = ChatColor.YELLOW; + } + + return prefixColor; + } +} diff --git a/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/ServerMenu/ServerConnectButton.java b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/ServerMenu/ServerConnectButton.java new file mode 100644 index 000000000..beb6916b9 --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/ServerMenu/ServerConnectButton.java @@ -0,0 +1,23 @@ +package nautilus.game.lobby.ServerMenu; + +import org.bukkit.entity.Player; + +import me.chiss.Core.Shop.IButton; + +public class ServerConnectButton implements IButton +{ + private ServerMenu _shop; + private String _serverName; + + public ServerConnectButton(ServerMenu shop, String serverName) + { + _shop = shop; + _serverName = serverName; + } + + @Override + public void Clicked(Player player) + { + _shop.SendPlayerToServer(player, _serverName); + } +} diff --git a/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/ServerMenu/ServerInfoManager.java b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/ServerMenu/ServerInfoManager.java new file mode 100644 index 000000000..7ea85a353 --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/ServerMenu/ServerInfoManager.java @@ -0,0 +1,155 @@ +package nautilus.game.lobby.ServerMenu; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.plugin.messaging.PluginMessageListener; + +import me.chiss.Core.Portal.Portal; +import mineplex.core.MiniPlugin; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; + +public class ServerInfoManager extends MiniPlugin implements PluginMessageListener +{ + private int _domPlayerCount; + private int _pvpPlayerCount; + private int _mk64PlayerCount; + private int _tutPlayerCount; + + private ServerMenu _serverMenu; + + public ServerInfoManager(JavaPlugin plugin, Portal portal) + { + super("ServerInfoManager", plugin); + + _serverMenu = new ServerMenu(this, portal); + + plugin.getServer().getMessenger().registerOutgoingPluginChannel(GetPlugin(), "BungeeCord"); + plugin.getServer().getMessenger().registerIncomingPluginChannel(GetPlugin(), "BungeeCord", this); + } + + /* + @EventHandler + public void PlayerCountUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (GetPlugin().getServer().getOnlinePlayers().length > 0) + { + Player player = GetPlugin().getServer().getOnlinePlayers()[0]; + SendServerPlayerCountRequest(player, "dom"); + SendServerPlayerCountRequest(player, "pvp"); + SendServerPlayerCountRequest(player, "mk64"); + SendServerPlayerCountRequest(player, "tut"); + + _serverMenu.UpdatePages(); + } + } +*/ + + @Override + public void onPluginMessageReceived(String channel, Player player, byte[] message) + { + if (!channel.equals("BungeeCord")) + return; + + DataInputStream in = null; + String subchannel = null; + try + { + in = new DataInputStream(new ByteArrayInputStream(message)); + subchannel = in.readUTF(); + + if (subchannel.equals("PlayerCount")) + { + switch (in.readUTF()) + { + case "dom": + _domPlayerCount = in.readInt(); + break; + case "pvp": + _pvpPlayerCount = in.readInt(); + break; + case "mk64": + _mk64PlayerCount = in.readInt(); + break; + case "tut": + _tutPlayerCount = in.readInt(); + break; + } + } + } + catch (IOException e) + { + e.printStackTrace(); + } + finally + { + try + { + in.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + + public int GetDomPlayerCount() + { + return _domPlayerCount; + } + + public int GetPvpPlayerCount() + { + return _pvpPlayerCount; + } + + public int GetMK64PlayerCount() + { + return _mk64PlayerCount; + } + + public int GetTutPlayerCount() + { + return _tutPlayerCount; + } + + private void SendServerPlayerCountRequest(Player player, String server) + { + ByteArrayOutputStream b = new ByteArrayOutputStream(); + DataOutputStream out = new DataOutputStream(b); + + try + { + out.writeUTF("PlayerCount"); + out.writeUTF(server); + } + catch (IOException e) + { + // Can never happen + } + finally + { + try + { + out.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + player.sendPluginMessage(GetPlugin(), "BungeeCord", b.toByteArray()); + } +} diff --git a/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/ServerMenu/ServerMenu.java b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/ServerMenu/ServerMenu.java new file mode 100644 index 000000000..199e35b73 --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/ServerMenu/ServerMenu.java @@ -0,0 +1,40 @@ +package nautilus.game.lobby.ServerMenu; + +import java.util.Map.Entry; + +import org.bukkit.entity.Player; + +import me.chiss.Core.Portal.Portal; +import me.chiss.Core.Shopv2.ShopBase; +import me.chiss.Core.Shopv2.page.ShopPageBase; + +public class ServerMenu extends ShopBase +{ + private Portal _portal; + + public ServerMenu(ServerInfoManager plugin, Portal portal) + { + super(plugin, "Server Menu [Right-Click Me]"); + + _portal = portal; + } + + @Override + protected ShopPageBase BuildPagesFor(Player player) + { + return new ServerMenuPage(Plugin, this, player); + } + + public void SendPlayerToServer(Player player, String server) + { + _portal.SendPlayerToServer(player, server); + } + + public void UpdatePages() + { + for (Entry>> pageEntry : GetPageMap().entrySet()) + { + ((ServerMenuPage)pageEntry.getValue()).UpdateServerCounts(); + } + } +} diff --git a/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/ServerMenu/ServerMenuPage.java b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/ServerMenu/ServerMenuPage.java new file mode 100644 index 000000000..c9edb21fb --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/ServerMenu/ServerMenuPage.java @@ -0,0 +1,37 @@ +package nautilus.game.lobby.ServerMenu; + +import me.chiss.Core.Shop.salespackage.ShopItem; +import me.chiss.Core.Shopv2.page.ShopPageBase; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class ServerMenuPage extends ShopPageBase +{ + public ServerMenuPage(ServerInfoManager plugin, ServerMenu shop, Player player) + { + super(plugin, shop, "Server Info", player); + + BuildPage(); + } + + @Override + protected void BuildPage() + { + UpdateServerCounts(); + + getInventory().setItem(28, new ShopItem(Material.BOOK, (byte)0, "Dominate Information", new String[] { ChatColor.RESET + "" + ChatColor.WHITE + "KitPvp:", ChatColor.RESET + "" + ChatColor.WHITE + "Capture and hold control points", ChatColor.RESET + "" + ChatColor.WHITE + "Lead your team to victory!" }, 1, false, true).getHandle()); + getInventory().setItem(30, new ShopItem(Material.BOOK, (byte)0, "Survival PvP Information", new String[] { ChatColor.RESET + "" + ChatColor.WHITE + "KitPvp:", ChatColor.RESET + "" + ChatColor.WHITE + "Build your base", ChatColor.RESET + "" + ChatColor.WHITE + "Fight unique bosses", ChatColor.RESET + "" + ChatColor.WHITE + "Become top clan!" }, 1, false, true).getHandle()); + getInventory().setItem(32, new ShopItem(Material.BOOK, (byte)0, "MineKart 64 Information", new String[] { ChatColor.RESET + "" + ChatColor.WHITE + "Mario Kart 64 Racing", ChatColor.RESET + "" + ChatColor.WHITE + "Nine different racing karts", ChatColor.RESET + "" + ChatColor.WHITE + "Three Race Cups and Battle Mode!" }, 1, false, true).getHandle()); + getInventory().setItem(34, new ShopItem(Material.BOOK, (byte)0, "Tutorial Information", new String[] { ChatColor.RESET + "" + ChatColor.WHITE + "Learn about KitPvp and Dominate" }, 1, false, true).getHandle()); + } + + public void UpdateServerCounts() + { + AddButton(19, new ShopItem(Material.IRON_SWORD, (byte)0, "Dominate " + ChatColor.WHITE + "(" + ChatColor.YELLOW + Plugin.GetDomPlayerCount() + "/100" + ChatColor.WHITE + ")", new String[] { ChatColor.RESET + "" + ChatColor.WHITE + "Click to join!" }, 1, false, true), new ServerConnectButton(Shop, "dom")); + AddButton(21, new ShopItem(Material.GRASS, (byte)0, "Survival PvP " + ChatColor.WHITE + "(" + ChatColor.YELLOW + Plugin.GetPvpPlayerCount() + "/100" + ChatColor.WHITE + ")", new String[] { ChatColor.RESET + "" + ChatColor.WHITE + "Click to join!" }, 1, false, true), new ServerConnectButton(Shop, "pvp")); + AddButton(23, new ShopItem(Material.WATCH, (byte)0, "MineKart 64 " + ChatColor.WHITE + "(" + ChatColor.YELLOW + Plugin.GetMK64PlayerCount() + "/100" + ChatColor.WHITE + ")", new String[] { ChatColor.RESET + "" + ChatColor.WHITE + "Click to join!" }, 1, false, true), new ServerConnectButton(Shop, "mk64")); + AddButton(25, new ShopItem(Material.BOOK_AND_QUILL, (byte)0, "Tutorial " + ChatColor.WHITE + "(" + ChatColor.YELLOW + Plugin.GetTutPlayerCount() + "/100" + ChatColor.WHITE + ")", new String[] { ChatColor.RESET + "" + ChatColor.WHITE + "Click to join!" }, 1, false, true), new ServerConnectButton(Shop, "tut")); + } +} diff --git a/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/GameQueue.java b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/GameQueue.java new file mode 100644 index 000000000..5ed9f868f --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/GameQueue.java @@ -0,0 +1,41 @@ +package nautilus.game.lobby.gamequeue; + +import java.util.HashSet; + +import org.bukkit.entity.Player; + +public class GameQueue +{ + private Gamemode _gamemode; + private QueueType _queueType; + + private HashSet _players; + + public GameQueue(Gamemode gamemode, QueueType queueType) + { + _gamemode = gamemode; + _queueType = queueType; + + _players = new HashSet(); + } + + public Gamemode GetGamemode() + { + return _gamemode; + } + + public QueueType GetQueueType() + { + return _queueType; + } + + public String GetDescription() + { + return _queueType.GetDescription(); + } + + public boolean ContainsPlayer(Player player) + { + return _players.contains(player.getName().toLowerCase()); + } +} diff --git a/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/Gamemode.java b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/Gamemode.java new file mode 100644 index 000000000..a234c9474 --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/Gamemode.java @@ -0,0 +1,56 @@ +package nautilus.game.lobby.gamequeue; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Material; + +public class Gamemode +{ + private List _gameQueues; + + private Material _displayMaterial; + private byte _displayData; + + private String _name; + private String[] _description; + + public Gamemode(Material displayMaterial, byte displayData, String name, String...description) + { + _displayMaterial = displayMaterial; + _displayData = displayData; + _name = name; + _description = description; + _gameQueues = new ArrayList(); + } + + public void AddGameQueue(QueueType queueType) + { + _gameQueues.add(new GameQueue(this, queueType)); + } + + public List GetQueues() + { + return _gameQueues; + } + + public String[] GetDescription() + { + return _description; + } + + public Material GetDisplayMaterial() + { + return _displayMaterial; + } + + public byte GetDisplayData() + { + return _displayData; + } + + public String GetName() + { + return _name; + } +} diff --git a/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/QueueManager.java b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/QueueManager.java new file mode 100644 index 000000000..3d43419c5 --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/QueueManager.java @@ -0,0 +1,44 @@ +package nautilus.game.lobby.gamequeue; + +import java.util.ArrayList; +import java.util.List; + + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.server.ServerBroadcaster; +import mineplex.core.server.packet.PlayerGameRequestPacket; + +public class QueueManager extends MiniPlugin +{ + private ServerBroadcaster _serverTalker; + private List _gameTypes; + + public QueueManager(JavaPlugin plugin, String webServerAddress) + { + super("Game Queue", plugin); + + _gameTypes = new ArrayList(); + + Gamemode dominate = new Gamemode(Material.BAKED_POTATO, (byte)0, "Dominate!", "Capture control points to win!"); + dominate.AddGameQueue(QueueType.SOLO); + + _gameTypes.add(dominate); + + _serverTalker = new ServerBroadcaster(webServerAddress); + _serverTalker.start(); + } + + public List GetGameTypes() + { + return _gameTypes; + } + + public void AddPlayerToQueue(Player player, GameQueue queue) + { + _serverTalker.QueuePacket(new PlayerGameRequestPacket(player.getName())); + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/QueueType.java b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/QueueType.java new file mode 100644 index 000000000..ea85fb16e --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/QueueType.java @@ -0,0 +1,26 @@ +package nautilus.game.lobby.gamequeue; + +public enum QueueType +{ + SOLO("Solo", "Play all alone."), + PARTY("Party", "Play with friends."); + + private String _name; + private String _description; + + QueueType(String name, String description) + { + _name = name; + _description = description; + } + + public String GetName() + { + return _name; + } + + public String GetDescription() + { + return _description; + } +} diff --git a/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/menu/GameQueueButton.java b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/menu/GameQueueButton.java new file mode 100644 index 000000000..aeab5aa5f --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/menu/GameQueueButton.java @@ -0,0 +1,25 @@ +package nautilus.game.lobby.gamequeue.menu; + +import nautilus.game.lobby.gamequeue.GameQueue; + +import org.bukkit.entity.Player; + +import me.chiss.Core.Shop.IButton; + +public class GameQueueButton implements IButton +{ + private QueuePage _queuePage; + private GameQueue _queue; + + public GameQueueButton(QueuePage queuePage, GameQueue queue) + { + _queuePage = queuePage; + _queue = queue; + } + + @Override + public void Clicked(Player player) + { + _queuePage.SelectQueue(player, _queue); + } +} diff --git a/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/menu/QueueMenu.java b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/menu/QueueMenu.java new file mode 100644 index 000000000..7efaede56 --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/menu/QueueMenu.java @@ -0,0 +1,21 @@ +package nautilus.game.lobby.gamequeue.menu; + +import org.bukkit.entity.Player; + +import nautilus.game.lobby.gamequeue.QueueManager; +import me.chiss.Core.Shopv2.ShopBase; +import me.chiss.Core.Shopv2.page.ShopPageBase; + +public class QueueMenu extends ShopBase +{ + public QueueMenu(QueueManager plugin) + { + super(plugin, "Game Queue"); + } + + @Override + protected ShopPageBase> BuildPagesFor(Player player) + { + return new QueuePage(Plugin, this, player); + } +} diff --git a/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/menu/QueuePage.java b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/menu/QueuePage.java new file mode 100644 index 000000000..c23526f58 --- /dev/null +++ b/Plugins/Nautilus.Game.Lobby/src/nautilus/game/lobby/gamequeue/menu/QueuePage.java @@ -0,0 +1,65 @@ +package nautilus.game.lobby.gamequeue.menu; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import me.chiss.Core.Shop.salespackage.ShopItem; +import me.chiss.Core.Shopv2.page.ShopPageBase; +import mineplex.core.common.util.C; +import nautilus.game.lobby.gamequeue.Gamemode; +import nautilus.game.lobby.gamequeue.QueueManager; +import nautilus.game.lobby.gamequeue.GameQueue; + +import org.bukkit.entity.Player; + +public class QueuePage extends ShopPageBase +{ + public QueuePage(QueueManager plugin, QueueMenu shop, Player player) + { + super(plugin, shop, " Queue Menu", player); + + BuildPage(); + } + + @Override + protected void BuildPage() + { + int slot = 0; + boolean locked = false; + + for (Gamemode gameType : Plugin.GetGameTypes()) + { + List itemLore = new ArrayList(); + + itemLore.addAll(Arrays.asList(gameType.GetDescription())); + + for (GameQueue queueType : gameType.GetQueues()) + { + itemLore.add(C.cBlack + ""); + itemLore.add(queueType.GetDescription()); + + ShopItem shopItem = new ShopItem(gameType.GetDisplayMaterial(), + gameType.GetDisplayData(), gameType.GetName(), + itemLore.toArray(new String[itemLore.size()]), 1, locked, + false); + + AddButton(slot, shopItem, new GameQueueButton(this, queueType)); + slot++; + } + } + } + + public void SelectQueue(Player player, GameQueue queue) + { + if (!queue.ContainsPlayer(player)) + { + Plugin.AddPlayerToQueue(player, queue); + PlayAcceptSound(player); + } + else + { + PlayDenySound(player); + } + } +} diff --git a/Plugins/Nautilus.Game.MineKart/.classpath b/Plugins/Nautilus.Game.MineKart/.classpath new file mode 100644 index 000000000..fdb3b8d0a --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/.classpath @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.MineKart/.externalToolBuilders/MineKart Builder.launch b/Plugins/Nautilus.Game.MineKart/.externalToolBuilders/MineKart Builder.launch new file mode 100644 index 000000000..21979608a --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/.externalToolBuilders/MineKart Builder.launch @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.MineKart/.project b/Plugins/Nautilus.Game.MineKart/.project new file mode 100644 index 000000000..50f9fe4d1 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/.project @@ -0,0 +1,26 @@ + + + Nautilus.Game.MineKart + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + + + LaunchConfigHandle + <project>/.externalToolBuilders/MineKart Builder.launch + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Nautilus.Game.MineKart/.settings/org.eclipse.jdt.core.prefs b/Plugins/Nautilus.Game.MineKart/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7341ab168 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/KartFactory$1.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/KartFactory$1.class new file mode 100644 index 000000000..846c88eba Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/KartFactory$1.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/KartFactory.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/KartFactory.class new file mode 100644 index 000000000..339140730 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/KartFactory.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/MineKart.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/MineKart.class new file mode 100644 index 000000000..323a3ae21 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/MineKart.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GP$GPState.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GP$GPState.class new file mode 100644 index 000000000..0d984a1b4 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GP$GPState.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GP.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GP.class new file mode 100644 index 000000000..1ce6b62fd Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GP.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPBattle.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPBattle.class new file mode 100644 index 000000000..2f12ba937 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPBattle.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPManager$1.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPManager$1.class new file mode 100644 index 000000000..1bbe837cf Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPManager$1.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPManager$2.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPManager$2.class new file mode 100644 index 000000000..0db7c3574 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPManager$2.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPManager$3.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPManager$3.class new file mode 100644 index 000000000..7ddcac9a1 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPManager$3.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPManager.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPManager.class new file mode 100644 index 000000000..2991ed5be Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPManager.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPResult$1$1$1.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPResult$1$1$1.class new file mode 100644 index 000000000..cba5da3fe Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPResult$1$1$1.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPResult$1$1.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPResult$1$1.class new file mode 100644 index 000000000..550700680 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPResult$1$1.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPResult$1.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPResult$1.class new file mode 100644 index 000000000..9516f008d Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPResult$1.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPResult.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPResult.class new file mode 100644 index 000000000..780ec80c1 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPResult.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPSet.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPSet.class new file mode 100644 index 000000000..a9f969a93 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/GPSet.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/ScoreComparator.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/ScoreComparator.class new file mode 100644 index 000000000..48bea4e46 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/ScoreComparator.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/GpCommand.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/GpCommand.class new file mode 100644 index 000000000..8e97b6c2d Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/GpCommand.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/ItemCommand.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/ItemCommand.class new file mode 100644 index 000000000..e0d28de27 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/ItemCommand.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/KartCommand.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/KartCommand.class new file mode 100644 index 000000000..dd9f254b6 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/KartCommand.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/VoteCommand.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/VoteCommand.class new file mode 100644 index 000000000..faf578cc5 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/VoteCommand.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/gp/FinishCommand.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/gp/FinishCommand.class new file mode 100644 index 000000000..684714212 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/gp/FinishCommand.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/gp/StartCommand.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/gp/StartCommand.class new file mode 100644 index 000000000..29a3283f2 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/gp/command/gp/StartCommand.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/KartItemActive$ActiveType.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/KartItemActive$ActiveType.class new file mode 100644 index 000000000..29d42c9ad Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/KartItemActive$ActiveType.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/KartItemActive.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/KartItemActive.class new file mode 100644 index 000000000..c20c89b7a Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/KartItemActive.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/KartItemEntity.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/KartItemEntity.class new file mode 100644 index 000000000..46bdb0518 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/KartItemEntity.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/KartItemManager.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/KartItemManager.class new file mode 100644 index 000000000..750801779 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/KartItemManager.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/KartItemType.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/KartItemType.class new file mode 100644 index 000000000..884a8f700 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/KartItemType.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/control/Collision.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/control/Collision.class new file mode 100644 index 000000000..7a31117df Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/control/Collision.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/control/Movement.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/control/Movement.class new file mode 100644 index 000000000..7e2d5ab8e Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/control/Movement.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_active/ActiveBananas.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_active/ActiveBananas.class new file mode 100644 index 000000000..95598fe9a Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_active/ActiveBananas.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_active/ActiveShells.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_active/ActiveShells.class new file mode 100644 index 000000000..f3bf132cd Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_active/ActiveShells.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_active/ActiveStandard.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_active/ActiveStandard.class new file mode 100644 index 000000000..d5dbca795 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_active/ActiveStandard.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseBlaze.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseBlaze.class new file mode 100644 index 000000000..fe448c60f Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseBlaze.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseChicken.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseChicken.class new file mode 100644 index 000000000..1774f93d5 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseChicken.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseCow.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseCow.class new file mode 100644 index 000000000..9a3a4eb8a Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseCow.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseEnderman.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseEnderman.class new file mode 100644 index 000000000..00c9a78d3 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseEnderman.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseGolem.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseGolem.class new file mode 100644 index 000000000..d0cca4a32 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseGolem.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UsePig.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UsePig.class new file mode 100644 index 000000000..25772540e Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UsePig.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseSheep.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseSheep.class new file mode 100644 index 000000000..14e1c0494 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseSheep.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseSpider$1.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseSpider$1.class new file mode 100644 index 000000000..4462e31dd Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseSpider$1.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseSpider.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseSpider.class new file mode 100644 index 000000000..2c5cd5bf2 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseSpider.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseWolf.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseWolf.class new file mode 100644 index 000000000..eb71b79b1 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_custom/UseWolf.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/ItemUse.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/ItemUse.class new file mode 100644 index 000000000..e99baf3db Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/ItemUse.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseBanana.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseBanana.class new file mode 100644 index 000000000..12d79d1c2 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseBanana.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseBananas.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseBananas.class new file mode 100644 index 000000000..8b87ca41f Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseBananas.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseFakeItem.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseFakeItem.class new file mode 100644 index 000000000..018938f9e Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseFakeItem.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseGhost.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseGhost.class new file mode 100644 index 000000000..afbe49785 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseGhost.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseGhost.java.orig b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseGhost.java.orig new file mode 100644 index 000000000..b3f877b2a --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseGhost.java.orig @@ -0,0 +1,42 @@ +package nautilus.game.minekart.item.use_default; + +import java.util.ArrayList; + +import org.bukkit.Sound; + +import me.chiss.Core.Utility.UtilMath; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.condition.ConditionData; +import nautilus.game.minekart.kart.condition.ConditionType; + +public class UseGhost extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + kart.SetItemStored(null); + + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), Sound.GHAST_MOAN, 2f, 1f); + + kart.AddCondition(new ConditionData(ConditionType.Ghost, 8000)); + + ArrayList steal = new ArrayList(); + + for (Kart other : kart.GetGP().GetKarts()) + { + if (kart.equals(other)) + continue; + + if (kart.GetItemStored() != null) + steal.add(other); + } + + if (!steal.isEmpty()) + { + Kart target = steal.get(UtilMath.r(steal.size())); + kart.SetItemStored(target.GetItemStored()); + target.SetItemStored(null); + } + } +} diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseGreenShell.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseGreenShell.class new file mode 100644 index 000000000..22b1b0abc Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseGreenShell.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseLightning.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseLightning.class new file mode 100644 index 000000000..381e07be8 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseLightning.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseLightning.java.orig b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseLightning.java.orig new file mode 100644 index 000000000..25a0d73a8 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseLightning.java.orig @@ -0,0 +1,33 @@ +package nautilus.game.minekart.item.use_default; + +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.condition.ConditionData; +import nautilus.game.minekart.kart.condition.ConditionType; +import nautilus.game.minekart.kart.crash.Crash_Spin; + +public class UseLightning extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + kart.SetItemStored(null); + + if (kart.GetGP() == null) + return; + + for (Kart other : kart.GetGP().GetKarts()) + { + if (kart.equals(other)) + continue; + + if (other.HasCondition(ConditionType.Star) || other.HasCondition(ConditionType.Ghost)) + continue; + + new Crash_Spin(kart, 0.8f); + + other.GetDriver().getWorld().strikeLightningEffect(other.GetDriver().getLocation()); + other.AddCondition(new ConditionData(ConditionType.Lightning, 10000)); + } + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseMushroom.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseMushroom.class new file mode 100644 index 000000000..fdcb6c9f7 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseMushroom.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseRedShell.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseRedShell.class new file mode 100644 index 000000000..5c12ff3a0 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseRedShell.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseStar.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseStar.class new file mode 100644 index 000000000..927d64496 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseStar.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseTripleGreenShell.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseTripleGreenShell.class new file mode 100644 index 000000000..58147e0f2 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseTripleGreenShell.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseTripleRedShell.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseTripleRedShell.class new file mode 100644 index 000000000..3a2e70e09 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/use_default/UseTripleRedShell.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/world_items_custom/Flame.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/world_items_custom/Flame.class new file mode 100644 index 000000000..b6bc7d69d Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/world_items_custom/Flame.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/world_items_default/Banana.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/world_items_default/Banana.class new file mode 100644 index 000000000..e222c6ad5 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/world_items_default/Banana.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/world_items_default/FakeItem.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/world_items_default/FakeItem.class new file mode 100644 index 000000000..c6592e8b9 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/world_items_default/FakeItem.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/world_items_default/GreenShell.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/world_items_default/GreenShell.class new file mode 100644 index 000000000..5468aab50 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/world_items_default/GreenShell.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/world_items_default/RedShell.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/world_items_default/RedShell.class new file mode 100644 index 000000000..2092ac10d Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/item/world_items_default/RedShell.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/Kart$DriftDirection.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/Kart$DriftDirection.class new file mode 100644 index 000000000..347bc4be3 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/Kart$DriftDirection.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/Kart.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/Kart.class new file mode 100644 index 000000000..c665c1489 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/Kart.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/KartManager.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/KartManager.class new file mode 100644 index 000000000..b22df37f3 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/KartManager.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/KartState$1.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/KartState$1.class new file mode 100644 index 000000000..f06c664f0 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/KartState$1.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/KartState.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/KartState.class new file mode 100644 index 000000000..5c2e1aeb6 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/KartState.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/KartType.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/KartType.class new file mode 100644 index 000000000..39c5739fe Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/KartType.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/KartUtil.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/KartUtil.class new file mode 100644 index 000000000..f529eee40 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/KartUtil.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/condition/Condition.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/condition/Condition.class new file mode 100644 index 000000000..3ca369656 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/condition/Condition.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/condition/ConditionData.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/condition/ConditionData.class new file mode 100644 index 000000000..87217a8a6 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/condition/ConditionData.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/condition/ConditionType.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/condition/ConditionType.class new file mode 100644 index 000000000..dea5752c1 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/condition/ConditionType.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/control/Collision.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/control/Collision.class new file mode 100644 index 000000000..d636a843c Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/control/Collision.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/control/Drive.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/control/Drive.class new file mode 100644 index 000000000..be607ba11 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/control/Drive.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/control/DriveDrift.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/control/DriveDrift.class new file mode 100644 index 000000000..b2caeb8d2 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/control/DriveDrift.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/control/World.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/control/World.class new file mode 100644 index 000000000..2a985b926 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/control/World.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/crash/Crash.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/crash/Crash.class new file mode 100644 index 000000000..248e2d7ed Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/crash/Crash.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/crash/Crash_Bump.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/crash/Crash_Bump.class new file mode 100644 index 000000000..952cf9a83 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/crash/Crash_Bump.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/crash/Crash_Explode.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/crash/Crash_Explode.class new file mode 100644 index 000000000..688c3b3a5 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/crash/Crash_Explode.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/crash/Crash_Knockback.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/crash/Crash_Knockback.class new file mode 100644 index 000000000..a6ea20215 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/crash/Crash_Knockback.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/crash/Crash_Spin.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/crash/Crash_Spin.class new file mode 100644 index 000000000..054714c9a Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/kart/crash/Crash_Spin.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/menu/KartMenu.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/menu/KartMenu.class new file mode 100644 index 000000000..5336f5667 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/menu/KartMenu.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/menu/KartPage.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/menu/KartPage.class new file mode 100644 index 000000000..dd071206f Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/menu/KartPage.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/menu/KartSelectButton.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/menu/KartSelectButton.class new file mode 100644 index 000000000..708ccd7d4 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/menu/KartSelectButton.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/repository/KartItemToken.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/repository/KartItemToken.class new file mode 100644 index 000000000..593f20754 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/repository/KartItemToken.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/repository/KartRepository$1.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/repository/KartRepository$1.class new file mode 100644 index 000000000..7448e1b47 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/repository/KartRepository$1.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/repository/KartRepository.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/repository/KartRepository.class new file mode 100644 index 000000000..acbc9873c Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/repository/KartRepository.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/shop/KartItem.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/shop/KartItem.class new file mode 100644 index 000000000..8086300a6 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/shop/KartItem.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/shop/KartItemButton.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/shop/KartItemButton.class new file mode 100644 index 000000000..749fb23a6 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/shop/KartItemButton.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/shop/KartShop.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/shop/KartShop.class new file mode 100644 index 000000000..14e200795 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/shop/KartShop.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/shop/page/KartPage.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/shop/page/KartPage.class new file mode 100644 index 000000000..cd59e480c Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/shop/page/KartPage.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/Track$1$1.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/Track$1$1.class new file mode 100644 index 000000000..8d605f1a2 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/Track$1$1.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/Track$1.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/Track$1.class new file mode 100644 index 000000000..b486a1cd3 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/Track$1.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/Track$TrackState.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/Track$TrackState.class new file mode 100644 index 000000000..6cce2bdf6 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/Track$TrackState.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/Track.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/Track.class new file mode 100644 index 000000000..29d3e0bf5 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/Track.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackEntity.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackEntity.class new file mode 100644 index 000000000..3f57bf9a9 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackEntity.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackItem.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackItem.class new file mode 100644 index 000000000..6f41fcde4 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackItem.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackLogic.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackLogic.class new file mode 100644 index 000000000..2c8498160 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackLogic.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackManager$1.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackManager$1.class new file mode 100644 index 000000000..eece9c8d8 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackManager$1.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackManager.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackManager.class new file mode 100644 index 000000000..f53112f28 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackManager.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackProcessor.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackProcessor.class new file mode 100644 index 000000000..3fa3a696b Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/TrackProcessor.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Bomb.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Bomb.class new file mode 100644 index 000000000..0dad4bc86 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Bomb.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Cow.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Cow.class new file mode 100644 index 000000000..504f31d94 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Cow.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Mole.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Mole.class new file mode 100644 index 000000000..e7fc1a36b Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Mole.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Sheepile.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Sheepile.class new file mode 100644 index 000000000..f79b6d777 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Sheepile.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Silverfish.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Silverfish.class new file mode 100644 index 000000000..036e377de Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Silverfish.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Spiderling.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Spiderling.class new file mode 100644 index 000000000..00a358925 Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Spiderling.class differ diff --git a/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Train.class b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Train.class new file mode 100644 index 000000000..f353d292d Binary files /dev/null and b/Plugins/Nautilus.Game.MineKart/bin/nautilus/game/minekart/track/ents/Train.class differ diff --git a/Plugins/Nautilus.Game.MineKart/plugin.yml b/Plugins/Nautilus.Game.MineKart/plugin.yml new file mode 100644 index 000000000..e600dfb55 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/plugin.yml @@ -0,0 +1,3 @@ +name: MineKart +main: nautilus.game.minekart.MineKart +version: 1.0 \ No newline at end of file diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/KartFactory.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/KartFactory.java new file mode 100644 index 000000000..75faca4b3 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/KartFactory.java @@ -0,0 +1,92 @@ +package nautilus.game.minekart; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import nautilus.game.minekart.kart.KartType; +import nautilus.game.minekart.repository.KartItemToken; +import nautilus.game.minekart.repository.KartRepository; +import nautilus.game.minekart.shop.KartItem; + +import org.bukkit.Material; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.donation.repository.GameSalesPackageToken; + +public class KartFactory extends MiniPlugin +{ + private KartRepository _repository; + private NautHashMap _karts; + private List _sortedKarts; + + public KartFactory(JavaPlugin plugin, KartRepository repository) + { + super("Kart Factory", plugin); + + _repository = repository; + _karts = new NautHashMap(); + + PopulateKarts(); + } + + public Collection GetKarts() + { + return _sortedKarts; + } + + private void PopulateKarts() + { + _karts.put("Chicken", new KartItem(Material.FEATHER, KartType.Chicken)); + _karts.put("Sheep", new KartItem(Material.WHEAT, KartType.Sheep)); + _karts.put("Cow", new KartItem(Material.MILK_BUCKET, KartType.Cow)); + _karts.put("Pig", new KartItem(Material.GRILLED_PORK, KartType.Pig)); + _karts.put("Spider", new KartItem(Material.STRING, KartType.Spider)); + _karts.put("Wolf", new KartItem(Material.SUGAR, KartType.Wolf)); + _karts.put("Enderman", new KartItem(Material.FIREBALL, KartType.Enderman)); + _karts.put("Blaze", new KartItem(Material.BLAZE_ROD, KartType.Blaze)); + _karts.put("Golem", new KartItem(Material.IRON_INGOT, KartType.Golem)); + + List itemTokens = new ArrayList(); + + for (KartItem item : _karts.values()) + { + KartItemToken itemToken = new KartItemToken(); + itemToken.Name = item.GetName(); + itemToken.Material = item.GetDisplayMaterial().toString(); + itemToken.Data = item.GetDisplayData() + ""; + itemToken.SalesPackage = new GameSalesPackageToken(); + + itemTokens.add(itemToken); + } + + for (KartItemToken itemToken : _repository.GetKartItems(itemTokens)) + { + if (_karts.containsKey(itemToken.Name)) + { + _karts.get(itemToken.Name).Update(itemToken.SalesPackage); + } + } + + _sortedKarts = new ArrayList(_karts.values()); + + Collections.sort(_sortedKarts, new Comparator() + { + @Override + public int compare(KartItem kartItem1, KartItem kartItem2) + { + if (kartItem1.GetKartType().GetStability() < kartItem2.GetKartType().GetStability()) + return -1; + + if (kartItem1.GetKartType().GetStability() == kartItem2.GetKartType().GetStability()) + return 0; + + return 1; + } + }); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/MineKart.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/MineKart.java new file mode 100644 index 000000000..f8aa024fa --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/MineKart.java @@ -0,0 +1,495 @@ +package nautilus.game.minekart; + +import java.io.File; +import java.io.FileFilter; +import java.io.IOException; + +import me.chiss.Core.Config.Config; +import me.chiss.Core.Loot.LootFactory; +import me.chiss.Core.MemoryFix.MemoryFix; +import me.chiss.Core.Module.ModuleManager; +import me.chiss.Core.Modules.*; +import me.chiss.Core.Plugin.IPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.antistack.AntiStack; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.command.CommandCenter; +import mineplex.core.common.CurrencyType; +import mineplex.core.creature.Creature; +import mineplex.core.donation.DonationManager; +import mineplex.core.energy.Energy; +import mineplex.core.explosion.Explosion; +import mineplex.core.fakeEntity.FakeEntity; +import mineplex.core.fakeEntity.FakeEntityManager; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.npc.NpcManager; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.packethandler.PlayerNamer; +import mineplex.core.pet.PetManager; +import mineplex.core.projectile.ProjectileManager; +import mineplex.core.punish.Punish; +import mineplex.core.recharge.Recharge; +import mineplex.core.server.ServerListener; +import mineplex.core.spawn.Spawn; +import mineplex.core.teleport.Teleport; +import mineplex.core.updater.Updater; +import mineplex.minecraft.game.core.combat.CombatManager; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.damage.DamageManager; +import mineplex.minecraft.game.core.fire.Fire; + +import nautilus.game.minekart.gp.GPManager; +import nautilus.game.minekart.kart.KartManager; +import nautilus.game.minekart.menu.KartMenu; +import nautilus.game.minekart.repository.KartRepository; +import nautilus.game.minekart.shop.KartShop; +import nautilus.game.minekart.track.TrackManager; +import nautilus.game.minekart.track.TrackProcessor; +import nautilus.minecraft.core.INautilusPlugin; +import net.minecraft.server.v1_6_R2.EntityPlayer; + +import org.apache.commons.io.FileDeleteStrategy; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Server; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.block.BlockGrowEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.FoodLevelChangeEvent; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerBucketFillEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; + +public class MineKart extends JavaPlugin implements INautilusPlugin, IPlugin, Listener +{ + private String WEB_CONFIG = "webServer"; + + //Modules + private ModuleManager _moduleManager; + private CoreClientManager _clientManager; + private DonationManager _donationManager; + private Config _config; + private Utility _utility; + private BlockRegenerate _blockRegenerate; + private BlockRestore _blockRestore; + private Blood _blood; + private Creature _creature; + private Energy _energy; + private Fire _fire; + private Logger _logger; + private LootFactory _lootFactory; + private Observer _observer; + private me.chiss.Core.Server.Server _serverModule; + private Spawn _spawn; + private Teleport _teleport; + private ProjectileManager _throw; + private NpcManager _npcManager; + + private GPManager _gpManager; + + private ServerListener _serverListener; + + private Location _spawnLocation; + + private FakeEntity _chicken; + private FakeEntity _wolf; + private FakeEntity _pig; + private FakeEntity _spider; + private FakeEntity _sheep; + private FakeEntity _cow; + private FakeEntity _golem; + private FakeEntity _blaze; + private FakeEntity _enderman; + + @Override + public void onEnable() + { + ClearRaceFolders(); + + getConfig().addDefault(WEB_CONFIG, "http://bettermc.com/"); + getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); + saveConfig(); + + _spawnLocation = new Location(this.getServer().getWorlds().get(0), 8.5, 17, -22.5, 0f, 0f); + + _clientManager = CoreClientManager.Initialize(this, GetWebServerAddress()); + CommandCenter.Initialize(this, _clientManager); + FakeEntityManager.Initialize(this); + _donationManager = new DonationManager(this, GetWebServerAddress()); + Recharge.Initialize(this); + + //Init Modules + GetModules(); + GetCreature(); + + new Punish(this, GetWebServerAddress()); + new Explosion(this, _blockRestore); + + GetServer(); + GetTeleport(); + + //Unreferenced Modules + new AntiStack(this); + //new Chat(this, GetClans(), _repository); + new JoinQuit(); + + ItemStackFactory.Initialize(this, true); + + //Kart + _gpManager = new GPManager(this, _donationManager, GetTeleport(), Recharge.Instance, new KartManager(this, Recharge.Instance), new TrackManager(this, GetTeleport())); + new TrackProcessor(); + + //Updates + new Updater(this); + + //_serverListener = new ServerListener(GetWebServerAddress(), getServer().getIp(), getServer().getPort() + 1); + + PlayerNamer playerNamer = new PlayerNamer(this, new PacketHandler(this), null); + //new TabLobbyList(this, playerNamer.PacketHandler, _clientManager, _donationManager, true); + + FakeEntityManager.Instance.SetPacketHandler(playerNamer.PacketHandler); + DonationManager donationManager = new DonationManager(this, GetWebServerAddress()); + + _npcManager = new NpcManager(this, _creature); + KartFactory _kartFactory = new KartFactory(this, new KartRepository(GetWebServerAddress())); + new KartShop(_kartFactory, _clientManager, donationManager, CurrencyType.Gems); + new KartMenu(_kartFactory, _clientManager, donationManager, _gpManager); + + new MemoryFix(this); + + getServer().getPluginManager().registerEvents(this, this); + + CreateFakeKarts(); + } + + @EventHandler + public void OnPlayerJoin(PlayerJoinEvent event) + { + event.getPlayer().teleport(GetSpawnLocation()); + event.getPlayer().setGameMode(GameMode.SURVIVAL); + event.getPlayer().setFoodLevel(20); + event.getPlayer().setHealth(20d); + ShowFakeKarts(event.getPlayer()); + } + + @EventHandler + public void PreventFoodChange(FoodLevelChangeEvent event) + { + if (event.getEntity() instanceof Player && !_gpManager.InGame((Player)event.getEntity())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void onBlockBreakEvent(BlockBreakEvent event) + { + if (!event.getPlayer().isOp()) + { + event.setCancelled(true); + } + } + + @EventHandler + public void onBlockPlaceEvent(BlockPlaceEvent event) + { + if (!event.getPlayer().isOp()) + event.setCancelled(true); + } + + @EventHandler + public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) + { + if (!event.getPlayer().isOp()) + event.setCancelled(true); + } + + @EventHandler + public void onPlayerBucketFill(PlayerBucketFillEvent event) + { + if (!event.getPlayer().isOp()) + event.setCancelled(true); + } + + @EventHandler + public void PreventDrop(PlayerDropItemEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void BurnCancel(BlockBurnEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void SpreadCancel(BlockFromToEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void GrowCancel(BlockGrowEvent event) + { + event.setCancelled(true); + } + + @Override + public void onDisable() + { + GetModules().onDisable(); + _serverListener.Shutdown(); + } + + @Override + public JavaPlugin GetPlugin() + { + return this; + } + + @Override + public String GetWebServerAddress() + { + return getConfig().getString(WEB_CONFIG); + } + + @Override + public Server GetRealServer() + { + return getServer(); + } + + @Override + public PluginManager GetPluginManager() + { + return GetRealServer().getPluginManager(); + } + + @Override + public void Log(String moduleName, String data) + { + System.out.println(moduleName + " : " + data); + } + + @Override + public ModuleManager GetModules() + { + if (_moduleManager == null) + _moduleManager = new ModuleManager(); + + return _moduleManager; + } + + @Override + public Config GetConfig() + { + if (_config == null) + _config = new Config(this); + + return _config; + } + + @Override + public Utility GetUtility() + { + if (_utility == null) + _utility = new Utility(this); + + return _utility; + } + + @Override + public BlockRegenerate GetBlockRegenerate() + { + if (_blockRegenerate == null) + _blockRegenerate = new BlockRegenerate(this); + + return _blockRegenerate; + } + + @Override + public BlockRestore GetBlockRestore() + { + if (_blockRestore == null) + _blockRestore = new BlockRestore(this); + + return _blockRestore; + } + + @Override + public Blood GetBlood() + { + if (_blood == null) + _blood = new Blood(this); + + return _blood; + } + + @Override + public Creature GetCreature() + { + if (_creature == null) + _creature = new Creature(this); + + return _creature; + } + + @Override + public Energy GetEnergy() + { + if (_energy == null) + _energy = new Energy(this); + + return _energy; + } + + @Override + public Fire GetFire() + { + if (_fire == null) + _fire = new Fire(this, new ConditionManager(this), new DamageManager(this, new CombatManager(this), _npcManager)); + + return _fire; + } + + @Override + public Logger GetLogger() + { + if (_logger == null) + _logger = new Logger(this); + + return _logger; + } + + @Override + public LootFactory GetLoot() + { + if (_lootFactory == null) + _lootFactory = new LootFactory(this); + + return _lootFactory; + } + + @Override + public Observer GetObserver() + { + if (_observer == null) + _observer = new Observer(this); + + return _observer; + } + + @Override + public me.chiss.Core.Server.Server GetServer() + { + if (_serverModule == null) + _serverModule = new me.chiss.Core.Server.Server(this,_clientManager); + + return _serverModule; + } + + @Override + public Spawn GetSpawn() + { + if (_spawn == null) + _spawn = new Spawn(this); + + return _spawn; + } + + @Override + public Teleport GetTeleport() + { + if (_teleport == null) + _teleport = new Teleport(this, _clientManager, GetSpawn()); + + return _teleport; + } + + @Override + public ProjectileManager GetThrow() + { + if (_throw == null) + _throw = new ProjectileManager(this); + + return _throw; + } + + @Override + public Location GetSpawnLocation() + { + return _spawnLocation; + } + + private void CreateFakeKarts() + { + _chicken = new FakeEntity(EntityType.CHICKEN, new Location(_spawnLocation.getWorld(), 6.5, 17.5, -39.5, 0f, 0f)); + _wolf = new FakeEntity(EntityType.WOLF, new Location(_spawnLocation.getWorld(), 8.5, 17.5, -39.5, 0f, 0f)); + _pig = new FakeEntity(EntityType.PIG, new Location(_spawnLocation.getWorld(), 10.5, 17.5, -39.5, 0f, 0f)); + _spider = new FakeEntity(EntityType.SPIDER, new Location(_spawnLocation.getWorld(), 6.5, 19.5, -39.5, 0f, 0f)); + _sheep = new FakeEntity(EntityType.SHEEP, new Location(_spawnLocation.getWorld(), 8.5, 19.5, -39.5, 0f, 0f)); + _cow = new FakeEntity(EntityType.COW, new Location(_spawnLocation.getWorld(), 10.5, 19.5, -39.5, 0f, 0f)); + _golem = new FakeEntity(EntityType.IRON_GOLEM, new Location(_spawnLocation.getWorld(), 6.5, 21.5, -39.5, 0f, 0f)); + _blaze = new FakeEntity(EntityType.BLAZE, new Location(_spawnLocation.getWorld(), 8.5, 21.5, -39.5, 0f, 0f)); + _enderman = new FakeEntity(EntityType.ENDERMAN, new Location(_spawnLocation.getWorld(), 10.5, 21.5, -39.5, 0f, 0f)); + } + + private void ShowFakeKarts(Player player) + { + EntityPlayer mcPlayer = ((CraftPlayer)player).getHandle(); + + mcPlayer.playerConnection.sendPacket(_chicken.Spawn()); + mcPlayer.playerConnection.sendPacket(_wolf.Spawn()); + mcPlayer.playerConnection.sendPacket(_pig.Spawn()); + mcPlayer.playerConnection.sendPacket(_spider.Spawn()); + mcPlayer.playerConnection.sendPacket(_sheep.Spawn()); + mcPlayer.playerConnection.sendPacket(_cow.Spawn()); + mcPlayer.playerConnection.sendPacket(_golem.Spawn()); + mcPlayer.playerConnection.sendPacket(_blaze.Spawn()); + mcPlayer.playerConnection.sendPacket(_enderman.Spawn()); + } + + private void ClearRaceFolders() + { + File mainDirectory = new File("."); + + FileFilter statsFilter = new FileFilter() + { + @Override + public boolean accept(File arg0) + { + return arg0.isDirectory() && arg0.getName().contains("-"); + } + }; + + for (File f : mainDirectory.listFiles(statsFilter)) + { + try + { + FileDeleteStrategy.FORCE.delete(f); + + } + catch (IOException e) + { + System.out.println("Error deleting " + f.getName() + " on startup."); + } + } + } + + @Override + public PetManager GetPetManager() + { + return null; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/GP.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/GP.java new file mode 100644 index 000000000..493a00624 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/GP.java @@ -0,0 +1,416 @@ +package nautilus.game.minekart.gp; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.InputStreamReader; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.scoreboard.DisplaySlot; +import org.bukkit.scoreboard.Objective; +import org.bukkit.scoreboard.Score; +import org.bukkit.scoreboard.Scoreboard; +import org.bukkit.scoreboard.ScoreboardManager; +import org.fusesource.jansi.Ansi.Color; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.fakeEntity.FakeEntityManager; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartType; +import nautilus.game.minekart.track.Track; +import nautilus.game.minekart.track.Track.TrackState; + +public class GP +{ + public enum GPState + { + Recruit, + Live, + Ended + } + + public GPManager Manager; + + private GPState _state = GPState.Recruit; + + private int _gpId = 0; + + private HashMap _players = new HashMap(); + + private Scoreboard _scoreScoreboard; + private Objective _scoreObjective; + + private Scoreboard _posScoreboard; + private Objective _posObjective; + + private boolean _switchScoreboards; + + private GPSet _trackSet; + private int _trackIndex = -1; + private Track[] _trackArray = null; + + private int _maxKarts = 10; + + public GP(GPManager manager, GPSet trackSet) + { + Manager = manager; + _trackSet = trackSet; + + _gpId = GetNewId(); + + //Prepare Tracks + _trackArray = new Track[_trackSet.GetMapNames().length]; + for (int i=0 ; i<_trackArray.length ; i++) + { + _trackArray[i] = new Track(this, Manager.GetTeleport(), Manager.GetRecharge(), _trackSet.GetMapNames()[i], i); + } + } + + public GPState GetState() + { + return _state; + } + + public int GetId() + { + return _gpId; + } + + public GPSet GetSet() + { + return _trackSet; + } + + public Track GetTrack() + { + if (_trackIndex == -1) + return null; + + if (_trackIndex >= _trackArray.length) + return null; + + return _trackArray[_trackIndex]; + } + + public Track GetTrack(int id) + { + try + { + return _trackArray[id]; + } + catch (Exception e) + { + return null; + } + } + + public Track[] GetTracks() + { + return _trackArray; + } + + public int GetMaxKarts() + { + return _maxKarts; + } + + public Collection GetPlayers() + { + return _players.keySet(); + } + + public Collection GetKarts() + { + HashSet _karts = new HashSet(); + + for (Player player : GetPlayers()) + { + Kart kart = Manager.KartManager.GetKart(player); + + if (kart != null) + _karts.add(kart); + } + + return _karts; + } + + public void SetState(GPState state) + { + _state = state; + } + + public void NextTrack() + { + _trackIndex++; + + for (Kart kart : GetKarts()) + { + kart.ClearTrackData(); + + kart.SetItemCycles(0); + kart.SetItemStored(null); + } + + if (_trackIndex < _trackArray.length) + { + for (Kart kart : GetKarts()) + { + kart.SetItemStored(null); + kart.SetItemActive(null); + + kart.GetDriver().eject(); + kart.GetDriver().leaveVehicle(); + } + + GetTrack().Initialize(); + } + else + { + _trackIndex--; + //Load Castle + Manager.CreateResult(this); + + _trackIndex++; + + for (Kart kart : GetKarts()) + { + Manager.KartManager.RemoveKart(kart.GetDriver()); + FakeEntityManager.Instance.RemoveForward(kart.GetDriver()); + FakeEntityManager.Instance.RemoveFakeVehicle(kart.GetDriver(), kart.GetEntity().GetEntityId()); + } + + Announce(F.main("MK", "Ended Set: " + F.elem(_trackSet.GetName()))); + + SetState(GPState.Ended); + } + } + + public void AddPlayer(Player player, KartType type) + { + _players.put(player, type); + + Manager.KartManager.AddKart(player, type, this); + } + + public void RemovePlayer(Player player, Kart kart) + { + _players.remove(player); + + if (_scoreScoreboard != null) + { + _scoreScoreboard.resetScores(Bukkit.getOfflinePlayer(Color.WHITE + player.getName())); + } + + if (_posScoreboard != null) + { + ChatColor col = ChatColor.YELLOW; + if (kart != null && kart.GetLap() > 3) + col = ChatColor.GREEN; + + _posScoreboard.resetScores(Bukkit.getOfflinePlayer(col + player.getName())); + } + + if (kart != null) + for (Track track : _trackArray) + track.RemoveKart(kart); + + if (this instanceof GPBattle) + Announce(F.main("MK", player.getName() + " has left the Battle.")); + else + Announce(F.main("MK", player.getName() + " has left the Grand Prix.")); + } + + public void UpdateScoreBoard() + { + if (GetTrack() == null) + return; + + if (GetTrack().GetState() == TrackState.Ended) + { + if (_scoreScoreboard == null) + { + ScoreboardManager manager = Bukkit.getScoreboardManager(); + _scoreScoreboard = manager.getNewScoreboard(); + + _scoreObjective = _scoreScoreboard.registerNewObjective("showposition", "dummy"); + _scoreObjective.setDisplaySlot(DisplaySlot.SIDEBAR); + _scoreObjective.setDisplayName(ChatColor.AQUA + "Total Score"); + + _switchScoreboards = true; + } + + if (_switchScoreboards) + { + for (Kart kart : GetTrack().GetPositions()) + { + if (kart.GetDriver() == null || !kart.GetDriver().isOnline()) + continue; + + kart.GetDriver().setScoreboard(_scoreScoreboard); + } + + _switchScoreboards = false; + } + + for (Kart kart : GetTrack().GetPositions()) + { + if (kart.GetDriver() == null || !kart.GetDriver().isOnline()) + continue; + + Score score = _scoreObjective.getScore(Bukkit.getOfflinePlayer(UtilPlayer.safeNameLength(ChatColor.WHITE + kart.GetDriver().getName()))); + score.setScore(GetScore(kart)); + } + } + else + { + if (_posScoreboard == null) + { + ScoreboardManager manager = Bukkit.getScoreboardManager(); + _posScoreboard = manager.getNewScoreboard(); + + _posObjective = _posScoreboard.registerNewObjective("showposition", "dummy"); + _posObjective.setDisplaySlot(DisplaySlot.SIDEBAR); + _posObjective.setDisplayName(ChatColor.AQUA + "Kart Positions"); + + _switchScoreboards = true; + } + + for (Kart kart : GetTrack().GetPositions()) + { + if (kart.GetDriver() == null || !kart.GetDriver().isOnline()) + continue; + + ChatColor col = ChatColor.YELLOW; + + if (kart.GetLap() > 3) + { + col = ChatColor.GREEN; + _posScoreboard.resetScores(Bukkit.getOfflinePlayer(UtilPlayer.safeNameLength(ChatColor.YELLOW + kart.GetDriver().getName()))); + } + else + { + _posScoreboard.resetScores(Bukkit.getOfflinePlayer(UtilPlayer.safeNameLength(ChatColor.GREEN + kart.GetDriver().getName()))); + } + + Score score = _posObjective.getScore(Bukkit.getOfflinePlayer(UtilPlayer.safeNameLength(col + kart.GetDriver().getName()))); + score.setScore(kart.GetLapPlace() + 1); + } + + if (_switchScoreboards) + { + for (Kart kart : GetTrack().GetPositions()) + { + if (kart.GetDriver() == null || !kart.GetDriver().isOnline()) + continue; + + + kart.GetDriver().setScoreboard(_posScoreboard); + } + + _switchScoreboards = false; + } + } + } + + public int GetScore(Kart kart) + { + int score = 0; + + for (Track track : _trackArray) + for (int i=0 ; i 16) + name = name.substring(0, 16); + + Score score = objective.getScore(Bukkit.getOfflinePlayer(name)); + score.setScore(GetScore(kart)); + } + + for (Kart kart : GetKarts()) + { + if (kart.GetDriver() == null || !kart.GetDriver().isOnline()) + continue; + + kart.GetDriver().setScoreboard(board); + } + } + else + { + ScoreboardManager manager = Bukkit.getScoreboardManager(); + Scoreboard board = manager.getNewScoreboard(); + + Objective objective = board.registerNewObjective("showposition", "dummy"); + objective.setDisplaySlot(DisplaySlot.SIDEBAR); + objective.setDisplayName(ChatColor.AQUA + "Kart Balloons"); + + for (Kart kart : GetKarts()) + { + if (kart.GetDriver() == null || !kart.GetDriver().isOnline()) + continue; + + ChatColor col = ChatColor.GRAY; + if (kart.GetLives() == 3) col = ChatColor.GREEN; + else if (kart.GetLives() == 2) col = ChatColor.YELLOW; + else if (kart.GetLives() == 1) col = ChatColor.RED; + + String name = col + kart.GetDriver().getName(); + if (name.length() > 16) + name = name.substring(0, 16); + + Score score = objective.getScore(Bukkit.getOfflinePlayer(name)); + score.setScore(kart.GetLives()); + } + + for (Kart kart : GetKarts()) + { + if (kart.GetDriver() == null || !kart.GetDriver().isOnline()) + continue; + + kart.GetDriver().setScoreboard(board); + } + } + } + + public void CheckBattleEnd() + { + if (GetTrack().GetState() == TrackState.Loading || GetTrack().GetState() == TrackState.Countdown) + return; + + int alive = 0; + Kart winner = null; + for (Kart kart : GetKarts()) + { + if (kart.GetLives() > 0) + { + alive++; + winner = kart; + } + } + + if (alive > 1) + return; + + if (GetTrack().GetState() != TrackState.Ended) + { + this.GetTrack().GetPositions().add(0, winner); + GetTrack().SetState(TrackState.Ended); + } + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/GPManager.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/GPManager.java new file mode 100644 index 000000000..093f712d8 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/GPManager.java @@ -0,0 +1,524 @@ +package nautilus.game.minekart.gp; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + +import nautilus.game.minekart.gp.GP.GPState; +import nautilus.game.minekart.gp.command.GpCommand; +import nautilus.game.minekart.gp.command.ItemCommand; +import nautilus.game.minekart.gp.command.KartCommand; +import nautilus.game.minekart.gp.command.VoteCommand; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartType; +import nautilus.game.minekart.kart.KartManager; +import nautilus.game.minekart.track.Track.TrackState; +import nautilus.game.minekart.track.TrackManager; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockSpreadEvent; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerLoginEvent.Result; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.portal.Portal; +import mineplex.core.recharge.Recharge; +import mineplex.core.teleport.Teleport; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.donation.DonationManager; + +public class GPManager extends MiniPlugin +{ + private DonationManager _donationManager; + private Teleport _teleport; + private Recharge _recharge; + + public KartManager KartManager; + public TrackManager TrackManager; + public Portal Portal; + + //Queue Data + private GPSet _set; + private Location _spawn; + + private ArrayList _players = new ArrayList(); + private HashMap _playerVote = new HashMap(); + private HashMap _kartSelect = new HashMap(); + + private long _voteTimer = 0; + private int _startTimer = 0; + + //Live Sets + private HashSet _live = new HashSet(); + + //Result Maps + private HashSet _results = new HashSet(); + + public GPManager(JavaPlugin plugin, DonationManager donationManager, Teleport teleport, Recharge recharge, KartManager kartManager, TrackManager trackManager) + { + super("Race Manager", plugin); + + _donationManager = donationManager; + _teleport = teleport; + _recharge = recharge; + KartManager = kartManager; + TrackManager = trackManager; + Portal = new Portal(plugin); + + _spawn = new Location(UtilWorld.getWorld("world"), 8.5, 18, -22.5); + } + + @Override + public void AddCommands() + { + AddCommand(new GpCommand(this)); + AddCommand(new ItemCommand(this)); + AddCommand(new KartCommand(this)); + AddCommand(new VoteCommand(this)); + } + + public void SelectKart(Player player, KartType kart) + { + _kartSelect.put(player, kart); + UtilPlayer.message(player, F.main("MK", "You selected " + F.elem(kart.GetName() + " Kart") + ".")); + } + + public KartType GetSelectedKart(Player player) + { + if (!_kartSelect.containsKey(player)) + _kartSelect.put(player, KartType.Sheep); + + return _kartSelect.get(player); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void Motd(ServerListPingEvent event) + { + if (_live.size() > 0) + { + if (_live.iterator().next() instanceof GPBattle) + { + event.setMotd(ChatColor.AQUA + "In Battle..."); + } + else + { + event.setMotd(ChatColor.AQUA + "In Race..."); + } + + event.setMaxPlayers(_plugin.getServer().getOnlinePlayers().length); + } + else + { + event.setMotd(ChatColor.GREEN + GetSet().GetName()); + event.setMaxPlayers(10); + } + } + + @EventHandler + public void CheckStart(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + //Full + if (_players.size() >= 10) + { + StartGP(false); + return; + } + + //Votes + int votes = 0; + for (boolean vote : _playerVote.values()) + { + if (vote) + votes++; + } + + int needed = (_players.size() / 2) + (_players.size()%2); + + if (votes >= needed && _players.size() >= 4) + { + StartGP(false); + } + else + { + if (UtilTime.elapsed(_voteTimer, 30000)) + { + if (_players.size() >= 4) + { + Announce(F.main("MK", "Type " + F.elem(C.cGreen + "/vote") + " to start the game with less players.")); + Announce(F.main("MK", F.elem((needed - votes)+"") + " more votes needed...")); + } + else + { + Announce(F.main("MK", "Waiting for players...")); + } + + + _voteTimer = System.currentTimeMillis(); + } + } + } + + public void StartGP(boolean force) + { + if (!force && _startTimer > 0) + { + Announce(F.main("MK", "Starting in " + F.time(UtilTime.MakeStr(_startTimer * 1000)) + ".")); + _startTimer--; + + return; + } + + GP gp; + if (GetSet() != GPSet.Battle) gp = new GP(this, GetSet()); + else gp = new GPBattle(this, GetSet()); + + //Add Players + int added = 0; + while (added < 10) + { + if (_players.isEmpty()) + break; + + Player player = _players.remove(0); + gp.AddPlayer(player, GetSelectedKart(player)); + + //Clean Player + _playerVote.remove(player); + _kartSelect.remove(player); + + added++; + } + + //Set Live + gp.SetState(GPState.Live); + gp.NextTrack(); + _live.add(gp); + } + + public void Vote(Player caller) + { + if (!_playerVote.containsKey(caller)) + return; + + boolean vote = _playerVote.get(caller); + + _playerVote.put(caller, !vote); + + if (!vote) Announce(F.main("MK", F.elem(caller.getName()) + " has " + F.elem(C.cGreen + "voted") + " to start the game.")); + else Announce(F.main("MK", F.elem(caller.getName()) + " has " + F.elem(C.cRed + "unvoted") + " to start the game.")); + } + + public void Announce(String string) + { + for (Player player : _players) + UtilPlayer.message(player, string); + } + + public GP GetGP(Player player) + { + for (GP race : _live) + if (race.GetPlayers().contains(player)) + return race; + + return null; + } + + @EventHandler + public void PlayerLogin(PlayerLoginEvent event) + { + if (_live.size() > 0) + { + event.disallow(Result.KICK_FULL, ChatColor.AQUA + "A race is already in progress."); + } + } + + @EventHandler + public void PlayerJoin(PlayerJoinEvent event) + { + Player player = event.getPlayer(); + _players.add(player); + _playerVote.put(player, false); + _startTimer = 20; + + player.teleport(_spawn); + } + + @EventHandler + public void PlayerQuit(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + + //Remove Kart Choice + _kartSelect.remove(player); + + //Remove Kart + Kart kart = KartManager.GetKart(player); + if (kart != null) + KartManager.RemoveKart(kart.GetDriver()); + + //Leave Queue + _players.remove(player); + _playerVote.remove(player); + _kartSelect.remove(player); + + //Leave GP + GP gp = GetGP(player); + if (gp != null) + gp.RemovePlayer(player, kart); + + //Leave Result + for (GPResult result : _results) + result.RemovePlayer(player); + + if (gp != null && gp.GetPlayers().size() == 0) + _plugin.getServer().shutdown(); + } + + @EventHandler + public void TeleportSpawn(EntityDamageEvent event) + { + if (event.getCause() != DamageCause.VOID) + return; + + if (!_players.contains(event.getEntity())) + return; + + event.getEntity().teleport(_spawn); + } + + @EventHandler + public void UpdateGPScoreboard(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) + return; + + for (GP gp : _live) + { + if (gp.GetState() != GPState.Ended && gp.GetTrack().GetState() != TrackState.Countdown) + { + gp.UpdateScoreBoard(); + } + } + } + + @EventHandler + public void UpdateGP(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet remove = new HashSet(); + + for (GP gp : _live) + { + if (gp.GetState() == GPState.Ended) + { + remove.add(gp); + continue; + } + + if (gp.GetTrack().GetState() == TrackState.Countdown) + { + gp.GetTrack().SpawnTeleport(); + } + + if (gp instanceof GPBattle) + ((GPBattle)gp).CheckBattleEnd(); + + gp.GetTrack().Update(); + } + + for (GP gp : remove) + { + gp.Unload(); + _live.remove(gp); + } + } + + @EventHandler + public void UpdateGPResult(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + HashSet remove = new HashSet(); + + for (GPResult result : _results) + { + if (result.End()) + remove.add(result); + } + + for (GPResult result : remove) + { + _results.remove(result); + _plugin.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() + { + public void run() + { + _plugin.getServer().shutdown(); + } + }, 100L); + } + } + + @EventHandler + public void CreatureSpawn(CreatureSpawnEvent event) + { + if (event.getSpawnReason() == SpawnReason.NATURAL || event.getSpawnReason() == SpawnReason.DEFAULT || event.getSpawnReason() == SpawnReason.EGG) + event.setCancelled(true); + } + + @EventHandler + public void BlockSpread(BlockSpreadEvent event) + { + event.setCancelled(true); + } + + public GPResult CreateResult(GP gp) + { + GPResult result = new GPResult(gp, _donationManager); + _results.add(result); + return result; + } + + public void DeleteResult(GPResult result) + { + _results.remove(result); + } + + @EventHandler + public void HandleChat(AsyncPlayerChatEvent event) + { + event.setCancelled(true); + + final String message = event.getMessage(); + final Player sender = event.getPlayer(); + final GP senderGP = GetGP(event.getPlayer()); + + //Talk to GP + if (senderGP != null) + { + _plugin.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() + { + public void run() + { + senderGP.Announce(C.cYellow + sender.getName() + " " + C.cWhite + message); + } + }, 0); + } + else + { + for (Player player : UtilServer.getPlayers()) + { + if (GetGP(player) != null) + continue; + + final Player recipient = player; + + _plugin.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() + { + public void run() + { + UtilPlayer.message(recipient, C.cYellow + sender.getName() + " " + C.cWhite + message); + } + }, 0); + } + } + } + + public boolean InGame(Player player) + { + return GetGP(player) != null; + } + + public GPSet GetSet() + { + if (_set == null) + { + File file = new File("GPSet.dat"); + + //Write If Blank + if (!file.exists()) + { + try + { + FileWriter fstream = new FileWriter(file); + BufferedWriter out = new BufferedWriter(fstream); + + out.write("MushroomCup"); + + out.close(); + } + catch (Exception e) + { + System.out.println("Error: GP Set Write Exception"); + } + } + + //Read + try + { + FileInputStream fstream = new FileInputStream(file); + DataInputStream in = new DataInputStream(fstream); + BufferedReader br = new BufferedReader(new InputStreamReader(in)); + String line = br.readLine(); + + _set = GPSet.valueOf(line); + + in.close(); + } + catch (Exception e) + { + System.out.println("Error: GP Set Read Exception"); + } + } + + if (_set == null) + { + return GPSet.MushroomCup; + } + + return _set; + } + + public Teleport GetTeleport() + { + return _teleport; + } + + public Recharge GetRecharge() + { + return _recharge; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/GPResult.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/GPResult.java new file mode 100644 index 000000000..876ae2b62 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/GPResult.java @@ -0,0 +1,258 @@ +package nautilus.game.minekart.gp; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import mineplex.core.common.util.FileUtil; +import mineplex.core.common.util.FireworkUtil; +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.WorldChunkLoader; +import mineplex.core.common.util.WorldLoadInfo; +import mineplex.core.common.util.WorldUtil; +import mineplex.core.donation.DonationManager; +import mineplex.core.fakeEntity.FakeEntity; +import mineplex.core.fakeEntity.FakePlayer; +import nautilus.game.minekart.kart.Kart; +import nautilus.minecraft.core.utils.ZipUtil; +import net.minecraft.server.v1_6_R2.EntityPlayer; + +import org.apache.commons.lang.math.RandomUtils; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.WorldCreator; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; + +public class GPResult +{ + private GPManager Manager; + + private String _file = "Result"; + + private World _world; + private GP _gp; + + private boolean _initialized = false; + + private long _time; + + private Kart _first; + private Kart _second; + private Kart _third; + + private List _fireworkLocations; + + public GPResult(GP gp, DonationManager manager) + { + Manager = gp.Manager; + + _gp = gp; + + _time = System.currentTimeMillis(); + + List sortedScores = new ArrayList(_gp.GetKarts()); + Collections.sort(sortedScores, new ScoreComparator(_gp)); + + int buffer = (_gp instanceof GPBattle ? 9 : 14); + + if (_gp.GetTrack().GetPositions().size() > 0 && sortedScores.size() > 0) + { + _first = sortedScores.get(0); + manager.RewardGems(_first.GetDriver().getName(), 8 * _gp.GetPlayers().size() + buffer); + } + + buffer += 2; + + if (_gp.GetTrack().GetPositions().size() > 1 && sortedScores.size() > 1) + { + _second = sortedScores.get(1); + manager.RewardGems(_second.GetDriver().getName(), 5 * _gp.GetPlayers().size() + buffer); + } + + buffer += 2; + + if (_gp.GetTrack().GetPositions().size() > 2 && sortedScores.size() > 2) + { + _third = sortedScores.get(2); + manager.RewardGems(_third.GetDriver().getName(), 2 * _gp.GetPlayers().size() + buffer); + } + + buffer += 2; + + for (int i = 3; i < sortedScores.size(); i++) + { + manager.RewardGems(sortedScores.get(i).GetDriver().getName(), buffer); + } + + _fireworkLocations = new ArrayList(5); + + Initialise(); + } + + public void TeleportPlayers() + { + Location loc = new Location(_world, 10, 23, -22); + loc.setYaw(180); + + FakePlayer firstPlayer = null; + FakePlayer secondPlayer = null; + FakePlayer thirdPlayer = null; + + FakeEntity firstKart = null; + FakeEntity secondKart = null; + FakeEntity thirdKart = null; + + if (_first != null) + { + Location location = new Location(_world, 10, 25, -29); + firstPlayer = new FakePlayer(_first.GetDriver().getName(), location); + firstKart = new FakeEntity(_first.GetEntity().GetEntityType(), location); + } + + if (_second != null) + { + Location location = new Location(_world, 6, 24, -29); + secondPlayer = new FakePlayer(_second.GetDriver().getName(), location); + secondKart = new FakeEntity(_second.GetEntity().GetEntityType(), location); + } + + if (_third != null) + { + Location location = new Location(_world, 14, 23, -29); + thirdPlayer = new FakePlayer(_third.GetDriver().getName(), location); + thirdKart = new FakeEntity(_third.GetEntity().GetEntityType(), location); + } + + for (Player player : _gp.GetPlayers()) + { + if (!player.isOnline()) + continue; + + Manager.GetTeleport().TP(player, loc); + + EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle(); + + if (_first != null) + { + entityPlayer.playerConnection.sendPacket(firstPlayer.Spawn()); + entityPlayer.playerConnection.sendPacket(firstKart.Spawn()); + entityPlayer.playerConnection.sendPacket(firstKart.SetPassenger(firstPlayer.GetEntityId())); + } + + if (_second != null) + { + entityPlayer.playerConnection.sendPacket(secondPlayer.Spawn()); + entityPlayer.playerConnection.sendPacket(secondKart.Spawn()); + entityPlayer.playerConnection.sendPacket(secondKart.SetPassenger(secondPlayer.GetEntityId())); + } + + if (_third != null) + { + entityPlayer.playerConnection.sendPacket(thirdPlayer.Spawn()); + entityPlayer.playerConnection.sendPacket(thirdKart.Spawn()); + entityPlayer.playerConnection.sendPacket(thirdKart.SetPassenger(thirdPlayer.GetEntityId())); + } + } + } + + public void Initialise() + { + UtilServer.getServer().getScheduler().runTaskAsynchronously(Manager.GetPlugin(), new Runnable() + { + public void run() + { + //Unzip + UnzipWorld(); + + SetLocations(); + + //Load Track Data Sync + UtilServer.getServer().getScheduler().runTask(Manager.GetPlugin(), new Runnable() + { + public void run() + { + WorldChunkLoader.AddWorld(new WorldLoadInfo(_world, -5, -6, 5, 2), new Runnable() + { + public void run() + { + _initialized = true; + TeleportPlayers(); + } + }); + } + }); + } + }); + } + + protected void SetLocations() + { + _fireworkLocations.add(new Location(_world, -9.5, 42, -54.5)); + _fireworkLocations.add(new Location(_world, 29.5, 42, -54.5)); + _fireworkLocations.add(new Location(_world, 32.5, 43, -77.5)); + _fireworkLocations.add(new Location(_world, -12.5, 43, -77.5)); + _fireworkLocations.add(new Location(_world, 10, 61, -61)); + } + + public void UnzipWorld() + { + //Unzip + String folder = _gp.GetId() + "-" + _gp.GetSet().GetName() + "-" + _file; + new File(folder).mkdir(); + new File(folder + File.separatorChar + "region").mkdir(); + new File(folder + File.separatorChar + "data").mkdir(); + ZipUtil.UnzipToDirectory(_file + ".zip", folder); + + //Start World + _world = WorldUtil.LoadWorld(new WorldCreator(folder)); + } + + public void Uninitialise() + { + MapUtil.UnloadWorld(Manager.GetPlugin(), _world); + MapUtil.ClearWorldReferences(_world.getName()); + FileUtil.DeleteFolder(new File(_world.getName())); + + _first = null; + _second = null; + _third = null; + + _fireworkLocations.clear(); + + _world = null; + } + + public boolean End() + { + if (!_initialized) + return false; + + if (!UtilTime.elapsed(_time, 30000)) + { + FireworkUtil.LaunchRandomFirework(_fireworkLocations.get(RandomUtils.nextInt(5))); + + return false; + } + + for (Player player : _gp.GetPlayers()) + { + Manager.Portal.SendPlayerToServer(player, "Lobby"); + } + + //Clean + _gp.GetPlayers().clear(); + _gp = null; + Uninitialise(); + + return true; + } + + public void RemovePlayer(Player player) + { + _gp.RemovePlayer(player, null); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/GPSet.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/GPSet.java new file mode 100644 index 000000000..f6f753505 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/GPSet.java @@ -0,0 +1,47 @@ +package nautilus.game.minekart.gp; + +import org.bukkit.Material; + +public enum GPSet +{ + MushroomCup("Mushroom Cup", new String[] {"MushroomA", "MushroomB", "MushroomC", "MushroomD"}, Material.RAW_CHICKEN, false), + FlowerCup( "Flower Cup", new String[] {"MushroomA", "MushroomB", "MushroomC", "MushroomD"}, Material.COOKED_CHICKEN, false), + StarCup( "Star Cup", new String[] {"MushroomA", "MushroomB", "MushroomC", "MushroomD"}, Material.CARROT_ITEM, false), + SpecialCup( "Special Cup", new String[] {"MushroomA", "MushroomB", "MushroomC", "MushroomD"}, Material.GOLDEN_CARROT, false), + + Battle("Battle", new String[] {"BattleA", "BattleB", "BattleC"}, Material.RAW_BEEF, true); + + + private String _name; + private String[] _mapNames; + private Material _displayMat; + private boolean _battle; + + GPSet(String name, String[] mapNames, Material mat, boolean battle) + { + _name = name; + _mapNames = mapNames; + _displayMat = mat; + _battle = battle; + } + + public String GetName() + { + return _name; + } + + public String[] GetMapNames() + { + return _mapNames; + } + + public Material GetDisplayMaterial() + { + return _displayMat; + } + + public boolean IsBattle() + { + return _battle; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/ScoreComparator.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/ScoreComparator.java new file mode 100644 index 000000000..768a3e70f --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/ScoreComparator.java @@ -0,0 +1,27 @@ +package nautilus.game.minekart.gp; + +import java.util.Comparator; + +import nautilus.game.minekart.kart.Kart; + +public class ScoreComparator implements Comparator +{ + private GP _gp; + + public ScoreComparator(GP gp) + { + _gp = gp; + } + + @Override + public int compare(Kart kart1, Kart kart2) + { + if (_gp.GetScore(kart1) > _gp.GetScore(kart2)) + return -1; + + if (_gp.GetScore(kart1) == _gp.GetScore(kart2)) + return 0; + + return 1; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/GpCommand.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/GpCommand.java new file mode 100644 index 000000000..691934dba --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/GpCommand.java @@ -0,0 +1,26 @@ +package nautilus.game.minekart.gp.command; + +import org.bukkit.entity.Player; + +import nautilus.game.minekart.gp.GPManager; +import nautilus.game.minekart.gp.command.gp.FinishCommand; +import nautilus.game.minekart.gp.command.gp.StartCommand; +import mineplex.core.command.MultiCommandBase; +import mineplex.core.common.Rank; + +public class GpCommand extends MultiCommandBase +{ + public GpCommand(GPManager plugin) + { + super(plugin, Rank.MODERATOR, "gp"); + + AddCommand(new StartCommand(plugin)); + AddCommand(new FinishCommand(plugin)); + } + + @Override + protected void Help(Player caller, String[] args) + { + + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/ItemCommand.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/ItemCommand.java new file mode 100644 index 000000000..c35b26ede --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/ItemCommand.java @@ -0,0 +1,32 @@ +package nautilus.game.minekart.gp.command; + +import org.bukkit.entity.Player; + +import nautilus.game.minekart.gp.GPManager; +import nautilus.game.minekart.item.KartItemType; +import nautilus.game.minekart.kart.Kart; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.UtilEnum; + +public class ItemCommand extends CommandBase +{ + public ItemCommand(GPManager plugin) + { + super(plugin, Rank.MODERATOR, "item"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 1) + return; + + Kart kart = Plugin.KartManager.GetKart(caller); + + KartItemType kartItem = UtilEnum.fromString(KartItemType.class, args[0]); + + if (kart != null) + kart.SetItemStored(kartItem); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/KartCommand.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/KartCommand.java new file mode 100644 index 000000000..6d98dc25f --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/KartCommand.java @@ -0,0 +1,31 @@ +package nautilus.game.minekart.gp.command; + +import org.bukkit.entity.Player; + +import nautilus.game.minekart.gp.GPManager; +import nautilus.game.minekart.kart.KartType; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; + +public class KartCommand extends CommandBase +{ + public KartCommand(GPManager plugin) + { + super(plugin, Rank.ADMIN, "kart"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 1) + return; + + for (KartType type : KartType.values()) + { + if (args[0].equalsIgnoreCase(type.GetName())) + { + Plugin.SelectKart(caller, type); + } + } + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/VoteCommand.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/VoteCommand.java new file mode 100644 index 000000000..2cb65b741 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/VoteCommand.java @@ -0,0 +1,21 @@ +package nautilus.game.minekart.gp.command; + +import org.bukkit.entity.Player; + +import nautilus.game.minekart.gp.GPManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; + +public class VoteCommand extends CommandBase +{ + public VoteCommand(GPManager plugin) + { + super(plugin, Rank.ALL, "vote"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.Vote(caller); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/gp/FinishCommand.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/gp/FinishCommand.java new file mode 100644 index 000000000..288ec221b --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/gp/FinishCommand.java @@ -0,0 +1,38 @@ +package nautilus.game.minekart.gp.command.gp; + +import org.bukkit.entity.Player; + +import nautilus.game.minekart.gp.GP; +import nautilus.game.minekart.gp.GP.GPState; +import nautilus.game.minekart.gp.GPManager; +import nautilus.game.minekart.kart.Kart; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; + +public class FinishCommand extends CommandBase +{ + public FinishCommand(GPManager plugin) + { + super(plugin, Rank.MODERATOR, "finish"); + } + + @Override + public void Execute(Player caller, String[] args) + { + GP race = Plugin.GetGP(caller); + if (race == null) + { + caller.sendMessage("You are not in a race"); + return; + } + + if (race.GetState() != GPState.Live) + { + caller.sendMessage("Your race is not live..."); + return; + } + + for (Kart kart : race.GetKarts()) + kart.SetLap(4); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/gp/StartCommand.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/gp/StartCommand.java new file mode 100644 index 000000000..432cea324 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/command/gp/StartCommand.java @@ -0,0 +1,21 @@ +package nautilus.game.minekart.gp.command.gp; + +import org.bukkit.entity.Player; + +import nautilus.game.minekart.gp.GPManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; + +public class StartCommand extends CommandBase +{ + public StartCommand(GPManager plugin) + { + super(plugin, Rank.MODERATOR, "start"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.StartGP(true); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/KartItemActive.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/KartItemActive.java new file mode 100644 index 000000000..c53b5232f --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/KartItemActive.java @@ -0,0 +1,49 @@ +package nautilus.game.minekart.item; + +import java.util.List; + +import nautilus.game.minekart.kart.Kart; + +public abstract class KartItemActive +{ + public enum ActiveType + { + Behind, + Orbit, + Trail + } + + private Kart _kart; + private ActiveType _type; + private List _ents; + + public KartItemActive(KartItemManager manager, Kart kart, ActiveType type, List ents) + { + _kart = kart; + _type = type; + _ents = ents; + + for (KartItemEntity item : ents) + item.SetHost(this); + + kart.SetItemActive(this); + manager.RegisterKartItem(this); + } + + public Kart GetKart() + { + return _kart; + } + + public ActiveType GetType() + { + return _type; + } + + public List GetEntities() + { + return _ents; + } + + public abstract boolean Use(); +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/KartItemEntity.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/KartItemEntity.java new file mode 100644 index 000000000..6bc423bb7 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/KartItemEntity.java @@ -0,0 +1,164 @@ +package nautilus.game.minekart.item; + +import nautilus.game.minekart.item.control.Movement; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.track.Track; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +public abstract class KartItemEntity +{ + public KartItemManager Manager; + + private Track _track; + + private Material _mat; + private byte _data; + + private KartItemActive _host; + + private Entity _entity; + private Vector _velocity; + private long _fireTime; + + private Kart _owner; + private Kart _target; + + private double _radius = 2; + + public KartItemEntity(KartItemManager manager, Kart owner, Location loc, Material mat, byte data) + { + Manager = manager; + + _owner = owner; + _track = owner.GetGP().GetTrack(); + + _mat = mat; + _data = data; + + _host = null; + + Spawn(loc); + + manager.RegisterWorldItem(this); + } + + @SuppressWarnings("deprecation") + public void Spawn(Location loc) + { + SetEntity(loc.getWorld().dropItem(loc.add(0, 0.5, 0), new ItemStack(_mat, 1, (short)0, _data))); + SetFired(); + } + + public void SetEntity(Entity ent) + { + _entity = ent; + } + + public Entity GetEntity() + { + return _entity; + } + + public Material GetMaterial() + { + return _mat; + } + + public void SetRadius(double rad) + { + _radius = rad; + } + + public void SetVelocity(Vector vel) + { + _velocity = vel; + } + + public Vector GetVelocity() + { + return _velocity; + } + + public Vector GetVelocityClone() + { + return new Vector(_velocity.getX(), _velocity.getY(), _velocity.getZ()); + } + + public Kart GetOwner() + { + return _owner; + } + + public void SetTarget(Kart kart) + { + _target = kart; + } + + public Kart GetTarget() + { + return _target; + } + + public long GetFireTime() + { + return _fireTime; + } + + public void SetFired() + { + _fireTime = System.currentTimeMillis(); + } + + public void SetFiredAdd(long time) + { + _fireTime = System.currentTimeMillis() + time; + } + + public KartItemActive GetHost() + { + return _host; + } + + public void SetHost(KartItemActive host) + { + _host = host; + } + + public double GetRadius() + { + return _radius; + } + + public abstract void CollideHandle(Kart kart); + + public boolean TickUpdate() + { + if (GetHost() != null) + return false; + + Movement.Move(this); + + return false; + } + + public void Clean() + { + if (_entity == null) + return; + + if (_entity.getPassenger() != null) + _entity.getPassenger().remove(); + + _entity.remove(); + } + + public Track GetTrack() + { + return _track; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/KartItemManager.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/KartItemManager.java new file mode 100644 index 000000000..23e95ecf5 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/KartItemManager.java @@ -0,0 +1,375 @@ +package nautilus.game.minekart.item; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Sound; +import org.bukkit.entity.Egg; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.minekart.gp.GPBattle; +import nautilus.game.minekart.item.KartItemActive.ActiveType; +import nautilus.game.minekart.item.control.Collision; +import nautilus.game.minekart.item.control.Movement; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartManager; +import nautilus.game.minekart.kart.crash.Crash_Explode; + +public class KartItemManager extends MiniPlugin +{ + public KartManager KartManager; + + private HashMap> _itemSelection = new HashMap>(); + + private HashSet _kartItems = new HashSet(); + private HashSet _worldItems = new HashSet(); + + public KartItemManager(JavaPlugin plugin, KartManager kartManager) + { + super("Kart Item Manager", plugin); + + KartManager = kartManager; + } + + @EventHandler + public void UseItem(PlayerDropItemEvent event) + { + Kart kart = KartManager.GetKart(event.getPlayer()); + if (kart == null) return; + + event.setCancelled(true); + + KartItemActive active = kart.GetItemActive(); + if (active != null) + { + if (active.Use()) + { + //Depleted + kart.SetItemActive(null); + + //Due to Auto-Activate + ItemDecrement(kart); + + GetKartItems().remove(active); + + //Sound + kart.GetDriver().playSound(kart.GetDriver().getLocation(), kart.GetKartType().GetSoundMain(), 2f, 1f); + } + + return; + } + + KartItemType type = kart.GetItemStored(); + if (type != null) + { + if (kart.GetItemCycles() > 10) + { + kart.SetItemCycles(kart.GetItemCycles() - 3); + return; + } + else if (kart.GetItemCycles() <= 0) + { + type.GetAction().Use(this, kart); + + //Sound + kart.GetDriver().playSound(kart.GetDriver().getLocation(), kart.GetKartType().GetSoundMain(), 2f, 1f); + } + } + } + + @EventHandler + public void CancelPickup(PlayerPickupItemEvent event) + { + for (KartItemEntity item : GetWorldItems()) + if (item.GetEntity() != null && item.GetEntity().equals(event.getItem())) + { + event.setCancelled(true); + return; + } + + //Not Map Item + event.setCancelled(true); + event.getItem().remove(); + } + + @EventHandler + public void CancelTarget(EntityTargetEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void EggHit(EntityDamageEvent event) + { + if (!(event instanceof EntityDamageByEntityEvent)) + return; + + EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent)event; + + if (!(eventEE.getDamager() instanceof Egg)) + return; + + Egg egg = (Egg)eventEE.getDamager(); + + if (egg.getShooter() == null) + return; + + if (!(egg.getShooter() instanceof Player)) + return; + + if (!(event.getEntity() instanceof Player)) + return; + + Player damager = (Player)egg.getShooter(); + Player damagee = (Player)event.getEntity(); + + Kart kart = KartManager.GetKart(damagee); + if (kart == null) return; + + new Crash_Explode(kart, 0.3f, false); + + //Inform + if (damager.equals(damagee)) + { + UtilPlayer.message(damagee, F.main("MK", "You hit yourself with " + F.item("Egg Blaster") + ".")); + } + else + { + UtilPlayer.message(damagee, F.main("MK", F.elem(damager.getName()) + " hit you with " + F.item("Egg Blaster") + ".")); + UtilPlayer.message(damager, F.main("MK", "You hit " + F.elem(damagee.getName()) + " with " + F.item("Egg Blaster") + ".")); + } + } + + @EventHandler + public void KartItemCycle(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) + return; + + for (Kart kart : KartManager.GetKarts().values()) + { + if (kart.GetItemCycles() > 0) + { + //Selected + if (kart.GetItemCycles() < 10) + { + //End Sound + if (kart.GetItemCycles()%3 == 0) + kart.GetDriver().playSound(kart.GetDriver().getLocation(), Sound.NOTE_PLING, 0.4f, 2f); + } + //Random + else + { + //Sound + kart.GetDriver().playSound(kart.GetDriver().getLocation(), Sound.NOTE_PLING, 0.2f, 1f + (10 - (kart.GetItemCycles()%10)) *0.05f); + + KartItemType next = GetNewItem(kart); + + //Ensure it doesnt cycle item twice in a row + while (next.equals(kart.GetItemStored())) + next = GetNewItem(kart); + + kart.SetItemStored(next); + } + + kart.SetItemCycles(kart.GetItemCycles() - 1); + + //Auto Activate + if (kart.GetItemCycles() == 0) + { + if (kart.GetItemStored() == KartItemType.Banana || + kart.GetItemStored() == KartItemType.BananaBunch || + kart.GetItemStored() == KartItemType.SingleGreenShell || + kart.GetItemStored() == KartItemType.DoubleGreenShell || + kart.GetItemStored() == KartItemType.TripleGreenShell || + kart.GetItemStored() == KartItemType.SingleRedShell || + kart.GetItemStored() == KartItemType.DoubleRedShell || + kart.GetItemStored() == KartItemType.TripleRedShell) + { + kart.GetItemStored().GetAction().Use(this, kart); + } + } + } + //Remove Stored, if active is gone + else if (kart.GetItemActive() == null && kart.GetItemStored() != null) + { + ItemDecrement(kart); + } + } + } + + public void ItemDecrement(Kart kart) + { + if (kart.GetItemStored() == KartItemType.Banana || + kart.GetItemStored() == KartItemType.SingleGreenShell || + kart.GetItemStored() == KartItemType.SingleRedShell) + { + kart.SetItemStored(null); + } + + if (kart.GetItemStored() == KartItemType.BananaBunch) + { + ItemStack item = kart.GetDriver().getInventory().getItem(3); + + if (item == null || item.getAmount() == 1) + { + kart.SetItemStored(null); + } + else + { + item.setAmount(item.getAmount() - 1); + kart.GetItemStored().GetAction().Use(this, kart); + } + } + + if (kart.GetItemStored() == KartItemType.DoubleGreenShell) + { + kart.SetItemStored(KartItemType.SingleGreenShell); + kart.GetItemStored().GetAction().Use(this, kart); + } + + if (kart.GetItemStored() == KartItemType.TripleGreenShell) + { + kart.SetItemStored(KartItemType.DoubleGreenShell); + kart.GetItemStored().GetAction().Use(this, kart); + } + + if (kart.GetItemStored() == KartItemType.DoubleRedShell) + { + kart.SetItemStored(KartItemType.SingleRedShell); + kart.GetItemStored().GetAction().Use(this, kart); + } + + if (kart.GetItemStored() == KartItemType.TripleRedShell) + { + kart.SetItemStored(KartItemType.DoubleRedShell); + kart.GetItemStored().GetAction().Use(this, kart); + } + } + + @EventHandler + public void KartItemUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (KartItemActive active : GetKartItems()) + { + if (active.GetType() == ActiveType.Behind) + Movement.Behind(active.GetKart(), active.GetEntities()); + + if (active.GetType() == ActiveType.Orbit) + Movement.Orbit(active.GetKart(), active.GetEntities()); + + if (active.GetType() == ActiveType.Trail) + Movement.Trail(active.GetKart(), active.GetEntities()); + } + } + + @EventHandler + public void WorldItemUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet remove = new HashSet(); + + for (KartItemEntity item : GetWorldItems()) + { + if (item.GetTrack() == null || item.GetTrack().GetWorld() == null) + { + remove.add(item); + continue; + } + + if (remove.contains(item)) + continue; + + if (item.TickUpdate()) + remove.add(item); + + //Collide with Items + KartItemEntity other = Collision.CollideItem(item, GetWorldItems()); + if (other != null) + { + remove.add(item); + remove.add(other); + } + + //Collide with Players + if (Collision.CollidePlayer(item, KartManager.GetKarts().values())) + remove.add(item); + } + + for (KartItemEntity item : remove) + { + if (item.GetHost() != null) + { + item.GetHost().GetEntities().remove(item); + + if (item.GetHost().GetEntities().isEmpty()) + { + item.GetHost().GetKart().SetItemActive(null); + GetKartItems().remove(item.GetHost()); + } + } + + item.Clean(); + + _worldItems.remove(item); + } + } + + public void RegisterKartItem(KartItemActive item) + { + _kartItems.add(item); + } + + public void RegisterWorldItem(KartItemEntity item) + { + _worldItems.add(item); + } + + public HashSet GetKartItems() + { + return _kartItems; + } + + public HashSet GetWorldItems() + { + return _worldItems; + } + + public KartItemType GetNewItem(Kart kart) + { + if (Math.random() > 1 - kart.GetKartType().GetKartItem().GetChance()) + return kart.GetKartType().GetKartItem(); + + int pos = kart.GetLapPlace(); + + if (kart.GetGP() instanceof GPBattle) + pos = -1; + + if (!_itemSelection.containsKey(pos)) + _itemSelection.put(pos, KartItemType.GetItem(pos)); + + ArrayList itemBag = _itemSelection.get(pos); + + return itemBag.get(UtilMath.r(itemBag.size())); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/KartItemType.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/KartItemType.java new file mode 100644 index 000000000..c012498a8 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/KartItemType.java @@ -0,0 +1,239 @@ +package nautilus.game.minekart.item; + +import java.util.ArrayList; + +import org.bukkit.ChatColor; +import org.bukkit.Material; + +import mineplex.core.common.util.C; +import nautilus.game.minekart.item.use_custom.*; +import nautilus.game.minekart.item.use_default.*; + +public enum KartItemType +{ + //Default + Banana( "Banana", Material.GOLD_INGOT, 1, new UseBanana()), + BananaBunch( "Banana Bunch", Material.GOLD_SPADE, 6, new UseBanana()), + FakeItem( "Fake Item", Material.FLINT, 1, new UseFakeItem()), + + SingleGreenShell( "Green Shell", Material.SLIME_BALL, 1, new UseGreenShell()), + DoubleGreenShell( "2x Green Shell", Material.MELON_SEEDS, 1, new UseGreenShell()), + TripleGreenShell( "3x Green Shell", Material.PUMPKIN_SEEDS, 1, new UseGreenShell()), + + SingleRedShell( "Red Shell", Material.MAGMA_CREAM, 1, new UseRedShell()), + DoubleRedShell( "2x Red Shell", Material.RAW_FISH, 1, new UseRedShell()), + TripleRedShell( "3x Red Shell", Material.COOKED_FISH, 1, new UseRedShell()), + + Ghost( "Ghost", Material.GHAST_TEAR, 1, new UseGhost()), + Star( "Star", Material.NETHER_STAR, 1, new UseStar()), + Lightning( "Lightning", Material.GLOWSTONE_DUST, 1, new UseLightning()), + + SingleMushroom( "1x Mushroom", Material.BREAD, 1, new UseMushroom()), + DoubleMushroom( "2x Mushroom", Material.BOWL, 1, new UseMushroom()), + TripleMushroom( "3x Mushroom", Material.MUSHROOM_SOUP, 1, new UseMushroom()), + SuperMushroom( "Super Mushroom", Material.GOLDEN_APPLE, 1, new UseMushroom()), + + //Custom + Chicken("Egg Blaster", Material.EGG, 16, 0.16, new UseChicken(), new String[] + { + "", + ChatColor.RESET + C.cWhite + "16-Round Egg Blaster.", + }), + + Pig("Pig Stink", Material.PORK, 1, 0.12, new UsePig(), new String[] + { + "", + ChatColor.RESET + C.cWhite + "Confuses all players.", + ChatColor.RESET + C.cWhite + "Lasts 20 seconds" + }), + + Wolf("Heart Barrier", Material.APPLE, 1, 0.16, new UseWolf(), new String[] + { + "", + ChatColor.RESET + C.cWhite + "Blocks 1 Shell/Banana/Fake Item", + ChatColor.RESET + C.cWhite + "Lasts 60 Seconds" + }), + + Spider("Spiderlings", Material.SEEDS, 1, 0.16, new UseSpider(), new String[] + { + "", + ChatColor.RESET + C.cWhite + "Release 1 Spiderling at each player.", + ChatColor.RESET + C.cWhite + "Spiderlings hunt players, causing a crash.", + ChatColor.RESET + C.cWhite + "Lasts 15 seconds." + }), + + Blaze("Infernal Kart", Material.BLAZE_POWDER, 1, 0.16, new UseBlaze(), new String[] + { + "", + ChatColor.RESET + C.cWhite + "Boost forwards with amazing handling.", + ChatColor.RESET + C.cWhite + "Leaves a trail of flames, slowing players." + }), + + Sheep("Super Sheep", Material.IRON_SPADE, 1, 0.08, new UseSheep(), new String[] + { + "", + ChatColor.RESET + C.cWhite + "Super Sheep flies around the track.", + ChatColor.RESET + C.cWhite + "Hunts down other nearby players.", + ChatColor.RESET + C.cWhite + "Lasts 15 seconds" + }), + + Enderman("Blink", Material.ENDER_PEARL, 1, 0.16, new UseEnderman(), new String[] + { + "", + ChatColor.RESET + C.cWhite + "Instantly teleport forward 20 blocks.", + ChatColor.RESET + C.cWhite + "Converts velocity into new direction.", + ChatColor.RESET + C.cWhite + "3 Uses." + }), + + Cow("Stampede", Material.DIAMOND_SPADE, 1, 0.16, new UseCow(), new String[] + { + "", + ChatColor.RESET + C.cWhite + "Angry cows charge foward at players." + }), + + Golem("Earthquake", Material.COAL, 1, 0.08, new UseGolem(), new String[] + { + "", + ChatColor.RESET + C.cWhite + "Halves all players velocity.", + ChatColor.RESET + C.cWhite + "Enemies are propelled upwards.", + ChatColor.RESET + C.cWhite + "More powerful at close range." + }); + + private String _name; + private Material _mat; + private int _amount; + + private ItemUse _action; + + private double _chance = 0; + private String[] _customDesc = new String[] {"Default"}; + + KartItemType(String name, Material mat, int amount, ItemUse action) + { + _name = name; + _mat = mat; + _amount = amount; + _action = action; + } + + KartItemType(String name, Material mat, int amount, double customChance, ItemUse action, String[] customString) + { + _name = name; + _mat = mat; + _amount = amount; + + _action = action; + + _chance = customChance; + _customDesc = customString; + } + + public String GetName() + { + return _name; + } + + public ItemUse GetAction() + { + return _action; + } + + public Material GetMaterial() + { + return _mat; + } + + public int GetAmount() + { + return _amount; + } + + public double GetChance() + { + return _chance; + } + + public String[] GetDesc() + { + return _customDesc; + } + + public static ArrayList GetItem(int pos) + { + ArrayList itemBag = new ArrayList(); + + if (pos == -1) + { + for (int i=1 ; i>0 ; i--) + itemBag.add(KartItemType.Star); + + for (int i=1 ; i>0 ; i--) + itemBag.add(KartItemType.Ghost); + + for (int i=1 ; i>0 ; i--) + itemBag.add(KartItemType.TripleRedShell); + + for (int i=2 ; i>0 ; i--) + itemBag.add(KartItemType.TripleGreenShell); + + for (int i=2 ; i>0 ; i--) + itemBag.add(KartItemType.BananaBunch); + + for (int i=2 ; i>0 ; i--) + itemBag.add(KartItemType.FakeItem); + + for (int i=3 ; i>0 ; i--) + itemBag.add(KartItemType.SingleRedShell); + + for (int i=3 ; i>0 ; i--) + itemBag.add(KartItemType.Banana); + + for (int i=4 ; i>0 ; i--) + itemBag.add(KartItemType.SingleGreenShell); + } + + else + { + for (int i=20 - (3 * 9-pos) ; i>0 ; i--) + itemBag.add(KartItemType.Lightning); + + for (int i=20 - (2 * 9-pos) ; i>0 ; i--) + itemBag.add(KartItemType.Star); + + for (int i=20 - (2 * 9-pos) ; i>0 ; i--) + itemBag.add(KartItemType.SuperMushroom); + + for (int i=20 - (2 * 9-pos) ; i>0 ; i--) + itemBag.add(KartItemType.Ghost); + + for (int i=20 - (2 * 9-pos) ; i>0 ; i--) + itemBag.add(KartItemType.TripleRedShell); + + for (int i=20 - (1 * 9-pos) ; i>0 ; i--) + itemBag.add(KartItemType.TripleGreenShell); + + for (int i=20 - (1 * 9-pos) ; i>0 ; i--) + itemBag.add(KartItemType.TripleMushroom); + + for (int i=20 - (1 * 9-pos) ; i>0 ; i--) + itemBag.add(KartItemType.BananaBunch); + + for (int i=5 + (2 * 9-pos) ; i>0 ; i--) + itemBag.add(KartItemType.SingleRedShell); + + for (int i=10 + (2 * 9-pos) ; i>0 ; i--) + itemBag.add(KartItemType.SingleMushroom); + + for (int i=10 + (2 * 9-pos) ; i>0 ; i--) + itemBag.add(KartItemType.SingleGreenShell); + + for (int i=0 + (2 * 9-pos) ; i>0 ; i--) + itemBag.add(KartItemType.FakeItem); + + for (int i=0 + (2 * 9-pos) ; i>0 ; i--) + itemBag.add(KartItemType.Banana); + } + + return itemBag; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/control/Collision.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/control/Collision.java new file mode 100644 index 000000000..6d33f1ae1 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/control/Collision.java @@ -0,0 +1,144 @@ +package nautilus.game.minekart.item.control; + +import java.util.Collection; +import java.util.HashSet; + +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import nautilus.game.minekart.item.KartItemEntity; +import nautilus.game.minekart.item.world_items_default.RedShell; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartState; +import nautilus.game.minekart.kart.condition.ConditionType; + +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.util.Vector; + +public class Collision +{ + public static boolean CollideBlock(KartItemEntity item) + { + Entity ent = item.GetEntity(); + if (ent == null) return true; + + //Current Velocity + Vector vel = item.GetVelocity(); + if (vel == null) return true; + + if (vel.length() <= 0) + return true; + + boolean collided = false; + double range = 0.31; + + Block block; + + block = ent.getLocation().add(range, 0, 0).getBlock(); + if (vel.getX() > 0 && UtilBlock.solid(block)) {vel.setX(-vel.getX()); collided = true;} + + block = ent.getLocation().add(-range, 0, 0).getBlock(); + if (vel.getX() < 0 && UtilBlock.solid(block)) {vel.setX(-vel.getX()); collided = true;} + + block = ent.getLocation().add(0, 0, range).getBlock(); + if (vel.getZ() > 0 && UtilBlock.solid(block)) {vel.setZ(-vel.getZ()); collided = true;} + + block = ent.getLocation().add(0, 0, -range).getBlock(); + if (vel.getZ() < 0 && UtilBlock.solid(block)) {vel.setZ(-vel.getZ()); collided = true;} + + return collided; + } + + public static boolean CollidePlayer(KartItemEntity item, Collection allKarts) + { + if (item.GetEntity() == null) + return false; + + for (Kart kart : allKarts) + { + if (kart.GetKartState() == KartState.Lakitu) + continue; + + if (kart.HasCondition(ConditionType.Ghost)) + { + if (item instanceof RedShell) + if (item.GetTarget() != null && item.GetTarget().equals(kart)) + return true; + + continue; + } + + //Don't hit owner + if (item.GetOwner() != null && kart.equals(item.GetOwner())) + { + if (item.GetHost() != null) + continue; + + if (!UtilTime.elapsed(item.GetFireTime(), 1000)) + continue; + } + + if (UtilMath.offset(kart.GetDriver(), item.GetEntity()) < item.GetRadius() && kart.GetDriver().getWorld() == item.GetEntity().getWorld()) + { + item.CollideHandle(kart); + return true; + } + } + + return false; + } + + public static KartItemEntity CollideItem(KartItemEntity item, HashSet allItems) + { + if (item.GetEntity() == null) + return null; + + for (KartItemEntity other : allItems) + { + if (item.equals(other)) + continue; + + //Both Arent Moving + if (item.GetVelocity() == null && other.GetVelocity() == null) + continue; + + //Both Arent Moving + if ((item.GetVelocity() != null && item.GetVelocity().length() <= 0) && (item.GetVelocity() != null && item.GetVelocity().length() <= 0)) + continue; + + //Dont collide with friends on orbit! + if (item.GetHost() != null && other.GetHost() != null) + if (item.GetHost().equals(other.GetHost())) + continue; + + //Don't collide with friends after shot (same owner) + if (item.GetOwner() != null && other.GetOwner() != null && item.GetOwner().equals(other.GetOwner())) + { + //Item is trailing + if (item.GetHost() != null && other.GetHost() == null) + { + if (!UtilTime.elapsed(other.GetFireTime(), 1000)) + { + continue; + } + } + //Other is trailing + else if (item.GetHost() == null && other.GetHost() != null) + { + if (!UtilTime.elapsed(item.GetFireTime(), 1000)) + { + continue; + } + } + } + + if (UtilMath.offset(other.GetEntity(), item.GetEntity()) < item.GetRadius()) + { + return other; + } + } + + return null; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/control/Movement.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/control/Movement.java new file mode 100644 index 000000000..70e9ece7c --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/control/Movement.java @@ -0,0 +1,181 @@ +package nautilus.game.minekart.item.control; + +import java.lang.reflect.Field; +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_6_R2.CraftWorld; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import nautilus.game.minekart.item.KartItemEntity; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartUtil; +import nautilus.game.minekart.kart.condition.ConditionType; +import net.minecraft.server.v1_6_R2.EntityInsentient; +import net.minecraft.server.v1_6_R2.EntityLiving; +import net.minecraft.server.v1_6_R2.PathfinderGoalSelector; + +public class Movement +{ + public static void Move(KartItemEntity item) + { + if (item.GetEntity() == null) + return; + + if (item.GetVelocity() == null) + return; + + if (item.GetVelocity().length() <= 0) + return; + + //Attempt to fix glitch + item.GetEntity().teleport(item.GetEntity().getLocation()); + + //Apply Velocity + item.GetEntity().setVelocity(item.GetVelocity()); + } + + public static void Behind(Kart kart, List moons) + { + for (int i=0 ; i moons) + { + int i = 0; + for (KartItemEntity item : moons) + { + if (item.GetEntity() instanceof LivingEntity) + ClearGoals((LivingEntity)item.GetEntity()); + + double radialLead = i * ((2d * Math.PI)/moons.size()); + i++; + + Location desiredA = GetTarget(kart.GetDriver().getLocation(), kart.GetDriver().getTicksLived(), radialLead); + Location desiredB = GetTarget(kart.GetDriver().getLocation(), kart.GetDriver().getTicksLived() + 1, radialLead); + + double distA = UtilMath.offset(item.GetEntity().getLocation(), desiredA); + double distB = UtilMath.offset(item.GetEntity().getLocation(), desiredB); + double distAB = UtilMath.offset(desiredA, desiredB); + + if (distA > distB) + continue; + + if (distA < distAB / 2) + continue; + + Vector vel = UtilAlg.getTrajectory(item.GetEntity().getLocation(), desiredA); + + //Kart velocity + Vector kartVel = kart.GetVelocity(); + if (kart.GetCrash() != null && kart.GetCrash().GetVelocity() != null) + kartVel = kart.GetCrash().GetVelocity(); + kartVel.setY(0); + + vel.add(kartVel); + + UtilAction.velocity(item.GetEntity(), vel, 0.2 + kartVel.length(), false, 0, 0, 10, false); + } + } + + private static void ClearGoals(LivingEntity ent) + { + try + { + Field _goalSelector = EntityInsentient.class.getDeclaredField("goalSelector"); + _goalSelector.setAccessible(true); + Field _targetSelector = EntityInsentient.class.getDeclaredField("targetSelector"); + _targetSelector.setAccessible(true); + + EntityLiving creature = ((CraftLivingEntity)ent).getHandle(); + + PathfinderGoalSelector goalSelector = new PathfinderGoalSelector(((CraftWorld)ent.getWorld()).getHandle().methodProfiler); + + _goalSelector.set(creature, goalSelector); + _targetSelector.set(creature, new PathfinderGoalSelector(((CraftWorld)ent.getWorld()).getHandle().methodProfiler)); + } + catch (IllegalArgumentException e) + { + e.printStackTrace(); + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + catch (NoSuchFieldException e) + { + e.printStackTrace(); + } + catch (SecurityException e) + { + e.printStackTrace(); + } + } + + public static Location GetTarget(Location origin, int ticks, double radialLead) + { + //Orbit + double speed = 10d; + + double oX = Math.sin(ticks/speed + radialLead) * 1.5; + double oY = 0.5; + double oZ = Math.cos(ticks/speed + radialLead) * 1.5; + + return new Location(origin.getWorld(), origin.getX() + oX, origin.getY() + oY, origin.getZ() + oZ); + } + + public static void Trail(Kart kart, List moons) + { + for (int i=0 ; i 0) + target = moons.get(i-1).GetEntity(); + + double offset = UtilMath.offset(cur, target); + + Vector vel = UtilAlg.getTrajectory(cur, target); + + UtilAction.velocity(cur, vel, offset, false, 0, 0, 10, false); + } + } + + public static void Home(KartItemEntity item) + { + if (!UtilTime.elapsed(item.GetFireTime(), 800)) + return; + + if (item.GetEntity() == null || item.GetTarget() == null) + return; + + if (item.GetTarget().HasCondition(ConditionType.Ghost)) + return; + + Vector vec = UtilAlg.getTrajectory2d(item.GetEntity(), item.GetTarget().GetDriver()); + UtilAlg.Normalize(vec); + vec.multiply(1.2); + vec.setY(-0.4); + + item.SetVelocity(vec); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_active/ActiveBananas.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_active/ActiveBananas.java new file mode 100644 index 000000000..aed9dc633 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_active/ActiveBananas.java @@ -0,0 +1,36 @@ +package nautilus.game.minekart.item.use_active; + +import java.util.List; + +import nautilus.game.minekart.item.KartItemActive; +import nautilus.game.minekart.item.KartItemEntity; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.kart.Kart; + +public class ActiveBananas extends KartItemActive +{ + public ActiveBananas(KartItemManager manager, Kart kart, List ents) + { + super(manager, kart, ActiveType.Trail, ents); + } + + @Override + public boolean Use() + { + if (GetEntities().isEmpty()) + return true; + + //Find Closest to firing trajectory + KartItemEntity back = GetEntities().get(GetEntities().size() - 1); + + //Fire Shell + back.SetHost(null); + back.SetVelocity(null); + GetEntities().remove(back); + + //Counter Collision with driver + back.SetFired(); + + return GetEntities().isEmpty(); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_active/ActiveShells.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_active/ActiveShells.java new file mode 100644 index 000000000..f369e655b --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_active/ActiveShells.java @@ -0,0 +1,77 @@ +package nautilus.game.minekart.item.use_active; + +import java.util.List; + +import org.bukkit.Location; + +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import nautilus.game.minekart.item.KartItemActive; +import nautilus.game.minekart.item.KartItemEntity; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.world_items_default.RedShell; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartUtil; + +public class ActiveShells extends KartItemActive +{ + public ActiveShells(KartItemManager manager, Kart kart, List ents) + { + super(manager, kart, ActiveType.Orbit, ents); + } + + @Override + public boolean Use() + { + if (GetEntities().isEmpty()) + return true; + + //Find Closest to firing trajectory + Location loc = KartUtil.GetLook(GetKart()); + + KartItemEntity closest = null; + double closestDist = 10; + + for (KartItemEntity item : GetEntities()) + { + double dist = UtilMath.offset(item.GetEntity().getLocation(), loc); + + if (closest == null) + { + closest = item; + closestDist = dist; + continue; + } + + if (dist < closestDist) + { + closest = item; + closestDist = dist; + } + } + + //Fire Shell + closest.SetHost(null); + closest.SetVelocity(UtilAlg.Normalize(GetKart().GetDriver().getLocation().getDirection().setY(0))); + GetEntities().remove(closest); + + //Counter Collision with driver + closest.SetFired(); + + //Red Shell Chase + if (closest instanceof RedShell) + { + Kart target = null; + + for (Kart other : GetKart().GetGP().GetKarts()) + { + if (other.GetLapPlace() + 1 == GetKart().GetLapPlace()) + target = other; + } + + closest.SetTarget(target); + } + + return GetEntities().isEmpty(); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_active/ActiveStandard.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_active/ActiveStandard.java new file mode 100644 index 000000000..650d9d467 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_active/ActiveStandard.java @@ -0,0 +1,99 @@ +package nautilus.game.minekart.item.use_active; + +import java.util.List; + +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import nautilus.game.minekart.gp.GPBattle; +import nautilus.game.minekart.item.KartItemActive; +import nautilus.game.minekart.item.KartItemEntity; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.world_items_default.GreenShell; +import nautilus.game.minekart.item.world_items_default.RedShell; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartUtil; + +public class ActiveStandard extends KartItemActive +{ + public ActiveStandard(KartItemManager manager, Kart kart, List ents) + { + super(manager, kart, ActiveType.Behind, ents); + } + + @Override + public boolean Use() + { + if (GetEntities().isEmpty()) + return true; + + KartItemEntity item = GetEntities().get(0); + + //Fire Item + item.SetVelocity(null); + item.SetFired(); + + //Green/Red Shell Velocity & Teleport + if (item instanceof RedShell || item instanceof GreenShell) + { + item.GetEntity().teleport(KartUtil.GetInfront(item.GetHost().GetKart())); + + Vector vel = UtilAlg.Normalize(GetKart().GetDriver().getLocation().getDirection().setY(0)); + vel.multiply(1.4); + vel.setY(-0.4); + item.SetVelocity(vel); + } + + //Remove References + item.SetHost(null); + GetEntities().remove(item); + + //Red Shell Home + if (item instanceof RedShell) + { + Kart target = null; + + if (GetKart().GetGP() instanceof GPBattle) + { + double closest = 9999; + + for (Kart other : GetKart().GetGP().GetKarts()) + { + if (GetKart().equals(other)) + continue; + + if (GetKart().GetLives() <= 0) + continue; + + double dist = UtilMath.offset(GetKart().GetDriver(), other.GetDriver()); + + if (target == null) + { + target = other; + closest = dist; + + } + + else if (dist < closest) + { + target = other; + closest = dist; + } + } + } + else + { + for (Kart other : GetKart().GetGP().GetKarts()) + { + if (other.GetLapPlace() + 1 == GetKart().GetLapPlace()) + target = other; + } + } + + item.SetTarget(target); + } + + return GetEntities().isEmpty(); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseBlaze.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseBlaze.java new file mode 100644 index 000000000..ff756dbb4 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseBlaze.java @@ -0,0 +1,18 @@ +package nautilus.game.minekart.item.use_custom; + +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.use_default.ItemUse; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.condition.ConditionData; +import nautilus.game.minekart.kart.condition.ConditionType; + +public class UseBlaze extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + kart.SetItemStored(null); + + kart.AddCondition(new ConditionData(ConditionType.BlazeFire, 3000)); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseChicken.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseChicken.java new file mode 100644 index 000000000..12adb2641 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseChicken.java @@ -0,0 +1,38 @@ +package nautilus.game.minekart.item.use_custom; + +import org.bukkit.Sound; +import org.bukkit.entity.Egg; +import org.bukkit.util.Vector; + +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.use_default.ItemUse; +import nautilus.game.minekart.kart.Kart; + +public class UseChicken extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + if (kart.GetDriver().getInventory().getItem(3) == null) + { + kart.SetItemStored(null); + } + else if (kart.GetDriver().getInventory().getItem(3).getAmount() > 1) + { + kart.GetDriver().getInventory().getItem(3).setAmount(kart.GetDriver().getInventory().getItem(3).getAmount() - 1); + } + else + { + kart.SetItemStored(null); + } + + Egg egg = kart.GetDriver().launchProjectile(Egg.class); + + Vector vel = kart.GetDriver().getLocation().getDirection(); + vel.setY(0.1); + vel.multiply(2); + egg.setVelocity(vel); + + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), Sound.CHICKEN_EGG_POP, 2f, 1f); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseCow.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseCow.java new file mode 100644 index 000000000..8658c9b75 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseCow.java @@ -0,0 +1,39 @@ +package nautilus.game.minekart.item.use_custom; + +import org.bukkit.Location; + +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.use_default.ItemUse; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartUtil; +import nautilus.game.minekart.track.ents.Cow; + +public class UseCow extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + kart.SetItemStored(null); + + //Mid + kart.GetGP().GetTrack().GetCreatures().add(new Cow(kart.GetGP().GetTrack(), KartUtil.GetLook(kart), kart, kart.GetDriver().getLocation().getDirection())); + + Location left1 = KartUtil.GetLook(kart).add(KartUtil.GetSide(kart).multiply(1.5)); + kart.GetGP().GetTrack().GetCreatures().add(new Cow(kart.GetGP().GetTrack(), left1, kart, kart.GetDriver().getLocation().getDirection())); + + Location left2 = KartUtil.GetLook(kart).add(KartUtil.GetSide(kart).multiply(3)); + kart.GetGP().GetTrack().GetCreatures().add(new Cow(kart.GetGP().GetTrack(), left2, kart, kart.GetDriver().getLocation().getDirection())); + + Location left3 = KartUtil.GetLook(kart).add(KartUtil.GetSide(kart).multiply(4.5)); + kart.GetGP().GetTrack().GetCreatures().add(new Cow(kart.GetGP().GetTrack(), left3, kart, kart.GetDriver().getLocation().getDirection())); + + Location right1 = KartUtil.GetLook(kart).subtract(KartUtil.GetSide(kart).multiply(1.5)); + kart.GetGP().GetTrack().GetCreatures().add(new Cow(kart.GetGP().GetTrack(), right1, kart, kart.GetDriver().getLocation().getDirection())); + + Location right2 = KartUtil.GetLook(kart).subtract(KartUtil.GetSide(kart).multiply(3)); + kart.GetGP().GetTrack().GetCreatures().add(new Cow(kart.GetGP().GetTrack(), right2, kart, kart.GetDriver().getLocation().getDirection())); + + Location right3 = KartUtil.GetLook(kart).subtract(KartUtil.GetSide(kart).multiply(4.5)); + kart.GetGP().GetTrack().GetCreatures().add(new Cow(kart.GetGP().GetTrack(), right3, kart, kart.GetDriver().getLocation().getDirection())); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseEnderman.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseEnderman.java new file mode 100644 index 000000000..9b839eea2 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseEnderman.java @@ -0,0 +1,105 @@ +package nautilus.game.minekart.item.use_custom; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilBlock; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.use_default.ItemUse; +import nautilus.game.minekart.kart.Kart; + +public class UseEnderman extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + if (kart.GetDriver().getInventory().getItem(3) == null) + { + kart.SetItemStored(null); + } + else if (kart.GetDriver().getInventory().getItem(3).getAmount() > 1) + { + kart.GetDriver().getInventory().getItem(3).setAmount(kart.GetDriver().getInventory().getItem(3).getAmount() - 1); + } + else + { + kart.SetItemStored(null); + } + + Player player = kart.GetDriver(); + + //Trail + Block lastEffect = player.getLocation().getBlock(); + + double maxRange = 20; + double curRange = 0; + while (curRange <= maxRange) + { + Vector look = player.getLocation().getDirection(); + look.setY(0); + look.normalize(); + look.multiply(curRange); + + Location newTarget = player.getLocation().add(0, 0.1, 0).add(look); + + if (UtilBlock.solid(newTarget.getBlock())) + break; + + //Progress Forwards + curRange += 0.2; + + //Trail + if (!lastEffect.equals(newTarget.getBlock())) + lastEffect.getWorld().playEffect(lastEffect.getLocation(), Effect.STEP_SOUND, 49); + + lastEffect = newTarget.getBlock(); + } + + //Modify Range + curRange -= 0.4; + if (curRange < 0) + curRange = 0; + + //Destination + Vector look = player.getLocation().getDirection(); + look.setY(0); + look.normalize(); + look.multiply(curRange); + + Location loc = player.getLocation().add(look).add(new Vector(0, 0.4, 0)); + + //Sound + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f); + + Entity item = player.getPassenger(); + if (item != null) item.leaveVehicle(); + player.eject(); + + //Action + if (curRange > 0) + { + player.leaveVehicle(); + player.teleport(loc); + } + + //Re-Attach Item + if (item != null) + { + item.teleport(loc.add(0, 1.5, 0)); + player.setPassenger(item); + } + + //Adjust Velocity + double length = kart.GetVelocity().length(); + Vector vel = player.getLocation().getDirection(); + vel.setY(0); + vel.normalize(); + vel.multiply(length); + kart.SetVelocity(vel); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseGolem.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseGolem.java new file mode 100644 index 000000000..e5f6634cf --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseGolem.java @@ -0,0 +1,61 @@ +package nautilus.game.minekart.item.use_custom; + +import org.bukkit.Effect; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.use_default.ItemUse; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartUtil; +import nautilus.game.minekart.kart.condition.ConditionType; +import nautilus.game.minekart.kart.crash.Crash_Explode; + +public class UseGolem extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + kart.SetItemStored(null); + + kart.GetGP().Announce(F.main("MK", F.elem(UtilEnt.getName(kart.GetDriver())) + " used " + F.item("Earthquake") + ".")); + + for (Kart other : manager.KartManager.GetKarts().values()) + { + if (other.equals(kart)) + continue; + + if (!KartUtil.IsGrounded(other)) + continue; + + if (other.HasCondition(ConditionType.Star) || other.HasCondition(ConditionType.Ghost)) + continue; + + double offset = UtilMath.offset(kart.GetDriver(), other.GetDriver()); + + //MiniBump Crash + if (offset < 100) + new Crash_Explode(other, 0.4 + ((100 - offset)/100), false); + + //Half Velocity + other.GetVelocity().multiply(0.50); + + //Sound + other.GetDriver().getWorld().playSound(other.GetDriver().getLocation(), Sound.IRONGOLEM_THROW, 2f, 0.5f); + } + + //Sound + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), Sound.IRONGOLEM_THROW, 2f, 0.5f); + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), Sound.IRONGOLEM_THROW, 2f, 0.5f); + + //Effect + for (Block cur : UtilBlock.getInRadius(kart.GetDriver().getLocation(), 4d).keySet()) + if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur)) + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId()); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UsePig.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UsePig.java new file mode 100644 index 000000000..916db7693 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UsePig.java @@ -0,0 +1,42 @@ +package nautilus.game.minekart.item.use_custom; + +import org.bukkit.Sound; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.use_default.ItemUse; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.condition.ConditionType; + +public class UsePig extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + kart.SetItemStored(null); + + kart.GetGP().Announce(F.main("MK", F.elem(UtilEnt.getName(kart.GetDriver())) + " used " + F.item("Pig Stink") + ".")); + + for (Kart other : manager.KartManager.GetKarts().values()) + { + if (other.equals(kart)) + continue; + + if (other.HasCondition(ConditionType.Star) || other.HasCondition(ConditionType.Ghost)) + continue; + + PotionEffect effect = new PotionEffect(PotionEffectType.CONFUSION, 400, 0, false); + effect.apply(other.GetDriver()); + + //Sound + other.GetDriver().getWorld().playSound(other.GetDriver().getLocation(), Sound.PIG_IDLE, 2f, 0.5f); + } + + //Sound + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), Sound.PIG_IDLE, 2f, 0.5f); + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), Sound.PIG_IDLE, 2f, 0.5f); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseSheep.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseSheep.java new file mode 100644 index 000000000..10b1e9adc --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseSheep.java @@ -0,0 +1,29 @@ +package nautilus.game.minekart.item.use_custom; + +import org.bukkit.Sound; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.use_default.ItemUse; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.track.ents.Sheepile; + +public class UseSheep extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + kart.SetItemStored(null); + + kart.GetGP().Announce(F.main("MK", F.elem(UtilEnt.getName(kart.GetDriver())) + " used " + F.item("Super Sheep") + ".")); + + //Spider + kart.GetGP().GetTrack().GetCreatures().add( + new Sheepile(kart.GetGP().GetTrack(), kart.GetDriver().getLocation(), kart)); + + //Sound + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), Sound.SHEEP_IDLE, 2f, 2f); + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), Sound.SHEEP_IDLE, 2f, 2f); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseSpider.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseSpider.java new file mode 100644 index 000000000..ceb25d3ee --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseSpider.java @@ -0,0 +1,47 @@ +package nautilus.game.minekart.item.use_custom; + +import org.bukkit.Sound; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.use_default.ItemUse; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.track.ents.Spiderling; + +public class UseSpider extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + kart.SetItemStored(null); + + kart.GetGP().Announce(F.main("MK", F.elem(UtilEnt.getName(kart.GetDriver())) + " used " + F.item("Spiderlings") + ".")); + + final Kart fKart = kart; + + int i = 0; + for (Kart other : kart.GetGP().GetKarts()) + { + if (other.equals(kart)) + continue; + + final Kart fOther = other; + + manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(manager.GetPlugin(), new Runnable() + { + public void run() + { + //Spider + fKart.GetGP().GetTrack().GetCreatures().add( + new Spiderling(fKart.GetGP().GetTrack(), fKart.GetDriver().getLocation(), fKart, fOther)); + + //Sound + fKart.GetDriver().getWorld().playSound(fKart.GetDriver().getLocation(), Sound.SPIDER_IDLE, 2f, 2f); + } + }, i * 3); + + i++; + } + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseWolf.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseWolf.java new file mode 100644 index 000000000..71e35624f --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_custom/UseWolf.java @@ -0,0 +1,18 @@ +package nautilus.game.minekart.item.use_custom; + +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.use_default.ItemUse; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.condition.ConditionData; +import nautilus.game.minekart.kart.condition.ConditionType; + +public class UseWolf extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + kart.SetItemStored(null); + + kart.AddCondition(new ConditionData(ConditionType.WolfHeart, 60000)); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/ItemUse.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/ItemUse.java new file mode 100644 index 000000000..7b97c3c5e --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/ItemUse.java @@ -0,0 +1,9 @@ +package nautilus.game.minekart.item.use_default; + +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.kart.Kart; + +public abstract class ItemUse +{ + public abstract void Use(KartItemManager Manager, Kart kart); +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseBanana.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseBanana.java new file mode 100644 index 000000000..6115a7d35 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseBanana.java @@ -0,0 +1,26 @@ +package nautilus.game.minekart.item.use_default; + +import java.util.ArrayList; + +import nautilus.game.minekart.item.KartItemEntity; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.use_active.ActiveStandard; +import nautilus.game.minekart.item.world_items_default.Banana; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartUtil; + +public class UseBanana extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + //Auto-Trail = Dont do this + //kart.SetItemStored(null); + + ArrayList ents = new ArrayList(); + + ents.add(new Banana(manager, kart, KartUtil.GetBehind(kart))); + + new ActiveStandard(manager, kart, ents); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseBananas.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseBananas.java new file mode 100644 index 000000000..6a8f813f2 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseBananas.java @@ -0,0 +1,31 @@ +package nautilus.game.minekart.item.use_default; + +import java.util.ArrayList; + +import nautilus.game.minekart.item.KartItemEntity; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.use_active.ActiveBananas; +import nautilus.game.minekart.item.world_items_default.Banana; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartUtil; + +public class UseBananas extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + kart.SetItemStored(null); + + ArrayList ents = new ArrayList(); + + ents.add(new Banana(manager, kart, KartUtil.GetLook(kart))); + ents.add(new Banana(manager, kart, KartUtil.GetLook(kart))); + ents.add(new Banana(manager, kart, KartUtil.GetLook(kart))); + ents.add(new Banana(manager, kart, KartUtil.GetLook(kart))); + ents.add(new Banana(manager, kart, KartUtil.GetLook(kart))); + ents.add(new Banana(manager, kart, KartUtil.GetLook(kart))); + ents.add(new Banana(manager, kart, KartUtil.GetLook(kart))); + + new ActiveBananas(manager, kart, ents); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseFakeItem.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseFakeItem.java new file mode 100644 index 000000000..25c006ef8 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseFakeItem.java @@ -0,0 +1,17 @@ +package nautilus.game.minekart.item.use_default; + +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.world_items_default.FakeItem; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartUtil; + +public class UseFakeItem extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + kart.SetItemStored(null); + + new FakeItem(manager, kart, KartUtil.GetBehind(kart)); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseGhost.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseGhost.java new file mode 100644 index 000000000..5a2a55a6b --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseGhost.java @@ -0,0 +1,79 @@ +package nautilus.game.minekart.item.use_default; + +import java.util.ArrayList; + +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.LeatherArmorMeta; + +import mineplex.core.common.util.UtilMath; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.condition.ConditionData; +import nautilus.game.minekart.kart.condition.ConditionType; + +public class UseGhost extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + if (kart.HasCondition(ConditionType.Star) || kart.HasCondition(ConditionType.Ghost) || kart.HasCondition(ConditionType.Lightning)) + return; + + kart.SetItemStored(null); + + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), Sound.GHAST_MOAN, 2f, 1f); + + kart.AddCondition(new ConditionData(ConditionType.Ghost, 8000)); + + ArrayList steal = new ArrayList(); + + for (Kart other : kart.GetGP().GetKarts()) + { + if (kart.equals(other)) + continue; + + if (other.GetItemStored() != null) + steal.add(other); + } + + if (!steal.isEmpty()) + { + Kart target = steal.get(UtilMath.r(steal.size())); + kart.SetItemStored(target.GetItemStored()); + target.SetItemStored(null); + + target.GetDriver().getWorld().playSound(target.GetDriver().getLocation(), Sound.GHAST_MOAN, 2f, 1f); + } + + Color color = Color.WHITE; + LeatherArmorMeta meta; + + ItemStack head = new ItemStack(Material.LEATHER_HELMET); + meta = (LeatherArmorMeta)head.getItemMeta(); + meta.setColor(color); + head.setItemMeta(meta); + + ItemStack chest = new ItemStack(Material.LEATHER_CHESTPLATE); + meta = (LeatherArmorMeta)chest.getItemMeta(); + meta.setColor(color); + chest.setItemMeta(meta); + + ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS); + meta = (LeatherArmorMeta)legs.getItemMeta(); + meta.setColor(color); + legs.setItemMeta(meta); + + ItemStack boots = new ItemStack(Material.LEATHER_BOOTS); + meta = (LeatherArmorMeta)boots.getItemMeta(); + meta.setColor(color); + boots.setItemMeta(meta); + + kart.GetDriver().getInventory().setHelmet(head); + kart.GetDriver().getInventory().setChestplate(chest); + kart.GetDriver().getInventory().setLeggings(legs); + kart.GetDriver().getInventory().setBoots(boots); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseGhost.java.orig b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseGhost.java.orig new file mode 100644 index 000000000..b3f877b2a --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseGhost.java.orig @@ -0,0 +1,42 @@ +package nautilus.game.minekart.item.use_default; + +import java.util.ArrayList; + +import org.bukkit.Sound; + +import me.chiss.Core.Utility.UtilMath; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.condition.ConditionData; +import nautilus.game.minekart.kart.condition.ConditionType; + +public class UseGhost extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + kart.SetItemStored(null); + + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), Sound.GHAST_MOAN, 2f, 1f); + + kart.AddCondition(new ConditionData(ConditionType.Ghost, 8000)); + + ArrayList steal = new ArrayList(); + + for (Kart other : kart.GetGP().GetKarts()) + { + if (kart.equals(other)) + continue; + + if (kart.GetItemStored() != null) + steal.add(other); + } + + if (!steal.isEmpty()) + { + Kart target = steal.get(UtilMath.r(steal.size())); + kart.SetItemStored(target.GetItemStored()); + target.SetItemStored(null); + } + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseGreenShell.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseGreenShell.java new file mode 100644 index 000000000..c05ae7e70 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseGreenShell.java @@ -0,0 +1,26 @@ +package nautilus.game.minekart.item.use_default; + +import java.util.ArrayList; + +import nautilus.game.minekart.item.KartItemEntity; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.use_active.ActiveStandard; +import nautilus.game.minekart.item.world_items_default.GreenShell; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartUtil; + +public class UseGreenShell extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + //Auto-Trail = Dont do this + //kart.SetItemStored(null); + + ArrayList ents = new ArrayList(); + + ents.add(new GreenShell(manager, kart, KartUtil.GetLook(kart))); + + new ActiveStandard(manager, kart, ents); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseLightning.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseLightning.java new file mode 100644 index 000000000..56ef0368f --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseLightning.java @@ -0,0 +1,37 @@ +package nautilus.game.minekart.item.use_default; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.condition.ConditionData; +import nautilus.game.minekart.kart.condition.ConditionType; +import nautilus.game.minekart.kart.crash.Crash_Spin; + +public class UseLightning extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + if (kart.HasCondition(ConditionType.Star) || kart.HasCondition(ConditionType.Ghost) || kart.HasCondition(ConditionType.Lightning)) + return; + + kart.SetItemStored(null); + + kart.GetGP().Announce(F.main("MK", F.elem(UtilEnt.getName(kart.GetDriver())) + " used " + F.item("Lightning") + ".")); + + for (Kart other : kart.GetGP().GetKarts()) + { + if (kart.equals(other)) + continue; + + if (other.HasCondition(ConditionType.Star) || other.HasCondition(ConditionType.Ghost)) + continue; + + new Crash_Spin(other, 0.8f); + + other.GetDriver().getWorld().strikeLightningEffect(other.GetDriver().getLocation()); + other.AddCondition(new ConditionData(ConditionType.Lightning, 10000)); + } + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseLightning.java.orig b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseLightning.java.orig new file mode 100644 index 000000000..25a0d73a8 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseLightning.java.orig @@ -0,0 +1,33 @@ +package nautilus.game.minekart.item.use_default; + +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.condition.ConditionData; +import nautilus.game.minekart.kart.condition.ConditionType; +import nautilus.game.minekart.kart.crash.Crash_Spin; + +public class UseLightning extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + kart.SetItemStored(null); + + if (kart.GetGP() == null) + return; + + for (Kart other : kart.GetGP().GetKarts()) + { + if (kart.equals(other)) + continue; + + if (other.HasCondition(ConditionType.Star) || other.HasCondition(ConditionType.Ghost)) + continue; + + new Crash_Spin(kart, 0.8f); + + other.GetDriver().getWorld().strikeLightningEffect(other.GetDriver().getLocation()); + other.AddCondition(new ConditionData(ConditionType.Lightning, 10000)); + } + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseMushroom.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseMushroom.java new file mode 100644 index 000000000..f09a90e7a --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseMushroom.java @@ -0,0 +1,35 @@ +package nautilus.game.minekart.item.use_default; + +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.KartItemType; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.condition.ConditionData; +import nautilus.game.minekart.kart.condition.ConditionType; + +public class UseMushroom extends ItemUse +{ + @Override + public void Use(KartItemManager manager, final Kart kart) + { + //Super + if (kart.GetItemStored() == KartItemType.SuperMushroom) + { + if (!kart.HasCondition(ConditionType.SuperMushroom)) + kart.AddCondition(new ConditionData(ConditionType.SuperMushroom, 8000)); + } + + //Triple + else if (kart.GetItemStored() == KartItemType.TripleMushroom) + kart.SetItemStored(KartItemType.DoubleMushroom); + + //Double + else if (kart.GetItemStored() == KartItemType.DoubleMushroom) + kart.SetItemStored(KartItemType.SingleMushroom); + + //Single + else + kart.SetItemStored(null); + + kart.AddCondition(new ConditionData(ConditionType.Boost, 2000)); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseRedShell.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseRedShell.java new file mode 100644 index 000000000..fd7dee2b8 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseRedShell.java @@ -0,0 +1,26 @@ +package nautilus.game.minekart.item.use_default; + +import java.util.ArrayList; + +import nautilus.game.minekart.item.KartItemEntity; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.use_active.ActiveStandard; +import nautilus.game.minekart.item.world_items_default.RedShell; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartUtil; + +public class UseRedShell extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + //Auto-Trail = Dont do this + //kart.SetItemStored(null); + + ArrayList ents = new ArrayList(); + + ents.add(new RedShell(manager, kart, KartUtil.GetLook(kart))); + + new ActiveStandard(manager, kart, ents); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseStar.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseStar.java new file mode 100644 index 000000000..27d48e272 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseStar.java @@ -0,0 +1,20 @@ +package nautilus.game.minekart.item.use_default; + +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.condition.ConditionData; +import nautilus.game.minekart.kart.condition.ConditionType; + +public class UseStar extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + if (kart.HasCondition(ConditionType.Star) || kart.HasCondition(ConditionType.Ghost) || kart.HasCondition(ConditionType.Lightning)) + return; + + kart.SetItemStored(null); + + kart.AddCondition(new ConditionData(ConditionType.Star, 10000)); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseTripleGreenShell.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseTripleGreenShell.java new file mode 100644 index 000000000..ea57665eb --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseTripleGreenShell.java @@ -0,0 +1,27 @@ +package nautilus.game.minekart.item.use_default; + +import java.util.ArrayList; + +import nautilus.game.minekart.item.KartItemEntity; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.use_active.ActiveShells; +import nautilus.game.minekart.item.world_items_default.GreenShell; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartUtil; + +public class UseTripleGreenShell extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + kart.SetItemStored(null); + + ArrayList ents = new ArrayList(); + + ents.add(new GreenShell(manager, kart, KartUtil.GetLook(kart))); + ents.add(new GreenShell(manager, kart, KartUtil.GetLook(kart))); + ents.add(new GreenShell(manager, kart, KartUtil.GetLook(kart))); + + new ActiveShells(manager, kart, ents); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseTripleRedShell.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseTripleRedShell.java new file mode 100644 index 000000000..d2f62edee --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/use_default/UseTripleRedShell.java @@ -0,0 +1,27 @@ +package nautilus.game.minekart.item.use_default; + +import java.util.ArrayList; + +import nautilus.game.minekart.item.KartItemEntity; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.use_active.ActiveShells; +import nautilus.game.minekart.item.world_items_default.RedShell; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartUtil; + +public class UseTripleRedShell extends ItemUse +{ + @Override + public void Use(KartItemManager manager, Kart kart) + { + kart.SetItemStored(null); + + ArrayList ents = new ArrayList(); + + ents.add(new RedShell(manager, kart, KartUtil.GetLook(kart))); + ents.add(new RedShell(manager, kart, KartUtil.GetLook(kart))); + ents.add(new RedShell(manager, kart, KartUtil.GetLook(kart))); + + new ActiveShells(manager, kart, ents); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/world_items_custom/Flame.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/world_items_custom/Flame.java new file mode 100644 index 000000000..be4f8219d --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/world_items_custom/Flame.java @@ -0,0 +1,36 @@ +package nautilus.game.minekart.item.world_items_custom; + +import org.bukkit.Location; +import org.bukkit.Material; + +import nautilus.game.minekart.item.KartItemEntity; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.kart.Kart; + +public class Flame extends KartItemEntity +{ + public Flame(KartItemManager manager, Kart kart, Location loc) + { + super(manager, kart, loc, Material.FIRE, (byte)0); + + SetRadius(1); + + this.SetFired(); + } + + @Override + public void CollideHandle(Kart kart) + { + if (!kart.IsInvulnerable(false)) + { + int ticks = Math.min(100, kart.GetDriver().getFireTicks() + 20); + kart.GetDriver().setFireTicks(ticks); + } + } + + @Override + public boolean TickUpdate() + { + return System.currentTimeMillis() - this.GetFireTime() > 6000; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/world_items_default/Banana.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/world_items_default/Banana.java new file mode 100644 index 000000000..3fa354a9d --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/world_items_default/Banana.java @@ -0,0 +1,53 @@ +package nautilus.game.minekart.item.world_items_default; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.minekart.item.KartItemEntity; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.crash.Crash_Spin; + +public class Banana extends KartItemEntity +{ + public Banana(KartItemManager manager, Kart kart, Location loc) + { + super(manager, kart, loc, Material.INK_SACK, (byte)11); + + SetRadius(1.5); + } + + @Override + public void CollideHandle(Kart kart) + { + if (!kart.IsInvulnerable(true)) + { + //Inform + if (kart.equals(GetOwner())) + { + UtilPlayer.message(kart.GetDriver(), F.main("MK", "You hit yourself with " + F.item("Banana") + ".")); + } + else + { + UtilPlayer.message(kart.GetDriver(), F.main("MK", F.elem(UtilEnt.getName(GetOwner().GetDriver())) + " hit you with " + F.item("Banana") + ".")); + UtilPlayer.message(GetOwner().GetDriver(), F.main("MK", "You hit " + F.elem(UtilEnt.getName(kart.GetDriver())) + " with " + F.item("Banana") + ".")); + } + + //Crash + if (kart.GetVelocity().length() == 0) + kart.SetVelocity(kart.GetDriver().getLocation().getDirection().setY(0)); + + kart.SetVelocity(UtilAlg.Normalize(kart.GetVelocityClone().setY(0)).multiply(0.6)); + new Crash_Spin(kart, 0.6f); + kart.SetStability(0); + } + + //Effect + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.BAT_HURT, 1f, 1f); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/world_items_default/FakeItem.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/world_items_default/FakeItem.java new file mode 100644 index 000000000..5c3f7a716 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/world_items_default/FakeItem.java @@ -0,0 +1,58 @@ +package nautilus.game.minekart.item.world_items_default; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EnderCrystal; +import org.bukkit.entity.Entity; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.minekart.item.KartItemEntity; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.crash.Crash_Explode; + +public class FakeItem extends KartItemEntity +{ + public FakeItem(KartItemManager manager, Kart kart, Location loc) + { + super(manager, kart, loc, Material.TRAPPED_CHEST, (byte)0); + + SetRadius(1.5); + } + + @Override + public void CollideHandle(Kart kart) + { + if (!kart.IsInvulnerable(true)) + { + //Inform + if (kart.equals(GetOwner())) + { + UtilPlayer.message(kart.GetDriver(), F.main("MK", "You hit yourself with " + F.item("Fake Item") + ".")); + } + else + { + UtilPlayer.message(kart.GetDriver(), F.main("MK", F.elem(UtilEnt.getName(GetOwner().GetDriver())) + " hit you with " + F.item("Fake Item") + ".")); + UtilPlayer.message(GetOwner().GetDriver(), F.main("MK", "You hit " + F.elem(UtilEnt.getName(kart.GetDriver())) + " with " + F.item("Fake Item") + ".")); + } + + //Crash + kart.CrashStop(); + new Crash_Explode(kart, 1.2f, false); + } + + //Effect + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.EXPLODE, 2f, 0.2f); + } + + @Override + public void Spawn(Location loc) + { + Entity ent = loc.getWorld().spawn(loc, EnderCrystal.class); + SetEntity(ent); + SetFired(); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/world_items_default/GreenShell.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/world_items_default/GreenShell.java new file mode 100644 index 000000000..cc9f2555f --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/world_items_default/GreenShell.java @@ -0,0 +1,81 @@ +package nautilus.game.minekart.item.world_items_default; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Slime; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.minekart.item.KartItemEntity; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.control.Collision; +import nautilus.game.minekart.item.control.Movement; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.crash.Crash_Explode; + +public class GreenShell extends KartItemEntity +{ + public GreenShell(KartItemManager manager, Kart kart, Location loc) + { + super(manager, kart, loc, Material.EMERALD_BLOCK, (byte)0); + + Vector vel = UtilAlg.Normalize(kart.GetDriver().getLocation().getDirection().setY(0)); + vel.multiply(1.4); + vel.setY(-0.5); + + SetVelocity(vel); + + SetRadius(1.5); + } + + @Override + public void CollideHandle(Kart kart) + { + if (!kart.IsInvulnerable(true)) + { + //Inform + if (kart.equals(GetOwner())) + { + UtilPlayer.message(kart.GetDriver(), F.main("MK", "You hit yourself with " + F.item("Green Shell") + ".")); + } + else + { + UtilPlayer.message(kart.GetDriver(), F.main("MK", F.elem(UtilEnt.getName(GetOwner().GetDriver())) + " hit you with " + F.item("Green Shell") + ".")); + UtilPlayer.message(GetOwner().GetDriver(), F.main("MK", "You hit " + F.elem(UtilEnt.getName(kart.GetDriver())) + " with " + F.item("Green Shell") + ".")); + } + + //Crash + new Crash_Explode(kart, 1f, true); + } + + //Effect + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.EXPLODE, 2f, 1.5f); + } + + @Override + public void Spawn(Location loc) + { + Slime slime = (Slime) loc.getWorld().spawnEntity(loc.add(0, 0.5, 0), EntityType.SLIME); + slime.setSize(1); + SetEntity(slime); + SetFired(); + } + + public boolean TickUpdate() + { + if (GetHost() != null) + return false; + + Movement.Move(this); + + if (Collision.CollideBlock(this)) + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.CHICKEN_EGG_POP, 2f, 1f); + + return false; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/world_items_default/RedShell.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/world_items_default/RedShell.java new file mode 100644 index 000000000..988936085 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/world_items_default/RedShell.java @@ -0,0 +1,84 @@ +package nautilus.game.minekart.item.world_items_default; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Slime; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.minekart.item.KartItemEntity; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.item.control.Collision; +import nautilus.game.minekart.item.control.Movement; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.crash.Crash_Explode; + +public class RedShell extends KartItemEntity +{ + public RedShell(KartItemManager manager, Kart kart, Location loc) + { + super(manager, kart, loc, Material.REDSTONE_BLOCK, (byte)0); + + Vector vel = UtilAlg.Normalize(kart.GetDriver().getLocation().getDirection().setY(0)); + vel.multiply(1.2); + vel.setY(-0.5); + + SetVelocity(vel); + + SetTarget(null); + + SetRadius(1.5); + } + + @Override + public void CollideHandle(Kart kart) + { + if (!kart.IsInvulnerable(true)) + { + //Inform + if (kart.equals(GetOwner())) + { + UtilPlayer.message(kart.GetDriver(), F.main("MK", "You hit yourself with " + F.item("Red Shell") + ".")); + } + else + { + UtilPlayer.message(kart.GetDriver(), F.main("MK", F.elem(UtilEnt.getName(GetOwner().GetDriver())) + " hit you with " + F.item("Red Shell") + ".")); + UtilPlayer.message(GetOwner().GetDriver(), F.main("MK", "You hit " + F.elem(UtilEnt.getName(kart.GetDriver())) + " with " + F.item("Red Shell") + ".")); + } + + //Crash + new Crash_Explode(kart, 1f, true); + } + + //Effect + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.EXPLODE, 2f, 1.5f); + } + + @Override + public void Spawn(Location loc) + { + Slime slime = (Slime) loc.getWorld().spawnEntity(loc.add(0, 0.5, 0), EntityType.MAGMA_CUBE); + slime.setSize(1); + SetEntity(slime); + SetFired(); + } + + public boolean TickUpdate() + { + if (GetHost() != null) + return false; + + if (GetTarget() != null) + GetTarget().GetDriver().playSound(this.GetEntity().getLocation(), Sound.NOTE_BASS, 0.2f, 1f); + + Movement.Home(this); + Movement.Move(this); + + return Collision.CollideBlock(this); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/Kart.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/Kart.java new file mode 100644 index 000000000..0bfab798b --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/Kart.java @@ -0,0 +1,660 @@ +package nautilus.game.minekart.kart; + +import java.util.ArrayList; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.fakeEntity.FakeEntity; +import mineplex.core.fakeEntity.FakeEntityManager; +import mineplex.core.fakeEntity.FakeItemDrop; +import mineplex.core.fakeEntity.FakePlayer; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.minekart.gp.GP; +import nautilus.game.minekart.gp.GP.GPState; +import nautilus.game.minekart.gp.GPBattle; +import nautilus.game.minekart.item.KartItemActive; +import nautilus.game.minekart.item.KartItemType; +import nautilus.game.minekart.kart.condition.ConditionData; +import nautilus.game.minekart.kart.condition.ConditionType; +import nautilus.game.minekart.kart.crash.Crash; +import nautilus.game.minekart.track.Track.TrackState; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +public class Kart +{ + public enum DriftDirection + { + Left, + Right, + None + } + + private Player _driver = null; + private FakeEntity _entity = null; + private FakeItemDrop _fakeItem = null; + private FakePlayer _fakePlayer = null; + + private GP _gp; + + //Kart + private KartType _kartType; + private KartState _kartState = KartState.Drive; + private long _kartStateTime = System.currentTimeMillis(); + private Vector _yaw; + + //Drift Data + private DriftDirection _drift = DriftDirection.None; + private long _driftStart = 0; + + //Crash Data + private Crash _crash; + + //Items + private int _itemCycles = 0; + private KartItemActive _itemActive = null; + private KartItemType _itemStored = null; + + //Conditions + private ArrayList _conditions = new ArrayList(); + + //Battle + private int _lives = 3; + + //Lap + private int _lap = 0; + private int _lapNode = 0; + private double _lapScore = 0; + private int _lapMomentum = 10000; + + private int _lapPlace = 0; + + private int _lakituTick = 0; + + //Music + private int _songStarTick = 0; + + //Physics + private Vector _velocity = new Vector(0,0,0); + + public Kart(Player player, KartType kartType, GP gp) + { + _gp = gp; + + _driver = player; + _kartType = kartType; + _entity = new FakeEntity(kartType.GetType(), player.getLocation()); + + Equip(); + } + + public GP GetGP() + { + return _gp; + } + + public FakeEntity GetEntity() + { + return _entity; + } + + public Player GetDriver() + { + return _driver; + } + + public KartType GetKartType() + { + return _kartType; + } + + public void SetKartType(KartType type) + { + _kartType = type; + Equip(); + } + + public KartState GetKartState() + { + return _kartState; + } + + public long GetKartStateTime() + { + return _kartStateTime; + } + + public void SetKartState(KartState state) + { + _kartState = state; + _kartStateTime = System.currentTimeMillis(); + } + + public Vector GetKartDirection() + { + return _velocity; + } + + public int GetLakituTick() + { + return _lakituTick; + } + + public void SetLakituTick(int tick) + { + _lakituTick += tick; + + if (_lakituTick <= 0) + _lakituTick = 0; + } + + public ArrayList GetConditions() + { + return _conditions; + } + + public void AddCondition(ConditionData data) + { + _conditions.add(data); + + if (data.IsCondition(ConditionType.Star)) + SetStarSongTick(0); + } + + public boolean HasCondition(ConditionType type) + { + for (ConditionData data : _conditions) + { + if (data.IsCondition(type)) + return true; + } + + return false; + } + + public void ExpireCondition(ConditionType type) + { + for (ConditionData data : GetConditions()) + if (data.IsCondition(type)) + data.Expire(); + } + + public void ExpireConditions() + { + for (ConditionData data : GetConditions()) + data.Expire(); + } + + public void Equip() + { + _driver.getInventory().clear(); + + //Driving + GetDriver().getInventory().setItem(0, ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD, (byte)0, 1, "§a§lAccelerate")); + GetDriver().getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD, (byte)0, 1, "§a§lHand Brake")); + + //Item Slot + GetDriver().getInventory().setItem(2, null); + GetDriver().getInventory().setItem(3, null); + GetDriver().getInventory().setItem(4, null); + + //State + ItemStack a = ItemStackFactory.Instance.CreateStack(Material.WOOD_HOE, (byte)0, (int)(GetKartType().GetTopSpeed() * 100), "§e§lTop Speed"); + ItemStack b = ItemStackFactory.Instance.CreateStack(Material.STONE_HOE, (byte)0, (int)GetKartType().GetAcceleration() - 10, "§e§lAcceleration"); + ItemStack c = ItemStackFactory.Instance.CreateStack(Material.IRON_HOE, (byte)0, (int)GetKartType().GetHandling() - 10, "§e§lHandling"); + ItemStack d = ItemStackFactory.Instance.CreateStack(GetKartType().GetAvatar(), (byte)0, 1, "§e§l" + GetKartType().GetName() + " Kart"); + + GetDriver().getInventory().setItem(5, d); + GetDriver().getInventory().setItem(6, a); + GetDriver().getInventory().setItem(7, b); + GetDriver().getInventory().setItem(8, c); + + } + + public Vector GetVelocity() + { + return _velocity; + } + + public Vector GetVelocityClone() + { + return new Vector(_velocity.getX(), _velocity.getY(), _velocity.getZ()); + } + + public void SetVelocity(Vector vec) + { + _velocity = vec; + } + + public Vector GetYaw() + { + return _yaw; + } + + public void CrashStop() + { + _velocity = new Vector(0,0,0); + ExpireCondition(ConditionType.Boost); + + if (GetKartState() == KartState.Drive) + LoseLife(); + } + + public double GetSpeed() + { + Vector vec = new Vector(_velocity.getX(), 0, _velocity.getZ()); + return vec.length(); + } + + public void SetDrift() + { + ClearDrift(); + + //Check Speed Requirement + if (GetSpeed() < 0.4) + { + return; + } + + //Check Turn Requirement + Vector look = GetDriver().getLocation().getDirection(); + look.setY(0); + look.normalize(); + + Vector vel = new Vector(GetVelocity().getX(), 0, GetVelocity().getZ()); + vel.normalize(); + + look.subtract(vel); + + if (look.length() < 0.2) + { + return; + } + + + //Get Drift Direction + Vector kartVec = new Vector(_velocity.getX(), 0, _velocity.getZ()); + kartVec.normalize(); + + Vector lookVec = GetDriver().getLocation().getDirection(); + lookVec.setY(0); + lookVec.normalize(); + + Vector left = new Vector(kartVec.getZ(), 0, kartVec.getX() * -1); + Vector right = new Vector(kartVec.getZ() * -1, 0, kartVec.getX()); + + double distLeft = UtilMath.offset(left, lookVec); + double distRight = UtilMath.offset(right, lookVec); + + if (distLeft < distRight) _drift = DriftDirection.Left; + else _drift = DriftDirection.Right; + + _driftStart = System.currentTimeMillis(); + } + + public DriftDirection GetDrift() + { + return _drift; + } + + public Vector GetDriftVector() + { + if (_drift == DriftDirection.None) + return new Vector(0,0,0); + + //Get Drift Direction + Vector kartVec = new Vector(_velocity.getX(), 0, _velocity.getZ()); + kartVec.normalize(); + + Vector lookVec = GetDriver().getLocation().getDirection(); + lookVec.setY(0); + lookVec.normalize(); + + if (_drift == DriftDirection.Left) + { + Vector drift = new Vector(kartVec.getZ(), 0, kartVec.getX() * -1); + return drift.subtract(kartVec); + } + else + { + Vector drift = new Vector(kartVec.getZ() * -1, 0, kartVec.getX()); + return drift.subtract(kartVec); + } + } + + public long GetDriftTime() + { + return System.currentTimeMillis() - _driftStart; + } + + public void ClearDrift() + { + _driftStart = System.currentTimeMillis(); + _drift = DriftDirection.None; + } + + public Crash GetCrash() + { + if (GetKartState() != KartState.Crash) + return null; + + return _crash; + } + + public void SetCrash(Crash crash) + { + _crash = crash; + } + + public void PickupItem() + { + if (GetItemStored() == null && GetItemCycles() == 0) + SetItemCycles(40); + } + + public void SetItemCycles(int cycles) + { + _itemCycles = cycles; + } + + public int GetItemCycles() + { + return _itemCycles; + } + + public KartItemType GetItemStored() + { + return _itemStored; + } + + public KartItemActive GetItemActive() + { + return _itemActive; + } + + public void SetItemStored(KartItemType item) + { + _itemStored = item; + + if (item == null) + { + if (_fakeItem != null) + RemoveFakeKartItemInfo(); + } + else + { + SetFakeKartItemInfo(item); + } + } + + private void SetFakeKartItemInfo(KartItemType item) + { + boolean showPlayer = false; + boolean spawnItem = false; + + if (_fakeItem == null) + { + _fakeItem = new FakeItemDrop(new ItemStack(item.GetMaterial()), GetDriver().getLocation()); + spawnItem = true; + } + else + _fakeItem.SetItemStack(new ItemStack(item.GetMaterial())); + + if (_fakePlayer == null) + { + showPlayer = true; + _fakePlayer = new FakePlayer("Buffer", GetDriver().getLocation().subtract(0, 10, 0)); + } + + //Set Item + GetDriver().getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(item.GetMaterial(), (byte)0, item.GetAmount(), "§a§l"+item.GetName())); + + for (Kart kart : GetGP().GetKarts()) + { + if (kart == this) + { + if (spawnItem) + { + FakeEntityManager.Instance.SendPacketTo(_fakeItem.Spawn(), kart.GetDriver()); + FakeEntityManager.Instance.SendPacketTo(_fakeItem.SetVehicle(kart.GetDriver().getEntityId()), kart.GetDriver()); + } + + FakeEntityManager.Instance.SendPacketTo(_fakeItem.Show(), kart.GetDriver()); + + continue; + } + + if (showPlayer) + { + FakeEntityManager.Instance.SendPacketTo(_fakePlayer.Spawn(), kart.GetDriver()); + FakeEntityManager.Instance.SendPacketTo(_fakePlayer.Hide(), kart.GetDriver()); + FakeEntityManager.Instance.SendPacketTo(_fakePlayer.SetVehicle(GetDriver().getEntityId()), kart.GetDriver()); + + FakeEntityManager.Instance.FakePassenger(kart.GetDriver(), GetDriver().getEntityId(), _fakePlayer.SetVehicle(GetDriver().getEntityId())); + } + + if (spawnItem) + { + FakeEntityManager.Instance.SendPacketTo(_fakeItem.Spawn(), kart.GetDriver()); + FakeEntityManager.Instance.SendPacketTo(_fakeItem.SetVehicle(_fakePlayer.GetEntityId()), kart.GetDriver()); + + FakeEntityManager.Instance.FakePassenger(kart.GetDriver(), _fakePlayer.GetEntityId(), _fakeItem.SetVehicle(_fakePlayer.GetEntityId())); + } + + FakeEntityManager.Instance.SendPacketTo(_fakeItem.Show(), kart.GetDriver()); + } + } + + private void RemoveFakeKartItemInfo() + { + GetDriver().getInventory().setItem(3, null); + + for (Kart kart : GetGP().GetKarts()) + { + if (_fakeItem != null) + { + FakeEntityManager.Instance.SendPacketTo(_fakeItem.Destroy(), kart.GetDriver()); + } + + if (kart != this) + { + if (_fakeItem != null && _fakePlayer != null) + { + FakeEntityManager.Instance.RemoveFakePassenger(kart.GetDriver(), _fakePlayer.GetEntityId()); + } + } + } + + _fakeItem = null; + } + + public void SetItemActive(KartItemActive item) + { + _itemActive = item; + } + + public void SetStability(int i) + { + GetDriver().setFoodLevel(i); + } + + public boolean CanControl() + { + if (GetGP() == null) + return true; + + if (GetGP().GetState() != GPState.Live) + return false; + + if (GetGP().GetTrack().GetState() != TrackState.Live && GetGP().GetTrack().GetState() != TrackState.Ending) + return false; + + if (HasFinishedTrack()) + return false; + + return true; + } + + public int GetLives() + { + return _lives; + } + + public void LoseLife() + { + if (_lives < 1) + return; + + if (GetGP() == null) + return; + + if (!(GetGP() instanceof GPBattle)) + return; + + GPBattle battle = (GPBattle)GetGP(); + _lives = _lives - 1; + + if (_lives == 0) + { + battle.GetTrack().GetPositions().add(0, this); + battle.CheckBattleEnd(); + } + } + + public int GetLap() + { + return _lap; + } + + public void SetLap(int lap) + { + _lap = lap; + } + + public int GetLapNode() + { + return _lapNode; + } + + public void SetLapNode(int lapNode) + { + if ((lapNode > _lapNode && !(_lapNode <= GetGP().GetTrack().GetProgress().size() / 5 && lapNode >= GetGP().GetTrack().GetProgress().size() * 4 / 5)) || (lapNode <= GetGP().GetTrack().GetProgress().size() / 5 && _lapNode >= GetGP().GetTrack().GetProgress().size() * 4 / 5)) + SetLapMomentum(GetLapMomentum() + 1); + else if (lapNode < _lapNode || (_lapNode <= GetGP().GetTrack().GetProgress().size() / 5 && lapNode >= GetGP().GetTrack().GetProgress().size() * 4 / 5)) + SetLapMomentum(GetLapMomentum() - 1); + + _lapNode = lapNode; + + //Next Lap + if (lapNode <= GetGP().GetTrack().GetProgress().size() / 5) + { + if (_lapMomentum > GetGP().GetTrack().GetProgress().size() / 4) + { + SetLap(GetLap() + 1); + SetLapMomentum(0); + + GetDriver().getWorld().playSound(GetDriver().getLocation(), GetKartType().GetSoundMain(), 0.5f, 1f); + + if (GetLap() > 3) + { + int place = GetLapPlace() + 1; + + String placeString = "st"; + if (place == 2) placeString = "nd"; + else if (place == 3) placeString = "rd"; + else if (place >= 4) placeString = "th"; + + GetGP().Announce(F.main("MK", F.name(GetDriver().getName()) + " finished in " + F.elem(place + placeString) + " place.")); + } + else + UtilPlayer.message(GetDriver(), F.main("MK", "Lap " + GetLap())); + } + } + } + + public double GetLapScore() + { + return _lapScore; + } + + public void SetLapScore(double lapScore) + { + _lapScore = lapScore + (1000000 * (_lap - (GetLapMomentum() < 0 ? 1 : 0))); + } + + public int GetLapMomentum() + { + return _lapMomentum; + } + + public void SetLapMomentum(int lapMomentum) + { + _lapMomentum = lapMomentum; + } + + public int GetLapPlace() + { + return _lapPlace; + } + + public void SetLapPlace(int place) + { + //Roar with joy! + if (place < _lapPlace) + GetDriver().getWorld().playSound(GetDriver().getLocation(), GetKartType().GetSoundMain(), 0.5f, 1f); + + _lapPlace = place; + } + + public boolean HasFinishedTrack() + { + return GetLap() > 3 || GetLives() <= 0; + } + + public void ClearTrackData() + { + //Battle + _lives = 3; + + //Lap + _lap = 0; + _lapNode = 0; + _lapScore = 0; + _lapMomentum = 10000; + + _lapPlace = 0; + } + + public int GetStarSongTick() + { + return _songStarTick; + } + + public void SetStarSongTick(int tick) + { + _songStarTick = tick; + } + + public void SetPlayerArmor() + { + GetDriver().getInventory().setHelmet(null); + GetDriver().getInventory().setChestplate(null); + GetDriver().getInventory().setLeggings(null); + GetDriver().getInventory().setBoots(null); + } + + public boolean IsInvulnerable(boolean useHeart) + { + if (useHeart && HasCondition(ConditionType.WolfHeart)) + { + ExpireCondition(ConditionType.WolfHeart); + return true; + } + + return HasCondition(ConditionType.Star) || HasCondition(ConditionType.Ghost); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/KartManager.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/KartManager.java new file mode 100644 index 000000000..766bfd8ae --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/KartManager.java @@ -0,0 +1,273 @@ +package nautilus.game.minekart.kart; + +import java.util.HashMap; +import java.util.HashSet; + +import nautilus.game.minekart.gp.GP; +import nautilus.game.minekart.item.KartItemManager; +import nautilus.game.minekart.kart.Kart.DriftDirection; +import nautilus.game.minekart.kart.condition.Condition; +import nautilus.game.minekart.kart.condition.ConditionData; +import nautilus.game.minekart.kart.condition.ConditionType; +import nautilus.game.minekart.kart.control.*; +import nautilus.game.minekart.kart.crash.Crash; +import nautilus.game.minekart.track.Track.TrackState; + +import net.minecraft.server.v1_6_R2.EntityPlayer; +import net.minecraft.server.v1_6_R2.MathHelper; +import net.minecraft.server.v1_6_R2.Packet; +import net.minecraft.server.v1_6_R2.Packet34EntityTeleport; + +import org.bukkit.Location; +import org.bukkit.Sound; + +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityRegainHealthEvent; +import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; +import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; + +public class KartManager extends MiniPlugin +{ + private Recharge _recharge; + + public KartItemManager ItemManager; + + private HashMap _karts = new HashMap(); + + public KartManager(JavaPlugin plugin, Recharge recharge) + { + super("Kart Manager", plugin); + + _recharge = recharge; + ItemManager = new KartItemManager(plugin, this); + } + + @EventHandler + public void KartUpdate(UpdateEvent event) + { + if (event.getType() == UpdateType.FASTER) + { + for (Kart kart : GetKarts().values()) + { + Condition.WolfHeart(kart); + Condition.SuperMushroom(kart); + } + } + + if (event.getType() == UpdateType.FAST) + { + for (Kart kart : GetKarts().values()) + { + Location location = kart.GetDriver().getLocation(); + Packet teleportPacket = new Packet34EntityTeleport( + kart.GetDriver().getEntityId(), + MathHelper.floor(location.getX() * 32.0D), + MathHelper.floor(location.getY() * 32.0D), + MathHelper.floor(location.getZ() * 32.0D), + (byte) ((int) (MathHelper.d(location.getYaw() * 256.0F / 360.0F))), + (byte) ((int) (MathHelper.d(location.getPitch() * 256.0F / 360.0F)))); + + for (Kart otherPlayer : kart.GetGP().GetKarts()) + { + if (kart.GetGP().GetTrack().GetState() != TrackState.Live) + break; + + if (otherPlayer.GetDriver() == kart.GetDriver()) + continue; + + EntityPlayer entityPlayer = ((CraftPlayer) otherPlayer + .GetDriver()).getHandle(); + + entityPlayer.playerConnection.sendPacket(teleportPacket); + } + } + } + + if (event.getType() == UpdateType.TICK) + { + for (Kart kart : GetKarts().values()) + { + // Physics + World.Gravity(kart); + + // Drag + World.AirDrag(kart); + World.FireDrag(kart); + World.RoadDrag(kart); + World.BlockDrag(kart); + + // Conditions + Condition.Boost(kart); + Condition.LightningSlow(kart); + Condition.StarEffect(kart); + Condition.StarCollide(kart); + Condition.BlazeFire(kart); + + // Collision + Collision.CollideBlock(kart); + Collision.CollidePlayer(kart); + + // Movement + if (kart.GetKartState() == KartState.Drive) + { + // Start/Stop + Drive.Accelerate(kart); + Drive.Brake(kart); + + // Turn + if (kart.GetDrift() == DriftDirection.None) + Drive.Turn(kart); + else + DriveDrift.Drift(kart); + + // Speed Limit + Drive.TopSpeed(kart); + + // Move Player + Drive.Move(kart); + + kart.GetDriver() + .getWorld() + .playSound(kart.GetDriver().getLocation(), + Sound.PIG_IDLE, .15f - (float)kart.GetSpeed() / 10, + .5f + (float)kart.GetSpeed()); + } + if (kart.GetKartState() == KartState.Crash) + { + Crash crash = kart.GetCrash(); + + if (crash == null + || (crash.CrashEnd() && KartUtil.IsGrounded(kart))) + { + // State Return + kart.SetKartState(KartState.Drive); + + // Restore Stability + if (crash == null || crash.StabilityRestore()) + kart.GetDriver().setFoodLevel(20); + + continue; + } + + crash.Move(kart); + } + if (kart.GetKartState() == KartState.Lakitu) + { + if (UtilTime.elapsed(kart.GetKartStateTime(), 8000)) + { + kart.SetKartState(KartState.Drive); + } else + { + kart.GetDriver().playSound( + kart.GetDriver().getLocation(), + Sound.NOTE_BASS, 0.3f, 0.1f); + } + + // Move Player + Drive.Move(kart); + } + } + } + } + + @EventHandler + public void ConditionExpire(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Kart kart : GetKarts().values()) + { + HashSet remove = new HashSet(); + + for (ConditionData data : kart.GetConditions()) + { + if (data.IsExpired()) + remove.add(data); + } + + for (ConditionData data : remove) + { + kart.GetConditions().remove(data); + + if (data.IsCondition(ConditionType.Star) + || data.IsCondition(ConditionType.Ghost)) + { + kart.SetPlayerArmor(); + } + + if (data.IsCondition(ConditionType.SuperMushroom)) + { + kart.SetItemStored(null); + } + } + } + } + + @EventHandler + public void StabilityRecover(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Kart kart : GetKarts().values()) + UtilPlayer.hunger(kart.GetDriver(), 1); + } + + @EventHandler + public void DriftHop(PlayerToggleSneakEvent event) + { + if (_recharge.use(event.getPlayer(), "Drift Hop", 250, false)) + DriveDrift.Hop(GetKart(event.getPlayer()), event); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void Damage(EntityDamageEvent event) + { + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void Damage(EntityRegainHealthEvent event) + { + if (event.getRegainReason() != RegainReason.CUSTOM) + event.setCancelled(true); + } + + public HashMap GetKarts() + { + return _karts; + } + + public Kart GetKart(Player player) + { + return _karts.get(player); + } + + public void AddKart(Player player, KartType type, GP gp) + { + RemoveKart(player); + + _karts.put(player, new Kart(player, type, gp)); + } + + public void RemoveKart(Player player) + { + _karts.remove(player); + UtilInv.Clear(player); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/KartState.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/KartState.java new file mode 100644 index 000000000..43624f664 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/KartState.java @@ -0,0 +1,14 @@ +package nautilus.game.minekart.kart; + + +public enum KartState +{ + Drive(), + Lakitu(), + Crash(), + + KartState() + { + + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/KartType.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/KartType.java new file mode 100644 index 000000000..4bfc2c026 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/KartType.java @@ -0,0 +1,176 @@ +package nautilus.game.minekart.kart; + +import mineplex.core.common.util.NautHashMap; +import nautilus.game.minekart.item.KartItemType; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; + +public enum KartType +{ + //Light + Pig("Pig", EntityType.PIG, Material.GRILLED_PORK, Material.GRILLED_PORK, + 0.9, 6, 5, 3, + Sound.PIG_IDLE, Sound.PIG_DEATH, Sound.PIG_WALK, + KartItemType.Pig), + + Chicken("Chicken", EntityType.CHICKEN, Material.FEATHER, Material.POTATO_ITEM, + 0.85, 8, 6, 1, + Sound.CHICKEN_IDLE, Sound.CHICKEN_HURT, Sound.CHICKEN_WALK, + KartItemType.Chicken), + + Wolf("Wolf", EntityType.WOLF, Material.SUGAR, Material.BAKED_POTATO, + 1.00, 5, 3, 2, + Sound.WOLF_BARK, Sound.WOLF_HURT, Sound.WOLF_WALK, + KartItemType.Wolf), + + //Med + Sheep("Sheep", EntityType.SHEEP, Material.WHEAT, Material.WHEAT, + 0.95, 4, 6, 5, + Sound.SHEEP_IDLE, Sound.SHEEP_SHEAR, Sound.SHEEP_WALK, + KartItemType.Sheep), + + Enderman("Enderman", EntityType.ENDERMAN, Material.FIREBALL, Material.ROTTEN_FLESH, + 0.90, 6, 5, 4, + Sound.ENDERMAN_IDLE, Sound.ENDERMAN_SCREAM, Sound.ENDERMAN_TELEPORT, + KartItemType.Enderman), + + Spider("Spider", EntityType.SPIDER, Material.STRING, Material.SPIDER_EYE, + 0.80, 7, 8, 4, + Sound.SPIDER_IDLE, Sound.SPIDER_DEATH, Sound.SPIDER_WALK, + KartItemType.Spider), + + //Heavy + Cow("Cow", EntityType.COW, Material.MILK_BUCKET, Material.MILK_BUCKET, + 1.0, 3, 5, 7, + Sound.COW_IDLE, Sound.COW_HURT, Sound.COW_WALK, + KartItemType.Cow), + + Blaze("Blaze", EntityType.BLAZE, Material.BLAZE_ROD, Material.COOKED_BEEF, + 1.0, 7, 1, 6, + Sound.BLAZE_BREATH, Sound.BLAZE_BREATH, Sound.BLAZE_BREATH, + KartItemType.Blaze), + + Golem("Golem", EntityType.IRON_GOLEM, Material.IRON_INGOT, Material.NETHER_BRICK_ITEM, + 1.05, 1, 7, 8, + Sound.IRONGOLEM_THROW, Sound.IRONGOLEM_HIT, Sound.IRONGOLEM_WALK, + KartItemType.Golem); + + private static NautHashMap _kartTypes; + + private String _name; + private EntityType _type; + private Material _kartAvatar; + private Material _grayAvatar; + + private double _topSpeed; + private double _acceleration; + private double _handling; + private double _stability; + + private Sound _soundUse; + private Sound _soundCrash; + private Sound _soundEngine; + + private KartItemType _kartItem; + + KartType(String name, EntityType type, Material kartAvatar, Material grayAvatar, double topSpeed, double acceleration, double handling, double stability, Sound use, Sound crash, Sound engine, KartItemType item) + { + _name = name; + _type = type; + _kartAvatar = kartAvatar; + _grayAvatar = grayAvatar; + + _topSpeed = topSpeed; + _acceleration = acceleration; + _handling = handling; + _stability = stability; + + _soundUse = use; + _soundCrash = crash; + _soundEngine = engine; + + _kartItem = item; + + GetMap().put(type, this); + } + + private static NautHashMap GetMap() + { + if (_kartTypes == null) + _kartTypes = new NautHashMap(); + + return _kartTypes; + } + + public static KartType GetByEntityType(EntityType entityType) + { + return _kartTypes.get(entityType); + } + + public String GetName() + { + return _name; + } + + public EntityType GetType() + { + return _type; + } + + public double GetTopSpeed() + { + return _topSpeed; + } + + public double GetAcceleration() + { + return 10 + _acceleration; + } + + public double GetHandling() + { + return 10 + _handling; + } + + public double GetStability() + { + return 10 + _stability; + } + + public Sound GetSoundMain() + { + return _soundUse; + } + + public Sound GetSoundCrash() + { + return _soundCrash; + } + + public Sound GetSoundEngine() + { + return _soundEngine; + } + + public KartItemType GetKartItem() + { + return _kartItem; + } + + public String[] GetDescription() + { + return new String[] {}; + } + + public Material GetAvatar() + { + return _kartAvatar; + } + + public Material GetAvatarGray() + { + return _grayAvatar; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/KartUtil.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/KartUtil.java new file mode 100644 index 000000000..1407ba002 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/KartUtil.java @@ -0,0 +1,67 @@ +package nautilus.game.minekart.kart; + +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; + +import org.bukkit.Location; +import org.bukkit.util.Vector; + +public class KartUtil +{ + public static boolean IsGrounded(Kart kart) + { + if (UtilEnt.isGrounded(kart.GetDriver())) + return true; + + //Standing on Air + int ground = kart.GetDriver().getLocation().subtract(0, 0.1, 0).getBlock().getTypeId() ; + if (ground == 0 || + ground == 8 || + ground == 9 || + ground == 10 || + ground == 11) + { + return false; + } + + return kart.GetDriver().getLocation().getY() % 0.5 == 0; + } + + public static boolean Stability(Kart kart, int amount) + { + UtilPlayer.hunger(kart.GetDriver(), -amount); + + return (kart.GetDriver().getFoodLevel() <= 0); + } + + public static Location GetBehind(Kart kart) + { + Location loc = kart.GetDriver().getLocation(); + loc.subtract(UtilAlg.Normalize(kart.GetVelocityClone().setY(0))); + + return loc; + } + + public static Location GetInfront(Kart kart) + { + Location loc = kart.GetDriver().getLocation(); + loc.add(UtilAlg.Normalize(kart.GetVelocityClone().setY(0))); + + return loc; + } + + public static Location GetLook(Kart kart) + { + Location loc = kart.GetDriver().getLocation(); + loc.add(UtilAlg.Normalize(kart.GetDriver().getLocation().getDirection().setY(0))); + + return loc; + } + + public static Vector GetSide(Kart kart) + { + Vector look = kart.GetDriver().getLocation().getDirection(); + return new Vector(look.getZ() * -1, 0, look.getX()); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/condition/Condition.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/condition/Condition.java new file mode 100644 index 000000000..5edac5f1d --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/condition/Condition.java @@ -0,0 +1,293 @@ +package nautilus.game.minekart.kart.condition; + +import org.bukkit.Color; +import org.bukkit.Effect; +import org.bukkit.EntityEffect; +import org.bukkit.Material; +import org.bukkit.Note; +import org.bukkit.Sound; +import org.bukkit.Note.Tone; +import org.bukkit.entity.Entity; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.LeatherArmorMeta; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilSound; +import nautilus.game.minekart.item.KartItemType; +import nautilus.game.minekart.item.world_items_custom.Flame; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartState; +import nautilus.game.minekart.kart.KartUtil; +import nautilus.game.minekart.kart.crash.Crash_Knockback; + +public class Condition +{ + public static Tone[] starSong = new Tone[] + { + Tone.C, + null, + Tone.C, + null, + null, + null, + Tone.C, + null, + null, + null, + null, + null, + Tone.C, + null, + null, + null, + Tone.C, + null, + null, + null, + Tone.C, + null, + Tone.C, + null, + null, + null, + Tone.C, + null, + null, + null, + null, + null, + Tone.B, + null, + Tone.B, + null, + null, + null, + Tone.B, + null, + null, + null, + null, + null, + Tone.B, + null, + null, + null, + Tone.B, + null, + null, + null, + Tone.B, + null, + Tone.B, + null, + null, + null, + Tone.B, + null, + null, + null, + null, + null, + }; + + public static void Boost(Kart kart) + { + if (!kart.HasCondition(ConditionType.Boost)) + return; + + if (!kart.CanControl()) + return; + + //Initial Velocity (if not moving) + if (kart.GetVelocity().length() <= 0) + kart.SetVelocity(kart.GetDriver().getLocation().getDirection().setY(0)); + + UtilAlg.Normalize(kart.GetVelocity()); + kart.GetVelocity().multiply(1.2); + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), Sound.FIZZ, 0.2f, 0.5f); + } + + public static void LightningSlow(Kart kart) + { + if (!kart.HasCondition(ConditionType.Lightning)) + return; + + //Effect + Entity ent = kart.GetDriver(); + + ent.getWorld().playEffect(ent.getLocation(), Effect.SMOKE, 1); + ent.getWorld().playEffect(ent.getLocation(), Effect.SMOKE, 3); + ent.getWorld().playEffect(ent.getLocation(), Effect.SMOKE, 5); + ent.getWorld().playEffect(ent.getLocation(), Effect.SMOKE, 7); + + + //Current Velocity + Vector vel = kart.GetVelocity(); + if (kart.GetCrash() != null) + vel = kart.GetCrash().GetVelocity(); + + if (vel.length() <= 0) + return; + + //Drag Horizontal + if (KartUtil.IsGrounded(kart)) + { + double drag = 0.008; + + //Variable Drag + vel.multiply(1 - drag); + + //Constant Drag + Vector dragVec = new Vector(vel.getX(), 0, vel.getZ()); + UtilAlg.Normalize(dragVec); + dragVec.multiply(0.0016); + vel.subtract(dragVec); + } + } + + public static void StarEffect(Kart kart) + { + if (!kart.HasCondition(ConditionType.Star)) + return; + + if (!kart.GetDriver().isOnline()) + return; + + //Song + if (starSong[kart.GetStarSongTick() % starSong.length] != null) + { + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), Sound.NOTE_PIANO, 1f, + UtilSound.GetPitch(new Note(1, starSong[kart.GetStarSongTick() % starSong.length], false))); + } + + //Effect + if (kart.GetStarSongTick() % 3 == 0) + { + Color color = Color.RED; + + if (kart.GetStarSongTick() % 12 == 0) color = Color.BLUE; + else if (kart.GetStarSongTick() % 9 == 0) color = Color.GREEN; + else if (kart.GetStarSongTick() % 6 == 0) color = Color.YELLOW; + + LeatherArmorMeta meta; + + ItemStack head = new ItemStack(Material.LEATHER_HELMET); + meta = (LeatherArmorMeta)head.getItemMeta(); + meta.setColor(color); + head.setItemMeta(meta); + + ItemStack chest = new ItemStack(Material.LEATHER_CHESTPLATE); + meta = (LeatherArmorMeta)chest.getItemMeta(); + meta.setColor(color); + chest.setItemMeta(meta); + + ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS); + meta = (LeatherArmorMeta)legs.getItemMeta(); + meta.setColor(color); + legs.setItemMeta(meta); + + ItemStack boots = new ItemStack(Material.LEATHER_BOOTS); + meta = (LeatherArmorMeta)boots.getItemMeta(); + meta.setColor(color); + boots.setItemMeta(meta); + + kart.GetDriver().getInventory().setHelmet(head); + kart.GetDriver().getInventory().setChestplate(chest); + kart.GetDriver().getInventory().setLeggings(legs); + kart.GetDriver().getInventory().setBoots(boots); + } + + //Tick + kart.SetStarSongTick(kart.GetStarSongTick() + 1); + } + + public static void StarCollide(Kart kart) + { + if (!kart.HasCondition(ConditionType.Star)) + return; + + for (Kart other : kart.GetGP().GetKarts()) + { + if (other.equals(kart)) + continue; + + if (other.HasCondition(ConditionType.Ghost) || other.HasCondition(ConditionType.Star)) + continue; + + if (other.GetKartState() != KartState.Drive) + continue; + + if (!kart.GetDriver().getWorld().equals(other.GetDriver().getWorld())) + continue; + + if (UtilMath.offset(kart.GetDriver(), other.GetDriver()) > 1) + continue; + + //Effects + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), Sound.EXPLODE, (float)0.5f, 0.5f); + + //Inform + UtilPlayer.message(other.GetDriver(), F.main("MK", F.elem(UtilEnt.getName(kart.GetDriver())) + " rammed you with " + F.item("Star") + ".")); + UtilPlayer.message(kart.GetDriver(), F.main("MK", "You rammed " + F.elem(UtilEnt.getName(other.GetDriver())) + " with " + F.item("Star") + ".")); + + //Hit Kart + new Crash_Knockback(other, kart.GetDriver().getLocation(), 1.5); + } + } + + public static void SuperMushroom(Kart kart) + { + if (!kart.HasCondition(ConditionType.SuperMushroom)) + return; + + if (kart.GetItemStored() != KartItemType.SuperMushroom) + return; + + ItemStack item = kart.GetDriver().getInventory().getItem(3); + + if (item == null) + { + kart.SetItemStored(KartItemType.SuperMushroom); + } + else + { + kart.SetItemStored(null); + } + } + + public static void WolfHeart(Kart kart) + { + if (!kart.HasCondition(ConditionType.WolfHeart)) + return; + + kart.GetDriver().playEffect(EntityEffect.WOLF_HEARTS); + } + + public static void BlazeFire(Kart kart) + { + if (!kart.HasCondition(ConditionType.BlazeFire)) + return; + + //Speed Boost + Vector vel = kart.GetDriver().getLocation().getDirection(); + vel.setY(0); + vel.normalize(); + kart.GetVelocity().setX(vel.getX()); + kart.GetVelocity().setZ(vel.getZ()); + + if (kart.GetVelocity().length() <= 0) + kart.SetVelocity(kart.GetDriver().getLocation().getDirection().setY(0)); + + UtilAlg.Normalize(kart.GetVelocity()); + kart.GetVelocity().multiply(1.1); + + //Drop Fire + new Flame(kart.GetGP().Manager.KartManager.ItemManager, kart, KartUtil.GetBehind(kart)); + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), Sound.FIRE, 2f, 2f); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/condition/ConditionData.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/condition/ConditionData.java new file mode 100644 index 000000000..7edf6cc6f --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/condition/ConditionData.java @@ -0,0 +1,30 @@ +package nautilus.game.minekart.kart.condition; + +public class ConditionData +{ + private ConditionType _type; + private long _start; + private long _duration; + + public ConditionData(ConditionType type, long duration) + { + _type = type; + _start = System.currentTimeMillis(); + _duration = duration; + } + + public boolean IsExpired() + { + return System.currentTimeMillis() > _start + _duration; + } + + public boolean IsCondition(ConditionType type) + { + return _type == type; + } + + public void Expire() + { + _start = 0; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/condition/ConditionType.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/condition/ConditionType.java new file mode 100644 index 000000000..ed5627049 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/condition/ConditionType.java @@ -0,0 +1,14 @@ +package nautilus.game.minekart.kart.condition; + +public enum ConditionType +{ + Ghost, + Boost, + Star, + Lightning, + SuperMushroom, + + WolfHeart, + BlazeFire, + CowSuper +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/control/Collision.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/control/Collision.java new file mode 100644 index 000000000..3b6241f7e --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/control/Collision.java @@ -0,0 +1,201 @@ +package nautilus.game.minekart.kart.control; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartState; +import nautilus.game.minekart.kart.KartUtil; +import nautilus.game.minekart.kart.condition.ConditionType; +import nautilus.game.minekart.kart.crash.Crash_Bump; +import nautilus.game.minekart.kart.crash.Crash_Knockback; +import nautilus.game.minekart.kart.crash.Crash_Spin; + +import org.bukkit.Effect; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.util.Vector; + +public class Collision +{ + public static void CollideBlock(Kart kart) + { + //Current Velocity + Vector vel = kart.GetVelocity(); + if (kart.GetCrash() != null) + if (kart.GetCrash().GetVelocity() != null) + vel = kart.GetCrash().GetVelocity(); + + Block block; + + double dist = 0.5; + + boolean done = false; + + block = kart.GetDriver().getLocation().add(dist, 0, 0).getBlock(); + if (vel.getX() > 0 && UtilBlock.solid(block)) {CollideBlock(kart, block, vel, true); done = true;} + + block = kart.GetDriver().getLocation().add(-dist, 0, 0).getBlock(); + if (vel.getX() < 0 && UtilBlock.solid(block)) {CollideBlock(kart, block, vel, true); done = true;} + + block = kart.GetDriver().getLocation().add(0, 0, dist).getBlock(); + if (vel.getZ() > 0 && UtilBlock.solid(block)) {CollideBlock(kart, block, vel, false); done = true;} + + block = kart.GetDriver().getLocation().add(0, 0, -dist).getBlock(); + if (vel.getZ() < 0 && UtilBlock.solid(block)) {CollideBlock(kart, block, vel, false); done = true;} + + if (done) + return; + + block = kart.GetDriver().getLocation().add(dist, 1, 0).getBlock(); + if (vel.getX() > 0 && UtilBlock.solid(block)) CollideBlock(kart, block, vel, true); + + block = kart.GetDriver().getLocation().add(-dist, 1, 0).getBlock(); + if (vel.getX() < 0 && UtilBlock.solid(block)) CollideBlock(kart, block, vel, true); + + block = kart.GetDriver().getLocation().add(0, 1, dist).getBlock(); + if (vel.getZ() > 0 && UtilBlock.solid(block)) CollideBlock(kart, block, vel, false); + + block = kart.GetDriver().getLocation().add(0, 1, -dist).getBlock(); + if (vel.getZ() < 0 && UtilBlock.solid(block)) CollideBlock(kart, block, vel, false); + } + + public static void CollideBlock(Kart kart, Block block, Vector vel, boolean X) + { + //Get Collision Power + double power = vel.getX(); + if (!X) power = vel.getZ(); + + power = Math.abs(power); + + //Set Velocity + if (X) vel.setX(0); + else vel.setZ(0); + + if (power < 0.4) + return; + + //Effects + block.getWorld().playSound(kart.GetDriver().getLocation(), Sound.IRONGOLEM_WALK, (float)power * 3, 1f); + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + + //Effect Stability + if (KartUtil.Stability(kart, (int) (power * 20))) + { + new Crash_Knockback(kart, block.getLocation().add(0.5, 0.5, 0.5), power); + } + else + { + new Crash_Bump(kart, block.getLocation().add(0.5, 0.5, 0.5), power); + } + } + + public static void CollidePlayer(Kart kart) + { + if (kart.HasCondition(ConditionType.Ghost) || kart.HasCondition(ConditionType.Star)) + return; + + for (Kart other : kart.GetGP().GetKarts()) + { + if (other.equals(kart)) + continue; + + if (other.HasCondition(ConditionType.Ghost) || other.HasCondition(ConditionType.Star)) + continue; + + if (kart.GetKartState() != KartState.Drive && other.GetKartState() != KartState.Drive) + continue; + + if (!kart.GetDriver().getWorld().equals(other.GetDriver().getWorld())) + continue; + + if (UtilMath.offset(kart.GetDriver(), other.GetDriver()) > 1) + continue; + + double collisionVel = 0; + + //Collisions + { + //X-Pos + if (kart.GetVelocity().getX() > 0 && other.GetDriver().getLocation().getX() > kart.GetDriver().getLocation().getX()) + { + double vel = kart.GetVelocity().getX() - other.GetVelocity().getX(); + + if (vel > 0) + collisionVel += vel; + } + //X-Neg + else if (kart.GetVelocity().getX() < 0 && other.GetDriver().getLocation().getX() < kart.GetDriver().getLocation().getX()) + { + double vel = kart.GetVelocity().getX() - other.GetVelocity().getX(); + + if (vel < 0) + collisionVel -= vel; + } + + //Z-Pos + if (kart.GetVelocity().getZ() > 0 && other.GetDriver().getLocation().getZ() > kart.GetDriver().getLocation().getZ()) + { + double vel = kart.GetVelocity().getZ() - other.GetVelocity().getZ(); + + if (vel > 0) + collisionVel += vel; + } + //Z-Neg + else if (kart.GetVelocity().getZ() < 0 && other.GetDriver().getLocation().getZ() < kart.GetDriver().getLocation().getZ()) + { + double vel = kart.GetVelocity().getZ() - other.GetVelocity().getZ(); + + if (vel < 0) + collisionVel -= vel; + } + } + + if (collisionVel <= 0) + return; + + collisionVel *= 2; + + //Effects + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), Sound.IRONGOLEM_HIT, (float)collisionVel, 1f); + + double powScale = 0.05; + + //Hit Kart + double relPower = ((collisionVel * other.GetKartType().GetStability()) / (kart.GetKartType().GetStability() / 10)); + if (KartUtil.Stability(kart, (int)relPower)) + { + //Inform + UtilPlayer.message(kart.GetDriver(), F.main("MK", F.elem(UtilEnt.getName(other.GetDriver())) + " knocked you out.")); + UtilPlayer.message(other.GetDriver(), F.main("MK", "You knocked out " + F.elem(UtilEnt.getName(kart.GetDriver())) + ".")); + + //Crash + if (collisionVel > 2) new Crash_Knockback(kart, other.GetDriver().getLocation(), relPower * powScale); + else new Crash_Spin(kart, other.GetDriver().getLocation(), relPower * powScale); + } + else + { + new Crash_Bump(kart, other.GetDriver().getLocation(), relPower * powScale); + } + + //Hit Other + relPower = ((collisionVel * kart.GetKartType().GetStability()) / (other.GetKartType().GetStability() / 10)); + if (KartUtil.Stability(other, (int)relPower)) + { + //Inform + UtilPlayer.message(other.GetDriver(), F.main("MK", F.elem(UtilEnt.getName(kart.GetDriver())) + " knocked you out.")); + UtilPlayer.message(kart.GetDriver(), F.main("MK", "You knocked out " + F.elem(UtilEnt.getName(other.GetDriver())) + ".")); + + //Crash + if (collisionVel > 2) new Crash_Knockback(other, kart.GetDriver().getLocation(), relPower * powScale); + else new Crash_Spin(other, kart.GetDriver().getLocation(), relPower * powScale); + } + else + { + new Crash_Bump(other, kart.GetDriver().getLocation(), relPower * powScale); + } + } + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/control/Drive.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/control/Drive.java new file mode 100644 index 000000000..bc8eb69ae --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/control/Drive.java @@ -0,0 +1,159 @@ +package nautilus.game.minekart.kart.control; + +import mineplex.core.common.util.UtilAlg; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartUtil; +import nautilus.game.minekart.kart.condition.ConditionType; + +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +public class Drive +{ + public static void TopSpeed(Kart kart) + { + if (!kart.CanControl()) + return; + + if (!KartUtil.IsGrounded(kart)) + return; + + if (kart.HasCondition(ConditionType.Boost)) + return; + + double topSpeed = kart.GetKartType().GetTopSpeed(); + + if (kart.HasCondition(ConditionType.Star)) + topSpeed *= 1.2; + + if (kart.GetSpeed() > topSpeed) + { + Vector vel = kart.GetVelocityClone(); + vel.setY(0); + vel.normalize(); + vel.multiply(topSpeed); + + kart.SetVelocity(vel); + } + } + + public static void Accelerate(Kart kart) + { + if (!kart.CanControl()) + return; + + if (!KartUtil.IsGrounded(kart)) + return; + + if (!kart.GetDriver().isBlocking()) + return; + + ItemStack item = kart.GetDriver().getItemInHand(); + if (item == null || item.getType() != Material.STONE_SWORD) + return; + + //Current Velocity + Vector vel = kart.GetVelocity(); + + //Initial Velocity + if (vel.length() == 0) + { + vel = kart.GetDriver().getLocation().getDirection().setY(0); + + //Looking directly Up/Down + if (vel.length() == 0) + return; + + vel.normalize(); + vel.multiply(0.001); + + kart.SetVelocity(vel); + } + + //Kart Acceleration + Vector acc = new Vector(vel.getX(), 0, vel.getZ()); + UtilAlg.Normalize(acc); + + double acceleration = kart.GetKartType().GetAcceleration(); + if (kart.HasCondition(ConditionType.Star)) + acceleration *= 1.2; + + acc.multiply(0.001 * acceleration); + vel.add(acc); +} + + public static void Brake(Kart kart) + { + if (!kart.CanControl()) + return; + + if (!KartUtil.IsGrounded(kart)) + return; + + if (!kart.GetDriver().isBlocking()) + return; + + ItemStack item = kart.GetDriver().getItemInHand(); + if (item == null || item.getType() != Material.WOOD_SWORD) + return; + + //Current Velocity + Vector vel = kart.GetVelocity(); + + //Drag % + vel.multiply(0.95); + + if (vel.length() < 0.05) + vel.multiply(0); + } + + public static void Turn(Kart kart) + { + if (!kart.CanControl()) + return; + + if (!KartUtil.IsGrounded(kart)) + return; + + //Current Velocity + Vector vel = kart.GetVelocity(); + + if (vel.length() <= 0) + return; + + double speed = vel.length(); + + double handling = kart.GetKartType().GetHandling(); + if (kart.HasCondition(ConditionType.Star)) + handling *= 1.2; + + //Turn + Vector turn = kart.GetDriver().getLocation().getDirection(); + turn.setY(0); + UtilAlg.Normalize(turn); + + turn.subtract(UtilAlg.Normalize(new Vector(vel.getX(), 0, vel.getZ()))); + + turn.multiply(0.003 * handling); + + vel.add(turn); + + //Reapply Speed + speed = (speed + (vel.length()*3)) / 4; + UtilAlg.Normalize(vel); + vel.multiply(speed); + } + + public static void Move(Kart kart) + { + //Current Velocity + Vector vel = kart.GetVelocity(); + + kart.GetDriver().setVelocity(vel); + + //Display Velocity as Exp + kart.GetDriver().setExp(Math.min(0.999f, ((float)kart.GetSpeed()/(float)kart.GetKartType().GetTopSpeed()))); + kart.GetDriver().setLevel((int) (kart.GetSpeed() * 100)); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/control/DriveDrift.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/control/DriveDrift.java new file mode 100644 index 000000000..b7b723431 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/control/DriveDrift.java @@ -0,0 +1,140 @@ +package nautilus.game.minekart.kart.control; + +import mineplex.core.common.util.UtilAlg; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.Kart.DriftDirection; +import nautilus.game.minekart.kart.condition.ConditionData; +import nautilus.game.minekart.kart.condition.ConditionType; +import nautilus.game.minekart.kart.KartUtil; + +import org.bukkit.Effect; +import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.util.Vector; + +public class DriveDrift +{ + public static void Hop(Kart kart, PlayerToggleSneakEvent event) + { + if (kart == null) + return; + + if (!kart.CanControl()) + return; + + if (event.getPlayer().isSneaking()) + { + Boost(kart); + kart.ClearDrift(); + return; + } + + if (!KartUtil.IsGrounded(kart)) + return; + + //Save Drift Values + kart.SetDrift(); + + /* + + //Current Velocity + Vector vel = kart.GetVelocity(); + double speed = vel.length(); + + //Turn + if (vel.length() > 0) + { + Vector turn = kart.GetDriver().getLocation().getDirection(); + turn.setY(0); + UtilAlg.Normalize(turn); + + turn.subtract(UtilAlg.Normalize(new Vector(vel.getX(), 0, vel.getZ()))); + + turn.multiply(0.1); + + vel.add(turn); + + UtilAlg.Normalize(vel); + vel.multiply(speed); + } + + //Hop + Vector hop = kart.GetDriver().getLocation().getDirection(); + hop.setY(0); + UtilAlg.Normalize(hop); + hop.multiply(0.03); + hop.setY(0.12); + + if (hop.length() > 0) + vel.add(hop); + */ + } + + public static void Drift(Kart kart) + { + if (!kart.CanControl()) + return; + + if (!kart.GetDriver().isSneaking()) + { + kart.ClearDrift(); + return; + } + + if (!KartUtil.IsGrounded(kart)) + return; + + if (kart.GetDrift() == DriftDirection.None) + return; + + //Current Velocity + Vector vel = kart.GetVelocity(); + double speed = kart.GetVelocity().length(); + + if (speed < 0.5) + { + kart.ClearDrift(); + return; + } + + //Drift + vel.add(kart.GetDriftVector().multiply(0.030)); + + //Turn + Vector turn = kart.GetDriver().getLocation().getDirection(); + turn.setY(0); + UtilAlg.Normalize(turn); + + turn.subtract(UtilAlg.Normalize(new Vector(vel.getX(), 0, vel.getZ()))); + + turn.multiply(0.0015 * kart.GetKartType().GetHandling()); + + vel.add(turn); + + //Reapply Speed + UtilAlg.Normalize(vel); + vel.multiply(speed); + + //Effect + long driftTime = kart.GetDriftTime(); + int effectId = 42; + if (driftTime > 4000) effectId = 57; + else if (driftTime > 2500) effectId = 41; + + kart.GetDriver().getWorld().playEffect(kart.GetDriver().getLocation().add(0, -1, 0), Effect.STEP_SOUND, effectId); + } + + public static void Boost(Kart kart) + { + if (kart.GetDrift() == DriftDirection.None) + return; + + if (kart.GetDriftTime() < 4000) + return; + + kart.AddCondition(new ConditionData(ConditionType.Boost, 2000)); + + //Effect + kart.GetDriver().getWorld().playEffect(kart.GetDriver().getLocation(), Effect.STEP_SOUND, 57); + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), kart.GetKartType().GetSoundMain(), 2f, 1f); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/control/World.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/control/World.java new file mode 100644 index 000000000..9398d7b5f --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/control/World.java @@ -0,0 +1,163 @@ +package nautilus.game.minekart.kart.control; + +import mineplex.core.common.util.UtilAlg; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartUtil; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.util.Vector; + +public class World +{ + public static void Gravity(Kart kart) + { + //Current Velocity + Vector vel = kart.GetVelocity(); + if (kart.GetCrash() != null) + vel = kart.GetCrash().GetVelocity(); + + //Landed + if (KartUtil.IsGrounded(kart)) + { + if (vel.getY() < 0) + vel.setY(0); + + return; + } + + //Downward Gravity + double down = Math.max(-1.0, vel.getY() - 0.1); + vel.setY(down); + } + + public static void AirDrag(Kart kart) + { + //Current Velocity + Vector vel = kart.GetVelocity(); + if (kart.GetCrash() != null) + vel = kart.GetCrash().GetVelocity(); + + if (vel.length() <= 0) + return; + + //Drag Horizontal + if (KartUtil.IsGrounded(kart)) + { + double drag = Math.log(vel.length() + 1) / 50d; + drag *= 1 / kart.GetKartType().GetTopSpeed(); //Increase for lower top speed karts + drag *= (kart.GetKartType().GetAcceleration() / 21d); //Reduce for lower accel karts + + //Variable Drag + vel.multiply(1 - drag); + } + //Drag Vertical + else + { + vel.setY(vel.getY() * 0.98); + } + } + + public static void FireDrag(Kart kart) + { + if (kart.GetDriver().getFireTicks() <= 0) + return; + + //Current Velocity + Vector vel = kart.GetVelocity(); + if (kart.GetCrash() != null) + return; + + if (vel.length() <= 0) + return; + + //Drag Horizontal + double drag = 0.008; + + //Variable Drag + vel.multiply(1 - drag); + } + + public static void RoadDrag(Kart kart) + { + if (!KartUtil.IsGrounded(kart)) + return; + + if (kart.GetGP() == null) + return; + + if (kart.GetGP().GetTrack() == null) + return; + + Block block = kart.GetDriver().getLocation().getBlock().getRelative(BlockFace.DOWN); + + //Current Velocity + Vector vel = kart.GetVelocity(); + if (kart.GetCrash() != null) + vel = kart.GetCrash().GetVelocity(); + + if (vel.length() <= 0) + return; + + //Constant Drag + Vector dragVec = new Vector(vel.getX(), 0, vel.getZ()); + UtilAlg.Normalize(dragVec); + dragVec.multiply(0.003); + vel.subtract(dragVec); + + //Off Road + if (!kart.GetGP().GetTrack().GetTrackBlocks().contains(block.getTypeId())) + if (block.getType() == Material.GRASS || + block.getType() == Material.SAND) + { + //Drag Horizontal + double drag = 0.025; + + //Variable Drag + vel.multiply(1 - drag); + + //Effect + if (kart.GetSpeed() > 0.2) + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + } + + //Stop Completely + if (!kart.GetDriver().isBlocking()) + if (vel.length() < 0.02) + vel.multiply(0); + } + + public static void BlockDrag(Kart kart) + { + if (!KartUtil.IsGrounded(kart)) + return; + + Block block = kart.GetDriver().getLocation().getBlock(); + + //Current Velocity + Vector vel = kart.GetVelocity(); + if (kart.GetCrash() != null) + vel = kart.GetCrash().GetVelocity(); + + if (vel.length() <= 0) + return; + + double drag = 0; + + if (block.getType() == Material.LONG_GRASS) drag = 0.02; + else if (block.getType() == Material.WATER) drag = 0.03; + else if (block.getType() == Material.STATIONARY_WATER) drag = 0.03; + + if (drag <= 0) + return; + + //Slow + vel.multiply(1 - drag); + + //Effect + if (vel.length() > 0.2) + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/crash/Crash.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/crash/Crash.java new file mode 100644 index 000000000..095da60bf --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/crash/Crash.java @@ -0,0 +1,83 @@ +package nautilus.game.minekart.kart.crash; + +import mineplex.core.common.util.UtilTime; +import nautilus.game.minekart.kart.Kart; + +import org.bukkit.EntityEffect; +import org.bukkit.util.Vector; + +public class Crash +{ + private Vector _velocity; + private long _crashTime; + private long _crashReq; + private boolean _canEnd; + private boolean _restoreStability; + + public Crash(Kart kart, Vector vel, long timeReq, boolean canEnd, boolean restoreStability) + { + kart.SetCrash(this); + kart.ClearDrift(); + + _velocity = vel; + _crashTime = System.currentTimeMillis(); + _crashReq = timeReq; + _canEnd = canEnd; + _restoreStability = restoreStability; + + kart.GetDriver().playEffect(EntityEffect.HURT); + } + + public void Update(Kart kart) + { + Move(kart); + } + + public void Move(Kart kart) + { + kart.GetDriver().setVelocity(_velocity); + + //Display Velocity as Exp + kart.GetDriver().setExp(Math.min(0.999f, ((float)_velocity.length()/(float)1.8))); + } + + public boolean CrashEnd() + { + return _canEnd && UtilTime.elapsed(_crashTime , _crashReq); + } + + public Vector GetVelocity() + { + return _velocity; + } + + public void SetVelocity(Vector vel) + { + _velocity = vel; + } + + public long GetCrashTime() + { + return _crashTime; + } + + public long GetCrashReq() + { + return _crashReq; + } + + public void SetCanEnd(boolean end) + { + _canEnd = end; + } + + public void SetCrashReq(long time) + { + _crashReq = time; + } + + public boolean StabilityRestore() + { + return _restoreStability; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/crash/Crash_Bump.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/crash/Crash_Bump.java new file mode 100644 index 000000000..15fad997a --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/crash/Crash_Bump.java @@ -0,0 +1,33 @@ +package nautilus.game.minekart.kart.crash; + +import mineplex.core.common.util.UtilAlg; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartState; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.util.Vector; + +public class Crash_Bump extends Crash +{ + public Crash_Bump(Kart kart, Location other, double power) + { + super(kart, new Vector(0,0,0), (long) (800 * power), true, false); + + //Effect + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), Sound.IRONGOLEM_HIT, (float)power, 1f); + + //Apply Knockback + Vector knock = UtilAlg.getTrajectory(other, kart.GetDriver().getLocation()); + knock.multiply(0.4 * power); + knock.add(new Vector(0, 0.4 * power, 0)); + SetVelocity(knock); + + double powerTrim = Math.min(power, 1) / 2; + + //Lose some velocity + kart.GetVelocity().multiply(1 - powerTrim); + + kart.SetKartState(KartState.Crash); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/crash/Crash_Explode.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/crash/Crash_Explode.java new file mode 100644 index 000000000..5617cb00d --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/crash/Crash_Explode.java @@ -0,0 +1,26 @@ +package nautilus.game.minekart.kart.crash; + +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartState; + +import org.bukkit.util.Vector; + +public class Crash_Explode extends Crash +{ + public Crash_Explode(Kart kart, double power, boolean resetVelocity) + { + super(kart, new Vector(0,0,0), (long) (1400 * power), true, true); + + //Effect + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), kart.GetKartType().GetSoundCrash(), 2f, 1f); + + //Apply Upwards + SetVelocity(kart.GetVelocityClone().add(new Vector(0, power * 1, 0))); + + //Remove Karts Velocity + if (resetVelocity) + kart.CrashStop(); + + kart.SetKartState(KartState.Crash); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/crash/Crash_Knockback.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/crash/Crash_Knockback.java new file mode 100644 index 000000000..7b409d9e8 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/crash/Crash_Knockback.java @@ -0,0 +1,33 @@ +package nautilus.game.minekart.kart.crash; + +import mineplex.core.common.util.UtilAlg; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartState; + +import org.bukkit.Location; +import org.bukkit.util.Vector; + +public class Crash_Knockback extends Crash +{ + + public Crash_Knockback(Kart kart, Location other, double power) + { + super(kart, new Vector(0,0,0), 1000, true, true); + + power = Math.min(power, 1.5); + + //Effect + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), kart.GetKartType().GetSoundCrash(), 2f, 1f); + + //Apply Knockback + Vector knock = UtilAlg.getTrajectory(other, kart.GetDriver().getLocation()); + knock.multiply(0.6 * power); + knock.add(new Vector(0, power * 0.8, 0)); + SetVelocity(knock); + + //Remove Karts Velocity + kart.CrashStop(); + + kart.SetKartState(KartState.Crash); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/crash/Crash_Spin.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/crash/Crash_Spin.java new file mode 100644 index 000000000..302486780 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/crash/Crash_Spin.java @@ -0,0 +1,51 @@ +package nautilus.game.minekart.kart.crash; + +import mineplex.core.common.util.UtilAlg; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartState; + +import org.bukkit.Location; +import org.bukkit.util.Vector; + +public class Crash_Spin extends Crash +{ + public Crash_Spin(Kart kart, Location other, double power) + { + super(kart, new Vector(0,0,0), (long) (1500 * power), true, true); + + power = Math.min(power, 1.5); + + //Effect + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), kart.GetKartType().GetSoundCrash(), 2f, 1f); + + //Apply Knockback + Vector knock = UtilAlg.getTrajectory(other, kart.GetDriver().getLocation()); + knock.setY(0); + UtilAlg.Normalize(knock); + knock.multiply(0.6 * power); + SetVelocity(knock); + + //Remove Karts Velocity + kart.CrashStop(); + + kart.SetKartState(KartState.Crash); + } + + public Crash_Spin(Kart kart, double power) + { + super(kart, new Vector(0,0,0), (long) (2000 * power), true, true); + + power = Math.min(power, 1.5); + + //Effect + kart.GetDriver().getWorld().playSound(kart.GetDriver().getLocation(), kart.GetKartType().GetSoundCrash(), 2f, 1f); + + //Apply Knockback + SetVelocity(kart.GetVelocity()); + + //Remove Karts Velocity + kart.CrashStop(); + + kart.SetKartState(KartState.Crash); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/menu/KartMenu.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/menu/KartMenu.java new file mode 100644 index 000000000..8feab8342 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/menu/KartMenu.java @@ -0,0 +1,34 @@ +package nautilus.game.minekart.menu; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.shop.ShopBase; +import mineplex.core.shop.page.ShopPageBase; + +import nautilus.game.minekart.KartFactory; +import nautilus.game.minekart.gp.GPManager; +import nautilus.game.minekart.shop.KartItem; + +import org.bukkit.entity.Player; + +public class KartMenu extends ShopBase +{ + private GPManager _gpManager; + + public KartMenu(KartFactory plugin, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager, GPManager gpManager) + { + super(plugin, clientManager, donationManager, "Kart Select"); + + _gpManager = gpManager; + } + + @Override + protected ShopPageBase> BuildPagesFor(Player player) + { + return new KartPage(Plugin, ClientManager, DonationManager, this, _gpManager, player); + } + + public void SelectKart(Player player, KartItem kartItem) + { + _gpManager.SelectKart(player, kartItem.GetKartType()); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/menu/KartPage.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/menu/KartPage.java new file mode 100644 index 000000000..fe65be6bd --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/menu/KartPage.java @@ -0,0 +1,213 @@ +package nautilus.game.minekart.menu; + +import java.util.ArrayList; +import java.util.List; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.page.ShopPageBase; + +import nautilus.game.minekart.KartFactory; +import nautilus.game.minekart.gp.GPManager; +import nautilus.game.minekart.gp.GPSet; +import nautilus.game.minekart.item.KartItemType; +import nautilus.game.minekart.kart.KartType; +import nautilus.game.minekart.shop.KartItem; +import net.minecraft.server.v1_6_R2.NBTTagList; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; + +public class KartPage extends ShopPageBase +{ + private GPManager _gpManager; + private ItemStack[] _playerInventoryContents; + + public KartPage(KartFactory plugin, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager, KartMenu shop, GPManager gpManager, Player player) + { + super(plugin, shop, clientManager, donationManager, " ", player); + + _gpManager = gpManager; + _playerInventoryContents = player.getInventory().getContents().clone(); + + BuildPage(); + } + + public void PlayerOpened() + { + UpdateKarts(); + } + + @SuppressWarnings("deprecation") + @Override + public void PlayerClosed() + { + super.PlayerClosed(); + + Player.getInventory().setContents(_playerInventoryContents); + + Player.updateInventory(); + } + + @Override + protected void BuildPage() + { + getInventory().setItem(0, new ShopItem(Material.INK_SACK, (byte)1, "", new String[] {}, 1, false, true).getHandle()); + getInventory().setItem(1, new ShopItem(Material.INK_SACK, (byte)4, "", new String[] {}, 1, false, true).getHandle()); + getInventory().setItem(2, new ShopItem(Material.INK_SACK, (byte)3, "", new String[] {}, 1, false, true).getHandle()); + getInventory().setItem(3, new ShopItem(Material.INK_SACK, (byte)6, "", new String[] {}, 1, false, true).getHandle()); + getInventory().setItem(4, new ShopItem(Material.INK_SACK, (byte)8, "", new String[] {}, 1, false, true).getHandle()); + getInventory().setItem(5, new ShopItem(Material.INK_SACK, (byte)2, "", new String[] {}, 1, false, true).getHandle()); + getInventory().setItem(6, new ShopItem(Material.INK_SACK, (byte)12, "", new String[] {}, 1, false, true).getHandle()); + getInventory().setItem(7, new ShopItem(Material.INK_SACK, (byte)10, "", new String[] {}, 1, false, true).getHandle()); + getInventory().setItem(8, new ShopItem(Material.INK_SACK, (byte)13, "", new String[] {}, 1, false, true).getHandle()); + + UpdateKarts(); + + ShowKartStats(_gpManager.GetSelectedKart(Player)); + } + + public void SelectKart(Player player, KartItem kartItem) + { + if (DonationManager.Get(player.getName()).Owns(kartItem.GetSalesPackageId()) || kartItem.IsFree() || DonationManager.Get(Client.GetPlayerName()).OwnsUnknownPackage("Minekart ULTRA") || Client.GetRank().Has(player, Rank.ULTRA, false)) + { + Shop.SelectKart(player, kartItem); + PlayAcceptSound(player); + ShowKartStats(_gpManager.GetSelectedKart(Player)); + UpdateKarts(); + } + else + { + PlayDenySound(player); + ShowKartStats(kartItem.GetKartType()); + } + } + + protected void ShowKartStats(KartType kartType) + { + for (KartItem item : Plugin.GetKarts()) + { + if (kartType == item.GetKartType()) + { + PlayerInventory inventory = Player.getInventory(); + inventory.clear(); + + double statValue = Math.ceil((kartType.GetTopSpeed() * 100 - 79) / 2.625); + Material statMaterial = GetStatMaterial(statValue); + int slot = 9; + inventory.setItem(slot, ItemStackFactory.Instance.CreateStack(Material.WOOD_HOE, (byte)0, (int)(kartType.GetTopSpeed() * 100), "§e§lTop Speed")); + + slot++; + while (statValue >= 1) + { + inventory.setItem(slot, ItemStackFactory.Instance.CreateStack(statMaterial, (byte)0, 1, "§e§lSpeed Bar")); + slot++; + statValue -= 1; + } + + statValue = kartType.GetAcceleration() - 10; + statMaterial = GetStatMaterial(statValue); + slot = 18; + inventory.setItem(slot, ItemStackFactory.Instance.CreateStack(Material.STONE_HOE, (byte)0, (int)statValue, "§e§lAcceleration")); + + slot++; + while (statValue >= 1) + { + inventory.setItem(slot, ItemStackFactory.Instance.CreateStack(statMaterial, (byte)0, 1, "§e§lAcceleration Bar")); + slot++; + statValue -= 1; + } + + statValue = kartType.GetHandling() - 10; + statMaterial = GetStatMaterial(statValue); + slot = 27; + inventory.setItem(slot, ItemStackFactory.Instance.CreateStack(Material.IRON_HOE, (byte)0, (int)statValue, "§e§lHandling")); + + slot++; + while (statValue >= 1) + { + inventory.setItem(slot, ItemStackFactory.Instance.CreateStack(statMaterial, (byte)0, 1, "§e§lHandling Bar")); + slot++; + statValue -= 1; + } + } + } + } + + protected boolean IsValidGPSet(GPSet gpSet) + { + return gpSet == GPSet.MushroomCup || gpSet == GPSet.Battle; + } + + public void UpdateKarts() + { + int slot = 45; + boolean locked = true; + + for (KartItem item : Plugin.GetKarts()) + { + if (DonationManager.Get(Client.GetPlayerName()).Owns(item.GetSalesPackageId()) || DonationManager.Get(Client.GetPlayerName()).OwnsUnknownPackage("Minekart ULTRA") || Client.GetRank().Has(Client.GetPlayer(), Rank.ULTRA, false) || item.IsFree()) + locked = false; + else + locked = true; + + List itemLore = new ArrayList(); + + if (locked) + { + itemLore.add(C.cGreen + "Purchase at Kart Shop"); + } + + itemLore.add(C.cBlack); + + itemLore.add(C.cWhite + "Max Speed: " + GetStatColor(Math.ceil((item.GetKartType().GetTopSpeed() * 100 - 79) / 2.625)) + item.GetKartType().GetTopSpeed() * 100); + itemLore.add(C.cWhite + "Acceleration: " + GetStatColor(item.GetKartType().GetAcceleration() - 10) + (item.GetKartType().GetAcceleration() - 10)); + itemLore.add(C.cWhite + "Handling: " + GetStatColor(item.GetKartType().GetHandling() - 10) + (item.GetKartType().GetHandling() - 10)); + itemLore.add(C.cWhite + "Weight: " + GetStatColor(item.GetKartType().GetStability() - 10) + (item.GetKartType().GetStability() - 10)); + + itemLore.add(C.cBlack); + + itemLore.add(C.cWhite + "Special Item: " + C.cYellow + item.GetKartType().GetKartItem().GetName()); + + ShopItem shopItem = new ShopItem(item.GetDisplayMaterial(), + item.GetDisplayData(), item.GetName(), + itemLore.toArray(new String[itemLore.size()]), 1, locked, + false); + + if (_gpManager.GetSelectedKart(Player) == item.GetKartType()) + { + shopItem.getHandle().tag.set("ench", new NBTTagList()); + + KartItemType kartItemType = item.GetKartType().GetKartItem(); + + ShopItem kartItem = new ShopItem(kartItemType.GetMaterial(), kartItemType.GetName(), kartItemType.GetDesc(), kartItemType.GetAmount(), false); + kartItem.getHandle().c((locked ? ChatColor.RED : ChatColor.GREEN) + kartItem.GetName() + (locked ? ChatColor.RED + " (Locked)" : "")); + + getInventory().setItem(slot - 9, kartItem.getHandle()); + } + else + { + getInventory().setItem(slot - 9, null); + } + + AddButton(slot, shopItem, new KartSelectButton(this, item)); + slot++; + } + } + + private ChatColor GetStatColor(double statValue) + { + return statValue >= 3 ? (statValue >= 6 ? ChatColor.GREEN : ChatColor.YELLOW) : ChatColor.RED; + } + + private Material GetStatMaterial(double statValue) + { + return statValue >= 3 ? (statValue >= 6 ? Material.EMERALD : Material.GOLD_NUGGET) : Material.REDSTONE; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/menu/KartSelectButton.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/menu/KartSelectButton.java new file mode 100644 index 000000000..792551f3b --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/menu/KartSelectButton.java @@ -0,0 +1,24 @@ +package nautilus.game.minekart.menu; + +import mineplex.core.shop.item.IButton; +import nautilus.game.minekart.shop.KartItem; + +import org.bukkit.entity.Player; + +public class KartSelectButton implements IButton +{ + private KartPage _page; + private KartItem _kartItem; + + public KartSelectButton(KartPage shop, KartItem kartItem) + { + _page = shop; + _kartItem = kartItem; + } + + @Override + public void Clicked(Player player) + { + _page.SelectKart(player, _kartItem); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/repository/KartItemToken.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/repository/KartItemToken.java new file mode 100644 index 000000000..f8af0ba37 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/repository/KartItemToken.java @@ -0,0 +1,11 @@ +package nautilus.game.minekart.repository; + +import mineplex.core.donation.repository.GameSalesPackageToken; + +public class KartItemToken +{ + public String Name; + public String Material; + public String Data; + public GameSalesPackageToken SalesPackage; +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/repository/KartRepository.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/repository/KartRepository.java new file mode 100644 index 000000000..7be4fe262 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/repository/KartRepository.java @@ -0,0 +1,22 @@ +package nautilus.game.minekart.repository; + +import java.util.List; + +import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; + +import mineplex.core.server.remotecall.JsonWebCall; + +public class KartRepository +{ + private String _webAddress; + + public KartRepository(String webserverAddress) + { + _webAddress = webserverAddress; + } + + public List GetKartItems(List itemTokens) + { + return new JsonWebCall(_webAddress + "MineKart/GetKartItems").Execute(new TypeToken>(){}.getType(), itemTokens); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/shop/KartItem.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/shop/KartItem.java new file mode 100644 index 000000000..7f49ed358 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/shop/KartItem.java @@ -0,0 +1,31 @@ +package nautilus.game.minekart.shop; + +import mineplex.core.common.CurrencyType; +import mineplex.core.shop.item.SalesPackageBase; +import nautilus.game.minekart.kart.KartType; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class KartItem extends SalesPackageBase +{ + private KartType _kartType; + + public KartItem(Material monsterEgg, KartType kartType) + { + super(kartType.GetName(), monsterEgg, (byte)0, kartType.GetDescription()); + + _kartType = kartType; + } + + @Override + public void Sold(Player player, CurrencyType currencyType) + { + + } + + public KartType GetKartType() + { + return _kartType; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/shop/KartItemButton.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/shop/KartItemButton.java new file mode 100644 index 000000000..1bfcdfb00 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/shop/KartItemButton.java @@ -0,0 +1,24 @@ +package nautilus.game.minekart.shop; + +import mineplex.core.shop.item.IButton; +import nautilus.game.minekart.shop.page.KartPage; + +import org.bukkit.entity.Player; + +public class KartItemButton implements IButton +{ + private KartPage _shop; + private KartItem _kartItem; + + public KartItemButton(KartPage shop, KartItem kartItem) + { + _shop = shop; + _kartItem = kartItem; + } + + @Override + public void Clicked(Player player) + { + _shop.PurchaseKart(player, _kartItem); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/shop/KartShop.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/shop/KartShop.java new file mode 100644 index 000000000..57f31050d --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/shop/KartShop.java @@ -0,0 +1,25 @@ +package nautilus.game.minekart.shop; + +import org.bukkit.entity.Player; + +import nautilus.game.minekart.KartFactory; +import nautilus.game.minekart.shop.page.KartPage; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.CurrencyType; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.ShopBase; +import mineplex.core.shop.page.ShopPageBase; + +public class KartShop extends ShopBase +{ + public KartShop(KartFactory plugin, CoreClientManager clientManager, DonationManager donationManger, CurrencyType...currencyTypes) + { + super(plugin, clientManager, donationManger, "Kart Shop", currencyTypes); + } + + @Override + protected ShopPageBase> BuildPagesFor(Player player) + { + return new KartPage(Plugin, ClientManager, DonationManager, this, player); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/shop/page/KartPage.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/shop/page/KartPage.java new file mode 100644 index 000000000..a340aca2f --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/shop/page/KartPage.java @@ -0,0 +1,189 @@ +package nautilus.game.minekart.shop.page; + +import java.util.ArrayList; +import java.util.List; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.CurrencyType; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.donation.DonationManager; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.page.ConfirmationPage; +import mineplex.core.shop.page.ShopPageBase; + +import nautilus.game.minekart.KartFactory; +import nautilus.game.minekart.kart.KartType; +import nautilus.game.minekart.shop.KartItem; +import nautilus.game.minekart.shop.KartItemButton; +import nautilus.game.minekart.shop.KartShop; +import net.minecraft.server.v1_6_R2.NBTTagList; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.PlayerInventory; + +public class KartPage extends ShopPageBase +{ + public KartPage(KartFactory plugin, CoreClientManager clientManager, DonationManager donationManager, KartShop shop, Player player) + { + super(plugin, shop, clientManager, donationManager, " Kart Shop", player); + + CurrencySlot = 22; + + BuildPage(); + } + + @Override + protected void BuildPage() + { + getInventory().setItem(0, new ShopItem(Material.INK_SACK, (byte)1, "", new String[] {}, 1, false, true).getHandle()); + getInventory().setItem(1, new ShopItem(Material.INK_SACK, (byte)4, "", new String[] {}, 1, false, true).getHandle()); + getInventory().setItem(2, new ShopItem(Material.INK_SACK, (byte)3, "", new String[] {}, 1, false, true).getHandle()); + getInventory().setItem(3, new ShopItem(Material.INK_SACK, (byte)6, "", new String[] {}, 1, false, true).getHandle()); + getInventory().setItem(4, new ShopItem(Material.INK_SACK, (byte)8, "", new String[] {}, 1, false, true).getHandle()); + getInventory().setItem(5, new ShopItem(Material.INK_SACK, (byte)2, "", new String[] {}, 1, false, true).getHandle()); + getInventory().setItem(6, new ShopItem(Material.INK_SACK, (byte)12, "", new String[] {}, 1, false, true).getHandle()); + getInventory().setItem(7, new ShopItem(Material.INK_SACK, (byte)10, "", new String[] {}, 1, false, true).getHandle()); + getInventory().setItem(8, new ShopItem(Material.INK_SACK, (byte)13, "", new String[] {}, 1, false, true).getHandle()); + + UpdateKarts(); + } + + public void PlayerOpened() + { + UpdateKarts(); + } + + protected void ShowKartStats(KartType kartType) + { + for (KartItem item : Plugin.GetKarts()) + { + if (kartType == item.GetKartType()) + { + PlayerInventory inventory = Player.getInventory(); + inventory.clear(); + + double statValue = Math.ceil((kartType.GetTopSpeed() * 100 - 79) / 2.625); + Material statMaterial = GetStatMaterial(statValue); + int slot = 9; + inventory.setItem(slot, ItemStackFactory.Instance.CreateStack(Material.WOOD_HOE, (byte)0, (int)(kartType.GetTopSpeed() * 100), "§e§lTop Speed")); + + slot++; + while (statValue >= 1) + { + inventory.setItem(slot, ItemStackFactory.Instance.CreateStack(statMaterial, (byte)0, 1, "§e§lSpeed Bar")); + slot++; + statValue -= 1; + } + + statValue = kartType.GetAcceleration() - 10; + statMaterial = GetStatMaterial(statValue); + slot = 18; + inventory.setItem(slot, ItemStackFactory.Instance.CreateStack(Material.STONE_HOE, (byte)0, (int)statValue, "§e§lAcceleration")); + + slot++; + while (statValue >= 1) + { + inventory.setItem(slot, ItemStackFactory.Instance.CreateStack(statMaterial, (byte)0, 1, "§e§lAcceleration Bar")); + slot++; + statValue -= 1; + } + + statValue = kartType.GetHandling() - 10; + statMaterial = GetStatMaterial(statValue); + slot = 27; + inventory.setItem(slot, ItemStackFactory.Instance.CreateStack(Material.IRON_HOE, (byte)0, (int)statValue, "§e§lHandling")); + + slot++; + while (statValue >= 1) + { + inventory.setItem(slot, ItemStackFactory.Instance.CreateStack(statMaterial, (byte)0, 1, "§e§lHandling Bar")); + slot++; + statValue -= 1; + } + } + } + } + + public void UpdateKarts() + { + int slot = 45; + boolean locked = true; + + for (KartItem item : Plugin.GetKarts()) + { + if (DonationManager.Get(Client.GetPlayerName()).Owns(item.GetSalesPackageId()) || DonationManager.Get(Client.GetPlayerName()).OwnsUnknownPackage("Minekart ULTRA") || Client.GetRank().Has(Client.GetPlayer(), Rank.ULTRA, false) || item.IsFree()) + locked = false; + else + locked = true; + + List itemLore = new ArrayList(); + + if (locked) + { + StringBuilder currencyBuilder = new StringBuilder(); + + int cost = item.GetCost(CurrencyType.Gems); + + if (cost > 0) + { + currencyBuilder.append(C.cYellow + cost + " Gems"); + } + + itemLore.add(currencyBuilder.toString()); + } + + itemLore.add(C.cBlack); + + itemLore.add(C.cWhite + "Max Speed: " + GetStatColor(Math.ceil((item.GetKartType().GetTopSpeed() * 100 - 79) / 2.625)) + item.GetKartType().GetTopSpeed() * 100); + itemLore.add(C.cWhite + "Acceleration: " + GetStatColor(item.GetKartType().GetAcceleration() - 10) + (item.GetKartType().GetAcceleration() - 10)); + itemLore.add(C.cWhite + "Handling: " + GetStatColor(item.GetKartType().GetHandling() - 10) + (item.GetKartType().GetHandling() - 10)); + itemLore.add(C.cWhite + "Weight: " + GetStatColor(item.GetKartType().GetStability() - 10) + (item.GetKartType().GetStability() - 10)); + + itemLore.add(C.cBlack); + + itemLore.add(C.cWhite + "Special Item: " + C.cYellow + item.GetKartType().GetKartItem().GetName()); + + ShopItem shopItem = new ShopItem(item.GetDisplayMaterial(), + item.GetDisplayData(), item.GetName(), + itemLore.toArray(new String[itemLore.size()]), 1, locked, + false); + + if (!locked) + { + shopItem.getHandle().tag.set("ench", new NBTTagList()); + } + + AddButton(slot, shopItem, new KartItemButton(this, item)); + slot++; + } + } + + private ChatColor GetStatColor(double statValue) + { + return statValue >= 3 ? (statValue >= 6 ? ChatColor.GREEN : ChatColor.YELLOW) : ChatColor.RED; + } + + private Material GetStatMaterial(double statValue) + { + return statValue >= 3 ? (statValue >= 6 ? Material.EMERALD : Material.GOLD_NUGGET) : Material.REDSTONE; + } + + public void PurchaseKart(Player player, KartItem kartItem) + { + if ((DonationManager.Get(Client.GetPlayerName()).GetGems() > kartItem.GetCost(CurrencyType.Gems)) && !DonationManager.Get(Client.GetPlayerName()).Owns(kartItem.GetSalesPackageId()) && !DonationManager.Get(Client.GetPlayerName()).OwnsUnknownPackage("Minekart ULTRA") && !Client.GetRank().Has(Client.GetPlayer(), Rank.ULTRA, false) && !kartItem.IsFree()) + { + PlayAcceptSound(player); + Shop.OpenPageForPlayer(player, new ConfirmationPage(Plugin, Shop, ClientManager, DonationManager, null, + this, kartItem, SelectedCurrency, player)); + } + else + { + PlayDenySound(player); + ShowKartStats(kartItem.GetKartType()); + } + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/Track.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/Track.java new file mode 100644 index 000000000..9819908b5 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/Track.java @@ -0,0 +1,708 @@ +package nautilus.game.minekart.track; + +import java.io.BufferedReader; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.HashMap; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.FileUtil; +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.WorldUtil; +import mineplex.core.recharge.Recharge; +import mineplex.core.teleport.Teleport; +import nautilus.game.minekart.gp.GP; +import nautilus.game.minekart.gp.GPBattle; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.track.ents.*; +import nautilus.minecraft.core.utils.ZipUtil; +import net.minecraft.server.v1_6_R2.ChunkPreLoadEvent; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.World; +import org.bukkit.WorldCreator; +import org.bukkit.entity.Player; +import org.bukkit.event.world.ChunkUnloadEvent; +import org.bukkit.util.Vector; + +public class Track +{ + public enum TrackState + { + Loading, + Countdown, + Live, + Ending, + Ended + } + + private World World = null; + + private int MinX = 0; + private int MinZ = 0; + private int MaxX = 0; + private int MaxZ = 0; + private int CurX = 0; + private int CurZ = 0; + + private GP GP; + private Teleport _teleport; + private Recharge _recharge; + private int _trackId; + + private String _name; + private String _file; + + //Race Data + private TrackState _state = TrackState.Loading; + private long _stateTime = System.currentTimeMillis(); + private int _countdown = 6; + private boolean _nextTrack = false; + + private HashMap _scores = new HashMap(); + private ArrayList _positions = new ArrayList(); + + //Map Data + private float _yaw = 0f; + private ArrayList _kartStart; + private ArrayList _returnPoints; + private ArrayList _trackProgress; + private ArrayList _itemBlocks; + + private HashMap _jumps; + + private ArrayList _creatures; + + private ArrayList _trackBlocks; + private ArrayList _returnBlocks; + + public Track(GP gp, Teleport teleport, Recharge recharge, String file, int id) + { + GP = gp; + _teleport = teleport; + _recharge = recharge; + + _trackId = id; + + _file = file; + + _kartStart = new ArrayList(); + _returnPoints = new ArrayList(); + _trackProgress = new ArrayList(); + _itemBlocks = new ArrayList(); + + _jumps = new HashMap(); + _creatures = new ArrayList(); + + _trackBlocks = new ArrayList(); + _returnBlocks = new ArrayList(); + + //Register Self + GP.Manager.TrackManager.RegisterTrack(this); + } + + public GP GetGP() + { + return GP; + } + + public String GetName() + { + return _name; + } + + public String GetFile() + { + return _file; + } + + public World GetWorld() + { + return World; + } + + public float GetYaw() + { + return _yaw; + } + + public ArrayList GetSpawns() + { + return _kartStart; + } + + public HashMap GetScores() + { + return _scores; + } + + public ArrayList GetPositions() + { + return _positions; + } + + public ArrayList GetProgress() + { + return _trackProgress; + } + + public ArrayList GetReturn() + { + return _returnPoints; + } + + public ArrayList GetItems() + { + return _itemBlocks; + } + + public HashMap GetJumps() + { + return _jumps; + } + + public ArrayList GetCreatures() + { + return _creatures; + } + + public ArrayList GetTrackBlocks() + { + return _trackBlocks; + } + + public ArrayList GetReturnBlocks() + { + return _returnBlocks; + } + + public void SetState(TrackState state) + { + if (_state != state) + { + if (state == TrackState.Ended || _state == TrackState.Ended) + GP.SwitchScoreboards(); + else if (state == TrackState.Countdown || _state == TrackState.Countdown) + GP.SwitchScoreboards(); + } + + _state = state; + _stateTime = System.currentTimeMillis(); + _countdown = 31; + + if (state == TrackState.Countdown) + _countdown = 8; + } + + public TrackState GetState() + { + return _state; + } + + public long GetStateTime() + { + return _stateTime; + } + + public void Update() + { + String type = "Race"; + if (GP instanceof GPBattle) + type = "Battle"; + + if (_state == TrackState.Loading) + { + + } + else if (_state == TrackState.Countdown) + { + if (UtilTime.elapsed(_stateTime, 1000)) + { + _stateTime = System.currentTimeMillis(); + _countdown--; + + //Inform + Sound + for (Player cur : GP.GetPlayers()) + { + if (_countdown > 5) + { + + } + else if (_countdown > 0) + { + UtilPlayer.message(cur, F.main("MK", type + " begins in " + F.time(_countdown + " Seconds") + "...")); + cur.playSound(cur.getLocation(), Sound.NOTE_PIANO, 1f, 1f); + } + else + { + UtilPlayer.message(cur, F.main("MK", type + " has started!")); + cur.playSound(cur.getLocation(), Sound.NOTE_PIANO, 2f, 2f); + } + } + + if (_countdown <= 0) + SetState(TrackState.Live); + } + } + else if (_state == TrackState.Live) + { + + } + else if (_state == TrackState.Ending) + { + boolean allFinished = true; + + for (Kart kart : GetGP().GetKarts()) + if (!kart.HasFinishedTrack()) + allFinished = false; + + if (allFinished) + { + GP.Announce(F.main("MK", type + " has ended.")); + SetState(TrackState.Ended); + } + + else if (UtilTime.elapsed(_stateTime, 1000)) + { + _stateTime = System.currentTimeMillis(); + _countdown--; + + //Inform + Sound + if (_countdown%5 == 0) + { + GP.Announce(F.main("MK", type + " ends in " + F.time(_countdown + " Seconds") + "...")); + + for (Player cur : GP.GetPlayers()) + { + if (_countdown > 0) cur.playSound(cur.getLocation(), Sound.NOTE_PIANO, 1f, 0.5f); + else cur.playSound(cur.getLocation(), Sound.NOTE_PIANO, 2f, 0f); + } + } + + if (_countdown <= 0) + { + GP.Announce(F.main("MK", type + " has ended.")); + SetState(TrackState.Ended); + } + } + } + else + { + if (_nextTrack) + return; + + if (UtilTime.elapsed(_stateTime, 10000)) + { + GetGP().NextTrack(); + _nextTrack = true; + } + } + } + + protected String GetFolder() + { + return GetGP().GetId() + "-" + GetGP().GetSet().GetName() + "-" + GetFile(); + } + + public void Initialize() + { + final Track track = this; + + System.out.println("Initializing...."); + + UtilServer.getServer().getScheduler().runTaskAsynchronously(GP.Manager.GetPlugin(), new Runnable() + { + public void run() + { + //Unzip + track.UnzipWorld(); + + //Load Track Data Sync + UtilServer.getServer().getScheduler().runTask(GP.Manager.GetPlugin(), new Runnable() + { + public void run() + { + //Start World + World = WorldUtil.LoadWorld(new WorldCreator(GetFolder())); + + //Load Track Data + track.LoadTrackData(); + } + }); + } + }); + } + + protected void UnzipWorld() + { + String folder = GetFolder(); + new File(folder).mkdir(); + new File(folder + File.separatorChar + "region").mkdir(); + new File(folder + File.separatorChar + "data").mkdir(); + ZipUtil.UnzipToDirectory(GetFile() + ".zip", folder); + } + + public void LoadTrackData() + { + //Load Track Data + try + { + FileInputStream fstream = new FileInputStream(GetFolder() + File.separatorChar + "TrackInfo.dat"); + DataInputStream in = new DataInputStream(fstream); + BufferedReader br = new BufferedReader(new InputStreamReader(in)); + String line; + + while ((line = br.readLine()) != null) + { + String[] tokens = line.split(":"); + + if (tokens.length < 2) + continue; + + if (tokens[0].length() == 0) + continue; + + //TRACK NAME + if (tokens[0].equalsIgnoreCase("TRACK_NAME")) + { + _name = tokens[1]; + } + + else if (tokens[0].equalsIgnoreCase("ROAD_TYPES")) + { + try + { + _trackBlocks.add(Integer.parseInt(tokens[1])); + } + catch (Exception e) + { + System.out.println("Track Data Read Error: Invalid Road Type [" + tokens[1] + "]"); + } + } + + else if (tokens[0].equalsIgnoreCase("RETURN_TYPES")) + { + try + { + _returnBlocks.add(Integer.parseInt(tokens[1])); + } + catch (Exception e) + { + System.out.println("Track Data Read Error: Invalid Return Type [" + tokens[1] + "]"); + } + } + + else if (tokens[0].equalsIgnoreCase("SPAWN_DIRECTION")) + { + try + { + _yaw = Float.valueOf(tokens[1]); + } + catch (Exception e) + { + System.out.println("Track Data Read Error: Invalid Yaw [" + tokens[1] + "]"); + } + } + + else if (tokens[0].equalsIgnoreCase("SPAWNS")) + { + for (int i=1 ; i= maxMilliseconds) + return false; + + World.getChunkAt(new Location(World, CurX, 0, CurZ)); + } + + CurZ = MinZ; + } + + return true; + } + + public void Uninitialize() + { + //Wipe Storage + _kartStart.clear(); + _returnPoints.clear(); + _trackProgress.clear(); + _itemBlocks.clear(); + _jumps.clear(); + _creatures.clear(); + _trackBlocks.clear(); + _returnBlocks.clear(); + + //Wipe World + MapUtil.UnloadWorld(GetGP().Manager.GetPlugin(), World); + MapUtil.ClearWorldReferences(World.getName()); + FileUtil.DeleteFolder(new File(World.getName())); + + World = null; + } + + private Location StrToLoc(String loc) + { + String[] coords = loc.split(","); + + try + { + return new Location(World, Integer.valueOf(coords[0])+0.5, Integer.valueOf(coords[1]), Integer.valueOf(coords[2])+0.5); + } + catch (Exception e) + { + System.out.println("Track Data Read Error: Invalid Location String [" + loc + "]"); + } + + return null; + } + + public void SpawnTeleport() + { + Track prevTrack = GP.GetTrack(_trackId - 1); + + //Use Previous Positions + if (prevTrack != null) + { + int i = 0; + for (Kart kart : prevTrack.GetPositions()) + { + Location loc = GetSpawns().get(i); + loc.setYaw(GetYaw()); + loc.setPitch(30f); + + //Battle + if (GetGP() instanceof GPBattle) + { + Vector dir = UtilAlg.getTrajectory(kart.GetDriver().getLocation(), GetProgress().get(0)); + loc.setYaw(UtilAlg.GetYaw(dir)); + loc.setPitch(UtilAlg.GetPitch(dir)); + } + + _teleport.TP(kart.GetDriver(), loc, false); + i++; + } + } + //Use Join Positions + else + { + int i = 0; + for (Player player : GetGP().GetPlayers()) + { + Location loc = GetSpawns().get(i); + loc.setYaw(GetYaw()); + loc.setPitch(30f); + + //Battle + if (GetGP() instanceof GPBattle) + { + Vector dir = UtilAlg.getTrajectory(player.getLocation(), GetProgress().get(0)); + loc.setYaw(UtilAlg.GetYaw(dir)); + loc.setPitch(UtilAlg.GetPitch(dir)); + } + + _teleport.TP(player, loc, false); + i++; + } + } + } + + public void RemoveKart(Kart kart) + { + _scores.remove(kart); + _positions.remove(kart); + } + + public void ChunkUnload(ChunkUnloadEvent event) + { + if (World == null) + return; + + if (!event.getWorld().equals(World)) + return; + + event.setCancelled(true); + } + + public void ChunkLoad(ChunkPreLoadEvent event) + { + if (World == null) + return; + + if (!event.GetWorld().equals(World)) + return; + + int x = event.GetX(); + int z = event.GetZ(); + + if (x >= MinX >> 4 && x <= MaxX >> 4 && z >= MinZ >> 4 && z <= MaxZ >> 4) + { + return; + } + + event.setCancelled(true); + } + + public Recharge GetRecharge() + { + return _recharge; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackEntity.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackEntity.java new file mode 100644 index 000000000..e9562da0c --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackEntity.java @@ -0,0 +1,153 @@ +package nautilus.game.minekart.track; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import nautilus.game.minekart.kart.Kart; +import net.minecraft.server.v1_6_R2.EntityCreature; +import net.minecraft.server.v1_6_R2.Navigation; + +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftCreature; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; + +public abstract class TrackEntity +{ + public Track Track; + + private String _name; + + private Entity _ent; + private EntityType _type; + + private Location _loc; + private double _offset = 3; + private double _collideRange = 1; + + private long _spawnRate = 30000; + private long _spawnTimer = 0; + + public TrackEntity(Track track, EntityType type, String name, double offset, double collideRange, long spawnRate, Location loc) + { + Track = track; + + _name = name; + + _type = type; + + _spawnRate = spawnRate; + + _offset = offset; + _collideRange = collideRange; + + _loc = loc; + } + + public String GetName() + { + return _name; + } + + public Entity GetEntity() + { + return _ent; + } + + public void SetEntity(Entity ent) + { + _ent = ent; + } + + public EntityType GetType() + { + return _type; + } + + public Location GetLocation() + { + return _loc; + } + + public long GetSpawnRate() + { + return _spawnRate; + } + + public long GetSpawnTimer() + { + return _spawnTimer; + } + + public void SetSpawnTimer(long time) + { + _spawnTimer = time; + } + + public double GetOffset() + { + return _offset; + } + + public double GetCollideRange() + { + return _collideRange; + } + + public boolean Update() + { + //Respawn + if (GetEntity() == null || !GetEntity().isValid()) + { + Respawn(); + } + //Return + else + { + Movement(); + } + + return false; + } + + public void Respawn() + { + if (GetType() == null) + return; + + if (GetEntity() != null) + GetEntity().remove(); + + if (UtilTime.elapsed(GetSpawnTimer(), GetSpawnRate())) + { + _ent = GetLocation().getWorld().spawnEntity(GetLocation(), GetType()); + SetSpawnTimer(System.currentTimeMillis()); + } + } + + public void Movement() + { + if (UtilMath.offset(GetLocation(), GetEntity().getLocation()) > GetOffset()) + { + if (GetEntity() instanceof Creature) + { + EntityCreature ec = ((CraftCreature)GetEntity()).getHandle(); + Navigation nav = ec.getNavigation(); + nav.a(GetLocation().getX(), GetLocation().getY(), GetLocation().getZ(), 0.4f); + } + } + } + + public void CheckCollision(Kart kart) + { + if (GetEntity() == null || !GetEntity().isValid()) + return; + + if (UtilMath.offset(kart.GetDriver().getLocation(), GetEntity().getLocation()) > GetCollideRange()) + return; + + Collide(kart); + } + + public abstract void Collide(Kart kart); +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackItem.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackItem.java new file mode 100644 index 000000000..e721aa1b8 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackItem.java @@ -0,0 +1,71 @@ +package nautilus.game.minekart.track; + +import nautilus.game.minekart.kart.Kart; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; + +public class TrackItem +{ + private Location _loc; + private Entity _ent = null; + private long _delay = 0; + + public TrackItem(Location loc) + { + _loc = loc; + } + + public Location GetLocation() + { + return _loc; + } + + public Entity GetEntity() + { + return _ent; + } + + public long GetDelay() + { + return _delay; + } + + public void SetEntity(Entity ent) + { + _ent = ent; + } + + public void SetDelay(long delay) + { + _delay = delay; + } + + public void SpawnEntity(World world) + { + if (GetEntity() != null) + GetEntity().remove(); + + SetEntity(world.spawnEntity(_loc.clone().add(0, 0, 0), EntityType.ENDER_CRYSTAL)); + + //SetEntity(world.dropItem(new Location(_loc.getWorld(), _loc.getX(), _loc.getY() + 1, _loc.getZ()), new ItemStack(Material.CHEST))); + //SetEntity(world.spawnFallingBlock(GetLocation(), Material.LOCKED_CHEST, (byte)0)); + //GetEntity().setVelocity(new Vector(0,0,0)); + } + + public void Pickup(Kart kart) + { + if (GetEntity() != null) + GetEntity().remove(); + + SetEntity(null); + SetDelay(System.currentTimeMillis()); + + GetLocation().getWorld().playEffect(GetLocation().clone().add(0, 1, 0), Effect.STEP_SOUND, 35); + + kart.PickupItem(); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackLogic.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackLogic.java new file mode 100644 index 000000000..7dfe79e34 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackLogic.java @@ -0,0 +1,243 @@ +package nautilus.game.minekart.track; + +import java.util.ArrayList; +import java.util.Iterator; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.track.Track.TrackState; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.util.Vector; + +public class TrackLogic +{ + public static void Positions(Track track) + { + if (track.GetWorld() == null) + return; + + if (track.GetState() == TrackState.Loading || track.GetState() == TrackState.Ended) + return; + + for (Kart kart : track.GetGP().GetKarts()) + SetKartProgress(track, kart); + + //Store Scores + track.GetScores().clear(); + for (Kart kart : track.GetGP().GetKarts()) + track.GetScores().put(kart, kart.GetLapScore()); + + + ArrayList pos = track.GetPositions(); + + //Order Scores + pos.clear(); + for (Kart kart : track.GetScores().keySet()) + { + boolean added = false; + + for (int i=0 ; i track.GetScores().get(pos.get(i))) + { + pos.add(i, kart); + added = true; + break; + } + } + + if (!added) + pos.add(kart); + } + + //Set Lap Place + for (int i=0 ; i iterator = track.GetCreatures().iterator(); + + while (iterator.hasNext()) + { + TrackEntity ent = iterator.next(); + + if (ent.Update()) + { + if (ent.GetEntity() != null) + ent.GetEntity().remove(); + + iterator.remove(); + } + + } + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackManager.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackManager.java new file mode 100644 index 000000000..2b28030fc --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackManager.java @@ -0,0 +1,348 @@ +package nautilus.game.minekart.track; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.fakeEntity.FakeEntityManager; +import mineplex.core.teleport.Teleport; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import nautilus.game.minekart.gp.GPBattle; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartState; +import nautilus.game.minekart.track.Track.TrackState; +import net.minecraft.server.v1_6_R2.ChunkPreLoadEvent; +import net.minecraft.server.v1_6_R2.EntityPlayer; +import net.minecraft.server.v1_6_R2.Packet; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockIgniteEvent; +import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.world.ChunkUnloadEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class TrackManager extends MiniPlugin +{ + private Teleport _teleport; + private HashSet _tracks = new HashSet(); + private HashSet _trackLoader = new HashSet(); + + public TrackManager(JavaPlugin plugin, Teleport teleport) + { + super("Track Manager", plugin); + + _teleport = teleport; + } + + public Set GetTracks() + { + return _tracks; + } + + public void RegisterTrack(Track track) + { + _tracks.add(track); + } + + public void LoadTrack(Track track) + { + _trackLoader.add(track); + } + + @EventHandler + public void LoadTrackUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator trackIterator = _trackLoader.iterator(); + + long endTime = System.currentTimeMillis() + 25; + + while (trackIterator.hasNext()) + { + long timeLeft = endTime - System.currentTimeMillis(); + if (timeLeft <= 0) continue; + + final Track track = trackIterator.next(); + + if (track.GetWorld() == null) + { + trackIterator.remove(); + } + else if (track.LoadChunks(timeLeft)) + { + trackIterator.remove(); + track.SetState(TrackState.Countdown); + track.GetGP().Announce(F.main("MK", "Starting Track: " + F.elem(track.GetName()))); + + track.SpawnTeleport(); + + for (final Kart kart : track.GetGP().GetKarts()) + { + kart.GetEntity().SetLocation(kart.GetDriver().getLocation()); + + Packet spawnPacket = kart.GetEntity().Spawn(); + Packet attachPacket = kart.GetEntity().SetPassenger(kart.GetDriver().getEntityId()); + + for (final Kart otherPlayer : track.GetGP().GetKarts()) + { + if (kart == otherPlayer) + continue; + + kart.GetDriver().hidePlayer(otherPlayer.GetDriver()); + + final EntityPlayer entityPlayer = ((CraftPlayer)otherPlayer.GetDriver()).getHandle(); + + entityPlayer.playerConnection.sendPacket(spawnPacket); + FakeEntityManager.Instance.ForwardMovement(otherPlayer.GetDriver(), kart.GetDriver(), kart.GetEntity().GetEntityId()); + FakeEntityManager.Instance.FakeVehicle(otherPlayer.GetDriver(), kart.GetDriver().getEntityId(), attachPacket); + } + } + + Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable() + { + public void run() + { + for (Kart kart : track.GetGP().GetKarts()) + { + for (Kart player : track.GetGP().GetKarts()) + { + if (kart.GetDriver() == player) + continue; + + kart.GetDriver().showPlayer(player.GetDriver()); + } + + kart.Equip(); + } + } + }, 5L); + } + } + } + + @EventHandler + public void DeleteTrack(UpdateEvent event) + { + if (event.getType() == UpdateType.TICK) + for (Track track : _tracks) + if (track.GetWorld() != null) + if (track.GetState() == TrackState.Ended) + if (track.GetWorld().getPlayers().isEmpty()) + track.Uninitialize(); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() == UpdateType.TICK) + for (Track track : _tracks) + if (!(track.GetGP() instanceof GPBattle)) + if (track.GetWorld() != null) + TrackLogic.Positions(track); + + if (event.getType() == UpdateType.TICK) + for (Track track : _tracks) + if (track.GetWorld() != null) + TrackLogic.Jump(track); + + if (event.getType() == UpdateType.FAST) + for (Track track : _tracks) + if (track.GetWorld() != null) + TrackLogic.UpdateItems(track); + + if (event.getType() == UpdateType.TICK) + for (Track track : _tracks) + if (track.GetWorld() != null) + TrackLogic.UpdateEntities(track); + + if (event.getType() == UpdateType.TICK) + for (Track track : _tracks) + if (track.GetWorld() != null) + TrackLogic.PickupItem(track); + + if (event.getType() == UpdateType.TICK) + for (Track track : _tracks) + if (track.GetWorld() != null) + TrackLogic.CollideMob(track); + } + + @EventHandler + public void BlockIgnite(BlockIgniteEvent event) + { + if (event.getCause() == IgniteCause.ENDER_CRYSTAL) + event.setCancelled(true); + } + + @EventHandler + public void PlayerIgnite(EntityCombustEvent event) + { + if (event.getDuration() < 100) + event.setCancelled(true); + } + + @EventHandler + public void ChunkUnload(ChunkUnloadEvent event) + { + for (Track track : _tracks) + track.ChunkUnload(event); + } + + @EventHandler + public void ChunkLoad(ChunkPreLoadEvent event) + { + for (Track track : _tracks) + { + track.ChunkLoad(event); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void Lakitu(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Track track : _tracks) + { + if (track.GetWorld() == null) + continue; + + if (track.GetState() != TrackState.Live) + continue; + + for (Kart kart : track.GetGP().GetKarts()) + { + kart.SetLakituTick(-1); + + if (kart.GetKartState() == KartState.Lakitu) + continue; + + //Get Return + int locId = -1; + double bestDist = 9999; + + for (int i=0 ; i 120) + { + Lakitu(kart, locId); + continue; + } + + Block block; + + //Void + if (kart.GetDriver().getLocation().getY() < 0) + { + Lakitu(kart, locId); + continue; + } + + //Drown + block = kart.GetDriver().getLocation().getBlock().getRelative(BlockFace.UP); + if (block.getTypeId() == 8 || block.getTypeId() == 9) + { + int neighbours = 0; + + if (block.getRelative( 1, 0, 0).getTypeId() == 8 || block.getRelative(1, 0, 0).getTypeId() == 9) neighbours++; + if (block.getRelative(-1, 0, 0).getTypeId() == 8 || block.getRelative(1, 0, 0).getTypeId() == 9) neighbours++; + if (block.getRelative(0, 0, 1).getTypeId() == 8 || block.getRelative(1, 0, 0).getTypeId() == 9) neighbours++; + if (block.getRelative(0, 0, -1).getTypeId() == 8 || block.getRelative(1, 0, 0).getTypeId() == 9) neighbours++; + + if (neighbours >= 3) + { + kart.SetLakituTick(2); + + if (kart.GetLakituTick() > 6) + { + Lakitu(kart, locId); + continue; + } + } + } + + //Negative Blocks + block = kart.GetDriver().getLocation().getBlock().getRelative(BlockFace.DOWN); + if (kart.GetGP().GetTrack().GetReturnBlocks().contains(block.getTypeId())) + { + kart.SetLakituTick(2); + + if (kart.GetLakituTick() > 6) + { + Lakitu(kart, locId); + continue; + } + } + } + } + } + + public void Lakitu(Kart kart, int locId) + { + kart.SetVelocity(new Vector(0,0,0)); + + kart.SetKartState(KartState.Lakitu); + + kart.ExpireConditions(); + + kart.SetLakituTick(-1000); + + kart.LoseLife(); + + //Get Locations + Location loc; + if (locId > 0) loc = kart.GetGP().GetTrack().GetReturn().get(locId-1); + else loc = kart.GetGP().GetTrack().GetReturn().get(kart.GetGP().GetTrack().GetReturn().size()); + + Location next = kart.GetGP().GetTrack().GetReturn().get(locId); + + Vector dir = UtilAlg.getTrajectory(loc, next); + loc.setYaw(UtilAlg.GetYaw(dir)); + loc.setPitch(0); + + _teleport.TP(kart.GetDriver(), loc); + + UtilPlayer.message(kart.GetDriver(), F.main("MK", "You are being returned to the track.")); + UtilPlayer.message(kart.GetDriver(), F.main("MK", "You cannot drive for 8 seconds.")); + + kart.GetDriver().playSound(kart.GetDriver().getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 1f); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackProcessor.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackProcessor.java new file mode 100644 index 000000000..9c2176f82 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackProcessor.java @@ -0,0 +1,321 @@ +package nautilus.game.minekart.track; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.util.ArrayList; +import java.util.HashMap; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.BlockState; +import org.bukkit.block.Sign; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class TrackProcessor +{ + private Location progressStart = null; + private ArrayList progress = new ArrayList(); + private ArrayList spawns = new ArrayList(); + private ArrayList returns = new ArrayList(); + private ArrayList items = new ArrayList(); + private HashMap mobs = new HashMap(); + private HashMap jumps = new HashMap(); + + private ArrayList spawnsOrdered = new ArrayList(); + private ArrayList progressOrdered = new ArrayList(); + + private int spawnsDisplayIndex = 0; + private int progressDisplayIndex = 0; + + public void ProcessTrack(Player caller) + { + progressStart = null; + progress.clear(); + spawns.clear(); + returns.clear(); + items.clear(); + + mobs.clear(); + jumps.clear(); + + progressOrdered.clear(); + spawnsOrdered.clear(); + + int processed = 0; + + caller.sendMessage("Scanning for Blocks..."); + for (int x=-500 ; x < 500 ; x++) + for (int z=-500 ; z < 500 ; z++) + for (int y=0 ; y < 256 ; y++) + { + processed++; + if (processed % 10000000 == 0) + caller.sendMessage("Processed: " + processed); + + Block block = caller.getWorld().getBlockAt(caller.getLocation().getBlockX()+x, caller.getLocation().getBlockY()+y, caller.getLocation().getBlockZ()+z); + + + if (block.getType() == Material.SIGN_POST) + { + Block type = block.getRelative(BlockFace.DOWN); + if (type == null) + continue; + + BlockState state = block.getState(); + + Sign sign = (Sign)state; + + String lineA = sign.getLine(0); + String lineB = sign.getLine(1); + + if (type.getType() == Material.WOOL && lineA.equals("MOB")) + { + if (type.getData() == 14) // red > mob + { + mobs.put(type.getLocation().add(0.5, 1.5, 0.5), lineB); + + //Remove Blocks + block.setTypeId(0); + type.setTypeId(0); + } + } + + else if (type.getType() == Material.EMERALD_BLOCK && lineA.equals("JUMP")) + { + jumps.put(type.getLocation(), lineB); + + //Remove Blocks + block.setTypeId(0); + } + } + + if (block.getTypeId() != 148) + continue; + + Block type = block.getRelative(BlockFace.DOWN); + if (type == null) + continue; + + if (type.getType() != Material.WOOL) + continue; + + if (type.getData() == 1) // orange > progress start + { + if (progressStart != null) + caller.sendMessage("Error: Duplicate Progress Start"); + + progressStart = type.getLocation().add(0.5, 0, 0.5); + } + else if (type.getData() == 4) // yellow > progress + { + progress.add(type.getLocation().add(0.5, 0, 0.5)); + } + else if (type.getData() == 5) // green > items + { + items.add(type.getLocation().add(0.5, 0, 0.5)); + } + else if (type.getData() == 11) // blue > spawns + { + spawns.add(type.getLocation().add(0.5, 0, 0.5)); + } + else if (type.getData() == 10) // purple > return + { + returns.add(type.getLocation().add(0.5, 0, 0.5)); + } + else + { + continue; + } + + //Remove Blocks + block.setTypeId(0); + type.setTypeId(0); + } + + caller.sendMessage("Ordering Progress Blocks..."); + + if (progressStart == null) + { + caller.sendMessage("Error: No Progress Start Found (Orange Wool)"); + return; + } + + //Order Progress + progressOrdered.add(progressStart); + + while (!progress.isEmpty()) + { + Location cur = progressOrdered.get(progressOrdered.size() - 1); + Location next = null; + double dist = 9999; + + for (Location loc : progress) + { + double newDist = UtilMath.offset(cur, loc); + + if (next == null) + { + next = loc; + dist = newDist; + } + + else if (newDist < dist) + { + next = loc; + dist = newDist; + } + } + + progress.remove(next); + progressOrdered.add(next); + } + + //Order Spawns + while (!spawns.isEmpty()) + { + Location spawn = null; + double dist = 9999; + + for (Location loc : spawns) + { + double newDist = UtilMath.offset(progressStart, loc); + + if (spawn == null) + { + spawn = loc; + dist = newDist; + } + + else if (newDist < dist) + { + spawn = loc; + dist = newDist; + } + } + + spawns.remove(spawn); + spawnsOrdered.add(spawn); + } + + //Lakitu + if (returns.isEmpty()) + returns = progressOrdered; + + //Save + try + { + FileWriter fstream = new FileWriter(caller.getWorld().getName() + File.separatorChar + "TrackInfo.dat"); + BufferedWriter out = new BufferedWriter(fstream); + + out.write("TRACK_NAME:"); + out.write("\n"); + out.write("\n"); + out.write("MIN_X:"); + out.write("\n"); + out.write("MAX_X:"); + out.write("\n"); + out.write("MIN_Z:"); + out.write("\n"); + out.write("MAX_Z:"); + out.write("\n"); + out.write("\n"); + out.write("ROAD_TYPES:"); + out.write("\n"); + out.write("RETURN_TYPES:"); + out.write("\n"); + out.write("\n"); + out.write("SPAWN_DIRECTION:0"); + out.write("\n"); + out.write("SPAWNS:" + LocationsToString(spawnsOrdered)); + out.write("\n"); + out.write("\n"); + out.write("PROGRESS:" + LocationsToString(progressOrdered)); + out.write("\n"); + out.write("\n"); + out.write("RETURNS:" + LocationsToString(returns)); + out.write("\n"); + out.write("\n"); + out.write("ITEMS:" + LocationsToString(items)); + out.write("\n"); + out.write("\n"); + out.write("CREATURES:" + LocationSignsToString(mobs)); + out.write("\n"); + out.write("\n"); + out.write("JUMPS:" + LocationSignsToString(jumps)); + + out.close(); + } + catch (Exception e) + { + caller.sendMessage("Error: File Write Error"); + } + + + caller.sendMessage("Track Data Saved."); + } + + public String LocationsToString(ArrayList locs) + { + String out = ""; + + for (Location loc : locs) + out += loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ() + ":"; + + return out; + } + + public String LocationSignsToString(HashMap locs) + { + String out = ""; + + for (Location loc : locs.keySet()) + out += locs.get(loc) + "@" + loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ() + ":"; + + return out; + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!progressOrdered.isEmpty()) + { + if (progressDisplayIndex >= progressOrdered.size()) + progressDisplayIndex = 0; + + Location loc = progressOrdered.get(progressDisplayIndex); + loc.getBlock().getWorld().playEffect(loc.getBlock().getLocation(), Effect.STEP_SOUND, 41); + + progressDisplayIndex++; + } + + if (!spawnsOrdered.isEmpty()) + { + if (spawnsDisplayIndex >= spawnsOrdered.size()) + spawnsDisplayIndex = 0; + + Location loc = spawnsOrdered.get(spawnsDisplayIndex); + loc.getBlock().getWorld().playEffect(loc.getBlock().getLocation(), Effect.STEP_SOUND, 22); + + spawnsDisplayIndex++; + } + + for (Location loc : returns) + loc.getBlock().getWorld().playEffect(loc.getBlock().getLocation(), Effect.STEP_SOUND, 90); + + for (Location loc : items) + loc.getBlock().getWorld().playEffect(loc.getBlock().getLocation(), Effect.STEP_SOUND, 18); + } +} + diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Bomb.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Bomb.java new file mode 100644 index 000000000..d9e92a8c4 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Bomb.java @@ -0,0 +1,40 @@ +package nautilus.game.minekart.track.ents; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.crash.Crash_Explode; +import nautilus.game.minekart.track.TrackEntity; +import nautilus.game.minekart.track.Track; + +public class Bomb extends TrackEntity +{ + public Bomb(Track track, Location loc) + { + super(track, EntityType.CREEPER, "Bomb", 5, 1, 30000, loc); + } + + @Override + public void Collide(Kart kart) + { + this.SetSpawnTimer(System.currentTimeMillis()); + this.GetEntity().remove(); + + if (!kart.IsInvulnerable(true)) + { + + UtilPlayer.message(kart.GetDriver(), F.main("MK", "You hit " + F.item(GetName()) + ".")); + + //Crash + kart.CrashStop(); + new Crash_Explode(kart, 1.2f, false); + } + + //Effect + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.EXPLODE, 2f, 0.2f); + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Cow.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Cow.java new file mode 100644 index 000000000..68cb7c776 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Cow.java @@ -0,0 +1,124 @@ +package nautilus.game.minekart.track.ents; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftCreature; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.crash.Crash_Explode; +import nautilus.game.minekart.track.Track; +import nautilus.game.minekart.track.TrackEntity; +import net.minecraft.server.v1_6_R2.EntityCreature; +import net.minecraft.server.v1_6_R2.Navigation; + +public class Cow extends TrackEntity +{ + private boolean _spawned = false; + private Kart _owner; + private Vector _dir; + + private long _spawn = 0; + + public Cow(Track track, Location loc, Kart owner, Vector dir) + { + super(track, EntityType.COW, "Stampede", 5, 1.5, 30000, loc); + + _owner = owner; + _dir = dir; + + _dir.setY(0); + _dir.normalize(); + _dir.multiply(1.2); + _dir.setY(-0.4); + + _spawn = System.currentTimeMillis(); + } + + @Override + public void CheckCollision(Kart kart) + { + if (kart.equals(_owner)) + return; + + if (GetEntity() == null || !GetEntity().isValid()) + return; + + if (UtilMath.offset(kart.GetDriver().getLocation(), GetEntity().getLocation()) > GetCollideRange()) + return; + + Collide(kart); + } + + @Override + public void Collide(Kart kart) + { + if (!kart.IsInvulnerable(false)) + { + UtilPlayer.message(kart.GetDriver(), F.main("MK", F.elem(_owner.GetDriver().getName()) + " hit you with " + F.item(GetName()) + ".")); + + //Crash + new Crash_Explode(kart, 1f, true); + } + + //Effect + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.COW_HURT, 2f, 1f); + } + + @Override + public boolean Update() + { + if (UtilTime.elapsed(_spawn, 10000)) + { + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.COW_HURT, 2f, 0.5f); + return true; + } + + if (GetEntity() != null && !UtilBlock.airFoliage(GetEntity().getLocation().add(_dir).add(0, 1, 0).getBlock())) + { + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.COW_HURT, 2f, 0.5f); + return true; + } + + //Respawn + if (GetEntity() == null || !GetEntity().isValid()) + { + if (_spawned) + { + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.COW_HURT, 2f, 0.5f); + return true; + } + + SetEntity(GetLocation().getWorld().spawnEntity(GetLocation(), GetType())); + _spawned = true; + } + //Move + else + { + //Push + GetEntity().setVelocity(_dir); + + //Walk + if (GetEntity() instanceof Creature) + { + EntityCreature ec = ((CraftCreature)GetEntity()).getHandle(); + Navigation nav = ec.getNavigation(); + nav.a(GetEntity().getLocation().getX() + (_dir.getX() * 5), GetEntity().getLocation().getY(), GetEntity().getLocation().getZ() + (_dir.getZ() * 5), 0.4f); + + //Direction + ec.setPositionRotation(GetEntity().getLocation().getX(), GetEntity().getLocation().getY(), GetEntity().getLocation().getZ(), + UtilAlg.GetYaw(_dir), 0); + } + } + + return false; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Mole.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Mole.java new file mode 100644 index 000000000..96b92a8ce --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Mole.java @@ -0,0 +1,87 @@ +package nautilus.game.minekart.track.ents; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartState; +import nautilus.game.minekart.kart.crash.Crash_Explode; +import nautilus.game.minekart.track.Track; +import nautilus.game.minekart.track.TrackEntity; + +public class Mole extends TrackEntity +{ + public Mole(Track track, Location loc) + { + super(track, null, "Monty Mole", 5, 1, 1500, loc); + } + + @Override + public void CheckCollision(Kart kart) + { + if (kart.GetKartState() == KartState.Crash) + return; + + if (UtilMath.offset(kart.GetDriver().getLocation(), GetLocation()) > GetCollideRange()) + return; + + if (GetLocation().getBlock().getType() != Material.RED_MUSHROOM) + return; + + Collide(kart); + } + + @Override + public void Collide(Kart kart) + { + if (!kart.IsInvulnerable(false)) + { + UtilPlayer.message(kart.GetDriver(), F.main("MK", "You hit " + F.item(GetName()) + ".")); + + //Crash + new Crash_Explode(kart, 1f, true); + } + + //Effect + GetLocation().getWorld().playSound(GetLocation(), Sound.EXPLODE, 2f, 1.5f); + + //Remove Mole + GetLocation().getBlock().setType(Material.AIR); + SetSpawnTimer(System.currentTimeMillis()); + } + + @Override + public boolean Update() + { + //Up + if (GetLocation().getBlock().getType() != Material.RED_MUSHROOM) + { + if (Math.random() > 0.99 && UtilTime.elapsed(GetSpawnTimer(), GetSpawnRate())) + { + GetLocation().getBlock().setType(Material.RED_MUSHROOM); + SetSpawnTimer(System.currentTimeMillis()); + + //Sound + GetLocation().getWorld().playSound(GetLocation(), Sound.BAT_HURT, 0.4f, 1.5f); + GetLocation().getWorld().playEffect(GetLocation(), Effect.STEP_SOUND, 3); + } + } + //Down + else + { + if (UtilTime.elapsed(GetSpawnTimer(), 1500)) + { + GetLocation().getBlock().setType(Material.AIR); + SetSpawnTimer(System.currentTimeMillis()); + } + } + + return false; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Sheepile.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Sheepile.java new file mode 100644 index 000000000..05dd92ba1 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Sheepile.java @@ -0,0 +1,183 @@ +package nautilus.game.minekart.track.ents; + +import java.util.HashSet; + +import org.bukkit.DyeColor; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftCreature; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Sheep; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.crash.Crash_Explode; +import nautilus.game.minekart.track.Track; +import nautilus.game.minekart.track.TrackEntity; +import net.minecraft.server.v1_6_R2.EntityCreature; + +public class Sheepile extends TrackEntity +{ + private boolean _spawned = false; + private Kart _owner; + private HashSet _hit = new HashSet(); + + private long _spawn = 0; + + private int _height = 2; + + public Sheepile(Track track, Location loc, Kart owner) + { + super(track, EntityType.SHEEP, "Super Sheep", 5, 1, 30000, loc); + + _owner = owner; + + _spawn = System.currentTimeMillis(); + } + + @Override + public void CheckCollision(Kart kart) + { + if (kart.equals(_owner)) + return; + + if (_hit.contains(kart)) + return; + + if (GetEntity() == null || !GetEntity().isValid()) + return; + + if (UtilMath.offset(kart.GetDriver().getLocation(), GetEntity().getLocation()) > GetCollideRange()) + return; + + Collide(kart); + } + + @Override + public void Collide(Kart kart) + { + if (!kart.IsInvulnerable(true)) + { + UtilPlayer.message(kart.GetDriver(), F.main("MK", F.elem(_owner.GetDriver().getName()) + " hit you with " + F.item(GetName()) + ".")); + UtilPlayer.message(_owner.GetDriver(), F.main("MK", "You hit " + F.elem(kart.GetDriver().getName()) + " with " + F.item(GetName()) + ".")); + + //Crash + new Crash_Explode(kart, 1.2f, true); + } + + _hit.add(kart); + + //Effect + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.EXPLODE, 1f, 2f); + } + + @Override + public boolean Update() + { + if (UtilTime.elapsed(_spawn, 15000)) + return true; + + //Respawn + if (GetEntity() == null || !GetEntity().isValid()) + { + if (_spawned) + return true; + + SetEntity(GetLocation().getWorld().spawnEntity(GetLocation(), GetType())); + _spawned = true; + + //Color + Sheep sheep = (Sheep)GetEntity(); + sheep.setBaby(); + sheep.setColor(DyeColor.RED); + + return false; + } + + + //Control + Location target = null; + + //Target Kart + for (Kart kart : Track.GetGP().GetKarts()) + { + if (_owner.equals(kart) || _hit.contains(kart)) + continue; + + if (UtilMath.offset(kart.GetDriver(), GetEntity()) < 8) + target = kart.GetDriver().getLocation(); + } + + //Target Lap + if (target == null) + { + int best = GetClosestNode(); + Location node = Track.GetProgress().get((best+1)%Track.GetProgress().size()); + + target = new Location(node.getWorld(), node.getX(), node.getY() + _height, node.getZ()); + } + + //Push + Vector dir = UtilAlg.getTrajectory(GetEntity().getLocation(), target); + dir.normalize(); + dir.multiply(1.2); + + + GetEntity().setVelocity(dir); + + //Direction + if (GetEntity() instanceof Creature) + { + EntityCreature ec = ((CraftCreature)GetEntity()).getHandle(); + ec.setPositionRotation(GetEntity().getLocation().getX(), GetEntity().getLocation().getY(), GetEntity().getLocation().getZ(), + UtilAlg.GetYaw(dir), 0); + } + + //Color + Sheep sheep = (Sheep)GetEntity(); + sheep.setBaby(); + double r = Math.random(); + if (r > 0.75) sheep.setColor(DyeColor.RED); + else if (r > 0.5) sheep.setColor(DyeColor.YELLOW); + else if (r > 0.25) sheep.setColor(DyeColor.GREEN); + else sheep.setColor(DyeColor.BLUE); + + //Sound + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.SHEEP_IDLE, 2f, 2f); + + return false; + } + + public int GetClosestNode() + { + int node = -1; + double bestDist = 9999; + + for (int i=0 ; i GetCollideRange()) + return; + + Collide(kart); + } + + @Override + public void Collide(Kart kart) + { + this.SetSpawnTimer(System.currentTimeMillis()); + this.GetEntity().remove(); + + if (!kart.IsInvulnerable(true)) + { + UtilPlayer.message(kart.GetDriver(), F.main("MK", F.elem(_owner.GetDriver().getName()) + " hit you with " + F.item(GetName()) + ".")); + UtilPlayer.message(_owner.GetDriver(), F.main("MK", "You hit " + F.elem(kart.GetDriver().getName()) + " with " + F.item(GetName()) + ".")); + + //Crash + new Crash_Explode(kart, 1.2f, true); + } + + //Effect + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.SPIDER_DEATH, 2f, 1f); + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.SPIDER_DEATH, 2f, 1f); + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.SPIDER_DEATH, 2f, 1f); + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.SPIDER_DEATH, 2f, 1f); + + _dead = true; + } + + @Override + public boolean Update() + { + if (_dead) + return true; + + if (UtilTime.elapsed(_spawn, 15000)) + return true; + + if (_target == null) + return true; + + if (!_target.GetDriver().isOnline()) + return true; + + //Respawn + if (GetEntity() == null || !GetEntity().isValid()) + { + if (_spawned) + return true; + + SetEntity(GetLocation().getWorld().spawnEntity(GetLocation(), GetType())); + _spawned = true; + } + //Return + else + { + //Push + Vector dir = UtilAlg.getTrajectory2d(GetEntity(), _target.GetDriver()); + dir.multiply(0.75); + dir.setY(-0.4); + GetEntity().setVelocity(dir); + + //Walk + if (GetEntity() instanceof Creature) + { + EntityCreature ec = ((CraftCreature)GetEntity()).getHandle(); + Navigation nav = ec.getNavigation(); + nav.a(_target.GetDriver().getLocation().getX(), _target.GetDriver().getLocation().getY(), _target.GetDriver().getLocation().getZ(), 0.4f); + + //Direction + ec.setPositionRotation(GetEntity().getLocation().getX(), GetEntity().getLocation().getY(), GetEntity().getLocation().getZ(), + UtilAlg.GetYaw(dir), 0); + } + } + + return false; + } +} diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Train.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Train.java new file mode 100644 index 000000000..0aed627f8 --- /dev/null +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Train.java @@ -0,0 +1,210 @@ +package nautilus.game.minekart.track.ents; + +import java.util.ArrayList; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftCreature; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.minekart.kart.Kart; +import nautilus.game.minekart.kart.KartState; +import nautilus.game.minekart.kart.crash.Crash_Explode; +import nautilus.game.minekart.track.Track; +import nautilus.game.minekart.track.TrackEntity; +import net.minecraft.server.v1_6_R2.EntityCreature; + +public class Train extends TrackEntity +{ + private Location _next = null; + private Location _past = null; + + public Train(Track track, Location loc) + { + super(track, EntityType.IRON_GOLEM, "Golem Train", 5, 1.6, 200, loc); + + _past = new Location(GetLocation().getWorld(), GetLocation().getX(), GetLocation().getY(), GetLocation().getZ()); + _next = _past; + } + + @Override + public void Collide(Kart kart) + { + if (kart.GetKartState() == KartState.Crash) + return; + + if (!kart.IsInvulnerable(false)) + { + + UtilPlayer.message(kart.GetDriver(), F.main("MK", "You hit " + F.item(GetName()) + ".")); + + //Crash + kart.CrashStop(); + new Crash_Explode(kart, 1.4f, false); + } + + //Effect + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.EXPLODE, 2f, 0.2f); + } + + @Override + public void Movement() + { + /* + if (_train >= 4) + return; + + //Put on tracks + Location loc = FindTarget(); + + if (loc == null) + return; + + _past = _next; + _next = loc; + + GetEntity().teleport(_next); + + //Project Forward + loc = FindTarget(); + + if (loc == null) + return; + + _past = _next; + _next = loc; + + GetEntity().setVelocity(UtilAlg.getTrajectory(_past, _next).multiply(0.5)); + + Minecart cart = (Minecart)GetEntity(); + cart.setSlowWhenEmpty(false); + + SetEntity(null); + + _past = new Location(GetLocation().getWorld(), GetLocation().getX(), GetLocation().getY(), GetLocation().getZ()); + _next = _past; + + _carriage++; + + if (_carriage >= 8) + { + _train++; + _carriage = 0; + SetSpawnTimer(System.currentTimeMillis() + 6000); + } + */ + if (_next.equals(_past)) + { + //Get First + Location loc = FindTarget(); + + if (loc == null) + return; + + _next = loc; + + if (_next.getBlock().getRelative(BlockFace.NORTH).equals(_past.getBlock())) + { + _past = _next; + _next = _next.getBlock().getRelative(BlockFace.WEST).getLocation().add(0.5, 0, 0.5); + } + else if (_next.getBlock().getRelative(BlockFace.SOUTH).equals(_past.getBlock())) + { + _past = _next; + _next = _next.getBlock().getRelative(BlockFace.EAST).getLocation().add(0.5, 0, 0.5); + } + else if (_next.getBlock().getRelative(BlockFace.EAST).equals(_past.getBlock())) + { + _past = _next; + _next = _next.getBlock().getRelative(BlockFace.NORTH).getLocation().add(0.5, 0, 0.5); + } + else if (_next.getBlock().getRelative(BlockFace.WEST).equals(_past.getBlock())) + { + _past = _next; + _next = _next.getBlock().getRelative(BlockFace.SOUTH).getLocation().add(0.5, 0, 0.5); + } + } + else + { + Location loc = FindTarget(); + + if (loc == null) + return; + + _past = _next; + _next = loc; + + GetEntity().teleport(_next); + SetSpawnTimer(System.currentTimeMillis()); + + if (GetEntity() instanceof Creature) + { + EntityCreature ec = ((CraftCreature)GetEntity()).getHandle(); + + //Direction + ec.setPositionRotation(GetEntity().getLocation().getX(), GetEntity().getLocation().getY(), GetEntity().getLocation().getZ(), + UtilAlg.GetYaw(UtilAlg.getTrajectory2d(_past, _next)), 0); + } + } + + /* + if (UtilMath.offset(_next, GetEntity().getLocation()) < 0.5) + { + Location loc = FindTarget(); + + if (loc == null) + return; + + _past = _next; + _next = loc; + } + else + { + + if (GetEntity() instanceof Creature) + { + EntityCreature ec = ((CraftCreature)GetEntity()).getHandle(); + Navigation nav = ec.getNavigation(); + nav.a(_next.getX(), _next.getY(), _next.getZ(), 0.4f); + } + + if (UtilTime.elapsed(GetSpawnTimer(), 200)) + { + GetEntity().teleport(_next); + SetSpawnTimer(System.currentTimeMillis()); + } + } + */ + } + + public Location FindTarget() + { + ArrayList tracks = new ArrayList(); + Block check; + + check = _next.getBlock().getRelative(0, 0, 1); + if (check.getTypeId() == 66 || check.getTypeId() == 27) tracks.add(check); + + check = _next.getBlock().getRelative( 1, 0, 0); + if (check.getTypeId() == 66 || check.getTypeId() == 27) tracks.add(check); + + check = _next.getBlock().getRelative(0, 0, -1); + if (check.getTypeId() == 66 || check.getTypeId() == 27) tracks.add(check); + + check = _next.getBlock().getRelative(-1, 0, 0); + if (check.getTypeId() == 66 || check.getTypeId() == 27) tracks.add(check); + + tracks.remove(_past.getBlock()); + + if (tracks.isEmpty()) + return null; + + return tracks.get(0).getLocation().add(0.5, 0, 0.5); + } +} diff --git a/Plugins/Nautilus.Game.PvP/.classpath b/Plugins/Nautilus.Game.PvP/.classpath new file mode 100644 index 000000000..2378a7180 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/.classpath @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.PvP/.externalToolBuilders/Nautilus.Game.PvP.launch b/Plugins/Nautilus.Game.PvP/.externalToolBuilders/Nautilus.Game.PvP.launch new file mode 100644 index 000000000..dcb9a797b --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/.externalToolBuilders/Nautilus.Game.PvP.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.PvP/.externalToolBuilders/PvP Builder.launch b/Plugins/Nautilus.Game.PvP/.externalToolBuilders/PvP Builder.launch new file mode 100644 index 000000000..dcb9a797b --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/.externalToolBuilders/PvP Builder.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.PvP/.project b/Plugins/Nautilus.Game.PvP/.project new file mode 100644 index 000000000..b6a75da4c --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/.project @@ -0,0 +1,27 @@ + + + Nautilus.Game.PvP + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + auto,full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/PvP Builder.launch + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Nautilus.Game.PvP/.settings/org.eclipse.jdt.core.prefs b/Plugins/Nautilus.Game.PvP/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7341ab168 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Nautilus.Game.PvP/PvP.xml b/Plugins/Nautilus.Game.PvP/PvP.xml new file mode 100644 index 000000000..e129fb89e --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/PvP.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/Field.class b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/Field.class new file mode 100644 index 000000000..22d42af32 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/Field.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldBlock.class b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldBlock.class new file mode 100644 index 000000000..b971b61b3 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldBlock.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldBlockData.class b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldBlockData.class new file mode 100644 index 000000000..d17b2169b Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldBlockData.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldBlockLootData.class b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldBlockLootData.class new file mode 100644 index 000000000..f7922420c Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldBlockLootData.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldMonster.class b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldMonster.class new file mode 100644 index 000000000..a571875b7 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldMonster.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldMonsterInput$CustomType.class b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldMonsterInput$CustomType.class new file mode 100644 index 000000000..7dd140940 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldMonsterInput$CustomType.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldMonsterInput.class b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldMonsterInput.class new file mode 100644 index 000000000..b0ae92399 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldMonsterInput.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldOre.class b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldOre.class new file mode 100644 index 000000000..80209b2b5 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldOre.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldOreData.class b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldOreData.class new file mode 100644 index 000000000..75545ba0d Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/FieldOreData.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/Monsters/FieldMonsterBase.class b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/Monsters/FieldMonsterBase.class new file mode 100644 index 000000000..de555f3bf Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/Monsters/FieldMonsterBase.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/UtilField.class b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/UtilField.class new file mode 100644 index 000000000..441a97a11 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/UtilField.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/repository/FieldRepository.class b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/repository/FieldRepository.class new file mode 100644 index 000000000..e38059b9f Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/me/chiss/Core/Field/repository/FieldRepository.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/PvP.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/PvP.class new file mode 100644 index 000000000..0776895b1 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/PvP.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/BenefitManager.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/BenefitManager.class new file mode 100644 index 000000000..2539ea254 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/BenefitManager.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/BenefitShop.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/BenefitShop.class new file mode 100644 index 000000000..2d9ece153 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/BenefitShop.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/Items/BenefitItem.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/Items/BenefitItem.class new file mode 100644 index 000000000..d25ff53f3 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/Items/BenefitItem.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/Items/CoinPack.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/Items/CoinPack.class new file mode 100644 index 000000000..aeaff3c4e Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/Items/CoinPack.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/Items/EnergizedPickaxe.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/Items/EnergizedPickaxe.class new file mode 100644 index 000000000..3100698cc Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/Items/EnergizedPickaxe.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/Repository/BenefitItemToken.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/Repository/BenefitItemToken.class new file mode 100644 index 000000000..b3eab1a3e Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/Repository/BenefitItemToken.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/Repository/BenefitRepository.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/Repository/BenefitRepository.class new file mode 100644 index 000000000..cc2190cfe Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/Repository/BenefitRepository.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/UI/BenefitItemButtonBase.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/UI/BenefitItemButtonBase.class new file mode 100644 index 000000000..826da8964 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/UI/BenefitItemButtonBase.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/UI/BenefitShopPage.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/UI/BenefitShopPage.class new file mode 100644 index 000000000..9e9e5b946 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/UI/BenefitShopPage.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/UI/CoinPackButton.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/UI/CoinPackButton.class new file mode 100644 index 000000000..aab3eeff8 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Benefit/UI/CoinPackButton.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Farming.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Farming.class new file mode 100644 index 000000000..13ea5bae5 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Farming.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Age.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Age.class new file mode 100644 index 000000000..bf72f38ee Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Age.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Fish.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Fish.class new file mode 100644 index 000000000..46a3a44f4 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Fish.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/FishData.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/FishData.class new file mode 100644 index 000000000..21e67536d Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/FishData.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/FishManager.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/FishManager.class new file mode 100644 index 000000000..2a4f38640 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/FishManager.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Loot.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Loot.class new file mode 100644 index 000000000..b649ee34a Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Loot.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Monster.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Monster.class new file mode 100644 index 000000000..9b349cadc Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Monster.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Rarity.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Rarity.class new file mode 100644 index 000000000..5ca79b899 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Rarity.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Size.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Size.class new file mode 100644 index 000000000..4ee9b43e1 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Fishing/Size.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Gameplay.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Gameplay.class new file mode 100644 index 000000000..1a8bb02a2 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Gameplay.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Recipes.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Recipes.class new file mode 100644 index 000000000..84fbdbbfe Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/Recipes.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/ShopManager.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/ShopManager.class new file mode 100644 index 000000000..a89cfb78e Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/ShopManager.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/SoundTest.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/SoundTest.class new file mode 100644 index 000000000..24896cb43 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/SoundTest.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/TreeRemover.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/TreeRemover.class new file mode 100644 index 000000000..7491e7990 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/TreeRemover.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/WorldBorder.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/WorldBorder.class new file mode 100644 index 000000000..bc3462768 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/WorldBorder.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClanRepository$1.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClanRepository$1.class new file mode 100644 index 000000000..246b534d0 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClanRepository$1.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClanRepository.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClanRepository.class new file mode 100644 index 000000000..06ca3d59d Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClanRepository.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Clans.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Clans.class new file mode 100644 index 000000000..0d17847e1 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Clans.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansAdmin.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansAdmin.class new file mode 100644 index 000000000..9ca9983c2 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansAdmin.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansBlocks.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansBlocks.class new file mode 100644 index 000000000..49fc02966 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansBlocks.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansClan$Role.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansClan$Role.class new file mode 100644 index 000000000..d6affd7a4 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansClan$Role.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansClan.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansClan.class new file mode 100644 index 000000000..d0c423d53 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansClan.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansCommand.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansCommand.class new file mode 100644 index 000000000..b734ea3ab Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansCommand.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansDisplay.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansDisplay.class new file mode 100644 index 000000000..e95138e10 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansDisplay.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansGame.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansGame.class new file mode 100644 index 000000000..7c01d9615 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansGame.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansOutpost.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansOutpost.class new file mode 100644 index 000000000..ac49d9e57 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansOutpost.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansOutpostBlock.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansOutpostBlock.class new file mode 100644 index 000000000..9532e6050 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansOutpostBlock.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansRepo.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansRepo.class new file mode 100644 index 000000000..8c0aaab95 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansRepo.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansTask.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansTask.class new file mode 100644 index 000000000..aefffdd22 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansTask.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansTerritory.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansTerritory.class new file mode 100644 index 000000000..a7d125c52 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansTerritory.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansUtility$ClanRelation.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansUtility$ClanRelation.class new file mode 100644 index 000000000..c60c8fae0 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansUtility$ClanRelation.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansUtility.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansUtility.class new file mode 100644 index 000000000..8e0ec86c4 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansUtility.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansWar.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansWar.class new file mode 100644 index 000000000..b29f5acde Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/ClansWar.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/AllianceToken.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/AllianceToken.class new file mode 100644 index 000000000..71f77a981 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/AllianceToken.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/ClanGeneratorToken.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/ClanGeneratorToken.class new file mode 100644 index 000000000..dc1a58263 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/ClanGeneratorToken.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/ClanMemberToken.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/ClanMemberToken.class new file mode 100644 index 000000000..63d3bece9 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/ClanMemberToken.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/ClanRole.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/ClanRole.class new file mode 100644 index 000000000..48adfe3bc Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/ClanRole.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/ClanTerritoryToken.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/ClanTerritoryToken.class new file mode 100644 index 000000000..7c06969e5 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/ClanTerritoryToken.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/ClanToken.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/ClanToken.class new file mode 100644 index 000000000..03f8f18dd Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/ClanToken.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/WarToken.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/WarToken.class new file mode 100644 index 000000000..c1e15c8c5 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/clans/Tokens/WarToken.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/serverreset/ServerReset.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/serverreset/ServerReset.class new file mode 100644 index 000000000..6ede10a94 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/serverreset/ServerReset.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/serverreset/ServerResetCommand.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/serverreset/ServerResetCommand.class new file mode 100644 index 000000000..6a8d97a1a Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/serverreset/ServerResetCommand.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/serverreset/ServerResetRepository.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/serverreset/ServerResetRepository.class new file mode 100644 index 000000000..44f74cf24 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/modules/serverreset/ServerResetRepository.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/repository/PvPRepository.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/repository/PvPRepository.class new file mode 100644 index 000000000..4d1e55a7d Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/repository/PvPRepository.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventBase$EventState.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventBase$EventState.class new file mode 100644 index 000000000..7c4ecd516 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventBase$EventState.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventBase.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventBase.class new file mode 100644 index 000000000..1943ca5c8 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventBase.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventManager.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventManager.class new file mode 100644 index 000000000..076586d3e Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventManager.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventMob.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventMob.class new file mode 100644 index 000000000..a00d2fcbc Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventMob.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventMobBoss.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventMobBoss.class new file mode 100644 index 000000000..d47b6f90e Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventMobBoss.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventMobMinion.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventMobMinion.class new file mode 100644 index 000000000..a7913cde0 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventMobMinion.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventTerrainFinder.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventTerrainFinder.class new file mode 100644 index 000000000..46c85eff6 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/EventTerrainFinder.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/BroodMother.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/BroodMother.class new file mode 100644 index 000000000..8598b643b Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/BroodMother.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/BroodMother.java.orig b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/BroodMother.java.orig new file mode 100644 index 000000000..9d020ee14 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/BroodMother.java.orig @@ -0,0 +1,366 @@ +package nautilus.game.pvp.worldevent.creature; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import me.chiss.Core.Items.IThrown; +import me.chiss.Core.Managers.Throw.IProjectileUser; +import me.chiss.Core.Updater.UpdateEvent; +import me.chiss.Core.Updater.UpdateEvent.UpdateType; +import me.chiss.Core.Utility.UtilAction; +import me.chiss.Core.Utility.UtilTime; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventCreatureBase; + +public class BroodMother extends EventCreatureBase implements IThrown +{ + private ArrayList _minions = new ArrayList(); + private int _minionsMax = 100; + + private HashMap _eggs = new HashMap(); + private long _eggLast = System.currentTimeMillis(); + private int _eggSpawns = 0; + + private long _webLast = System.currentTimeMillis(); + private int _webSpawns = 0; + private int _webMax = 100; + + private int _eggItems = 0; + private int _eggItemMax = 20; + + private long _stateLast = System.currentTimeMillis(); + + private int _state = 0; + //Normal + //Eggs + //Run + //Webs + + public BroodMother(EventBase event, Location location) + { + super(event, location, "Brood Mother", true, 800, EntityType.SPIDER); + } + + @EventHandler + public void Heal(UpdateEvent event) + { + if (GetEntity() == null) + return; + + if (event.getType() != UpdateType.SEC) + return; + + ModifyHealth(1); + } + + @Override + public void Die() + { + Event.Manager.Blood().Effects(GetEntity().getEyeLocation(), 50, 0.8, + Sound.SPIDER_DEATH, 2f, 0.5f, Material.BONE, (byte)0, false); + Loot(); + Remove(); + } + + @Override + public void Loot() + { + Event.Manager.Loot().DropLoot(GetEntity().getEyeLocation(), 40, 40, 0.2f, 0.05f, 3d); + } + + @EventHandler + public void StateSwitch(UpdateEvent event) + { + if (_state != 0) + return; + + if (event.getType() != UpdateType.SEC) + return; + + if (!UtilTime.elapsed(_stateLast, 12000)) + return; + + if (Math.random() > 0.5 || _minions.size() + _eggs.size() < 6) + { + if (_minions.size() + _eggs.size() < 6 || UtilTime.elapsed(_eggLast, 30000)) + { + _eggLast = System.currentTimeMillis(); + _state = 1; + _eggSpawns = GetMinionsMax(); + ((Creature)GetEntity()).setTarget(null); + } + } + else + { + if (UtilTime.elapsed(_webLast, 30000)) + { + _webLast = System.currentTimeMillis(); + _state = 2; + _webSpawns = Scale(_webMax); + ((Creature)GetEntity()).setTarget(null); + } + } + } + + private int Scale(int a) + { + return (int) (a * (0.1 + (0.9 - 0.9 * (GetHealthCur() / GetHealthMax())))); + } + + private int GetMinionsMax() + { + int max = Scale(_minionsMax); + max -= _minions.size(); + + return max; + } + + @EventHandler + public void WebSpawn(UpdateEvent event) + { + if (_state != 2) + return; + + if (event.getType() != UpdateType.FASTEST) + return; + + if (GetEntity() == null) + return; + + if (_webSpawns <= 0) + { + _state = 0; + _stateLast = System.currentTimeMillis(); + return; + } + + _webSpawns--; + + //Item + Item item = GetEntity().getWorld().dropItem(GetEntity().getLocation().add(0, 0.5, 0), + Event.Manager.Item().CreateStack(Material.WEB)); + + //Velocity + UtilAction.velocity(item, new Vector(Math.random()-0.5, 0, Math.random()-0.5).normalize(), + Math.random() * 0.4 + 0.2, false, 0, Math.random() * 0.6 + 0.4, 10, false); + + //Sound + item.getWorld().playSound(item.getLocation(), Sound.BREATH, 0.5f, 0.2f); + + //Thrown + Event.Manager.Throw().AddThrow(item, GetEntity(), this, + -1, false, false, true, + null, 2f, 0.5f, + null, 0, UpdateType.TICK, 1.5d); + } + + @EventHandler + public void EggSpawn(UpdateEvent event) + { + if (_state != 1) + return; + + if (event.getType() != UpdateType.FASTEST) + return; + + if (GetEntity() == null) + return; + + if (_eggSpawns <= 0) + { + _state = 0; + _stateLast = System.currentTimeMillis(); + return; + } + + if (_eggItems >= _eggItemMax) + return; + + _eggSpawns--; + + //Item + Item item = GetEntity().getWorld().dropItem(GetEntity().getLocation().add(0, 0.5, 0), + Event.Manager.Item().CreateStack(Material.DRAGON_EGG)); + + //Velocity + UtilAction.velocity(item, new Vector(Math.random()-0.5, 0, Math.random()-0.5).normalize(), + Math.random() * 0.4 + 0.2, false, 0, Math.random() * 0.6 + 0.4, 10, false); + + //Sound + item.getWorld().playSound(item.getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1f); + + //Thrown + Event.Manager.Throw().AddThrow(item, GetEntity(), this, + -1, false, false, true, + null, 2f, 0.5f, + null, 0, UpdateType.TICK, 1.5d); + + _eggItems++; + } + + @Override + public void Collide(LivingEntity target, Block block, IProjectileUser data) + { + //Null + } + + @Override + public void Idle(IProjectileUser data) + { + BlockForm(data); + } + + @Override + public void Expire(IProjectileUser data) + { + BlockForm(data); + } + + public void BlockForm(IProjectileUser data) + { + Material mat = ((Item)data.GetThrown()).getItemStack().getType(); + + if (mat == Material.DRAGON_EGG) + { + Block egg = data.GetThrown().getLocation().getBlock(); + + if (egg.getRelative(BlockFace.DOWN).getType() != Material.DRAGON_EGG && + egg.getRelative(BlockFace.DOWN).getType() != Material.WEB) + { + egg.setType(Material.DRAGON_EGG); + _eggs.put(egg, System.currentTimeMillis()); + } + + _eggItems--; + } + else if (mat == Material.WEB) + { + Block web = data.GetThrown().getLocation().getBlock(); + + if (web.getType() != Material.WATER && web.getType() != Material.STATIONARY_WATER) + Event.Manager.BlockRestore().Add(web, 30, (byte)0, Scale(40000)); + } + + data.GetThrown().remove(); + } + + @EventHandler + public void EggHatch(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (_eggs.isEmpty()) + return; + + HashSet hatch = new HashSet(); + + for (Block block : _eggs.keySet()) + if (Math.random() > 0.98) + if (UtilTime.elapsed(_eggs.get(block), 12000)) + hatch.add(block); + + for (Block block : hatch) + { + _eggs.remove(block); + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + block.setTypeId(0); + Event.CreatureRegister(new Broodling(Event, block.getLocation().add(0.5, 0.5, 0.5), this)); + } + } + + @EventHandler + public void EggCrush(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetEntity().getWorld().getPlayers()) + { + Block below = cur.getLocation().getBlock().getRelative(BlockFace.DOWN); + if (below.getType() != Material.DRAGON_EGG) + continue; + + if (!_eggs.containsKey(below)) + continue; + + _eggs.remove(below); + below.setTypeId(0); + below.getWorld().playEffect(below.getLocation(), Effect.STEP_SOUND, 122); + + UtilAction.velocity(cur, cur.getLocation().getDirection(), 0.3, true, 0.3, 0, 10, true); + } + } + + @EventHandler + public void EggHit(PlayerInteractEvent event) + { + if (event.getClickedBlock() == null) + return; + + if (!_eggs.containsKey(event.getClickedBlock())) + return; + + event.setCancelled(true); + } + + public void MinionRegister(Broodling minion) + { + _minions.add(minion); + } + + public void MinionDeregister(Broodling minion) + { + _minions.remove(minion); + } + + public ArrayList GetMinions() + { + return _minions; + } + + @EventHandler(priority = EventPriority.LOWEST) + public void TargetCancel(EntityTargetEvent event) + { + if (!event.getEntity().equals(GetEntity())) + return; + + if (_state == 0 && (GetHealthCur() / GetHealthMax()) < 0.5) + return; + + event.setCancelled(true); + } + + public boolean CanTarget(LivingEntity ent) + { + int i = 0; + + for (Broodling cur : _minions) + { + LivingEntity target = ((Creature)cur.GetEntity()).getTarget(); + + if (target != null && target.equals(ent)) + i++; + } + + return i < Scale(20); + } +} diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/Broodling.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/Broodling.class new file mode 100644 index 000000000..d77c348cc Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/Broodling.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SkeletonKing.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SkeletonKing.class new file mode 100644 index 000000000..3ce585830 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SkeletonKing.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SkeletonMinion.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SkeletonMinion.class new file mode 100644 index 000000000..b4825e179 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SkeletonMinion.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeBase.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeBase.class new file mode 100644 index 000000000..7e71ccd69 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeBase.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeKing.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeKing.class new file mode 100644 index 000000000..ce62dd19a Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeKing.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeKingHalf.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeKingHalf.class new file mode 100644 index 000000000..f3e17820f Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeKingHalf.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeKingQuarter.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeKingQuarter.class new file mode 100644 index 000000000..5d5a8aec7 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeKingQuarter.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeRocket.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeRocket.class new file mode 100644 index 000000000..9fb781a78 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeRocket.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeShield.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeShield.class new file mode 100644 index 000000000..47a3f4f1f Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SlimeShield.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/Swarmer.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/Swarmer.class new file mode 100644 index 000000000..8b6064abb Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/Swarmer.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SwarmerHost.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SwarmerHost.class new file mode 100644 index 000000000..2c7ff9963 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/SwarmerHost.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/UndeadArcher.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/UndeadArcher.class new file mode 100644 index 000000000..60c477b1a Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/UndeadArcher.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/UndeadWarrior.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/UndeadWarrior.class new file mode 100644 index 000000000..1feea48da Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/UndeadWarrior.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/Wither.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/Wither.class new file mode 100644 index 000000000..cea9974f3 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/creature/Wither.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BaseUndead.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BaseUndead.class new file mode 100644 index 000000000..a3f5df30a Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BaseUndead.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BossSkeleton.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BossSkeleton.class new file mode 100644 index 000000000..d6cf948a9 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BossSkeleton.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BossSlime.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BossSlime.class new file mode 100644 index 000000000..901c4779b Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BossSlime.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BossSpider.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BossSpider.class new file mode 100644 index 000000000..7d8508972 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BossSpider.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BossSwarmer.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BossSwarmer.class new file mode 100644 index 000000000..35de73bdc Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BossSwarmer.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BossWither.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BossWither.class new file mode 100644 index 000000000..845ed8bbd Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/BossWither.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/EndFlood.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/EndFlood.class new file mode 100644 index 000000000..2797b3904 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/EndFlood.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/EndVolcano.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/EndVolcano.class new file mode 100644 index 000000000..72f010751 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/events/EndVolcano.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/object/Flood.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/object/Flood.class new file mode 100644 index 000000000..7c5e17904 Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/object/Flood.class differ diff --git a/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/object/Volcano.class b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/object/Volcano.class new file mode 100644 index 000000000..1cd06d18a Binary files /dev/null and b/Plugins/Nautilus.Game.PvP/bin/nautilus/game/pvp/worldevent/object/Volcano.class differ diff --git a/Plugins/Nautilus.Game.PvP/plugin.yml b/Plugins/Nautilus.Game.PvP/plugin.yml new file mode 100644 index 000000000..6d9407297 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/plugin.yml @@ -0,0 +1,3 @@ +name: PvP +main: nautilus.game.pvp.PvP +version: 0.1 \ No newline at end of file diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/Field.java b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/Field.java new file mode 100644 index 000000000..8a1fb481c --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/Field.java @@ -0,0 +1,69 @@ +package me.chiss.Core.Field; + + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import me.chiss.Core.Module.AModule; +import mineplex.core.server.IRepository; + +public class Field extends AModule +{ + private FieldBlock _block; + private FieldOre _ore; + private FieldMonster _mob; + + public Field(JavaPlugin plugin, IRepository repository, String serverName) + { + super("Field Factory", plugin, repository); + + _block = new FieldBlock(plugin, repository, serverName); + _ore = new FieldOre(plugin, repository, serverName); + _mob = new FieldMonster(plugin, repository, serverName); + } + + @Override + public void enable() + { + + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + + } + + public FieldBlock GetBlock() + { + return _block; + } + + public FieldOre GetOre() + { + return _ore; + } + + public FieldMonster GetMonster() + { + return _mob; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlock.java b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlock.java new file mode 100644 index 000000000..72d0d1d47 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlock.java @@ -0,0 +1,413 @@ +package me.chiss.Core.Field; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.WeakHashMap; + +import nautilus.minecraft.core.webserver.token.Server.FieldBlockToken; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import me.chiss.Core.Module.AModule; +import mineplex.core.server.IRepository; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.common.util.UtilEvent.ActionType; + +public class FieldBlock extends AModule +{ + private HashMap _blocks; + + private HashSet _active = new HashSet(); + + //Player Info + private WeakHashMap _title = new WeakHashMap(); + private WeakHashMap _stock = new WeakHashMap(); + private WeakHashMap _regen = new WeakHashMap(); + private WeakHashMap _emptyId = new WeakHashMap(); + private WeakHashMap _emptyData = new WeakHashMap(); + private WeakHashMap _lootString = new WeakHashMap(); + + private String _serverName; + + public FieldBlock(JavaPlugin plugin, IRepository repository, String serverName) + { + super("Field Block", plugin, repository); + + _blocks = new HashMap(); + + _serverName = serverName; + + load(); + } + + //Module Functions + @Override + public void enable() + { + + } + + @Override + public void disable() + { + clean(); + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("fb"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) + return; + + if (args.length == 0) + { + showSettings(caller); + return; + } + + if (args[0].equalsIgnoreCase("toggle")) + { + if (!_active.remove(caller.getName())) + _active.add(caller.getName()); + + UtilPlayer.message(caller, F.main(GetName(), "Interact Active: " + F.tf(_active.contains(caller.getName())))); + } + + else if (args[0].equalsIgnoreCase("load")) + { + load(); + UtilPlayer.message(caller, F.main(_moduleName, "Reloaded Field Blocks from Database.")); + } + + else if (args[0].equalsIgnoreCase("wipe")) + { + wipe(caller); + } + + else if (args[0].equalsIgnoreCase("help")) + { + help(caller); + } + + else if (args.length <= 1) + { + help(caller); + } + + else if (args[0].equalsIgnoreCase("title")) + { + _title.put(caller, args[1]); + showSettings(caller); + } + + else if (args[0].equalsIgnoreCase("stock")) + { + try + { + int count = Integer.parseInt(args[1]); + if (count < 1) count = 1; + _stock.put(caller, count); + showSettings(caller); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main(_moduleName, "Invalid Stock Max.")); + } + } + + else if (args[0].equalsIgnoreCase("regen")) + { + try + { + double regen = Double.parseDouble(args[1]); + if (regen < 0) regen = 0; + _regen.put(caller, UtilMath.trim(1, regen)); + showSettings(caller); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main(_moduleName, "Invalid Stock Regeneration Time.")); + } + } + + else if (args[0].equalsIgnoreCase("empty")) + { + try + { + String[] toks = args[1].split(":"); + + int id = Integer.parseInt(toks[0]); + byte data = Byte.parseByte(toks[1]); + + _emptyId.put(caller, id); + _emptyData.put(caller, data); + showSettings(caller); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main(_moduleName, "Invalid Empty Block.")); + } + } + + + else if (args[0].equalsIgnoreCase("loot")) + { + boolean error = false; + for (String cur : args[1].split(",")) + { + String[] loot = cur.split(":"); + + if (loot.length != 5) + { + error = true; + break; + } + + try + { + Integer.parseInt(loot[0]); + Byte.parseByte(loot[1]); + Integer.parseInt(loot[2]); + Integer.parseInt(loot[3]); + Integer.parseInt(loot[4]); + } + catch (Exception e) + { + error = true; + break; + } + } + + if (error) + { + UtilPlayer.message(caller, F.main(_moduleName, "Invalid Loot String.")); + return; + } + + _lootString.put(caller, args[1]); + showSettings(caller); + } + } + + private void showSettings(Player caller) + { + populateSettings(caller); + + UtilPlayer.message(caller, F.main(_moduleName, "Field Addition Settings;")); + UtilPlayer.message(caller, F.desc("Title", _title.get(caller))); + UtilPlayer.message(caller, F.desc("Stock", _stock.get(caller)+"")); + UtilPlayer.message(caller, F.desc("Regen", _regen.get(caller)+"")); + UtilPlayer.message(caller, F.desc("Empty", _emptyId.get(caller) + ":" + _emptyData.get(caller))); + UtilPlayer.message(caller, F.desc("Loot", _lootString.get(caller))); + } + + private void populateSettings(Player caller) + { + if (!_title.containsKey(caller)) _title.put(caller, "Default"); + if (!_stock.containsKey(caller)) _stock.put(caller, 1); + if (!_regen.containsKey(caller)) _regen.put(caller, 3d); + if (!_emptyId.containsKey(caller)) _emptyId.put(caller, 1); + if (!_emptyData.containsKey(caller)) _emptyData.put(caller, (byte)0); + if (!_lootString.containsKey(caller)) _lootString.put(caller, "263:0:2:1:50"); + } + + public void help(Player caller) + { + UtilPlayer.message(caller, F.main(_moduleName, "Commands List;")); + UtilPlayer.message(caller, F.help("/fo toggle", "Toggle Tools", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fb loot ", "Set Loot", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fb empty ", "Set Empty Block", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fb stock <#>", "Set Stock Max", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fb regen ", "Set Stock Regen", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fb wipe", "Delete All Block Fields (Database)", Rank.ADMIN)); + } + + @EventHandler + public void handleInteract(PlayerInteractEvent event) + { + if (!_active.contains(event.getPlayer().getName())) + return; + + if (event.getPlayer().getItemInHand() != null && event.getPlayer().getItemInHand().getType().toString().contains("PICKAXE")) + { + if (Util().Event().isAction(event, ActionType.R_BLOCK)) + showBlock(event.getPlayer(), event); + } + + else if (Util().Gear().isMat(event.getPlayer().getItemInHand(), Material.GLOWSTONE_DUST)) + { + if (Util().Event().isAction(event, ActionType.L_BLOCK)) + addBlock(event.getPlayer(), event); + + else if (Util().Event().isAction(event, ActionType.R)) + glowBlocks(event.getPlayer(), event); + } + + else if (Util().Gear().isMat(event.getPlayer().getItemInHand(), Material.REDSTONE)) + { + if (Util().Event().isAction(event, ActionType.L_BLOCK)) + delBlock(event.getPlayer(), event); + + else if (Util().Event().isAction(event, ActionType.R)) + glowBlocks(event.getPlayer(), event); + } + } + + private void glowBlocks(Player player, PlayerInteractEvent event) + { + if (!Clients().Get(player).Rank().Has(Rank.ADMIN, false)) + return; + + load(); + + for (FieldBlockData cur : _blocks.values()) + cur.getBlock().setTypeId(89); + + event.setCancelled(true); + } + + private void wipe(Player player) + { + for (FieldBlockData cur : _blocks.values()) + { + cur.setEmpty(); + GetRepository().DeleteFieldBlock(_serverName, UtilWorld.locToStr(cur.getLocation())); + } + + _blocks.clear(); + + UtilPlayer.message(player, F.main(_moduleName, "Full Field Wipe Completed.")); + } + + private void delBlock(Player player, PlayerInteractEvent event) + { + if (!Clients().Get(player).Rank().Has(Rank.ADMIN, false)) + return; + + GetRepository().DeleteFieldBlock(_serverName, UtilWorld.locToStr(event.getClickedBlock().getLocation())); + + //Inform + event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, 42); + UtilPlayer.message(player, F.main(_moduleName, "Field Block removed.")); + + event.setCancelled(true); + } + + private void addBlock(Player player, PlayerInteractEvent event) + { + if (!Clients().Get(player).Rank().Has(Rank.ADMIN, false)) + return; + + populateSettings(player); + showSettings(player); + + FieldBlockToken token = new FieldBlockToken(); + + token.Server = _serverName; + token.Location = UtilWorld.locToStr(event.getClickedBlock().getLocation()); + token.BlockId = event.getClickedBlock().getTypeId(); + token.BlockData = event.getClickedBlock().getData(); + token.EmptyId = _emptyId.get(player); + token.EmptyData = _emptyData.get(player); + token.StockMax = _stock.get(player); + token.StockRegenTime = _regen.get(player); + token.Loot = _lootString.get(player); + + GetRepository().AddFieldBlock(token); + + //Inform + event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, 41); + UtilPlayer.message(player, F.main(_moduleName, "Field Block added.")); + + event.setCancelled(true); + } + + private void showBlock(Player player, PlayerInteractEvent event) + { + FieldBlockData fieldBlock = getFieldBlock(event.getClickedBlock()); + if (fieldBlock == null) return; + + fieldBlock.showInfo(player); + + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void BlockBreak(BlockBreakEvent event) + { + if (event.isCancelled()) + return; + + FieldBlockData fieldBlock = getFieldBlock(event.getBlock()); + if (fieldBlock == null) return; + + fieldBlock.handleMined(event.getPlayer()); + event.setCancelled(true); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + for (FieldBlockData cur : _blocks.values()) + cur.regen(); + + if (event.getType() == UpdateType.FAST) + for (FieldBlockData cur : _blocks.values()) + cur.check(); + } + + public void load() + { + clean(); + + for (FieldBlockToken token : GetRepository().GetFieldBlocks(_serverName)) + { + Location loc = UtilWorld.strToLoc(token.Location); + _blocks.put(token.Location, new FieldBlockData(this, loc, token.BlockId, token.BlockData, token.EmptyId, token.EmptyData, token.StockMax, token.StockRegenTime, token.Loot)); + } + } + + public void clean() + { + for (FieldBlockData cur : _blocks.values()) + cur.clean(); + + _blocks.clear(); + } + + public FieldBlockData getFieldBlock(Block block) + { + if (_blocks.containsKey(UtilWorld.locToStr(block.getLocation()))) + return _blocks.get(UtilWorld.locToStr(block.getLocation())); + + return null; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlockData.java b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlockData.java new file mode 100644 index 000000000..8dc5afe28 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlockData.java @@ -0,0 +1,219 @@ +package me.chiss.Core.Field; + +import java.util.ArrayList; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.itemstack.ItemStackFactory; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public class FieldBlockData +{ + //Block + private Location _loc; + + private ArrayList _loot; + + private int _stockCur; + private int _stockMax; + + private int _blockId; + private byte _blockData; + + private int _emptyId; + private byte _emptyData; + + private long _regenTime; + private long _breakTime; + + private FieldBlock Field; + + //Constructor + public FieldBlockData(FieldBlock field, Location loc, + int blockId, byte blockData, int emptyId, byte emptyData, + int stockMax, double regenTime, String lootString) + { + Field = field; + + //Block + _loc = loc; + + //Loot + _loot = new ArrayList(); + for (String cur : lootString.split(",")) + { + String[] loot = cur.split(":"); + + if (loot.length != 5) + { + Field.Log("Loot Failure: " + cur); + continue; + } + + //Parse and Add + try + { + _loot.add(new FieldBlockLootData(Integer.parseInt(loot[0]), + Byte.parseByte(loot[1]), + Integer.parseInt(loot[2]), + Integer.parseInt(loot[3]), + Integer.parseInt(loot[4]))); + } + catch (Exception e) + { + Field.Log("Loot Failure: " + cur); + } + } + + _stockCur = 0; + _stockMax = stockMax; + + _blockId = blockId; + _blockData = blockData; + + _emptyId = emptyId; + _emptyData = emptyData; + + _regenTime = (long)(regenTime * 60000); + _breakTime = 0; + + //Start Ore + regen(); + } + + public void check() + { + //Correct Block + if (_stockCur >= 1) + if (_loc.getBlock().getTypeId() != _blockId) + { + //89 is used to display Field Blocks + if (_loc.getBlock().getTypeId() != 89) + _stockCur--; + + _loc.getBlock().setTypeIdAndData(_blockId, _blockData, false); + } + + if (_stockCur == 0) + if (_loc.getBlock().getTypeId() != _emptyId) + _loc.getBlock().setTypeIdAndData(_emptyId, _emptyData, false); + } + + public void regen() + { + //Maxed + if (_stockCur >= _stockMax) + return; + + //Cooldown + if (!UtilTime.elapsed(_breakTime, UtilField.scale(_regenTime))) + return; + + //Increase Ore + if (_stockCur == 0) + _loc.getBlock().setTypeIdAndData(_blockId, _blockData, false); + + _stockCur++; + _breakTime = System.currentTimeMillis(); + + //Effect + _loc.getWorld().playEffect(_loc, Effect.STEP_SOUND, _blockId); + } + + public void handleMined(Player player) + { + if (!Field.Energy().use(player, "Mine Field Block", 60, true, true)) + return; + + //Set Break Time - Avoid Instant Regen + if (_stockCur == _stockMax) + _breakTime = System.currentTimeMillis(); + + //Loot + Change Block + if (_stockCur <= 0) + return; + + if (tryMine()) + { + //Effect + _loc.getWorld().playEffect(_loc, Effect.STEP_SOUND, _loc.getBlock().getTypeId()); + + _stockCur--; + if (_stockCur == 0) + _loc.getBlock().setTypeIdAndData(_emptyId, _emptyData, false); + } + + //Slow + Field.Condition().Factory().Slow("Field Slow", player, player, 6, 1, false, true, false); + } + + public boolean tryMine() + { + if (_loot.isEmpty()) + return true; + + boolean dropped = false; + + for (FieldBlockLootData cur : _loot) + { + if (cur.drop()) + { + int amount = cur.base + UtilMath.r(cur.bonus+1); + _loc.getWorld().dropItemNaturally(_loc, ItemStackFactory.Instance.CreateStack(cur.id, cur.data, amount)); + dropped = true; + } + } + + return dropped; + } + + public void showInfo(Player player) + { + UtilPlayer.message(player, F.main("Field", "Block Information;")); + UtilPlayer.message(player, F.desc("Block Capacity", _stockCur + "/" + _stockMax)); + + if (_stockCur >= _stockMax) + UtilPlayer.message(player, F.desc("Block Regeneration", "Full Capacity")); + else + { + long time = UtilField.scale(_regenTime) - (System.currentTimeMillis() - _breakTime); + UtilPlayer.message(player, F.desc("Block Regeneration", + UtilTime.convertString(time, 1, TimeUnit.FIT))); + } + + for (FieldBlockLootData cur : _loot) + cur.showInfo(player); + } + + public void clean() + { + _loc.getBlock().setTypeIdAndData(_emptyId, _emptyData, false); + } + + public Block getBlock() + { + return _loc.getBlock(); + } + + public Location getLocation() + { + return _loc; + } + + public void setEmpty() + { + getBlock().setTypeIdAndData(_emptyId, _emptyData, true); + } + + public boolean isEmpty() + { + return _stockCur == 0; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlockLootData.java b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlockLootData.java new file mode 100644 index 000000000..e1c3b6796 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlockLootData.java @@ -0,0 +1,50 @@ +package me.chiss.Core.Field; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemStackFactory; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class FieldBlockLootData +{ + protected int id; + protected byte data; + protected int base; + protected int bonus; + protected int chance; + + public FieldBlockLootData(int idIn, byte dataIn, int baseIn, int bonusIn, int chanceIn) + { + id = idIn; + data = dataIn; + base = baseIn; + bonus = bonusIn; + chance = chanceIn; + + if (chance <= 0) chance = 1; + if (chance > 100) chance = 100; + + if (base <= 0) base = 1; + if (bonus < 0) bonus = 0; + } + + public boolean drop() + { + return (UtilMath.r(100) <= chance); + } + + public void showInfo(Player player) + { + String name = Material.getMaterial(id).toString(); + String amount = base + ""; + if (bonus > 0) + amount = base + " to " + (base+bonus); + + name = ItemStackFactory.Instance.GetName(id, data, false); + + UtilPlayer.message(player, F.desc(name, amount + " at " + chance + "%")); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldMonster.java b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldMonster.java new file mode 100644 index 000000000..9f9dc5886 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldMonster.java @@ -0,0 +1,332 @@ +package me.chiss.Core.Field; + +import java.util.HashSet; +import java.util.WeakHashMap; + +import nautilus.minecraft.core.webserver.token.Server.FieldMonsterToken; + +import org.bukkit.Location; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.server.IRepository; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import me.chiss.Core.Field.Monsters.FieldMonsterBase; +import me.chiss.Core.Module.AModule; + +public class FieldMonster extends AModule +{ + private HashSet _pits; + private String _serverName; + + private WeakHashMap _input = new WeakHashMap(); + + public FieldMonster(JavaPlugin plugin, IRepository repository, String serverName) + { + super("Field Monster", plugin, repository); + + _pits = new HashSet(); + _serverName = serverName; + + Load(); + } + + @Override + public void enable() + { + + } + + @Override + public void disable() + { + Clean(); + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("fm"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) + return; + + if (!_input.containsKey(caller)) + _input.put(caller, new FieldMonsterInput()); + + FieldMonsterInput input = _input.get(caller); + + if (args.length == 0) + { + _input.get(caller).Display(caller); + UtilPlayer.message(caller, F.main(_moduleName, "Type " + F.elem("/fm help") + " for commands.")); + } + + else if (args[0].equalsIgnoreCase("help")) + { + Help(caller); + } + + else if (args[0].equalsIgnoreCase("type")) + { + try + { + input.type = UtilEnt.searchEntity(caller, args[1], true); + if (input.type != null) + input.Display(caller); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main(_moduleName, "Invalid Monster Type.")); + } + } + + else if (args[0].equalsIgnoreCase("max")) + { + try + { + int value = Integer.parseInt(args[1]); + if (value < 1) value = 1; + input.mobMax = value; + input.Display(caller); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main(_moduleName, "Invalid Monster Max.")); + } + } + + else if (args[0].equalsIgnoreCase("rate")) + { + try + { + double value = Double.parseDouble(args[1]); + if (value < 0) value = 0; + input.mobRate = value; + input.Display(caller); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main(_moduleName, "Invalid Monster Rate.")); + } + } + + else if (args[0].equalsIgnoreCase("radius")) + { + try + { + int integer = Integer.parseInt(args[1]); + if (integer < 1) integer = 1; + input.radius = integer; + input.Display(caller); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main(_moduleName, "Invalid Area Radius.")); + } + } + + else if (args[0].equalsIgnoreCase("height")) + { + try + { + int integer = Integer.parseInt(args[1]); + if (integer < 1) integer = 1; + input.height = integer; + input.Display(caller); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main(_moduleName, "Invalid Area Height.")); + } + } + + else if (args[0].equalsIgnoreCase("create")) + { + if (args.length < 2) + { + UtilPlayer.message(caller, F.main(_moduleName, "Missing Monster Field Name.")); + } + else + { + Create(caller, args[1]); + } + } + + else if (args[0].equalsIgnoreCase("delete")) + { + if (args.length < 2) + { + UtilPlayer.message(caller, F.main(_moduleName, "Missing Monster Field Name.")); + } + else + { + Delete(caller, args[1]); + } + } + + else if (args[0].equalsIgnoreCase("list")) + { + UtilPlayer.message(caller, F.main(_moduleName, "Listing Monster Fields;")); + + for (FieldMonsterBase pit : _pits) + pit.Display(caller); + } + + else if (args[0].equalsIgnoreCase("info")) + { + UtilPlayer.message(caller, F.main(GetName(), "Listing Monster Fields;")); + + for (FieldMonsterBase pit : _pits) + pit.Display(caller); + } + + else if (args[0].equalsIgnoreCase("wipe")) + { + Wipe(caller, true); + } + + else if (args[0].equalsIgnoreCase("kill")) + { + for (FieldMonsterBase pit : _pits) + pit.RemoveMonsters(); + } + + else + { + UtilPlayer.message(caller, F.main(GetName(), "Invalid Command.")); + } + } + + private void Help(Player caller) + { + UtilPlayer.message(caller, F.main(GetName(), "Commands List;")); + UtilPlayer.message(caller, F.help("/fm type ", "Set Monster Type", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm max <#>", "Set Monster Limit", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm rate ", "Set Monster Rate", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm radius <#>", "Set Area Radius", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm height <#>", "Set Area Height", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm create ", "Create at your Location", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm delete ", "Delete Field", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm list", "List Monster Fields", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm info ", "Display Monster Field", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm kill", "Kills all Field Monsters", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm wipe", "Delete All Monster Field (Database)", Rank.ADMIN)); + } + + private void Create(Player caller, String name) + { + FieldMonsterInput input = _input.get(caller); + + if (input.type == null) + { + UtilPlayer.message(caller, F.main(GetName(), "You have not set Monster Type.")); + return; + } + + for (FieldMonsterBase pit : _pits) + { + if (name.equalsIgnoreCase(pit.GetName())) + { + UtilPlayer.message(caller, F.main(GetName(), "Monster Field with this name already exists.")); + return; + } + } + + FieldMonsterBase pit = new FieldMonsterBase(this, name, _serverName, input.type, input.mobMax, input.mobRate, caller.getLocation(), input.radius, input.height); + Add(pit, true); + + UtilPlayer.message(caller, F.main(GetName(), "You created Monster Field.")); + pit.Display(caller); + } + + private void Add(FieldMonsterBase pit, boolean repo) + { + UtilServer.getServer().getPluginManager().registerEvents(pit, Plugin()); + _pits.add(pit); + + if (repo) + GetRepository().AddFieldMonster(pit.GetToken()); + } + + private void Delete(Player caller, String name) + { + HashSet remove = new HashSet(); + + for (FieldMonsterBase pit : _pits) + if (pit.GetName().equalsIgnoreCase(name)) + remove.add(pit); + + int i = remove.size(); + + for (FieldMonsterBase pit : remove) + Delete(pit, true); + + UtilPlayer.message(caller, F.main(GetName(), "Deleted " + i + " Monster Field(s).")); + } + + private void Delete(FieldMonsterBase pit, boolean repo) + { + _pits.remove(pit); + pit.RemoveMonsters(); + HandlerList.unregisterAll(pit); + + if (repo) + GetRepository().DeleteFieldMonster(_serverName, pit.GetToken().Name); + } + + private void Wipe(Player player, boolean repo) + { + HashSet remove = new HashSet(); + + for (FieldMonsterBase pit : _pits) + remove.add(pit); + + _pits.clear(); + + for (FieldMonsterBase pit : remove) + Delete(pit, repo); + + UtilPlayer.message(player, F.main(_moduleName, "Field Monsters Wiped.")); + } + + private void Load() + { + Wipe(null, false); + + for (FieldMonsterToken token : GetRepository().GetFieldMonsters(_serverName)) + { + EntityType type = UtilEnt.searchEntity(null, token.Type, false); + if (type == null) continue; + + Location loc = UtilWorld.strToLoc(token.Centre); + if (loc == null) continue; + + FieldMonsterBase pit = new FieldMonsterBase(this, token.Name, _serverName, type, token.MobMax, token.MobRate, loc, token.Radius, token.Height); + Add(pit, false); + } + } + + private void Clean() + { + for (FieldMonsterBase pit : _pits) + pit.RemoveMonsters(); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldMonsterInput.java b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldMonsterInput.java new file mode 100644 index 000000000..d8227a054 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldMonsterInput.java @@ -0,0 +1,34 @@ +package me.chiss.Core.Field; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +public class FieldMonsterInput +{ + public enum CustomType + { + + } + + public EntityType type = null; + public CustomType customType = null; + + public int mobMax = 12; + public double mobRate = 1; + + public int radius = 12; + public int height = 4; + + public void Display(Player caller) + { + UtilPlayer.message(caller, F.main("Field Monster", "Field Monster Settings;")); + UtilPlayer.message(caller, F.desc("Type", type + "")); + UtilPlayer.message(caller, F.desc("Max", mobMax + "")); + UtilPlayer.message(caller, F.desc("Rate", mobRate + "")); + UtilPlayer.message(caller, F.desc("Radius", radius + "")); + UtilPlayer.message(caller, F.desc("Height ", height + "")); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldOre.java b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldOre.java new file mode 100644 index 000000000..c64bf2609 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldOre.java @@ -0,0 +1,340 @@ +package me.chiss.Core.Field; + +import java.util.ArrayList; +import java.util.HashSet; + +import nautilus.minecraft.core.webserver.token.Server.FieldOreToken; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import me.chiss.Core.Module.AModule; +import mineplex.core.server.IRepository; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.common.util.UtilEvent.ActionType; + +public class FieldOre extends AModule +{ + private HashSet _active = new HashSet(); + + private ArrayList _oreInactive = new ArrayList(); + private ArrayList _oreActive = new ArrayList(); + + private HashSet _oreLocations = new HashSet(); + + private long _oreRegen = 0; + private long _oreRegenTime = 20000; + + private String _serverName; + + public FieldOre(JavaPlugin plugin, IRepository repository, String serverName) + { + super("Field Ore", plugin, repository); + + _serverName = serverName; + + load(); + } + + @Override + public void enable() + { + + } + + @Override + public void disable() + { + clean(); + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("fo"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) + return; + + if (args.length == 0) + { + help(caller); + return; + } + + if (args[0].equalsIgnoreCase("toggle")) + { + if (!_active.remove(caller.getName())) + _active.add(caller.getName()); + + UtilPlayer.message(caller, F.main(GetName(), "Interact Active: " + F.tf(_active.contains(caller.getName())))); + } + + else if (args[0].equalsIgnoreCase("help")) + { + help(caller); + } + + else if (args[0].equalsIgnoreCase("reset")) + { + reset(caller); + } + + else if (args[0].equalsIgnoreCase("fill")) + { + fill(caller); + } + + else if (args[0].equalsIgnoreCase("list")) + { + list(caller); + } + + else if (args[0].equalsIgnoreCase("wipe")) + { + wipe(caller); + } + + + } + + public void help(Player caller) + { + UtilPlayer.message(caller, F.main(_moduleName, "Commands List;")); + UtilPlayer.message(caller, F.help("/fo toggle", "Toggle Tools", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fo list", "List Ores", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fo fill", "Set Ores to Ore", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fo reset", "Reset Ores to Stone", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fo wipe", "Delete All Ore Fields (Database)", Rank.ADMIN)); + } + + @EventHandler + public void handleInteract(PlayerInteractEvent event) + { + if (!_active.contains(event.getPlayer().getName())) + return; + + if (Util().Gear().isMat(event.getPlayer().getItemInHand(), Material.DIAMOND)) + { + if (Util().Event().isAction(event, ActionType.L)) + addBlock(event.getPlayer(), event); + + else if (Util().Event().isAction(event, ActionType.R_BLOCK)) + delBlock(event.getPlayer(), event); + } + } + + private void reset(Player player) + { + for (FieldOreData ore : _oreActive) + { + ore.SetActive(false); + _oreInactive.add(ore); + } + + _oreActive.clear(); + + UtilPlayer.message(player, F.main(_moduleName, "Field Ore Reset.")); + } + + private void fill(Player player) + { + while (!_oreInactive.isEmpty()) + _oreInactive.get(UtilMath.r(_oreInactive.size())).StartVein(2 + UtilMath.r(5)); + + UtilPlayer.message(player, F.main(_moduleName, "Field Ore Generated.")); + } + + private void list(Player player) + { + UtilPlayer.message(player, F.main(_moduleName, F.value("Total", ""+_oreLocations.size()))); + UtilPlayer.message(player, F.main(_moduleName, F.value("Active", ""+_oreActive.size()))); + UtilPlayer.message(player, F.main(_moduleName, F.value("Inactive", ""+_oreInactive.size()))); + } + + private void wipe(Player player) + { + reset(player); + + for (Location loc : _oreLocations) + { + GetRepository().DeleteFieldOre(_serverName, UtilWorld.locToStr(loc)); + } + + _oreInactive.clear(); + _oreLocations.clear(); + + UtilPlayer.message(player, F.main(_moduleName, "Field Ore Wiped.")); + } + + private void addBlock(Player player, PlayerInteractEvent event) + { + if (!Clients().Get(player).Rank().Has(Rank.ADMIN, false)) + return; + + Block block = player.getTargetBlock(null, 0); + + if (Get(block.getLocation()) != null) + { + UtilPlayer.message(player, F.main(_moduleName, "This is already Field Ore.")); + return; + } + + //Repo + FieldOreToken token = new FieldOreToken(); + token.Server = _serverName; + token.Location = UtilWorld.locToStr(block.getLocation()); + GetRepository().AddFieldOre(token); + + //Memory + _oreInactive.add(new FieldOreData(this, block.getLocation())); + + //Inform + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 57); + UtilPlayer.message(player, F.main(_moduleName, "Field Ore Added.")); + + event.setCancelled(true); + } + + private void delBlock(Player player, PlayerInteractEvent event) + { + if (!Clients().Get(player).Rank().Has(Rank.ADMIN, false)) + return; + + event.setCancelled(true); + + FieldOreData ore = Get(event.getPlayer().getTargetBlock(null, 0).getLocation()); + + if (ore == null) + { + UtilPlayer.message(player, F.main(_moduleName, "This is not Field Ore.")); + return; + } + + GetRepository().DeleteFieldOre(_serverName, UtilWorld.locToStr(event.getClickedBlock().getLocation())); + + ore.GetLocation().getBlock().setType(Material.STONE); + + ore.Delete(); + + _oreActive.remove(ore); + _oreInactive.remove(ore); + _oreLocations.remove(ore); + + //Inform + event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, 57); + UtilPlayer.message(player, F.main(_moduleName, "Field Ore Removed.")); + } + + public FieldOreData Get(Location loc) + { + for (FieldOreData ore : _oreInactive) + if (ore.GetLocation().equals(loc)) + return ore; + + for (FieldOreData ore : _oreActive) + if (ore.GetLocation().equals(loc)) + return ore; + + return null; + } + + @EventHandler(priority = EventPriority.LOWEST) + public void Break(BlockBreakEvent event) + { + if (event.isCancelled()) + return; + + if (!_oreLocations.contains(event.getBlock().getLocation())) + return; + + FieldOreData ore = Get(event.getBlock().getLocation()); + + if (ore == null) + return; + + event.setCancelled(true); + + ore.OreMined(event.getPlayer().getEyeLocation()); + } + + @EventHandler + private void Regenerate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_oreInactive.isEmpty()) + return; + + if (!UtilTime.elapsed(_oreRegen, UtilField.scale(_oreRegenTime))) + return; + + _oreRegen = System.currentTimeMillis(); + + //Start! + _oreInactive.get(UtilMath.r(_oreInactive.size())).StartVein(2 + UtilMath.r(5)); + } + + public ArrayList GetActive() + { + return _oreActive; + } + + public ArrayList GetInactive() + { + return _oreInactive; + } + + public HashSet GetLocations() + { + return _oreLocations; + } + + public void load() + { + clean(); + + for (FieldOreToken token : GetRepository().GetFieldOres(_serverName)) + { + Location loc = UtilWorld.strToLoc(token.Location); + + loc.getBlock().setType(Material.STONE); + _oreInactive.add(new FieldOreData(this, loc)); + _oreLocations.add(loc); + } + } + + public void clean() + { + reset(null); + _oreInactive.clear(); + _oreActive.clear(); + _oreLocations.clear(); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldOreData.java b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldOreData.java new file mode 100644 index 000000000..c7fa15213 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldOreData.java @@ -0,0 +1,209 @@ +package me.chiss.Core.Field; + +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Item; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.itemstack.ItemStackFactory; + +public class FieldOreData +{ + protected boolean _active = false; + + protected Location _loc = null; + protected HashSet _neighbours = new HashSet(); + protected double _neighbourDist = 4; + + protected FieldOre Field; + + public FieldOreData(FieldOre field, Location loc) + { + Field = field; + _loc = loc; + + Field.GetLocations().add(_loc); + + for (FieldOreData other : Field.GetInactive()) + { + if (other.equals(this)) + continue; + + if (UtilMath.offset(_loc, other.GetLocation()) > _neighbourDist) + continue; + + AddNeighbour(other); + other.AddNeighbour(this); + } + + for (FieldOreData other : Field.GetActive()) + { + if (other.equals(this)) + continue; + + if (UtilMath.offset(_loc, other.GetLocation()) > _neighbourDist) + continue; + + AddNeighbour(other); + other.AddNeighbour(this); + } + } + + public void AddNeighbour(FieldOreData other) + { + _neighbours.add(other); + } + + public void RemoveNeighbour(FieldOreData other) + { + _neighbours.remove(other); + } + + public Location GetLocation() + { + return _loc; + } + + public boolean IsActive() + { + return _active; + } + + public void OreMined(Location source) + { + //Persist + OreLoot(source); + + if (Math.random() > 0.9) + return; + + Field.GetInactive().add(this); + Field.GetActive().remove(this); + + _loc.getBlock().setType(Material.STONE); + + _active = false; + } + + public void OreLoot(Location source) + { + ItemStack stack = null; + + Block block = _loc.getBlock(); + + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + + if (block.getType() == Material.IRON_ORE) stack = ItemStackFactory.Instance.CreateStack(Material.IRON_INGOT); + else if (block.getType() == Material.GOLD_ORE) stack = ItemStackFactory.Instance.CreateStack(Material.GOLD_INGOT); + else if (block.getType() == Material.DIAMOND_ORE) stack = ItemStackFactory.Instance.CreateStack(Material.DIAMOND); + else if (block.getType() == Material.LAPIS_ORE) stack = ItemStackFactory.Instance.CreateStack(Material.INK_SACK, (byte)4); + else if (block.getType() == Material.COAL_ORE) stack = ItemStackFactory.Instance.CreateStack(Material.COAL, 2); + else if (block.getType() == Material.REDSTONE_ORE) stack = ItemStackFactory.Instance.CreateStack(Material.REDSTONE, 3); + + if (stack == null) + return; + + Vector vec = UtilAlg.getTrajectory(_loc.getBlock().getLocation().add(0.5, 0.5, 0.5), source).normalize(); + + Item item = _loc.getWorld().dropItem(_loc.getBlock().getLocation().add(0.5, 0.5, 0.5).add(vec), stack); + item.setPickupDelay(40); + } + + public void StartVein(int veinSize) + { + _loc.getBlock().setType(OreSelect()); + + Field.GetInactive().remove(this); + Field.GetActive().add(this); + + _active = true; + + //Spread + OreSpread(veinSize); + } + + public void OreSpread(int veinSize) + { + if (veinSize <= 0) + return; + + //Spread To... + FieldOreData closest = null; + double dist = 10; + + for (FieldOreData other : _neighbours) + { + if (other.IsActive()) + continue; + + if (UtilMath.offset(_loc, other.GetLocation()) > dist) + continue; + + closest = other; + } + + if (closest == null) + return; + + closest.StartVein(veinSize - 1); + } + + public Material OreSelect() + { + //Similar + FieldOreData closest = null; + double dist = 10; + + for (FieldOreData other : _neighbours) + { + if (!other.IsActive()) + continue; + + if (UtilMath.offset(_loc, other.GetLocation()) > dist) + continue; + + closest = other; + } + + if (closest != null) + return closest.GetLocation().getBlock().getType(); + + + //Spread + double rand = Math.random(); + + if (rand < 0.32) return Material.IRON_ORE; + if (rand < 0.64) return Material.GOLD_ORE; + if (rand < 0.96) return Material.DIAMOND_ORE; + if (rand < 0.98) return Material.COAL_ORE; + //if (rand < 0.97) return Material.REDSTONE_ORE; + return Material.LAPIS_ORE; + } + + public void Delete() + { + for (FieldOreData other : _neighbours) + other.RemoveNeighbour(this); + + Field.GetLocations().remove(_loc); + + _neighbours.clear(); + _neighbours = null; + _loc = null; + + System.out.println("Deleted"); + } + + public void SetActive(boolean active) + { + _active = active; + _loc.getBlock().setType(Material.STONE); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/Monsters/FieldMonsterBase.java b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/Monsters/FieldMonsterBase.java new file mode 100644 index 000000000..8f02202b0 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/Monsters/FieldMonsterBase.java @@ -0,0 +1,221 @@ +package me.chiss.Core.Field.Monsters; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + +import me.chiss.Core.Field.FieldMonster; +import me.chiss.Core.Field.UtilField; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; +import nautilus.minecraft.core.webserver.token.Server.FieldMonsterToken; +import net.minecraft.server.v1_6_R2.EntityCreature; +import net.minecraft.server.v1_6_R2.Navigation; + +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftCreature; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityCombustEvent; + +public class FieldMonsterBase implements Listener +{ + public FieldMonster Manager; + + private String _name; + private String _serverName; + private EntityType _type; + + private int _mobMax; + private HashMap _mobs = new HashMap(); + + private ArrayList _locs = new ArrayList(); + + private double _mobRate = 0.5; + private long _mobLast = 0; + + private Location _centre; + private int _radius; + private int _height; + + public FieldMonsterBase(FieldMonster manager, String name, String serverName, EntityType type, int mobMax, double mobRate, Location centre, int radius, int height) + { + Manager = manager; + + _name = name; + _serverName = serverName; + _type = type; + + _mobMax = mobMax; + _mobRate = mobRate; + + _centre = centre; + _radius = radius; + _height = height; + + + PopulateLocations(); + } + + @EventHandler + public void Spawn(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_locs.isEmpty()) + return; + + if (_mobs.size() >= _mobMax) + return; + + if (!UtilTime.elapsed(_mobLast, UtilField.scale((long) (_mobRate * 60000)))) + return; + + _mobLast = System.currentTimeMillis(); + + Entity ent = Manager.Creature().SpawnEntity(SelectLocation(), _type); + _mobs.put(ent, 0); + } + + @EventHandler + public void Despawn(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + HashSet remove = new HashSet(); + + for (Entity mob : _mobs.keySet()) + if (mob == null || mob.isDead() || !mob.isValid()) + remove.add(mob); + + for (Entity mob : remove) + _mobs.remove(mob); + } + + @EventHandler + public void Return(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Entity mob : _mobs.keySet()) + if (UtilMath.offset2d(mob.getLocation(), _centre) > 2*_radius) + { + int time = _mobs.get(mob) + 1; + _mobs.put(mob, time); + + Location loc = SelectLocation(); + if (loc == null) + continue; + + //Move + if (time < 10) + { + EntityCreature ec = ((CraftCreature)mob).getHandle(); + Navigation nav = ec.getNavigation(); + nav.a(loc.getX(), loc.getY(), loc.getZ(), 0.2f); + } + + //Extreme + else + { + mob.teleport(loc); + } + } + else + { + _mobs.put(mob, 0); + } + } + + @EventHandler + public void Combust(EntityCombustEvent event) + { + if (_mobs.containsKey(event.getEntity())) + event.setCancelled(true); + } + + public void PopulateLocations() + { + int attempts = 0; + while (_locs.size() < (_radius*_radius) && attempts < 2000) + { + attempts++; + + Block block = _centre.getBlock().getRelative(UtilMath.r(_radius * 2) - _radius, UtilMath.r(_height * 2) - _height, UtilMath.r(_radius * 2) - _radius); + + if (!UtilBlock.solid(block)) + continue; + + if (!UtilBlock.airFoliage(block.getRelative(0,1,0))) + continue; + + if (!UtilBlock.airFoliage(block.getRelative(0,2,0))) + continue; + + if (_locs.contains(block.getLocation())) + continue; + + _locs.add(block.getLocation().add(0.5, 1.5, 0.5)); + } + } + + public Location SelectLocation() + { + if (_locs.isEmpty()) + return null; + + return _locs.get(UtilMath.r(_locs.size())); + } + + public double GetRadius() + { + return _radius; + } + + public String GetName() + { + return _name; + } + + public void Display(Player caller) + { + UtilPlayer.message(caller, F.value(_name, _type.toString() + " " + UtilWorld.locToStrClean(_centre))); + } + + public void RemoveMonsters() + { + for (Entity ent : _mobs.keySet()) + ent.remove(); + + _mobs.clear(); + } + + public FieldMonsterToken GetToken() + { + FieldMonsterToken token = new FieldMonsterToken(); + + token.Name = _name; + token.Server = _serverName; + token.Type = _type.toString(); + token.MobMax = _mobMax; + token.MobRate = _mobRate; + token.Centre = UtilWorld.locToStr(_centre); + token.Radius = _radius; + token.Height = _height; + + return token; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/UtilField.java b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/UtilField.java new file mode 100644 index 000000000..a631b7b72 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/UtilField.java @@ -0,0 +1,12 @@ +package me.chiss.Core.Field; + +import mineplex.core.common.util.UtilServer; + +public class UtilField +{ + public static long scale(long regenTime) + { + int players = 80 - Math.min(80, UtilServer.getPlayers().length); + return (long)(regenTime * (-16 * Math.log(Math.pow(8.01,2) - Math.pow(0.1*players,2)) + 67.6)); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/repository/FieldRepository.java b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/repository/FieldRepository.java new file mode 100644 index 000000000..55722da6b --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/repository/FieldRepository.java @@ -0,0 +1,72 @@ +package me.chiss.Core.Field.repository; + +public class FieldRepository +{ + public List GetFieldBlocks(String server) + { + return new JsonWebCall(WebServerAddress + "Fields/GetFieldBlocks").Execute(new TypeToken>(){}.getType(), server); + } + + @Override + public void AddFieldBlock(FieldBlockToken token) + { + new AsyncJsonWebCall(WebServerAddress + "Fields/AddFieldBlock").Execute(token); + } + + @Override + public void DeleteFieldBlock(String server, String location) + { + FieldBlockToken token = new FieldBlockToken(); + token.Server = server; + token.Location = location; + + new AsyncJsonWebCall(WebServerAddress + "Fields/DeleteFieldBlock").Execute(token); + } + + //Field Ore + @Override + public List GetFieldOres(String server) + { + return new JsonWebCall(WebServerAddress + "Fields/GetFieldOres").Execute(new TypeToken>(){}.getType(), server); + } + + @Override + public void AddFieldOre(FieldOreToken token) + { + new AsyncJsonWebCall(WebServerAddress + "Fields/AddFieldOre").Execute(token); + } + + @Override + public void DeleteFieldOre(String server, String location) + { + FieldOreToken token = new FieldOreToken(); + token.Server = server; + token.Location = location; + + new AsyncJsonWebCall(WebServerAddress + "Fields/DeleteFieldOre").Execute(token); + } + + //Field Monster + @Override + public List GetFieldMonsters(String server) + { + return new JsonWebCall(WebServerAddress + "Fields/GetFieldMonsters").Execute(new TypeToken>(){}.getType(), server); + } + + @Override + public void AddFieldMonster(FieldMonsterToken token) + { + new AsyncJsonWebCall(WebServerAddress + "Fields/AddFieldMonster").Execute(token); + } + + @Override + public void DeleteFieldMonster(String server, String name) + { + FieldMonsterToken token = new FieldMonsterToken(); + token.Server = server; + token.Name = name; + + new AsyncJsonWebCall(WebServerAddress + "Fields/DeleteFieldMonster").Execute(token); + } + +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/PvP.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/PvP.java new file mode 100644 index 000000000..068182756 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/PvP.java @@ -0,0 +1,571 @@ +package nautilus.game.pvp; + +import java.util.HashSet; + +import me.chiss.Core.Chat.Chat; +import me.chiss.Core.Class.ClassFactory; +import me.chiss.Core.Config.Config; +import me.chiss.Core.Field.Field; +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Loot.LootFactory; +import me.chiss.Core.MemoryFix.MemoryFix; +import me.chiss.Core.Module.ModuleManager; +import me.chiss.Core.Modules.*; +import me.chiss.Core.NAC.NAC; +import me.chiss.Core.Plugin.IPlugin; +import me.chiss.Core.Plugin.IRelation; +import me.chiss.Core.Scheduler.Scheduler; +import mineplex.core.message.Message; +import mineplex.core.npc.NpcManager; +import mineplex.core.packethandler.TabLobbyList; +import mineplex.core.pet.PetFactory; +import mineplex.core.pet.PetManager; +import mineplex.core.pet.PetShop; +import mineplex.core.portal.Portal; +import mineplex.core.projectile.ProjectileManager; +import mineplex.core.recharge.Recharge; +import mineplex.core.server.ServerListener; +import mineplex.core.server.event.PlayerVoteEvent; +import mineplex.core.updater.Updater; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.antistack.AntiStack; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.command.CommandCenter; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.creature.Creature; +import mineplex.core.energy.Energy; +import mineplex.core.explosion.Explosion; +import mineplex.minecraft.game.classcombat.item.ItemFactory; +import mineplex.minecraft.game.core.combat.CombatManager; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.fire.Fire; +import mineplex.minecraft.game.core.mechanics.Weapon; +import mineplex.minecraft.punish.Punish; +import nautilus.game.pvp.modules.Farming; +import nautilus.game.pvp.modules.Gameplay; +import nautilus.game.pvp.modules.Recipes; +import nautilus.game.pvp.modules.ShopManager; +import nautilus.game.pvp.modules.SoundTest; +import nautilus.game.pvp.modules.TreeRemover; +import nautilus.game.pvp.modules.WorldBorder; +import nautilus.game.pvp.modules.Benefit.BenefitManager; +import nautilus.game.pvp.modules.Fishing.FishManager; +import nautilus.game.pvp.modules.clans.Clans; +import nautilus.game.pvp.modules.serverreset.ServerReset; +import nautilus.game.pvp.repository.PvPRepository; +import nautilus.game.pvp.worldevent.EventManager; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; + +public class PvP extends JavaPlugin implements IPlugin, Listener +{ + private String WEB_CONFIG = "webServer"; + + //Modules + private ModuleManager _moduleManager; + private Config _config; + private CoreClientManager _clientManager; + private Utility _utility; + private BlockRegenerate _blockRegenerate; + private BlockRestore _blockRestore; + private Blood _blood; + private Clans _clans; + private ClassFactory _classFactory; + private ConditionManager _condition; + private Creature _creature; + private DamageManager _damage; + private Energy _energy; + private Explosion _explosion; + private Field _field; + private Fire _fire; + private Ignore _ignore; + private Logger _logger; + private LootFactory _lootFactory; + private Observer _observer; + private PetManager _petManager; + private Recharge _recharge; + private me.chiss.Core.Server.Server _serverModule; + private ProjectileManager _throw; + private Weapon _weapon; + private Wiki _wiki; + + //Interfaces + private IRelation _relation; + + //Repo + private PvPRepository _repository; + + private ServerListener _serverListener; + + @Override + public void onEnable() + { + getConfig().addDefault(WEB_CONFIG, "http://www.nautmc.com/"); + getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); + saveConfig(); + + //Repo + _repository = new PvPRepository(GetWebServerAddress()); + + //Init Modules + GetModules(); + + _clientManager = CoreClientManager.Initialize(this, GetWebServerAddress()); + CommandCenter.Initialize(this, _clientManager); + + CombatManager.Initialize(this); + ItemStackFactory.Initialize(this); + + new Punish(this, GetWebServerAddress()); + GetBlood(); + GetClans(); + GetClasses(); + GetClients(); + GetCreature(); + GetCondition(); + GetEnergy(); + GetExplosion(); + GetField(); + GetFire(); + + new Fix(this); + new Give(this); + + GetIgnore(); + GetLoot(); + + new Message(this); + new NAC(this, _repository); + + GetObserver(); + GetServer(); + GetWeapon(); + //GetWiki(); + + _petManager = new PetManager(this, GetWebServerAddress(), GetCreature(), GetClients()); + + //Unreferenced Modules + new AntiStack(); + new Chat(this, _clientManager, GetClans()); + new EventManager(this); + new Farming(this); + new Firework(this); + Scheduler.Initialize(this, _repository); + FishManager.Initialize(this, Scheduler.Instance, _repository); + new Gameplay(this); + new mineplex.minecraft.game.core.mechanics.PistonJump(this); + new Information(this); + new PlayerInfo(this); + new PointManager(this, Scheduler.Instance, _repository, 4000, 150, 80, 8, 80, 8, 300); + new PetShop(this, _repository, GetClients(), new PetFactory(_repository), GetPetManager()); + new Quit(this); + new Recipes(this); + new SoundTest(this); + new ServerReset(this, GetWebServerAddress()); + new Tester(this); + new WorldBorder(this); + new MemoryFix(this); + + //Remove Skills + _skillFactory.RemoveSkill("Longshot", "Heavy Arrows"); + _skillFactory.RemoveSkill("Dwarf Toss", "Flesh Hook"); + _skillFactory.RemoveSkill("Fissure", null); + + //Activate Class Save + //GetClasses().GetRestore().Activate(); + + new Portal(this); + + //Shops + new ShopManager(this, _repository, new BenefitManager(this, GetWebServerAddress(), GetEnergy())); + new NpcManager(this); + + //Items + HashSet itemIgnore = new HashSet(); + itemIgnore.add("Bolas"); + itemIgnore.add("Shuriken"); + ItemFactory.Initialize(this, _repository, itemIgnore); + + //Set Relation + _relation = GetClans(); + + //Updates + getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); + + new TabLobbyList(this, _clientManager, new PlayerNamer(this, GetNameColorer()).PacketHandler, true); + + new TreeRemover(this); + + _serverListener = new ServerListener(GetWebServerAddress(), getServer().getIp(), getServer().getPort() + 1); + _serverListener.start(); + + this.getServer().getPluginManager().registerEvents(this, this); + } + + @EventHandler + public void onPlayerVote(PlayerVoteEvent event) + { + CoreClient client = _clientManager.Get(event.GetPlayerName()); + + if (client != null) + { + client.Donor().AddPoints(event.GetPointsReceived()); + + client.GetPlayer().sendMessage(ChatColor.AQUA + "*************************************"); + client.GetPlayer().sendMessage(C.cDGreen + " Thanks for voting!"); + client.GetPlayer().sendMessage(C.cDGreen + " You received " + ChatColor.YELLOW + event.GetPointsReceived() + C.cDGreen + " points! "); + client.GetPlayer().sendMessage(ChatColor.AQUA + "*************************************"); + client.GetPlayer().playSound(client.GetPlayer().getLocation(), Sound.LEVEL_UP, .3f, 1f); + + for (Player player : getServer().getOnlinePlayers()) + { + if (player == client.GetPlayer()) + continue; + + player.sendMessage(F.main("Vote", ChatColor.YELLOW + event.GetPlayerName() + ChatColor.GRAY + " voted at bettermc.com/Vote for " + ChatColor.YELLOW + event.GetPointsReceived() + C.cGray + " points! ")); + } + } + } + + @Override + public void onDisable() + { + GetModules().onDisable(); + _serverListener.Shutdown(); + } + + @EventHandler + public void SpawnTeleport(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + return; + + if (event.getClickedBlock().getType() != Material.ENDER_PORTAL_FRAME) + return; + + event.setCancelled(true); + + if (spawnList.isEmpty()) + return; + + int closestIndex = 0; + double dist = 99999; + + for (int i=0 ; i _itemMap; + private NautHashMap> _itemPlayerMap; + public BenefitRepository Repository; + + public BenefitManager(JavaPlugin plugin, String webServerAddress, Energy energy) + { + super("Benefit Manager", plugin); + + Repository = new BenefitRepository(webServerAddress); + _energy = energy; + _itemMap = new NautHashMap(); + _itemPlayerMap = new NautHashMap>(); + + PopulateFactory(); + } + + public boolean PlayerOwnsMe(String name, Player player) + { + return _itemPlayerMap.get(name).contains(player); + } + + private void PopulateFactory() + { + AddBenefitItem(new EnergizedPickaxe(this, _energy, Material.DIAMOND_PICKAXE), true); + AddBenefitItem(new CoinPack(this, "50k Coin Pack", Material.GOLD_INGOT, 50000), false); + AddBenefitItem(new CoinPack(this, "250k Coin Pack", Material.GOLD_BLOCK, 250000), false); + + List itemTokens = new ArrayList(); + + for (BenefitItem item : _itemMap.values()) + { + BenefitItemToken itemToken = new BenefitItemToken(); + itemToken.Name = item.GetName(); + itemToken.Material = item.GetDisplayMaterial().toString(); + itemToken.SalesPackage = new GameSalesPackageToken(); + + itemTokens.add(itemToken); + } + + for (BenefitItemToken itemToken : Repository.GetBenefitItems(itemTokens)) + { + if (_itemMap.containsKey(itemToken.Name)) + { + _itemMap.get(itemToken.Name).Update(itemToken.SalesPackage); + } + } + } + + private void AddBenefitItem(BenefitItem benefitItem, boolean addToOwnerList) + { + _itemMap.put(benefitItem.GetName(), benefitItem); + + if (addToOwnerList) + { + _itemPlayerMap.put(benefitItem.GetName(), new ArrayList()); + } + + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void Login(PlayerLoginEvent event) + { + GetClientEvent clientEvent = new GetClientEvent(event.getPlayer()); + + GetPluginManager().callEvent(clientEvent); + + if (clientEvent.GetClient().Rank().Has(Rank.EMERALD, false)) + { + _itemPlayerMap.get("Energized Pickaxe").add(event.getPlayer()); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void Quit(PlayerQuitEvent event) + { + _itemPlayerMap.get("Energized Pickaxe").remove(event.getPlayer()); + } + + public Collection GetBenefitItems() + { + return _itemMap.values(); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/BenefitShop.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/BenefitShop.java new file mode 100644 index 000000000..286d549bb --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/BenefitShop.java @@ -0,0 +1,23 @@ +package nautilus.game.pvp.modules.Benefit; + +import org.bukkit.entity.Player; + +import me.chiss.Core.Shopv2.ShopBase; +import me.chiss.Core.Shopv2.page.ShopPageBase; +import mineplex.core.CurrencyType; +import nautilus.game.pvp.modules.Benefit.UI.BenefitShopPage; + +public class BenefitShop extends ShopBase +{ + public BenefitShop(BenefitManager plugin, String name, CurrencyType...currencyTypes) + { + super(plugin, name, currencyTypes); + } + + @Override + protected ShopPageBase BuildPagesFor(Player player) + { + // Always return first page you want opened. + return new BenefitShopPage(Plugin, this, player); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Items/BenefitItem.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Items/BenefitItem.java new file mode 100644 index 000000000..1ccbfaffb --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Items/BenefitItem.java @@ -0,0 +1,22 @@ +package nautilus.game.pvp.modules.Benefit.Items; + +import me.chiss.Core.Shopv2.Item.SalesPackageBase; + +import org.bukkit.Material; +import org.bukkit.event.Listener; + +import nautilus.game.pvp.modules.Benefit.BenefitManager; + +public abstract class BenefitItem extends SalesPackageBase implements Listener +{ + protected BenefitManager Plugin; + + public BenefitItem(BenefitManager plugin, String name, Material material, String...description) + { + super(name, material, description); + + Plugin = plugin; + + plugin.RegisterEvents(this); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Items/CoinPack.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Items/CoinPack.java new file mode 100644 index 000000000..28d4eee05 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Items/CoinPack.java @@ -0,0 +1,31 @@ +package nautilus.game.pvp.modules.Benefit.Items; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.CurrencyType; +import mineplex.minecraft.account.GetClientEvent; + +import nautilus.game.pvp.modules.Benefit.BenefitManager; + +public class CoinPack extends BenefitItem +{ + private int _coinValue; + + public CoinPack(BenefitManager plugin, String name, Material material, int coinValue) + { + super(plugin, name, material); + + _coinValue = coinValue; + } + + public void Sold(Player player, CurrencyType currencyType) + { + GetClientEvent clientEvent = new GetClientEvent(player); + + Plugin.GetPluginManager().callEvent(clientEvent); + + clientEvent.GetClient().Game().SetEconomyBalance(_coinValue + clientEvent.GetClient().Game().GetEconomyBalance()); + clientEvent.GetClient().Donor().DeductCost(GetCost(currencyType), currencyType, false); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Items/EnergizedPickaxe.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Items/EnergizedPickaxe.java new file mode 100644 index 000000000..42ded9e14 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Items/EnergizedPickaxe.java @@ -0,0 +1,138 @@ +package nautilus.game.pvp.modules.Benefit.Items; + +import java.util.HashSet; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemHeldEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import mineplex.core.CurrencyType; +import mineplex.core.common.util.F; +import mineplex.core.energy.Energy; +import nautilus.game.pvp.modules.Benefit.BenefitManager; + +public class EnergizedPickaxe extends BenefitItem +{ + private HashSet _active; + private Energy _energy; + + public EnergizedPickaxe(BenefitManager plugin, Energy energy, Material material) + { + super(plugin, "Energized Pickaxe", material, ChatColor.RESET + "Available to Emerald or Diamond Ranks only.", ChatColor.BLACK + "", ChatColor.RESET + "" + ChatColor.GRAY + "Hold Diamond Pickaxe.", ChatColor.RESET + "" + ChatColor.GRAY + "Right-click to enable instant break mode.", ChatColor.RESET + "" + ChatColor.GRAY + "Consumes 12 Energy per block."); + + _energy = energy; + _active = new HashSet(); + } + + @Override + public void Sold(Player player, CurrencyType currencyType) + { + // Nothing + } + + @EventHandler + public void OnPlayerInteract(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (event.getItem() != null && event.getItem().getType() == Material.DIAMOND_PICKAXE && Plugin.PlayerOwnsMe(GetName(), player)) + { + if ((event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) && !_active.contains(player.getName())) + { + _active.add(player.getName()); + player.sendMessage(F.main(GetName(), GetName() + " activated.")); + return; + } + } + } + + @EventHandler + public void OnPlayerItemHeldChange(PlayerItemHeldEvent event) + { + if (_active.contains(event.getPlayer().getName()) && event.getPlayer().getItemInHand() != null && event.getPlayer().getItemInHand().getType() == Material.DIAMOND_PICKAXE) + { + Deactivate(event.getPlayer()); + } + } + + @EventHandler + public void OnPlayerOpenInventory(InventoryClickEvent event) + { + if (_active.contains(event.getWhoClicked().getName()) && event.getWhoClicked().getItemInHand() != null && event.getWhoClicked().getItemInHand().getType() != Material.DIAMOND_PICKAXE) + { + Deactivate((Player)event.getWhoClicked()); + } + } + + @EventHandler + public void OnPlayerDropItem(PlayerDropItemEvent event) + { + if (_active.contains(event.getPlayer().getName()) && event.getItemDrop().getItemStack().getType() == Material.DIAMOND_PICKAXE) + { + Deactivate(event.getPlayer()); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void OnBlockDamageEvent(BlockDamageEvent event) + { + if (_active.contains(event.getPlayer().getName())) + { + if (event.getBlock().getType() != Material.BEDROCK) + event.setInstaBreak(true); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void OnBlockBreakEvent(BlockBreakEvent event) + { + if (event.isCancelled()) + return; + + Player player = event.getPlayer(); + + if (_active.contains(player.getName())) + { + if (!_energy.use(player, Plugin.GetName(), 12, true, false)) + { + _active.remove(player.getName()); + player.sendMessage(F.main(GetName(), GetName() + " deactivated.")); + event.setCancelled(true); + return; + } + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void OnEntityDeath(EntityDeathEvent event) + { + if (event.getEntityType() == EntityType.PLAYER) + { + _active.remove(((Player)event.getEntity()).getName()); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void OnPlayerQuit(PlayerQuitEvent event) + { + _active.remove(event.getPlayer().getName()); + } + + private void Deactivate(Player player) + { + _active.remove(player.getName()); + player.sendMessage(F.main(GetName(), GetName() + " deactivated.")); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Repository/BenefitItemToken.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Repository/BenefitItemToken.java new file mode 100644 index 000000000..c3e95dbf1 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Repository/BenefitItemToken.java @@ -0,0 +1,10 @@ +package nautilus.game.pvp.modules.Benefit.Repository; + +import mineplex.minecraft.donation.repository.GameSalesPackageToken; + +public class BenefitItemToken +{ + public String Name; + public String Material; + public GameSalesPackageToken SalesPackage; +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Repository/BenefitRepository.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Repository/BenefitRepository.java new file mode 100644 index 000000000..95b2332fd --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Repository/BenefitRepository.java @@ -0,0 +1,21 @@ +package nautilus.game.pvp.modules.Benefit.Repository; + +import java.util.List; + +import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; + +import mineplex.core.server.RemoteRepository; +import mineplex.core.server.remotecall.JsonWebCall; + +public class BenefitRepository extends RemoteRepository +{ + public BenefitRepository(String webserverAddress) + { + super(webserverAddress); + } + + public List GetBenefitItems(List itemTokens) + { + return new JsonWebCall(WebServerAddress + "Dominate/GetBenefitItems").Execute(new TypeToken>(){}.getType(), itemTokens); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/UI/BenefitItemButtonBase.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/UI/BenefitItemButtonBase.java new file mode 100644 index 000000000..1f3d80dd5 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/UI/BenefitItemButtonBase.java @@ -0,0 +1,13 @@ +package nautilus.game.pvp.modules.Benefit.UI; + +import me.chiss.Core.Shop.IButton; + +public abstract class BenefitItemButtonBase implements IButton +{ + protected BenefitShopPage Shop; + + public BenefitItemButtonBase(BenefitShopPage shop) + { + Shop = shop; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/UI/BenefitShopPage.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/UI/BenefitShopPage.java new file mode 100644 index 000000000..6cb92700b --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/UI/BenefitShopPage.java @@ -0,0 +1,104 @@ +package nautilus.game.pvp.modules.Benefit.UI; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import mineplex.core.CurrencyType; +import mineplex.core.common.util.C; +import mineplex.core.Rank; +import me.chiss.Core.Shop.salespackage.ShopItem; +import me.chiss.Core.Shopv2.page.ConfirmationPage; +import me.chiss.Core.Shopv2.page.ShopPageBase; +import nautilus.game.pvp.modules.Benefit.BenefitManager; +import nautilus.game.pvp.modules.Benefit.BenefitShop; +import nautilus.game.pvp.modules.Benefit.Items.BenefitItem; +import nautilus.game.pvp.modules.Benefit.Items.CoinPack; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +public class BenefitShopPage extends ShopPageBase +{ + public BenefitShopPage(BenefitManager plugin, BenefitShop shop, Player player) + { + super(plugin, shop, " Benefit Shop", player); + BuildPage(); + } + + @SuppressWarnings("incomplete-switch") + protected void BuildPage() + { + int slot = 53; + boolean locked = false; + + for (BenefitItem item : Plugin.GetBenefitItems()) + { + switch (item.GetDisplayMaterial()) + { + case GOLD_INGOT: + slot = 30; + break; + case GOLD_BLOCK: + slot = 32; + break; + case DIAMOND_PICKAXE: + slot = 40; + + if (!Client.Rank().Has(Rank.EMERALD, false)) + locked = true; + + break; + } + + List itemLore = new ArrayList(); + + StringBuilder currencyBuilder = new StringBuilder(); + + for (CurrencyType currencyType : CurrencyType.values()) + { + int cost = item.GetCost(currencyType); + + if (cost > 0) + { + currencyBuilder.append(C.cYellow + cost + + currencyType.Prefix() + ChatColor.WHITE + " or "); + } + } + + if (currencyBuilder.indexOf("or") != -1) + itemLore.add(currencyBuilder.substring(0, currencyBuilder.length() - 6)); + else + itemLore.add(currencyBuilder.toString()); + + itemLore.add(C.cBlack); + + itemLore.addAll(Arrays.asList(item.GetDescription())); + + ShopItem shopItem = new ShopItem(item.GetDisplayMaterial(), + (byte) 0, item.GetName(), + itemLore.toArray(new String[itemLore.size()]), 1, locked, + false); + + if (item instanceof CoinPack) + AddButton(slot, shopItem, new CoinPackButton(this, + ((CoinPack) item))); + else + getInventory().setItem(slot, shopItem.getHandle()); + } + } + + public void PurchaseCoinPack(Player player, CoinPack coinPack) + { + if (Client.Donor().GetBalance(SelectedCurrency, false) >= coinPack.GetCost(SelectedCurrency)) + { + PlayAcceptSound(player); + Shop.OpenPageForPlayer(player, new ConfirmationPage(Plugin, Shop, Plugin.Repository, + null, this, coinPack, SelectedCurrency, false, player)); + } + else + { + PlayDenySound(player); + } + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/UI/CoinPackButton.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/UI/CoinPackButton.java new file mode 100644 index 000000000..b833cfc8f --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/UI/CoinPackButton.java @@ -0,0 +1,23 @@ +package nautilus.game.pvp.modules.Benefit.UI; + +import org.bukkit.entity.Player; + +import nautilus.game.pvp.modules.Benefit.Items.CoinPack; + +public class CoinPackButton extends BenefitItemButtonBase +{ + private CoinPack _coinPack; + + public CoinPackButton(BenefitShopPage shop, CoinPack coinPack) + { + super(shop); + + _coinPack = coinPack; + } + + @Override + public void Clicked(Player player) + { + Shop.PurchaseCoinPack(player, _coinPack); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Farming.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Farming.java new file mode 100644 index 000000000..166846623 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Farming.java @@ -0,0 +1,106 @@ +package nautilus.game.pvp.modules; + +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Module.AModule; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class Farming extends AModule +{ + public Farming(JavaPlugin plugin) + { + super("Farming", plugin); + } + + @Override + public void enable() + { + + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + + } + + @EventHandler + public void BlockBreak(BlockPlaceEvent event) + { + if (event.isCancelled()) + return; + + if (event.getBlock().getType() != Material.LEAVES) + return; + + if (event.getPlayer().getItemInHand() != null) + if (event.getPlayer().getItemInHand().getType() == Material.SHEARS) + return; + + if (Math.random() > 0.9) + event.getBlock().getWorld().dropItemNaturally( + event.getBlock().getLocation().add(0.5, 0.5, 0.5), + ItemStackFactory.Instance.CreateStack(Material.APPLE)); + + if (Math.random() > 0.999) + event.getBlock().getWorld().dropItemNaturally( + event.getBlock().getLocation().add(0.5, 0.5, 0.5), + ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE)); + } + + @EventHandler + public void BlockPlace(BlockPlaceEvent event) + { + if (event.isCancelled()) + return; + + if ( + event.getBlock().getTypeId() != 59 && + event.getBlock().getTypeId() != 83 && + event.getBlock().getTypeId() != 104 && + event.getBlock().getTypeId() != 105 && + event.getBlock().getTypeId() != 127 && + event.getBlock().getTypeId() != 141 && + event.getBlock().getTypeId() != 142 + ) + return; + + if (event.getBlock().getLocation().getY() < event.getBlock().getWorld().getSeaLevel() - 12) + { + UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot plant " + + F.item(ItemStackFactory.Instance.GetName(event.getPlayer().getItemInHand(), true)) + " this deep underground.")); + event.setCancelled(true); + } + + else if (event.getBlock().getLocation().getY() > event.getBlock().getWorld().getSeaLevel() + 24) + { + UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot plant " + + F.item(ItemStackFactory.Instance.GetName(event.getPlayer().getItemInHand(), true)) + " at this altitude.")); + event.setCancelled(true); + } + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Age.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Age.java new file mode 100644 index 000000000..888bd957c --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Age.java @@ -0,0 +1,36 @@ +package nautilus.game.pvp.modules.Fishing; + +public enum Age +{ + Young(50, 1, Rarity.Common), + Mature(100, 2, Rarity.Common), + Old(50, 4, Rarity.Moderate), + Ancient(10, 8, Rarity.Rare), + Mythical(1, 16, Rarity.Legendary); + + private int scale; + private double mult; + private Rarity rarity; + + private Age(int scale, double mult, Rarity rarity) + { + this.scale = scale; + this.mult = mult; + this.rarity = rarity; + } + + public int GetScale() + { + return scale; + } + + public double GetMult() + { + return mult; + } + + public Rarity GetRarity() + { + return rarity; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Fish.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Fish.java new file mode 100644 index 000000000..719b109ce --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Fish.java @@ -0,0 +1,40 @@ +package nautilus.game.pvp.modules.Fishing; + +public enum Fish +{ + Bass(260, 1, Rarity.Common), + Flounder(200, 2, Rarity.Common), + Barramundi(140, 3, Rarity.Common), + Snapper(80, 4, Rarity.Moderate), + Tuna(60, 6, Rarity.Moderate), + Mackarel(40, 8, Rarity.Moderate), + Trout(20, 12, Rarity.Rare), + Salmon(10, 16, Rarity.Rare), + Shark(1, 24, Rarity.Legendary); + + private int scale; + private double mult; + private Rarity rarity; + + private Fish(int scale, double mult, Rarity rarity) + { + this.scale = scale; + this.mult = mult; + this.rarity = rarity; + } + + public int GetScale() + { + return scale; + } + + public double GetMult() + { + return mult; + } + + public Rarity GetRarity() + { + return rarity; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/FishData.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/FishData.java new file mode 100644 index 000000000..d4c681239 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/FishData.java @@ -0,0 +1,23 @@ +package nautilus.game.pvp.modules.Fishing; + +public class FishData +{ + private double _pounds; + private String _catcher; + + public FishData(double size, String catcher) + { + _pounds = size; + _catcher = catcher; + } + + public double GetPounds() + { + return _pounds; + } + + public String GetCatcher() + { + return _catcher; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/FishManager.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/FishManager.java new file mode 100644 index 000000000..499a43ba6 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/FishManager.java @@ -0,0 +1,667 @@ +package nautilus.game.pvp.modules.Fishing; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + +import mineplex.core.Rank; +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Module.AModule; +import me.chiss.Core.Scheduler.IScheduleListener; +import me.chiss.Core.Scheduler.Scheduler; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.util.TimeSpan; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.minecraft.account.event.AsyncClientLoadEvent; +import nautilus.game.pvp.repository.PvPRepository; +import nautilus.minecraft.core.webserver.token.Account.FishToken; + +import org.bukkit.ChatColor; +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerFishEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerFishEvent.State; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class FishManager extends AModule implements IScheduleListener +{ + public static FishManager Instance; + + private PvPRepository _repository; + + private HashSet _debug = new HashSet(); + + private HashMap> _personal = new HashMap>(); + private HashMap _allTimeHigh = new HashMap(); + private HashMap _day = new HashMap(); + + private ArrayList _fishScale = new ArrayList(); + private ArrayList _fishAge = new ArrayList(); + private ArrayList _fishSize = new ArrayList(); + private ArrayList _monsterList = new ArrayList(); + private ArrayList _lootList = new ArrayList(); + + public static void Initialize(JavaPlugin plugin, Scheduler scheduler, PvPRepository repository) + { + if (Instance == null) + Instance = new FishManager(plugin, scheduler, repository); + } + + protected FishManager(JavaPlugin plugin, Scheduler scheduler, PvPRepository repository) + { + super("Fishing", plugin); + + _repository = repository; + + for (FishToken token : GetRepository().GetFishingAllTimeHigh()) + { + _allTimeHigh.put(Enum.valueOf(Fish.class, token.Name), new FishData(token.Size, token.Catcher)); + } + + for (FishToken token : GetRepository().GetFishingDayHigh()) + { + _day.put(Enum.valueOf(Fish.class, token.Name), new FishData(token.Size, token.Catcher)); + } + + Scheduler.Initialize(plugin, repository); + scheduler.ScheduleDailyRecurring(this, -5 * TimeSpan.HOUR); + } + + @Override + public PvPRepository GetRepository() + { + return _repository; + } + + @Override + public void enable() + { + + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("fish"); + AddCommand("fishing"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (args.length == 0) + { + // LOLWUT + } + else if (args[0].equals("ath")) + DisplayScores(caller, _allTimeHigh, "All Time High", true); + + else if (args[0].equals("day")) + DisplayScores(caller, _day, "Catch of the Day", true); + + else if (args[0].equals("pb")) + DisplayScores(caller, _personal.get(caller.getName()), "Personal Best", false); + + else if (args[0].equals("debug")) + { + if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) + return; + + if (!_debug.remove(caller.getName())) + _debug.add(caller.getName()); + + caller.sendMessage("Fishing Debug: " + _debug.contains(caller.getName())); + } + + else if (args[0].equals("test")) + { + if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) + return; + + int tests = 100000000; + double totalSize = 0; + for (int i=0 ; i 0.2) + CatchFish(player, event.getCaught().getLocation(), false); + + else if (Math.random() > 0.3) + CatchMonster(player, event.getCaught().getLocation(), false); + + else + CatchItem(player, event.getCaught().getLocation(), false); + + //Effect + player.getWorld().playEffect(event.getCaught().getLocation(), Effect.STEP_SOUND, 8); + player.getWorld().playSound(event.getCaught().getLocation(), Sound.SPLASH, 1f, 1f); + + event.setCancelled(true); + } + + private Fish SelectFish() + { + if (!_fishScale.isEmpty()) + return _fishScale.get(UtilMath.r(_fishScale.size())); + + for (Fish fish : Fish.values()) + for (int i=0 ; i 0) + { + ItemStack fishStack = ItemStackFactory.Instance.CreateStack(Material.RAW_FISH, (byte)0, Math.min((int)weightCopy, 64), + fish.GetRarity().GetColor() + fish.toString(), new String[] + { + C.cGray + "Age: " + age.GetRarity().GetColor() + age.toString(), + C.cGray + "Size: " + size.GetRarity().GetColor() + size.toString(), + C.cGray + "Weight: " + C.cGreen + UtilMath.trim(1, weight) + " Pounds" + }, player.getName() + " Fishing"); + Item item = player.getWorld().dropItem(loc, fishStack); + + //Launch + double mult = 0.5 + (0.6 * (UtilMath.offset(player.getLocation(), item.getLocation())/16d)); + item.setVelocity(player.getLocation().toVector().subtract(item.getLocation().toVector()).normalize().add(new Vector(0, 0.4, 0)).multiply(mult)); + + weightCopy -= 64; + } + + //Inform + UtilPlayer.message(player, F.main(GetName(), + "You caught a " + + ChatColor.GREEN + UtilMath.trim(1, weight) + " Pound " + + size.GetRarity().GetColor() + size.toString() + " " + + age.GetRarity().GetColor() + age.toString() + " " + + fish.GetRarity().GetColor() + fish.toString() + + C.cGray + ".")); + + //Record + RecordCatchFish(player, fish, age, size, weight); + + //Item + if (player.getItemInHand() != null) + { + if (player.getItemInHand().getType() == Material.FISHING_ROD) + { + //Weight + int pounds = (int)weight + ItemStackFactory.Instance.GetLoreVar(player.getItemInHand(), "Fish Caught", 0); + ItemStackFactory.Instance.SetLoreVar(player.getItemInHand(), "Fish Caught", "" + pounds); + + //Best + String caught = "" + ChatColor.GREEN + UtilMath.trim(1, weight) + " Pound " + + size.GetRarity().GetColor() + size.toString() + " " + + age.GetRarity().GetColor() + age.toString() + " " + + fish.GetRarity().GetColor() + fish.toString(); + try + { + String prevStr = ItemStackFactory.Instance.GetLoreVar(player.getItemInHand(), "Best Catch").split(" ")[0]; + double prev = Double.parseDouble(prevStr.substring(2, prevStr.length())); + + if (weight > prev) + ItemStackFactory.Instance.SetLoreVar(player.getItemInHand(), "Best Catch", caught); + } + catch (Exception e) + { + ItemStackFactory.Instance.SetLoreVar(player.getItemInHand(), "Best Catch", caught); + } + } + } + + + return weight; + } + + private void RecordCatchFish(Player player, Fish fish, Age age, Size size, double weight) + { + //ATH + boolean ath = true; + if (!_allTimeHigh.containsKey(fish)) + _allTimeHigh.put(fish, new FishData(weight, player.getName())); + else if (_allTimeHigh.get(fish).GetPounds() < weight) + _allTimeHigh.put(fish, new FishData(weight, player.getName())); + else + ath = false; + + if (ath) + { + UtilServer.broadcast("§b§lNew Fishing All Time High -------------------"); + + UtilServer.broadcast(F.name(player.getName()) + " caught a " + + ChatColor.GREEN + UtilMath.trim(1, weight) + " Pound " + + size.GetRarity().GetColor() + size.toString() + " " + + age.GetRarity().GetColor() + age.toString() + " " + + fish.GetRarity().GetColor() + fish.toString() + + C.cGray + "."); + + GetRepository().SaveFishingAllTimeHigh(fish, new FishData(weight, player.getName())); + } + + //Day + boolean day = true; + if (!_day.containsKey(fish)) + _day.put(fish, new FishData(weight, player.getName())); + else if (_day.get(fish).GetPounds() < weight) + _day.put(fish, new FishData(weight, player.getName())); + else + day = false; + + if (day) + { + if (!ath) + { + UtilPlayer.message(player, F.main(GetName(), + "This is the best " + fish.GetRarity().GetColor() + fish.toString() + C.cGray + " of the day!")); + } + + + GetRepository().SaveFishingDayHigh(fish, new FishData(weight, player.getName())); + } + + //Personal + if (!_personal.containsKey(player.getName())) + _personal.put(player.getName(), new HashMap()); + + boolean personalBest = true; + if (!_personal.get(player.getName()).containsKey(fish)) + _personal.get(player.getName()).put(fish, new FishData(weight, player.getName())); + else if (_personal.get(player.getName()).get(fish).GetPounds() < weight) + _personal.get(player.getName()).put(fish, new FishData(weight, player.getName())); + else + personalBest = false; + + if (personalBest) + { + if (!ath) + UtilPlayer.message(player, F.main(GetName(), + "This is your personal best " + fish.GetRarity().GetColor() + fish.toString() + C.cGray + " catch!")); + + GetRepository().SaveFishingScores(fish, new FishData(weight, player.getName())); + } + } + + private Monster SelectMonster() + { + if (!_monsterList.isEmpty()) + return _monsterList.get(UtilMath.r(_monsterList.size())); + + for (Monster monster : Monster.values()) + for (int i=0 ; i 1) + amountStr += amount + " "; + + //Inform + UtilPlayer.message(player, F.main(GetName(), + "You caught " + + loot.GetRarity().GetColor() + amountStr + ChatColor.stripColor(lootStack.getItemMeta().getDisplayName()) + + C.cGray + ".")); + + //Item + if (player.getItemInHand() != null) + if (player.getItemInHand().getType() == Material.FISHING_ROD) + { + //Weight + int loots = 1 + ItemStackFactory.Instance.GetLoreVar(player.getItemInHand(), "Loot Caught", 0); + ItemStackFactory.Instance.SetLoreVar(player.getItemInHand(), "Loot Caught", "" + loots); + } + + return loot; + } + + public boolean WaterCheck(Location loc) + { + int waterCount = 0; + for (Block cur : UtilBlock.getInRadius(loc.getBlock().getLocation(), 4d).keySet()) + { + int type = cur.getTypeId(); + if (type == 8 || type == 9) + { + waterCount++; + } + } + + if (waterCount > 64) + return true; + + return false; + } + + public void DisplayScores(Player caller, HashMap scores, String listName, boolean catcher) + { + UtilPlayer.message(caller, F.main(GetName(), "Displaying " + listName + ";")); + + for (Fish fish : Fish.values()) + { + if (scores == null || !scores.containsKey(fish)) + UtilPlayer.message(caller, + C.cYellow + fish.toString() + " " + + C.cRed + "None"); + + else if (!catcher) + UtilPlayer.message(caller, + C.cYellow + fish.toString() + " " + + C.cGreen + UtilMath.trim(1, scores.get(fish).GetPounds()) + " Pounds"); + + else + UtilPlayer.message(caller, + C.cYellow + fish.toString() + " " + + C.cGreen + UtilMath.trim(1, scores.get(fish).GetPounds()) + " Pounds " + + C.cGold + scores.get(fish).GetCatcher()); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void AsyncLogin(AsyncClientLoadEvent event) + { + HashMap personal = new HashMap(); + + for (FishToken token : event.GetClientToken().FishTokens) + { + personal.put(Fish.valueOf(token.Name), new FishData(token.Size, event.GetClientToken().Name)); + } + + _personal.put(event.GetClientToken().Name, personal); + } + + @EventHandler + public void UnloadPersonal(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + _personal.remove(player.getName()); + } + + @Override + public void AppointmentFire() + { + UtilServer.broadcast("§b§lBest Catches of the Day @ " + UtilTime.date()); + + double bestWeight = 0; + String best = C.cRed + "None"; + + for (Fish fish : Fish.values()) + { + if (_day == null || !_day.containsKey(fish)) + { + UtilServer.broadcast(C.cYellow + fish.toString() + " " + C.cRed + "None"); + } + + else + { + String out = C.cYellow + fish.toString() + " " + + C.cGreen + UtilMath.trim(1, _day.get(fish).GetPounds()) + " Pounds " + + C.cGold + _day.get(fish).GetCatcher(); + + if (_day.get(fish).GetPounds() > bestWeight) + { + bestWeight = _day.get(fish).GetPounds(); + best = out; + } + + UtilServer.broadcast(out);// + C.cDGreen + " 40,000 Coins"); + } + } + + if (!best.contains("None")) + { + UtilServer.broadcast("§b§lThe Best"); + UtilServer.broadcast(best);// + C.cDGreen + " 100,000 Coins"); + } + + _day.clear(); + + GetRepository().ClearDailyFishingScores(); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Loot.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Loot.java new file mode 100644 index 000000000..189debf71 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Loot.java @@ -0,0 +1,91 @@ +package nautilus.game.pvp.modules.Fishing; + +import org.bukkit.Material; + +public enum Loot +{ + A(Material.VINE, 24, 200, Rarity.Common), + B(Material.APPLE, 1, 200, Rarity.Common), + C(Material.LOG, 32, 200, Rarity.Common), + D(Material.DEAD_BUSH, 1, 200, Rarity.Common), + E(Material.COOKED_CHICKEN, 1, 200, Rarity.Common), + F(Material.COMPASS, 1, 200, Rarity.Common), + G(Material.LEAVES, 32, 200, Rarity.Common), + H(Material.FISHING_ROD, 1, 200, Rarity.Common), + I(Material.BONE, 12, 200, Rarity.Common), + + IRONHelm(Material.IRON_HELMET, 35, Rarity.Moderate), + IRONChest(Material.IRON_CHESTPLATE, 35, Rarity.Moderate), + IRONLegs(Material.IRON_LEGGINGS, 35, Rarity.Moderate), + IRONBoots(Material.IRON_BOOTS, 35, Rarity.Moderate), + + GOLDHelm(Material.GOLD_HELMET, 35, Rarity.Moderate), + GOLDChest(Material.GOLD_CHESTPLATE, 35, Rarity.Moderate), + GOLDLegs(Material.GOLD_LEGGINGS, 35, Rarity.Moderate), + GOLDBoots(Material.GOLD_BOOTS, 35, Rarity.Moderate), + + LEATHERHelm(Material.LEATHER_HELMET, 35, Rarity.Moderate), + LEATHERChest(Material.LEATHER_CHESTPLATE, 35, Rarity.Moderate), + LEATHERLegs(Material.LEATHER_LEGGINGS, 35, Rarity.Moderate), + LEATHERBoots(Material.LEATHER_BOOTS, 35, Rarity.Moderate), + + DIAMONDHelm(Material.DIAMOND_HELMET, 35, Rarity.Moderate), + DIAMONDChest(Material.DIAMOND_CHESTPLATE, 35, Rarity.Moderate), + DIAMONDLegs(Material.DIAMOND_LEGGINGS, 35, Rarity.Moderate), + DIAMONDBoots(Material.DIAMOND_BOOTS, 35, Rarity.Moderate), + + CHAINMAILHelm(Material.CHAINMAIL_HELMET, 35, Rarity.Moderate), + CHAINMAILChest(Material.CHAINMAIL_CHESTPLATE, 35, Rarity.Moderate), + CHAINMAILLegs(Material.CHAINMAIL_LEGGINGS, 35, Rarity.Moderate), + CHAINMAILBoots(Material.CHAINMAIL_BOOTS, 35, Rarity.Moderate), + + R1(Material.GOLD_SWORD, 25, Rarity.Rare), + R2(Material.GOLD_AXE, 25, Rarity.Rare), + R3(Material.DIAMOND_SWORD, 25, Rarity.Rare), + R4(Material.DIAMOND_AXE, 25, Rarity.Rare), + R5(Material.TNT, 25, Rarity.Rare), + + Unique(null, 1, Rarity.Legendary); + + private Material type; + private int amount = 1; + private int scale; + private Rarity rarity; + + private Loot(Material type, int amount, int scale, Rarity rarity) + { + this.scale = scale; + this.amount = amount; + this.type = type; + this.rarity = rarity; + + } + + private Loot(Material type, int scale, Rarity rarity) + { + this.scale = scale; + this.type = type; + this.rarity = rarity; + + } + + public int GetScale() + { + return scale; + } + + public Material GetType() + { + return type; + } + + public int GetAmount() + { + return amount; + } + + public Rarity GetRarity() + { + return rarity; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Monster.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Monster.java new file mode 100644 index 000000000..a3653f3ea --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Monster.java @@ -0,0 +1,41 @@ +package nautilus.game.pvp.modules.Fishing; + +import org.bukkit.entity.EntityType; + +public enum Monster +{ + Silverfish(EntityType.SILVERFISH, 1000, Rarity.Common), + Slime(EntityType.SLIME, 500, Rarity.Common), + Zombie(EntityType.ZOMBIE, 200, Rarity.Moderate), + Skeleton(EntityType.SKELETON, 200, Rarity.Moderate), + Creeper(EntityType.CREEPER, 50, Rarity.Rare), + TNT(EntityType.PRIMED_TNT, 25, Rarity.Rare), + Enderman(EntityType.ENDERMAN, 25, Rarity.Rare), + Wither(EntityType.WITHER, 0, Rarity.Legendary); + + private EntityType type; + private int scale; + private Rarity rarity; + + private Monster(EntityType type, int scale, Rarity rarity) + { + this.scale = scale; + this.type = type; + this.rarity = rarity; + } + + public int GetScale() + { + return scale; + } + + public EntityType GetType() + { + return type; + } + + public Rarity GetRarity() + { + return rarity; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Rarity.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Rarity.java new file mode 100644 index 000000000..036755c04 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Rarity.java @@ -0,0 +1,23 @@ +package nautilus.game.pvp.modules.Fishing; + +import org.bukkit.ChatColor; + +public enum Rarity +{ + Common(ChatColor.YELLOW), + Moderate(ChatColor.GOLD), + Rare(ChatColor.RED), + Legendary(ChatColor.LIGHT_PURPLE); + + private ChatColor c; + + private Rarity(ChatColor c) + { + this.c = c; + } + + public ChatColor GetColor() + { + return c; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Size.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Size.java new file mode 100644 index 000000000..8481bb925 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Fishing/Size.java @@ -0,0 +1,36 @@ +package nautilus.game.pvp.modules.Fishing; + +public enum Size +{ + Small(100, 1, Rarity.Common), + Moderate(200, 2, Rarity.Common), + Large(50, 4, Rarity.Moderate), + Huge(5, 8, Rarity.Rare), + Colossal(1, 16, Rarity.Legendary); + + private int scale; + private double mult; + private Rarity rarity; + + private Size(int scale, double mult, Rarity rarity) + { + this.scale = scale; + this.mult = mult; + this.rarity = rarity; + } + + public int GetScale() + { + return scale; + } + + public double GetMult() + { + return mult; + } + + public Rarity GetRarity() + { + return rarity; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Gameplay.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Gameplay.java new file mode 100644 index 000000000..e46ca4254 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Gameplay.java @@ -0,0 +1,831 @@ +package nautilus.game.pvp.modules; + +import java.util.HashMap; +import java.util.HashSet; + +import mineplex.core.Rank; +import me.chiss.Core.Combat.CombatLog; +import me.chiss.Core.Combat.Event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Module.AModule; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilEvent.ActionType; + +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.Effect; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Biome; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.block.BlockIgniteEvent; +import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerBucketFillEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.LeatherArmorMeta; +import org.bukkit.plugin.java.JavaPlugin; + +public class Gameplay extends AModule +{ + private HashMap _bucketWater = new HashMap(); + private HashMap _woolColors = new HashMap(); + + //private HashSet _torch = new HashSet(); + + public Gameplay(JavaPlugin plugin) + { + super("PvP Gameplay", plugin); + } + + //Module Functions + @Override + public void enable() + { + _woolColors = new HashMap(); + _woolColors.put("White", (byte)0); + _woolColors.put("Orange", (byte)1); + _woolColors.put("Magenta", (byte)2); + _woolColors.put("LightBlue", (byte)3); + _woolColors.put("Yellow", (byte)4); + _woolColors.put("Lime", (byte)5); + _woolColors.put("Pink", (byte)6); + _woolColors.put("Gray", (byte)7); + _woolColors.put("LightGray", (byte)8); + _woolColors.put("Cyan", (byte)9); + _woolColors.put("Purple", (byte)10); + _woolColors.put("Blue", (byte)11); + _woolColors.put("Brown", (byte)12); + _woolColors.put("Green", (byte)13); + _woolColors.put("Red", (byte)14); + _woolColors.put("Black", (byte)15); + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("gm"); + AddCommand("die"); + AddCommand("wool"); + AddCommand("leather"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (cmd.equals("die")) + { + Damage().NewDamageEvent(caller, null, null, DamageCause.SUICIDE, 5000, false, true, true, null, null); + return; + } + + if (cmd.equals("gm")) + { + if (Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) + { + if (caller.getGameMode() == GameMode.SURVIVAL) + caller.setGameMode(GameMode.CREATIVE); + else + caller.setGameMode(GameMode.CREATIVE); + + UtilPlayer.message(caller, F.main("Admin", "Toggled Game Mode.")); + } + } + + if (cmd.equals("leather")) + { + try + { + int r = Integer.valueOf(args[0]); + int g = Integer.valueOf(args[1]); + int b = Integer.valueOf(args[2]); + + LeatherArmorMeta meta; + + meta = (LeatherArmorMeta)caller.getInventory().getHelmet().getItemMeta(); + meta.setColor(Color.fromRGB(r, g, b)); + caller.getInventory().getHelmet().setItemMeta(meta); + + meta = (LeatherArmorMeta)caller.getInventory().getChestplate().getItemMeta(); + meta.setColor(Color.fromRGB(r, g, b)); + caller.getInventory().getChestplate().setItemMeta(meta); + + meta = (LeatherArmorMeta)caller.getInventory().getLeggings().getItemMeta(); + meta.setColor(Color.fromRGB(r, g, b)); + caller.getInventory().getLeggings().setItemMeta(meta); + + meta = (LeatherArmorMeta)caller.getInventory().getBoots().getItemMeta(); + meta.setColor(Color.fromRGB(r, g, b)); + caller.getInventory().getBoots().setItemMeta(meta); + + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main("Game", "Invalid Input.")); + } + } + + if (cmd.equals("wool")) + { + if (args.length == 0) + { + ListWool(caller); + } + else + { + SetWool(caller, args[0]); + } + + return; + } + + if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) + return; + } + + private void SetWool(Player caller, String search) + { + if (caller.getItemInHand() == null || caller.getItemInHand().getType() != Material.WOOL) + { + UtilPlayer.message(caller, F.main("Wool", "You must be holding wool.")); + return; + } + + HashSet match = new HashSet(); + + for (String cur : _woolColors.keySet()) + if (cur.toLowerCase().contains(search.toLowerCase())) + match.add(cur); + + try + { + byte id = Byte.parseByte(search); + for (String cur : _woolColors.keySet()) + if (_woolColors.get(cur) == id) + match.add(cur); + } + catch (Exception e) + { + + } + + //No / Non-Unique + if (match.size() != 1) + { + //Inform + UtilPlayer.message(caller, F.main("Wool Search", "" + + C.mCount + match.size() + + C.mBody + " matches for [" + + C.mElem + search + + C.mBody + "].")); + + if (match.size() > 0) + { + String matchString = ""; + for (String cur : match) + matchString += F.elem(cur) + ", "; + if (matchString.length() > 1) + matchString = matchString.substring(0 , matchString.length() - 2); + + UtilPlayer.message(caller, F.main("Wool Search", "" + + C.mBody + "Matches [" + + C.mElem + matchString + + C.mBody + "].")); + } + + return; + } + + for (String cur : match) + { + caller.setItemInHand(ItemStackFactory.Instance.CreateStack(Material.WOOL, _woolColors.get(cur), caller.getItemInHand().getAmount())); + UtilPlayer.message(caller, F.main("Wool", "Set color to " + F.elem(cur) + ".")); + } + } + + private void ListWool(Player caller) + { + UtilPlayer.message(caller, F.main("Wool", "Listing Colors;")); + String colors = ""; + for (String cur : _woolColors.keySet()) + colors += _woolColors.get(cur) + "." + cur + " "; + + UtilPlayer.message(caller, colors); + } + + @EventHandler + public void BucketEmpty(PlayerBucketEmptyEvent event) + { + event.setCancelled(true); + + Block block = event.getBlockClicked().getRelative(event.getBlockFace()); + + if (event.getBucket() == Material.WATER_BUCKET) + { + block.setTypeIdAndData(8, (byte)1, true); + BlockRestore().Add(event.getBlockClicked().getRelative(event.getBlockFace()), 8, (byte)0, 1000); + _bucketWater.put(block, System.currentTimeMillis()); + } + + if (event.getBucket() == Material.LAVA_BUCKET) + { + block.setTypeIdAndData(10, (byte)6, true); + BlockRestore().Add(event.getBlockClicked().getRelative(event.getBlockFace()), 10, (byte)0, 2000); + } + + + event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.BUCKET)); + UtilInv.Update(event.getPlayer()); + } + + @EventHandler + public void BucketFill(PlayerBucketFillEvent event) + { + event.setCancelled(true); + + if (event.getItemStack().getType() == Material.WATER_BUCKET) + if (!_bucketWater.containsKey(event.getBlockClicked())) + event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.WATER_BUCKET)); + + UtilInv.Update(event.getPlayer()); + } + + @EventHandler + public void BucketWaterExpire(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + HashSet remove = new HashSet(); + + for (Block cur : _bucketWater.keySet()) + if (UtilTime.elapsed(_bucketWater.get(cur), 2000)) + remove.add(cur); + + for (Block cur : remove) + _bucketWater.remove(cur); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void ObsidianCancel(BlockPlaceEvent event) + { + if (event.getBlock().getType() == Material.OBSIDIAN) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.item("Obsidian") + ".")); + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void CommandPlace(BlockPlaceEvent event) + { + if (event.getBlock().getType() == Material.COMMAND || + event.getBlock().getType() == Material.NOTE_BLOCK || + event.getBlock().getType() == Material.REDSTONE_LAMP_ON) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.item("Proximity Devices") + ".")); + event.setCancelled(true); + } + } + + @EventHandler + public void WebBreak(BlockDamageEvent event) + { + if (event.isCancelled()) + return; + + if (event.getBlock().getType() == Material.WEB) + event.setInstaBreak(true); + } + + @EventHandler(priority=EventPriority.LOWEST) + public void IronBlockBreak(BlockBreakEvent event) + { + if (event.isCancelled()) + return; + + if (event.getBlock().getType() != Material.IRON_BLOCK) + return; + + for (int x=-1 ; x<=1 ; x++) + for (int z=-1 ; z<=1 ; z++) + if (event.getBlock().getRelative(x, 1, z).getType() == Material.BEACON) + { + event.setCancelled(true); + return; + } + } + + @EventHandler + public void LapisPlace(BlockPlaceEvent event) + { + if (event.isCancelled()) + return; + + if (event.getBlock().getType() != Material.LAPIS_BLOCK) + return; + + event.setCancelled(true); + + UtilInv.remove(event.getPlayer(), Material.LAPIS_BLOCK, (byte)0, 1); + + final Block block = event.getBlock(); + + _plugin.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() + { + public void run() + { + block.setTypeId(8); + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 8); + block.getWorld().playSound(block.getLocation(), Sound.SPLASH, 2f, 1f); + } + }, 0); + } + + @EventHandler + public void EnderChestBreak(BlockBreakEvent event) + { + if (event.isCancelled()) + return; + + if (event.getBlock().getType() != Material.ENDER_CHEST) + return; + + event.setCancelled(true); + + event.getBlock().setTypeId(0); + event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().add(0.5, 0.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.ENDER_CHEST)); + } + + @EventHandler + public void IronDoor(PlayerInteractEvent event) + { + if (!Util().Event().isAction(event, ActionType.R_BLOCK)) + return; + + if (event.getClickedBlock().getTypeId() != 71) + return; + + Block block = event.getClickedBlock(); + + //Knock + if (event.isCancelled()) + { + if (!Recharge().use(event.getPlayer(), "Door Knock", 500, false)) + return; + + block.getWorld().playEffect(block.getLocation(), Effect.ZOMBIE_CHEW_WOODEN_DOOR, 0); + } + + //Open + else + { + if (block.getData() >= 8) + block = block.getRelative(BlockFace.DOWN); + + if (block.getData() < 4) block.setData((byte)(block.getData()+4), true); + else block.setData((byte)(block.getData()-4), true); + + //Effect + block.getWorld().playEffect(block.getLocation(), Effect.DOOR_TOGGLE, 0); + } + } + + @EventHandler + public void BrewingDisable(PlayerInteractEvent event) + { + if (!Util().Event().isAction(event, ActionType.R_BLOCK)) + return; + + if (event.getClickedBlock().getTypeId() != 117) + return; + + event.setCancelled(true); + } + + @EventHandler + public void BrewingBreak(BlockBreakEvent event) + { + if (event.isCancelled()) + return; + + if (event.getBlock().getType() != Material.BREWING_STAND) + return; + + event.setCancelled(true); + + event.getBlock().setTypeId(0); + event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().add(0.5, 0.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.BREWING_STAND)); + } + + + + @EventHandler + public void EnchantDisable(PlayerInteractEvent event) + { + if (!Util().Event().isAction(event, ActionType.R_BLOCK)) + return; + + if (event.getClickedBlock().getType() != Material.ENCHANTMENT_TABLE) + return; + + event.setCancelled(true); + } + + @EventHandler + public void AnvilDisable(PlayerInteractEvent event) + { + if (!Util().Event().isAction(event, ActionType.R_BLOCK)) + return; + + if (event.getClickedBlock().getType() != Material.ANVIL) + return; + + event.setCancelled(true); + } + + /** + @EventHandler + public void ThrowTorch(PlayerInteractEvent event) + { + if (!Util().Event().isAction(event, ActionType.L)) + return; + + Player player = event.getPlayer(); + + if (player.getItemInHand() == null) + return; + + if (player.getItemInHand().getType() != Material.REDSTONE_TORCH_ON) + return; + + if (Clans().CUtil().getAccess(player, player.getLocation()) != ClanRelation.SELF) + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You cannot use " + + F.skill("Throw Torch") + + " in " + + Clans().CUtil().getOwnerStringRel(player.getLocation(), event.getPlayer().getName()) + + ".")); + + return; + } + + if (player.getItemInHand().getAmount() > 1) + player.getItemInHand().setAmount(player.getItemInHand().getAmount() - 1); + else + player.setItemInHand(null); + + //Throw + Item item = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.REDSTONE_TORCH_ON)); + UtilAction.velocity(item, event.getPlayer().getLocation().getDirection(), 0.6, false, 0, 0.2, 10, false); + + //Save + _torch.add(item); + + event.setCancelled(true); + } + + @EventHandler + public void ThrowTNT(PlayerInteractEvent event) + { + if (!Util().Event().isAction(event, ActionType.L)) + return; + + Player player = event.getPlayer(); + + if (player.getItemInHand() == null) + return; + + if (player.getItemInHand().getType() != Material.TNT) + return; + + if (Clans().CUtil().getAccess(player, player.getLocation()) != ClanRelation.SELF) + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You cannot use " + + F.skill("Throw TNT") + + " in " + + Clans().CUtil().getOwnerStringRel(player.getLocation(), event.getPlayer().getName()) + + ".")); + + return; + } + + if (player.getItemInHand().getAmount() > 1) + player.getItemInHand().setAmount(player.getItemInHand().getAmount() - 1); + else + player.setItemInHand(null); + + //Throw + FallingBlock fall = event.getPlayer().getWorld().spawnFallingBlock(event.getPlayer().getEyeLocation(), 46, (byte)0); + UtilAction.velocity(fall, event.getPlayer().getLocation().getDirection(), 0.3, false, 0, 0.2, 10, false); + + event.setCancelled(true); + } + + @EventHandler + public void TorchLight(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Item item : _torch) + for (Block block : UtilBlock.getInRadius(item.getLocation(), 1.5).keySet()) + if (block.getTypeId() == 46) + { + block.setTypeIdAndData(0, (byte)0, true); + block.getWorld().spawn(block.getLocation().add(0.5, 0.5, 0.5), TNTPrimed.class); + } + } + + @EventHandler + public void TorchExpire(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + HashSet remove = new HashSet(); + + for (Item cur : _torch) + if (cur.isDead() || !cur.isValid()) + remove.add(cur); + + for (Item cur : remove) + { + _torch.remove(cur); + cur.remove(); + } + } + **/ + + @EventHandler + public void BonemealCancel(PlayerInteractEvent event) + { + if (!Util().Event().isAction(event, ActionType.R)) + return; + + Player player = event.getPlayer(); + + if (player.getItemInHand() == null) + return; + + if (player.getItemInHand().getType() != Material.INK_SACK) + return; + + if (player.getItemInHand().getData() == null) + return; + + if (player.getItemInHand().getData().getData() != 15) + return; + + event.setCancelled(true); + } + + @EventHandler + public void WildfireSpread(BlockBurnEvent event) + { + if (event.isCancelled()) + return; + + event.setCancelled(true); + + for (int x=-1 ; x<=1 ; x++) + for (int y=-1 ; y<=1 ; y++) + for (int z=-1 ; z<=1 ; z++) + { + //Self + if (x == 0 && y == 0 && z == 0) + { + event.getBlock().setType(Material.FIRE); + + if (event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.GRASS) + event.getBlock().getRelative(BlockFace.DOWN).setType(Material.DIRT); + + return; + } + + Block block = event.getBlock().getRelative(x, y, z); + + if (block.getRelative(BlockFace.DOWN).getType() == Material.GRASS) + block.getRelative(BlockFace.DOWN).setType(Material.DIRT); + + //Surroundings + if (!( + (x == 0 && y == 0) || + (x == 0 && z == 0) || + (y == 0 && z == 0) + )) + continue; + + if (block.getTypeId() == 0) + block.setType(Material.FIRE); + } + } + + @EventHandler + public void WildfireDirt(BlockIgniteEvent event) + { + if (event.isCancelled()) + return; + + if (event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.GRASS) + event.getBlock().getRelative(BlockFace.DOWN).setType(Material.DIRT); + } + + @EventHandler(priority = EventPriority.LOW) + public void WildfireCancel(BlockIgniteEvent event) + { + if (event.isCancelled()) + return; + + if (event.getBlock().getBiome() == Biome.JUNGLE || event.getBlock().getBiome() == Biome.JUNGLE_HILLS) + if (event.getCause() == IgniteCause.SPREAD) + event.setCancelled(true); + } + + @EventHandler (priority = EventPriority.HIGHEST) + public void MoneyLossSteal(CombatDeathEvent event) + { + if (!(event.GetEvent().getEntity() instanceof Player)) + return; + + Player player = (Player)event.GetEvent().getEntity(); + + int balance = Clients().Get(player).Game().GetEconomyBalance(); + + int lose = (int) (0.04 * balance); + + //Balance + Clients().Get(player).Game().SetEconomyBalance(balance - lose); + + CombatLog log = event.GetLog(); + if (log.GetKiller() != null) + { + //Inform + UtilPlayer.message(UtilPlayer.searchExact(log.GetKiller().GetName()), F.main("Death", "You stole " + F.count((lose) + " Coins") + " from " + F.name(player.getName()) + ".")); + + //Inform + UtilPlayer.message(player, F.main("Death", "You lost " + F.count((lose) + " Coins") + " to " + F.name(log.GetKiller().GetName()) + ".")); + } + else + { + //Inform + UtilPlayer.message(player, F.main("Death", "You lost " + F.count((lose) + " Coins") + " for dying.")); + } + } + + /* + @EventHandler + public void MaterialSwap(PlayerInteractEvent event) + { + ItemStack stack = event.getPlayer().getItemInHand(); + + if (stack == null) + return; + + if (stack.getType() == Material.IRON_INGOT) + { + event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.GOLD_INGOT, stack.getAmount())); + UtilPlayer.message(event.getPlayer(), F.main("Material", "You swapped " + F.elem("Iron") + " for " + F.elem("Gold") + ".")); + } + + else if (stack.getType() == Material.GOLD_INGOT) + { + event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.DIAMOND, stack.getAmount())); + UtilPlayer.message(event.getPlayer(), F.main("Material", "You swapped " + F.elem("Gold") + " for " + F.elem("Diamond") + ".")); + } + + else if (stack.getType() == Material.DIAMOND) + { + event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.LEATHER, stack.getAmount())); + UtilPlayer.message(event.getPlayer(), F.main("Material", "You swapped " + F.elem("Diamond") + " for " + F.elem("Leather") + ".")); + } + + else if (stack.getType() == Material.LEATHER) + { + event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.IRON_INGOT, stack.getAmount())); + UtilPlayer.message(event.getPlayer(), F.main("Material", "You swapped " + F.elem("Leather") + " for " + F.elem("Iron") + ".")); + } + } + */ + + @EventHandler + public void SpawnDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.FALL) + return; + + if (!Clans().CUtil().isSpecial(event.GetDamageeEntity().getLocation(), "Spawn")) + return; + + event.SetCancelled("Spawn Fall"); + } + + @EventHandler + public void Repair(PlayerInteractEvent event) + { + if (event.getClickedBlock() == null) + return; + + if (event.getClickedBlock().getType() != Material.ANVIL) + return; + + if (!Util().Event().isAction(event, ActionType.R_BLOCK)) + return; + + Player player = event.getPlayer(); + + if (UtilMath.offset(player.getLocation(), event.getClickedBlock().getLocation()) > 2) + { + UtilPlayer.message(player, F.main("Repair", "You are too far from the " + F.item("Anvil") + ".")); + return; + } + + if (player.getItemInHand() == null) + return; + + ItemStack item = player.getItemInHand(); + + if (item.getDurability() <= 0) + { + UtilPlayer.message(player, F.main("Repair", "Your " + F.item(item == null ? ChatColor.YELLOW + "Hand" : item.getItemMeta().getDisplayName()) + " does not need repairs.")); + return; + } + + if (!Util().Gear().isRepairable(item)) + { + UtilPlayer.message(player, F.main("Repair", "You cannot repair " + F.item(item.getItemMeta().getDisplayName()) + ".")); + return; + } + + String creator = ItemStackFactory.Instance.GetLoreVar(item, "Owner"); + + if (creator != null) + { + if (creator.length() > 2) + creator = creator.substring(2, creator.length()); + + if (!creator.equals(player.getName())) + { + UtilPlayer.message(player, F.main("Repair", "You cannot repair " + F.item(item.getItemMeta().getDisplayName()) + " by " + F.name(creator) + ".")); + return; + } + } + + //Repair! + UtilPlayer.message(player, F.main("Repair", "You repaired " + F.item(item.getItemMeta().getDisplayName()) + ".")); + item.setDurability((short)0); + UtilInv.Update(player); + + //Break + if (Math.random() > 0.85) + event.getClickedBlock().setData((byte) (event.getClickedBlock().getData() + 4)); + + if (event.getClickedBlock().getData() >= 12) + { + player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, 145); + event.getClickedBlock().setTypeIdAndData(0, (byte)0, true); + } + + //Record + int repairs = 1 + ItemStackFactory.Instance.GetLoreVar(item, "Repaired", 0); + + ItemStackFactory.Instance.SetLoreVar(item, "Repaired", "" + repairs); + + //Effect + player.playSound(player.getLocation(), Sound.ANVIL_USE, 1f, 1f); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Recipes.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Recipes.java new file mode 100644 index 000000000..ba5f188ca --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Recipes.java @@ -0,0 +1,250 @@ +package nautilus.game.pvp.modules; + +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Module.AModule; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.inventory.PrepareItemCraftEvent; +import org.bukkit.inventory.CraftingInventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.ShapedRecipe; +import org.bukkit.plugin.java.JavaPlugin; + +public class Recipes extends AModule +{ + public Recipes(JavaPlugin plugin) + { + super("Recipes", plugin); + } + + @EventHandler(priority = EventPriority.HIGH) + public void ReplaceDoor(PrepareItemCraftEvent event) + { + if (event.getRecipe().getResult() == null) + return; + + Material type = event.getRecipe().getResult().getType(); + + if (type != Material.WOOD_DOOR && type != Material.WOODEN_DOOR) + return; + + if (!(event.getInventory() instanceof CraftingInventory)) + return; + + CraftingInventory inv = (CraftingInventory)event.getInventory(); + + //Feedback + ItemStack result = ItemStackFactory.Instance.CreateStack(Material.IRON_DOOR); + inv.setResult(result); + } + + @EventHandler(priority = EventPriority.HIGH) + public void DenySword(PrepareItemCraftEvent event) + { + if (event.getRecipe().getResult() == null) + return; + + Material type = event.getRecipe().getResult().getType(); + + if (type != Material.DIAMOND_SWORD && type != Material.GOLD_SWORD && + type != Material.DIAMOND_AXE && type != Material.GOLD_AXE) + return; + + if (!(event.getInventory() instanceof CraftingInventory)) + return; + + CraftingInventory inv = (CraftingInventory)event.getInventory(); + + for (ItemStack cur : inv.getMatrix()) + if (cur != null) + if (cur.getType() == Material.GOLD_BLOCK || cur.getType() == Material.DIAMOND_BLOCK) + return; + + String name = ItemStackFactory.Instance.GetName(event.getRecipe().getResult(), true); + String matName = "Gold"; + if (type == Material.DIAMOND_AXE || type == Material.DIAMOND_SWORD) + matName = "Diamond"; + + //Feedback + ItemStack result = ItemStackFactory.Instance.CreateStack(36, (byte)0, 1, "§r" + C.cGray + "Recipe changed for " + F.item(name) + ".", + new String[] {C.cGray + "Use " + F.item(matName + " Blocks") + " instead of " + F.item(matName + " Ingots") + "."}); + + inv.setResult(result); + } + + @EventHandler(priority = EventPriority.HIGH) + public void DenyGeneral(PrepareItemCraftEvent event) + { + if (event.getRecipe().getResult() == null) + return; + + Material type = event.getRecipe().getResult().getType(); + + if ( + type != Material.GOLDEN_APPLE && + type != Material.GOLDEN_CARROT && + type != Material.ENDER_CHEST && + type != Material.ENCHANTMENT_TABLE && + type != Material.BREWING_STAND && + type != Material.TNT) + return; + + if (!(event.getInventory() instanceof CraftingInventory)) + return; + + CraftingInventory inv = (CraftingInventory)event.getInventory(); + + String name = ItemStackFactory.Instance.GetName(event.getRecipe().getResult(), true); + + //Feedback + ItemStack result = ItemStackFactory.Instance.CreateStack(36, (byte)0, 1, + "§r" + C.cGray + "Crafting of " + F.item(name) + " is disabled.", new String[] {}); + + inv.setResult(result); + } + + @Override + public void enable() + { + + ShapedRecipe goldAxe = new ShapedRecipe(new ItemStack(Material.GOLD_AXE, 1)); + goldAxe.shape("#MM","#SM","#S#"); + goldAxe.setIngredient('M', Material.GOLD_BLOCK); + goldAxe.setIngredient('S', Material.STICK); + UtilServer.getServer().addRecipe(goldAxe); + + ShapedRecipe diamondAxe = new ShapedRecipe(new ItemStack(Material.DIAMOND_AXE, 1)); + diamondAxe.shape("#MM","#SM","#S#"); + diamondAxe.setIngredient('M', Material.DIAMOND_BLOCK); + diamondAxe.setIngredient('S', Material.STICK); + UtilServer.getServer().addRecipe(diamondAxe); + + ShapedRecipe goldSword = new ShapedRecipe(new ItemStack(Material.GOLD_SWORD, 1)); + goldSword.shape("M","M","S"); + goldSword.setIngredient('M', Material.GOLD_BLOCK); + goldSword.setIngredient('S', Material.STICK); + UtilServer.getServer().addRecipe(goldSword); + + ShapedRecipe diamondSword = new ShapedRecipe(new ItemStack(Material.DIAMOND_SWORD, 1)); + diamondSword.shape("M","M","S"); + diamondSword.setIngredient('M', Material.DIAMOND_BLOCK); + diamondSword.setIngredient('S', Material.STICK); + UtilServer.getServer().addRecipe(diamondSword); + + //Iron Door + ShapedRecipe ironDoor = new ShapedRecipe(new ItemStack(Material.IRON_DOOR, 1)); + ironDoor.shape("I","I"); + ironDoor.setIngredient('I', Material.IRON_INGOT); + UtilServer.getServer().addRecipe(ironDoor); + + //Chain Helm + ShapedRecipe chainHelm = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_HELMET, 1)); + + chainHelm.shape("SIS","I#I"); + + chainHelm.setIngredient('I', Material.IRON_INGOT); + chainHelm.setIngredient('S', Material.GOLD_INGOT); + + UtilServer.getServer().addRecipe(chainHelm); + + //Chain Chest + ShapedRecipe chainChest = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_CHESTPLATE, 1)); + + chainChest.shape("I#I","SIS","ISI"); + + chainChest.setIngredient('I', Material.IRON_INGOT); + chainChest.setIngredient('S', Material.GOLD_INGOT); + + UtilServer.getServer().addRecipe(chainChest); + + //Chain Legs + ShapedRecipe chainLegs = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_LEGGINGS, 1)); + + chainLegs.shape("ISI","S#S","I#I"); + + chainLegs.setIngredient('I', Material.IRON_INGOT); + chainLegs.setIngredient('S', Material.GOLD_INGOT); + + UtilServer.getServer().addRecipe(chainLegs); + + //Chain Boots + ShapedRecipe chainBoots = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_BOOTS, 1)); + + chainBoots.shape("S#S","I#I"); + + chainBoots.setIngredient('I', Material.IRON_INGOT); + chainBoots.setIngredient('S', Material.GOLD_INGOT); + + UtilServer.getServer().addRecipe(chainBoots); + + //Chain Helm + ShapedRecipe chainHelm2 = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_HELMET, 1)); + + chainHelm2.shape("SIS","I#I"); + + chainHelm2.setIngredient('I', Material.GOLD_INGOT); + chainHelm2.setIngredient('S', Material.IRON_INGOT); + + UtilServer.getServer().addRecipe(chainHelm2); + + //Chain Chest + ShapedRecipe chainChest2 = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_CHESTPLATE, 1)); + + chainChest2.shape("I#I","SIS","ISI"); + + chainChest2.setIngredient('I', Material.GOLD_INGOT); + chainChest2.setIngredient('S', Material.IRON_INGOT); + + UtilServer.getServer().addRecipe(chainChest2); + + //Chain Legs + ShapedRecipe chainLegs2 = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_LEGGINGS, 1)); + + chainLegs2.shape("ISI","S#S","I#I"); + + chainLegs2.setIngredient('I', Material.GOLD_INGOT); + chainLegs2.setIngredient('S', Material.IRON_INGOT); + + UtilServer.getServer().addRecipe(chainLegs2); + + //Chain Boots + ShapedRecipe chainBoots2 = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_BOOTS, 1)); + + chainBoots2.shape("S#S","I#I"); + + chainBoots2.setIngredient('I', Material.GOLD_INGOT); + chainBoots2.setIngredient('S', Material.IRON_INGOT); + + UtilServer.getServer().addRecipe(chainBoots2); + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/ShopManager.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/ShopManager.java new file mode 100644 index 000000000..b7498da74 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/ShopManager.java @@ -0,0 +1,127 @@ +package nautilus.game.pvp.modules; + +import me.chiss.Core.Module.AModule; +import me.chiss.Core.Plugin.IPlugin; +import me.chiss.Core.PvpShop.PvpShopFactory; +import me.chiss.Core.Shop.PvpBuildShop; +import me.chiss.Core.Shop.PvpDonatorShop; +import me.chiss.Core.Shop.PvpItemShop; +import mineplex.core.CurrencyType; +import mineplex.core.server.RemoteRepository; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; +import nautilus.game.pvp.modules.Benefit.BenefitManager; +import nautilus.game.pvp.modules.Benefit.BenefitShop; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class ShopManager extends AModule +{ + private PvpDonatorShop _donatorShop; + private PvpBuildShop _buildShop; + private PvpItemShop _combatShop; + private PvpItemShop _blockShop; + private PvpItemShop _itemShop; + + public ShopManager(JavaPlugin plugin, RemoteRepository _repository, BenefitManager benefitManager) + { + super("Shop Manager", plugin); + + _donatorShop = new PvpDonatorShop((IPlugin)plugin, _repository, Clients(), Classes(), Skills()); + _buildShop = new PvpBuildShop((IPlugin)plugin, _repository, Clients(), Classes(), Skills()); + + _combatShop = new PvpItemShop((IPlugin)plugin, _repository, Clients(), new PvpShopFactory(plugin, _repository, "pvp_shop_combat.dat"), "§4Blacksmith"); + _blockShop = new PvpItemShop((IPlugin)plugin, _repository, Clients(), new PvpShopFactory(plugin, _repository, "pvp_shop_block.dat"), "§4Miner"); + _itemShop = new PvpItemShop((IPlugin)plugin, _repository, Clients(), new PvpShopFactory(plugin, _repository, "pvp_shop_item.dat"), "§4Merchant"); + new BenefitShop(benefitManager, "§4Benefactor", CurrencyType.Gems); + } + + @Override + public void enable() + { + + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("bank"); + AddCommand("coins"); + AddCommand("balance"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (cmd.equals("bank") || cmd.equals("coins") || cmd.equals("balance")) + { + UtilPlayer.message(caller, F.main("Economy", "You have " + F.elem(Clients().Get(caller).Game().GetEconomyBalance() + " Coins") + ".")); + return; + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onPlayerInteract(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!Util().Event().isAction(event, ActionType.R_BLOCK)) + return; + + if (_donatorShop.ShouldOpenShop(event.getClickedBlock())) + { + _donatorShop.OpenShopForPlayer(player); + event.setCancelled(true); + } + + if (Clans().CUtil().isSafe(event.getPlayer())) + { + if (_itemShop.ShouldOpenShop(event.getClickedBlock())) + { + _itemShop.OpenShopForPlayer(player); + event.setCancelled(true); + } + + if (_combatShop.ShouldOpenShop(event.getClickedBlock())) + { + _combatShop.OpenShopForPlayer(player); + event.setCancelled(true); + } + + if (_blockShop.ShouldOpenShop(event.getClickedBlock())) + { + _blockShop.OpenShopForPlayer(player); + event.setCancelled(true); + } + } + + if (_buildShop.ShouldOpenShop(event.getClickedBlock())) + { + if (Clients().Get(player).Class().GetGameClass() == null) + { + UtilPlayer.message(player, F.main("Class Setup", "You do not have a Class.")); + return; + } + + _buildShop.OpenShopForPlayer(player); + event.setCancelled(true); + } + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/SoundTest.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/SoundTest.java new file mode 100644 index 000000000..3c250c37f --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/SoundTest.java @@ -0,0 +1,165 @@ +package nautilus.game.pvp.modules; + +import java.util.WeakHashMap; + +import me.chiss.Core.Module.AModule; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilEvent.ActionType; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class SoundTest extends AModule +{ + public boolean _enabled = false; + + public WeakHashMap _sound = new WeakHashMap(); + public WeakHashMap _index = new WeakHashMap(); + public WeakHashMap _volume = new WeakHashMap(); + public WeakHashMap _pitch = new WeakHashMap(); + + public SoundTest(JavaPlugin plugin) + { + super("Sound Test", plugin); + } + + //Module Functions + @Override + public void enable() + { + + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + public void populate(Player player) + { + if (!_sound.containsKey(player)) _sound.put(player, Sound.AMBIENCE_CAVE); + if (!_index.containsKey(player)) _index.put(player, 0); + if (!_volume.containsKey(player)) _volume.put(player, 1f); + if (!_pitch.containsKey(player)) _pitch.put(player, 1f); + } + + public void playSound(Player player) + { + if (!_enabled) + return; + + populate(player); + + player.sendMessage("[" + F.elem(_index.get(player)+"/"+Sound.values().length) + "] " + F.item(_sound.get(player)+"") + " [Volume " + F.count(""+_volume.get(player)) + "] [Pitch " + F.count(""+_pitch.get(player)) + "]"); + + player.getWorld().playSound(player.getLocation(), _sound.get(player), _volume.get(player), _pitch.get(player)); + } + + @EventHandler + public void doSound(PlayerInteractEvent event) + { + if (event.getPlayer().getItemInHand().getType() != Material.STICK) + return; + + populate(event.getPlayer()); + + if (Util().Event().isAction(event, ActionType.L)) + { + _index.put(event.getPlayer(), _index.get(event.getPlayer()) - 1); + + if (_index.get(event.getPlayer()) < 0) + _index.put(event.getPlayer(), Sound.values().length); + } + + if (Util().Event().isAction(event, ActionType.R)) + { + _index.put(event.getPlayer(), _index.get(event.getPlayer()) + 1); + + if (_index.get(event.getPlayer()) >= Sound.values().length) + _index.put(event.getPlayer(), 0); + } + + int count = 0; + for (Sound cur : Sound.values()) + { + if (count == _index.get(event.getPlayer())) + { + _sound.put(event.getPlayer(), cur); + break; + } + + count++; + } + + playSound(event.getPlayer()); + } + + @EventHandler + public void doFloatA(PlayerInteractEvent event) + { + if (event.getPlayer().getItemInHand().getType() != Material.FLINT) + return; + + populate(event.getPlayer()); + + if (Util().Event().isAction(event, ActionType.L)) + _volume.put(event.getPlayer(), _volume.get(event.getPlayer()) - 0.1f); + + if (Util().Event().isAction(event, ActionType.R)) + _volume.put(event.getPlayer(), _volume.get(event.getPlayer()) + 0.1f); + + if (_volume.get(event.getPlayer()) < 0) + _volume.put(event.getPlayer(), 0f); + + if (_volume.get(event.getPlayer()) > 2) + _volume.put(event.getPlayer(), 2f); + + playSound(event.getPlayer()); + } + + @EventHandler + public void doFloatB(PlayerInteractEvent event) + { + if (event.getPlayer().getItemInHand().getType() != Material.COAL) + return; + + populate(event.getPlayer()); + + if (Util().Event().isAction(event, ActionType.L)) + _pitch.put(event.getPlayer(), _pitch.get(event.getPlayer()) - 0.1f); + + if (Util().Event().isAction(event, ActionType.R)) + _pitch.put(event.getPlayer(), _pitch.get(event.getPlayer()) + 0.1f); + + if (_pitch.get(event.getPlayer()) < 0) + _pitch.put(event.getPlayer(), 0f); + + if (_pitch.get(event.getPlayer()) > 2) + _pitch.put(event.getPlayer(), 2f); + + playSound(event.getPlayer()); + } + + @Override + public void commands() { + AddCommand("soundtest"); + } + + @Override + public void command(Player caller, String cmd, String[] args) { + _enabled = !_enabled; + UtilServer.broadcast("Sound Test: " + _enabled); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/TreeRemover.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/TreeRemover.java new file mode 100644 index 000000000..3869d1b4c --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/TreeRemover.java @@ -0,0 +1,190 @@ +package nautilus.game.pvp.modules; + +import java.util.List; + +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.NautHashMap; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.TreeType; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class TreeRemover implements Runnable, Listener +{ + private JavaPlugin _plugin; + private World _world; + private boolean _stopDecay; + private int _taskId; + private int _x = -600; + private int _z = -600; + + public boolean _clearedLogs = false; + + public NautHashMap>> _tempLeafMap = new NautHashMap>>(); + + public TreeRemover(JavaPlugin plugin) + { + _plugin = plugin; + _world = Bukkit.getWorlds().get(0); + + _plugin.getServer().getPluginManager().registerEvents(this, _plugin); + } + + public void run() + { + if (!_clearedLogs) + { + _clearedLogs = ClearArea(); + + if (_clearedLogs) + { + _x = -600; + _z = -600; + _stopDecay = false; + } + } + else if (PlaceNewTrees()) + { + List entities = _world.getEntities(); + + for (Entity entity : entities) + { + if (entity instanceof Item) + { + entity.remove(); + } + } + + _plugin.getServer().getScheduler().cancelTask(_taskId); + } + } + + private boolean ClearArea() + { + for (; _x <= 600;) + { + for (; _z <= 600;) + { + if (!_world.isChunkLoaded(_x >> 4, _z >> 4)) + _world.loadChunk(_x >> 4, _z >> 4); + + for (int y = 50; y <= 100; y++) + { + Block block = _world.getBlockAt(_x, y, _z); + + if (block.getType() == Material.LOG || block.getType() == Material.LEAVES) + { + MapUtil.QuickChangeBlockAt(_world, _x, y, _z, Material.AIR); + } + } + + _z++; + + if (_z % (GetHeaviness() * 10) == 0) + return false; + } + + _z = -600; + _x++; + + if (_x % 60 == 0) + System.out.println("Removing trees progress : " + (((_x / 60) + 10) * 5) + "% done."); + } + + if (_x >= 600) + { + return true; + } + + return false; + } + + private boolean PlaceNewTrees() + { + for (; _x <= 600;) + { + for (; _z <= 600;) + { + if (!_world.isChunkLoaded(_x >> 4, _z >> 4)) + _world.loadChunk(_x >> 4, _z >> 4); + + Block previousBlock = null; + + for (int y = 100; y >= 50; y--) + { + Block block = _world.getBlockAt(_x, y, _z); + + if (block.getType().isSolid() && previousBlock != null && previousBlock.getType().isTransparent()) + { + if (_x % GetHeaviness() == 0 && _z % GetHeaviness() == 0 && Math.random() > .4) + { + _world.generateTree(previousBlock.getLocation().add((Math.random() >= .5 ? -1 : 1) * Math.random() * 5, 0.0, (Math.random() >= .5 ? -1 : 1) * Math.random() * 5), Math.random() > .25 ? TreeType.TREE : TreeType.BIG_TREE); + break; + } + } + + if (block.isLiquid()) + break; + + previousBlock = block; + } + + _z++; + + if (_z % (GetHeaviness() * 10) == 0) + return false; + } + + _z = -600; + _x++; + + if (_x % 60 == 0) + System.out.println("Placing trees progress : " + (((_x / 60) + 10) * 5) + "% done."); + } + + if (_x >= 600) + { + return true; + } + + return false; + } + + @EventHandler + public void OnPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().equals("/removetrees") && event.getPlayer().isOp()) + { + _plugin.getServer().getScheduler().cancelTask(_taskId); + _taskId = _plugin.getServer().getScheduler().scheduleSyncRepeatingTask(_plugin, this, 0L, 1L); + _stopDecay = true; + } + else if (event.getMessage().equals("/placetrees") && event.getPlayer().isOp()) + { + _plugin.getServer().getScheduler().cancelTask(_taskId); + _taskId = _plugin.getServer().getScheduler().scheduleSyncRepeatingTask(_plugin, this, 0L, 1L); + _clearedLogs = true; + } + } + + @EventHandler + public void LeavesDecay(LeavesDecayEvent event) + { + if (_stopDecay) + event.setCancelled(true); + } + + private int GetHeaviness() + { + return (_x >= -400 && _z >= -400 && _x <= 400 && _z <= 400) ? 10 : 14; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/WorldBorder.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/WorldBorder.java new file mode 100644 index 000000000..b15e04d71 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/WorldBorder.java @@ -0,0 +1,123 @@ +package nautilus.game.pvp.modules; + +import java.util.HashSet; + +import mineplex.core.Rank; +import me.chiss.Core.Module.AModule; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilServer; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.World.Environment; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.plugin.java.JavaPlugin; + +public class WorldBorder extends AModule +{ + private int _edgeWorld = 600; + private HashSet _ignore; + + public WorldBorder(JavaPlugin plugin) + { + super("World Border", plugin); + } + + @Override + public void enable() + { + _ignore = new HashSet(); + _ignore.add(Material.LOG); + } + + @Override + public void disable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("edgemark"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) + return; + + if (cmd.equals("edgemark")) + { + caller.sendMessage("Marking Edges..."); + + for (int x=-_edgeWorld ; x<=_edgeWorld ; x++) + for (int z=-_edgeWorld ; z<=_edgeWorld ; z++) + { + if (Math.abs(x) != _edgeWorld && Math.abs(z) != _edgeWorld) + continue; + + Block block = UtilBlock.getHighest(caller.getWorld(), x, z, _ignore); + int yMax = block.getY(); + + for (int y=yMax ; y>=0 ; y--) + block.setType(Material.BEDROCK); + } + + caller.sendMessage("Marked Edges."); + } + } + + @EventHandler + public void UpdateEvent(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : UtilServer.getPlayers()) + { + if (cur.getWorld().getEnvironment() != Environment.NORMAL) + continue; + + double offset = 0; + + //X+ + if (cur.getLocation().getX() > _edgeWorld) + if (Math.abs(cur.getLocation().getX() - _edgeWorld) > offset) + offset = Math.abs(cur.getLocation().getX() - _edgeWorld); + + //X- + if (cur.getLocation().getX() < -_edgeWorld) + if (Math.abs(cur.getLocation().getX() + _edgeWorld) > offset) + offset = Math.abs(cur.getLocation().getX() + _edgeWorld); + + //Z+ + if (cur.getLocation().getZ() > _edgeWorld) + if (Math.abs(cur.getLocation().getZ() - _edgeWorld) > offset) + offset = Math.abs(cur.getLocation().getZ() - _edgeWorld); + + //Z- + if (cur.getLocation().getZ() < -_edgeWorld) + if (Math.abs(cur.getLocation().getZ() + _edgeWorld) > offset) + offset = Math.abs(cur.getLocation().getZ() + _edgeWorld); + + if (offset == 0) + continue; + + Damage().NewDamageEvent(cur, null, null, DamageCause.VOID, 1 + offset/3 , false, true, false, "Worlds Edge", null); + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, 7); + } + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClanRepository.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClanRepository.java new file mode 100644 index 000000000..b555e1157 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClanRepository.java @@ -0,0 +1,70 @@ +package nautilus.game.pvp.modules.clans; + +import java.util.ArrayList; +import java.util.List; + +import mineplex.core.common.util.UtilWorld; +import mineplex.core.server.remotecall.AsyncJsonWebCall; +import mineplex.core.server.remotecall.JsonWebCall; +import nautilus.game.pvp.modules.clans.Tokens.ClanGeneratorToken; +import nautilus.game.pvp.modules.clans.Tokens.ClanToken; + +import org.bukkit.Location; +import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; + +public class ClanRepository +{ + private String _webServerAddress; + + public ClanRepository(String webServerAddress) + { + _webServerAddress = webServerAddress; + } + + public List GetClans(String serverName) + { + return new JsonWebCall(_webServerAddress + "Clan/GetClans").Execute(new TypeToken>(){}.getType(), serverName); + } + + public void AddClan(ClanToken clan) + { + new AsyncJsonWebCall(_webServerAddress + "Clan/AddClan").Execute(clan); + } + + public void EditClan(ClanToken clan) + { + new AsyncJsonWebCall(_webServerAddress + "Clan/EditClan").Execute(clan); + } + + public void DeleteClan(ClanToken clan) + { + new AsyncJsonWebCall(_webServerAddress + "Clan/DeleteClan").Execute(clan); + } + + public void UpdateClanTNTGenerators(List genUpdateList) + { + List tokenList = new ArrayList(genUpdateList.size()); + + for (ClansClan clan : genUpdateList) + { + ClanGeneratorToken token = new ClanGeneratorToken(); + token.Name = clan.GetName(); + token.Location = UtilWorld.locToStr(clan.GetGeneratorBlock()); + token.Stock = clan.GetGeneratorStock(); + token.Time = clan.GetGeneratorTime(); + } + + new AsyncJsonWebCall(_webServerAddress + "Clan/UpdateClanTNTGenerators").Execute(tokenList); + } + + public void UpdateClanTNTGenerator(String name, Location generatorBlock, int generatorStock, long generatorTime) + { + ClanGeneratorToken token = new ClanGeneratorToken(); + token.Name = name; + token.Location = UtilWorld.locToStr(generatorBlock); + token.Stock = generatorStock; + token.Time = generatorTime; + + new AsyncJsonWebCall(_webServerAddress + "Clan/UpdateClanTNTGenerator").Execute(token); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Clans.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Clans.java new file mode 100644 index 000000000..71cf94390 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Clans.java @@ -0,0 +1,793 @@ +package nautilus.game.pvp.modules.clans; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; + + +import nautilus.game.pvp.modules.clans.ClansUtility.ClanRelation; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockIgniteEvent; +import org.bukkit.event.block.BlockPistonExtendEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import me.chiss.Core.Combat.Event.CombatDeathEvent; +import mineplex.minecraft.game.core.classcombat.SkillTriggerEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import me.chiss.Core.Module.AModule; +import me.chiss.Core.Plugin.IChat; +import me.chiss.Core.Plugin.IRelation; +import mineplex.core.packethandler.INameColorer; +import mineplex.core.server.IRepository; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.creature.event.CreatureSpawnCustomEvent; +import mineplex.minecraft.punish.PunishChatEvent; + +public class Clans extends AModule implements IRelation, IChat, INameColorer +{ + private int _dominanceLimit = 16; + private int _inviteExpire = 2; + private int _nameMin = 3; + private int _nameMax = 10; + private long _powerTime = 300000; + private long _reclaimTime = 1800000; + private long _onlineTime = 1200000; + + private long _generatorTime = 21600000; //6 Hours + + private long _outpostTime = 7200000; //2 Hours + + private List _genUpdateList = new ArrayList(); + + private boolean _powerEnabled = false; + + //Clans + private HashMap _clanMap = new HashMap(); + private HashMap _clanMemberMap = new HashMap(); + private HashMap _claimMap = new HashMap(); + private HashMap _unclaimMap = new HashMap(); + + private HashMap _clanOutpostMap = new HashMap(); + + //Clans Modules + private ClansAdmin _clansAdmin; + private ClansBlocks _clansBlocks; + private ClansCommand _clansCommand; + private ClansDisplay _clansDisplay; + private ClansGame _clansGame; + private ClansRepo _clansRepo; + private ClansTask _clansTask; + private ClansUtility _clansUtility; + + //Repo + private IRepository _repository; + + private String _serverName; + + public Clans(JavaPlugin plugin, IRepository repository, String serverName) + { + super("Clans", plugin); + + _serverName = serverName; + + SetRepository(repository); + + CRepo().loadClans(); + } + + //Module Functions + @Override + public void config() + { + _dominanceLimit = Config().getInt(_moduleName, "Dominance Limit", _dominanceLimit); + _inviteExpire = Config().getInt(_moduleName, "Invitation Expire (Minutes)", _inviteExpire); + _nameMin = Config().getInt(_moduleName, "Name Minimum Length", _nameMin); + _nameMax = Config().getInt(_moduleName, "Name Maximum Length", _nameMax); + _powerTime = Config().getLong(_moduleName, "Power Regeneration Time", _powerTime); + _reclaimTime = Config().getLong(_moduleName, "Territory Reclaim Time", _reclaimTime); + _powerEnabled = Config().getBool(_moduleName, "Power Enabled", _powerEnabled); + } + + @Override + public void enable() + { + + } + + @Override + public void disable() + { + //runs in parallel, nothing to do here. + } + + @Override + public void commands() + { + AddCommand("c"); + AddCommand("clans"); + AddCommand("f"); + AddCommand("factions"); + + AddCommand("cc"); + AddCommand("fc"); + AddCommand("ac"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (cmd.equals("cc") || cmd.equals("fc")) + CCommand().commandChat(caller, args); + + else if (cmd.equals("ac")) + CCommand().commandAllyChat(caller, args); + + else + CCommand().command(caller, args); + } + + public ClansClan getClan(String name) + { + return GetClanMap().get(name); + } + + public void EndWar(final ClansClan cA, final ClansClan cB) + { + final ClansWar war = cA.GetEnemyOut().get(cB.GetName()); + if (war == null) return; + + //Recharge + cA.GetEnemyRecharge().put(cB.GetName(), System.currentTimeMillis() + 172800000); + cB.GetEnemyRecharge().put(cA.GetName(), System.currentTimeMillis() + 172800000); + + //Neutral + CTask().neutral(cA, cB, "War End", true); + + //Pillage Relation + CTask().pillage(cA, cB, true); + + //Delay + _plugin.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() + { + public void run() + { + //Broadcast + if (Math.abs(war.GetDominance()) == GetDominanceLimit()) + UtilServer.broadcastSpecial("Clans Invasion", F.name(cA.GetName()) + " conquered " + F.name(cB.GetName()) + + " in an invasion, taking " + + F.time(UtilTime.convertString(System.currentTimeMillis() - war.GetCreated(), 1, TimeUnit.FIT)) + + "." ); + } + }, 20); + + final long duration = (long) (1200000 * ((double)cB.GetMembers().size() / (double)cA.GetMembers().size())); + int durationTicks = (int) ((duration * 20) / 1000); + + //To Start + for (int i = 0 ; i<10 ; i++) + { + final int j = i; + + //Delay + _plugin.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() + { + public void run() + { + cA.inform("Pillage on " + F.name("Clan " + cB.GetName()) + " starts in " + F.time((10 - j) + " Minutes") + ".", null); + cB.inform("Pillage by " + F.name("Clan " + cA.GetName()) + " starts in " + F.time((10 - j) + " Minutes") + ".", null); + } + }, 60 + (1200 * i)); + } + + //Start + _plugin.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() + { + public void run() + { + cA.inform("Pillage on " + F.name("Clan " + cB.GetName()) + " has begun!", null); + cB.inform("Pillage by " + F.name("Clan " + cA.GetName()) + " has begun!", null); + cA.GetPillage().add(cB.GetName()); + } + }, 12000); + + //End + _plugin.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() + { + public void run() + { + cA.inform("Pillage on " + F.name("Clan " + cB.GetName()) + " has ended!", null); + cB.inform("Pillage by " + F.name("Clan " + cA.GetName()) + " has ended!", null); + cA.GetPillage().remove(cB.GetName()); + + CTask().pillage(cA, cB, false); + } + }, 12000 + durationTicks); + + //To End + int i = 0; + while (durationTicks > 1200) + { + //Increment + durationTicks -= 1200; + i++; + + //Final + final int count = i; + + //Delay + _plugin.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() + { + public void run() + { + //Inform A + cA.inform("Pillage on " + F.name("Clan " + cB.GetName()) + " ending in " + F.time(count + " Minutes") + ".", null); + cB.inform("Pillage by " + F.name("Clan " + cA.GetName()) + " ending in " + F.time(count + " Minutes") + ".", null); + } + }, 12000 + durationTicks); + } + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() == UpdateType.SEC) + Power(); + + if (event.getType() == UpdateType.FAST) + CGame().UpdateSafe(); + + if (event.getType() == UpdateType.FASTER) + CGame().UpdateDisplay(); + + if (event.getType() == UpdateType.SEC) + { + for (ClansClan clan : _clanMap.values()) + { + if (clan.GeneratorUpdate()) + _genUpdateList.add(clan); + + clan.OutpostUpdate(); + } + + if (_genUpdateList.size() > 0) + { + CRepo().Repository.UpdateClanTNTGenerators(_genUpdateList); + _genUpdateList.clear(); + } + } + + if (event.getType() == UpdateType.FAST) + for (ClansClan clan : _clanMap.values()) + if (clan.GetOutpost() != null) + clan.GetOutpost().BuildUpdate(); + } + + public long lastPower = System.currentTimeMillis(); + public void Power() + { + HashSet handledSet = new HashSet(); + + for (Player cur : UtilServer.getPlayers()) + { + ClansClan clan = CUtil().getClanByPlayer(cur); + + if (clan == null) + continue; + + if (clan.getPower() == clan.getPowerMax()) + { + clan.SetPowerTime(0); + continue; + } + + if (handledSet.contains(clan)) + continue; + + if (CUtil().isSafe(cur)) + continue; + + if (cur.isDead()) + continue; + + //Add Time + clan.SetPowerTime(clan.GetPowerTime() + (System.currentTimeMillis() - lastPower)); + + if (clan.GetPowerTime() > GetPowerTime()) + { + clan.SetPowerTime(0); + clan.modifyPower(1); + clan.inform("Clan regenerated 1 Power.", null); + } + + //Set Handled + handledSet.add(clan); + } + + lastPower = System.currentTimeMillis(); + } + + @EventHandler(priority = EventPriority.LOW) + public void BlockBurn(BlockBurnEvent event) + { + CGame().BlockBurn(event); + } + + @EventHandler(priority = EventPriority.LOW) + public void BlockIgnite(BlockIgniteEvent event) + { + CGame().BlockSpread(event); + } + + @EventHandler(priority = EventPriority.LOW) //AFTER Field + public void BlockBreak(BlockBreakEvent event) + { + if (event.isCancelled()) + return; + + CGame().BlockBreak(event); + + if (event.getBlock().getType() == Material.BREWING_STAND) + for (ClansClan clan : _clanMap.values()) + clan.GeneratorBreak(event.getBlock().getLocation()); + + if (event.getBlock().getType() == Material.BEACON) + for (ClansClan clan : _clanMap.values()) + clan.OutpostBreak(event.getBlock().getLocation()); + } + + @EventHandler(priority = EventPriority.LOW) + public void BlockPlace(BlockPlaceEvent event) + { + if (event.isCancelled()) + return; + + CGame().BlockPlace(event); + + //TNT Generator + if (event.getBlock().getType() == Material.BREWING_STAND) + { + ClansClan clan = CUtil().getClanByPlayer(event.getPlayer()); + if (clan != null) + { + if (!clan.GeneratorPlace(event.getPlayer(), event.getBlock().getLocation())) + event.setCancelled(true); + } + else + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You must place " + F.item("TNT Generator") + " in your Territory.")); + event.setCancelled(true); + } + } + + //Outpost + if (event.getBlock().getType() == Material.BEACON) + { + ClansClan clan = CUtil().getClanByPlayer(event.getPlayer()); + if (clan != null) + { + if (!clan.OutpostPlace(event.getPlayer(), event.getBlock().getLocation())) + event.setCancelled(true); + } + else + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You require a Clan to use " + F.item("Clan Outpost") + ".")); + event.setCancelled(true); + } + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void BlockCreatureSpawn(CreatureSpawnCustomEvent event) + { + ClansClan clan = Clans().CUtil().getOwner(event.GetLocation()); + + if (clan != null) + if (!clan.IsAdmin() && !clan.GetName().equals("Spawn")) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + CGame().Damage(event); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void Interact(PlayerInteractEvent event) + { + CGame().Interact(event); + CDisplay().handleInteract(event); + + if (Util().Event().isAction(event, ActionType.R_BLOCK)) + if (event.getClickedBlock().getType() == Material.BREWING_STAND && !event.isCancelled()) + { + for (ClansClan clan : _clanMap.values()) + clan.GeneratorUse(event.getPlayer(), event.getClickedBlock().getLocation()); + + event.setCancelled(true); + } + else if (event.getClickedBlock().getType() == Material.BEACON) + { + for (ClansClan clan : _clanMap.values()) + clan.OutpostUse(event.getPlayer(), event.getClickedBlock().getLocation()); + + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void Piston(BlockPistonExtendEvent event) + { + CGame().Piston(event); + } + + @EventHandler(priority = EventPriority.LOW) + public void SkillTrigger(SkillTriggerEvent event) + { + CGame().SafeSkill(event); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void Death(CombatDeathEvent event) + { + CGame().DeathDominance(event); + + CGame().DeathColor(event); + } + + @EventHandler + public void Join(PlayerJoinEvent event) + { + CGame().Join(event); + } + + @EventHandler + public void Quit(PlayerQuitEvent event) + { + CGame().Quit(event); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void Explosion(EntityExplodeEvent event) + { + CGame().Explode(event); + } + + public boolean HandleClanChat(AsyncPlayerChatEvent event, String filteredMessage) + { + CoreClient client = Clients().Get(event.getPlayer()); + + if (client == null) + return false; + + if (!client.Clan().IsClanChat()) + return false; + + ClansClan clan = CUtil().getClanByPlayer(event.getPlayer()); + if (clan == null) + { + Clients().Get(event.getPlayer()).Clan().SetClanChat(false); + return false; + } + + ChatClan(clan, event.getPlayer(), event.getMessage(), filteredMessage); + return true; + } + + public boolean HandleAllyChat(AsyncPlayerChatEvent event, String filteredMessage) + { + if (!Clients().Get(event.getPlayer()).Clan().IsAllyChat()) + return false; + + ClansClan clan = CUtil().getClanByPlayer(event.getPlayer()); + if (clan == null) + { + Clients().Get(event.getPlayer()).Clan().SetAllyChat(false); + return false; + } + + ChatAlly(clan, event.getPlayer(), event.getMessage(), filteredMessage); + return true; + } + + public void HandleChat(final AsyncPlayerChatEvent event, final String filteredMessage) + { + // Call it sync since we are using async and not just modifying the global message(per player tweaks) + event.getPlayer().getServer().getScheduler().scheduleSyncDelayedTask(Plugin(), new Runnable() + { + public void run() + { + if (HandleClanChat(event, filteredMessage)) + return; + + if (HandleAllyChat(event, filteredMessage)) + return; + + PunishChatEvent chatEvent = new PunishChatEvent(event.getPlayer()); + + Plugin().getServer().getPluginManager().callEvent(chatEvent); + + if (chatEvent.isCancelled()) + return; + + ChatGlobal(event.getPlayer(), event.getMessage(), filteredMessage); + } + }); + } + + public void ChatClan(ClansClan clan, Player sender, String message, String filteredMessage) + { + clan.chat(sender, message, filteredMessage); + } + + public void ChatAlly(ClansClan clan, Player sender, String message, String filteredMessage) + { + for (String cur : clan.GetAllyMap().keySet()) + { + ClansClan ally = CUtil().getClanByClanName(cur); + if (ally == null) continue; + + ally.allyChat(clan, sender, message, filteredMessage); + } + + clan.allyChat(clan, sender, message, filteredMessage); + } + + public void ChatGlobal(final Player sender, final String message, String filteredMessage) + { + for (Player cur : sender.getServer().getOnlinePlayers()) + { + String newMessage = message; + + //Get Client + CoreClient client = Clients().Get(sender.getName()); + + if (client.Game().GetFilterChat()) + { + newMessage = filteredMessage; + } + + //Prepend Name + newMessage = _clansUtility.mRel(client.Clan().GetRelation(cur.getName()), sender.getName(), false) + " " + newMessage; + + //Prepend Clan + if (Clients().Get(sender).Clan().InClan()) + newMessage = _clansUtility.mRel(client.Clan().GetRelation(cur.getName()), Clients().Get(sender).Clan().GetClanName(), true) + " " + newMessage; + + //Prepend NAC / Rank + StringBuilder builder = new StringBuilder(); + + String prefixChar = "*"; + + if (client.NAC().IsUsing()) + builder.append(ChatColor.GREEN + prefixChar); + else + builder.append(ChatColor.DARK_GRAY + prefixChar); + + if (client.Rank().Has(Rank.OWNER, false)) + builder.append(ChatColor.AQUA + prefixChar + ChatColor.WHITE); + else if (client.Rank().Has(Rank.MODERATOR, false)) + builder.append(ChatColor.AQUA + prefixChar + ChatColor.WHITE); + else if (client.Rank().Has(Rank.DIAMOND, false)) + builder.append(ChatColor.AQUA + prefixChar + ChatColor.WHITE); + else if (client.Rank().Has(Rank.EMERALD, false)) + builder.append(ChatColor.GREEN + prefixChar + ChatColor.WHITE); + else if (client.Donor().HasDonated()) + builder.append(ChatColor.YELLOW + prefixChar + ChatColor.WHITE); + else + builder.append(ChatColor.DARK_GRAY + prefixChar + ChatColor.WHITE); + + String icons = builder.toString(); + newMessage = icons + newMessage; + + UtilPlayer.message(cur, newMessage, true); + } + } + + public ClansAdmin CAdmin() + { + if (_clansAdmin == null) + _clansAdmin = new ClansAdmin(this); + + return _clansAdmin; + } + + public ClansBlocks CBlocks() + { + if (_clansBlocks == null) + _clansBlocks = new ClansBlocks(this); + + return _clansBlocks; + } + + public ClansCommand CCommand() + { + if (_clansCommand == null) + _clansCommand = new ClansCommand(this); + + return _clansCommand; + } + + public ClansDisplay CDisplay() + { + if (_clansDisplay == null) + _clansDisplay = new ClansDisplay(this); + + return _clansDisplay; + } + + public ClansGame CGame() + { + if (_clansGame == null) + _clansGame = new ClansGame(this); + + return _clansGame; + } + + public ClansRepo CRepo() + { + if (_clansRepo == null) + _clansRepo = new ClansRepo(this); + + return _clansRepo; + } + + public ClansTask CTask() + { + if (_clansTask == null) + _clansTask = new ClansTask(this); + + return _clansTask; + } + + public ClansUtility CUtil() + { + if (_clansUtility == null) + _clansUtility = new ClansUtility(this); + + return _clansUtility; + } + + public int GetDominanceLimit() { + return _dominanceLimit; + } + + public int GetInviteExpire() { + return _inviteExpire; + } + + public int GetNameMin() { + return _nameMin; + } + + public int GetNameMax() { + return _nameMax; + } + + public long GetPowerTime() { + return _powerTime; + } + + public long GetReclaimTime() { + return _reclaimTime; + } + + public long GetGeneratorTime() { + return _generatorTime; + } + + public long GetOutpostTime() { + return _outpostTime; + } + + public long GetOnlineTime() { + return _onlineTime; + } + + public boolean IsPowerEnabled() { + return _powerEnabled; + } + + public void SetPowerEnabled(boolean _powerEnabled) { + this._powerEnabled = _powerEnabled; + } + + public HashMap GetClanMap() { + return _clanMap; + } + + public HashMap GetOutpostMap() + { + return _clanOutpostMap; + } + + public HashMap GetClaimMap() + { + return _claimMap; + } + + public HashMap GetUnclaimMap() + { + return _unclaimMap; + } + + + @Override + public boolean CanHurt(Player a, Player b) + { + if (a.equals(b)) + return false; + + return CUtil().canHurt(a, b); + } + + @Override + public boolean CanHurt(String a, String b) + { + if (a.equals(b)) + return false; + + return CUtil().canHurt(UtilPlayer.searchExact(a), UtilPlayer.searchExact(b)); + } + + @Override + public boolean IsSafe(Player a) + { + return CUtil().isSafe(a); + } + + public IRepository GetRepository() { + return _repository; + } + + public void SetRepository(IRepository _repository) { + this._repository = _repository; + } + + public HashMap GetClanMemberMap() + { + return _clanMemberMap; + } + + public ClanRelation GetRelation(String playerA, String playerB) + { + return Clients().Get(playerA).Clan().GetRelation(playerB); + } + + @Override + public ChatColor GetColorOfFor(String other, Player player) + { + return CUtil().relChatColor(Clients().Get(player).Clan().GetRelation(other), false); + } + + public String GetServerName() + { + return _serverName; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansAdmin.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansAdmin.java new file mode 100644 index 000000000..7e0b2c0b5 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansAdmin.java @@ -0,0 +1,767 @@ +package nautilus.game.pvp.modules.clans; + +import java.util.ArrayList; + +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import nautilus.game.pvp.modules.clans.ClansClan.Role; + +import org.bukkit.entity.Player; + +public class ClansAdmin +{ + private Clans Clans; + + public ClansAdmin(Clans clans) + { + Clans = clans; + } + + public void command(Player caller, String[] args) + { + if (args.length == 1) + help(caller); + + else if (args[1].equalsIgnoreCase("help") || args[1].equalsIgnoreCase("h")) + help(caller); + + else if (!Clans.Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) + return; + + else if (args[1].equalsIgnoreCase("set") || args[1].equalsIgnoreCase("mimic")) + setMimic(caller, args); + + else if (args[1].equalsIgnoreCase("create")) + create(caller, args); + + else if (args[1].equalsIgnoreCase("disband") || args[1].equalsIgnoreCase("delete") || args[1].equalsIgnoreCase("d")) + delete(caller, args); + + else if (args[1].equalsIgnoreCase("invite") || args[1].equalsIgnoreCase("i")) + invite(caller, args); + + else if (args[1].equalsIgnoreCase("promote")) + promote(caller, args); + + else if (args[1].equalsIgnoreCase("demote")) + demote(caller, args); + + else if (args[1].equalsIgnoreCase("kick") || args[1].equalsIgnoreCase("k")) + kick(caller, args); + + else if (args[1].equalsIgnoreCase("ally") || args[1].equalsIgnoreCase("a")) + ally(caller, args); + + else if (args[1].equalsIgnoreCase("trust")) + trust(caller, args); + + else if (args[0].equalsIgnoreCase("neutral") || args[0].equalsIgnoreCase("neut") || args[0].equalsIgnoreCase("n")) + neutral(caller, args); + + else if (args[0].equalsIgnoreCase("enemy") || args[0].equalsIgnoreCase("e") || args[0].equalsIgnoreCase("war") || args[0].equalsIgnoreCase("w")) + enemy(caller, args); + + else if (args[1].equalsIgnoreCase("claim") || args[1].equalsIgnoreCase("c")) + claim(caller); + + else if (args[1].equalsIgnoreCase("unclaim") || args[1].equalsIgnoreCase("uc")) + unclaim(caller, args); + + else if (args[1].equalsIgnoreCase("home") || args[1].equalsIgnoreCase("h")) + home(caller, args); + + else if (args[1].equalsIgnoreCase("safe")) + safe(caller); + + else if (args[1].equalsIgnoreCase("autoclaim")) + autoclaim(caller); + + else + help(caller); + } + + private void help(Player caller) + { + UtilPlayer.message(caller, F.main("Clans Admin", "Admin Commands List;")); + + UtilPlayer.message(caller, F.help("/c x create ", "Create Admin Clan", Rank.ADMIN)); + + UtilPlayer.message(caller, F.help("/c x set ", "Set Mimic Clan", Rank.ALL)); + + UtilPlayer.message(caller, F.help("/c x home (set)", "Teleport to Mimic Home", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c x invite ", "Invite Player to Mimic", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c x promote ", "Promote Player in Mimic", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c x demote ", "Demote Player in Mimic", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c x kick ", "Kick Player from Mimic", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c x ally ", "Send Alliance to Mimic", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c x trust ", "Give Trust to Clan", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c x neutral ", "Set Neutrality", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c x enemy ", "Start Invasion", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c x claim", "Claim Territory for Mimic", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c x unclaim (all)", "Unclaim Territory for Mimic", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c x delete", "Delete Mimic Clan", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c x autoclaim", "AutoClaim for Mimic Clan", Rank.ADMIN)); + UtilPlayer.message(caller, F.main("Mimic Clan", Clans.Clients().Get(caller).Clan().GetMimic())); + } + + private void autoclaim(Player caller) + { + Clans.Clients().Get(caller).Clan().SetAutoClaim(!Clans.Clients().Get(caller).Clan().IsAutoClaim()); + + UtilPlayer.message(caller, F.main("Clans Admin", F.oo("Auto Claim", Clans.Clients().Get(caller).Clan().IsAutoClaim()))); + } + + public void setMimic(Player caller, String[] args) + { + if (args.length < 3) + { + if (Clans.Clients().Get(caller).Clan().GetMimic().length() > 0) + { + UtilPlayer.message(caller, F.main("Clans Admin", "You are no longer mimicing " + F.elem("Clan " + Clans.Clients().Get(caller).Clan().GetMimic()) + ".")); + Clans.Clients().Get(caller).Clan().SetMimic(""); + } + else + UtilPlayer.message(caller, F.main("Clans Admin", "You did not input a Clan/Player.")); + + return; + } + + ClansClan clan = Clans.CUtil().searchClanPlayer(caller, args[2], true); + + if (clan == null) + { + UtilPlayer.message(caller, F.main("Clans Admin", "Invalid Clan/Player.")); + return; + } + + //Set Mimic + Clans.Clients().Get(caller).Clan().SetMimic(clan.GetName()); + + //Inform + UtilPlayer.message(caller, F.main("Clans Admin", "You are mimicing " + F.elem("Clan " + clan.GetName()) + ".")); + } + + public ClansClan getMimic(Player caller, boolean inform) + { + String mimic = Clans.Clients().Get(caller).Clan().GetMimic(); + + if (mimic.length() == 0) + return null; + + ClansClan clan = Clans.CUtil().searchClanPlayer(caller, mimic, true); + + if (clan == null) + { + if (inform) + UtilPlayer.message(caller, F.main("Clans Admin", "You are not mimicing a Clan.")); + + return null; + } + + return clan; + } + + public void create(Player caller, String[] args) + { + if (args.length < 3) + { + UtilPlayer.message(caller, F.main("Clans Admin", "You did not input a Clan name.")); + return; + } + + if (!Clans.Util().Input().valid(args[2])) + { + UtilPlayer.message(caller, F.main("Clans Admin", "Invalid characters in Clan name.")); + return; + } + + if (args[2].length() < Clans.GetNameMin()) + { + UtilPlayer.message(caller, F.main("Clans Admin", "Clan name too short. Minimum length is " + (Clans.GetNameMin()) + ".")); + return; + } + + if (args[2].length() > Clans.GetNameMax()) + { + UtilPlayer.message(caller, F.main("Clans Admin", "Clan name too long. Maximum length is + " + (Clans.GetNameMax()) + ".")); + return; + } + + for (String cur : Clans.CCommand().denyClan) + { + if (cur.equalsIgnoreCase(args[2])) + { + UtilPlayer.message(caller, F.main("Clans Admin", "Clan name cannot be a Clan command.")); + return; + } + } + + for (String cur : Clans.Clients().GetAll()) + { + if (cur.equalsIgnoreCase(args[2])) + { + UtilPlayer.message(caller, F.main("Clans Admin", "Clan name cannot be a Player name.")); + return; + } + } + + if (Clans.getClan(args[2]) != null) + { + UtilPlayer.message(caller, F.main("Clans Admin", F.elem("Clan " + args[2]) + " already exists.")); + return; + } + + //Inform + UtilServer.broadcast(F.main("Clans Admin", caller.getName() + " formed " + F.elem("Admin Clan " + args[2]) + ".")); + + // Create and Join + Clans.CTask().create(caller.getName(), args[2], true); + + // Set Mimic + Clans.Clients().Get(caller).Clan().SetMimic(args[2]); + + // Inform + UtilPlayer.message(caller, F.main("Clans Admin", "You are mimicing Clan " + args[2] + ".")); + } + + public void delete(Player caller, String[] args) + { + ClansClan clan = getMimic(caller, true); + + if (clan == null) + return; + + //Task + Clans.CTask().delete(clan); + + //Inform + UtilServer.broadcast(F.main("Clans Admin", caller.getName() + " disbanded " + F.elem("Clan " + clan.GetName()) + ".")); + } + + public void invite(Player caller, String[] args) + { + ClansClan clan = getMimic(caller, true); + + if (clan == null) + return; + + if (args.length < 3) + { + UtilPlayer.message(caller, F.main("Clans Admin", "You did not input an invitee.")); + return; + } + + Player target = UtilPlayer.searchOnline(caller, args[2], true); + if (target == null) + return; + + if (target.getName().equals(caller.getName())) + { + UtilPlayer.message(caller, F.main("Clans Admin", "You cannot invite yourself.")); + return; + } + + //Inform + clan.inform(caller.getName() + " invited " + target.getName() + " to join Clan " + clan.GetName() + ".", caller.getName()); + UtilPlayer.message(caller, F.main("Clans Admin", "You invited " + target.getName() + " to join " + F.elem("Clan " + clan.GetName()) + ".")); + UtilPlayer.message(target, F.main("Clans Admin", caller.getName() + " invited you to join " + F.elem("Clan " + clan.GetName()) + ".")); + + //Task + Clans.CTask().invite(clan, target.getName(), caller.getName()); + } + + public void promote(Player caller, String[] args) + { + ClansClan clan = getMimic(caller, true); + + if (clan == null) + return; + + if (args.length < 3) + { + UtilPlayer.message(caller, F.main("Clans Admin", "You did not input player to promote.")); + return; + } + + String target = UtilPlayer.searchCollection(caller, args[2], clan.GetMembers().keySet(), "Clan Member", true); + + if (target == null) + return; + + if (clan.GetMembers().get(target) == Role.LEADER) + { + UtilPlayer.message(caller, F.main("Clans Admin", "You cannot promote " + F.name(target) + " any further.")); + return; + } + + //Task + String newRank = "?"; + if (clan.GetMembers().get(target) == Role.RECRUIT) + { + Clans.CTask().role(clan, target, Role.MEMBER); + newRank = "Member"; + } + else if (clan.GetMembers().get(target) == Role.MEMBER) + { + Clans.CTask().role(clan, target, Role.ADMIN); + newRank = "Admin"; + } + else if (clan.GetMembers().get(target) == Role.ADMIN) + { + Clans.CTask().role(clan, target, Role.LEADER); + newRank = "Leader"; + } + + //Inform + UtilPlayer.message(caller, F.main("Clans Admin", "You promoted " + target + " to " + newRank + " in Mimic Clan.")); + clan.inform(caller.getName() + " promoted " + target + " to " + newRank + ".", null); + } + + public void demote(Player caller, String[] args) + { + ClansClan clan = getMimic(caller, true); + + if (clan == null) + return; + + if (args.length < 3) + { + UtilPlayer.message(caller, F.main("Clans Admin", "You did not input player to demote.")); + return; + } + + String target = UtilPlayer.searchCollection(caller, args[2], clan.GetMembers().keySet(), "Clan Member", true); + if (target == null) + return; + + if (clan.GetMembers().get(target) == Role.RECRUIT) + { + UtilPlayer.message(caller, F.main("Clans Admin", "You cannot demote " + F.name(target) + " any further.")); + return; + } + + //Task + String newRank = "?"; + if (clan.GetMembers().get(target) == Role.MEMBER) + { + Clans.CTask().role(clan, target, Role.RECRUIT); + newRank = "Recruit"; + } + else if (clan.GetMembers().get(target) == Role.ADMIN) + { + Clans.CTask().role(clan, target, Role.MEMBER); + newRank = "Member"; + } + else if (clan.GetMembers().get(target) == Role.LEADER) + { + Clans.CTask().role(clan, target, Role.ADMIN); + newRank = "Admin"; + } + + //Inform + UtilPlayer.message(caller, F.main("Clans Admin", "You demoted " + target + " to " + newRank + " in Mimic Clan.")); + clan.inform(F.main("Clans Admin", caller.getName() + " demoted " + target + " to " + newRank + "."), null); + } + + public void kick(Player caller, String[] args) + { + ClansClan clan = getMimic(caller, true); + + if (clan == null) + return; + + if (args.length < 3) + { + UtilPlayer.message(caller, F.main("Clans Admin", "You did not input a Player to kick.")); + return; + } + + String targetName = UtilPlayer.searchCollection(caller, args[2], clan.GetMembers().keySet(), "Clan Member", true); + + if (targetName == null) + return; + + CoreClient target = Clans.Clients().Get(targetName); + + //Task + Clans.CTask().leave(clan, target.GetPlayerName()); + + //Inform + UtilPlayer.message(UtilPlayer.searchOnline(null, target.GetPlayerName(), false), F.main("Clans Admin", caller.getName() + " kicked you from " + F.elem("Clan " + clan.GetName()) + ".")); + UtilPlayer.message(caller, F.main("Clans Admin", "You kicked " + target.GetPlayerName() + " from your Clan.")); + clan.inform(F.main("Clans Admin", caller.getName() + " kicked " + target.GetPlayerName() + " from your Clan."), caller.getName()); + } + + public void ally(Player caller, String[] args) + { + ClansClan cA = getMimic(caller, true); + + if (cA == null) + return; + + if (args.length < 3) + { + UtilPlayer.message(caller, F.main("Clans Admin", "You did not input a Clan to ally.")); + return; + } + + ClansClan cB = Clans.CUtil().searchClanPlayer(caller, args[2], true); + + if (cB == null) + return; + + if (cA.isSelf(cB.GetName())) + { + UtilPlayer.message(caller, F.main("Clans Admin", "You cannot ally with yourself.")); + return; + } + + if (cA.isAlly(cB.GetName())) + { + UtilPlayer.message(caller, F.main("Clans Admin", "You are already allies with " + F.elem("Clan " + cB.GetName()) + ".")); + return; + } + + if (cB.isRequested(cA.GetName())) + { + //Task + Clans.CTask().ally(cA, cB, caller.getName()); + + //Inform + UtilPlayer.message(caller, F.main("Clans Admin", "You accepted alliance with Clan " + cB.GetName() + ".")); + cA.inform(caller.getName() + " accepted alliance with Clan " + cB.GetName() + ".", caller.getName()); + cB.inform("Clan " + cA.GetName() + " has accepted alliance with you.", null); + } + else + { + //Task + Clans.CTask().requestAlly(cA, cB, caller.getName()); + + //Inform + UtilPlayer.message(caller, F.main("Clans Admin", "You requested alliance with Clan " + cB.GetName() + ".")); + cA.inform(caller.getName() + " has requested alliance with Clan " + cB.GetName() + ".", caller.getName()); + cB.inform("Clan " + cA.GetName() + " has requested alliance with you.", null); + } + } + + public void trust(Player caller, String[] args) + { + ClansClan cA = getMimic(caller, true); + + if (cA == null) + return; + + if (args.length < 3) + { + UtilPlayer.message(caller, F.main("Clans Admin", "You did not input a Clan to enemy.")); + return; + } + + ClansClan cB = Clans.CUtil().searchClanPlayer(caller, args[2], true); + + if (cB == null) + return; + + if (!cA.isAlly(cB.GetName())) + { + UtilPlayer.message(caller, F.main("Clans Admin", "You cannot give trust to enemies.")); + return; + } + + //Task + if (Clans.CTask().trust(cA, cB, caller.getName())) + { + //Inform + UtilPlayer.message(caller, F.main("Clans Admin", "You gave trust to Clan " + cB.GetName() + ".")); + cA.inform(caller.getName() + " has given trust to Clan " + cB.GetName() + ".", caller.getName()); + cB.inform("Clan " + cA.GetName() + " has given trust to you.", null); + } + else + { + //Inform + UtilPlayer.message(caller, F.main("Clans Admin", "You revoked trust to Clan " + cB.GetName() + ".")); + cA.inform(caller.getName() + " has revoked trust to Clan " + cB.GetName() + ".", caller.getName()); + cB.inform("Clan " + cA.GetName() + " has revoked trust to you.", null); + } + } + + public void neutral(Player caller, String[] args) + { + ClansClan cA = getMimic(caller, true); + + if (cA == null) + return; + + if (args.length < 2) + { + UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to set neutrality with.")); + return; + } + + ClansClan cB = Clans.CUtil().searchClanPlayer(caller, args[1], true); + + if (cB == null) + return; + + if (cB.isSelf(cA.GetName())) + { + UtilPlayer.message(caller, F.main("Clans", "You prefer to think of yourself positively...")); + return; + } + + if (cB.isNeutral(cA.GetName())) + { + UtilPlayer.message(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.GetName()) + ".")); + return; + } + + if (cB.isAlly(cA.GetName())) + { + //Task + Clans.CTask().neutral(cA, cB, caller.getName(), true); + + //Inform + UtilPlayer.message(caller, F.main("Clans", "You revoked alliance with " + F.elem("Clan " + cB.GetName()) + ".")); + cA.inform(F.name(caller.getName()) + " revoked alliance with " + F.elem("Clan " + cB.GetName()) + ".", caller.getName()); + cB.inform(F.elem("Clan " + cA.GetName()) + " has revoked alliance with you.", null); + + return; + } + + if (cA.GetEnemyOut().containsKey(cB.GetName())) + { + //Task + Clans.CTask().neutral(cA, cB, caller.getName(), false); + + //Inform + UtilPlayer.message(caller, F.main("Clans", "You ended invasion on " + F.elem("Clan " + cB.GetName()) + ".")); + cA.inform(F.name(caller.getName()) + " ended invasion on " + F.elem("Clan " + cB.GetName()) + ".", caller.getName()); + cB.inform(F.elem("Clan " + cA.GetName()) + " has ended invasion on you.", null); + + return; + } + } + + public void enemy(Player caller, String[] args) + { + ClansClan cA = getMimic(caller, true); + + if (cA == null) + return; + + if (cA.getWars() >= cA.getWarsMax()) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot invade more Clans.")); + return; + } + + if (args.length < 2) + { + UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to invade.")); + return; + } + + ClansClan cB = Clans.CUtil().searchClanPlayer(caller, args[1], true); + + if (cB == null) + return; + + if (cA.isSelf(cB.GetName())) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot invade yourself.")); + return; + } + + if (cA.GetEnemyOut().containsKey(cB.GetName())) + { + UtilPlayer.message(caller, F.main("Clans", "You are already invading " + F.elem("Clan " + cB.GetName()) + ".")); + return; + } + + if (cA.isAlly(cB.GetName())) + { + UtilPlayer.message(caller, F.main("Clans", "You must end alliance with " + F.elem("Clan " + cB.GetName()) + " first.")); + return; + } + + ClansWar war = new ClansWar(Clans, cA, cB, 0, System.currentTimeMillis()); + + //Task + Clans.CTask().enemy(war, caller.getName()); + + //Inform + UtilPlayer.message(caller, F.main("Clans", "You started invasion on " + F.elem("Clan " + cB.GetName()) + ".")); + cA.inform(F.name(caller.getName()) + " started invasion on " + F.elem("Clan " + cB.GetName()) + ".", caller.getName()); + cB.inform(F.elem("Clan " + cA.GetName()) + " has started an invasion on you.", null); + } + + public void claim(Player caller) + { + ClansClan clientClan = getMimic(caller, true); + + if (clientClan == null) + return; + + if (clientClan.getClaims() >= clientClan.getClaimsMax()) + { + UtilPlayer.message(caller, F.main("Clans Admin", "Your Clan cannot claim more Territory.")); + return; + } + + String chunk = UtilWorld.chunkToStr(caller.getLocation().getChunk()); + ClansClan ownerClan = Clans.CUtil().getOwner(caller.getLocation()); + + //Already Claimed + if (ownerClan != null) + { + UtilPlayer.message(caller, F.main("Clans Admin", "This Territory is claimed by " + + Clans.CUtil().mRel(Clans.CUtil().relPC(caller.getName(), ownerClan), ownerClan.GetName(), true) + ".")); + return; + } + + //Task + Clans.CTask().claim(clientClan.GetName(), chunk, caller.getName(), false); + + //Inform + UtilPlayer.message(caller, F.main("Clans Admin", "You claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".")); + clientClan.inform(caller.getName() + " claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName()); + } + + public void unclaim(Player caller, String args[]) + { + if (args.length > 2) + { + if (args[2].equalsIgnoreCase("all") || args[2].equalsIgnoreCase("a")) + { + unclaimall(caller); + return; + } + } + + ClansClan clientClan = getMimic(caller, true); + + if (clientClan == null) + return; + + String chunk = UtilWorld.chunkToStr(caller.getLocation().getChunk()); + ClansClan ownerClan = Clans.CUtil().getOwner(caller.getLocation()); + + //Not Claimed + if (ownerClan == null) + { + UtilPlayer.message(caller, F.main("Clans Admin", "Territory is not claimed.")); + return; + } + + //Task + Clans.CTask().unclaim(chunk, caller.getName(), true); + + //Inform + UtilPlayer.message(caller, F.main("Clans Admin", "You unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".")); + ownerClan.inform(caller.getName() + " unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName()); + } + + public void unclaimall(Player caller) + { + ClansClan clientClan = getMimic(caller, true); + + if (clientClan == null) + return; + + //Unclaim + ArrayList toUnclaim = new ArrayList(); + + for (String chunk : clientClan.GetClaimSet()) + toUnclaim.add(chunk); + + for (String chunk : toUnclaim) + Clans.CTask().unclaim(chunk, caller.getName(), true); + + //Inform + UtilPlayer.message(caller, F.main("Clans Admin", "You unclaimed all your Clans Territory.")); + clientClan.inform(caller.getName() + " unclaimed all your Clans Territory.", caller.getName()); + } + + public void home(Player caller, String[] args) + { + if (args.length > 2) + { + if (args[2].equalsIgnoreCase("set") || args[2].equalsIgnoreCase("s")) + { + homeSet(caller); + return; + } + } + + ClansClan clan = getMimic(caller, true); + + if (clan == null) + return; + + if (clan.GetHome() == null) + { + UtilPlayer.message(caller, F.main("Clans Admin", "Your Clan has not set a Home.")); + return; + } + + if (!clan.GetClaimSet().contains(UtilWorld.chunkToStr(clan.GetHome().getChunk()))) + { + UtilPlayer.message(caller, F.main("Clans Admin", "Your Clan has lost its Home Territory.")); + return; + } + + //Do + Clans.Teleport().TP(caller, clan.GetHome()); + + //Inform + UtilPlayer.message(caller, F.main("Clans Admin", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + ".")); + } + + public void homeSet(Player caller) + { + ClansClan clan = getMimic(caller, true); + + if (clan == null) + return; + + if (Clans.CUtil().getOwner(caller.getLocation()) == null) + { + UtilPlayer.message(caller, F.main("Clans Admin", "You must set your Clan Home in your own Territory.")); + return; + } + + if (!Clans.CUtil().getOwner(caller.getLocation()).isSelf(clan.GetName())) + { + UtilPlayer.message(caller, F.main("Clans Admin", "You must set your Clan Home in your own Territory.")); + return; + } + + //Task + Clans.CTask().home(clan, caller.getLocation(), caller.getName()); + + //Inform + UtilPlayer.message(caller, F.main("Clans Admin", "You set Clan Home to " + UtilWorld.locToStrClean(caller.getLocation()) + ".")); + clan.inform(caller.getName() + " set Clan Home to " + UtilWorld.locToStrClean(caller.getLocation()) + ".", caller.getName()); + } + + public void safe(Player caller) + { + ClansTerritory claim = Clans.CUtil().getClaim(caller.getLocation()); + + if (claim == null) + { + UtilPlayer.message(caller, F.main("Clans Admin", "You can only Safe Zone on Claimed Territory.")); + return; + } + + //Set + Clans.CTask().safe(claim, caller.getName()); + + //Inform + UtilPlayer.message(caller, F.main("Clans Admin", "Territory Safe Zone: " + F.tf(claim.safe))); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansBlocks.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansBlocks.java new file mode 100644 index 000000000..36dbf220f --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansBlocks.java @@ -0,0 +1,145 @@ +package nautilus.game.pvp.modules.clans; + +import java.util.HashSet; + + +public class ClansBlocks +{ + public ClansBlocks(Clans clans) + { + + } + + public HashSet denyInteract = new HashSet(); + public HashSet allowInteract = new HashSet(); + + public HashSet denyUsePlace = new HashSet(); + public HashSet allowUsePlace = new HashSet(); + + public HashSet allowBreak = new HashSet(); + + public boolean denyInteract(int id) + { + if (denyInteract.isEmpty()) + { + denyInteract.add(22); //Lapis + denyInteract.add(23); //Dispenser + denyInteract.add(26); //Bed + denyInteract.add(54); //Chest + denyInteract.add(61); //Furance + denyInteract.add(62); //Furnace + denyInteract.add(64); //Wood Door + //denyInteract.add(69); //Lever + //denyInteract.add(70); //Stone Plate + denyInteract.add(71); //Iron Door + //denyInteract.add(72); //Wood Plate + //denyInteract.add(77); //Stone Button + denyInteract.add(93); //Repeater + denyInteract.add(94); //Repeater + denyInteract.add(96); //Trap Door + denyInteract.add(107); //Fence Gate + denyInteract.add(117); //Brewing Stand + denyInteract.add(146); //Trap Chest + } + + return denyInteract.contains(id); + } + + public boolean allowInteract(int id) + { + if (allowInteract.isEmpty()) + { + allowInteract.add(64); //Wood Door + //allowInteract.add(69); //Lever + //allowInteract.add(70); //Stone Plate + allowInteract.add(71); //Iron Door + //allowInteract.add(72); //Wood Plate + //allowInteract.add(77); //Stone Button + allowInteract.add(96); //Trap Door + allowInteract.add(107); //Fence Gate + } + + return allowInteract.contains(id); + } + + public boolean denyUsePlace(int id) + { + if (denyUsePlace.isEmpty()) + { + //List PLACEABLE ITEMS + denyUsePlace.add(259); //Flint & Steel + denyUsePlace.add(321); //Painting + denyUsePlace.add(323); //Sign + denyUsePlace.add(324); //Wood Door + denyUsePlace.add(326); //Water Bucket + denyUsePlace.add(327); //Lava Bucket + denyUsePlace.add(330); //Iron Door + denyUsePlace.add(331); //Redstone + denyUsePlace.add(333); //Boat + denyUsePlace.add(355); //Bed + denyUsePlace.add(356); //Redstone Repeater + denyUsePlace.add(379); //Brewing Stand + denyUsePlace.add(380); //Cauldron + denyUsePlace.add(389); //Frame + denyUsePlace.add(390); //Pot + denyUsePlace.add(404); //Comparator + denyUsePlace.add(407); //TNT Cart + } + + if (id == 65) + return false; + + if (id > 0 && id < 256) + return true; + + return denyUsePlace.contains(id); + } + + public boolean allowUsePlace(int id) + { + if (allowUsePlace.isEmpty()) + { + allowUsePlace.add(37); //Flower + allowUsePlace.add(38); //Flower + allowUsePlace.add(65); //Ladder + } + + return allowUsePlace.contains(id); + } + + public boolean canBreak(int id) + { + if (allowBreak.isEmpty()) + { + allowBreak.add(6); //Saplings + allowBreak.add(12); //Sand + allowBreak.add(13); //Gravel + allowBreak.add(22); //Blue + allowBreak.add(30); //Web + + allowBreak.add(39); //Brown Mushroom + allowBreak.add(40); //Red Mushroom + allowBreak.add(59); //Wheat Seeds + allowBreak.add(81); //Cactus + allowBreak.add(83); //Sugar Cane + allowBreak.add(86); //Pumpkin + allowBreak.add(103); //Melon + allowBreak.add(104); //Pumpkin Stem + allowBreak.add(105); //Melon Stem + allowBreak.add(115); //Nether Wart + allowBreak.add(127); //Cocoa Plant + allowBreak.add(141); //Carrot + allowBreak.add(142); //Potato + + allowBreak.add(58); //Workbench + allowBreak.add(61); //Furnace + allowBreak.add(62); //Furnace + //allowBreak.add(116); //Enchanting + //allowBreak.add(117); //Brewing + allowBreak.add(138); //Beacon + //allowBreak.add(145); //Anvil + } + + return allowBreak.contains(id); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansClan.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansClan.java new file mode 100644 index 000000000..4a3ef56d1 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansClan.java @@ -0,0 +1,1047 @@ +package nautilus.game.pvp.modules.clans; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedList; + +import mineplex.core.account.CoreClient; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.pvp.modules.clans.ClansUtility.ClanRelation; +import nautilus.game.pvp.modules.clans.Tokens.AllianceToken; +import nautilus.game.pvp.modules.clans.Tokens.ClanMemberToken; +import nautilus.game.pvp.modules.clans.Tokens.ClanRole; +import nautilus.game.pvp.modules.clans.Tokens.ClanTerritoryToken; +import nautilus.game.pvp.modules.clans.Tokens.ClanToken; +import nautilus.game.pvp.modules.clans.Tokens.WarToken; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +public class ClansClan +{ + public enum Role + { + LEADER(4), + ADMIN(3), + MEMBER(2), + RECRUIT(1), + NONE(0); + + private int i; + + private Role(int value) + { + this.i = value; + } + + public int toInt() + { + return i; + } + } + + private ClanToken _token; + + private String _name = ""; + private String _desc = ""; + private Location _home = null; + + private int _power = 0; + private long _powerTime = 3000000; + + private boolean _admin = false; + + private long _dateCreated = 0; + private long _lastOnline = 0; + + private Location _generatorBlock = null; + private long _generatorTime = 0; + private int _generatorStock = 0; + + private ClansOutpost _outpost = null; + + private NautHashMap _allyMap = new NautHashMap(); + + private NautHashMap _enemyOut = new NautHashMap(); + private NautHashMap _enemyIn = new NautHashMap(); + + private NautHashMap _enemyRecharge = new NautHashMap(); + private HashSet _enemyEvent = new HashSet(); + private HashSet _enemyPillage = new HashSet(); + + //Loaded from Client + private NautHashMap _memberMap = new NautHashMap(); + private HashSet _claimSet = new HashSet(); + + //Temporary + private NautHashMap _inviteeMap = new NautHashMap(); + private NautHashMap _inviterMap = new NautHashMap(); + + private NautHashMap _requestMap = new NautHashMap(); + + //Clans REfernece + public Clans Clans; + + public ClansClan(Clans clans, ClanToken token) + { + Clans = clans; + _token = token; + + _name = token.Name; + _desc = token.Description; + + try + { + _home = UtilWorld.strToLoc(token.Home); + } + catch (Exception e) + { + + } + + _power = token.Power; + _admin = token.Admin; + + _dateCreated = token.DateCreated; + _lastOnline = token.LastTimeOnline; + + if (token.Generator != null) + { + if (token.Generator.Location != null && !token.Generator.Location.isEmpty()) + _generatorBlock = UtilWorld.strToLoc(token.Generator.Location); + + _generatorStock = token.Generator.Stock; + _generatorTime = token.Generator.Time; + } + } + + public int getPower() + { + if (IsAdmin()) + return 1000; + + return getPowerMax() - _power; + } + + public int getPowerMax() + { + if (IsAdmin()) + return 1000; + + int powerMax = 2 + GetMembers().size(); + + if (powerMax > 8) + powerMax = 8; + + return powerMax; + } + + public int getClaims() + { + return GetClaimSet().size(); + } + + public int getClaimsMax() + { + if (IsAdmin()) + return 1000; + + return 2 + GetMembers().size(); + } + + public int getAllies() + { + return GetAllyMap().size(); + } + + public int getAlliesMax() + { + if (IsAdmin()) + return 1000; + + return Math.max(2, 9 - _memberMap.size()); + } + + public int getWars() + { + return GetEnemyOut().size(); + } + + public int getWarsMax() + { + return 1 + GetMembers().size(); + } + + public int getEnemies() + { + return GetAllyMap().size(); + } + + public boolean isRequested(String clan) + { + if (!GetRequestMap().containsKey(clan)) + return false; + + if (System.currentTimeMillis() > GetRequestMap().get(clan) + (Clans.GetInviteExpire() * 60000)) + return false; + + return true; + } + + public boolean isInvited(String player) + { + if (!GetInviteeMap().containsKey(player)) + return false; + + if (System.currentTimeMillis() > GetInviteeMap().get(player) + (Clans.GetInviteExpire() * 60000)) + return false; + + return true; + } + + public boolean isMember(String clan) + { + return GetMembers().containsKey(clan); + } + + public boolean isAlly(String other) + { + return GetAllyMap().containsKey(other); + } + + public boolean isSelf(String other) + { + return this.GetName().equals(other); + } + + public boolean isNeutral(String other) + { + return (!isEnemy(other) && !isAlly(other) && !isSelf(other)); + } + + public boolean isEnemy(String other) + { + return (_enemyOut.containsKey(other) || _enemyIn.containsKey(other)); + } + + public boolean isPillage(String other) + { + return GetEnemyEvent().contains(other); + } + + public boolean canPillage(ClansClan other) + { + return _enemyPillage.contains(other.GetName()); + } + + public int getDominance(ClansClan clan) + { + if (!GetEnemyOut().containsKey(clan.GetName())) + return 0; + + ClansWar war = GetEnemyOut().get(clan.GetName()); + + return war.GetDominance(); + } + + public String getDominanceString(ClansClan clan) + { + if (clan == null) + return "Unknown"; + + //Mutual Invasion + if (this.GetEnemyOut().containsKey(clan.GetName()) && clan.GetEnemyOut().containsKey(this.GetName())) + { + return C.mBody + "(" + C.mElem + + C.listValueOn + this.GetEnemyOut().get(clan.GetName()).GetDominance() + + C.mBody + ":" + + C.listValueOff + clan.GetEnemyOut().get(this.GetName()).GetDominance() + + C.mBody + ")"; + } + + else if (this.GetEnemyOut().containsKey(clan.GetName())) + { + return C.mBody + "(" + C.mElem + + C.listValueOn + this.GetEnemyOut().get(clan.GetName()).GetDominance() + + C.mBody + ":" + + C.listValueOff + "-" + + C.mBody + ")"; + } + + else if (clan.GetEnemyOut().containsKey(this.GetName())) + { + return C.mBody + "(" + C.mElem + + C.listValueOn + "-" + + C.mBody + ":" + + C.listValueOff + clan.GetEnemyOut().get(this.GetName()).GetDominance() + + C.mBody + ")"; + } + + return "Unknown"; + } + + public void modifyPower(int mod) + { + int newPower = _power - mod; + setPower(newPower); + } + + public void setPower(int pow) + { + _power = pow; + + //Limits + if (_power < 0) + _power = 0; + + if (_power > getPowerMax()) + _power = getPowerMax(); + + Clans.CRepo().EditClan(GetToken()); + } + + + public void gainDominance(ClansClan other) + { + ClansWar war = null; + + //Subtract from Enemy + war = other.GetEnemyOut().get(this.GetName()); + if (war != null) + { + if (war.GetDominance() > 0) + { + war.SetDominance(war.GetDominance() - 1); + + //Inform + other.inform("You lost Dominance against " + + Clans.CUtil().mRel(Clans.CUtil().rel(this, other), this.GetName(), false) + " " + other.getDominanceString(this) + ".", null); + + this.inform("You recovered Dominance against " + + Clans.CUtil().mRel(Clans.CUtil().rel(this, other), other.GetName(), false) + " " + this.getDominanceString(other) + ".", null); + + return; + } + } + + //Add to Self + war = this.GetEnemyOut().get(other.GetName()); + if (war != null) + { + war.SetDominance(war.GetDominance() + 1); + + //Inform + other.inform("You lost Dominance against " + + Clans.CUtil().mRel(Clans.CUtil().rel(this, other), this.GetName(), false) + " " + other.getDominanceString(this) + ".", null); + + this.inform("You gained Dominance against " + + Clans.CUtil().mRel(Clans.CUtil().rel(this, other), other.GetName(), false) + " " + this.getDominanceString(other) + ".", null); + } + } + + public long getTimer() + { + int penalty = 0; + + /* XXX + for (int cur : GetWarMap().values()) + { + + if (cur < 0) + penalty -= cur*2; + + else + penalty += cur; + }*/ + + return System.currentTimeMillis() + (penalty * 1000); + } + + public boolean getTrust(String clan) + { + if (!GetAllyMap().containsKey(clan)) + return false; + + return GetAllyMap().get(clan); + } + + public LinkedList mDetails(String caller) + { + LinkedList stringList = new LinkedList(); + + stringList.add(F.main("Clans", Clans.CUtil().mRel(Clans.CUtil().relPC(caller, this), GetName() + " Information;", true))); + //stringList.add(F.value("Desc", _desc)); + + + + if (Clans.IsPowerEnabled()) + { + stringList.add(F.value("Power", getPower() + "/" + getPowerMax())); + if (_power > 0) + stringList.add(F.value("Power Gain", + UtilTime.convertString(Clans.GetPowerTime()-GetPowerTime(), 1, TimeUnit.FIT))); + else + stringList.add(F.value("Power Gain", "Full Power")); + } + + //Age + stringList.add(F.value("Age", UtilTime.convertString(System.currentTimeMillis() - _dateCreated, 1, TimeUnit.FIT))); + + //Home + if (Clans.CUtil().relPC(caller, this) == ClanRelation.SELF) + stringList.add(F.value("Home", UtilWorld.locToStrClean(GetHome()))); + + //Land + stringList.add(F.value("Territory", getClaims() + "/" + getClaimsMax())); + + //Ally String + String allySorted = ""; + HashSet allyUnsorted = new HashSet(); + + for (String allyName : GetAllyMap().keySet()) + allyUnsorted.add(allyName); + + for (String cur : UtilAlg.sortKey(allyUnsorted)) + allySorted += Clans.CUtil().mRel(Clans.CUtil().relPC(caller, Clans.GetClanMap().get(cur)), cur, false) + ", "; + + stringList.add(F.value("Allies", allySorted)); + + //Wars Out String + String warsSorted = ""; + HashSet warsUnsorted = new HashSet(); + + for (String warName : GetEnemyOut().keySet()) + warsUnsorted.add(warName); + + for (String cur : UtilAlg.sortKey(warsUnsorted)) + warsSorted += Clans.CUtil().mRel(Clans.CUtil().relPC(caller, Clans.GetClanMap().get(cur)), cur, false) + ", "; + + stringList.add(F.value("Invading", warsSorted)); + + //Wars In String + warsSorted = ""; + warsUnsorted = new HashSet(); + + for (String warName : GetEnemyIn().keySet()) + warsUnsorted.add(warName); + + for (String cur : UtilAlg.sortKey(warsUnsorted)) + warsSorted += Clans.CUtil().mRel(Clans.CUtil().relPC(caller, Clans.GetClanMap().get(cur)), cur, false) + ", "; + + stringList.add(F.value("Defending", warsSorted)); + + //Members + String members = ""; + for (String cur : UtilAlg.sortKey(GetMembers().keySet())) + { + String name = C.listValueOff + cur; + if (UtilPlayer.isOnline(cur)) + name = C.listValueOn + cur; + + if (GetMembers().get(cur) == Role.LEADER) + members += C.listValue + "L." + name + C.mBody + ", "; + + if (GetMembers().get(cur) == Role.ADMIN) + members += C.listValue + "A." + name + C.mBody + ", "; + + if (GetMembers().get(cur) == Role.MEMBER) + members += C.listValue + "M." + name + C.mBody + ", "; + + if (GetMembers().get(cur) == Role.RECRUIT) + members += C.listValue + "R." + name + C.mBody + ", "; + } + stringList.add(F.value("Members", members)); + + if (_generatorBlock == null) + { + stringList.add(F.value("TNT Generator", C.cRed + "None")); + } + else + { + stringList.add(F.value("TNT Generator", _generatorStock + " TNT")); + stringList.add(F.value("TNT Generation", + UtilTime.convertString(Clans.GetGeneratorTime() - (System.currentTimeMillis() - _generatorTime) , 1, TimeUnit.FIT))); + } + + //Protected + stringList.add(F.value("TNT Protection", getProtected())); + + //Dominance + ClansClan callerClan = Clans.CUtil().getClanByPlayer(caller); + if (callerClan != null) + if (this.isEnemy(callerClan.GetName())) + stringList.add(F.value("Dominance", callerClan.getDominanceString(this))); + + return stringList; + } + + public LinkedList mTerritory() + { + LinkedList stringList = new LinkedList(); + + stringList.add(F.main("Clans", GetName() + " Territory;")); + + for (String cur : GetClaimSet()) + { + stringList.add(cur); + } + + return stringList; + } + + public void inform(String message, String ignore) + { + for (String cur : GetMembers().keySet()) + { + if (ignore != null && cur.equals(ignore)) + continue; + + Player player = UtilPlayer.searchOnline(null, cur, false); + + if (player == null) + continue; + + UtilPlayer.message(player, F.main("Clans", message)); + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 2f); + } + } + + public void chat(Player sender, String message, String filteredMessage) + { + for (String cur : GetMembers().keySet()) + { + Player player = UtilPlayer.searchOnline(null, cur, false); + + if (player == null) + continue; + + CoreClient client = Clans.Clients().Get(player); + + if (client.Game().GetFilterChat()) + UtilPlayer.message(player, C.cAqua + sender.getName() + C.cDAqua + " " + filteredMessage); + else + UtilPlayer.message(player, C.cAqua + sender.getName() + C.cDAqua + " " + message); + } + } + + public void allyChat(ClansClan senderClan, Player sender, String message, String filteredMessage) + { + for (String cur : GetMembers().keySet()) + { + Player player = UtilPlayer.searchOnline(null, cur, false); + + if (player == null) + continue; + + CoreClient client = Clans.Clients().Get(player); + + //C.cDGreen + senderClan.GetName() + " " + + + if (client.Game().GetFilterChat()) + UtilPlayer.message(player, C.cDGreen + sender.getName() + C.cGreen + " " + filteredMessage); + else + UtilPlayer.message(player, C.cDGreen + sender.getName() + C.cGreen + " " + message); + } + } + + public long GetPowerTime() + { + return _powerTime; + } + + public void SetPowerTime(long powerTime) + { + _powerTime = powerTime; + } + + public String GetName() + { + return _name; + } + + public String GetDesc() + { + return _desc; + } + + public void SetDesc(String desc) + { + _desc = desc; + _token.Description = desc; + } + + public NautHashMap GetMembers() + { + return _memberMap; + } + + public HashSet GetClaimSet() + { + return _claimSet; + } + + public Location GetHome() + { + return _home; + } + + public void SetHome(Location loc) + { + _home = loc; + _token.Home = UtilWorld.locToStr(loc); + } + + public boolean IsAdmin() + { + return _admin; + } + + public void SetAdmin(boolean admin) + { + _admin = admin; + _token.Admin = admin; + } + + public NautHashMap GetInviterMap() + { + return _inviterMap; + } + + public NautHashMap GetInviteeMap() + { + return _inviteeMap; + } + + public NautHashMap GetEnemyOut() + { + return _enemyOut; + } + + public NautHashMap GetEnemyIn() + { + return _enemyIn; + } + + public NautHashMap GetEnemyRecharge() + { + return _enemyRecharge; + } + + public NautHashMap GetEnemyAccess() + { + return _enemyRecharge; + } + + public HashSet GetEnemyEvent() + { + return _enemyEvent; + } + + public NautHashMap GetAllyMap() + { + return _allyMap; + } + + public NautHashMap GetRequestMap() + { + return _requestMap; + } + + public long GetDateCreated() + { + return _dateCreated; + } + + public long GetLastOnline() + { + return _lastOnline; + } + + public void SetLastOnline(long lastOnline) + { + _lastOnline = lastOnline; + _token.LastTimeOnline = lastOnline; + } + + public ClanToken GetTokenUnupdated() + { + return _token; + } + + public ClanToken GetToken() + { + //Update Members + _token.Members = new ArrayList(); + for (String name : GetMembers().keySet()) + { + ClanMemberToken token = new ClanMemberToken(); + token.Name = name; + token.ClanRole = new ClanRole(); + token.ClanRole.Name = GetMembers().get(name).toString(); + + _token.Members.add(token); + } + + //Update Territory + _token.Territories = new ArrayList(); + for (String chunk : GetClaimSet()) + { + ClanTerritoryToken token = new ClanTerritoryToken(); + token.ClanName = _token.Name; + token.ClanId = _token.ClanId; + token.ServerName = Clans.GetServerName(); + token.Chunk = chunk; + + if (Clans.GetClaimMap().get(chunk) != null) + token.Safe = Clans.GetClaimMap().get(chunk).safe; + + _token.Territories.add(token); + } + + //Update Relations + _token.Alliances = new ArrayList(); + for (String clanName : GetAllyMap().keySet()) + { + ClansClan clan = Clans.getClan(clanName); + AllianceToken token = new AllianceToken(); + token.ClanId = clan.GetTokenUnupdated().ClanId; + token.ClanName = clan.GetTokenUnupdated().Name; + + if (GetAllyMap().get(clanName)) + token.Trusted = true; + + _token.Alliances.add(token); + } + + //Wars + _token.Wars = new ArrayList(); + for (ClansWar war : GetEnemyOut().values()) + { + if (!war.GetClanA().equals(this)) + continue; + + WarToken token = new WarToken(); + token.ClanId = war.GetClanB().GetTokenUnupdated().ClanId; + token.ClanName = war.GetClanB().GetTokenUnupdated().Name; + token.Dominance = war.GetDominance(); + token.Created = war.GetCreated(); + + token.Ended = false; + token.Cooldown = 0; + + _token.Wars.add(token); + } + + //Recharges + for (String other : GetEnemyRecharge().keySet()) + { + ClansClan clan = Clans.getClan(other); + + WarToken token = new WarToken(); + token.ClanId = clan.GetTokenUnupdated().ClanId; + token.ClanName = clan.GetTokenUnupdated().Name; + token.Dominance = -1; + token.Created = -1; + + token.Ended = true; + token.Cooldown = GetEnemyRecharge().get(other); + + _token.Wars.add(token); + } + + return _token; + } + + public boolean isOnlineNow() + { + for (String cur : GetMembers().keySet()) + if (UtilPlayer.isOnline(cur)) + return true; + + return false; + } + + public boolean isOnline() + { + for (String cur : GetMembers().keySet()) + if (UtilPlayer.isOnline(cur)) + return true; + + return System.currentTimeMillis() - _lastOnline < Clans.GetOnlineTime(); + } + + public String getProtected() + { + for (String cur : GetMembers().keySet()) + if (UtilPlayer.isOnline(cur)) + return C.cRed + "No - Clan Members are Online"; + + if (System.currentTimeMillis() - _lastOnline > Clans.GetOnlineTime()) + return C.cGreen + "Yes - Clan Members are Offline"; + + return C.cGold + "No, " + + UtilTime.convertString(Clans.GetOnlineTime() - (System.currentTimeMillis() - _lastOnline), 1, TimeUnit.FIT) + + " to Protection"; + } + + public boolean GeneratorUpdate() + { + if (_generatorBlock == null) + return false; + + if (_generatorBlock.getBlock().getType() != Material.BREWING_STAND) + { + GeneratorDestroy(); + return false; + } + + ClansClan owner = Clans.CUtil().getOwner(_generatorBlock); + if (owner == null || !owner.equals(this)) + { + GeneratorDestroy(); + return false; + } + + if (_generatorStock == 4) + return false; + + if (!UtilTime.elapsed(_generatorTime, Clans.GetGeneratorTime())) + return false; + + _generatorTime = System.currentTimeMillis(); + _generatorStock += 1; + + //Inform + inform("Your " + F.item("TNT Generator") + " has " + F.item(_generatorStock + " TNT") + ".", null); + return true; + } + + public void GeneratorUse(Player player, Location loc) + { + if (_generatorBlock == null) + return; + + if (!_generatorBlock.equals(loc)) + return; + + if (_generatorStock > 0) + { + _generatorStock -= 1; + + Clans.CRepo().Repository.UpdateClanTNTGenerator(_token.Name, _generatorBlock, _generatorStock, _generatorTime); + + //Drop + _generatorBlock.getWorld().dropItemNaturally( + _generatorBlock.getBlock().getLocation().add(0.5, 0.5, 0.5), + ItemStackFactory.Instance.CreateStack(Material.TNT)); + + //Inform + inform(F.name(player.getName()) + " withdrew from " + F.item("TNT Generator") + ".", null); + } + else + { + UtilPlayer.message(player, F.main("Clans", "The " + F.item("TNT Generator") + " is empty.")); + } + } + + public boolean GeneratorPlace(Player player, Location loc) + { + if (_generatorBlock != null) + { + UtilPlayer.message(player, F.main("Clans", "You already have a " + F.item("TNT Generator") + ".")); + return false; + } + + ClansClan owner = Clans.CUtil().getOwner(loc); + if (owner == null || !owner.equals(this)) + { + UtilPlayer.message(player, F.main("Clans", "You must place " + F.item("TNT Generator") + " in your Territory.")); + return false; + } + + //Inform + inform(F.name(player.getName()) + " created a " + F.item("TNT Generator") + ".", null); + + _generatorBlock = loc; + _generatorStock = 0; + _generatorTime = System.currentTimeMillis(); + + Clans.CRepo().Repository.UpdateClanTNTGenerator(owner.GetName(), _generatorBlock, _generatorStock, _generatorTime); + + return true; + } + + public void GeneratorBreak(Location loc) + { + if (_generatorBlock == null) + return; + + if (!_generatorBlock.equals(loc)) + return; + + GeneratorDestroy(); + } + + public void GeneratorDestroy() + { + //Drop + for (int i=0 ; i< _generatorStock ; i++) + _generatorBlock.getWorld().dropItemNaturally( + _generatorBlock.getBlock().getLocation().add(0.5, 0.5, 0.5), + ItemStackFactory.Instance.CreateStack(Material.TNT)); + + //Inform + inform("Your " + F.item("TNT Generator") + " has been destroyed!", null); + + //Save + _generatorTime = System.currentTimeMillis(); + _generatorStock = 0; + _generatorBlock = null; + + Clans.CRepo().Repository.UpdateClanTNTGenerator(GetName(), _generatorBlock, _generatorStock, _generatorTime); + } + + public Location GetGeneratorBlock() + { + return _generatorBlock; + } + + public int GetGeneratorStock() + { + return _generatorStock; + } + + public long GetGeneratorTime() + { + return _generatorTime; + } + + public HashSet GetPillage() + { + return _enemyPillage; + } + + public boolean OutpostPlace(Player player, Location loc) + { + if (loc.getBlockY() < 10) + { + UtilPlayer.message(player, F.main("Clans", "You cannot place " + F.item("Clan Outpost") + " this deep.")); + return false; + } + + if ( + Clans.CUtil().isClaimed(loc.getBlock().getRelative( 5, 0, 0).getLocation()) || + Clans.CUtil().isClaimed(loc.getBlock().getRelative(-5, 0, 0).getLocation()) || + Clans.CUtil().isClaimed(loc.getBlock().getRelative(0, 0, 5).getLocation()) || + Clans.CUtil().isClaimed(loc.getBlock().getRelative(0, 0, -5).getLocation())) + { + UtilPlayer.message(player, F.main("Clans", "You cannot place " + F.item("Clan Outpost") + " near claimed Territory.")); + return false; + } + + for (ClansOutpost outpost : Clans.GetOutpostMap().values()) + { + if (UtilMath.offset(loc, outpost.GetLocation()) < 10) + { + UtilPlayer.message(player, F.main("Clans", "You cannot place " + F.item("Clan Outpost") + " near other Outposts.")); + return false; + } + } + + if (_outpost != null) + { + UtilPlayer.message(player, F.main("Clans", "You already have a " + F.item("Clan Outpost") + ".")); + return false; + } + + ClansClan owner = Clans.CUtil().getOwner(loc); + if (owner != null) + { + UtilPlayer.message(player, F.main("Clans", "You must place " + F.item("Clan Outpost") + " in Wilderness.")); + return false; + } + + //Inform + inform(F.name(player.getName()) + " constructed a " + F.item("Clan Outpost") + ".", null); + + _outpost = new ClansOutpost(this, loc, System.currentTimeMillis()); + + //XXX WRITE + + return true; + } + + public void OutpostBreak(Location loc) + { + if (_outpost == null) + return; + + if (!_outpost.GetLocation().equals(loc)) + return; + + OutpostDestroy(); + } + + public void OutpostDestroy() + { + //Inform + inform("Your " + F.item("Clan Outpost") + " has been destroyed!", null); + + _outpost.GetLocation().getWorld().createExplosion(_outpost.GetLocation(), 4f); + + _outpost.Clean(); + + Clans.GetOutpostMap().remove(_outpost); + _outpost = null; + + //XXX WRITE + } + + public void OutpostUse(Player player, Location loc) + { + if (_outpost == null) + return; + + if (!_outpost.GetLocation().equals(loc)) + return; + + //Inform + UtilPlayer.message(player, F.main("Clans", F.item("Clan Outpost") + " deconstucts in " + + F.time(UtilTime.convertString(Clans.GetOutpostTime() - (System.currentTimeMillis() - _outpost.GetCreated()), 1, TimeUnit.FIT)) + ".")); + } + + public void OutpostUpdate() + { + if (_outpost == null) + return; + + if (_outpost.GetLocation().getBlock().getType() != Material.BEACON) + { + OutpostDestroy(); + return; + } + + if (!UtilTime.elapsed(_outpost.GetCreated(), Clans.GetOutpostTime())) + return; + + OutpostDestroy(); + } + + public ClansOutpost GetOutpost() + { + return _outpost; + } + + +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansCommand.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansCommand.java new file mode 100644 index 000000000..8bb78bac2 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansCommand.java @@ -0,0 +1,1345 @@ +package nautilus.game.pvp.modules.clans; + +import java.util.ArrayList; + +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.minecraft.punish.PunishChatEvent; +import nautilus.game.pvp.modules.clans.ClansClan.Role; +import nautilus.game.pvp.modules.clans.ClansUtility.ClanRelation; + +import org.bukkit.Chunk; +import org.bukkit.entity.Player; + +public class ClansCommand +{ + private Clans Clans; + public ClansCommand(Clans clans) + { + Clans = clans; + } + + public String[] denyClan = new String[] { + "outpost", "neut", "neutral", "sethome", "promote", "demote", "admin", "help", "create", "disband", "delete", "invite", "join", "kick", "ally", "trust", "enemy", "claim", "unclaim", "territory", "home"}; + + public void command(Player caller, String[] args) + { + if (args.length == 0) + { + if (Clans.Clients().Get(caller).Clan().InClan()) + infoClan(caller, Clans.Clients().Get(caller).Clan().GetClanName()); + + else + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + + if (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("h")) + help(caller); + + else if (args[0].equalsIgnoreCase("admin") || args[0].equalsIgnoreCase("x")) + Clans.CAdmin().command(caller, args); + + else if (args[0].equalsIgnoreCase("create")) + create(caller, args); + + else if (args[0].equalsIgnoreCase("disband") || args[0].equalsIgnoreCase("delete")) + delete(caller, args); + + else if (args[0].equalsIgnoreCase("invite") || args[0].equalsIgnoreCase("i")) + invite(caller, args); + + else if (args[0].equalsIgnoreCase("promote") || args[0].equalsIgnoreCase("+")) + promote(caller, args); + + else if (args[0].equalsIgnoreCase("demote") || args[0].equalsIgnoreCase("-")) + demote(caller, args); + + else if (args[0].equalsIgnoreCase("join") || args[0].equalsIgnoreCase("j")) + join(caller, args); + + else if (args[0].equalsIgnoreCase("leave") || args[0].equalsIgnoreCase("l")) + leave(caller, args); + + else if (args[0].equalsIgnoreCase("kick") || args[0].equalsIgnoreCase("k")) + kick(caller, args); + + else if (args[0].equalsIgnoreCase("ally") || args[0].equalsIgnoreCase("a")) + ally(caller, args); + + else if (args[0].equalsIgnoreCase("trust")) + trust(caller, args); + + else if (args[0].equalsIgnoreCase("neutral") || args[0].equalsIgnoreCase("neut") || args[0].equalsIgnoreCase("n")) + neutral(caller, args); + + else if (args[0].equalsIgnoreCase("enemy") || args[0].equalsIgnoreCase("e") || args[0].equalsIgnoreCase("war") || args[0].equalsIgnoreCase("w")) + enemy(caller, args); + + else if (args[0].equalsIgnoreCase("claim") || args[0].equalsIgnoreCase("c")) + claim(caller, args); + + else if (args[0].equalsIgnoreCase("unclaim") || args[0].equalsIgnoreCase("uc")) + unclaim(caller, args); + + else if (args[0].equalsIgnoreCase("map") || args[0].equalsIgnoreCase("m")) + map(caller, args); + + else if (args[0].equalsIgnoreCase("home") || args[0].equalsIgnoreCase("h")) + home(caller, args); + + else if (args[0].equalsIgnoreCase("outpost")) + outpost(caller); + + else if (args[0].equalsIgnoreCase("sethome")) + homeSet(caller); + + else if (args[0].equalsIgnoreCase("territory") || args[0].equalsIgnoreCase("t")) + infoTerritory(caller, args); + + else if (args[0].equalsIgnoreCase("who") || args[0].equalsIgnoreCase("w")) + { + if (args.length > 1) infoClan(caller, args[1]); + else infoClan(caller, null); + } + + else + infoClan(caller, args[0]); + } + + public void commandChat(Player caller, String[] args) + { + if (args.length == 0) + { + Clans.Clients().Get(caller).Clan().SetClanChat(!Clans.Clients().Get(caller).Clan().IsClanChat()); + UtilPlayer.message(caller, F.main("Clans", "Clan Chat: " + F.oo(Clans.Clients().Get(caller).Clan().IsClanChat()))); + return; + } + + //Single Clan + if (!Clans.Clients().Get(caller).Clan().IsClanChat()) + { + ClansClan clan = Clans.CUtil().getClanByPlayer(caller); + if (clan == null) + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + else + Clans.ChatClan(clan, caller, F.combine(args, 0, null, false), F.combine(args, 0, null, false)); + } + //Single Normal + else + { + PunishChatEvent event = new PunishChatEvent(caller); + + Clans.Plugin().getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + return; + + Clans.ChatGlobal(caller, F.combine(args, 0, null, false), F.combine(args, 0, null, false)); + } + } + + public void commandAllyChat(Player caller, String[] args) + { + if (args.length == 0) + { + Clans.Clients().Get(caller).Clan().SetAllyChat(!Clans.Clients().Get(caller).Clan().IsAllyChat()); + UtilPlayer.message(caller, F.main("Clans", "Ally Chat: " + F.oo(Clans.Clients().Get(caller).Clan().IsAllyChat()))); + return; + } + + //Single Clan + if (!Clans.Clients().Get(caller).Clan().IsAllyChat()) + { + ClansClan clan = Clans.CUtil().getClanByPlayer(caller); + if (clan == null) UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + else Clans.ChatAlly(clan, caller, F.combine(args, 0, null, false), F.combine(args, 0, null, false)); + } + //Single Normal + else + { + PunishChatEvent event = new PunishChatEvent(caller); + + Clans.Plugin().getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + return; + + Clans.ChatGlobal(caller, F.combine(args, 0, null, false), F.combine(args, 0, null, false)); + } + } + + private void help(Player caller) + { + UtilPlayer.message(caller, F.main("Clans", "Commands List;")); + UtilPlayer.message(caller, F.help("/c create ", "Create new Clan", Rank.ALL)); + UtilPlayer.message(caller, F.help("/c join ", "Join a Clan", Rank.ALL)); + UtilPlayer.message(caller, F.help("/c leave ", "Leave your Clan", Rank.ALL)); + UtilPlayer.message(caller, F.help("/c map ", "View Clan Map", Rank.ALL)); + UtilPlayer.message(caller, F.help("/cc (Message)", "Clan Chat (Toggle)", Rank.ALL)); + + UtilPlayer.message(caller, F.help("/c promote ", "Promote Player in Clan", Rank.MODERATOR)); + UtilPlayer.message(caller, F.help("/c demote ", "Demote Player in Clan", Rank.MODERATOR)); + + UtilPlayer.message(caller, F.help("/c home (set)", "Teleport to Clan Home", Rank.MODERATOR)); + + UtilPlayer.message(caller, F.help("/c invite ", "Invite Player to Clan", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c kick ", "Kick Player from Clan", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c neutral ", "Request Neutrality with Clan", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c enemy ", "Declare War with Clan", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c ally ", "Send Alliance to Clan", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c trust ", "Give Trust to Clan", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c claim", "Claim Territory", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c unclaim (all)", "Unclaim Territory", Rank.ADMIN)); + + UtilPlayer.message(caller, F.help("/c delete", "Delete your Clan", Rank.OWNER)); + + UtilPlayer.message(caller, F.help("/c ", "View Clan Information", Rank.ALL)); + } + + public void create(Player caller, String[] args) + { + CoreClient client = Clans.Clients().Get(caller); + + if (client.Clan().InClan()) + { + UtilPlayer.message(caller, F.main("Clans", "You are already in a Clan.")); + return; + } + + if (!client.Clan().CanJoin()) + { + UtilPlayer.message(caller, F.main("Clans", "You recently left a Clan with low Dominance.")); + UtilPlayer.message(caller, F.main("Clans", "You cannot join a Clan for " + + C.mTime + UtilTime.convertString(System.currentTimeMillis() - client.Clan().GetDelay(), 1, TimeUnit.FIT) + + C.mBody + ".")); + return; + } + + if (args.length < 2) + { + UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan name.")); + return; + } + + if (!Clans.Util().Input().valid(args[1])) + { + UtilPlayer.message(caller, F.main("Clans", "Invalid characters in Clan name.")); + return; + } + + if (args[1].length() < Clans.GetNameMin()) + { + UtilPlayer.message(caller, F.main("Clans", "Clan name too short. Minimum length is " + (Clans.GetNameMin()) + ".")); + return; + } + + if (args[1].length() > Clans.GetNameMax()) + { + UtilPlayer.message(caller, F.main("Clans", "Clan name too long. Maximum length is + " + (Clans.GetNameMax()) + ".")); + return; + } + + for (String cur : denyClan) + { + if (cur.equalsIgnoreCase(args[1])) + { + UtilPlayer.message(caller, F.main("Clans", "Clan name cannot be a Clan command.")); + return; + } + } + + for (String cur : Clans.Clients().GetAll()) + { + if (cur.equalsIgnoreCase(args[1])) + { + UtilPlayer.message(caller, F.main("Clans", "Clan name cannot be a Player name.")); + return; + } + } + + for (String cur : Clans.GetClanMap().keySet()) + { + if (cur.equalsIgnoreCase(args[1])) + { + UtilPlayer.message(caller, F.main("Clans", "Clan name is already used by another Clan.")); + return; + } + } + + //Inform + UtilServer.broadcast(F.main("Clans", F.name(caller.getName()) + " formed " + F.elem("Clan " + args[1]) + ".")); + + //Create and Join + Clans.CTask().join(Clans.CTask().create(caller.getName(), args[1], false), caller.getName(), Role.LEADER); + } + + public void delete(Player caller, String[] args) + { + ClansClan clan = Clans.CUtil().getClanByPlayer(caller); + + if (clan == null) + { + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + + if (Clans.CUtil().getRole(caller) != Role.LEADER) + { + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader can disband the Clan.")); + return; + } + + //Task + Clans.CTask().delete(clan); + + //Inform + UtilServer.broadcast(F.main("Clans", F.name(caller.getName()) + " disbanded " + F.elem("Clan " + clan.GetName()) + ".")); + } + + public void invite(Player caller, String[] args) + { + ClansClan clan = Clans.CUtil().getClanByPlayer(caller); + + if (clan == null) + { + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + + if (clan.GetMembers().get(caller.getName()) != Role.LEADER && + clan.GetMembers().get(caller.getName()) != Role.ADMIN) + { + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can send invites.")); + return; + } + + if (args.length < 2) + { + UtilPlayer.message(caller, F.main("Clans", "You did not input an invitee.")); + return; + } + + Player target = UtilPlayer.searchOnline(caller, args[1], true); + if (target == null) + return; + + if (target.getName().equals(caller.getName())) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot invite yourself.")); + return; + } + + //Inform + clan.inform(F.name(caller.getName()) + " invited " + F.name(target.getName()) + " to join your Clan.", caller.getName()); + UtilPlayer.message(caller, F.main("Clans", "You invited " + F.name(target.getName()) + " to join your Clan.")); + UtilPlayer.message(target, F.main("Clans", F.name(caller.getName()) + " invited you to join " + F.elem("Clan " + clan.GetName()) + ".")); + UtilPlayer.message(target, F.main("Clans", "Type " + F.elem("/c join " + clan.GetName()) + " to accept!")); + + //Task + Clans.CTask().invite(clan, target.getName(), caller.getName()); + } + + public void join(Player caller, String[] args) + { + CoreClient client = Clans.Clients().Get(caller); + + if (client.Clan().InClan()) + { + UtilPlayer.message(caller, F.main("Clans", "You are already in a Clan.")); + return; + } + + if (!client.Clan().CanJoin()) + { + UtilPlayer.message(caller, F.main("Clans", "You recently left a Clan with low " + F.elem("Dominance") + ".")); + UtilPlayer.message(caller, F.main("Clans", "You cannot join a Clan for " + + C.mTime + UtilTime.convertString(System.currentTimeMillis() - client.Clan().GetDelay(), 1, TimeUnit.FIT) + + C.mBody + ".")); + return; + } + + if (args.length < 2) + { + UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan name.")); + return; + } + + if (!Clans.Util().Input().valid(args[1])) + { + UtilPlayer.message(caller, F.main("Clans", "Invalid characters in Clan name.")); + return; + } + + ClansClan clan = Clans.CUtil().searchClanPlayer(caller, args[1], true); + if (clan == null) + return; + + if (!clan.isInvited(caller.getName())) + { + UtilPlayer.message(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clan.GetName()) + ".")); + return; + } + + //Task + Clans.CTask().join(clan, caller.getName(), Role.RECRUIT); + + //Inform + UtilPlayer.message(caller, F.main("Clans", "You joined " + F.elem("Clan " + clan.GetName()) + ".")); + clan.inform(F.name(caller.getName()) + " has joined your Clan.", caller.getName()); + } + + public void leave(Player caller, String[] args) + { + ClansClan clan = Clans.CUtil().getClanByPlayer(caller); + + if (clan == null) + { + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + + if (clan.GetMembers().get(caller.getName()) == Role.LEADER && clan.GetMembers().size() > 1) + { + UtilPlayer.message(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving.")); + return; + } + + //Leave or Delete + if (clan.GetMembers().size() > 1) + { + //Inform + UtilPlayer.message(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.GetName()) + ".")); + + //Task + Clans.CTask().leave(clan, caller.getName()); + + //Inform + clan.inform(F.name(caller.getName()) + " has left your Clan.", null); + } + else + { + delete(caller, args); + } + } + + public void kick(Player caller, String[] args) + { + ClansClan clan = Clans.CUtil().getClanByPlayer(caller); + + if (clan == null) + { + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + + if (args.length < 2) + { + UtilPlayer.message(caller, F.main("Clans", "You did not input a Player to kick.")); + return; + } + + String target = UtilPlayer.searchCollection(caller, args[1], clan.GetMembers().keySet(), "Clan Member", true); + + if (target == null) + return; + + if (clan.GetMembers().get(caller.getName()) != Role.LEADER && + clan.GetMembers().get(caller.getName()) != Role.ADMIN) + { + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can kick members.")); + return; + } + + if ((clan.GetMembers().get(target) == Role.LEADER && clan.GetMembers().get(caller.getName()) == Role.ADMIN) || + (clan.GetMembers().get(target) == Role.ADMIN && clan.GetMembers().get(caller.getName()) == Role.ADMIN)) + { + UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(target) + ".")); + return; + } + + + //Task + Clans.CTask().leave(clan, target); + + //Inform + UtilPlayer.message(UtilPlayer.searchOnline(null, target, false), F.main("Clans", F.name(caller.getName()) + " kicked you from " + F.elem("Clan " + clan.GetName()) + ".")); + UtilPlayer.message(caller, F.main("Clans", "You kicked " + F.name(target) + " from your Clan.")); + clan.inform(F.main("Clans", F.name(caller.getName()) + " kicked " + F.name(target) + " from your Clan."), caller.getName()); + } + + public void promote(Player caller, String[] args) + { + ClansClan clan = Clans.CUtil().getClanByPlayer(caller); + + if (clan == null) + { + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + + if (args.length < 2) + { + UtilPlayer.message(caller, F.main("Clans", "You did not input player to promote.")); + return; + } + + String target = UtilPlayer.searchCollection(caller, args[1], clan.GetMembers().keySet(), "Clan Member", true); + + if (target == null) + return; + + if (target.equals(caller.getName())) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot promote yourself.")); + return; + } + + if (clan.GetMembers().get(caller.getName()).toInt() <= clan.GetMembers().get(target).toInt()) + { + UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(target) + ".")); + return; + } + + //Task + String newRank = "?"; + if (clan.GetMembers().get(target) == Role.RECRUIT) + { + Clans.CTask().role(clan, target, Role.MEMBER); + newRank = "Member"; + } + else if (clan.GetMembers().get(target) == Role.MEMBER) + { + Clans.CTask().role(clan, target, Role.ADMIN); + newRank = "Admin"; + } + else if (clan.GetMembers().get(target) == Role.ADMIN) + { + Clans.CTask().role(clan, target, Role.LEADER); + newRank = "Leader"; + + //Give Leader + Clans.CTask().role(clan, caller.getName(), Role.ADMIN); + } + + //Inform + clan.inform(F.name(caller.getName()) + " promoted " + F.name(target) + " to " + F.elem(newRank) + ".", null); + } + + public void demote(Player caller, String[] args) + { + ClansClan clan = Clans.CUtil().getClanByPlayer(caller); + + if (clan == null) + { + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + + if (args.length < 2) + { + UtilPlayer.message(caller, F.main("Clans", "You did not input player to demote.")); + return; + } + + String target = UtilPlayer.searchCollection(caller, args[1], clan.GetMembers().keySet(), "Clan Member", true); + + if (target == null) + return; + + if (target.equals(caller.getName())) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot demote yourself.")); + return; + } + + if (clan.GetMembers().get(caller.getName()).toInt() <= clan.GetMembers().get(target).toInt()) + { + UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(target) + ".")); + return; + } + + if (clan.GetMembers().get(target) == Role.RECRUIT) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot demote " + F.name(target) + " any further.")); + return; + } + + //Task + String newRank = "?"; + if (clan.GetMembers().get(target) == Role.MEMBER) + { + Clans.CTask().role(clan, target, Role.RECRUIT); + newRank = "Recruit"; + } + else if (clan.GetMembers().get(target) == Role.ADMIN) + { + Clans.CTask().role(clan, target, Role.MEMBER); + newRank = "Member"; + } + + //Inform + clan.inform(F.main("Clans", F.name(caller.getName()) + " demoted " + F.name(target) + " to " + F.elem(newRank) + "."), null); + } + + public void ally(Player caller, String[] args) + { + ClansClan cA = Clans.CUtil().getClanByPlayer(caller); + + if (cA == null) + { + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + + if (cA.GetMembers().get(caller.getName()) != Role.LEADER && cA.GetMembers().get(caller.getName()) != Role.ADMIN) + { + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Alliances.")); + return; + } + + if (args.length < 2) + { + UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to ally.")); + return; + } + + ClansClan cB = Clans.CUtil().searchClanPlayer(caller, args[1], true); + + if (cB == null) + return; + + if (cA.isSelf(cB.GetName())) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot ally with yourself.")); + return; + } + + if (cA.isAlly(cB.GetName())) + { + UtilPlayer.message(caller, F.main("Clans", "You are already allies with " + F.elem("Clan " + cB.GetName()) + ".")); + return; + } + + if (cA.isEnemy(cB.GetName())) + { + UtilPlayer.message(caller, F.main("Clans", "You must end war with " + F.elem("Clan " + cB.GetName()) + " first.")); + return; + } + + if (cA.getAllies() >= cA.getAlliesMax()) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot have any more allies.")); + return; + } + + if (cB.getAllies() >= cB.getAlliesMax()) + { + UtilPlayer.message(caller, F.main("Clans", F.elem("Clan " + cB.GetName()) + " cannot have any more allies.")); + return; + } + + if (cB.isRequested(cA.GetName())) + { + //Task + Clans.CTask().ally(cA, cB, caller.getName()); + + //Inform + UtilPlayer.message(caller, F.main("Clans", "You accepted alliance with " + F.elem("Clan " + cB.GetName()) + ".")); + cA.inform(F.name(caller.getName()) + " accepted alliance with " + F.elem("Clan " + cB.GetName()) + ".", caller.getName()); + cB.inform(F.elem("Clan " + cA.GetName()) + " has accepted alliance with you.", null); + } + else + { + //Task + Clans.CTask().requestAlly(cA, cB, caller.getName()); + + //Inform + UtilPlayer.message(caller, F.main("Clans", "You requested alliance with " + F.elem("Clan " + cB.GetName()) + ".")); + cA.inform(F.name(caller.getName()) + " has requested alliance with " + F.elem("Clan " + cB.GetName()) + ".", caller.getName()); + cB.inform(F.elem("Clan " + cA.GetName()) + " has requested alliance with you.", null); + } + } + + public void trust(Player caller, String[] args) + { + CoreClient client = Clans.Clients().Get(caller); + ClansClan cA = Clans.getClan(client.Clan().GetClanName()); + + if (cA == null) + { + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + + if (cA.GetMembers().get(caller.getName()) != Role.LEADER && cA.GetMembers().get(caller.getName()) != Role.ADMIN) + { + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Trust.")); + return; + } + + if (args.length < 2) + { + UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to enemy.")); + return; + } + + ClansClan cB = Clans.CUtil().searchClanPlayer(caller, args[1], true); + + if (cB == null) + return; + + if (!cA.isAlly(cB.GetName())) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot give trust to enemies.")); + return; + } + + //Task + if (Clans.CTask().trust(cA, cB, caller.getName())) + { + //Inform + UtilPlayer.message(caller, F.main("Clans", "You gave trust to " + F.elem("Clan " + cB.GetName()) + ".")); + cA.inform(F.name(caller.getName()) + " has given trust to " + F.elem("Clan " + cB.GetName()) + ".", caller.getName()); + cB.inform(F.elem("Clan " + cA.GetName()) + " has given trust to you.", null); + } + else + { + //Inform + UtilPlayer.message(caller, F.main("Clans", "You revoked trust to " + F.elem("Clan " + cB.GetName()) + ".")); + cA.inform(F.name(caller.getName()) + " has revoked trust to " + F.elem("Clan " + cB.GetName()) + ".", caller.getName()); + cB.inform(F.elem("Clan " + cA.GetName()) + " has revoked trust to you.", null); + } + } + + public void neutral(Player caller, String[] args) + { + CoreClient client = Clans.Clients().Get(caller); + ClansClan cA = Clans.getClan(client.Clan().GetClanName()); + + if (cA == null) + { + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + + if (cA.GetMembers().get(caller.getName()) != Role.LEADER && cA.GetMembers().get(caller.getName()) != Role.ADMIN) + { + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage relationships.")); + return; + } + + if (args.length < 2) + { + UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to set neutrality with.")); + return; + } + + ClansClan cB = Clans.CUtil().searchClanPlayer(caller, args[1], true); + + if (cB == null) + return; + + if (cB.isSelf(cA.GetName())) + { + UtilPlayer.message(caller, F.main("Clans", "You prefer to think of yourself positively...")); + return; + } + + if (cB.isNeutral(cA.GetName())) + { + UtilPlayer.message(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.GetName()) + ".")); + return; + } + + if (cB.isAlly(cA.GetName())) + { + //Task + Clans.CTask().neutral(cA, cB, caller.getName(), true); + + //Inform + UtilPlayer.message(caller, F.main("Clans", "You revoked alliance with " + F.elem("Clan " + cB.GetName()) + ".")); + cA.inform(F.name(caller.getName()) + " revoked alliance with " + F.elem("Clan " + cB.GetName()) + ".", caller.getName()); + cB.inform(F.elem("Clan " + cA.GetName()) + " has revoked alliance with you.", null); + + return; + } + + if (cA.GetEnemyOut().containsKey(cB.GetName())) + { + //Task + Clans.CTask().neutral(cA, cB, caller.getName(), false); + + //Inform + UtilPlayer.message(caller, F.main("Clans", "You ended invasion on " + F.elem("Clan " + cB.GetName()) + ".")); + cA.inform(F.name(caller.getName()) + " ended invasion on " + F.elem("Clan " + cB.GetName()) + ".", caller.getName()); + cB.inform(F.elem("Clan " + cA.GetName()) + " has ended invasion on you.", null); + + return; + } + } + + public void enemy(Player caller, String[] args) + { + CoreClient client = Clans.Clients().Get(caller); + ClansClan cA = Clans.getClan(client.Clan().GetClanName()); + + if (cA == null) + { + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + + if (cA.GetMembers().get(caller.getName()) != Role.LEADER && cA.GetMembers().get(caller.getName()) != Role.ADMIN) + { + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage invasions.")); + return; + } + + if (cA.getWars() >= cA.getWarsMax()) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot invade more Clans.")); + return; + } + + if (args.length < 2) + { + UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to invade.")); + return; + } + + ClansClan cB = Clans.CUtil().searchClanPlayer(caller, args[1], true); + + if (cB == null) + return; + + if (cA.GetEnemyRecharge().containsKey(cB.GetName())) + { + long time = cA.GetEnemyRecharge().get(cB.GetName()); + if (System.currentTimeMillis() < time) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot invade " + F.elem("Clan " + cB.GetName()) + " for " + + F.time(UtilTime.convertString(time - System.currentTimeMillis(), 1, TimeUnit.FIT)) + "." )); + return; + } + } + + if (cA.isSelf(cB.GetName())) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot invade yourself.")); + return; + } + + if (cA.GetEnemyOut().containsKey(cB.GetName())) + { + UtilPlayer.message(caller, F.main("Clans", "You are already invading " + F.elem("Clan " + cB.GetName()) + ".")); + return; + } + + if (cA.isAlly(cB.GetName())) + { + UtilPlayer.message(caller, F.main("Clans", "You must end alliance with " + F.elem("Clan " + cB.GetName()) + " first.")); + return; + } + + ClansWar war = new ClansWar(Clans, cA, cB, 0, System.currentTimeMillis()); + + //Task + Clans.CTask().enemy(war, caller.getName()); + + //Inform + UtilPlayer.message(caller, F.main("Clans", "You started invasion on " + F.elem("Clan " + cB.GetName()) + ".")); + cA.inform(F.name(caller.getName()) + " started invasion on " + F.elem("Clan " + cB.GetName()) + ".", caller.getName()); + cB.inform(F.elem("Clan " + cA.GetName()) + " has started an invasion on you.", null); + } + + public void claim(Player caller, String args[]) + { + ClansClan clan = Clans.CUtil().getClanByPlayer(caller); + + if (clan == null) + { + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + + if (clan.GetMembers().get(caller.getName()) != Role.LEADER && clan.GetMembers().get(caller.getName()) != Role.ADMIN) + { + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can claim Territory.")); + return; + } + + if (caller.getLocation().getChunk().getX() < -24 || + caller.getLocation().getChunk().getX() > 23 || + caller.getLocation().getChunk().getZ() < -24 || + caller.getLocation().getChunk().getZ() > 23) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot claim Territory this far away.")); + return; + } + + for (ClansOutpost outpost : Clans.GetOutpostMap().values()) + { + if (outpost.GetLocation().getChunk().equals(caller.getLocation().getChunk())) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot claim Territory containing a Clan Outpost.")); + return; + } + } + + String chunk = UtilWorld.chunkToStr(caller.getLocation().getChunk()); + ClansClan ownerClan = Clans.CUtil().getOwner(caller.getLocation()); + + //Try to Steal + if (ownerClan != null && !ownerClan.equals(clan)) + if (unclaimSteal(caller, clan, ownerClan)) + { + return; + } + else + { + UtilPlayer.message(caller, F.main("Clans", "This Territory is owned by " + + Clans.CUtil().mRel(Clans.CUtil().relPC(caller.getName(), ownerClan), ownerClan.GetName(), true) + ".")); + return; + } + + if (clan.getClaims() >= clan.getClaimsMax()) + { + UtilPlayer.message(caller, F.main("Clans", "Your Clan cannot claim more Territory.")); + return; + } + + //Boxed + if (checkBox(caller.getLocation().getChunk(), 4)) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot claim this Territory, it causes a box.")); + UtilPlayer.message(caller, F.main("Clans", "This means a Territory has all sides claimed.")); + return; + } + + //Adjacent + boolean selfAdj = false; + for (int x=-1 ; x<=1 ; x++) + for (int z=-1 ; z<=1 ; z++) + { + if (x== 0 && z == 0) + continue; + + String other = UtilWorld.chunkToStr(caller.getWorld().getChunkAt( + caller.getLocation().getChunk().getX()+x, + caller.getLocation().getChunk().getZ()+z)); + + ClansClan adjClan = Clans.CUtil().getOwner(other); + + if (adjClan == null) + continue; + + if (x == 0 || z == 0) + { + if (checkBox(caller.getWorld().getChunkAt( + caller.getLocation().getChunk().getX()+x, + caller.getLocation().getChunk().getZ()+z), 3)) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot claim this Territory, it causes a box.")); + UtilPlayer.message(caller, F.main("Clans", "This means a Territory has all sides claimed.")); + return; + } + + if (Clans.CUtil().rel(clan, adjClan) == ClanRelation.SELF) + { + selfAdj = true; + } + + else if (Clans.CUtil().rel(clan, adjClan) != ClanRelation.SELF) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot claim Territory next to " + + Clans.CUtil().mRel(Clans.CUtil().rel(ownerClan, adjClan), adjClan.GetName(), true) + ".")); + return; + } + } + } + + //Not Next to Self + if (!selfAdj && !clan.GetClaimSet().isEmpty()) + { + UtilPlayer.message(caller, F.main("Clans", "You must claim next to your other Territory.")); + return; + } + + //Claim Timer + if (Clans.GetUnclaimMap().containsKey(chunk)) + { + if (!UtilTime.elapsed(Clans.GetUnclaimMap().get(chunk), Clans.GetReclaimTime())) + { + UtilPlayer.message(caller, F.main("Clans", "This Territory cannot be claimed for " + + F.time(UtilTime.convertString(Clans.GetReclaimTime() - (System.currentTimeMillis()-Clans.GetUnclaimMap().get(chunk)), 1, TimeUnit.FIT)) + ".")); + + return; + } + else + { + Clans.GetUnclaimMap().remove(chunk); + } + } + + //Enemies in Land + for (Player cur : UtilServer.getPlayers()) + if (UtilMath.offset(cur, caller) < 16) + if (Clans.CUtil().playerEnemy(caller.getName(), cur.getName())) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot claim while enemies are nearby.")); + return; + } + + //Recharge + if (!Clans.Recharge().use(caller, "Territory Claim", 60000, true)) + return; + + //Task + Clans.CTask().claim(clan.GetName(), chunk, caller.getName(), false); + + //Inform + UtilPlayer.message(caller, F.main("Clans", "You claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".")); + clan.inform(F.name(caller.getName()) + " claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName()); + } + + public boolean checkBox(Chunk chunk, int req) + { + int boxed = 0; + for (int x=-1 ; x<=1 ; x++) + for (int z=-1 ; z<=1 ; z++) + { + if (x == 0 && z == 0 || x != 0 && z != 0) + continue; + + String other = UtilWorld.chunkToStr(chunk.getWorld().getChunkAt( + chunk.getX()+x, chunk.getZ()+z)); + + ClansClan adjClan = Clans.CUtil().getOwner(other); + + if (adjClan == null) + continue; + + boxed++; + } + + return (boxed >= req); + } + + public void unclaim(Player caller, String args[]) + { + if (args.length > 1) + { + if (args[1].equalsIgnoreCase("all") || args[1].equalsIgnoreCase("a")) + { + unclaimall(caller); + return; + } + } + + ClansClan clan = Clans.CUtil().getClanByPlayer(caller); + + if (clan == null) + { + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + + String chunk = UtilWorld.chunkToStr(caller.getLocation().getChunk()); + ClansClan ownerClan = Clans.CUtil().getOwner(caller.getLocation()); + + //Try to Steal + if (ownerClan != null && !ownerClan.equals(clan)) + if (unclaimSteal(caller, clan, ownerClan)) + return; + + //Role + if (clan.GetMembers().get(caller.getName()) != Role.LEADER && clan.GetMembers().get(caller.getName()) != Role.ADMIN) + { + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can unclaim Territory.")); + return; + } + + //Not Claimed + if (ownerClan == null || !ownerClan.equals(clan)) + { + UtilPlayer.message(caller, F.main("Clans", "This Territory is not owned by you.")); + return; + } + + //Task + Clans.CTask().unclaim(chunk, caller.getName(), true); + + //Inform + UtilPlayer.message(caller, F.main("Clans", "You unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".")); + clan.inform(F.name(caller.getName()) + " unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName()); + } + + public boolean unclaimSteal(Player caller, ClansClan clientClan, ClansClan ownerClan) + { + if (!ownerClan.isEnemy(clientClan.GetName()) && !ownerClan.isNeutral(clientClan.GetName())) + return false; + + if (ownerClan.getClaims() > ownerClan.getClaimsMax()) + { + //Nothing Extra + } + else if (ownerClan.getPower() <= 0) + { + //Regen Power + ownerClan.modifyPower(1); + } + else + { + return false; + } + + //Change Inform + UtilPlayer.message(caller, F.main("Clans", "You can no longer 'steal' territory. " + + "You simply unclaim it and it can not be reclaimed by anyone for 30 mintes." + + "This was done to improve gameplay. Enjoy!")); + + //Inform + UtilServer.broadcast(F.main("Clans", F.elem(clientClan.GetName()) + " unclaimed from " + + F.elem(ownerClan.GetName()) + " at " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + ".")); + + //Unclaim + Clans.CTask().unclaim(UtilWorld.chunkToStr(caller.getLocation().getChunk()), caller.getName(), true); + + return true; + } + + public void unclaimall(Player caller) + { + ClansClan clan = Clans.CUtil().getClanByPlayer(caller); + + if (clan == null) + { + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + + if (clan.GetMembers().get(caller.getName()) != Role.LEADER) + { + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader can unclaim all Territory.")); + return; + } + + //Unclaim + ArrayList toUnclaim = new ArrayList(); + + for (String chunk : clan.GetClaimSet()) + toUnclaim.add(chunk); + + for (String chunk : toUnclaim) + Clans.CTask().unclaim(chunk, caller.getName(), true); + + //Inform + UtilPlayer.message(caller, F.main("Clans", "You unclaimed all your Clans Territory.")); + clan.inform(F.name(caller.getName()) + " unclaimed all your Clans Territory.", caller.getName()); + } + + public void map(Player caller, String[] args) + { + if (args.length > 1) + { + if (args[1].equals("toggle") || args[1].equals("t")) + { + Clans.Clients().Get(caller).Clan().SetMapOn(!Clans.Clients().Get(caller).Clan().IsMapOn()); + UtilPlayer.message(caller, + F.main("Clans", "You toggled Clan Map: " + F.oo(Clans.Clients().Get(caller).Clan().IsMapOn()))); + return; + } + } + + //Display + Clans.CDisplay().displayOwner(caller); + Clans.CDisplay().displayMap(caller); + } + + public void home(Player caller, String[] args) + { + if (args.length > 1) + { + if (args[1].equalsIgnoreCase("set") || args[1].equalsIgnoreCase("s")) + { + homeSet(caller); + return; + } + } + + ClansClan clan = Clans.CUtil().getClanByPlayer(caller); + + if (clan == null) + { + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + + if (clan.GetHome() == null) + { + UtilPlayer.message(caller, F.main("Clans", "Your Clan has not set a Home.")); + return; + } + + if (!clan.GetClaimSet().contains(UtilWorld.chunkToStr(clan.GetHome().getChunk()))) + { + UtilPlayer.message(caller, F.main("Clans", "Your Clan has lost its Home Territory.")); + return; + } + + if (!Clans.CUtil().isSafe(caller.getLocation())) + { + UtilPlayer.message(caller, F.main("Clans", "You can only use Clan Home from Spawn.")); + return; + } + + if (!Clans.CUtil().isSpecial(caller.getLocation(), "Spawn")) + { + UtilPlayer.message(caller, F.main("Clans", "You can only use Clan Home from Spawn.")); + return; + } + + /* + CoreClient client = Clans.Clients().Get(caller); + for (Player cur : clan.GetHome().getWorld().getPlayers()) + if (client.Clan().GetRelation(cur.getName()) == ClanRelation.NEUTRAL) + if (clan.GetClaimSet().contains(UtilWorld.chunkToStr(cur.getLocation().getChunk()))) + { + UtilPlayer.message(caller, F.main("Clans", "You cannot use Clan Home with enemies in your Territory.")); + return; + } + */ + + if (!Clans.Recharge().use(caller, "Clans Teleport", 300000, true)) + return; + + //Do + Clans.Teleport().TP(caller, clan.GetHome()); + + //Inform + UtilPlayer.message(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + ".")); + } + + public void outpost(Player caller) + { + + ClansClan clan = Clans.CUtil().getClanByPlayer(caller); + + if (clan == null) + { + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + + if (clan.GetOutpost() == null) + { + UtilPlayer.message(caller, F.main("Clans", "Your Clan does not have an Outpost.")); + return; + } + + if (!Clans.CUtil().isSafe(caller.getLocation())) + { + UtilPlayer.message(caller, F.main("Clans", "You can only use Clan Home from Spawn.")); + return; + } + + if (!Clans.CUtil().isSpecial(caller.getLocation(), "Spawn")) + { + UtilPlayer.message(caller, F.main("Clans", "You can only use Clan Home from Spawn.")); + return; + } + + if (!Clans.Recharge().use(caller, "Clans Teleport", 300000, true)) + return; + + //Do + Clans.Teleport().TP(caller, clan.GetOutpost().GetLocation()); + + //Inform + UtilPlayer.message(caller, F.main("Clans", "You teleported to your Clan Outpost " + UtilWorld.locToStrClean(caller.getLocation()) + ".")); + } + + public void homeSet(Player caller) + { + ClansClan clan = Clans.CUtil().getClanByPlayer(caller); + + if (clan == null) + { + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + + if (clan.GetMembers().get(caller.getName()) != Role.LEADER && clan.GetMembers().get(caller.getName()) != Role.ADMIN) + { + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Clan Home.")); + return; + } + + if (Clans.CUtil().getOwner(caller.getLocation()) == null) + { + UtilPlayer.message(caller, F.main("Clans", "You must set your Clan Home in your own Territory.")); + return; + } + + if (!Clans.CUtil().getOwner(caller.getLocation()).isSelf(clan.GetName())) + { + UtilPlayer.message(caller, F.main("Clans", "You must set your Clan Home in your own Territory.")); + return; + } + + //Task + Clans.CTask().home(clan, caller.getLocation(), caller.getName()); + + //Inform + UtilPlayer.message(caller, F.main("Clans", "You set Clan Home to " + UtilWorld.locToStrClean(caller.getLocation()) + ".")); + clan.inform(caller.getName() + " set Clan Home to " + UtilWorld.locToStrClean(caller.getLocation()) + ".", caller.getName()); + } + + + public void infoClan(Player caller, String search) + { + if (search == null) + { + UtilPlayer.message(caller, F.main("Clans", "You did not input a search parameter.")); + return; + } + + ClansClan clan = Clans.CUtil().searchClanPlayer(caller, search, true); + if (clan == null) + return; + + UtilPlayer.message(caller, clan.mDetails(caller.getName())); + } + + public void infoTerritory(Player caller, String[] args) + { + ClansClan clan; + if (args.length < 2) + { + clan = Clans.CUtil().getClanByPlayer(caller); + + if (clan == null) + { + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + return; + } + } + + else + clan = Clans.CUtil().searchClan(caller, args[1], true); + + if (clan == null) + return; + + UtilPlayer.message(caller, clan.mTerritory()); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansDisplay.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansDisplay.java new file mode 100644 index 000000000..9e46e0454 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansDisplay.java @@ -0,0 +1,262 @@ +package nautilus.game.pvp.modules.clans; + +import java.util.LinkedList; + +import mineplex.core.account.CoreClient; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import nautilus.game.pvp.modules.clans.ClansUtility.ClanRelation; + +import org.bukkit.Chunk; +import org.bukkit.Material; +import org.bukkit.World.Environment; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerInteractEvent; + +public class ClansDisplay +{ + private Clans Clans; + public ClansDisplay(Clans clans) + { + Clans = clans; + } + + public void Update(Player player) + { + if (player.getWorld().getEnvironment() != Environment.NORMAL) + return; + + CoreClient client = Clans.Clients().Get(player); + if (client == null) return; + + //Same Chunk + if (client.Clan().GetTerritory().equals(UtilWorld.chunkToStr(player.getLocation().getChunk()))) + return; + + //Update Territory + client.Clan().SetTerritory(UtilWorld.chunkToStr(player.getLocation().getChunk())); + + //AutoClaim + if (client.Clan().IsAutoClaim()) + Clans.CAdmin().claim(player); + + //Map + String owner = "?"; + ClansClan ownerClan = Clans.CUtil().getOwner(player.getLocation()); + if (ownerClan != null) + owner = ownerClan.GetName(); + + boolean safe = Clans.CUtil().isSafe(player); + + if (!client.Clan().IsMapOn()) + { + boolean showChange = false; + + //Owner Change + if (!client.Clan().GetOwner().equals(owner)) + { + client.Clan().SetOwner(owner); + showChange = true; + } + + //Safe Change + if (safe != client.Clan().IsSafe()) + { + client.Clan().SetSafe(safe); + showChange = true; + } + + if (showChange) + displayOwner(player); + } + else + { + displayOwner(player); + displayMap(player); + } + } + + public void displayOwner(Player player) + { + //Name + String ownerString = C.xWilderness + "Wilderness"; + + ClansTerritory claim = Clans.CUtil().getClaim(player.getLocation()); + String append = ""; + if (claim != null) + { + //Relation + ClanRelation relation = Clans.CUtil().relPT(player.getName(), claim.chunk); + + //Name + ownerString = Clans.CUtil().mRel(relation, claim.getOwner(), false); + + //Trust + if (relation == ClanRelation.ALLY_TRUST) + append = C.mBody + "(" + C.mElem + "Trusted" + C.mBody + ")"; + + //Dom + if (relation == ClanRelation.ENEMY) + { + ClansClan clientClan = Clans.CUtil().getClanByPlayer(player); + + if (clientClan != null) + { + ClansClan ownerClan = Clans.CUtil().getClanByClanName(claim.owner); + if (ownerClan != null) + append = clientClan.getDominanceString(ownerClan); + } + } + } + + UtilPlayer.message(player, F.main("Clans", ownerString + " " + append)); + } + + public int width = 8; + public int height = 4; + + public void displayMap(Player player) + { + if (player.getWorld().getEnvironment().equals(Environment.NETHER)) + return; + + //Get Local + LinkedList local = mLocalMap(player, player.getLocation().getChunk(), true); + + //Get Home + LinkedList home = null; + + if (player.getItemInHand().getType() == Material.MAP) + { + ClansClan clan = Clans.CUtil().getClanByPlayer(player); + if (clan != null) + if (clan.GetHome() != null) + home = mLocalMap(player, clan.GetHome().getChunk(), false); + } + + //Display + if (home == null || local.size() != home.size()) + UtilPlayer.message(player, local); + + else + for (int i = 0 ; i < local.size() ; i++) + UtilPlayer.message(player, local.get(i) + " " + home.get(i)); + } + + public LinkedList mLocalMap(Player player, Chunk chunk, boolean local) + { + if (chunk == null) + return null; + + LinkedList localMap = new LinkedList(); + + for (int i=(chunk.getX()-height) ; i <= (chunk.getX()+height) ; i++) + { + String output = C.xNone + "<"; + + for (int j=(chunk.getZ()+width) ; j >= (chunk.getZ()-width) ; j--) + { + Chunk curChunk = player.getWorld().getChunkAt(i, j); + + //Count Players + int pCount = 0; + if (player.getItemInHand().getType() == Material.MAP) + { + for (Player cur : UtilServer.getPlayers()) + if (cur.getLocation().getChunk().toString().equals(curChunk.toString())) + pCount++; + } + + //Get Data + ClansClan curOwner = Clans.CUtil().getOwner(UtilWorld.chunkToStr(curChunk)); + ClansTerritory curClaim = Clans.CUtil().getClaim(UtilWorld.chunkToStr(curChunk)); + + //Add Icon + if (i == chunk.getX() && j == chunk.getZ()) + output += getMapIcon(Clans.CUtil().relPC(player.getName(), curOwner), curClaim, curOwner, curChunk, pCount, true, local); + else + output += getMapIcon(Clans.CUtil().relPC(player.getName(), curOwner), curClaim, curOwner, curChunk, pCount, false, local); + } + + output += ">"; + + //Send + localMap.add(output); + } + + return localMap; + } + + public String getMapIcon(ClanRelation relation, ClansTerritory claim, ClansClan owner, Chunk chunk, int players, boolean mid, boolean local) + { + if (players > 9) + players = 9; + + if (mid && local) + { + if (players > 0) return "" + C.cWhite + players; + else return "" + C.cWhite + "X"; + } + + if (owner == null || claim == null) + { + if (players > 0) return "" + C.xNone + players; + else return "" + C.xNone + "-"; + } + + if (claim.safe) + { + if (players > 0) return "" + C.xSafe + players; + else return "" + C.xSafe + "S"; + } + + if (owner.IsAdmin()) + { + if (players > 0) return "" + C.xAdmin + players; + else return "" + C.xAdmin + "+"; + } + + + if (relation == ClanRelation.SELF) + { + if (players > 0) return "" + C.xSelf + players; + else if (Clans.CUtil().isChunkHome(owner, chunk)) return "" + C.xSelf + "H"; + else return "" + C.xSelf + "#"; + } + + if (relation == ClanRelation.ALLY) + { + if (players > 0) return "" + C.xAlly + players; + else if (Clans.CUtil().isChunkHome(owner, chunk)) return "" + C.xAlly + "H"; + else return "" + C.xAlly + "#"; + } + + if (relation == ClanRelation.ALLY_TRUST) + { + if (players > 0) return "" + C.xdAlly + players; + else if (Clans.CUtil().isChunkHome(owner, chunk)) return "" + C.xdAlly + "H"; + else return "" + C.xdAlly + "#"; + } + + if (players > 0) return "" + C.xEnemy + players; + else if (Clans.CUtil().isChunkHome(owner, chunk)) return "" + C.xEnemy + "H"; + else return "" + C.xEnemy + "#"; + } + + public void handleInteract(PlayerInteractEvent event) + { + if (event.getPlayer().getItemInHand().getType() != Material.MAP) + return; + + if (!Clans.Recharge().use(event.getPlayer(), "Clan Map", 500, false)) + return; + + displayOwner(event.getPlayer()); + displayMap(event.getPlayer()); + } + + +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansGame.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansGame.java new file mode 100644 index 000000000..790be1c2a --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansGame.java @@ -0,0 +1,543 @@ +package nautilus.game.pvp.modules.clans; + +import nautilus.game.pvp.modules.clans.ClansClan.Role; +import nautilus.game.pvp.modules.clans.ClansUtility.ClanRelation; + +import org.bukkit.Effect; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World.Environment; +import org.bukkit.block.Block; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockIgniteEvent; +import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; +import org.bukkit.event.block.BlockPistonExtendEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import me.chiss.Core.Combat.Event.CombatDeathEvent; +import mineplex.minecraft.game.core.classcombat.SkillTriggerEvent; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.blockrestore.BlockRestoreData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.itemstack.ItemStackFactory; + +public class ClansGame +{ + private Clans Clans; + public ClansGame(Clans clans) + { + Clans = clans; + } + + //Player Chunk Display + public void UpdateDisplay() + { + for (Player cur : UtilServer.getPlayers()) + Clans.CDisplay().Update(cur); + } + + public void UpdateSafe() + { + for (Player cur : UtilServer.getPlayers()) + if (Clans.CUtil().isSafe(cur.getLocation())) + { + ClansClan clan = Clans.CUtil().getClanByPlayer(cur); + if (clan != null) + if (!clan.GetEnemyEvent().isEmpty()) + { + UtilPlayer.message(cur, F.main("Safe Zone", "You are not safe during invasions.")); + return; + } + + + long lastDamager = Clans.Clients().Get(cur).Player().GetLastDamager(); + + if (!UtilTime.elapsed(lastDamager, 15000)) + { + UtilPlayer.message(cur, F.main("Safe Zone", "You are not safe for " + + F.time(UtilTime.convertString(15000 - (System.currentTimeMillis() - lastDamager), 1, TimeUnit.FIT)))); + + Clans.Condition().Factory().Custom("Unsafe", cur, cur, ConditionType.CUSTOM, 1, 0, false, Material.FIRE, (byte)0, true); + } + } + } + + public void SafeSkill(SkillTriggerEvent event) + { + if (!Clans.CUtil().isSafe(event.GetPlayer())) + return; + + UtilPlayer.message(event.GetPlayer(), F.main("Safe Zone", "You cannot use " + F.skill(event.GetSkillName() + " in " + F.elem("Safe Zone") + "."))); + + event.SetCancelled(true); + } + + public void BlockBurn(BlockBurnEvent event) + { + if (Clans.CUtil().isBorderlands(event.getBlock().getLocation())) + event.setCancelled(true); + } + + public void BlockSpread(BlockIgniteEvent event) + { + if (event.getCause() == IgniteCause.SPREAD) + if (Clans.CUtil().isBorderlands(event.getBlock().getLocation())) + event.setCancelled(true); + } + + //Block Place (After Interact) + public void BlockPlace(BlockPlaceEvent event) + { + if (event.getBlock().getType() != Material.LADDER) + return; + + if (Clans.CUtil().getAccess(event.getPlayer(), event.getBlock().getLocation()) == ClanRelation.SELF) + return; + + final Block block = event.getBlock(); + + UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Clans.Plugin(), new Runnable() + { + public void run() + { + Clans.BlockRestore().Add(block, 65, block.getData(), 30000); + + BlockRestoreData data = Clans.BlockRestore().GetData(block); + if (data != null) + { + data.setFromId(0); + data.setFromData((byte)0); + } + } + }, 0); + + } + + //Block Break + public void BlockBreak(BlockBreakEvent event) + { + if (event.getPlayer().getWorld().getEnvironment() != Environment.NORMAL) + return; + + //Borderlands + if (Clans.CUtil().isBorderlands(event.getBlock().getLocation()) && event.getPlayer().getGameMode() != GameMode.CREATIVE) + { + //Disallow + event.setCancelled(true); + + //Inform + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You can not break " + + F.elem(ItemStackFactory.Instance.GetName(event.getBlock(), true)) + + " in " + + F.elem("Borderlands") + + ".")); + return; + } + + if (Clans.CBlocks().canBreak(event.getBlock().getTypeId())) + return; + + if (Clans.CUtil().getAccess(event.getPlayer(), event.getBlock().getLocation()) == ClanRelation.SELF) + { + //Disallow Shops + if (event.getBlock().getType() == Material.ENDER_CHEST || event.getBlock().getType() == Material.ENCHANTMENT_TABLE) + if (Clans.CUtil().isSafe(event.getBlock().getLocation())) + { + //Disallow + event.setCancelled(true); + + //Inform + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You can not break " + + F.elem(ItemStackFactory.Instance.GetName(event.getBlock(), true)) + + " in " + + Clans.CUtil().getOwnerStringRel(event.getBlock().getLocation(), event.getPlayer().getName()) + + ".")); + } + + //Disallow Recruit Chest + if (Clans.CUtil().isClaimed(event.getBlock().getLocation())) + if (event.getBlock().getTypeId() == 54) + { + if (Clans.CUtil().getRole(event.getPlayer()) == Role.RECRUIT) + { + //Disallow + event.setCancelled(true); + + //Inform + UtilPlayer.message(event.getPlayer(), F.main("Clans", "Clan Recruits cannot break " + + F.elem(ItemStackFactory.Instance.GetName(event.getBlock(), true)) + ".")); + } + } + + //Allow + return; + } + + //Disallow + event.setCancelled(true); + + //Inform + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You can not break " + + F.elem(ItemStackFactory.Instance.GetName(event.getBlock(), true)) + + " in " + + Clans.CUtil().getOwnerStringRel(event.getBlock().getLocation(), event.getPlayer().getName()) + + ".")); + } + + public void Damage(CustomDamageEvent event) + { + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + if (Clans.CUtil().isSafe(damagee)) + event.SetCancelled("Safe Zone"); + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + if (!Clans.CUtil().canHurt(damagee, damager)) + { + //Cancel + event.SetCancelled("Clans Ally"); + + //Inform + if (damager != null) + { + ClanRelation rel = Clans.GetRelation(damagee.getName(), damager.getName()); + UtilPlayer.message(damager, F.main("Clans", + "You cannot harm " + Clans.CUtil().mRel(rel, damagee.getName(), false) + ".")); + } + } + } + + public void DeathDominance(CombatDeathEvent event) + { + if (!(event.GetEvent().getEntity() instanceof Player)) + return; + + Player player = (Player)event.GetEvent().getEntity(); + + ClansClan clan = Clans.CUtil().getClanByPlayer(player); + if (clan == null) + return; + + //Lose Power + if (Clans.IsPowerEnabled()) + clan.modifyPower(-1); + + //Dominance + if (clan.GetDateCreated() < 86400000) + return; + + if (event.GetLog().GetKiller() == null || !event.GetLog().GetKiller().IsPlayer()) + { + ClansClan territoryClan = Clans.CUtil().getOwner(player.getLocation()); + + if (territoryClan == null) + return; + + if (territoryClan.GetDateCreated() < 86400000) + return; + + if (!territoryClan.isOnlineNow()) + return; + + //Add Dominance + territoryClan.gainDominance(clan); + } + else + { + ClansClan killerClan = Clans.CUtil().getClanByPlayer(event.GetLog().GetKiller().GetName()); + + if (killerClan == null) + return; + + if (killerClan.IsAdmin()) + return; + + if (killerClan.GetDateCreated() < 86400000) + return; + + if (!killerClan.isOnlineNow()) + return; + + //Add Dominance + killerClan.gainDominance(clan); + } + } + + public void DeathColor(CombatDeathEvent event) + { + event.GetLog().SetClans(true); + } + + //Block Interact and Placement + public void Interact(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (player.getWorld().getEnvironment() != Environment.NORMAL) + return; + + if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.LEFT_CLICK_BLOCK) + return; + + //Block Interaction + Location loc = event.getClickedBlock().getRelative(event.getBlockFace()).getLocation(); + if (UtilBlock.usable(event.getClickedBlock())) loc = event.getClickedBlock().getLocation(); + + //Borderlands + if ( player.getGameMode() != GameMode.CREATIVE && + player.getItemInHand() != null && + Clans.CBlocks().denyUsePlace(player.getItemInHand().getTypeId()) && + Clans.CUtil().isBorderlands(event.getClickedBlock().getLocation())) + { + //Disallow + event.setCancelled(true); + + //Inform + UtilPlayer.message(player, F.main("Clans", "You cannot use/place " + + F.elem(ItemStackFactory.Instance.GetName(event.getClickedBlock(), true)) + + " in " + + F.elem("Borderlands") + + ".")); + + return; + } + + ClanRelation access = Clans.CUtil().getAccess(player, loc); + + //Hoe Return + if (access != ClanRelation.SELF && !UtilBlock.usable(event.getClickedBlock())) + { + if (Clans.Util().Gear().isHoe(player.getItemInHand())) + { + event.setCancelled(true); + return; + } + } + + //Full Access + if (access == ClanRelation.SELF) + { + //Recruits cannot open Chests + if (event.getClickedBlock().getTypeId() == 54) + { + if (Clans.CUtil().getRole(player) == Role.RECRUIT) + { + //Disallow + event.setCancelled(true); + + //Inform + UtilPlayer.message(player, F.main("Clans", "Clan Recruits cannot access " + + F.elem(ItemStackFactory.Instance.GetName(event.getClickedBlock(), true)) + + ".")); + } + } + + //Wilderness Adjacent + if ( event.getAction() == Action.RIGHT_CLICK_BLOCK && + !UtilBlock.usable(event.getClickedBlock()) && + player.getItemInHand() != null && + Clans.CBlocks().denyUsePlace(player.getItemInHand().getTypeId()) && + !Clans.CUtil().isClaimed(loc)) + { + + String enemy = null; + boolean self = false; + + for (int x=-1 ; x<=1 ; x++) + for (int z=-1 ; z<=1 ; z++) + { + if (self) + continue; + + if (x != 0 && z != 0 || x == 0 && z == 0) + continue; + + Location sideLoc = new Location(loc.getWorld(), loc.getX()+x, loc.getY(), loc.getZ()+z); + + if (Clans.CUtil().isSelf(player.getName(), sideLoc)) + self = true; + + if (enemy != null) + continue; + + if (Clans.CUtil().getAccess(player, sideLoc) != ClanRelation.SELF) + enemy = Clans.CUtil().getOwnerStringRel( + new Location(loc.getWorld(), loc.getX()+x, loc.getY(), loc.getZ()+z), + player.getName()); + } + + if (enemy != null && !self) + { + //Disallow + event.setCancelled(true); + + //Inform + UtilPlayer.message(player, F.main("Clans", "You cannot use/place " + + F.elem(ItemStackFactory.Instance.GetName(player.getItemInHand(), true)) + + " next to " + + enemy + + ".")); + + return; + } + } + + return; + } + + + //Deny Interaction + if (Clans.CBlocks().denyInteract(event.getClickedBlock().getTypeId())) + { + //Block Action + if (access == ClanRelation.NEUTRAL) + { + //Allow Field Chest + if (event.getClickedBlock().getTypeId() == 54) + if (Clans.CUtil().isSpecial(event.getClickedBlock().getLocation(), "Fields")) + return; + + //Disallow + event.setCancelled(true); + + //Inform + UtilPlayer.message(player, F.main("Clans", "You cannot use " + + F.elem(ItemStackFactory.Instance.GetName(event.getClickedBlock(), true)) + + " in " + + Clans.CUtil().getOwnerStringRel(event.getClickedBlock().getLocation(), + player.getName()) + + ".")); + + return; + } + //Block is not Trust Allowed + else if (!Clans.CBlocks().allowInteract(event.getClickedBlock().getTypeId()) || access != ClanRelation.ALLY_TRUST) + { + //Disallow + event.setCancelled(true); + + //Inform + UtilPlayer.message(player, F.main("Clans", "You cannot use " + + F.elem(ItemStackFactory.Instance.GetName(event.getClickedBlock(), true)) + + " in " + + Clans.CUtil().getOwnerStringRel(event.getClickedBlock().getLocation(), + player.getName()) + + ".")); + + return; + } + } + + //Block Placement + if (event.getAction() == Action.RIGHT_CLICK_BLOCK) + if (player.getItemInHand().getType() != Material.AIR) + if (Clans.CBlocks().denyUsePlace(player.getItemInHand().getTypeId())) + { + //Disallow + event.setCancelled(true); + + //Inform + UtilPlayer.message(player, F.main("Clans", "You cannot use/place " + + F.elem(ItemStackFactory.Instance.GetName(player.getItemInHand(), true)) + + " in " + + Clans.CUtil().getOwnerStringRel(event.getClickedBlock().getRelative(event.getBlockFace()).getLocation(), + player.getName()) + + ".")); + + return; + } + } + + + + public void Join(PlayerJoinEvent event) + { + Clans.CUtil().updateRelations(event.getPlayer()); + } + + public void Piston(BlockPistonExtendEvent event) + { + ClansClan pistonClan = Clans.CUtil().getOwner(event.getBlock().getLocation()); + + Block push = event.getBlock(); + for (int i=0 ; i<13 ; i++) + { + push = push.getRelative(event.getDirection()); + + Block front = push.getRelative(event.getDirection()).getRelative(event.getDirection()); + + if (push.getType() == Material.AIR) + return; + + ClansClan pushClan = Clans.CUtil().getOwner(front.getLocation()); + + if (pushClan == null) + continue; + + if (pushClan.IsAdmin()) + continue; + + if (pistonClan == null) + { + push.getWorld().playEffect(push.getLocation(), Effect.STEP_SOUND, push.getTypeId()); + event.setCancelled(true); + return; + } + + if (pistonClan.equals(pushClan)) + continue; + + push.getWorld().playEffect(push.getLocation(), Effect.STEP_SOUND, push.getTypeId()); + event.setCancelled(true); + return; + } + } + + public void Quit(PlayerQuitEvent event) + { + ClansClan clan = Clans.CUtil().getClanByPlayer(event.getPlayer()); + if (clan == null) return; + + clan.SetLastOnline(System.currentTimeMillis()); + } + + public void Explode(EntityExplodeEvent event) + { + try + { + if (event.getEntityType() != EntityType.PRIMED_TNT && event.getEntityType() != EntityType.MINECART_TNT) + return; + } + catch (Exception e) + { + return; + } + + ClansClan clan = Clans.CUtil().getOwner(event.getEntity().getLocation()); + if (clan == null) return; + + if (!clan.isOnline()) + event.setCancelled(true); + else + clan.inform(C.cRed + "Your Territory is under attack!", null); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansOutpost.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansOutpost.java new file mode 100644 index 000000000..a120c8bfa --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansOutpost.java @@ -0,0 +1,315 @@ +package nautilus.game.pvp.modules.clans; + +import java.util.ArrayList; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.FallingBlock; +import org.bukkit.util.Vector; + +public class ClansOutpost +{ + private static int size = 3; + + private ClansClan _clan; + private Location _block; + private long _created; + private int _state; + private ArrayList _build = new ArrayList(); + + public ClansOutpost(ClansClan clan, Location block, long created) + { + _clan = clan; + _block = block; + _created = created; + _state = 0; + + Build(); + + clan.Clans.GetOutpostMap().put(clan.GetName(), this); + } + + public void Build() + { + + _build = new ArrayList(); + + for (int y=-1 ; y <= 6 ; y++) + for (int x=-size ; x <= size ; x++) + for (int z=-size ; z <= size ; z++) + { + Location loc = new Location(_block.getWorld(), _block.getX()+x, _block.getY()+y, _block.getZ()+z); + + if (_clan.Clans.CUtil().isClaimed(loc)) + continue; + + //Clear + if (x != 0 || z != 0 || y != 0) + if (loc.getBlock().getTypeId() != 0) + _build.add(new ClansOutpostBlock(loc, 0, (byte)0)); + + //Floor + if (y == -1 && Math.abs(x) <= size-1 && Math.abs(z) <= size-1) + { + _build.add(new ClansOutpostBlock(loc, 98, (byte)0)); + } + + //Walls + if (Math.abs(x) == size || Math.abs(z) == size) + { + _build.add(new ClansOutpostBlock(loc, 98, (byte)0)); + } + + //Roof + if (y == 5 && Math.abs(x) <= size-1 && Math.abs(z) <= size-1) + { + _build.add(new ClansOutpostBlock(loc, 44, (byte)13)); + } + } + + for (int y=-1 ; y <= 6 ; y++) + for (int x=-size ; x <= size ; x++) + for (int z=-size ; z <= size ; z++) + { + Location loc = new Location(_block.getWorld(), _block.getX()+x, _block.getY()+y, _block.getZ()+z); + + if (_clan.Clans.CUtil().isClaimed(loc)) + continue; + + //Doors + if (y == 0 || y == 1) + { + if (x == 0 && z == size) + { + _build.add(new ClansOutpostBlock(loc, 71, (byte)(y * 8 + 2 + 4))); + } + if (x == 0 && z == -size) + { + _build.add(new ClansOutpostBlock(loc, 71, (byte)(y * 8 + 4))); + } + if (x == size && z == 0) + { + _build.add(new ClansOutpostBlock(loc, 71, (byte)(y * 8 + 3 + 4))); + } + if (x == -size && z == 0) + { + _build.add(new ClansOutpostBlock(loc, 71, (byte)(y * 8 + 1 + 4))); + } + } + + //Platform + if (y == 2) + { + if (Math.abs(x) == size-1 && Math.abs(z) < size) + { + _build.add(new ClansOutpostBlock(loc, 44, (byte)13)); + } + if (Math.abs(z) == size-1 && Math.abs(x) < size) + { + _build.add(new ClansOutpostBlock(loc, 44, (byte)13)); + } + } + + //Windows + if (y == 4) + { + if (Math.abs(x) == size && Math.abs(z) < size-1) + { + _build.add(new ClansOutpostBlock(loc, 0, (byte)0)); + } + if (Math.abs(z) == size && Math.abs(x) < size-1) + { + _build.add(new ClansOutpostBlock(loc, 0, (byte)0)); + } + } + + //Ladders + if (y >= 0 && y < 3) + { + if (x == size-1 && z == size-1) + { + _build.add(new ClansOutpostBlock(loc, 65, (byte)2)); + } + if (x == (-size)+1 && z == (-size)+1) + { + _build.add(new ClansOutpostBlock(loc, 65, (byte)3)); + } + } + + //Chests + if (y == 0) + { + if (x == size-1 && z == (-size)+1) + { + _build.add(new ClansOutpostBlock(loc, 54, (byte)0)); + } + if (x == (-size)+1 && z == size-1) + { + _build.add(new ClansOutpostBlock(loc, 54, (byte)0)); + } + + if (x == size-2 && z == (-size)+1) + { + _build.add(new ClansOutpostBlock(loc, 54, (byte)0)); + } + if (x == (-size)+2 && z == size-1) + { + _build.add(new ClansOutpostBlock(loc, 54, (byte)0)); + } + } + + //Beacon Floor + if (y == -1) + { + if (Math.abs(x) <= 1 && Math.abs(z) <= 1) + { + _build.add(new ClansOutpostBlock(loc, 42, (byte)0)); + } + } + + //Beacon Roof + if (y == 5) + { + if (Math.abs(x) == 1 && Math.abs(z) <= 1) + { + _build.add(new ClansOutpostBlock(loc, 98, (byte)0)); + } + if (Math.abs(z) == 1 && Math.abs(x) <= 1) + { + _build.add(new ClansOutpostBlock(loc, 98, (byte)0)); + } + } + + //Beacon Glass + if (y == 5 && x == 0 && z == 0) + { + _build.add(new ClansOutpostBlock(loc, 20, (byte)0)); + } + } + } + + public void BuildUpdate() + { + if (_build == null) + return; + + if (_build.isEmpty()) + return; + + ClansOutpostBlock block = _build.remove(0); + + block.Build(); + } + + public void Clean() + { + _build = new ArrayList(); + + for (int y=-1 ; y <= 6 ; y++) + for (int x=-size ; x <= size ; x++) + for (int z=-size ; z <= size ; z++) + { + Location loc = new Location(_block.getWorld(), _block.getX()+x, _block.getY()+y, _block.getZ()+z); + + if (_clan.Clans.CUtil().isClaimed(loc)) + continue; + + //Clear + if (loc.getBlock().getTypeId() == 0) + continue; + + if (loc.getBlock().getType() == Material.CHEST) + { + loc.getBlock().breakNaturally(); + continue; + } + + if (loc.getBlock().getType() == Material.BEACON) + { + loc.getBlock().setTypeId(0); + continue; + } + + if (loc.getBlock().getType() == Material.IRON_BLOCK) + { + loc.getBlock().setTypeId(98); + } + + _build.add(new ClansOutpostBlock(loc, loc.getBlock().getTypeId(), (byte)loc.getBlock().getData())); + loc.getBlock().setTypeId(0); + } + + for (ClansOutpostBlock block : _build) + { + //Block + FallingBlock fall = block.loc.getWorld().spawnFallingBlock(block.loc.add(0.5, 0.5, 0.5), block.id, block.data); + + Vector vec = UtilAlg.getTrajectory(_block, fall.getLocation()); + if (vec.getY() < 0) vec.setY(vec.getY() * -1); + + UtilAction.velocity(fall, vec, 1, false, 0, 0.6, 10, false); + + _clan.Clans.Explosion().GetExplosionBlocks().add(fall); + } + } + + public Location GetLocation() + { + return _block; + } + + public ClansClan GetClan() + { + return _clan; + } + + public long GetCreated() + { + return _created; + } + + public int GetState() + { + return _state; + } + + public boolean IsOn() + { + if (_block.getBlock().getType() != Material.BEACON) + return false; + + if (_block.getBlock().getLightFromSky() != (byte)15) + return false; + + for (int x=-1 ; x<=1 ; x++) + for (int z=-1 ; z<=1 ; z++) + { + if (_block.getBlock().getRelative(x, -1, z).getType() != Material.IRON_BLOCK) + return false; + } + + return true; + } + + public boolean Contains(Location loc) + { + if (Math.abs(loc.getBlockX() - _block.getBlockX()) > size) + return false; + + if (Math.abs(loc.getBlockZ() - _block.getBlockZ()) > size) + return false; + + if (loc.getBlockX() == _block.getBlockX()) + if (loc.getBlockZ() == _block.getBlockZ()) + if (loc.getBlockY() >= _block.getBlockY()) + return true; + + if (loc.getBlockY() < _block.getBlockY() - 1 || loc.getBlockY() > _block.getBlockY() + 6) + return false; + + return true; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansOutpostBlock.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansOutpostBlock.java new file mode 100644 index 000000000..32e648368 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansOutpostBlock.java @@ -0,0 +1,22 @@ +package nautilus.game.pvp.modules.clans; + +import org.bukkit.Location; + +public class ClansOutpostBlock +{ + Location loc; + int id; + byte data; + + public ClansOutpostBlock(Location loc, int id, byte data) + { + this.loc = loc; + this.id = id; + this.data = data; + } + + public void Build() + { + loc.getBlock().setTypeIdAndData(id, data, true); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansRepo.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansRepo.java new file mode 100644 index 000000000..21bea678c --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansRepo.java @@ -0,0 +1,131 @@ +package nautilus.game.pvp.modules.clans; + +import java.util.List; + +import nautilus.game.pvp.modules.clans.ClansClan.Role; +import nautilus.game.pvp.modules.clans.Tokens.AllianceToken; +import nautilus.game.pvp.modules.clans.Tokens.ClanMemberToken; +import nautilus.game.pvp.modules.clans.Tokens.ClanTerritoryToken; +import nautilus.game.pvp.modules.clans.Tokens.ClanToken; +import nautilus.game.pvp.modules.clans.Tokens.WarToken; + +import me.chiss.Core.Plugin.IPlugin; + +public class ClansRepo +{ + private Clans Clans; + public ClanRepository Repository; + + public ClansRepo(Clans clans) + { + Clans = clans; + Repository = new ClanRepository(((IPlugin)Clans.Plugin()).GetWebServerAddress()); + } + + public void loadClans() + { + List clanTokens = Repository.GetClans(Clans.GetServerName()); + + //Create Clans + for (ClanToken token : clanTokens) + { + //Create Clan + ClansClan clan = new ClansClan(Clans, token); + Clans.GetClanMap().put(clan.GetName(), clan); + + //Add Members + for (ClanMemberToken client : token.Members) + { + clan.GetMembers().put(client.Name, Role.valueOf(client.ClanRole.Name)); + Clans.GetClanMemberMap().put(client.Name, clan); + } + + //Add Territory + for (ClanTerritoryToken territory : token.Territories) + { + clan.GetClaimSet().add(territory.Chunk); + + //Register Claim + Clans.GetClaimMap().put(territory.Chunk, new ClansTerritory(Clans, clan.GetName(), territory.Chunk, territory.Safe)); + } + } + + //Add Relationships + for (ClanToken token : clanTokens) + { + ClansClan clan = Clans.getClan(token.Name); + if (clan == null) + { + System.out.println("Clans Load Error: Could not find Clan " + token.Name); + continue; + } + + for (AllianceToken alliance : token.Alliances) + { + ClansClan other = Clans.getClan(alliance.ClanName); + if (other == null) + { + System.out.println("Clans Load Error: Could not find Alliance Clan " + token.Name); + continue; + } + + clan.GetAllyMap().put(other.GetName(), alliance.Trusted); + } + + for (WarToken warToken : token.Wars) + { + ClansClan other = Clans.getClan(warToken.ClanName); + if (other == null) + { + System.out.println("Clans Load Error: Could not find War Clan " + token.Name); + continue; + } + + if (!warToken.Ended) + { + ClansWar war = new ClansWar(Clans, clan, other, warToken.Dominance, warToken.Created); + clan.GetEnemyOut().put(other.GetName(), war); + other.GetEnemyIn().put(clan.GetName(), war); + } + else + { + //Clan + if (clan.GetEnemyRecharge().containsKey(other.GetName())) + { + if (clan.GetEnemyRecharge().get(other.GetName()) < warToken.Cooldown) + clan.GetEnemyRecharge().put(other.GetName(), warToken.Cooldown); + } + else + { + clan.GetEnemyRecharge().put(other.GetName(), warToken.Cooldown); + } + //Other + if (other.GetEnemyRecharge().containsKey(clan.GetName())) + { + if (other.GetEnemyRecharge().get(clan.GetName()) < warToken.Cooldown) + other.GetEnemyRecharge().put(clan.GetName(), warToken.Cooldown); + } + else + { + other.GetEnemyRecharge().put(clan.GetName(), warToken.Cooldown); + } + } + } + } + } + + public void AddClan(ClanToken clanToken) + { + Repository.AddClan(clanToken); + } + + public void EditClan(ClanToken clanToken) + { + Repository.EditClan(clanToken); + } + + public void DeleteClan(ClanToken clanToken) + { + Repository.DeleteClan(clanToken); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansTask.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansTask.java new file mode 100644 index 000000000..ecf37d936 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansTask.java @@ -0,0 +1,404 @@ +package nautilus.game.pvp.modules.clans; + +import java.util.ArrayList; + +import nautilus.game.pvp.modules.clans.ClansClan.Role; +import nautilus.game.pvp.modules.clans.Tokens.ClanMemberToken; +import nautilus.game.pvp.modules.clans.Tokens.ClanRole; +import nautilus.game.pvp.modules.clans.Tokens.ClanToken; + +import org.bukkit.Chunk; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; + +import mineplex.core.account.CoreClient; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilWorld; + +public class ClansTask +{ + private Clans Clans; + public ClansTask(Clans clans) + { + Clans = clans; + } + + public void delete(ClansClan clan) + { + //Territory Unclaim + for (String cur : clan.GetClaimSet()) + Clans.GetClaimMap().remove(cur); + + Clans.GetClanMap().remove(clan.GetName()); + + for (String cur : clan.GetMembers().keySet()) + { + CoreClient client = Clans.Clients().GetNull(cur); + + Clans.GetClanMemberMap().remove(cur); + + if (client != null) + client.Clan().Update("", "", clan.getTimer()); + } + + //Clean from Others + for (ClansClan cur : Clans.GetClanMap().values()) + { + cur.GetAllyMap().remove(clan.GetName()); + cur.GetEnemyIn().remove(clan.GetName()); + cur.GetEnemyOut().remove(clan.GetName()); + cur.GetEnemyRecharge().remove(clan.GetName()); + cur.GetRequestMap().remove(clan.GetName()); + } + + //Save + Clans.CRepo().DeleteClan(clan.GetToken()); + + //Update Relations + for (String cur : clan.GetMembers().keySet()) + Clans.CUtil().updateRelations(cur); + + //Log + Clans.Log("Deleted [" + clan.GetName() + "]."); + } + + public ClansClan create(String creator, String name, boolean admin) + { + ClanToken token = new ClanToken(); + token.Name = name; + token.Description = "No Description"; + token.Home = ""; + token.Admin = admin; + token.DateCreated = System.currentTimeMillis(); + token.LastTimeOnline = System.currentTimeMillis(); + token.Power = 0; + + token.Members = new ArrayList(); + ClanMemberToken memberToken = new ClanMemberToken(); + memberToken.ClanRole = new ClanRole(); + memberToken.ClanRole.Name = Role.ADMIN.toString(); + memberToken.Name = creator; + + //Create Clan + ClansClan clan = new ClansClan(Clans, token); + Clans.GetClanMap().put(name, clan); + + //Save + Clans.CRepo().AddClan(token); + + //Update Relations + Clans.CUtil().updateRelations(creator); + + //Log + Clans.Log("[" + clan.GetName() + "] with Admin [" + admin + "] created by [" + creator + "]."); + + return clan; + } + + public void join(ClansClan clan, String player, Role role) + { + //Client + CoreClient client = Clans.Clients().Get(player); + + if (client.Clan().InClan()) + leave(Clans.CUtil().getClanByPlayer(player), player); + + //Update Clan + clan.GetMembers().put(player, role); + Clans.GetClanMemberMap().put(player, clan); + clan.GetInviteeMap().remove(player); + String inviter = clan.GetInviterMap().remove(player); + if (inviter == null) inviter = ""; + + //Update Client + client.Clan().Update(clan.GetName(), inviter, 0L); + + //Save + Clans.CRepo().EditClan(clan.GetToken()); + + //Update Relations + Clans.CUtil().updateRelations(player); + + //Log + Clans.Log("Added [" + player + "] to [" + clan.GetName() + "]."); + } + + public void leave(ClansClan clan, String player) + { + if (clan == null) + return; + + //Update Client + CoreClient client = Clans.Clients().Get(player); + if (client != null) + client.Clan().Update("", "", clan.getTimer()); + + //Update Clan + clan.GetMembers().remove(player); + Clans.GetClanMemberMap().remove(player); + + //Save + Clans.CRepo().EditClan(clan.GetToken()); + + //Update Relations + Clans.CUtil().updateRelations(player); + + //Log + Clans.Log("Removed [" + player + "] from [" + clan.GetName() + "]."); + } + + public void role(ClansClan clan, String player, Role role) + { + //Update Clan + clan.GetMembers().put(player, role); + + //Save + Clans.CRepo().EditClan(clan.GetToken()); + + //Log + Clans.Log("Removed [" + player + "] from [" + clan.GetName() + "]."); + } + + public void invite(ClansClan clan, String player, String inviter) + { + clan.GetInviteeMap().put(player, System.currentTimeMillis()); + clan.GetInviterMap().put(player, inviter); + + //Log + Clans.Log("Invited [" + player + "] to [" + clan.GetName() + "] by [" + inviter + "]."); + } + + public void requestAlly(ClansClan clan, ClansClan target, String player) + { + clan.GetRequestMap().put(target.GetName(), System.currentTimeMillis()); + + //Log + Clans.Log("Alliance Request to [" + target.GetName() + "] from [" + clan.GetName() + "] by [" + player + "]."); + } + + public void ally(ClansClan cA, ClansClan cB, String player) + { + //Remove Requests + cA.GetRequestMap().remove(cB.GetName()); + cB.GetRequestMap().remove(cA.GetName()); + + //Update Clans + cA.GetAllyMap().put(cB.GetName(), false); + cB.GetAllyMap().put(cA.GetName(), false); + + //Save + Clans.CRepo().EditClan(cA.GetToken()); + Clans.CRepo().EditClan(cB.GetToken()); + + //Update Relations + for (String cur : cA.GetMembers().keySet()) + Clans.CUtil().updateRelations(cur); + + //Update Relations + for (String cur : cB.GetMembers().keySet()) + Clans.CUtil().updateRelations(cur); + + //Log + Clans.Log("Added Ally for [" + cB.GetName() + "] and [" + cA.GetName() + "] by [" + player + "]."); + } + + public boolean trust(ClansClan cA, ClansClan cB, String player) + { + if (!cA.GetAllyMap().containsKey(cB.GetName())) + return false; + + boolean trust = !cA.GetAllyMap().get(cB.GetName()); + + //Memory + cA.GetAllyMap().put(cB.GetName(), trust); + + //Save + Clans.CRepo().EditClan(cA.GetToken()); + Clans.CRepo().EditClan(cB.GetToken()); + + //Update Relations + for (String cur : cA.GetMembers().keySet()) + Clans.CUtil().updateRelations(cur); + + //Update Relations + for (String cur : cB.GetMembers().keySet()) + Clans.CUtil().updateRelations(cur); + + //Log + Clans.Log("Gave Trust [" + trust + "] to [" + cB.GetName() + "] for [" + cA.GetName() + "] by [" + player + "]."); + + return trust; + } + + public void neutral(ClansClan cA, ClansClan cB, String player, boolean bothClans) + { + //Update Clans + cA.GetAllyMap().remove(cB.GetName()); + cB.GetAllyMap().remove(cA.GetName()); + + cA.GetEnemyOut().remove(cB.GetName()); + cB.GetEnemyIn().remove(cA.GetName()); + + if (bothClans) + { + cA.GetEnemyIn().remove(cB.GetName()); + cB.GetEnemyOut().remove(cA.GetName()); + } + + //Save + Clans.CRepo().EditClan(cA.GetToken()); + Clans.CRepo().EditClan(cB.GetToken()); + + //Update Relations + for (String cur : cA.GetMembers().keySet()) + Clans.CUtil().updateRelations(cur); + + //Update Relations + for (String cur : cB.GetMembers().keySet()) + Clans.CUtil().updateRelations(cur); + + //Log + Clans.Log("Added Neutral between [" + cA.GetName() + "] and [" + cB.GetName() + "] by [" + player + "]."); + } + + public void enemy(ClansWar war, String player) + { + war.GetClanA().GetEnemyOut().put(war.GetClanB().GetName(), war); + war.GetClanB().GetEnemyIn().put(war.GetClanA().GetName(), war); + + //Save + Clans.CRepo().EditClan(war.GetClanA().GetToken()); + + //Update Relations + for (String cur : war.GetClanA().GetMembers().keySet()) + Clans.CUtil().updateRelations(cur); + + //Update Relations + for (String cur : war.GetClanB().GetMembers().keySet()) + Clans.CUtil().updateRelations(cur); + + //Log + Clans.Log("Added Invasion between [" + war.GetClanA().GetName() + "] and [" + war.GetClanB().GetName() + "] by [" + player + "]."); + } + + + + public boolean claim(String name, String chunk, String player, boolean safe) + { + if (!Clans.GetClanMap().containsKey(name)) + return false; + + ClansClan clan = Clans.GetClanMap().get(name); + + //Unclaim + if (Clans.GetClaimMap().containsKey(chunk)) + unclaim(chunk, player, false); + + //Memory + ClansTerritory claim = new ClansTerritory(Clans, name, chunk, safe); + clan.GetClaimSet().add(chunk); + Clans.GetClaimMap().put(chunk, claim); + + //Save + Clans.CRepo().EditClan(clan.GetToken()); + + //Visual + Chunk c = UtilWorld.strToChunk(chunk); + if (!clan.IsAdmin()) + for (int i = 0 ; i < 3 ; i++) + for (int x=0 ; x < 16 ; x++) + for (int z=0 ; z < 16 ; z++) + if (z == 0 || z == 15 || x == 0 || x == 15) + { + Block down = UtilBlock.getHighest(c.getWorld(), c.getBlock(x, 0, z).getX(), c.getBlock(x, 0, z).getZ()).getRelative(BlockFace.DOWN); + + if (down.getTypeId() == 1 || down.getTypeId() == 2 || down.getTypeId() == 3 || down.getTypeId() == 12 || down.getTypeId() == 8) + Clans.BlockRestore().Add(down, 89, (byte)0, 180000); + } + + //Log + Clans.Log("Added Claim for [" + name + "] at [" + chunk + "] by [" + player + "]."); + + return true; + } + + public boolean unclaim(String chunk, String player, boolean sql) + { + ClansTerritory claim = Clans.GetClaimMap().remove(chunk); + + if (claim == null) + { + Clans.Log("Unclaiming NULL Chunk Failed."); + return false; + } + + ClansClan clan = Clans.GetClanMap().get(claim.owner); + + if (clan == null) + { + Clans.Log("Unclaiming from NULL Clan Failed."); + return false; + } + + //Memory + clan.GetClaimSet().remove(chunk); + + //Save + Clans.CRepo().EditClan(clan.GetToken()); + + //Register + Clans.GetUnclaimMap().put(chunk, System.currentTimeMillis()); + + //Log + Clans.Log("Removed Claim for [" + clan.GetName() + "] at [" + chunk + "] by [" + player + "]."); + + return true; + } + + public void home(ClansClan clan, Location loc, String player) + { + //Memory + clan.SetHome(loc); + + //Save + Clans.CRepo().EditClan(clan.GetToken()); + + //Log + Clans.Log("Set Home for [" + clan.GetName() + "] to " + UtilWorld.locToStrClean(loc) + " by [" + player + "]."); + } + + public void safe(ClansTerritory claim, String player) + { + //Memory + claim.safe = !claim.safe; + + //Save + Clans.CRepo().EditClan(Clans.getClan(claim.getOwner()).GetToken()); + + //Log + Clans.Log("Safe Zone at [" + claim.chunk + "] set to [" + claim.safe + "] by [" + player + "]."); + } + + public void pillage(ClansClan cA, ClansClan cB, boolean start) + { + if (start) + { + cA.GetEnemyEvent().add(cB.GetName()); + cB.GetEnemyEvent().add(cA.GetName()); + } + else + { + cA.GetEnemyEvent().remove(cB.GetName()); + cB.GetEnemyEvent().remove(cA.GetName()); + } + + //Update Relations + for (String cur : cA.GetMembers().keySet()) + Clans.CUtil().updateRelations(cur); + + //Update Relations + for (String cur : cB.GetMembers().keySet()) + Clans.CUtil().updateRelations(cur); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansTerritory.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansTerritory.java new file mode 100644 index 000000000..265981c93 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansTerritory.java @@ -0,0 +1,34 @@ +package nautilus.game.pvp.modules.clans; + + +public class ClansTerritory +{ + public String owner = ""; + public String chunk = ""; + + public boolean safe = false; + + private Clans _clans; + public ClansTerritory(Clans clans) + { + _clans = clans; + } + + public ClansTerritory(Clans clans, String owner, String chunk, boolean safe) + { + _clans = clans; + this.owner = owner; + this.chunk = chunk; + this.safe = safe; + } + + public String getOwner() + { + ClansClan clan = _clans.CUtil().getClanByClanName(owner); + + if (clan == null || !clan.IsAdmin()) + return "Clan " + owner; + + return owner; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansUtility.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansUtility.java new file mode 100644 index 000000000..443848828 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansUtility.java @@ -0,0 +1,578 @@ +package nautilus.game.pvp.modules.clans; + +import java.util.LinkedList; +import java.util.Map.Entry; + +import nautilus.game.pvp.modules.clans.ClansClan.Role; + +import org.bukkit.ChatColor; +import org.bukkit.Chunk; +import org.bukkit.Location; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClient; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; + +public class ClansUtility +{ + private Clans Clans; + public ClansUtility(Clans clans) + { + Clans = clans; + } + + public enum ClanRelation + { + SELF, + ALLY, + ALLY_TRUST, + NEUTRAL, + ENEMY, + PILLAGE, + ADMIN, + SAFE + } + + public ClansClan searchClanPlayer(Player caller, String name, boolean inform) + { + //CLAN + LinkedList clanMatchList = new LinkedList(); + + for (ClansClan cur : Clans.GetClanMap().values()) + { + if (cur.GetName().equalsIgnoreCase(name)) + return cur; + + if (cur.GetName().toLowerCase().contains(name.toLowerCase())) + clanMatchList.add(cur); + } + + if (clanMatchList.size() == 1) + return clanMatchList.get(0); + + //No / Non-Unique + String clanMatchString = "None"; + if (clanMatchList.size() > 1) + { + for (ClansClan cur : clanMatchList) + clanMatchString += cur.GetName() + " "; + } + + //PLAYER + LinkedList playerMatchList = new LinkedList(); + + for (Entry clanMemberEntry : Clans.GetClanMemberMap().entrySet()) + { + if (clanMemberEntry.getKey().equalsIgnoreCase(name)) + return clanMemberEntry.getValue(); + + if (clanMemberEntry.getKey().toLowerCase().contains(name.toLowerCase())) + playerMatchList.add(clanMemberEntry.getValue()); + } + + if (playerMatchList.size() == 1) + return playerMatchList.get(0); + + //No / Non-Unique + String playerMatchString = "None"; + if (playerMatchList.size() > 1) + { + for (ClansClan cur : playerMatchList) + playerMatchString += cur.GetName() + " "; + } + + if (inform) + { + UtilPlayer.message(caller, F.main("Clan Search", "" + + C.mCount + (clanMatchList.size() + playerMatchList.size()) + + C.mBody + " matches for [" + + C.mElem + name + + C.mBody + "]."), false); + + UtilPlayer.message(caller, F.desc("Matches via Clan", clanMatchString), false); + UtilPlayer.message(caller, F.desc("Matches via Player", playerMatchString), false);; + } + + return null; + } + + public ClansClan searchClan(Player caller, String name, boolean inform) + { + LinkedList matchList = new LinkedList(); + + for (ClansClan cur : Clans.GetClanMap().values()) + { + if (cur.GetName().equalsIgnoreCase(name)) + return cur; + + if (cur.GetName().toLowerCase().contains(name.toLowerCase())) + matchList.add(cur); + } + + //No / Non-Unique + if (matchList.size() != 1) + { + if (!inform) + return null; + + //Inform + UtilPlayer.message(caller, F.main("Clan Search", "" + + C.mCount + matchList.size() + + C.mBody + " matches for [" + + C.mElem + name + + C.mBody + "]."), false); + + if (matchList.size() > 0) + { + String matchString = ""; + for (ClansClan cur : matchList) + matchString += cur.GetName() + " "; + + UtilPlayer.message(caller, F.main("Clan Search", "" + + C.mBody + " Matches [" + + C.mElem + matchString + + C.mBody + "]."), false); + } + + return null; + } + + return matchList.get(0); + } + + public ClansClan getClanByClanName(String clan) + { + return Clans.getClan(clan); + } + + public ClansClan getClanByPlayer(Player player) + { + return getClanByPlayer(player.getName()); + } + + public ClansClan getClanByPlayer(String name) + { + if (!Clans.GetClanMemberMap().containsKey(name)) + return null; + + return Clans.GetClanMemberMap().get(name); + } + + public Role getRole(Player player) + { + try + { + return getClanByPlayer(player).GetMembers().get(player.getName()); + } + catch (Exception e) + { + return Role.NONE; + } + } + + public boolean isSafe(Player player) + { + ClansClan clan = Clans.CUtil().getClanByPlayer(player); + if (clan != null) + { + if (!clan.GetEnemyEvent().isEmpty()) + return false; + } + + if (!UtilTime.elapsed(Clans.Clients().Get(player).Player().GetLastDamager(), 15000)) + return false; + + return isSafe(player.getLocation()); + } + + public boolean isSafe(Location loc) + { + /* XXX + for (Region cur : _clans.regionSet) + { + if (cur.contains(loc)) + return true; + } + */ + + if (!Clans.GetClaimMap().containsKey(UtilWorld.chunkToStr(loc.getChunk()))) + return false; + + return Clans.GetClaimMap().get(UtilWorld.chunkToStr(loc.getChunk())).safe; + } + + public boolean isChunkHome(ClansClan clan, Chunk chunk) + { + if (clan == null) + return false; + + if (clan.GetHome() == null) + return false; + + return clan.GetHome().getChunk().equals(chunk); + } + + public ClansTerritory getClaim(Location loc) + { + String chunk = UtilWorld.chunkToStr(loc.getChunk()); + return Clans.GetClaimMap().get(chunk); + } + + public ClansTerritory getClaim(String chunk) + { + return Clans.GetClaimMap().get(chunk); + } + + public ClansClan getOwner(String chunk) + { + ClansTerritory claim = getClaim(chunk); + + if (claim == null) + return null; + + return getOwner(claim); + } + + public ClansClan getOwner(Location loc) + { + ClansTerritory claim = getClaim(loc); + + if (claim != null) + return getOwner(claim); + + for (ClansOutpost outpost : Clans.GetOutpostMap().values()) + if (outpost.IsOn()) + if (outpost.Contains(loc)) + return outpost.GetClan(); + + return null; + } + + public ClansClan getOwner(ClansTerritory claim) + { + return getClanByClanName(claim.owner); + } + + public String getOwnerString(Location loc) + { + ClansClan owner = getOwner(loc); + + if (owner == null) + return "Wilderness"; + + return owner.GetName(); + } + + public String getOwnerStringRel(Location loc, String player) + { + ClanRelation rel = Clans.CUtil().relPT(player, UtilWorld.chunkToStr(loc.getChunk())); + return Clans.CUtil().mRel(rel, Clans.CUtil().getOwnerString(loc), true); + } + + public boolean isClaimed(Location loc) + { + String chunk = UtilWorld.chunkToStr(loc.getChunk()); + + return Clans.GetClaimMap().containsKey(chunk); + } + + public boolean isAlliance(String player, Location loc) + { + if (!Clans.Clients().Get(player).Clan().InClan()) + return false; + + if (!isClaimed(loc)) + return false; + + return getOwner(getClaim(loc)).isAlly(Clans.Clients().Get(player).Clan().GetClanName()); + } + + public boolean isSelf(String player, Location loc) + { + if (!Clans.Clients().Get(player).Clan().InClan()) + return false; + + if (!isClaimed(loc)) + return false; + + return getOwner(getClaim(loc)).isSelf(Clans.Clients().Get(player).Clan().GetClanName()); + } + + public boolean isAdmin(Location loc) + { + if (!isClaimed(loc)) + return false; + + return getOwner(getClaim(loc)).IsAdmin(); + } + + public boolean isSpecial(Location loc, String special) + { + if (!isClaimed(loc)) + return false; + + if (!isAdmin(loc)) + return false; + + return getOwner(getClaim(loc)).GetName().toLowerCase().contains(special.toLowerCase()); + } + + public ClanRelation getAccess(Player player, Location loc) + { + //Observer Override + if (Clans.Observer().isObserver(player, false)) + { + if (Clans.Observer().isObserver(player, true)) + return ClanRelation.SELF; + else + return ClanRelation.NEUTRAL; + } + + ClansClan owner = this.getOwner(loc); + ClansClan clan = getClanByPlayer(player); + + if (owner == null) + return ClanRelation.SELF; + + if (owner.equals(Clans.CAdmin().getMimic(player, false))) + return ClanRelation.SELF; + + if (owner.equals(clan)) + return ClanRelation.SELF; + + if (clan != null) + if (clan.canPillage(owner)) + return ClanRelation.SELF; + + if (clan != null) + if (owner.getTrust(clan.GetName())) + return ClanRelation.ALLY_TRUST; + + if (clan != null) + if (owner.isAlly(clan.GetName())) + return ClanRelation.ALLY; + + if (clan != null) + if (owner.isEnemy(clan.GetName())) + return ClanRelation.ENEMY; + + return ClanRelation.NEUTRAL; + } + + //Player Player + public ClanRelation relPP(String pA, String pB) + { + return rel(getClanByPlayer(pA), getClanByPlayer(pB)); + } + + //Clan Clan + public ClanRelation relCC(String cA, String cB) + { + return rel(searchClan(null, cA, false), searchClan(null, cB, false)); + } + + //Territory Territory + public ClanRelation relTT(String tA, String tB) + { + return rel(getOwner(tA), getOwner(tB)); + } + + //Player Clan + public ClanRelation relPC(String pA, String cB) + { + return rel(getClanByPlayer(pA), searchClan(null, cB, false)); + } + + //Player Clan (Object) + public ClanRelation relPC(String pA, ClansClan cB) + { + return rel(getClanByPlayer(pA), cB); + } + + //Player Territory + public ClanRelation relPT(String pA, String tB) + { + ClansTerritory claim = getClaim(tB); + if (claim != null) + if (claim.safe) + return ClanRelation.SAFE; + + return rel(getClanByPlayer(pA), getOwner(tB)); + } + + //Clan Territory + public ClanRelation relCT(String cA, String tB) + { + ClansTerritory claim = getClaim(tB); + if (claim != null) + if (claim.safe) + return ClanRelation.SAFE; + + return rel(searchClan(null, cA, false), getOwner(tB)); + } + + public ClanRelation rel(ClansClan cA, ClansClan cB) + { + if (cA == null || cB == null) + return ClanRelation.NEUTRAL; + + //Self + if (cA.IsAdmin() || cB.IsAdmin()) + return ClanRelation.ADMIN; + + if (cA.GetName().equals(cB.GetName())) + return ClanRelation.SELF; + + //Ally + if (cA.getTrust(cB.GetName())) + return ClanRelation.ALLY_TRUST; + + if (cA.isAlly(cB.GetName())) + return ClanRelation.ALLY; + + if (cA.isPillage(cB.GetName())) + return ClanRelation.PILLAGE; + + if (cA.isEnemy(cB.GetName())) + return ClanRelation.ENEMY; + + //Enemy + return ClanRelation.NEUTRAL; + } + + public ChatColor relChatColor(ClanRelation relation, boolean dark) + { + if (relation == ClanRelation.SAFE) return C.xAdmin; + if (relation == ClanRelation.ADMIN) return C.xAdmin; + + if (!dark) + { + if (relation == ClanRelation.SELF) return C.xSelf; + if (relation == ClanRelation.ALLY_TRUST) return C.xdAlly; + if (relation == ClanRelation.ALLY) return C.xAlly; + if (relation == ClanRelation.ENEMY) return C.xWar; + if (relation == ClanRelation.PILLAGE) return C.xPillage; + return C.xEnemy; + } + + if (relation == ClanRelation.SELF) return C.xdSelf; + if (relation == ClanRelation.ALLY_TRUST) return C.xAlly; + if (relation == ClanRelation.ALLY) return C.xdAlly; + if (relation == ClanRelation.ENEMY) return C.xdWar; + if (relation == ClanRelation.PILLAGE) return C.xdPillage; + return C.xdEnemy; + } + + public String relColor(ClanRelation relation, boolean dark) + { + if (relation == ClanRelation.SAFE) return C.xAdmin + "(" + C.xSafe + "SAFE" + C.xAdmin + ") "; + + return relChatColor(relation, dark) + ""; + } + + public String mRel(ClanRelation relation, String message, boolean dark) + { + return relColor(relation, dark) + message + C.mChat; + } + + public boolean playerSelf(String pA, String pB) + { + ClansClan cA = getClanByPlayer(pA); + ClansClan cB = getClanByPlayer(pB); + + if (cA == null || cB == null) + return false; + + return cA.isSelf(cB.GetName()); + } + + public boolean playerAlly(String pA, String pB) + { + ClansClan cA = getClanByPlayer(pA); + ClansClan cB = getClanByPlayer(pB); + + if (cA == null || cB == null) + return false; + + return cA.isAlly(cB.GetName()); + } + + public boolean playerEnemy(String pA, String pB) + { + ClansClan cA = getClanByPlayer(pA); + ClansClan cB = getClanByPlayer(pB); + + if (cA == null || cB == null) + return true; + + return !(cA.isAlly(cB.GetName()) || cA.isSelf(cB.GetName())); + } + + public boolean canHurt(Player damagee, Player damager) + { + if (damagee == null) + return false; + + if (isSafe(damagee)) + return false; + + if (damager == null) + return true; + + if (isSafe(damager)) + return false; + + ClanRelation rel = Clans.CUtil().relPP(damagee.getName(), damager.getName()); + + if (rel == ClanRelation.ALLY || rel == ClanRelation.ALLY_TRUST || rel == ClanRelation.SELF) + return false; + + return true; + } + + public void updateRelations(String name) + { + updateRelations(UtilPlayer.searchExact(name)); + } + + public void updateRelations(Player player) + { + if (player == null) + return; + + CoreClient client = Clans.Clients().Get(player); + + for (Player cur : UtilServer.getPlayers()) + { + //For Player + client.Clan().SetRelationship( + cur.getName(), Clans.CUtil().relPP(cur.getName(), player.getName())); + + //For Other + Clans.Clients().Get(cur.getName()).Clan().SetRelationship( + player.getName(), Clans.CUtil().relPP(player.getName(), cur.getName())); + + if (player.canSee(cur)) + { + player.hidePlayer(cur); + player.showPlayer(cur); + } + + if (cur.canSee(player)) + { + cur.hidePlayer(player); + cur.showPlayer(player); + } + } + } + + public boolean isBorderlands(Location loc) + { + return (Math.abs(loc.getX()) > 400 || Math.abs(loc.getZ()) > 400); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansWar.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansWar.java new file mode 100644 index 000000000..80912eeb0 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansWar.java @@ -0,0 +1,63 @@ +package nautilus.game.pvp.modules.clans; + +public class ClansWar +{ + private Clans Clans; + + private ClansClan _clanA; + private ClansClan _clanB; + private int _dom; + private long _created; + + public ClansWar(Clans clans, ClansClan a, ClansClan b, int dom, long created) + { + Clans = clans; + + _clanA = a; + _clanB = b; + _dom = dom; + _created = created; + } + + public ClansClan GetClanA() + { + return _clanA; + } + + public ClansClan GetClanB() + { + return _clanB; + } + + public int GetDominance() + { + return _dom; + } + + public long GetCreated() + { + return _created; + } + + public boolean SetDominance(int dom) + { + if (dom < 0) + dom = 0; + + if (dom > Clans.GetDominanceLimit()) + dom = Clans.GetDominanceLimit(); + + _dom = dom; + + //Save + Clans.CRepo().EditClan(_clanA.GetToken()); + + if (dom >= Clans.GetDominanceLimit()) + { + Clans.EndWar(GetClanA(), GetClanB()); + return false; + } + + return true; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/AllianceToken.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/AllianceToken.java new file mode 100644 index 000000000..c3286d0dd --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/AllianceToken.java @@ -0,0 +1,8 @@ +package nautilus.game.pvp.modules.clans.Tokens; + +public class AllianceToken +{ + public int ClanId; + public String ClanName; + public boolean Trusted; +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/ClanGeneratorToken.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/ClanGeneratorToken.java new file mode 100644 index 000000000..0e9b77341 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/ClanGeneratorToken.java @@ -0,0 +1,12 @@ +package nautilus.game.pvp.modules.clans.Tokens; + +public class ClanGeneratorToken +{ + public String Name; + + public String Location; + + public int Stock; + + public long Time; +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/ClanMemberToken.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/ClanMemberToken.java new file mode 100644 index 000000000..f101a2748 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/ClanMemberToken.java @@ -0,0 +1,8 @@ +package nautilus.game.pvp.modules.clans.Tokens; + +public class ClanMemberToken +{ + public int AccountId; + public String Name; + public ClanRole ClanRole; +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/ClanRole.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/ClanRole.java new file mode 100644 index 000000000..15b580e49 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/ClanRole.java @@ -0,0 +1,7 @@ +package nautilus.game.pvp.modules.clans.Tokens; + +public class ClanRole +{ + public int ClanRoleId; + public String Name; +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/ClanTerritoryToken.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/ClanTerritoryToken.java new file mode 100644 index 000000000..35b4d273e --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/ClanTerritoryToken.java @@ -0,0 +1,10 @@ +package nautilus.game.pvp.modules.clans.Tokens; + +public class ClanTerritoryToken +{ + public int ClanId; + public String ClanName; + public String ServerName; + public String Chunk; + public boolean Safe; +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/ClanToken.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/ClanToken.java new file mode 100644 index 000000000..aed97160f --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/ClanToken.java @@ -0,0 +1,22 @@ +package nautilus.game.pvp.modules.clans.Tokens; + +import java.util.List; + +public class ClanToken +{ + public int ClanId; + public String Name; + public String Description; + public int Power; + public String Home; + public boolean Admin; + public long DateCreated; + public long LastTimeOnline; + + public ClanGeneratorToken Generator; + public List Members; + public List Territories; + + public List Alliances; + public List Wars; +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/WarToken.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/WarToken.java new file mode 100644 index 000000000..84e85d0f1 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Tokens/WarToken.java @@ -0,0 +1,11 @@ +package nautilus.game.pvp.modules.clans.Tokens; + +public class WarToken +{ + public int ClanId; + public String ClanName; + public int Dominance; + public long Created; + public boolean Ended; + public long Cooldown; +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerReset.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerReset.java new file mode 100644 index 000000000..17f0eaccc --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerReset.java @@ -0,0 +1,27 @@ +package nautilus.game.pvp.modules.serverreset; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; + +public class ServerReset extends MiniPlugin +{ + private ServerResetRepository _repository; + + public ServerReset(JavaPlugin plugin, String webAddress) + { + super("Server Reset", plugin); + + _repository = new ServerResetRepository(webAddress); + } + + public void AddCommands() + { + AddCommand(new ServerResetCommand(this)); + } + + public ServerResetRepository GetRepository() + { + return _repository; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerResetCommand.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerResetCommand.java new file mode 100644 index 000000000..71a7268f4 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerResetCommand.java @@ -0,0 +1,67 @@ +package nautilus.game.pvp.modules.serverreset; + +import java.io.File; +import java.io.FilenameFilter; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import mineplex.core.Rank; +import me.chiss.Core.Commands.CommandBase; +import mineplex.minecraft.account.GetClientEvent; + +public class ServerResetCommand extends CommandBase +{ + public ServerResetCommand(ServerReset plugin) + { + super(plugin, Rank.OWNER, "serverreset"); + } + + @Override + public void Execute(Player caller, String[] args) + { + ClearEconomy(); + System.out.println(F.main(Plugin.GetName(), caller.getName() + " cleared Economy.")); + caller.sendMessage(F.main(Plugin.GetName(), "Cleared Economy.")); + + ClearNpcs(); + } + + private void ClearNpcs() + { + new File("npcs.dat").delete(); + } + + private void ClearEconomy() + { + for (Player player : Bukkit.getOnlinePlayers()) + { + GetClientEvent clientEvent = new GetClientEvent(player); + + Plugin.GetPluginManager().callEvent(clientEvent); + + clientEvent.GetClient().Game().SetEconomyBalance(0); + } + + File economyDir = new File("economy/"); + + FilenameFilter statsFilter = new FilenameFilter() + { + public boolean accept(File paramFile, String paramString) + { + if (paramString.endsWith("dat")) + { + return true; + } + + return false; + } + }; + + for (File f : economyDir.listFiles(statsFilter)) + { + f.delete(); + } + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerResetRepository.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerResetRepository.java new file mode 100644 index 000000000..532d6e68e --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerResetRepository.java @@ -0,0 +1,17 @@ +package nautilus.game.pvp.modules.serverreset; + +import mineplex.core.server.RemoteRepository; +import mineplex.core.server.remotecall.JsonWebCall; + +public class ServerResetRepository extends RemoteRepository +{ + public ServerResetRepository(String webserverAddress) + { + super(webserverAddress); + } + + public void ResetClanData() + { + new JsonWebCall(WebServerAddress + "Clan/ResetClanData").Execute(); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/repository/PvPRepository.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/repository/PvPRepository.java new file mode 100644 index 000000000..9fc22adaf --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/repository/PvPRepository.java @@ -0,0 +1,65 @@ +package nautilus.game.pvp.repository; + +import java.util.List; + +import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; + +import mineplex.core.server.RemoteRepository; +import mineplex.core.server.remotecall.AsyncJsonWebCall; +import mineplex.core.server.remotecall.JsonWebCall; +import nautilus.game.pvp.modules.Fishing.Fish; +import nautilus.game.pvp.modules.Fishing.FishData; +import nautilus.minecraft.core.webserver.token.Account.FishToken; + +public class PvPRepository extends RemoteRepository +{ + public PvPRepository(String webServerAddress) + { + super(webServerAddress); + } + + public List GetFishingAllTimeHigh() + { + return new JsonWebCall(WebServerAddress + "Fishing/GetFishingAllTimeHigh").Execute(new TypeToken>(){}.getType(), (Object)null); + } + + public List GetFishingDayHigh() + { + return new JsonWebCall(WebServerAddress + "Fishing/GetFishingDayHigh").Execute(new TypeToken>(){}.getType(), (Object)null); + } + + public void ClearDailyFishingScores() + { + new AsyncJsonWebCall(WebServerAddress + "Fishing/ClearDailyFishingScores").Execute(); + } + + public void SaveFishingAllTimeHigh(Fish fish, FishData fishData) + { + FishToken token = new FishToken(); + token.Name = fish.name(); + token.Size = fishData.GetPounds(); + token.Catcher = fishData.GetCatcher(); + + new AsyncJsonWebCall(WebServerAddress + "Fishing/SaveFishingAllTimeHigh").Execute(token); + } + + public void SaveFishingDayHigh(Fish fish, FishData fishData) + { + FishToken token = new FishToken(); + token.Name = fish.name(); + token.Size = fishData.GetPounds(); + token.Catcher = fishData.GetCatcher(); + + new AsyncJsonWebCall(WebServerAddress + "Fishing/SaveFishingDayHigh").Execute(token); + } + + public void SaveFishingScores(Fish fish, FishData fishData) + { + FishToken token = new FishToken(); + token.Name = fish.name(); + token.Size = fishData.GetPounds(); + token.Catcher = fishData.GetCatcher(); + + new AsyncJsonWebCall(WebServerAddress + "Fishing/SaveFishingScore").Execute(token); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventBase.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventBase.java new file mode 100644 index 000000000..ac075c57d --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventBase.java @@ -0,0 +1,274 @@ +package nautilus.game.pvp.worldevent; + +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map.Entry; + +import me.chiss.Core.Modules.BlockRegenerateSet; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; + +import org.bukkit.block.Block; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.ProjectileHitEvent; + +public abstract class EventBase implements Listener +{ + public enum EventState + { + PREPARE, + LIVE, + END + } + + public EventManager Manager; + + private String _eventName; + private EventState _state; + + private long _eventStart = 0; + private long _eventExpire = 0; + + private long _lastAnnounce = 0; + + private ArrayList _creatures = new ArrayList(); + private HashMap> _blocks = new HashMap>(); + private BlockRegenerateSet _blockSet; + + private HashSet _arrows = new HashSet(); + + private int _idleTicks = 0; + + public EventBase(EventManager manager, String eventName, double eventExpireHours) + { + _eventName = eventName; + + _eventStart = System.currentTimeMillis(); + SetExpire(eventExpireHours); + + _lastAnnounce = System.currentTimeMillis(); + + Manager = manager; + + _blockSet = Manager.BlockRegenerate().CreateSet(10); + + _state = EventState.PREPARE; + } + + public void TriggerStart() + { + System.out.println("Preparing World Event: " + GetEventName()); + Start(); + + Manager.RecordStart(this); + } + + public void TriggerStop() + { + Clean(); + Stop(); + + Manager.RecordStop(this); + } + + public void Clean() + { + SetState(EventState.END); + + //Remove Creatures + HashSet remove = new HashSet(); + + for (EventMob cur : _creatures) + remove.add(cur); + + _creatures.clear(); + + //Mobs + for (EventMob cur : remove) + cur.Remove(); + + //Arrows + for (Entity cur : _arrows) + cur.remove(); + + //Remove Blocks + _blockSet.Start(); + + _blocks.clear(); + } + + public abstract void Start(); + public abstract void Stop(); + + @EventHandler + public void Prepare(UpdateEvent event) + { + if (_state != EventState.PREPARE) + return; + + if (event.getType() != UpdateType.TICK) + return; + + _idleTicks++; + if (_idleTicks > 600) + { + _idleTicks = 0; + System.out.println("Failed to prepare " + GetEventName() + "."); + TriggerStop(); + return; + } + + PrepareCustom(); + } + + public abstract void PrepareCustom(); + + public void CreatureRegister(EventMob creature) + { + _creatures.add(creature); + UtilServer.getServer().getPluginManager().registerEvents(creature, Manager.Plugin()); + } + + public void CreatureDeregister(EventMob creature) + { + _creatures.remove(creature); + HandlerList.unregisterAll(creature); + } + + public ArrayList GetCreatures() + { + return _creatures; + } + + public void AddBlock(Block block, int id, byte data) + { + if (!_blocks.containsKey(block)) + _blocks.put(block, new AbstractMap.SimpleEntry(block.getTypeId(), block.getData())); + + _blockSet.AddBlock(block.getLocation(), block.getTypeId(), block.getData()); + block.setTypeIdAndData(id, data, true); + } + + public boolean RemoveBlock(Block block) + { + Entry entry = _blocks.remove(block); + if (entry == null) return false; + + block.setTypeIdAndData(entry.getKey(), entry.getValue(), true); + return true; + } + + public HashMap> GetBlocks() + { + return _blocks; + } + + public String GetEventName() + { + return _eventName; + } + + public EventState GetState() { + return _state; + } + + public void SetState(EventState _state) { + this._state = _state; + } + + public void SetEventName(String newName) + { + _eventName = newName; + } + + public void ResetIdleTicks() + { + _idleTicks = 0; + } + + @EventHandler + public void AnnounceUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if (!UtilTime.elapsed(_lastAnnounce, 120000)) + return; + + _lastAnnounce = System.currentTimeMillis(); + + AnnounceDuring(); + } + + public abstract void AnnounceStart(); + public abstract void AnnounceDuring(); + public abstract void AnnounceEnd(); + public abstract void AnnounceExpire(); + + @EventHandler + public void ExpireUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if (!CanExpire()) + return; + + if (System.currentTimeMillis() - _eventStart < _eventExpire) + return; + + TriggerStop(); + AnnounceExpire(); + } + + public void SetExpire(double eventExpireHours) + { + _eventExpire = (long) (eventExpireHours * 3600000); + } + + public abstract boolean CanExpire(); + + public void AddArrow(Arrow arrow) + { + _arrows.add(arrow); + } + + @EventHandler + public void ArrowClean(ProjectileHitEvent event) + { + if (_arrows.remove(event.getEntity())) + { + event.getEntity().remove(); + } + } + + @EventHandler + public void ArrowClean(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_arrows.isEmpty()) + return; + + for (Iterator i = _arrows.iterator(); i.hasNext();) + { + Entity cur = i.next(); + + if (cur.isDead() || !cur.isValid() || cur.getTicksLived() > 60 || cur.getTicksLived() == 0) + { + i.remove(); + cur.remove(); + } + } + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventManager.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventManager.java new file mode 100644 index 000000000..c3e793479 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventManager.java @@ -0,0 +1,155 @@ +package nautilus.game.pvp.worldevent; + +import java.util.HashSet; + +import mineplex.core.Rank; +import me.chiss.Core.Module.AModule; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import nautilus.game.pvp.worldevent.events.BossSkeleton; +import nautilus.game.pvp.worldevent.events.BossSlime; +import nautilus.game.pvp.worldevent.events.BaseUndead; +import nautilus.game.pvp.worldevent.events.BossSpider; +import nautilus.game.pvp.worldevent.events.BossSwarmer; +import nautilus.game.pvp.worldevent.events.BossWither; +import nautilus.game.pvp.worldevent.events.EndFlood; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.plugin.java.JavaPlugin; + +public class EventManager extends AModule +{ + private HashSet _active = new HashSet(); + + private EventTerrainFinder _terrainFinder; + + private long _lastStart = 0; + private long _lastStop = 0; + + public EventManager(JavaPlugin plugin) + { + super("Event Manager", plugin); + + _terrainFinder = new EventTerrainFinder(this); + + _lastStart = System.currentTimeMillis(); + _lastStop = System.currentTimeMillis(); + } + + @Override + public void enable() + { + + } + + @Override + public void disable() + { + for (EventBase cur : _active) + cur.TriggerStop(); + } + + @Override + public void config() + { + + } + + @Override + public void commands() + { + AddCommand("ev"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) + return; + + if (args.length == 0) + { + caller.sendMessage("Missing Event Parameter."); + return; + } + + EventBase event = null; + + if (args[0].equals("dead")) event = new BaseUndead(this); + if (args[0].equals("dead4")) event = new BaseUndead(this, 4); + if (args[0].equals("slime")) event = new BossSlime(this); + if (args[0].equals("skel")) event = new BossSkeleton(this); + if (args[0].equals("swarm")) event = new BossSwarmer(this); + if (args[0].equals("wither")) event = new BossWither(this); + if (args[0].equals("brood")) event = new BossSpider(this); + + if (args[0].equals("flood")) event = new EndFlood(this, caller.getLocation()); + + if (event != null) + { + event.TriggerStart(); + _active.add(event); + + UtilServer.getServer().getPluginManager().registerEvents(event, Plugin()); + } + } + + @EventHandler + public void StartEvent(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + if (!_active.isEmpty()) + return; + + if (System.currentTimeMillis() - _lastStart < 7200000) + return; + + if (System.currentTimeMillis() - _lastStop < 7200000) + return; + + StartEvent(); + } + + public void StartEvent() + { + double rand = Math.random(); + + if (rand > 0.90) (new BaseUndead(this)).TriggerStart(); + else if (rand > 0.72) (new BossSlime(this)).TriggerStart(); + else if (rand > 0.54) (new BossSkeleton(this)).TriggerStart(); + else if (rand > 0.36) (new BossSwarmer(this)).TriggerStart(); + else if (rand > 0.18) (new BossWither(this)).TriggerStart(); + else (new BossSpider(this)).TriggerStart(); + + } + + public EventTerrainFinder TerrainFinder() + { + return _terrainFinder; + } + + public void RecordStart(EventBase event) + { + _active.add(event); + + //Register Events + UtilServer.getServer().getPluginManager().registerEvents(event, Plugin()); + + _lastStart = System.currentTimeMillis(); + } + + public void RecordStop(EventBase event) + { + _active.remove(event); + + //Deregister Events + HandlerList.unregisterAll(event); + + _lastStop = System.currentTimeMillis(); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventMob.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventMob.java new file mode 100644 index 000000000..72a8fba7c --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventMob.java @@ -0,0 +1,389 @@ +package nautilus.game.pvp.worldevent; + +import java.util.HashMap; + +import nautilus.game.pvp.worldevent.EventBase.EventState; + +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.world.ChunkUnloadEvent; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; + +public abstract class EventMob implements Listener +{ + public EventBase Event; + + private LivingEntity _entity; + + private Location _loc; + private EntityType _type; + + private String _name; + private double _healthCur; + private double _healthMax; + + private long _lastAttacked = 0; + private long _lastAttacker = 0; + + protected long _attackerDelay = 400; + protected long _attackedDelay = 400; + + protected boolean _useName = true; + + private HashMap _damagers = new HashMap(); + + public EventMob(EventBase event, Location location, String name, boolean useName, int health, EntityType type) + { + Event = event; + + _loc = location; + _type = type; + + _name = name; + _useName = useName; + + _healthMax = health; + _healthCur = health; + + Spawn(); + + Event.Manager.Creature().AddEntityName(_entity, GetName()); + } + + public void UpdateName() + { + if (!_useName) + return; + + if (_entity instanceof CraftLivingEntity) + { + String healthString = (int)_healthCur + "/" + (int)_healthMax; + double per = (double)_healthCur / (double)_healthMax; + if (per > 0.5) healthString = C.cGreen + healthString; + if (per > 0.2) healthString = C.cYellow + healthString; + else healthString = C.cRed + healthString; + + healthString = C.cWhite + "(" + healthString + C.cWhite + ")"; + + CraftLivingEntity ent = (CraftLivingEntity)_entity; + ent.setCustomName(_name + " " + healthString); + ent.setCustomNameVisible(true); + } + } + + public void Spawn() + { + Event.Manager.Creature().SetForce(true); + LivingEntity ent = (LivingEntity) GetLocation().getWorld().spawnEntity(GetLocation(), GetType()); + Event.Manager.Creature().SetForce(false); + + ent.setRemoveWhenFarAway(false); + + SetEntity(ent); + + ent.setMaxHealth(100d); + ent.setHealth(100d); + + SpawnCustom(); + + UpdateName(); + } + + @EventHandler + public void ChunkDespawn(ChunkUnloadEvent event) + { + if (event.getChunk().equals(GetEntity().getLocation().getChunk())) + event.setCancelled(true); + } + + public void SpawnCustom() + { + //Null + } + + @EventHandler + public void Refresh(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (Event.GetState() == EventState.END) + return; + + if (!_loc.getChunk().isLoaded()) + return; + + if (GetEntity() == null) + { + System.out.println("Respawning (" + GetName() + ") @ " + UtilWorld.locToStrClean(_loc) + " because NULL."); + Spawn(); + } + + else if (GetEntity().isDead()) + { + System.out.println("Ending (" + GetName() + ") @ " + UtilWorld.locToStrClean(_loc) + " because DEAD."); + Die(); + } + + else if (!GetEntity().isValid()) + { + GetEntity().remove(); + + System.out.println("Respawning (" + GetName() + ") @ " + UtilWorld.locToStrClean(_loc) + " because INVALID."); + Spawn(); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void DamagerRate(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + if (event.GetDamagerEntity(false) == null) + return; + + if (!event.GetDamagerEntity(false).equals(GetEntity())) + return; + + if (!UtilTime.elapsed(_lastAttacker, _attackerDelay)) + { + event.SetCancelled("Event Creature Damager Rate"); + return; + } + + DamagerCustom(event); + + _lastAttacker = System.currentTimeMillis(); + } + + public void DamagerCustom(CustomDamageEvent event) + { + + } + + @EventHandler(priority = EventPriority.LOWEST) + public void DamagedRate(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK && event.GetCause() != DamageCause.PROJECTILE) + return; + + if (GetEntity() == null) + return; + + if (!event.GetDamageeEntity().equals(GetEntity())) + return; + + if (!UtilTime.elapsed(_lastAttacked, _attackedDelay)) + { + event.SetCancelled("Event Creature Damagee Rate"); + return; + } + + _lastAttacked = System.currentTimeMillis(); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void DamagedBorderlands(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (GetEntity() == null) + return; + + if (!event.GetDamageeEntity().equals(GetEntity())) + return; + + //Record Damage + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + if (!Event.Manager.Clans().CUtil().isBorderlands(damager.getLocation()) || + !Event.Manager.Clans().CUtil().isBorderlands(GetEntity().getLocation())) + { + event.SetCancelled("Not Borderlands"); + UtilPlayer.message(damager, F.main("World Event", "You cannot harm " + F.name(_name) + " outside of Borderlands.")); + } + } + + + @EventHandler(priority = EventPriority.HIGHEST) + public void Damaged(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (GetEntity() == null) + return; + + if (!event.GetDamageeEntity().equals(GetEntity())) + return; + + //Record Damage + Player damager = event.GetDamagerPlayer(true); + if (damager != null) _damagers.put(damager.getName(), event.GetDamage()); + + //Custom + DamagedCustom(event); + if (event.IsCancelled()) + return; + + double heal = ((CraftLivingEntity)event.GetDamageeEntity()).getMaxHealth(); + + //Heal + event.GetDamageeEntity().setHealth(heal); + + //Apply Damage + ApplyDamage(event.GetDamage()); + + //Record + _lastAttacked = System.currentTimeMillis(); + } + + public void DamagedCustom(CustomDamageEvent event) + { + + } + + public void ApplyDamage(double damage) + { + _healthCur -= damage; + if (_healthCur <= 0) + Die(); + + //Update + UpdateName(); + } + + @EventHandler + public void Combust(EntityCombustEvent event) + { + if (GetEntity() == null) + return; + + if (event.getEntity().equals(GetEntity())) + event.setCancelled(true); + } + + @EventHandler + public void DamageType(CustomDamageEvent event) + { + if (GetEntity() == null) + return; + + if (event.GetCause() != DamageCause.SUFFOCATION && + event.GetCause() != DamageCause.DROWNING && + event.GetCause() != DamageCause.FALL) + return; + + if (event.GetDamageeEntity().equals(GetEntity())) + event.SetCancelled("Damage Cancel"); + } + + public void Die() + { + Loot(); + Remove(); + } + + public void Remove() + { + if (GetEntity() != null) + GetEntity().remove(); + + Event.CreatureDeregister(this); + } + + public abstract void Loot(); + + public String GetName() + { + return _name; + } + + public double GetHealthCur() + { + if (_healthCur < 0) + return 0; + + return _healthCur; + } + + public double GetHealthMax() + { + return _healthMax; + } + + public void ModifyHealth(double mod) + { + _healthCur += mod; + + if (_healthCur > _healthMax) + _healthCur = _healthMax; + + if (_healthCur <= 0) + Die(); + else + UpdateName(); + } + + @EventHandler + public void UpdateLocation(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if (GetEntity() == null) + return; + + _loc = GetEntity().getLocation(); + } + + public Location GetLocation() + { + return _loc; + } + + public EntityType GetType() + { + return _type; + } + + public LivingEntity GetEntity() + { + return _entity; + } + + public void SetEntity(LivingEntity ent) + { + _entity = ent; + } + + public boolean CanExpire() + { + return (System.currentTimeMillis() - _lastAttacked > 120000); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventMobBoss.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventMobBoss.java new file mode 100644 index 000000000..87b4e14a8 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventMobBoss.java @@ -0,0 +1,58 @@ +package nautilus.game.pvp.worldevent; + +import java.util.ArrayList; + +import org.bukkit.Location; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; + +public abstract class EventMobBoss extends EventMob +{ + protected ArrayList _minions = new ArrayList(); + protected int _minionsMax = 0; + protected int _minionTargetLimit = 1; + + protected int _state = 0; + + protected Location _location; + + public EventMobBoss(EventBase event, Location location, String name, boolean useName, int health, EntityType type) + { + super(event, location, name, useName, health, type); + + _location = location; + } + + public void MinionRegister(EventMobMinion minion) + { + _minions.add(minion); + } + + public void MinionDeregister(EventMobMinion minion) + { + _minions.remove(minion); + } + + public ArrayList GetMinions() + { + return _minions; + } + + public boolean MinionTarget(LivingEntity ent) + { + int i = 0; + + for (EventMobMinion cur : _minions) + if (cur.GetTarget() != null && cur.GetTarget().equals(ent)) + i++; + + return i < _minionTargetLimit; + } + + public int GetState() + { + return _state; + } + + public abstract void DistanceAction(); +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventMobMinion.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventMobMinion.java new file mode 100644 index 000000000..c1f5c23ea --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventMobMinion.java @@ -0,0 +1,203 @@ +package nautilus.game.pvp.worldevent; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import net.minecraft.server.v1_6_R2.EntityCreature; +import net.minecraft.server.v1_6_R2.Navigation; + +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftCreature; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityTargetEvent; + +public abstract class EventMobMinion extends EventMob +{ + protected EventMobBoss _host; + protected double _radialLead = 0; + + protected LivingEntity _target = null; + + protected int _distReturnSoft = 12; + protected int _distReturnHard = 24; + protected int _distRemove = 32; + + protected int _distTarget = 16; + + public EventMobMinion(EventBase event, Location location, String name, boolean useName, int health, EntityType type, EventMobBoss host) + { + super(event, location, name, useName, health, type); + + _host = host; + _host.MinionRegister(this); + } + + public LivingEntity GetTarget() + { + return _target; + } + + public void SetTarget(LivingEntity ent) + { + _target = ent; + } + + @EventHandler + public void Target(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if (_target != null && (_target.isDead() || !_target.isValid())) + { + _target = null; + } + + + //Hard Return + if (UtilMath.offset(_host.GetEntity(), GetEntity()) > _distReturnHard) + { + _target = _host.GetEntity(); + } + + + //Soft Return + if (_target == null && UtilMath.offset(_host.GetEntity(), GetEntity()) > _distReturnSoft) + { + _target = _host.GetEntity(); + } + + + //Cancel Return + if (_target != null && _target.equals(_host.GetEntity()) && UtilMath.offset(_host.GetEntity(), GetEntity()) < _distReturnSoft) + { + _target = null; + } + + + //Target Player + if (_target == null) + { + + for (Player cur : UtilPlayer.getNearby(GetEntity().getLocation(), _distTarget)) + { + if (!_host.MinionTarget(cur)) + continue; + + _target = cur; + } + } + + if (_target != null) + { + ((Creature)GetEntity()).setTarget(_target); + } + else + { + ((Creature)GetEntity()).setTarget(null); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void TargetCancel(EntityTargetEvent event) + { + if (GetEntity() == null) + return; + + if (event.getTarget() == null) + return; + + if (!event.getEntity().equals(GetEntity())) + return; + + if (TargetCancelCustom(event.getTarget())) + event.setCancelled(true); + + if (_target == null || _target.isDead() || !_target.isValid() || !event.getTarget().equals(_target)) + event.setCancelled(true); + } + + public boolean TargetCancelCustom(Entity entity) + { + return false; + } + + @EventHandler + public void Despawn(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if ( GetEntity() == null || !GetEntity().isValid() || + _host.GetEntity() == null || _host.GetEntity().isDead() || !_host.GetEntity().isValid() || + UtilMath.offset(GetEntity(), _host.GetEntity()) > _distRemove) + { + Remove(); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void Return(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!Valid()) + return; + + if (_target == null || _target.isDead() || !_target.isValid() || !_target.equals(_host.GetEntity())) + return; + + //Move + EntityCreature ec = ((CraftCreature)GetEntity()).getHandle(); + Navigation nav = ec.getNavigation(); + Location loc = _host.GetEntity().getLocation(); + nav.a(loc.getX(), loc.getY(), loc.getZ(), 0.4f); + } + + public boolean Valid() + { + if (GetEntity() == null || !GetEntity().isValid() || _host == null || + _host.GetEntity() == null || _host.GetEntity().isDead() || !_host.GetEntity().isValid()) + { + Die(); + + return false; + } + + return true; + } + + @Override + public void Remove() + { + _host.MinionDeregister(this); + + if (GetEntity() != null) + GetEntity().remove(); + + Event.CreatureDeregister(this); + } + + @Override + public void Loot() + { + + } + + public void SetRadialLead(double lead) + { + _radialLead = lead; + } + + public abstract void StateChange(int newState); + + +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventTerrainFinder.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventTerrainFinder.java new file mode 100644 index 000000000..6b656ab0e --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventTerrainFinder.java @@ -0,0 +1,176 @@ +package nautilus.game.pvp.worldevent; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Set; + +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; + +import org.bukkit.Chunk; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; + +public class EventTerrainFinder +{ + public EventManager Manager; + + public EventTerrainFinder(EventManager manager) + { + Manager = manager; + } + + public double PosNeg() + { + if (Math.random() > 0.5) + return -1; + return 1; + } + + public Location FindArea(World world, int size, int vert) + { + for (int i=0 ; i<20 ; i++) + { + int x = 0; + int z = 0; + + //X Side + if (Math.random() > 0.5) + { + x = (int) (PosNeg() * ((400 + size) + UtilMath.r(200 - (size*2)))); + z = (int) (PosNeg() * UtilMath.r(600 - size)); + } + //Z Side + else + { + z = (int) (PosNeg() * ((400 + size) + UtilMath.r(200 - (size*2)))); + x = (int) (PosNeg() * UtilMath.r(600 - size)); + } + + Location loc = UtilBlock.getHighest(world, x, z).getLocation(); + + int total = ((size*2)+1)*((size*2)+1); + + int liquid = 0; + HashMap heights = new HashMap(); + + HashSet chunks = new HashSet(); + boolean wilderness = true; + + //Gather Data + for (x=-size ; x<=size && wilderness ; x++) + for (z=-size ; z<=size && wilderness ; z++) + { + Block block = UtilBlock.getHighest(world, loc.getBlockX()+x, loc.getBlockZ()+z); + + if (!chunks.contains(block.getChunk())) + if (Manager.Clans().CUtil().isClaimed(block.getLocation())) + { + chunks.add(block.getChunk()); + wilderness = false; + break; + } + + //Liquid + if (block.getRelative(BlockFace.DOWN).isLiquid() || block.isLiquid()) + liquid++; + + //Height + int heightDiff = block.getY() - loc.getBlockY(); + if (!heights.containsKey(heightDiff)) heights.put(heightDiff, 1); + else heights.put(heightDiff, heights.get(heightDiff) + 1); + } + + if (!wilderness) + continue; + + //Too Watery + if ((double)liquid/(double)total > 0.25) + continue; + + //Too Height Variable + int withinHeight = 0; + for (int h=-vert ; h<=vert ; h++) + { + if (!heights.containsKey(h)) + continue; + + withinHeight += heights.get(h); + } + + if ((double)withinHeight/(double)total < 0.9) + continue; + + //Success + return loc; + } + + return null; + } + + public Location LocateSpace(Location areaSource, int areaRadius, int xArea, int yArea, int zArea, boolean replaceBlocks, boolean aboveOther, Set otherBlock) + { + for (int i=0 ; i<20 ; i++) + { + int x = UtilMath.r(areaRadius*2) - areaRadius + areaSource.getBlockX(); + int z = UtilMath.r(areaRadius*2) - areaRadius + areaSource.getBlockZ(); + + Block block = UtilBlock.getHighest(areaSource.getWorld(), x, z); + + if (!aboveOther) + if (otherBlock.contains(block.getRelative(BlockFace.DOWN))) + continue; + + boolean valid = true; + + int overlaps = 0; + + //Previous + for (x=-xArea ; x<=xArea ; x++) + { + for (z=-zArea ; z<=zArea ; z++) + { + for (int y=0 ; y<=yArea ; y++) + { + //Check Blocks + Block cur = areaSource.getWorld().getBlockAt(block.getX()+x, block.getY()+y, block.getZ()+z); + + if (cur.getRelative(BlockFace.DOWN).isLiquid()) + { + valid = false; + break; + } + + if (otherBlock.contains(cur)) + { + valid = false; + break; + } + + //Check Area + if (!UtilBlock.airFoliage(cur)) + overlaps += 1; + } + + if (!valid) + break; + } + + if (!valid) + break; + } + + if (!replaceBlocks && overlaps > 0) + continue; + + if (!valid) + continue; + + return block.getLocation(); + } + + return null; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/BroodMother.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/BroodMother.java new file mode 100644 index 000000000..71810d003 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/BroodMother.java @@ -0,0 +1,352 @@ +package nautilus.game.pvp.worldevent.creature; + +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilTime; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventMobBoss; + +public class BroodMother extends EventMobBoss implements IThrown +{ + private HashMap _eggs = new HashMap(); + private long _eggLast = System.currentTimeMillis(); + private int _eggSpawns = 0; + + private long _webLast = System.currentTimeMillis(); + private int _webSpawns = 0; + private int _webMax = 80; + + private int _eggItems = 0; + private int _eggItemMax = 20; + + private long _stateLast = System.currentTimeMillis(); + + //States + //0 Normal + //1 Eggs + //2 Webs + + public BroodMother(EventBase event, Location location) + { + super(event, location, "Brood Mother", true, 800, EntityType.SPIDER); + + _minionsMax = 80; + } + + @EventHandler + public void Heal(UpdateEvent event) + { + if (GetEntity() == null) + return; + + if (event.getType() != UpdateType.SEC) + return; + + ModifyHealth(1); + } + + @Override + public void Die() + { + Event.Manager.Blood().Effects(GetEntity().getEyeLocation(), 50, 0.8, + Sound.SPIDER_DEATH, 2f, 0.5f, Material.BONE, (byte)0, false); + Loot(); + Remove(); + } + + @Override + public void Remove() + { + if (GetEntity() != null) + GetEntity().remove(); + + Event.CreatureDeregister(this); + + for (Block cur : _eggs.keySet()) + cur.setTypeId(0); + } + + @Override + public void Loot() + { + Event.Manager.Loot().DropLoot(GetEntity().getEyeLocation(), 40, 40, 0.2f, 0.05f, 3d); + } + + @Override + public void DistanceAction() + { + // TODO Auto-generated method stub + } + + @EventHandler + public void StateSwitch(UpdateEvent event) + { + if (_state != 0) + return; + + if (event.getType() != UpdateType.SEC) + return; + + if (!UtilTime.elapsed(_stateLast, 12000)) + return; + + if (Math.random() > 0.5 || _minions.size() + _eggs.size() < 6) + { + if (_minions.size() + _eggs.size() < 6 || UtilTime.elapsed(_eggLast, 30000)) + { + _eggLast = System.currentTimeMillis(); + _state = 1; + _eggSpawns = GetMinionsMax(); + ((Creature)GetEntity()).setTarget(null); + } + } + else + { + if (UtilTime.elapsed(_webLast, 30000)) + { + _webLast = System.currentTimeMillis(); + _state = 2; + _webSpawns = Scale(_webMax); + ((Creature)GetEntity()).setTarget(null); + } + } + } + + private int Scale(int a) + { + return (int) (a * (0.1 + (0.9 - 0.9 * (GetHealthCur() / GetHealthMax())))); + } + + private int GetMinionsMax() + { + int max = Scale(_minionsMax); + max -= _minions.size(); + + return max; + } + + @EventHandler + public void WebSpawn(UpdateEvent event) + { + if (_state != 2) + return; + + if (event.getType() != UpdateType.FASTEST) + return; + + if (GetEntity() == null) + return; + + if (_webSpawns <= 0) + { + _state = 0; + _stateLast = System.currentTimeMillis(); + return; + } + + _webSpawns--; + + //Item + Item item = GetEntity().getWorld().dropItem(GetEntity().getLocation().add(0, 0.5, 0), + ItemStackFactory.Instance.CreateStack(Material.WEB)); + + //Velocity + UtilAction.velocity(item, new Vector(Math.random()-0.5, 0, Math.random()-0.5).normalize(), + Math.random() * 0.4 + 0.2, false, 0, Math.random() * 0.6 + 0.4, 10, false); + + //Sound + item.getWorld().playSound(item.getLocation(), Sound.BREATH, 0.5f, 0.2f); + + //Thrown + Event.Manager.Throw().AddThrow(item, GetEntity(), this, + -1, false, false, true, + null, 2f, 0.5f, + null, 0, UpdateType.TICK, 1.5d); + } + + @EventHandler + public void EggSpawn(UpdateEvent event) + { + if (_state != 1) + return; + + if (event.getType() != UpdateType.FASTEST) + return; + + if (GetEntity() == null) + return; + + if (_eggSpawns <= 0) + { + _state = 0; + _stateLast = System.currentTimeMillis(); + return; + } + + if (_eggItems >= _eggItemMax) + return; + + _eggSpawns--; + + //Item + Item item = GetEntity().getWorld().dropItem(GetEntity().getLocation().add(0, 0.5, 0), + ItemStackFactory.Instance.CreateStack(Material.DRAGON_EGG)); + + //Velocity + UtilAction.velocity(item, new Vector(Math.random()-0.5, 0, Math.random()-0.5).normalize(), + Math.random() * 0.4 + 0.2, false, 0, Math.random() * 0.6 + 0.4, 10, false); + + //Sound + item.getWorld().playSound(item.getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1f); + + //Thrown + Event.Manager.Throw().AddThrow(item, GetEntity(), this, + -1, false, false, true, + null, 2f, 0.5f, + null, 0, UpdateType.TICK, 1.5d); + + _eggItems++; + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + //Null + } + + @Override + public void Idle(ProjectileUser data) + { + BlockForm(data); + } + + @Override + public void Expire(ProjectileUser data) + { + BlockForm(data); + } + + public void BlockForm(ProjectileUser data) + { + Material mat = ((Item)data.GetThrown()).getItemStack().getType(); + + if (mat == Material.DRAGON_EGG) + { + Block egg = data.GetThrown().getLocation().getBlock(); + + if (egg.getRelative(BlockFace.DOWN).getType() != Material.DRAGON_EGG && + egg.getRelative(BlockFace.DOWN).getType() != Material.WEB) + { + egg.setType(Material.DRAGON_EGG); + _eggs.put(egg, System.currentTimeMillis()); + } + + _eggItems--; + } + else if (mat == Material.WEB) + { + Block web = data.GetThrown().getLocation().getBlock(); + + if (web.getType() != Material.WATER && web.getType() != Material.STATIONARY_WATER) + Event.Manager.BlockRestore().Add(web, 30, (byte)0, Scale(40000)); + } + + data.GetThrown().remove(); + } + + @EventHandler + public void EggHatch(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (_eggs.isEmpty()) + return; + + HashSet hatch = new HashSet(); + + for (Block block : _eggs.keySet()) + if (Math.random() > 0.98) + if (UtilTime.elapsed(_eggs.get(block), 12000)) + hatch.add(block); + + for (Block block : hatch) + { + _eggs.remove(block); + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + block.setTypeId(0); + Event.CreatureRegister(new Broodling(Event, block.getLocation().add(0.5, 0.5, 0.5), this)); + } + } + + @EventHandler + public void EggCrush(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetEntity().getWorld().getPlayers()) + { + Block below = cur.getLocation().getBlock().getRelative(BlockFace.DOWN); + if (below.getType() != Material.DRAGON_EGG) + continue; + + if (!_eggs.containsKey(below)) + continue; + + _eggs.remove(below); + below.setTypeId(0); + below.getWorld().playEffect(below.getLocation(), Effect.STEP_SOUND, 122); + + UtilAction.velocity(cur, cur.getLocation().getDirection(), 0.3, true, 0.3, 0, 10, true); + } + } + + @EventHandler + public void EggHit(PlayerInteractEvent event) + { + if (event.getClickedBlock() == null) + return; + + if (!_eggs.containsKey(event.getClickedBlock())) + return; + + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void TargetCancel(EntityTargetEvent event) + { + if (!event.getEntity().equals(GetEntity())) + return; + + if (_state == 0 && (GetHealthCur() / GetHealthMax()) < 0.5) + return; + + event.setCancelled(true); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/BroodMother.java.orig b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/BroodMother.java.orig new file mode 100644 index 000000000..9d020ee14 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/BroodMother.java.orig @@ -0,0 +1,366 @@ +package nautilus.game.pvp.worldevent.creature; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import me.chiss.Core.Items.IThrown; +import me.chiss.Core.Managers.Throw.IProjectileUser; +import me.chiss.Core.Updater.UpdateEvent; +import me.chiss.Core.Updater.UpdateEvent.UpdateType; +import me.chiss.Core.Utility.UtilAction; +import me.chiss.Core.Utility.UtilTime; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventCreatureBase; + +public class BroodMother extends EventCreatureBase implements IThrown +{ + private ArrayList _minions = new ArrayList(); + private int _minionsMax = 100; + + private HashMap _eggs = new HashMap(); + private long _eggLast = System.currentTimeMillis(); + private int _eggSpawns = 0; + + private long _webLast = System.currentTimeMillis(); + private int _webSpawns = 0; + private int _webMax = 100; + + private int _eggItems = 0; + private int _eggItemMax = 20; + + private long _stateLast = System.currentTimeMillis(); + + private int _state = 0; + //Normal + //Eggs + //Run + //Webs + + public BroodMother(EventBase event, Location location) + { + super(event, location, "Brood Mother", true, 800, EntityType.SPIDER); + } + + @EventHandler + public void Heal(UpdateEvent event) + { + if (GetEntity() == null) + return; + + if (event.getType() != UpdateType.SEC) + return; + + ModifyHealth(1); + } + + @Override + public void Die() + { + Event.Manager.Blood().Effects(GetEntity().getEyeLocation(), 50, 0.8, + Sound.SPIDER_DEATH, 2f, 0.5f, Material.BONE, (byte)0, false); + Loot(); + Remove(); + } + + @Override + public void Loot() + { + Event.Manager.Loot().DropLoot(GetEntity().getEyeLocation(), 40, 40, 0.2f, 0.05f, 3d); + } + + @EventHandler + public void StateSwitch(UpdateEvent event) + { + if (_state != 0) + return; + + if (event.getType() != UpdateType.SEC) + return; + + if (!UtilTime.elapsed(_stateLast, 12000)) + return; + + if (Math.random() > 0.5 || _minions.size() + _eggs.size() < 6) + { + if (_minions.size() + _eggs.size() < 6 || UtilTime.elapsed(_eggLast, 30000)) + { + _eggLast = System.currentTimeMillis(); + _state = 1; + _eggSpawns = GetMinionsMax(); + ((Creature)GetEntity()).setTarget(null); + } + } + else + { + if (UtilTime.elapsed(_webLast, 30000)) + { + _webLast = System.currentTimeMillis(); + _state = 2; + _webSpawns = Scale(_webMax); + ((Creature)GetEntity()).setTarget(null); + } + } + } + + private int Scale(int a) + { + return (int) (a * (0.1 + (0.9 - 0.9 * (GetHealthCur() / GetHealthMax())))); + } + + private int GetMinionsMax() + { + int max = Scale(_minionsMax); + max -= _minions.size(); + + return max; + } + + @EventHandler + public void WebSpawn(UpdateEvent event) + { + if (_state != 2) + return; + + if (event.getType() != UpdateType.FASTEST) + return; + + if (GetEntity() == null) + return; + + if (_webSpawns <= 0) + { + _state = 0; + _stateLast = System.currentTimeMillis(); + return; + } + + _webSpawns--; + + //Item + Item item = GetEntity().getWorld().dropItem(GetEntity().getLocation().add(0, 0.5, 0), + Event.Manager.Item().CreateStack(Material.WEB)); + + //Velocity + UtilAction.velocity(item, new Vector(Math.random()-0.5, 0, Math.random()-0.5).normalize(), + Math.random() * 0.4 + 0.2, false, 0, Math.random() * 0.6 + 0.4, 10, false); + + //Sound + item.getWorld().playSound(item.getLocation(), Sound.BREATH, 0.5f, 0.2f); + + //Thrown + Event.Manager.Throw().AddThrow(item, GetEntity(), this, + -1, false, false, true, + null, 2f, 0.5f, + null, 0, UpdateType.TICK, 1.5d); + } + + @EventHandler + public void EggSpawn(UpdateEvent event) + { + if (_state != 1) + return; + + if (event.getType() != UpdateType.FASTEST) + return; + + if (GetEntity() == null) + return; + + if (_eggSpawns <= 0) + { + _state = 0; + _stateLast = System.currentTimeMillis(); + return; + } + + if (_eggItems >= _eggItemMax) + return; + + _eggSpawns--; + + //Item + Item item = GetEntity().getWorld().dropItem(GetEntity().getLocation().add(0, 0.5, 0), + Event.Manager.Item().CreateStack(Material.DRAGON_EGG)); + + //Velocity + UtilAction.velocity(item, new Vector(Math.random()-0.5, 0, Math.random()-0.5).normalize(), + Math.random() * 0.4 + 0.2, false, 0, Math.random() * 0.6 + 0.4, 10, false); + + //Sound + item.getWorld().playSound(item.getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1f); + + //Thrown + Event.Manager.Throw().AddThrow(item, GetEntity(), this, + -1, false, false, true, + null, 2f, 0.5f, + null, 0, UpdateType.TICK, 1.5d); + + _eggItems++; + } + + @Override + public void Collide(LivingEntity target, Block block, IProjectileUser data) + { + //Null + } + + @Override + public void Idle(IProjectileUser data) + { + BlockForm(data); + } + + @Override + public void Expire(IProjectileUser data) + { + BlockForm(data); + } + + public void BlockForm(IProjectileUser data) + { + Material mat = ((Item)data.GetThrown()).getItemStack().getType(); + + if (mat == Material.DRAGON_EGG) + { + Block egg = data.GetThrown().getLocation().getBlock(); + + if (egg.getRelative(BlockFace.DOWN).getType() != Material.DRAGON_EGG && + egg.getRelative(BlockFace.DOWN).getType() != Material.WEB) + { + egg.setType(Material.DRAGON_EGG); + _eggs.put(egg, System.currentTimeMillis()); + } + + _eggItems--; + } + else if (mat == Material.WEB) + { + Block web = data.GetThrown().getLocation().getBlock(); + + if (web.getType() != Material.WATER && web.getType() != Material.STATIONARY_WATER) + Event.Manager.BlockRestore().Add(web, 30, (byte)0, Scale(40000)); + } + + data.GetThrown().remove(); + } + + @EventHandler + public void EggHatch(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (_eggs.isEmpty()) + return; + + HashSet hatch = new HashSet(); + + for (Block block : _eggs.keySet()) + if (Math.random() > 0.98) + if (UtilTime.elapsed(_eggs.get(block), 12000)) + hatch.add(block); + + for (Block block : hatch) + { + _eggs.remove(block); + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + block.setTypeId(0); + Event.CreatureRegister(new Broodling(Event, block.getLocation().add(0.5, 0.5, 0.5), this)); + } + } + + @EventHandler + public void EggCrush(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetEntity().getWorld().getPlayers()) + { + Block below = cur.getLocation().getBlock().getRelative(BlockFace.DOWN); + if (below.getType() != Material.DRAGON_EGG) + continue; + + if (!_eggs.containsKey(below)) + continue; + + _eggs.remove(below); + below.setTypeId(0); + below.getWorld().playEffect(below.getLocation(), Effect.STEP_SOUND, 122); + + UtilAction.velocity(cur, cur.getLocation().getDirection(), 0.3, true, 0.3, 0, 10, true); + } + } + + @EventHandler + public void EggHit(PlayerInteractEvent event) + { + if (event.getClickedBlock() == null) + return; + + if (!_eggs.containsKey(event.getClickedBlock())) + return; + + event.setCancelled(true); + } + + public void MinionRegister(Broodling minion) + { + _minions.add(minion); + } + + public void MinionDeregister(Broodling minion) + { + _minions.remove(minion); + } + + public ArrayList GetMinions() + { + return _minions; + } + + @EventHandler(priority = EventPriority.LOWEST) + public void TargetCancel(EntityTargetEvent event) + { + if (!event.getEntity().equals(GetEntity())) + return; + + if (_state == 0 && (GetHealthCur() / GetHealthMax()) < 0.5) + return; + + event.setCancelled(true); + } + + public boolean CanTarget(LivingEntity ent) + { + int i = 0; + + for (Broodling cur : _minions) + { + LivingEntity target = ((Creature)cur.GetEntity()).getTarget(); + + if (target != null && target.equals(ent)) + i++; + } + + return i < Scale(20); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/Broodling.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/Broodling.java new file mode 100644 index 000000000..77c3eb5d4 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/Broodling.java @@ -0,0 +1,136 @@ +package nautilus.game.pvp.worldevent.creature; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventMobMinion; + +public class Broodling extends EventMobMinion +{ + private LivingEntity _mount = null; + private long _mountTime = 0; + + public Broodling(EventBase event, Location location, BroodMother host) + { + super(event, location, "Broodling", true, 24, EntityType.CAVE_SPIDER, host); + + _mountTime = System.currentTimeMillis(); + } + + @Override + public void StateChange(int newState) + { + //SPIDERLINGS DONT CARE!!!! + } + + @Override + public void DamagerCustom(CustomDamageEvent event) + { + Mount(event); + } + + public void Mount(CustomDamageEvent event) + { + if (_target == null) + return; + + if (!(_target instanceof Player)) + + if (!event.GetDamageeEntity().equals(_target)) + return; + + if (Math.random() > 0.50) + return; + + if (UtilMath.offset(GetEntity(), _target) > 2) + return; + + if (!UtilTime.elapsed(_mountTime, 8000)) + return; + + if (_target.getPassenger() != null && _target.getPassenger().getType() == EntityType.CAVE_SPIDER) + return; + + //Condition Indicators + Event.Manager.Condition().SetIndicatorVisibility(_target, false); + + //Action + _target.eject(); + _target.setPassenger(GetEntity()); + + _mount = _target; + _mountTime = System.currentTimeMillis(); + } + + @EventHandler + public void Dismount(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_mount == null) + return; + + if (!UtilTime.elapsed(_mountTime, 4000)) + return; + + GetEntity().leaveVehicle(); + _mount.eject(); + + _mountTime = System.currentTimeMillis(); + + Event.Manager.Condition().SetIndicatorVisibility(_mount, true); + } + + @Override + public void Die() + { + Event.Manager.Blood().Effects(GetEntity().getEyeLocation(), 4, 0.5, + Sound.SPIDER_DEATH, 1f, 1f, Material.BONE, (byte)0, false); + + Loot(); + Remove(); + } + + @EventHandler + public void Leap(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + if (_target == null || _target.isDead() || !_target.isValid()) + return; + + if (_mount != null) + return; + + if (!Valid()) + return; + + //Leap + if ( Math.random() > 0.75 && + UtilEnt.isGrounded(GetEntity()) && + UtilMath.offset(GetEntity().getLocation(), _target.getEyeLocation()) > 2) + { + Vector vec = UtilAlg.getTrajectory(GetEntity().getLocation(), _target.getEyeLocation()); + UtilAction.velocity(GetEntity(), vec, Math.random()/2 + 0.5, false, 0, Math.random()/3, 0.3, true); + } + } + + +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/SkeletonKing.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/SkeletonKing.java new file mode 100644 index 000000000..babe66128 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/SkeletonKing.java @@ -0,0 +1,210 @@ +package nautilus.game.pvp.worldevent.creature; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftSkeleton; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Skeleton; +import org.bukkit.entity.Skeleton.SkeletonType; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilTime; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventMobBoss; +import nautilus.game.pvp.worldevent.EventMobMinion; +import net.minecraft.server.v1_6_R2.EntitySkeleton; +import net.minecraft.server.v1_6_R2.Item; +import net.minecraft.server.v1_6_R2.ItemStack; + +public class SkeletonKing extends EventMobBoss +{ + private int _minionsMax = 16; + + private long _stateTime = System.currentTimeMillis(); + + public SkeletonKing(EventBase event, Location location) + { + super(event, location, "Skeleton King", true, 800, EntityType.SKELETON); + + _minionTargetLimit = 4; + } + + @Override + public void SpawnCustom() + { + if (!(GetEntity() instanceof Skeleton)) + return; + + try + { + Skeleton skel = (Skeleton)GetEntity(); + skel.setSkeletonType(SkeletonType.WITHER); + CraftSkeleton skelC = (CraftSkeleton)skel; + EntitySkeleton skelMC = skelC.getHandle(); + + skelMC.setEquipment(0, new ItemStack(Item.IRON_SWORD)); + } + catch (Exception e) + { + System.out.println("Skeleton Armor Error."); + } + } + + @Override + public void DamagedCustom(CustomDamageEvent event) + { + if (event.GetCause() == DamageCause.PROJECTILE) + { + if (!event.GetDamageeEntity().equals(GetEntity())) + return; + + event.SetCancelled("Skeleton Resistance"); + } + + if (event.GetCause() == DamageCause.FIRE) + { + if (!event.GetDamageeEntity().equals(GetEntity())) + return; + + GetEntity().setFireTicks(0); + + event.SetCancelled("Skeleton Resistance"); + } + } + + @EventHandler + public void Combust(EntityCombustEvent event) + { + if (GetEntity() == null) + return; + + if (event.getEntity().equals(GetEntity())) + event.setCancelled(true); + } + + @EventHandler + public void Heal(UpdateEvent event) + { + if (GetEntity() == null) + return; + + if (event.getType() != UpdateType.SEC) + return; + + ModifyHealth(1); + } + + @Override + public void Die() + { + Event.Manager.Blood().Effects(GetEntity().getEyeLocation(), 50, 0.8, + Sound.SKELETON_DEATH, 2f, 0.2f, Material.BONE, (byte)0, false); + Loot(); + Remove(); + } + + @Override + public void Loot() + { + Event.Manager.Loot().DropLoot(GetEntity().getEyeLocation(), 40, 40, 0.2f, 0.05f, 3d); + } + + @EventHandler + public void MinionSpawn(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + if (GetState() != 1) + return; + + if (GetEntity() == null) + return; + + if (_minions.size() >= _minionsMax) + return; + + Event.CreatureRegister(new SkeletonMinion(Event, GetEntity().getLocation(), this)); + + MinionPositions(); + } + + public void MinionPositions() + { + int i = 0; + for (EventMobMinion cur : _minions) + { + cur.SetRadialLead(i * ((2d * Math.PI)/_minions.size())); + i++; + } + } + + public int GetState() + { + return _state; + } + + public void SetState(int state) + { + _state = state; + _stateTime = System.currentTimeMillis(); + + for (EventMobMinion cur : _minions) + cur.StateChange(state); + } + + @EventHandler + public void StateChanger(UpdateEvent event) + { + if (GetEntity() == null) + return; + + if (event.getType() != UpdateType.FAST) + return; + + if (GetState() == 0) + { + if (UtilTime.elapsed(_stateTime, 30000)) + { + SetState(1); + ((Skeleton)GetEntity()).setTarget(null); + } + } + else if (GetState() == 1) + { + if (UtilTime.elapsed(_stateTime, 8000) && _minions.size() == _minionsMax) + { + SetState(2); + } + } + else if (GetState() == 2) + { + if (UtilTime.elapsed(_stateTime, 8000)) + { + SetState(0); + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void TargetCancel(EntityTargetEvent event) + { + if (GetState() == 1 && event.getEntity().equals(GetEntity())) + event.setCancelled(true); + } + + @Override + public void DistanceAction() + { + // TODO Auto-generated method stub + + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/SkeletonMinion.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/SkeletonMinion.java new file mode 100644 index 000000000..9d6970b36 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/SkeletonMinion.java @@ -0,0 +1,183 @@ +package nautilus.game.pvp.worldevent.creature; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftSkeleton; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventMobMinion; +import net.minecraft.server.v1_6_R2.EntityCreature; +import net.minecraft.server.v1_6_R2.EntitySkeleton; +import net.minecraft.server.v1_6_R2.Item; +import net.minecraft.server.v1_6_R2.ItemStack; +import net.minecraft.server.v1_6_R2.Navigation; + +public class SkeletonMinion extends EventMobMinion +{ + public SkeletonMinion(EventBase event, Location location, SkeletonKing host) + { + super(event, location, "Skeleton Minion", true, 32, EntityType.SKELETON, host); + + if (GetState() == 0) + SetWeapon(Item.IRON_SWORD); + } + + @Override + public void SpawnCustom() + { + if (!(GetEntity() instanceof Skeleton)) + return; + + try + { + Skeleton skel = (Skeleton)GetEntity(); + CraftSkeleton skelC = (CraftSkeleton)skel; + EntitySkeleton skelMC = skelC.getHandle(); + + skelMC.setEquipment(0, new ItemStack(Item.BOW)); + } + catch (Exception e) + { + System.out.println("Skeleton Armor Error."); + } + } + + @Override + public void DamagedCustom(CustomDamageEvent event) + { + if (event.GetCause() == DamageCause.PROJECTILE) + { + if (!event.GetDamageeEntity().equals(GetEntity())) + return; + + event.SetCancelled("Skeleton Resistance"); + } + + if (event.GetCause() == DamageCause.FIRE) + { + if (!event.GetDamageeEntity().equals(GetEntity())) + return; + + GetEntity().setFireTicks(0); + + event.SetCancelled("Skeleton Resistance"); + } + + if (Math.random() > 0.5) + { + LivingEntity damager = event.GetDamagerEntity(true); + if (damager != null) + SetTarget(damager); + } + } + + @Override + public void StateChange(int newState) + { + if (newState == 0) + SetWeapon(Item.IRON_SWORD); + + if (newState == 1) + SetWeapon(Item.BOW); + } + + public void SetWeapon(Item item) + { + ((Skeleton)GetEntity()).setTarget(null); + + try + { + Skeleton skel = (Skeleton)GetEntity(); + CraftSkeleton skelC = (CraftSkeleton)skel; + EntitySkeleton skelMC = skelC.getHandle(); + + skelMC.setEquipment(0, new ItemStack(item)); + } + catch (Exception e) + { + System.out.println("Skeleton Weapon Error."); + } + } + + @Override + public boolean TargetCancelCustom(Entity target) + { + return (GetState() != 0 && !target.equals(GetEntity())); + } + + @Override + public void Die() + { + Event.Manager.Blood().Effects(GetEntity().getEyeLocation(), 10, 0.5, + Sound.SKELETON_DEATH, 1f, 1f, Material.BONE, (byte)0, false); + + Loot(); + Remove(); + } + + @EventHandler(priority = EventPriority.HIGH) // AFTER ARROW + public void Orbit(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (GetState() == 0) + return; + + if (!Valid()) + return; + + double sizeMod = 2 + (((SkeletonKing)_host).GetMinions().size() / 20); + + //Orbit + double speed = 20d; + double oX = Math.sin(_host.GetEntity().getTicksLived()/speed + _radialLead) * 2 * sizeMod; + double oY = 1; + double oZ = Math.cos(_host.GetEntity().getTicksLived()/speed + _radialLead) * 2 * sizeMod; + + //Move + EntityCreature ec = ((CraftCreature)GetEntity()).getHandle(); + Navigation nav = ec.getNavigation(); + Location loc = _host.GetEntity().getLocation().add(oX, oY, oZ); + nav.a(loc.getX(), loc.getY(), loc.getZ(), 0.4f); + } + + @EventHandler + public void Arrow(UpdateEvent event) + { + if (GetState() != 2) + return; + + if (event.getType() != UpdateType.FASTEST) + return; + + if (!Valid()) + return; + + Arrow arrow = GetEntity().getWorld().spawnArrow( + GetEntity().getEyeLocation().add(UtilAlg.getTrajectory2d(_host.GetEntity(), GetEntity())), + UtilAlg.getTrajectory2d(_host.GetEntity(), GetEntity()).normalize(), 2f, 16f); + arrow.setShooter(GetEntity()); + + Event.AddArrow(arrow); + } + + public int GetState() + { + return _host.GetState(); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/SlimeBase.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/SlimeBase.java new file mode 100644 index 000000000..9c1ec930d --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/SlimeBase.java @@ -0,0 +1,248 @@ +package nautilus.game.pvp.worldevent.creature; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventMobBoss; + +public abstract class SlimeBase extends EventMobBoss +{ + //FLAGS + public int speed = 0; + public int loot = 0; + + public int shieldCount = 0; + private long _shieldLast = 0; + private ArrayList _shields = new ArrayList(); + + public int rocketCount = 0; + private HashMap _rocketReturn = new HashMap(); + + private double _damageLoot = 20; + private double _damageToLoot = 0; + + public SlimeBase(EventBase event, Location location, String name, int health) + { + super(event, location, name, true, health, EntityType.SLIME); + + _attackerDelay = 800; + } + + public abstract void SpawnCustom(); + + @Override + public void DamagedCustom(CustomDamageEvent event) + { + if (event.GetCause() == DamageCause.FALL) + { + event.SetCancelled("Fall Immunity"); + return; + } + + event.SetKnockback(false); + + _damageToLoot += event.GetDamage(); + + while (_damageToLoot >= _damageLoot) + { + Event.Manager.Loot().DropEmerald(GetEntity().getLocation(), 1, 0, 2d); + _damageToLoot -= _damageLoot; + } + } + + @Override + public void Die() + { + Event.Manager.Blood().Effects(GetEntity().getEyeLocation(), 30, 1, + Sound.SLIME_WALK, 2f, 0.6f, Material.SLIME_BALL, (byte)0, false); + + Split(); + Loot(); + Remove(); + } + + + public abstract void Split(); + + public void Loot() + { + Event.Manager.Loot().DropLoot(GetEntity().getEyeLocation(), loot, loot, 0.05f, 0.03f, 2d); + } + + public void RocketLaunch(LivingEntity target) + { + Event.CreatureRegister(new SlimeRocket(Event, GetEntity().getEyeLocation(), target)); + } + + @EventHandler + public void SlimeSpeed(UpdateEvent event) + { + if (speed < 1) + return; + + if (GetEntity() == null) + return; + + if (event.getType() != UpdateType.FAST) + return; + + Event.Manager.Condition().Factory().Speed("Slime Speed", GetEntity(), GetEntity(), 1.9, speed-1, false, false); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void RocketCounter(CustomDamageEvent event) + { + if (rocketCount == 0) + return; + + if (event.IsCancelled()) + return; + + if (GetEntity() == null) + return; + + if (event.GetProjectile() == null) + return; + + if (!event.GetDamageeEntity().equals(GetEntity())) + return; + + LivingEntity damager = event.GetDamagerEntity(true); + if (damager == null) return; + + //Return Fire + _rocketReturn.put(damager, rocketCount); + } + + @EventHandler + public void RocketUpdate(UpdateEvent event) + { + if (GetEntity() == null) + return; + + if (event.getType() != UpdateType.SEC) + return; + + HashSet remove = new HashSet(); + + for (LivingEntity target : _rocketReturn.keySet()) + { + int count = _rocketReturn.get(target); + + RocketLaunch(target); + + if (count > 1) + _rocketReturn.put(target, count - 1); + else + remove.add(target); + } + + for (LivingEntity cur : remove) + _rocketReturn.remove(cur); + } + + @EventHandler + public void ShieldSpawn(UpdateEvent event) + { + if (GetEntity() == null) + return; + + if (event.getType() != UpdateType.FAST) + return; + + if (_shields.size() >= shieldCount) + return; + + if (System.currentTimeMillis() < _shieldLast) + return; + + //Regen One + if (!_shields.isEmpty()) + Event.CreatureRegister(new SlimeShield(Event, GetEntity().getLocation(), this)); + + //Regen Fully + else + for (int i=0 ; i 400 || _target == null || _target.isDead() || !_target.isValid()) + { + Die(); + return; + } + + if (UtilMath.offset(GetEntity(), _target) < 2) + Die(); + else + UtilAction.velocity(GetEntity(), UtilAlg.getTrajectory(GetEntity(), _target), + 0.6, false, 0, 0.2, 1, true); + } + + @Override + public void Die() + { + Explode(); + + Event.Manager.Blood().Effects(GetEntity().getEyeLocation(), 10, 0.5, + Sound.SLIME_WALK2, 1f, 1f, Material.SLIME_BALL, (byte)0, false); + + Loot(); + Remove(); + } + + @Override + public void Loot() + { + + } + + public void Explode() + { + if (GetEntity() == null) + { + System.out.println("NULL ENT"); + return; + } + + GetEntity().getWorld().createExplosion(GetEntity().getLocation(), 0f); + + for (Player player : UtilPlayer.getNearby(GetEntity().getLocation(), 2)) + Event.Manager.Damage().NewDamageEvent(player, GetEntity(), null, + DamageCause.CUSTOM, 4, true, true, false, + null, null); + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/SlimeShield.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/SlimeShield.java new file mode 100644 index 000000000..1839ba048 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/SlimeShield.java @@ -0,0 +1,128 @@ +package nautilus.game.pvp.worldevent.creature; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Slime; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventMob; + +public class SlimeShield extends EventMob +{ + private SlimeBase _host; + private double _radialLead = 0; + private boolean teleport = true; + + public SlimeShield(EventBase event, Location location, SlimeBase host) + { + super(event, location, "Slime Shield", false, 5000, EntityType.SLIME); + + _host = host; + + SpawnCustom(); + + _host.ShieldRegister(this); + } + + @Override + public void SpawnCustom() + { + if (!(GetEntity() instanceof Slime)) + return; + + Slime slime = (Slime)GetEntity(); + slime.setSize(2); + } + + @Override + @EventHandler(priority = EventPriority.LOWEST) + public void Damaged(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (GetEntity() == null) + return; + + if (!event.GetDamageeEntity().equals(GetEntity())) + return; + + event.SetCancelled("Slime King Rocket"); + + if (event.GetProjectile() != null) + Die(); + } + + @EventHandler + public void Orbit(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if ( + GetEntity() == null || !GetEntity().isValid() || + _host.GetEntity() == null || _host.GetEntity().isDead() || !_host.GetEntity().isValid() || + UtilMath.offset(GetEntity(), _host.GetEntity()) > 10) + { + Die(); + return; + } + + double sizeMod = 2; + if (_host.GetEntity() instanceof SlimeKing) sizeMod = 2; + else if (_host.GetEntity() instanceof SlimeKingHalf) sizeMod = 1.5; + else if (_host.GetEntity() instanceof SlimeKingQuarter) sizeMod = 1; + + //Orbit + double speed = 10d; + double oX = Math.sin(_host.GetEntity().getTicksLived()/speed + _radialLead) * 2 * sizeMod; + double oY = 3 * sizeMod; + double oZ = Math.cos(_host.GetEntity().getTicksLived()/speed + _radialLead) * 2 * sizeMod; + + if (teleport) + { + GetEntity().teleport(_host.GetEntity().getLocation().add(oX, oY, oZ)); + teleport = false; + } + else + { + UtilAction.velocity(GetEntity(), + UtilAlg.getTrajectory(GetEntity().getLocation(), _host.GetEntity().getLocation().add(oX, oY, oZ)), + 0.4, false, 0, 0.1, 1, true); + } + } + + @Override + public void Die() + { + _host.ShieldDeregister(this); + + Event.Manager.Blood().Effects(GetEntity().getEyeLocation(), 10, 0.5, + Sound.SLIME_WALK2, 2f, 1f, Material.SLIME_BALL, (byte)0, false); + + Loot(); + Remove(); + } + + @Override + public void Loot() + { + + } + + public void SetRadialLead(double lead) + { + _radialLead = lead; + } + +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/Swarmer.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/Swarmer.java new file mode 100644 index 000000000..558f52f26 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/Swarmer.java @@ -0,0 +1,133 @@ +package nautilus.game.pvp.worldevent.creature; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventMobMinion; + +public class Swarmer extends EventMobMinion +{ + private int _leapRange = 2; + + public Swarmer(EventBase event, Location location, SwarmerHost host) + { + super(event, location, "Swarmer", false, 10, EntityType.SILVERFISH, host); + + _target = host.GetEntity(); + } + + @Override + public void Target(UpdateEvent event) + { + //None! + } + + @Override + public void DamagedCustom(CustomDamageEvent event) + { + if (event.GetCause() == DamageCause.FIRE) + { + if (!event.GetDamageeEntity().equals(GetEntity())) + return; + + GetEntity().setFireTicks(0); + + event.SetCancelled("Swarm Resistance"); + return; + } + + if (Math.random() > 0.5) + { + LivingEntity damager = event.GetDamagerEntity(true); + if (damager != null) + SetTarget(damager); + } + } + + @Override + public void DamagerCustom(CustomDamageEvent event) + { + if (!event.GetDamageeEntity().equals(_target)) + return; + + event.AddMod("Swarmer", "Swarm", 2, false); + event.SetKnockback(false); + + _target = _host.GetEntity(); + } + + @EventHandler + public void Heal(UpdateEvent event) + { + if (GetEntity() == null) + return; + + if (event.getType() != UpdateType.SEC) + return; + + ModifyHealth(1); + } + + @Override + public void Die() + { + Event.Manager.Blood().Effects(GetEntity().getEyeLocation(), 4, 0.5, + Sound.SILVERFISH_KILL, 1f, 1f, Material.BONE, (byte)0, false); + + Loot(); + Remove(); + } + + @Override + public void Return(UpdateEvent event) + { + + } + + @EventHandler + public void Leap(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!Valid()) + return; + + if (_target == null || _target.isDead() || !_target.isValid()) + _target = _host.GetEntity(); + + if (!UtilEnt.isGrounded(GetEntity())) + return; + + //Leap + if (Math.random() > 0.95 || UtilMath.offset(GetEntity(), _target) > _leapRange) + { + Vector vec = UtilAlg.getTrajectory(GetEntity(), _target); + UtilAction.velocity(GetEntity(), vec, Math.random()/2 + 0.5, false, 0, Math.random()/3, 0.3, true); + } + + //Move + ((Creature)GetEntity()).setTarget(_target); + } + + @Override + public void StateChange(int newState) + { + //None + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/SwarmerHost.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/SwarmerHost.java new file mode 100644 index 000000000..5140653a8 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/SwarmerHost.java @@ -0,0 +1,121 @@ +package nautilus.game.pvp.worldevent.creature; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventMobBoss; +import nautilus.game.pvp.worldevent.EventMobMinion; + +public class SwarmerHost extends EventMobBoss +{ + private int _minionsMax = 60; + + public SwarmerHost(EventBase event, Location location) + { + super(event, location, "Swarmer", true, 120, EntityType.SILVERFISH); + } + + @Override + public void DamagedCustom(CustomDamageEvent event) + { + if (!_minions.isEmpty()) + { + event.SetCancelled("Minion"); + return; + } + + if (event.GetCause() == DamageCause.FALL) + { + if (!event.GetDamageeEntity().equals(GetEntity())) + return; + + event.SetCancelled("Swarm Resistance"); + } + + if (event.GetCause() == DamageCause.FIRE) + { + if (!event.GetDamageeEntity().equals(GetEntity())) + return; + + GetEntity().setFireTicks(0); + + event.SetCancelled("Swarm Resistance"); + } + } + + @Override + public void Die() + { + Event.Manager.Blood().Effects(GetEntity().getEyeLocation(), 50, 0.8, + Sound.SILVERFISH_KILL, 2f, 0.2f, Material.BONE, (byte)0, false); + Loot(); + Remove(); + } + + @Override + public void Loot() + { + Event.Manager.Loot().DropLoot(GetEntity().getEyeLocation(), 40, 40, 0.2f, 0.05f, 3d); + } + + @EventHandler + public void MinionSpawn(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (GetEntity() == null) + return; + + if (_minions.size() >= _minionsMax) + return; + + if (GetHealthCur() <= _minions.size()) + return; + + Event.CreatureRegister(new Swarmer(Event, GetEntity().getLocation(), this)); + } + + @Override + public void MinionDeregister(EventMobMinion minion) + { + _minions.remove(minion); + ApplyDamage(1); + } + + @EventHandler + public void SendAttacker(UpdateEvent event) + { + if (GetEntity() == null) + return; + + if (event.getType() != UpdateType.FAST) + return; + + if (_minions.size() == 0) + return; + + for (Player player : UtilPlayer.getNearby(GetEntity().getLocation(), 16)) + { + EventMobMinion minion = _minions.get(UtilMath.r(_minions.size())); + minion.SetTarget(player); + } + } + + @Override + public void DistanceAction() + { + //XXX + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/UndeadArcher.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/UndeadArcher.java new file mode 100644 index 000000000..39445399c --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/creature/UndeadArcher.java @@ -0,0 +1,95 @@ +package nautilus.game.pvp.worldevent.creature; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftSkeleton; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilMath; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventMob; +import net.minecraft.server.v1_6_R2.EntitySkeleton; +import net.minecraft.server.v1_6_R2.Item; +import net.minecraft.server.v1_6_R2.ItemStack; + +public class UndeadArcher extends EventMob +{ + public UndeadArcher(EventBase event, Location location) + { + super(event, location, "Undead Archer", true, 60, EntityType.SKELETON); + } + + @Override + public void SpawnCustom() + { + if (!(GetEntity() instanceof Skeleton)) + return; + + try + { + Skeleton skel = (Skeleton)GetEntity(); + CraftSkeleton skelC = (CraftSkeleton)skel; + EntitySkeleton skelMC = skelC.getHandle(); + + skelMC.setEquipment(0, new ItemStack(Item.BOW)); + skelMC.setEquipment(1, new ItemStack(Item.CHAINMAIL_BOOTS)); + skelMC.setEquipment(2, new ItemStack(Item.CHAINMAIL_LEGGINGS)); + skelMC.setEquipment(3, new ItemStack(Item.CHAINMAIL_CHESTPLATE)); + skelMC.setEquipment(4, new ItemStack(Item.CHAINMAIL_HELMET)); + } + catch (Exception e) + { + System.out.println("Skeleton Armor Error."); + } + } + + @EventHandler + public void Condition(UpdateEvent event) + { + if (GetEntity() == null) + return; + + if (event.getType() != UpdateType.SEC) + return; + + ModifyHealth(1); + } + + @Override + public void Die() + { + Event.Manager.Blood().Effects(GetEntity().getEyeLocation(), 10, 0.5, + Sound.SKELETON_DEATH, 1f, 1f, Material.BONE, (byte)0, false); + Loot(); + Remove(); + } + + @Override + public void Loot() + { + if (Math.random() > 0.97) + GetEntity().getWorld().dropItem(GetEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_HELMET)); + + if (Math.random() > 0.97) + GetEntity().getWorld().dropItem(GetEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_CHESTPLATE)); + + if (Math.random() > 0.97) + GetEntity().getWorld().dropItem(GetEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_LEGGINGS)); + + if (Math.random() > 0.97) + GetEntity().getWorld().dropItem(GetEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_BOOTS)); + + if (Math.random() > 0.90) + GetEntity().getWorld().dropItem(GetEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.BOW)); + + GetEntity().getWorld().dropItem(GetEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.ARROW, UtilMath.r(12) + 1)); + + for (int i=0 ; i 16) + return; + + double power = 0.6 + (1.2 * ((dist-3)/13d)); + + //Leap + UtilAction.velocity(zombie, UtilAlg.getTrajectory(zombie, zombie.getTarget()), + power, false, 0, 0.4, 1, true); + + //Effect + zombie.getWorld().playSound(zombie.getLocation(), Sound.ZOMBIE_HURT, 1f, 2f); + } + + @EventHandler + public void Conditions(UpdateEvent event) + { + if (GetEntity() == null) + return; + + if (event.getType() != UpdateType.SEC) + return; + + ModifyHealth(1); + Event.Manager.Condition().Factory().Speed("Undead Haste", GetEntity(), GetEntity(), 1.9, 2, false, false); + } + + @Override + public void Die() + { + Event.Manager.Blood().Effects(GetEntity().getEyeLocation(), 10, 0.5, + Sound.ZOMBIE_DEATH, 1f, 1f, Material.ROTTEN_FLESH, (byte)0, true); + Loot(); + Remove(); + } + + @Override + public void Loot() + { + if (Math.random() > 0.97) + GetEntity().getWorld().dropItem(GetEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.IRON_HELMET)); + + if (Math.random() > 0.97) + GetEntity().getWorld().dropItem(GetEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.IRON_CHESTPLATE)); + + if (Math.random() > 0.97) + GetEntity().getWorld().dropItem(GetEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.IRON_LEGGINGS)); + + if (Math.random() > 0.97) + GetEntity().getWorld().dropItem(GetEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.IRON_BOOTS)); + + if (Math.random() > 0.90) + GetEntity().getWorld().dropItem(GetEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.IRON_SWORD)); + + for (int i=0 ; i _chests = new HashSet(); + + public BaseUndead(EventManager manager) + { + super(manager, "Undead Camp", 1); + + double rand = Math.random(); + + rand = rand * UtilServer.getFilledPercent(); + + if (rand > 0.98) + { + _mod = 4; + SetEventName("Undead Fortress"); + //SetExpire(4); + } + else if (rand > 0.93) + { + _mod = 3; + SetEventName("Undead Stronghold"); + //SetExpire(3); + } + else if (rand > 0.60) + { + _mod = 2; + SetEventName("Undead Village"); + //SetExpire(2); + } + + _areaSize = (int) (8 * _mod); + + _hutMax = (int) (_mod * _mod * (UtilMath.r(4) + 1)); + _towerMax = (int) (_mod * _mod * (UtilMath.r(4) + 3)); + _poleMax = (int) (_mod * _mod * (UtilMath.r(11) + 10)); + _minZombie = (int) (_mod * (UtilMath.r(9) + 8)); + } + + public BaseUndead(EventManager manager, int i) + { + super(manager, "Undead Camp", 1); + + double rand = i; + + if (rand > 0.98) + { + _mod = 4; + SetEventName("Undead Fortress"); + SetExpire(4); + } + else if (rand > 0.93) + { + _mod = 3; + SetEventName("Undead Stronghold"); + SetExpire(3); + } + else if (rand > 0.75) + { + _mod = 2; + SetEventName("Undead Village"); + SetExpire(2); + } + + _areaSize = (int) (8 * _mod); + + _hutMax = (int) (_mod * _mod * (UtilMath.r(4) + 1)); + _towerMax = (int) (_mod * _mod * (UtilMath.r(4) + 3)); + _poleMax = (int) (_mod * _mod * (UtilMath.r(11) + 10)); + _minZombie = (int) (_mod * (UtilMath.r(9) + 8)); + } + + @Override + public void Start() + { + + } + + @Override + public void Stop() + { + + } + + @Override + public void PrepareCustom() + { + if (_loc == null) FindLocation(); + else if (_hutCur < _hutMax) CreateHut(); + else if (GetCreatures().size() < _minZombie) CreateZombie(); + else if (_towerCur < _towerMax) CreateTower(); + else if (_poleCur < _poleMax) CreateLamp(); + + else + { + System.out.println("Constructed " + GetEventName() + " at " + UtilWorld.locToStrClean(_loc) + "."); + AnnounceStart(); + SetState(EventState.LIVE); + } + } + + private void FindLocation() + { + _loc = Manager.TerrainFinder().FindArea(UtilWorld.getWorldType(Environment.NORMAL), _areaSize, 2); + + if (_loc != null) + System.out.println("Constructing " + GetEventName() + " at " + UtilWorld.locToStrClean(_loc) + "..."); + } + + private void AddChest(Block chest) + { + Block side; + int adj = 0; + + side = chest.getRelative(BlockFace.NORTH); + if (side.getType() == Material.CHEST) + { + adj++; + if (side.getRelative(BlockFace.NORTH).getType() == Material.CHEST) return; + if (side.getRelative(BlockFace.SOUTH).getType() == Material.CHEST) return; + if (side.getRelative(BlockFace.EAST).getType() == Material.CHEST) return; + if (side.getRelative(BlockFace.WEST).getType() == Material.CHEST) return; + } + + side = chest.getRelative(BlockFace.SOUTH); + if (side.getType() == Material.CHEST) + { + adj++; + if (side.getRelative(BlockFace.NORTH).getType() == Material.CHEST) return; + if (side.getRelative(BlockFace.SOUTH).getType() == Material.CHEST) return; + if (side.getRelative(BlockFace.EAST).getType() == Material.CHEST) return; + if (side.getRelative(BlockFace.WEST).getType() == Material.CHEST) return; + } + + side = chest.getRelative(BlockFace.EAST); + if (side.getType() == Material.CHEST) + { + adj++; + if (side.getRelative(BlockFace.NORTH).getType() == Material.CHEST) return; + if (side.getRelative(BlockFace.SOUTH).getType() == Material.CHEST) return; + if (side.getRelative(BlockFace.EAST).getType() == Material.CHEST) return; + if (side.getRelative(BlockFace.WEST).getType() == Material.CHEST) return; + } + + side = chest.getRelative(BlockFace.WEST); + if (side.getType() == Material.CHEST) + { + adj++; + if (side.getRelative(BlockFace.NORTH).getType() == Material.CHEST) return; + if (side.getRelative(BlockFace.SOUTH).getType() == Material.CHEST) return; + if (side.getRelative(BlockFace.EAST).getType() == Material.CHEST) return; + if (side.getRelative(BlockFace.WEST).getType() == Material.CHEST) return; + } + + if (adj > 1) + return; + + AddBlock(chest, 130, (byte)(UtilMath.r(4) + 2)); + _chests.add(chest); + } + + private void AddFurnace(Block chest) + { + AddBlock(chest, 61, (byte)(UtilMath.r(4) + 2)); + _chests.add(chest); + } + + private void CreateHut() + { + int hutX = UtilMath.r(4) + 2; + int hutZ = UtilMath.r(4) + 2; + int hutY = UtilMath.r(2) + 3; + + int buffer = Math.max(hutX, hutZ)/2 + 1; + + Location loc = Manager.TerrainFinder().LocateSpace(_loc, _areaSize-buffer, hutX, hutY+2, hutZ, true, false, GetBlocks().keySet()); + + if (loc == null) + return; + + boolean xWall = (Math.random() > 0.5); + boolean zWall = (Math.random() > 0.5); + + //Base + for (int x=-hutX ; x<=hutX ; x++) + for (int z=-hutZ ; z<=hutZ ; z++) + { + Block block = loc.getBlock().getRelative(x, -1, z); + + //Space + for (int y=0 ; y<=hutY ; y++) + AddBlock(loc.getBlock().getRelative(x, y, z), 0, (byte)0); + + //Walls + if (!xWall && x == -hutX || xWall && x == hutX || !zWall && z == -hutZ || zWall && z == hutZ) + for (int y=0 ; y<=hutY ; y++) + AddBlock(loc.getBlock().getRelative(x, y, z), 5, (byte)0); + + //Corners + if (Math.abs(x) == hutX && Math.abs(z) == hutZ) + { + AddBlock(block, 17, (byte)0); + for (int y=0 ; y<=hutY ; y++) + AddBlock(loc.getBlock().getRelative(x, y, z), 17, (byte)0); + + //Support Stands + boolean support = true; + Block below = block; + while (support) + { + below = below.getRelative(BlockFace.DOWN); + + if (!UtilBlock.fullSolid(below) || below.isLiquid()) + AddBlock(below, 17, (byte)0); + + else + support = false; + } + } + + //Floor & Roof + else + { + AddBlock(block, 5, (byte)0); + AddBlock(loc.getBlock().getRelative(x, hutY-1, z), 126, (byte)8); + } + + //Insides + if (Math.abs(x) != hutX && Math.abs(z) != hutZ) + { + if (Math.random() > 0.90) + AddChest(block.getRelative(BlockFace.UP)); + + else if (Math.random() > 0.95) + AddFurnace(block.getRelative(BlockFace.UP)); + + else if (Math.random() > 0.95) + CreatureRegister(new UndeadWarrior(this, block.getRelative(BlockFace.UP).getLocation().add(0.5, 0.5, 0.5))); + } + } + + _hutCur++; + ResetIdleTicks(); + } + + + + private void CreateZombie() + { + + Location loc = Manager.TerrainFinder().LocateSpace(_loc, _areaSize, 0, 3, 0, false, true, GetBlocks().keySet()); + + if (loc == null) + return; + + CreatureRegister(new UndeadWarrior(this, loc.add(0.5, 0.5, 0.5))); + + _poleCur++; + ResetIdleTicks(); + } + + private void CreateTower() + { + int towerX = UtilMath.r(3) + 1; + int towerZ = UtilMath.r(3) + 1; + int towerY = UtilMath.r(4) + 3; + + int buffer = Math.max(towerX, towerZ)/2 + 1; + + Location loc = Manager.TerrainFinder().LocateSpace(_loc, _areaSize-buffer, towerX, towerY+2, towerZ, false, true, GetBlocks().keySet()); + + if (loc == null) + return; + + int ladder = UtilMath.r(4); + + + //Base + for (int x=-towerX ; x<=towerX ; x++) + for (int z=-towerZ ; z<=towerZ ; z++) + { + Block block = loc.getBlock().getRelative(x, towerY, z); + + //Space + for (int y=0 ; y<=towerY ; y++) + AddBlock(loc.getBlock().getRelative(x, y, z), 0, (byte)0); + + //Corner + if (Math.abs(x) == towerX && Math.abs(z) == towerZ) + { + AddBlock(block, 5, (byte)0); + AddBlock(block.getRelative(BlockFace.UP), 85, (byte)0); + + //Support Stands + boolean support = true; + Block below = block; + while (support) + { + below = below.getRelative(BlockFace.DOWN); + + if (!UtilBlock.fullSolid(below) && !below.isLiquid()) + AddBlock(below, 85, (byte)0); + + else if (below.isLiquid()) + AddBlock(below, 17, (byte)0); + + else + support = false; + } + + //Ladder + if (ladder == 0 && x == -towerX && z == -towerZ || + ladder == 1 && x == -towerX && z == towerZ || + ladder == 2 && x == towerX && z == -towerZ || + ladder == 3 && x == towerX && z == towerZ) + { + boolean laddering = true; + below = block; + while (laddering) + { + below = below.getRelative(BlockFace.DOWN); + + if (!UtilBlock.fullSolid(below)) + { + AddBlock(below, 5, (byte)0); + + if (ladder == 0) AddBlock(below.getRelative(-1, 0, 0), 65, (byte)4); + else if (ladder == 1) AddBlock(below.getRelative(-1, 0, 0), 65, (byte)4); + else if (ladder == 2) AddBlock(below.getRelative(1, 0, 0), 65, (byte)5); + else if (ladder == 3) AddBlock(below.getRelative(1, 0, 0), 65, (byte)5); + } + + else + laddering = false; + } + } + } + + //Platform + else + AddBlock(block, 126, (byte)8); + + //Features + if (Math.random() > 0.95) + AddChest(block.getRelative(BlockFace.UP)); + + else if (Math.random() > 0.95) + CreatureRegister(new UndeadArcher(this, block.getRelative(BlockFace.UP).getLocation().add(0.5, 0.5, 0.5))); + } + + _towerCur++; + ResetIdleTicks(); + } + + private void CreateLamp() + { + Location loc = Manager.TerrainFinder().LocateSpace(_loc, _areaSize, 0, 4, 0, false, true, GetBlocks().keySet()); + + if (loc == null) + return; + + AddBlock(loc.getBlock(), 85, (byte)0); + AddBlock(loc.getBlock().getRelative(BlockFace.UP), 85, (byte)0); + AddBlock(loc.getBlock().getRelative(BlockFace.UP).getRelative(BlockFace.UP), 50, (byte)0); + + _poleCur++; + ResetIdleTicks(); + } + + @Override + public void AnnounceStart() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " has been constructed.")); + } + + @Override + public void AnnounceDuring() + { + Location loc = _loc; + for (Block block : _chests) + { + loc = block.getLocation(); + break; + } + + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " is near " + + F.elem(UtilWorld.locToStrClean(loc)) + ".")); + } + + @Override + public void AnnounceEnd() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " has been pillaged.")); + } + + @Override + public void AnnounceExpire() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " has been abandoned.")); + } + + @EventHandler(priority = EventPriority.LOW) + public void ChestOpen(PlayerInteractEvent event) + { + if (event.getClickedBlock() == null) + return; + + if (event.getClickedBlock().getType() != Material.ENDER_CHEST && + event.getClickedBlock().getType() != Material.FURNACE) + return; + + if (!GetBlocks().containsKey(event.getClickedBlock())) + return; + + event.setCancelled(true); + + if (!Manager.Recharge().use(event.getPlayer(), "Loot Chest", 60000, true)) + return; + + if (event.getClickedBlock().getType() == Material.ENDER_CHEST) LootChest(event.getClickedBlock()); + else if (event.getClickedBlock().getType() == Material.FURNACE) LootFurance(event.getClickedBlock()); + + //Inform + UtilPlayer.message(event.getPlayer(), F.main(GetEventName(), "You smash open an " + F.elem("Undead Chest") + "!")); + + //Effect + event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, event.getClickedBlock().getTypeId()); + + //Clear + _chests.remove(event.getClickedBlock()); + event.getClickedBlock().setTypeId(0); + } + + private void LootFurance(Block block) + { + for (int i=0 ; i remove = new HashSet(); + + for (Block cur : _chests) + if (cur.getType() != Material.ENDER_CHEST && cur.getType() != Material.FURNACE && cur.getType() != Material.BURNING_FURNACE) + remove.add(cur); + + for (Block cur : remove) + _chests.remove(cur); + } + + @Override + public boolean CanExpire() + { + if (GetState() != EventState.LIVE) + return false; + + return true; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/BossSkeleton.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/BossSkeleton.java new file mode 100644 index 000000000..bd5853f60 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/BossSkeleton.java @@ -0,0 +1,125 @@ +package nautilus.game.pvp.worldevent.events; + +import org.bukkit.Location; +import org.bukkit.World.Environment; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventMob; +import nautilus.game.pvp.worldevent.EventManager; +import nautilus.game.pvp.worldevent.creature.*; + +public class BossSkeleton extends EventBase +{ + private Location _loc; + + public BossSkeleton(EventManager manager) + { + super(manager, "Skeleton King", 1); + } + + @Override + public void Start() + { + + } + + @Override + public void Stop() + { + + } + + @Override + public void PrepareCustom() + { + if (_loc == null) + FindLocation(); + + if (_loc != null) + { + AnnounceStart(); + SetState(EventState.LIVE); + } + } + + private void FindLocation() + { + _loc = Manager.TerrainFinder().FindArea(UtilWorld.getWorldType(Environment.NORMAL), 8, 1); + + if (_loc != null) + { + Location loc = Manager.TerrainFinder().LocateSpace(_loc, 8, 0, 5, 0, false, false, GetBlocks().keySet()); + + if (loc == null) + { + _loc = null; + return; + } + + CreatureRegister(new SkeletonKing(this, loc.add(0.5, 0.5, 0.5))); + } + } + + @Override + public void AnnounceStart() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " has entered the world.")); + System.out.println(GetEventName() + " Start " + UtilWorld.locToStrClean(_loc) + "."); + } + + @Override + public void AnnounceDuring() + { + for (EventMob cur : GetCreatures()) + if (cur instanceof SkeletonKing) + UtilServer.broadcast(F.main("World Event", F.elem(cur.GetName()) + " is near " + + F.elem(UtilWorld.locToStrClean(cur.GetEntity().getLocation())) + ".")); + } + + @Override + public void AnnounceEnd() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " has been defeated!")); + System.out.println(GetEventName() + " End " + UtilWorld.locToStrClean(_loc) + "."); + } + + @Override + public void AnnounceExpire() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " has left the world.")); + System.out.println(GetEventName() + " Expire " + UtilWorld.locToStrClean(_loc) + "."); + } + + @EventHandler + public void EndCheck(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if (GetState() != EventState.LIVE) + return; + + if (!GetCreatures().isEmpty()) + return; + + TriggerStop(); + AnnounceEnd(); + } + + @Override + public boolean CanExpire() + { + for (EventMob cur : GetCreatures()) + if (cur instanceof EventMob) + if (!((EventMob)cur).CanExpire()) + return false; + + return true; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/BossSlime.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/BossSlime.java new file mode 100644 index 000000000..0f2e5d623 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/BossSlime.java @@ -0,0 +1,125 @@ +package nautilus.game.pvp.worldevent.events; + +import org.bukkit.Location; +import org.bukkit.World.Environment; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventMob; +import nautilus.game.pvp.worldevent.EventManager; +import nautilus.game.pvp.worldevent.creature.*; + +public class BossSlime extends EventBase +{ + private Location _loc; + + public BossSlime(EventManager manager) + { + super(manager, "Slime King", 1); + } + + @Override + public void Start() + { + + } + + @Override + public void Stop() + { + + } + + @Override + public void PrepareCustom() + { + if (_loc == null) + FindLocation(); + + if (_loc != null) + { + AnnounceStart(); + SetState(EventState.LIVE); + } + } + + private void FindLocation() + { + _loc = Manager.TerrainFinder().FindArea(UtilWorld.getWorldType(Environment.NORMAL), 8, 1); + + if (_loc != null) + { + Location loc = Manager.TerrainFinder().LocateSpace(_loc, 8, 0, 5, 0, false, false, GetBlocks().keySet()); + + if (loc == null) + { + _loc = null; + return; + } + + CreatureRegister(new SlimeKing(this, loc.add(0.5, 0.5, 0.5))); + } + } + + @Override + public void AnnounceStart() + { + UtilServer.broadcast(F.main("World Event", F.elem("Slime King") + " has entered the world.")); + System.out.println(GetEventName() + " Start " + UtilWorld.locToStrClean(_loc) + "."); + } + + @Override + public void AnnounceDuring() + { + for (EventMob cur : GetCreatures()) + if (cur instanceof SlimeBase) + UtilServer.broadcast(F.main("World Event", F.elem(cur.GetName()) + " is near " + + F.elem(UtilWorld.locToStrClean(cur.GetEntity().getLocation())) + ".")); + } + + @Override + public void AnnounceEnd() + { + UtilServer.broadcast(F.main("World Event", F.elem("Slime King") + " has been defeated!")); + System.out.println(GetEventName() + " End " + UtilWorld.locToStrClean(_loc) + "."); + } + + @Override + public void AnnounceExpire() + { + UtilServer.broadcast(F.main("World Event", F.elem("Slime King") + " has left the world.")); + System.out.println(GetEventName() + " Expire " + UtilWorld.locToStrClean(_loc) + "."); + } + + @EventHandler + public void EndCheck(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if (GetState() != EventState.LIVE) + return; + + if (!GetCreatures().isEmpty()) + return; + + TriggerStop(); + AnnounceEnd(); + } + + @Override + public boolean CanExpire() + { + for (EventMob cur : GetCreatures()) + if (cur instanceof SlimeBase) + if (!((SlimeBase)cur).CanExpire()) + return false; + + return true; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/BossSpider.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/BossSpider.java new file mode 100644 index 000000000..e8dcbc376 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/BossSpider.java @@ -0,0 +1,125 @@ +package nautilus.game.pvp.worldevent.events; + +import org.bukkit.Location; +import org.bukkit.World.Environment; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventMob; +import nautilus.game.pvp.worldevent.EventManager; +import nautilus.game.pvp.worldevent.creature.*; + +public class BossSpider extends EventBase +{ + private Location _loc; + + public BossSpider(EventManager manager) + { + super(manager, "Brood Mother", 1); + } + + @Override + public void Start() + { + + } + + @Override + public void Stop() + { + + } + + @Override + public void PrepareCustom() + { + if (_loc == null) + FindLocation(); + + if (_loc != null) + { + AnnounceStart(); + SetState(EventState.LIVE); + } + } + + private void FindLocation() + { + _loc = Manager.TerrainFinder().FindArea(UtilWorld.getWorldType(Environment.NORMAL), 8, 1); + + if (_loc != null) + { + Location loc = Manager.TerrainFinder().LocateSpace(_loc, 8, 0, 5, 0, false, false, GetBlocks().keySet()); + + if (loc == null) + { + _loc = null; + return; + } + + CreatureRegister(new BroodMother(this, loc.add(0.5, 0.5, 0.5))); + } + } + + @Override + public void AnnounceStart() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " has entered the world.")); + System.out.println(GetEventName() + " Start " + UtilWorld.locToStrClean(_loc) + "."); + } + + @Override + public void AnnounceDuring() + { + for (EventMob cur : GetCreatures()) + if (cur instanceof BroodMother) + UtilServer.broadcast(F.main("World Event", F.elem(cur.GetName()) + " is near " + + F.elem(UtilWorld.locToStrClean(cur.GetEntity().getLocation())) + ".")); + } + + @Override + public void AnnounceEnd() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " has been defeated!")); + System.out.println(GetEventName() + " End " + UtilWorld.locToStrClean(_loc) + "."); + } + + @Override + public void AnnounceExpire() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " has left the world.")); + System.out.println(GetEventName() + " Expire " + UtilWorld.locToStrClean(_loc) + "."); + } + + @EventHandler + public void EndCheck(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if (GetState() != EventState.LIVE) + return; + + if (!GetCreatures().isEmpty()) + return; + + TriggerStop(); + AnnounceEnd(); + } + + @Override + public boolean CanExpire() + { + for (EventMob cur : GetCreatures()) + if (cur instanceof EventMob) + if (!((EventMob)cur).CanExpire()) + return false; + + return true; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/BossSwarmer.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/BossSwarmer.java new file mode 100644 index 000000000..f4059caaa --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/BossSwarmer.java @@ -0,0 +1,125 @@ +package nautilus.game.pvp.worldevent.events; + +import org.bukkit.Location; +import org.bukkit.World.Environment; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventMob; +import nautilus.game.pvp.worldevent.EventManager; +import nautilus.game.pvp.worldevent.creature.*; + +public class BossSwarmer extends EventBase +{ + private Location _loc; + + public BossSwarmer(EventManager manager) + { + super(manager, "Swarmer", 1); + } + + @Override + public void Start() + { + + } + + @Override + public void Stop() + { + + } + + @Override + public void PrepareCustom() + { + if (_loc == null) + FindLocation(); + + if (_loc != null) + { + AnnounceStart(); + SetState(EventState.LIVE); + } + } + + private void FindLocation() + { + _loc = Manager.TerrainFinder().FindArea(UtilWorld.getWorldType(Environment.NORMAL), 8, 1); + + if (_loc != null) + { + Location loc = Manager.TerrainFinder().LocateSpace(_loc, 8, 0, 5, 0, false, false, GetBlocks().keySet()); + + if (loc == null) + { + _loc = null; + return; + } + + CreatureRegister(new SwarmerHost(this, loc.add(0.5, 0.5, 0.5))); + } + } + + @Override + public void AnnounceStart() + { + UtilServer.broadcast(F.main("World Event", F.elem("Swarmer") + " has entered the world.")); + System.out.println(GetEventName() + " Start " + UtilWorld.locToStrClean(_loc) + "."); + } + + @Override + public void AnnounceDuring() + { + for (EventMob cur : GetCreatures()) + if (cur instanceof SwarmerHost) + UtilServer.broadcast(F.main("World Event", F.elem(cur.GetName()) + " is near " + + F.elem(UtilWorld.locToStrClean(cur.GetEntity().getLocation())) + ".")); + } + + @Override + public void AnnounceEnd() + { + UtilServer.broadcast(F.main("World Event", F.elem("Swarmer") + " has been defeated!")); + System.out.println(GetEventName() + " End " + UtilWorld.locToStrClean(_loc) + "."); + } + + @Override + public void AnnounceExpire() + { + UtilServer.broadcast(F.main("World Event", F.elem("Swarmer") + " has left the world.")); + System.out.println(GetEventName() + " Expire " + UtilWorld.locToStrClean(_loc) + "."); + } + + @EventHandler + public void EndCheck(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if (GetState() != EventState.LIVE) + return; + + if (!GetCreatures().isEmpty()) + return; + + TriggerStop(); + AnnounceEnd(); + } + + @Override + public boolean CanExpire() + { + for (EventMob cur : GetCreatures()) + if (cur instanceof EventMob) + if (!((EventMob)cur).CanExpire()) + return false; + + return true; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/BossWither.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/BossWither.java new file mode 100644 index 000000000..57250252a --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/BossWither.java @@ -0,0 +1,125 @@ +package nautilus.game.pvp.worldevent.events; + +import org.bukkit.Location; +import org.bukkit.World.Environment; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventMob; +import nautilus.game.pvp.worldevent.EventManager; +import nautilus.game.pvp.worldevent.creature.*; + +public class BossWither extends EventBase +{ + private Location _loc; + + public BossWither(EventManager manager) + { + super(manager, "Charles Witherton", 1); + } + + @Override + public void Start() + { + + } + + @Override + public void Stop() + { + + } + + @Override + public void PrepareCustom() + { + if (_loc == null) + FindLocation(); + + if (_loc != null) + { + AnnounceStart(); + SetState(EventState.LIVE); + } + } + + private void FindLocation() + { + _loc = Manager.TerrainFinder().FindArea(UtilWorld.getWorldType(Environment.NORMAL), 8, 1); + + if (_loc != null) + { + Location loc = Manager.TerrainFinder().LocateSpace(_loc, 8, 0, 10, 0, false, false, GetBlocks().keySet()); + + if (loc == null) + { + _loc = null; + return; + } + + CreatureRegister(new Wither(this, loc.add(0.5, 5, 0.5))); + } + } + + @Override + public void AnnounceStart() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " has entered the world.")); + System.out.println(GetEventName() + " Start " + UtilWorld.locToStrClean(_loc) + "."); + } + + @Override + public void AnnounceDuring() + { + for (EventMob cur : GetCreatures()) + if (cur instanceof Wither) + UtilServer.broadcast(F.main("World Event", F.elem(cur.GetName()) + " is near " + + F.elem(UtilWorld.locToStrClean(cur.GetEntity().getLocation())) + ".")); + } + + @Override + public void AnnounceEnd() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " has been defeated!")); + System.out.println(GetEventName() + " End " + UtilWorld.locToStrClean(_loc) + "."); + } + + @Override + public void AnnounceExpire() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " has left the world.")); + System.out.println(GetEventName() + " Expire " + UtilWorld.locToStrClean(_loc) + "."); + } + + @EventHandler + public void EndCheck(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if (GetState() != EventState.LIVE) + return; + + if (!GetCreatures().isEmpty()) + return; + + TriggerStop(); + AnnounceEnd(); + } + + @Override + public boolean CanExpire() + { + for (EventMob cur : GetCreatures()) + if (cur instanceof EventMob) + if (!((EventMob)cur).CanExpire()) + return false; + + return true; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/EndFlood.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/EndFlood.java new file mode 100644 index 000000000..152a54c54 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/EndFlood.java @@ -0,0 +1,211 @@ +package nautilus.game.pvp.worldevent.events; + +import java.util.ArrayList; + +import org.bukkit.Location; +import org.bukkit.World.Environment; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventMob; +import nautilus.game.pvp.worldevent.EventManager; +import nautilus.game.pvp.worldevent.creature.*; + +public class EndFlood extends EventBase +{ + private ArrayList> blocks = new ArrayList>(); + boolean canEnd = false; + private int lowest = 256; + private int borders = 600; + private Location _startLocation; + + public EndFlood(EventManager manager, Location location) + { + super(manager, "Flooding Rains", 1); + + _startLocation = location; + + while (blocks.size() < 256) + blocks.add(new ArrayList()); + } + + @Override + public void Start() + { + + } + + @Override + public void Stop() + { + + } + + @Override + public void PrepareCustom() + { + Flow(_startLocation.getBlock()); + + AnnounceStart(); + SetState(EventState.LIVE); + } + + @Override + public void AnnounceStart() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " is beginning...")); + System.out.println(GetEventName() + " Start."); + Manager.ServerM().stopWeather = true; + } + + @Override + public void AnnounceDuring() + { + for (EventMob cur : GetCreatures()) + if (cur instanceof SlimeBase) + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " is in progress.")); + } + + @Override + public void AnnounceEnd() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " have ended!")); + System.out.println(GetEventName() + " End."); + StormOff(); + } + + @Override + public void AnnounceExpire() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " have ended.")); + System.out.println(GetEventName() + " Expire."); + StormOff(); + } + + public void StormOn() + { + Manager.ServerM().stopWeather = false; + UtilWorld.getWorldType(Environment.NORMAL).setStorm(true); + UtilWorld.getWorldType(Environment.NORMAL).setThundering(true); + UtilWorld.getWorldType(Environment.NORMAL).setWeatherDuration(60000); + UtilWorld.getWorldType(Environment.NORMAL).setThunderDuration(60000); + } + + public void StormOff() + { + Manager.ServerM().stopWeather = true; + } + + @EventHandler + public void EndCheck(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if (GetState() != EventState.LIVE) + return; + + if (GetSize() > 0) + return; + + if (!canEnd) + return; + + TriggerStop(); + AnnounceEnd(); + } + + @Override + public boolean CanExpire() + { + return blocks.isEmpty() && canEnd; + } + + @EventHandler + public void Flood(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (int i=0 ; i < 100 ; i++) + { + Block front = GetBlock(); + if (front == null) + { + System.out.println("Flood Null"); + return; + } + + canEnd = true; + + Flow(front.getRelative(BlockFace.NORTH)); + Flow(front.getRelative(BlockFace.SOUTH)); + Flow(front.getRelative(BlockFace.EAST)); + Flow(front.getRelative(BlockFace.WEST)); + Flow(front.getRelative(BlockFace.DOWN)); + } + } + + @EventHandler + public void Weather(UpdateEvent event) + { + if (event.getType() != UpdateType.MIN_01) + return; + + StormOn(); + } + + public Block GetBlock() + { + while (lowest < 256) + { + if (blocks.get(lowest).isEmpty()) + { + lowest++; + //System.out.println("Blocks: " + GetSize() + " Lowest: " + lowest); + continue; + } + + Block block = blocks.get(lowest).remove(UtilMath.r(blocks.get(lowest).size())); + + return block; + } + + return null; + } + + public boolean Flow(Block block) + { + if (Math.abs(block.getX()) > borders || Math.abs(block.getZ()) > borders) + return false; + + if (block.getTypeId() != 0 && !(block.getTypeId() == 9 && block.getData() != 0)) + return false; + + block.setTypeIdAndData(8, (byte)0, false); + + blocks.get(block.getY()).add(block); + + if (block.getY() < lowest) + lowest = block.getY(); + + return true; + } + + public int GetSize() + { + int count = 0; + for (int i = lowest ; i<256 ; i++) + count += blocks.get(i).size(); + + return count; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/EndVolcano.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/EndVolcano.java new file mode 100644 index 000000000..f4503ba2b --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/events/EndVolcano.java @@ -0,0 +1,104 @@ +package nautilus.game.pvp.worldevent.events; + +import org.bukkit.Location; +import org.bukkit.World.Environment; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import nautilus.game.pvp.worldevent.EventBase; +import nautilus.game.pvp.worldevent.EventMob; +import nautilus.game.pvp.worldevent.EventManager; +import nautilus.game.pvp.worldevent.creature.*; + +public class EndVolcano extends EventBase +{ + private Location _loc; + + public EndVolcano(EventManager manager) + { + super(manager, "Volcanic Apocalypse", 1); + } + + @Override + public void Start() + { + + } + + @Override + public void Stop() + { + + } + + @Override + public void PrepareCustom() + { + _loc = new Location(UtilWorld.getWorldType(Environment.NORMAL), 0, 0, 0); + + if (_loc != null) + { + AnnounceStart(); + SetState(EventState.LIVE); + } + } + + @Override + public void AnnounceStart() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " is nearing eruption.")); + } + + @Override + public void AnnounceDuring() + { + for (EventMob cur : GetCreatures()) + if (cur instanceof SlimeBase) + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " is in progress.")); + } + + @Override + public void AnnounceEnd() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " has ended!")); + System.out.println(GetEventName() + " End " + UtilWorld.locToStrClean(_loc) + "."); + } + + @Override + public void AnnounceExpire() + { + UtilServer.broadcast(F.main("World Event", F.elem(GetEventName()) + " has ended.")); + System.out.println(GetEventName() + " Expire " + UtilWorld.locToStrClean(_loc) + "."); + } + + @EventHandler + public void EndCheck(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if (GetState() != EventState.LIVE) + return; + + if (!GetCreatures().isEmpty()) + return; + + TriggerStop(); + AnnounceEnd(); + } + + @Override + public boolean CanExpire() + { + for (EventMob cur : GetCreatures()) + if (cur instanceof EventMob) + if (!((EventMob)cur).CanExpire()) + return false; + + return true; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/object/Flood.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/object/Flood.java new file mode 100644 index 000000000..1919d67bd --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/object/Flood.java @@ -0,0 +1,15 @@ +package nautilus.game.pvp.worldevent.object; + +public class Flood +{ + short x; + short y; + short z; + + public Flood(short x, short y, short z) + { + this.x = x; + this.y = y; + this.z = z; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/object/Volcano.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/object/Volcano.java new file mode 100644 index 000000000..491ddfb74 --- /dev/null +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/object/Volcano.java @@ -0,0 +1,15 @@ +package nautilus.game.pvp.worldevent.object; + +import org.bukkit.Location; +import org.bukkit.event.Listener; + +public class Volcano implements Listener +{ + Location _loc; + + public Volcano(Location loc) + { + _loc = loc; + } + +} diff --git a/Plugins/Nautilus.Game.Tutorial/.classpath b/Plugins/Nautilus.Game.Tutorial/.classpath new file mode 100644 index 000000000..e08f1fd32 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.Tutorial/.externalToolBuilders/Tutorial Builder.launch b/Plugins/Nautilus.Game.Tutorial/.externalToolBuilders/Tutorial Builder.launch new file mode 100644 index 000000000..d80c1ebc6 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/.externalToolBuilders/Tutorial Builder.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Plugins/Nautilus.Game.Tutorial/.project b/Plugins/Nautilus.Game.Tutorial/.project new file mode 100644 index 000000000..d5172b979 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/.project @@ -0,0 +1,27 @@ + + + Nautilus.Game.Tutorial + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + auto,full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/Tutorial Builder.launch + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Nautilus.Game.Tutorial/.settings/org.eclipse.jdt.core.prefs b/Plugins/Nautilus.Game.Tutorial/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7341ab168 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Nautilus.Game.Tutorial/plugin.yml b/Plugins/Nautilus.Game.Tutorial/plugin.yml new file mode 100644 index 000000000..7ad06c96c --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/plugin.yml @@ -0,0 +1,3 @@ +name: Tutorial +main: nautilus.game.tutorial.Tutorial +version: 0.73 \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/IconData.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/IconData.java new file mode 100644 index 000000000..875e7cfeb --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/IconData.java @@ -0,0 +1,52 @@ +package nautilus.game.tutorial; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Entity; + +public class IconData +{ + private Location _loc; + private Material _mat; + private byte _data; + private Entity _ent = null; + + public IconData(Location loc, Material mat) + { + _loc = loc; + _mat = mat; + _data = 0; + } + + public IconData(Location loc, Material mat, byte data) + { + _loc = loc; + _mat = mat; + _data = data; + } + + public Entity GetEntity() + { + return _ent; + } + + public void SetEntity(Entity ent) + { + _ent = ent; + } + + public Location GetLocation() + { + return _loc; + } + + public Material GetMaterial() + { + return _mat; + } + + public byte GetData() + { + return _data; + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/Tutorial.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/Tutorial.java new file mode 100644 index 000000000..23b2e6cfd --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/Tutorial.java @@ -0,0 +1,485 @@ +package nautilus.game.tutorial; + +import java.util.HashSet; + +import me.chiss.Core.Clans.Clans; +import me.chiss.Core.Class.ClassFactory; +import me.chiss.Core.Combat.CombatManager; +import me.chiss.Core.Commands.CommandCenter; +import me.chiss.Core.Commands.CommandManager; +import me.chiss.Core.Condition.ConditionManager; +import me.chiss.Core.Config.Config; +import me.chiss.Core.Damage.DamageManager; +import me.chiss.Core.Field.Field; +import mineplex.core.antistack.AntiStack; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.creature.Creature; +import mineplex.core.energy.Energy; +import mineplex.core.explosion.Explosion; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.message.Message; +import mineplex.core.npc.NpcManager; +import mineplex.core.projectile.ProjectileManager; +import me.chiss.Core.Loot.LootFactory; +import me.chiss.Core.MemoryFix.MemoryFix; +import me.chiss.Core.Module.ModuleManager; +import me.chiss.Core.Modules.*; +import me.chiss.Core.Pet.PetManager; +import me.chiss.Core.PlayerTagNamer.INameColorer; +import me.chiss.Core.PlayerTagNamer.PlayerNamer; +import me.chiss.Core.PlayerTagNamer.TabLobbyList; +import me.chiss.Core.Plugin.IPlugin; +import me.chiss.Core.Plugin.IRelation; +import me.chiss.Core.Spawn.Spawn; +import me.chiss.Core.Teleport.Teleport; +import mineplex.core.Fire; +import mineplex.core.Recharge; +import mineplex.core.server.RemoteRepository; +import mineplex.core.server.ServerListener; +import mineplex.core.updater.Updater; +import me.chiss.Core.Weapon.WeaponFactory; +import mineplex.minecraft.account.CoreClientManager; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.core.classcombat.item.ItemFactory; +import mineplex.minecraft.game.core.mechanics.Gameplay; +import mineplex.minecraft.game.core.mechanics.Weapon; +import mineplex.minecraft.punish.Punish; + +import nautilus.game.tutorial.modules.ShopManager; +import nautilus.minecraft.core.INautilusPlugin; + +import org.bukkit.Location; +import org.bukkit.Server; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; + +public class Tutorial extends JavaPlugin implements INautilusPlugin, IPlugin +{ + private String WEB_CONFIG = "webServer"; + + //Modules + private ModuleManager _moduleManager; + private Config _config; + private CoreClientManager _clientManager; + private Utility _utility; + private BlockRegenerate _blockRegenerate; + private BlockRestore _blockRestore; + private Blood _blood; + private Clans _clans; + private ClassFactory _classFactory; + private ConditionManager _condition; + private Creature _creature; + private DamageManager _damage; + private Energy _energy; + private Explosion _explosion; + private Field _field; + private Fire _fire; + private Ignore _ignore; + private Logger _logger; + private LootFactory _lootFactory; + private Observer _observer; + private PetManager _petManager; + private Recharge _recharge; + private me.chiss.Core.Server.Server _serverModule; + private SkillFactory _skillFactory; + private Spawn _spawn; + private Teleport _teleport; + private ProjectileManager _throw; + private Weapon _weapon; + private Wiki _wiki; + + //Interfaces + private IRelation _relation; + + //Repo + private RemoteRepository _repository; + + private ServerListener _serverListener; + + @Override + public void onEnable() + { + getConfig().addDefault(WEB_CONFIG, "http://bettermc.com/"); + getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); + saveConfig(); + + //Repo + _repository = new RemoteRepository(GetWebServerAddress()); + + //Commands + CommandCenter.Initialize(this); + + //Init Modules + CombatManager.Initialize(this); + ItemFactory.Initialize(this, _repository, new HashSet()); + ItemStackFactory.Initialize(this); + WeaponFactory.Initialize(this, GetWebServerAddress()); + + GetModules(); + + GetBlood(); + //GetClans(); + GetClasses(); + GetClients(); + GetCreature(); + GetCondition(); + GetDamage(); + GetEnergy(); + GetExplosion(); + GetField(); + GetFire(); + + new Give(this); + new Message(this); + + GetObserver(); + GetServer(); + GetSkills(); + //GetSpawn(); + GetTeleport(); + GetWeapon(); + //GetWiki(); + + //Unreferenced Modules + new AntiStack(this); + //new Chat(this, GetClans(), _repository); + new CommandManager(this); + new Firework(this); + new Gameplay(this); + new mineplex.minecraft.game.core.mechanics.Gameplay(this); + new PlayerInfo(this); + new Punish(this, GetWebServerAddress()); + new Quit(this); + new MemoryFix(this); + + new TutorialManager(this, _repository); + + new ShopManager(this, _repository); + new NpcManager(this); + + //Set Relation + //_relation = GetClans(); + + //Updates + getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); + + new TabLobbyList(this, new PlayerNamer(this, GetNameColorer()).PacketHandler, true); + + _serverListener = new ServerListener(GetWebServerAddress(), getServer().getIp(), getServer().getPort() + 1); + _serverListener.start(); + } + + @Override + public void onDisable() + { + GetModules().onDisable(); + _serverListener.Shutdown(); + } + + @Override + public JavaPlugin GetPlugin() + { + return this; + } + + @Override + public String GetWebServerAddress() + { + return getConfig().getString(WEB_CONFIG); + } + + @Override + public Server GetRealServer() + { + return getServer(); + } + + @Override + public PluginManager GetPluginManager() + { + return GetRealServer().getPluginManager(); + } + + @Override + public void Log(String moduleName, String data) + { + System.out.println(moduleName + " : " + data); + } + + @Override + public IRelation GetRelation() + { + return _relation; + } + + @Override + public ModuleManager GetModules() + { + if (_moduleManager == null) + _moduleManager = new ModuleManager(); + + return _moduleManager; + } + + @Override + public Config GetConfig() + { + if (_config == null) + _config = new Config(this); + + return _config; + } + + @Override + public CoreClientManager GetClients() + { + if (_clientManager == null) + _clientManager = new CoreClientManager(this, new me.chiss.Core.Plugin.Logger(), _repository); + + return _clientManager; + } + + @Override + public Utility GetUtility() + { + if (_utility == null) + _utility = new Utility(this); + + return _utility; + } + + @Override + public BlockRegenerate GetBlockRegenerate() + { + if (_blockRegenerate == null) + _blockRegenerate = new BlockRegenerate(this); + + return _blockRegenerate; + } + + @Override + public BlockRestore GetBlockRestore() + { + if (_blockRestore == null) + _blockRestore = new BlockRestore(this); + + return _blockRestore; + } + + @Override + public Blood GetBlood() + { + if (_blood == null) + _blood = new Blood(this); + + return _blood; + } + + @Override + public Clans GetClans() + { + if (_clans == null) + _clans = new Clans(this, _repository, "TUT"); + + return _clans; + } + + @Override + public ClassFactory GetClasses() + { + if (_classFactory == null) + _classFactory = new ClassFactory(this, _repository, GetSkills()); + + return _classFactory; + } + + @Override + public ConditionManager GetCondition() + { + if (_condition == null) + _condition = new ConditionManager(this); + + return _condition; + } + + @Override + public Creature GetCreature() + { + if (_creature == null) + _creature = new Creature(this); + + return _creature; + } + + @Override + public DamageManager GetDamage() + { + if (_damage == null) + _damage = new DamageManager(this, CombatManager.Instance); + + return _damage; + } + + @Override + public Energy GetEnergy() + { + if (_energy == null) + _energy = new Energy(this); + + return _energy; + } + + @Override + public Explosion GetExplosion() + { + if (_explosion == null) + _explosion = new Explosion(this); + + return _explosion; + } + + @Override + public Field GetField() + { + if (_field == null) + _field = new Field(this, _repository, "Tutorial"); + + return _field; + } + + @Override + public Fire GetFire() + { + if (_fire == null) + _fire = new Fire(this); + + return _fire; + } + + @Override + public Ignore GetIgnore() + { + if (_ignore == null) + _ignore = new Ignore(this, _repository); + + return _ignore; + } + + @Override + public Logger GetLogger() + { + if (_logger == null) + _logger = new Logger(this); + + return _logger; + } + + @Override + public LootFactory GetLoot() + { + if (_lootFactory == null) + _lootFactory = new LootFactory(this); + + return _lootFactory; + } + + @Override + public Observer GetObserver() + { + if (_observer == null) + _observer = new Observer(this); + + return _observer; + } + + @Override + public Recharge GetRecharge() + { + if (_recharge == null) + _recharge = new Recharge(this); + + return _recharge; + } + + @Override + public me.chiss.Core.Server.Server GetServer() + { + if (_serverModule == null) + _serverModule = new me.chiss.Core.Server.Server(this); + + return _serverModule; + } + + @Override + public SkillFactory GetSkills() + { + if (_skillFactory == null) + _skillFactory = new SkillFactory(this, _repository); + + return _skillFactory; + } + + @Override + public Spawn GetSpawn() + { + if (_spawn == null) + _spawn = new Spawn(this); + + return _spawn; + } + + @Override + public Teleport GetTeleport() + { + if (_teleport == null) + _teleport = new Teleport(this); + + return _teleport; + } + + @Override + public ProjectileManager GetThrow() + { + if (_throw == null) + _throw = new ProjectileManager(this); + + return _throw; + } + + @Override + public Weapon GetWeapon() + { + if (_weapon == null) + _weapon = new Weapon(this); + + return _weapon; + } + + @Override + public Wiki GetWiki() + { + if (_wiki == null) + _wiki = new Wiki(this, _repository); + + return _wiki; + } + + @Override + public Location GetSpawnLocation() + { + // TODO Auto-generated method stub + return null; + } + + @Override + public INameColorer GetNameColorer() + { + return _clans; + } + + @Override + public PetManager GetPetManager() + { + return _petManager; + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/TutorialData.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/TutorialData.java new file mode 100644 index 000000000..c25583d14 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/TutorialData.java @@ -0,0 +1,217 @@ +package nautilus.game.tutorial; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.HashMap; + +import nautilus.game.tutorial.TutorialManager.TutorialType; +import nautilus.game.tutorial.part.Part; + +public class TutorialData +{ + private String _playerName; + + private Part _part = null; + + private HashMap _tutorials; + + private TutorialType _current = null; + + public TutorialData(String playerName) + { + _playerName = playerName; + + _tutorials = new HashMap(); + + for (TutorialType cur : TutorialType.values()) + _tutorials.put(cur, false); + + Read(); + } + + public Part GetPart() + { + return _part; + } + + public void SetPart(Part part) + { + _part = part; + } + + public void SetCompleted(TutorialType tute) + { + _tutorials.put(tute, true); + + Write(); + } + + public boolean HasCompleted(TutorialType tute) + { + return _tutorials.get(tute); + } + + public TutorialType GetCurrent() + { + return _current; + } + + public void SetCurrent(TutorialType type) + { + _current = type; + } + + public boolean AllowClassShop() + { + if (_part == null) + return false; + + return _part.AllowClassShop(); + } + + public boolean AllowClassSetup() + { + if (_part == null) + return false; + + return _part.AllowClassSetup(); + } + + public boolean AllowAction() + { + if (_part == null) + return false; + + return _part.AllowAction(); + } + + public void Read() + { + FileInputStream fstream = null; + BufferedReader br = null; + + try + { + //Make Dir + File folder = new File("data/tutorial"); + folder.mkdirs(); + + File file = new File("data/tutorial/" + _playerName + ".dat"); + + if (file.exists()) + { + fstream = new FileInputStream(file); + br = new BufferedReader(new InputStreamReader(fstream)); + + String line = br.readLine(); + + while (line != null) + { + TutorialType type = TutorialType.valueOf(line.charAt(0)+""); + boolean complete = line.charAt(1) == '1'; + + _tutorials.put(type, complete); + + line = br.readLine(); + } + } + } + catch (Exception e) + { + System.out.println("Tutorial Data Read Error."); + e.printStackTrace(); + } + finally + { + if (br != null) + { + try + { + br.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } + + public void Write() + { + FileWriter fstream = null; + BufferedWriter out = null; + + try + { + //Make Dir + File folder = new File("data/tutorial"); + folder.mkdirs(); + + File file = new File("data/tutorial/" + _playerName + ".dat"); + + fstream = new FileWriter(file); + out = new BufferedWriter(fstream); + + for (TutorialType type : _tutorials.keySet()) + { + if (_tutorials.get(type)) + out.write(type + "1"); + else + out.write(type + "0"); + + out.newLine(); + } + + out.close(); + } + catch (Exception e) + { + System.out.println("Tutorial Data Write Error."); + e.printStackTrace(); + } + finally + { + if (out != null) + { + try + { + out.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + if (fstream != null) + { + try + { + fstream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/TutorialManager.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/TutorialManager.java new file mode 100644 index 000000000..02382b4fd --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/TutorialManager.java @@ -0,0 +1,700 @@ +package nautilus.game.tutorial; + +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.World.Environment; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import mineplex.core.Rank; +import mineplex.core.itemstack.ItemStackFactory; +import me.chiss.Core.Module.AModule; +import mineplex.core.server.IRepository; +import mineplex.core.server.util.Callback; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import mineplex.minecraft.account.CoreClient; +import mineplex.minecraft.donation.repository.token.PlayerUpdateToken; +import mineplex.minecraft.game.classcombat.SkillTriggerEvent; +import mineplex.minecraft.game.classcombat.events.ClassSetupEvent; +import nautilus.game.tutorial.part.Part; +import nautilus.game.tutorial.part.a_welcome.A01_Welcome; +import nautilus.game.tutorial.part.b_class_basics.*; +import nautilus.game.tutorial.part.c_locked_skills.C01_Brute; +import nautilus.game.tutorial.part.d_class_builds.D01_CustomBuild; +import nautilus.game.tutorial.part.m_icons.M01_Icons; +import nautilus.game.tutorial.part.q_secret.Q01_Secret; +import nautilus.game.tutorial.part.z_domination.Z01_Introduction; + +public class TutorialManager extends AModule +{ + public enum TutorialType + { + A("Welcome"), + B("Class Basics"), + C("Locked Skills"), + D("Custom Builds"), + M("Condition Icons"), + Q("???"), + Z("Domination"); + + private String _name; + + TutorialType(String name) + { + _name = name; + } + + public String GetName() + { + return _name; + } + } + + private HashMap _data = new HashMap(); + + //Objects + public Entity domItemEmerald = null; + public Entity domItemChest = null; + + //Condition Icons + public HashSet icons; + + //Spawns + public Location spawnA = new Location(UtilWorld.getWorldType(Environment.NORMAL), 0.5, 13, -4.5); + public Location spawnB = new Location(UtilWorld.getWorldType(Environment.NORMAL), 5.5, 33, -14.5); + public Location spawnC = new Location(UtilWorld.getWorldType(Environment.NORMAL), 3.5, 61, -54.5); + + //Wool + public Location redWool = new Location(UtilWorld.getWorldType(Environment.NORMAL), -1, 14.5, 5); + public Location greenWool = new Location(UtilWorld.getWorldType(Environment.NORMAL), 2, 14.5, 5); + + //NPC + public Location tutorials = new Location(UtilWorld.getWorldType(Environment.NORMAL), -9.5, 57.5, 18.5); + + //Tables + public Location classShop = new Location(UtilWorld.getWorldType(Environment.NORMAL), 8.5, 57.5, 17.5); + public Location classSetup = new Location(UtilWorld.getWorldType(Environment.NORMAL), -4.5, 57.5, 30.5); + + //Animals + public Location sheepPit = new Location(UtilWorld.getWorldType(Environment.NORMAL), 63, 57, 3); + + //Secret + public Location secPig = new Location(UtilWorld.getWorldType(Environment.NORMAL), -39, 85, 49); + public Location secChick = new Location(UtilWorld.getWorldType(Environment.NORMAL), 55, 76, 36); + public Location secSpider = new Location(UtilWorld.getWorldType(Environment.NORMAL), 46, 48, -18); + public Location secPortal = new Location(UtilWorld.getWorldType(Environment.NORMAL), 30.5, 54, 56.5); + public Location secCat = new Location(UtilWorld.getWorldType(Environment.NORMAL), -13.5, 25, -0.5); + + //Domination + public Location domIsland = new Location(UtilWorld.getWorldType(Environment.NORMAL), -45.5, 58.5, -43.5); + public Location domCP = new Location(UtilWorld.getWorldType(Environment.NORMAL), -45.5, 59.5, -50.5); + public Location domResupply = new Location(UtilWorld.getWorldType(Environment.NORMAL), -64.5, 57.5, -39.5); + public Location domEmerald = new Location(UtilWorld.getWorldType(Environment.NORMAL), -34.5, 60.5, -50.5); + + public TutorialManager(JavaPlugin plugin, IRepository repository) + { + super("Tutorial Manager", plugin, repository); + + AddIndicators(); + } + + private void AddIndicators() + { + icons = new HashSet(); + + icons.add(new IconData(new Location(UtilWorld.getWorldType(Environment.NORMAL), -21.5, 58.5, 17.5), + Material.IRON_CHESTPLATE, (byte)0)); + + icons.add(new IconData(new Location(UtilWorld.getWorldType(Environment.NORMAL), -21.5, 58.5, 19.5), + Material.INK_SACK, (byte)1)); + + icons.add(new IconData(new Location(UtilWorld.getWorldType(Environment.NORMAL), -21.5, 58.5, 21.5), + Material.WEB, (byte)0)); + + icons.add(new IconData(new Location(UtilWorld.getWorldType(Environment.NORMAL), -21.5, 58.5, 23.5), + Material.FEATHER, (byte)0)); + + icons.add(new IconData(new Location(UtilWorld.getWorldType(Environment.NORMAL), -21.5, 58.5, 25.5), + Material.IRON_SWORD, (byte)0)); + + icons.add(new IconData(new Location(UtilWorld.getWorldType(Environment.NORMAL), -21.5, 58.5, 27.5), + Material.CARROT_ITEM, (byte)0)); + + icons.add(new IconData(new Location(UtilWorld.getWorldType(Environment.NORMAL), -21.5, 58.5, 29.5), + Material.BLAZE_POWDER, (byte)0)); + + icons.add(new IconData(new Location(UtilWorld.getWorldType(Environment.NORMAL), -19.5, 58.5, 31.5), + Material.DEAD_BUSH, (byte)0)); + + icons.add(new IconData(new Location(UtilWorld.getWorldType(Environment.NORMAL), -17.5, 58.5, 31.5), + Material.SLIME_BALL, (byte)0)); + + icons.add(new IconData(new Location(UtilWorld.getWorldType(Environment.NORMAL), -15.5, 58.5, 31.5), + Material.ENDER_PEARL, (byte)0)); + + icons.add(new IconData(new Location(UtilWorld.getWorldType(Environment.NORMAL), -13.5, 58.5, 31.5), + Material.WATCH, (byte)0)); + } + + @Override + public void enable() + { + + } + + @Override + public void config() + { + + } + + @Override + public void disable() + { + if (domItemChest != null) + domItemChest.remove(); + + if (domItemEmerald != null) + domItemEmerald.remove(); + + for (IconData cur : icons) + { + if (cur.GetEntity() != null) + cur.GetEntity().remove(); + } + } + + @Override + public void commands() + { + AddCommand("tut"); + } + + @Override + public void command(Player caller, String cmd, String[] args) + { + if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) + return; + + if (args.length == 0) return; + else if (args[0].equals("a")) StartTutorial(caller, TutorialType.A); + else if (args[0].equals("b")) StartTutorial(caller, TutorialType.B); + else if (args[0].equals("c")) StartTutorial(caller, TutorialType.C); + else if (args[0].equals("d")) StartTutorial(caller, TutorialType.D); + else if (args[0].equals("z")) StartTutorial(caller, TutorialType.Z); + + else if (args[0].equals("stop")) EndTutorial(caller, false); + else if (args[0].equals("finish")) EndTutorial(caller, true); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : UtilServer.getPlayers()) + { + Part part = _data.get(cur).GetPart(); + + if (part == null) + continue; + + //Food Update + if (!part.IsCompleted()) + { + part.FoodUpdate(cur); + } + + //Next Action + if (part.Progress() && !part.IsCompleted()) + { + part.GetAction().DoAction(cur); + } + + //Next Part + if (part.IsCompleted()) + { + //Deregister Last + HandlerList.unregisterAll(part); + + //Register Next + Part nextPart = part.GetNext(); + UtilServer.getServer().getPluginManager().registerEvents(nextPart, Plugin()); + _data.get(cur).SetPart(nextPart); + } + } + } + + @EventHandler + public void Join(PlayerJoinEvent event) + { + Player player = event.getPlayer(); + + //Strip + UtilInv.Clear(player); + + //Insert Player + GetData(player); + + //Start welcome if not done + if (!GetData(player).HasCompleted(TutorialType.A)) + StartTutorial(player, TutorialType.A); + else + Teleport().TP(player, spawnC); + } + + @EventHandler + public void Quit(PlayerQuitEvent event) + { + EndTutorial(event.getPlayer(), false); + + //Remove Data + _data.remove(event.getPlayer()); + } + + @EventHandler + public void NPCInteract(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() == null) + return; + + if (!(event.getRightClicked() instanceof CraftLivingEntity)) + return; + + CraftLivingEntity ent = (CraftLivingEntity)event.getRightClicked(); + String name = ent.getCustomName(); + + if (name == null) + return; + + if (name.contains("Class Basics")) StartTutorial(event.getPlayer(), TutorialType.B); + else if (name.contains("Locked Skills")) StartTutorial(event.getPlayer(), TutorialType.C); + else if (name.contains("Custom Build")) StartTutorial(event.getPlayer(), TutorialType.D); + + else if (name.contains("Condition Icon")) StartTutorial(event.getPlayer(), TutorialType.M); + + else if (name.contains("Barry")) StartTutorial(event.getPlayer(), TutorialType.Q); + + else if (name.contains("Domination")) StartTutorial(event.getPlayer(), TutorialType.Z); + } + + public TutorialData GetData(Player player) + { + if (!_data.containsKey(player)) + _data.put(player, new TutorialData(player.getName())); + + return _data.get(player); + } + + public void StartTutorial(Player player, TutorialType type) + { + System.out.println("Starting: " + type.GetName() + " for " + player.getName()); + //Start New + TutorialData data = GetData(player); + + //Limits + if (player.getGameMode() != GameMode.CREATIVE) + { + if (type == TutorialType.B) + { + if (!data.HasCompleted(TutorialType.A)) + { + UtilPlayer.message(player, F.main("Tutorial", "You must complete " + F.elem(TutorialType.A.GetName()) + " first.")); + return; + } + } + + else if (type == TutorialType.C) + { + if (!data.HasCompleted(TutorialType.A)) + { + UtilPlayer.message(player, F.main("Tutorial", "You must complete " + F.elem(TutorialType.A.GetName()) + " first.")); + return; + } + if (!data.HasCompleted(TutorialType.B)) + { + UtilPlayer.message(player, F.main("Tutorial", "You must complete " + F.elem(TutorialType.B.GetName()) + " first.")); + return; + } + + } + + else if (type == TutorialType.D) + { + if (!data.HasCompleted(TutorialType.A)) + { + UtilPlayer.message(player, F.main("Tutorial", "You must complete " + F.elem(TutorialType.A.GetName()) + " first.")); + return; + } + if (!data.HasCompleted(TutorialType.B)) + { + UtilPlayer.message(player, F.main("Tutorial", "You must complete " + F.elem(TutorialType.B.GetName()) + " first.")); + return; + } + if (!data.HasCompleted(TutorialType.C)) + { + UtilPlayer.message(player, F.main("Tutorial", "You must complete " + F.elem(TutorialType.C.GetName()) + " first.")); + return; + } + } + + else if (type == TutorialType.Z) + { + if (!data.HasCompleted(TutorialType.A)) + { + UtilPlayer.message(player, F.main("Tutorial", "You must complete " + F.elem(TutorialType.A.GetName()) + " first.")); + return; + } + } + } + + //End Old + EndTutorial(player, false); + + Part nextPart = null; + if (type == TutorialType.A) nextPart = new A01_Welcome(this, data, player); + else if (type == TutorialType.B) nextPart = new B01_ClassSelection(this, data, player); + else if (type == TutorialType.C) nextPart = new C01_Brute(this, data, player); + else if (type == TutorialType.D) nextPart = new D01_CustomBuild(this, data, player); + else if (type == TutorialType.M) nextPart = new M01_Icons(this, data, player); + else if (type == TutorialType.Q) nextPart = new Q01_Secret(this, data, player); + else if (type == TutorialType.Z) nextPart = new Z01_Introduction(this, data, player); + + + if (nextPart == null) + { + UtilPlayer.message(player, F.main("Tutorial", "Error: Invalid Tutorial")); + return; + } + + + data.SetPart(nextPart); + data.SetCurrent(type); + + UtilServer.getServer().getPluginManager().registerEvents(nextPart, Plugin()); + + //Inform + UtilPlayer.message(player, F.main("Tutorial", "Starting Tutorial: " + F.elem(type.GetName()))); + player.playSound(player.getLocation(), Sound.CHEST_OPEN, 0.5f, 2f); + } + + public void EndTutorial(Player player, boolean award) + { + TutorialData data = GetData(player); + + if (data.GetCurrent() == null) + return; + + if (data.GetPart() == null) + return; + + //Unregister + HandlerList.unregisterAll(data.GetPart()); + + //Remove Points + if (data.GetPart().GetPointRemove()) + GivePoints(data.GetPart().GetPlayerName(), -4000); + + //Award Points + if (award && !data.HasCompleted(data.GetCurrent())) + AwardPoints(player); + + //Strip + UtilInv.Clear(player); + + //Set Completed + if (award) + data.SetCompleted(data.GetCurrent()); + + //Remove Part + data.SetPart(null); + + //Inform + if (award) + UtilPlayer.message(player, F.main("Tutorial", "Completed Tutorial: " + F.elem(data.GetCurrent().GetName()))); + else + UtilPlayer.message(player, F.main("Tutorial", "Ended Tutorial: " + F.elem(data.GetCurrent().GetName()))); + + player.playSound(player.getLocation(), Sound.CHEST_OPEN, 0.5f, 2f); + } + + public void AwardPoints(Player player) + { + GiveCredits(player.getName(), 400); + UtilPlayer.message(player, F.main("Tutorial", "You received " + F.elem("400 Credits") + "!")); + player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); + } + + @EventHandler + public void IconItems(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + for (IconData cur : icons) + { + if (cur.GetEntity() == null || !cur.GetEntity().isValid()) + { + if (cur.GetEntity() != null) + cur.GetEntity().remove(); + + cur.SetEntity(cur.GetLocation().getWorld().dropItem(cur.GetLocation(), ItemStackFactory.Instance.CreateStack(cur.GetMaterial(), cur.GetData()))); + cur.GetEntity().setVelocity(new Vector(0,0,0)); + } + } + } + + @EventHandler + public void DomItems(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + if (domItemEmerald == null || !domItemEmerald.isValid()) + { + if (domItemEmerald != null) + domItemEmerald.remove(); + + domItemEmerald = domEmerald.getWorld().dropItem(domEmerald, new ItemStack(Material.EMERALD)); + domItemEmerald.setVelocity(new Vector(0,0,0)); + } + + if (domItemChest == null || !domItemChest.isValid()) + { + if (domItemChest != null) + domItemChest.remove(); + + domItemChest = domResupply.getWorld().dropItem(domResupply, new ItemStack(Material.CHEST)); + domItemChest.setVelocity(new Vector(0,0,0)); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void DeathItems(EntityDeathEvent event) + { + event.getDrops().clear(); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void Drop(PlayerDropItemEvent event) + { + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void Pickup(PlayerPickupItemEvent event) + { + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void Pickup(AsyncPlayerChatEvent event) + { + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void BlockBreak(BlockBreakEvent event) + { + if (event.getPlayer().getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void BlockPlace(BlockPlaceEvent event) + { + if (event.getPlayer().getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void QuitMessage(PlayerQuitEvent event) + { + event.setQuitMessage(null); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void JoinMessage(PlayerJoinEvent event) + { + event.setJoinMessage(null); + } + + /* + @EventHandler(priority = EventPriority.LOWEST) + public void ChunkLoad(ChunkLoadEvent event) + { + if (event.getChunk().getX() >= 4 || event.getChunk().getX() <= -5 || event.getChunk().getZ() >= 4 || event.getChunk().getZ() <= -5) + event.getChunk().unload(false, false); + } + */ + + @EventHandler(priority = EventPriority.LOWEST) + public void CancelClassBlock(PlayerInteractEvent event) + { + if (event.getClickedBlock() == null) + return; + + if (!UtilBlock.usable(event.getClickedBlock())) + return; + + if (GetData(event.getPlayer()).AllowClassShop()) + if (event.getClickedBlock().getType() == Material.ENDER_CHEST) + return; + + if (GetData(event.getPlayer()).AllowClassSetup()) + if (event.getClickedBlock().getType() == Material.ENCHANTMENT_TABLE) + return; + + event.setCancelled(true); + } + + @EventHandler + public void CancelSkillTrigger(SkillTriggerEvent event) + { + if (GetData(event.GetPlayer()).AllowAction()) + return; + + event.SetCancelled(true); + + //Inform + UtilPlayer.message(event.GetPlayer(), F.main("Tutorial", "You cannot use " + F.skill(event.GetSkillName()) + " at the moment.")); + UtilPlayer.message(event.GetPlayer(), F.main("Tutorial", "Please wait until instructed to do so...")); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void VoidReturn(EntityDamageEvent event) + { + if (event.getCause() != DamageCause.VOID) + return; + + if (!(event.getEntity() instanceof Player)) + return; + + Player player = (Player)event.getEntity(); + + event.setCancelled(true); + + + //Teleport + Teleport().TP(player, spawnC); + player.playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f); + + //Reset Part + if (GetData(player).GetPart() != null) + { + GetData(player).GetPart().Dialogue(player, "Careful now! Let's try that again..."); + GetData(player).GetPart().SetIndex(0); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void DamageRemove(EntityDamageEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + event.setCancelled(true); + } + + + @EventHandler + public void Print(ClassSetupEvent event) + { + /* + System.out.println("type: " + event.GetType()); + System.out.println("class: " + event.GetClassType()); + System.out.println("id: " + event.GetPosition()); + + CustomBuildToken bt = event.GetBuild(); + if (bt == null) + System.out.println("build: " + "null"); + else + { + System.out.println("build id: " + bt.CustomBuildNumber); + System.out.println("build name: " + bt.Name); + System.out.println("build item tok: " + bt.ItemTokensBalance); + System.out.println("build skill tok: " + bt.SkillTokensBalance); + } + */ + } + + public void GivePoints(String name, int amount) + { + PlayerUpdateToken token = new PlayerUpdateToken(); + token.Name = name; + final CoreClient client = Clients().Get(name); + if (client == null) + { + System.out.println("Tutorial Point Set: NULL Client"); + return; + } + + token.Credits = 0; + token.Points = amount; + token.FilterChat = client.Game().GetFilterChat(); + + GetRepository().PlayerUpdate(new Callback () + { + public void run(PlayerUpdateToken token) + { + client.Donor().SetPoints(client.Donor().GetGreenGems() + token.Points); + } + }, token); + } + + public void GiveCredits(String name, int amount) + { + PlayerUpdateToken token = new PlayerUpdateToken(); + token.Name = name; + final CoreClient client = Clients().Get(name); + if (client == null) + { + System.out.println("Tutorial Credit Set: NULL Client"); + return; + } + + token.Credits = amount; + token.Points = 0; + token.FilterChat = client.Game().GetFilterChat(); + + GetRepository().PlayerUpdate(new Callback () + { + public void run(PlayerUpdateToken token) + { + client.Donor().SetCredits(client.Donor().GetBlueGems() + token.Credits); + } + }, token); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/Action.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/Action.java new file mode 100644 index 000000000..b5d433e8a --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/Action.java @@ -0,0 +1,38 @@ +package nautilus.game.tutorial.action; + +import org.bukkit.entity.Player; + +import nautilus.game.tutorial.part.Part; + +public abstract class Action +{ + protected Part Part; + + private long _delay; + + public Action(Part part, long delay) + { + Part = part; + _delay = delay; + } + + public void DoAction(Player player) + { + CustomAction(player); + + Part.SetNextAction(System.currentTimeMillis() + _delay); + Part.IncrementIndex(); + } + + public abstract void CustomAction(Player player); + + public void SetDelay(long newDelay) + { + _delay = newDelay; + } + + public long GetDelay() + { + return _delay; + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/AllowAction.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/AllowAction.java new file mode 100644 index 000000000..8d2265cda --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/AllowAction.java @@ -0,0 +1,24 @@ +package nautilus.game.tutorial.action.types; + +import org.bukkit.entity.Player; + +import nautilus.game.tutorial.action.Action; +import nautilus.game.tutorial.part.Part; + +public class AllowAction extends Action +{ + public boolean _value; + + public AllowAction(Part part, boolean value) + { + super(part, 0); + + _value = value; + } + + @Override + public void CustomAction(Player player) + { + Part.SetAllowAction(_value); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/AllowClassSetup.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/AllowClassSetup.java new file mode 100644 index 000000000..29592ad66 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/AllowClassSetup.java @@ -0,0 +1,24 @@ +package nautilus.game.tutorial.action.types; + +import org.bukkit.entity.Player; + +import nautilus.game.tutorial.action.Action; +import nautilus.game.tutorial.part.Part; + +public class AllowClassSetup extends Action +{ + public boolean _value; + + public AllowClassSetup(Part part, boolean value) + { + super(part, 0); + + _value = value; + } + + @Override + public void CustomAction(Player player) + { + Part.SetAllowClassSetup(_value); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/AllowClassShop.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/AllowClassShop.java new file mode 100644 index 000000000..2ceee22e8 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/AllowClassShop.java @@ -0,0 +1,24 @@ +package nautilus.game.tutorial.action.types; + +import org.bukkit.entity.Player; + +import nautilus.game.tutorial.action.Action; +import nautilus.game.tutorial.part.Part; + +public class AllowClassShop extends Action +{ + public boolean _value; + + public AllowClassShop(Part part, boolean value) + { + super(part, 0); + + _value = value; + } + + @Override + public void CustomAction(Player player) + { + Part.SetAllowClassShop(_value); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/Complete.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/Complete.java new file mode 100644 index 000000000..510209f01 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/Complete.java @@ -0,0 +1,20 @@ +package nautilus.game.tutorial.action.types; + +import org.bukkit.entity.Player; + +import nautilus.game.tutorial.action.Action; +import nautilus.game.tutorial.part.Part; + +public class Complete extends Action +{ + public Complete(Part part) + { + super(part, 0); + } + + @Override + public void CustomAction(Player player) + { + Part.SetCompleted(true); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/CompleteTutorial.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/CompleteTutorial.java new file mode 100644 index 000000000..205dd2ddd --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/CompleteTutorial.java @@ -0,0 +1,20 @@ +package nautilus.game.tutorial.action.types; + +import org.bukkit.entity.Player; + +import nautilus.game.tutorial.action.Action; +import nautilus.game.tutorial.part.Part; + +public class CompleteTutorial extends Action +{ + public CompleteTutorial(Part part) + { + super(part, 0); + } + + @Override + public void CustomAction(Player player) + { + Part.TutorialCompleted(); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/Dialogue.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/Dialogue.java new file mode 100644 index 000000000..e43c54759 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/Dialogue.java @@ -0,0 +1,96 @@ +package nautilus.game.tutorial.action.types; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.tutorial.action.Action; +import nautilus.game.tutorial.part.Part; + +public class Dialogue extends Action +{ + public static int dialogueBase = 1200; + public static int dialogueChar = 60; + + private String _sender = "Cat"; + private String _message = null; + private String[] _messages = null; + + public static String[] restartMessages = new String[] + { + "Confused? Let's try again...", + "Come on, you can do it!", + "It's really not that difficult...", + "Did you fall asleep..?" + }; + + public static String[] fishMessage = new String[] + { + "Eat the fish, so juicy sweeeeet!", + "We're not going anywhere until you eat it.", + "Look how deliciously fresh, and raw, it is.", + "I can wait all day.", + "You'll starve if you don't eat it..." + }; + + public Dialogue(Part part, String sender, String message) + { + super(part, 0); + _sender = sender; + _message = message; + } + + public Dialogue(Part part, String message) + { + super(part, 0); + _message = message; + } + + public Dialogue(Part part, String[] messages) + { + super(part, 0); + _messages = messages; + } + + @Override + public void CustomAction(Player player) + { + //Set Message & Delay + if (_messages != null || _message == null) + { + String previous = _message; + + _message = SelectMessage(); + + while (_messages.length > 1 && _message.equals(previous)) + _message = SelectMessage(); + } + + + //Set Delay + SetDelay(dialogueBase + (dialogueChar * _message.length())); + + UtilPlayer.message(player, F.tute(_sender, _message)); + + //Effect + if (_sender.equals("System")) + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 2f); + else + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 1f); + } + + private String SelectMessage() + { + if (_messages != null) + { + String message = _messages[UtilMath.r(_messages.length)]; + + if (message != null) + return message; + } + + return ""; + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/EndTutorial.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/EndTutorial.java new file mode 100644 index 000000000..bb1bff688 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/EndTutorial.java @@ -0,0 +1,20 @@ +package nautilus.game.tutorial.action.types; + +import org.bukkit.entity.Player; + +import nautilus.game.tutorial.action.Action; +import nautilus.game.tutorial.part.Part; + +public class EndTutorial extends Action +{ + public EndTutorial(Part part) + { + super(part, 0); + } + + @Override + public void CustomAction(Player player) + { + Part.TutorialCompletedNoAward(); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/ForceLook.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/ForceLook.java new file mode 100644 index 000000000..1ef8edea7 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/ForceLook.java @@ -0,0 +1,62 @@ +package nautilus.game.tutorial.action.types; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAlg; +import nautilus.game.tutorial.action.Action; +import nautilus.game.tutorial.part.Part; + +public class ForceLook extends Action +{ + private Location _target; + private int _ticks = 20; + + public ForceLook(Part part, Location target, long delay) + { + super(part, delay); + + _target = target; + } + + @Override + public void DoAction(Player player) + { + CustomAction(player); + + _ticks--; + + if (_ticks > 0) + return; + + Part.SetNextAction(System.currentTimeMillis() + GetDelay()); + Part.IncrementIndex(); + + _ticks = 20; + } + + @Override + public void CustomAction(Player player) + { + Vector vector = UtilAlg.getTrajectory(player.getEyeLocation(), _target).normalize(); + + double x = vector.getX(); + double y = vector.getY(); + double z = vector.getZ(); + double xz = Math.sqrt((x*x) + (z*z)); + + double yaw = Math.toDegrees(Math.atan((-x)/z)); + if (z < 0) yaw += 180; + + double pitch = Math.toDegrees(Math.atan(xz/y)); + if (y <= 0) pitch += 90; + else pitch -= 90; + + Location loc = player.getLocation(); + loc.setYaw((float) yaw); + loc.setPitch((float) pitch); + + player.teleport(loc); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/Index.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/Index.java new file mode 100644 index 000000000..75129d23e --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/Index.java @@ -0,0 +1,29 @@ +package nautilus.game.tutorial.action.types; + +import nautilus.game.tutorial.action.Action; +import nautilus.game.tutorial.part.Part; + +import org.bukkit.entity.Player; + +public class Index extends Action +{ + private String _index; + + public Index(Part part, String index) + { + super(part, 0); + + _index = index; + } + + @Override + public void CustomAction(Player player) + { + + } + + public String GetIndex() + { + return _index; + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/IndexJump.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/IndexJump.java new file mode 100644 index 000000000..2af4add44 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/action/types/IndexJump.java @@ -0,0 +1,33 @@ +package nautilus.game.tutorial.action.types; + +import org.bukkit.entity.Player; + +import nautilus.game.tutorial.action.Action; +import nautilus.game.tutorial.part.Part; + +public class IndexJump extends Action +{ + private String _index; + + public IndexJump(Part part, String index) + { + super(part, 0); + + _index = index; + } + + @Override + public void CustomAction(Player player) + { + for (int i=0 ; i _actions; + private int _index = 0; + private long _nextAction = 0; + private boolean _isActing = true; + + private boolean _allowAction = false; + private boolean _allowClassShop = false; + private boolean _allowClassSetup = false; + + private boolean _completed = false; + + private boolean _creditRemove = false; + + public Part(TutorialManager manager, TutorialData data, Player player) + { + Manager = manager; + Data = data; + + _player = player; + _playerName = player.getName(); + + _actions = new ArrayList(); + + CreateActions(); + } + + public abstract void CreateActions(); + + public ArrayList GetActions() + { + return _actions; + } + + public Action GetAction() + { + return _actions.get(_index); + } + + public abstract Part GetNext(); + + public boolean IsActing() + { + return _isActing; + } + + public void IndexJump(String jumpTo) + { + SetNextAction(0); + + for (int i=0 ; i= _actions.size()) + return false; + + return (System.currentTimeMillis() > _nextAction); + } + + public void SetCompleted(boolean completed) + { + _completed = completed; + } + + public boolean IsCompleted() + { + return _completed; + } + + public void SetCreditRemove(boolean creditRemove) + { + _creditRemove = creditRemove; + } + + public boolean GetPointRemove() + { + return _creditRemove; + } + + public void FoodUpdate(Player player) + { + player.setFoodLevel(18); + } + + public Player GetPlayer() + { + return _player; + } + + public String GetPlayerName() + { + return _playerName; + } + + public void Add(Action action) + { + _actions.add(action); + } + + public void SetAllowAction(boolean value) + { + _allowAction = value; + } + + public boolean AllowAction() + { + return _allowAction; + } + + public void SetAllowClassShop(boolean value) + { + _allowClassShop = value; + } + + public boolean AllowClassShop() + { + return _allowClassShop; + } + + public void SetAllowClassSetup(boolean value) + { + _allowClassSetup = value; + } + + public boolean AllowClassSetup() + { + return _allowClassSetup; + } + + public void TutorialCompleted() + { + Manager.EndTutorial(GetPlayer(), true); + } + + public void TutorialCompletedNoAward() + { + Manager.EndTutorial(GetPlayer(), false); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/a_welcome/A01_Welcome.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/a_welcome/A01_Welcome.java new file mode 100644 index 000000000..a08edfdba --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/a_welcome/A01_Welcome.java @@ -0,0 +1,97 @@ +package nautilus.game.tutorial.part.a_welcome; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.Dialogue; +import nautilus.game.tutorial.action.types.ForceLook; +import nautilus.game.tutorial.action.types.Index; +import nautilus.game.tutorial.action.types.IndexJump; +import nautilus.game.tutorial.action.types.Pause; +import nautilus.game.tutorial.action.types.SoundEffect; +import nautilus.game.tutorial.action.types.Teleport; +import nautilus.game.tutorial.part.Part; + +public class A01_Welcome extends Part +{ + public A01_Welcome(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new SoundEffect(this, Sound.ZOMBIE_UNFECT, 2f, 2f)); + Add(new Teleport(this, Manager.spawnA)); + Add(new Pause(this, 6000)); + + //Intro + Add(new Dialogue(this, "Voice", "Hello?")); + Add(new Pause(this, 2000)); + Add(new Dialogue(this, "Voice", "Ah, there you are.")); + Add(new Dialogue(this, "Voice", "Welcome to the " + F.te("Better MineCraft Tutorial") + ".")); + Add(new Dialogue(this, "Voice", "Here you will learn about Classes, Skills and Games.")); + + Add(new Dialogue(this, "Voice", "My name is " + F.te("Catherine") + ", but you can call me " + F.te("Cat") + ".")); + Add(new SoundEffect(this, Sound.CAT_MEOW, 1f, 1f, 1000)); + Add(new Dialogue(this, "I promise to keep this short and fun!")); + + Add(new Dialogue(this, "For each tutorial you complete, you will be rewarded...")); + Add(new Dialogue(this, F.te(C.cAqua + "400 Credits") + " to unlock " + F.te("Skills") + " and " + F.te("Items") + "!")); + Add(new Dialogue(this, "I know, I am very generous... no need to say thank you.")); + + //Wool Punch + Add(new Index(this, "Wool Punch")); + + Add(new ForceLook(this, Manager.redWool, 0)); + Add(new Dialogue(this, "Punch the " + F.te(C.cRed + "Red Wool") + " if you don't need tutoring.")); + + Add(new ForceLook(this, Manager.greenWool, 0)); + Add(new Dialogue(this, "Punch the " + F.te(C.cGreen + "Green Wool") + " to get started!")); + + Add(new Pause(this, 20000)); + + Add(new Dialogue(this, Dialogue.restartMessages)); + Add(new IndexJump(this, "Wool Punch")); + } + + @EventHandler + public void BlockClick(PlayerInteractEvent event) + { + if (event.getClickedBlock() == null) + return; + + if (event.getClickedBlock().getType() != Material.WOOL) + return; + + if (!event.getPlayer().getName().equals(GetPlayerName())) + return; + + if (event.getClickedBlock().getData() == 5) + { + SetCompleted(true); + event.setCancelled(true); + } + + else if (event.getClickedBlock().getData() == 14) + { + UtilPlayer.kick(event.getPlayer(), "Cat", "Thanks for nothing..."); + event.setCancelled(true); + } + } + + @Override + public Part GetNext() + { + return new A02_Food(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/a_welcome/A02_Food.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/a_welcome/A02_Food.java new file mode 100644 index 000000000..ea9d4a5aa --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/a_welcome/A02_Food.java @@ -0,0 +1,97 @@ +package nautilus.game.tutorial.part.a_welcome; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class A02_Food extends Part +{ + public A02_Food(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + ItemStack item; + + Add(new Dialogue(this, "Excellent, let's get started!")); + Add(new Dialogue(this, "Before we begin, there is something important to do...")); + Add(new Pause(this, 1200)); + + item = ItemStackFactory.Instance.CreateStack(Material.PUMPKIN_PIE); + Add(new Dialogue(this, "...you'll need to eat this pie, I just baked it!")); + Add(new ItemAdd(this, item)); + Add(new Dialogue(this, "Careful not to drop it, it's hot!")); + + Add(new Pause(this, 6000)); + Add(new Dialogue(this, "Not a fan of pumpkin, eh?")); + Add(new ItemRemove(this, item)); + + item = ItemStackFactory.Instance.CreateStack(Material.COOKED_BEEF); + Add(new Dialogue(this, "That's alright, I cook a mean steak.")); + Add(new ItemAdd(this, item)); + Add(new Dialogue(this, "Have a taste of this!")); + + Add(new Pause(this, 6000)); + Add(new Dialogue(this, "Vegetarian maybe? Fine, eat this...")); + Add(new ItemRemove(this, item)); + + item = ItemStackFactory.Instance.CreateStack(Material.BREAD); + Add(new Dialogue(this, "Freshly baked bread!")); + Add(new ItemAdd(this, item)); + + Add(new Pause(this, 6000)); + Add(new Dialogue(this, "You're not making this easy on me...")); + Add(new ItemRemove(this, item)); + + item = ItemStackFactory.Instance.CreateStack(Material.APPLE); + Add(new Dialogue(this, "Please... you must eat something!")); + Add(new ItemAdd(this, item)); + Add(new Dialogue(this, "Apple?")); + + Add(new Pause(this, 6000)); + Add(new ItemRemove(this, item)); + + item = ItemStackFactory.Instance.CreateStack(Material.COOKIE); + Add(new Dialogue(this, "How about a delicious cookie..?")); + Add(new ItemAdd(this, item)); + + Add(new Pause(this, 6000)); + Add(new Dialogue(this, "Fine! That's it! I've had enough...")); + Add(new ItemRemove(this, item)); + + item = ItemStackFactory.Instance.CreateStack(Material.RAW_FISH); + Add(new Dialogue(this, "Eat this fish.")); + Add(new ItemAdd(this, item)); + + Add(new Index(this, "Fish")); + + Add(new Pause(this, 6000)); + Add(new Dialogue(this, Dialogue.fishMessage)); + + Add(new IndexJump(this, "Fish")); + } + + @Override + public void FoodUpdate(Player player) + { + if (player.getFoodLevel() > 18) + SetCompleted(true); + + player.setFoodLevel(18); + } + + @Override + public Part GetNext() + { + return new A03_Teleport(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/a_welcome/A03_Teleport.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/a_welcome/A03_Teleport.java new file mode 100644 index 000000000..760591e4e --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/a_welcome/A03_Teleport.java @@ -0,0 +1,57 @@ +package nautilus.game.tutorial.part.a_welcome; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class A03_Teleport extends Part +{ + public A03_Teleport(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Dialogue(this, "Fantastic!")); + Add(new Dialogue(this, "Now that you've eaten some 'food' we can start.")); + + Add(new Pause(this, 1000)); + + Add(new Dialogue(this, "I'm going to teleport you to " + F.te("Tutorial Islands") + ".")); + Add(new Dialogue(this, "The weather is beautiful there.")); + + Add(new Pause(this, 1000)); + + Add(new Dialogue(this, "System", "Commencing teleport in;")); + Add(new Dialogue(this, "System", "3...")); + Add(new Dialogue(this, "System", "2...")); + Add(new Dialogue(this, "System", "1...")); + Add(new SoundEffect(this, Sound.ZOMBIE_UNFECT, 2f, 2f)); + + Add(new Teleport(this, Manager.spawnB)); + Add(new Pause(this, 1000)); + Add(new Dialogue(this, "Uhh...")); + Add(new Pause(this, 2500)); + + Add(new Teleport(this, Manager.spawnC)); + Add(new Pause(this, 4000)); + Add(new Dialogue(this, "Much better.")); + Add(new Dialogue(this, "Lets get straight into it!")); + Add(new Pause(this, 2000)); + + Add(new Complete(this)); + } + + @Override + public Part GetNext() + { + return new A04_Tutorials(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/a_welcome/A04_Tutorials.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/a_welcome/A04_Tutorials.java new file mode 100644 index 000000000..d748714e3 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/a_welcome/A04_Tutorials.java @@ -0,0 +1,76 @@ +package nautilus.game.tutorial.part.a_welcome; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class A04_Tutorials extends Part +{ + private boolean _prox = false; + + public A04_Tutorials(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Dialogue(this, "Welcome to " + F.te("Tutorial Islands") + ".")); + Add(new Dialogue(this, "Here you can do a number of different tutorials.")); + + Add(new Pause(this, 1000)); + + Add(new Index(this, "1")); + + Add(new Dialogue(this, "Head over to the " + F.te("Tutorial Minions") + ".")); + Add(new ForceLook(this, Manager.tutorials, 0)); + + Add(new AllowAction(this, true)); + + Add(new Pause(this, 30000)); + Add(new Dialogue(this, Dialogue.restartMessages)); + Add(new IndexJump(this, "1")); + + Add(new Index(this, "2")); + + Add(new Dialogue(this, "These are my minons, they do whatever I say.")); + Add(new Dialogue(this, "Simply " + F.ta("Right-Click") + " them to start a tutorial.")); + Add(new Dialogue(this, "Good luck!")); + + Add(new CompleteTutorial(this)); + } + + @EventHandler + public void UpdateProximity(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!AllowAction()) + return; + + if (_prox) + return; + + if (UtilMath.offset(GetPlayer().getLocation(), Manager.tutorials) < 8) + { + IndexJump("2"); + _prox = true; + } + } + + @Override + public Part GetNext() + { + return null; + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B01_ClassSelection.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B01_ClassSelection.java new file mode 100644 index 000000000..0124b8534 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B01_ClassSelection.java @@ -0,0 +1,94 @@ +package nautilus.game.tutorial.part.b_class_basics; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.minecraft.game.classcombat.events.ClassSetupEvent; +import mineplex.minecraft.game.classcombat.events.ClassSetupEvent.SetupType; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class B01_ClassSelection extends Part +{ + public B01_ClassSelection(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + //Intro + Add(new Dialogue(this, "Hello again, " + GetPlayerName() + "!")); + Add(new Dialogue(this, "Ready to learn about " + F.te("Classes") + " and " + F.te("Default Builds") + "?")); + Add(new Dialogue(this, "Yes?")); + Add(new Dialogue(this, "Good!")); + + Add(new Dialogue(this, "There are five different Classes available to you.")); + Add(new Dialogue(this, "Knight.")); + Add(new Dialogue(this, "Ranger.")); + Add(new Dialogue(this, "Brute.")); + Add(new Dialogue(this, "Assassin.")); + Add(new Dialogue(this, "Mage.")); + Add(new Dialogue(this, "Each of them have their own unique abilities.")); + + Add(new Pause(this, 3000)); + + Add(new Dialogue(this, "See that " + F.te("Enchantment Table") + "?")); + Add(new ForceLook(this, Manager.classSetup, 0)); + + Add(new Dialogue(this, "Well, it's not an " + F.te("Enchantment Table") + ".")); + Add(new Dialogue(this, "Thats a " + F.te("Class Setup Table") + ".")); + + Add(new Dialogue(this, "You can use it to choose your " + F.te("Class") + ".")); + + //Armor Set + Add(new Index(this, "Armor Set")); + + Add(new Dialogue(this, F.te(C.cGreen + "Right-Click") + " the " + F.te("Class Setup Table") + ".")); + Add(new Dialogue(this, "Then " + F.te(C.cGreen + "Left-Click") + " any of the armor sets.")); + Add(new AllowClassSetup(this, true)); + + Add(new Pause(this, 20000)); + + Add(new Dialogue(this, Dialogue.restartMessages)); + + Add(new ForceLook(this, Manager.classSetup, 0)); + + Add(new IndexJump(this, "Armor Set")); + } + + @EventHandler + public void ClassSetup(ClassSetupEvent event) + { + if (!event.GetPlayer().equals(GetPlayer())) + return; + + if (event.GetType() == SetupType.OpenMain) + return; + + if (event.GetType() == SetupType.ApplyDefaultBuilt) + { + event.GetPlayer().closeInventory(); + SetCompleted(true); + } + + else + { + event.GetPlayer().closeInventory(); + IndexJump("Armor Set"); + Dialogue(event.GetPlayer(), "Wrong! Try again!"); + event.SetCancelled(true); + } + } + + @Override + public Part GetNext() + { + return new B02_BruteClass(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B02_BruteClass.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B02_BruteClass.java new file mode 100644 index 000000000..a2f6054ce --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B02_BruteClass.java @@ -0,0 +1,74 @@ +package nautilus.game.tutorial.part.b_class_basics; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.events.ClassSetupEvent; +import mineplex.minecraft.game.classcombat.events.ClassSetupEvent.SetupType; +import mineplex.core.common.util.F; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class B02_BruteClass extends Part +{ + public B02_BruteClass(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Dialogue(this, "Fantastic!")); + + Add(new Index(this, "Start")); + + Add(new Dialogue(this, "Now do it again, and choose " + F.te("Brute Default Build") + ".")); + Add(new AllowClassSetup(this, true)); + Add(new Pause(this, 20000)); + Add(new IndexJump(this, "Start")); + } + + @EventHandler + public void ClassSetup(ClassSetupEvent event) + { + if (!event.GetPlayer().equals(GetPlayer())) + return; + + if (event.GetType() == SetupType.OpenMain) + return; + + if (event.GetType() == SetupType.ApplyDefaultBuilt) + { + if (event.GetClassType() == ClassType.Brute) + { + event.GetPlayer().closeInventory(); + SetCompleted(true); + } + else + { + event.GetPlayer().closeInventory(); + SetIndex(1); + Dialogue(event.GetPlayer(), "That's not the " + F.te("Brute Default Build") + "!"); + event.SetCancelled(true); + } + } + + else + { + event.GetPlayer().closeInventory(); + SetIndex(1); + Dialogue(event.GetPlayer(), "Nope!"); + event.SetCancelled(true); + } + } + + @Override + public Part GetNext() + { + return new B03_Skills(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B03_Skills.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B03_Skills.java new file mode 100644 index 000000000..4759d5258 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B03_Skills.java @@ -0,0 +1,53 @@ +package nautilus.game.tutorial.part.b_class_basics; + +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class B03_Skills extends Part +{ + public B03_Skills(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Dialogue(this, "You're doing great, I'm so proud.")); + Add(new Dialogue(this, "We should have a party to celebrate!")); + + + Add(new Pause(this, 3000)); + Add(new Dialogue(this, "Just kidding, you're actually doing very badly.")); + Add(new Dialogue(this, "Anyway...")); + Add(new Dialogue(this, "Each " + F.te("Class") + " has its own set of Skills.")); + Add(new Dialogue(this, "Skills can be " + F.te("Active") + " or " + F.te("Passive") + ".")); + Add(new Dialogue(this, "You use " + F.te("Active Skills") + " by clicking with weapons.")); + Add(new Dialogue(this, "However, " + F.te("Passive Skills") + " work automatically.")); + + Add(new Pause(this, 2000)); + + Add(new Dialogue(this, "Let's look at your equipped " + F.te("Skills") + ".")); + Add(new Dialogue(this, "In your inventory, there will be a row of items.")); + Add(new Dialogue(this, "This shows you what " + F.te("Skills") + " you have, and what they do.")); + + Add(new Dialogue(this, "I'll give you " + F.ta("20 Seconds") + " to have a look.")); + + Add(new Pause(this, 20000)); + + Add(new Dialogue(this, "You can view your " + F.te("Skills") + " like this, at any time.")); + + Add(new Complete(this)); + } + + @Override + public Part GetNext() + { + return new B04_DwarfToss(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B04_DwarfToss.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B04_DwarfToss.java new file mode 100644 index 000000000..f539e898e --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B04_DwarfToss.java @@ -0,0 +1,144 @@ +package nautilus.game.tutorial.part.b_class_basics; + +import java.util.HashSet; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Sheep; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import mineplex.minecraft.game.classcombat.events.SkillEvent; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class B04_DwarfToss extends Part +{ + public HashSet _sheep = new HashSet(); + + public B04_DwarfToss(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Index(this, "Start")); + + Add(new Dialogue(this, "Your swords " + F.te("Active Skill") + " is " + F.ts("Dwarf Toss") + ".")); + Add(new Dialogue(this, "This allows you to pick something up and throw it!")); + Add(new Dialogue(this, F.ta("Hold Right-Click") + " to pick it up.")); + Add(new Dialogue(this, "Then " + F.ta("Release Right-Click") + " to throw!")); + + Add(new Dialogue(this, "Lets give it a try...")); + Add(new Dialogue(this, "See those sheep over there?")); + Add(new ForceLook(this, Manager.sheepPit, 0)); + + Add(new Pause(this, 1000)); + + Add(new Dialogue(this, "I hate sheep...")); + Add(new Dialogue(this, "Throw one off the island for me!")); + Add(new AllowAction(this, true)); + + Add(new Pause(this, 30000)); + Add(new Dialogue(this, "You can do it, just toss a sheep away.")); + + Add(new Pause(this, 10000)); + Add(new Dialogue(this, "They don't have souls, i promise!")); + + Add(new Pause(this, 10000)); + Add(new Dialogue(this, "Do you like sheep or something...?")); + + Add(new Pause(this, 10000)); + Add(new AllowAction(this, false)); + Add(new Dialogue(this, "You must be confused...")); + Add(new Dialogue(this, "Let's start over!")); + + Add(new IndexJump(this, "Start")); + + Add(new Index(this, "End")); + + Add(new Dialogue(this, "YES! Goodbye you wooly freak.")); + Add(new Dialogue(this, "Oh " + GetPlayerName() + ", I think we could be good friends!")); + + Add(new Complete(this)); + } + + @EventHandler + public void DwarfToss(SkillEvent event) + { + if (!AllowAction()) + return; + + if (event.GetTargets() == null) + return; + + if (event.GetTargets().size() != 1) + return; + + if (!event.GetSkillName().equals("Dwarf Toss")) + return; + + if (!event.GetPlayer().getName().equals(GetPlayerName())) + return; + + Entity ent = event.GetTargets().get(0); + + if (!(ent instanceof Sheep)) + return; + + _sheep.add(ent); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + //Recharge Dwarf Toss + Manager.Clients().Get(GetPlayerName()).Game().GetRecharge().remove("Dwarf Toss"); + + HashSet remove = new HashSet(); + + for (Entity cur : _sheep) + if (cur.isDead() || !cur.isValid() || (UtilEnt.isGrounded(cur) && cur.getVehicle() == null)) + remove.add(cur); + + for (Entity cur : remove) + _sheep.remove(cur); + } + + @EventHandler + public void Damage(EntityDamageEvent event) + { + if (!AllowAction()) + return; + + if (event.getCause() != DamageCause.VOID) + return; + + if (!(event.getEntity() instanceof Sheep)) + return; + + if (!_sheep.contains(event.getEntity())) + return; + + SetAllowAction(false); + IndexJump("End"); + } + + @Override + public Part GetNext() + { + return new B05_SeismicSlam(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B05_SeismicSlam.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B05_SeismicSlam.java new file mode 100644 index 000000000..8b2b68b89 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B05_SeismicSlam.java @@ -0,0 +1,108 @@ +package nautilus.game.tutorial.part.b_class_basics; + +import java.util.HashSet; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Sheep; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.minecraft.game.classcombat.events.SkillEvent; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class B05_SeismicSlam extends Part +{ + public HashSet _sheep = new HashSet(); + + public B05_SeismicSlam(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Index(this, "Start")); + + Add(new Dialogue(this, "Now let's look at your axe ability, " + F.ts("Seismic Slam") + ".")); + Add(new Dialogue(this, "Just " + F.ta("Right-Click") + " with your axe to do it!")); + Add(new Dialogue(this, "You jump up and then slam down into the ground.")); + Add(new Dialogue(this, "This sends all nearby enemies flying!")); + + Add(new Dialogue(this, "You know what to do...")); + Add(new AllowAction(this, true)); + + Add(new Pause(this, 30000)); + Add(new Dialogue(this, "Ok, maybe you don't know what to do.")); + Add(new Dialogue(this, "Use " + F.te("Seismic Slam") + " on some sheep!")); + + Add(new Pause(this, 30000)); + Add(new Dialogue(this, "You can do it! I beleive in you!")); + + Add(new Pause(this, 10000)); + Add(new Dialogue(this, "Come on " + GetPlayerName() + "!")); + + Add(new Pause(this, 10000)); + Add(new AllowAction(this, false)); + Add(new Dialogue(this, "I guess we'll try that again...")); + + Add(new IndexJump(this, "Start")); + + Add(new Index(this, "End")); + + Add(new Pause(this, 1000)); + Add(new Dialogue(this, "Weeeeeeeee!")); + Add(new Dialogue(this, "You're a natural!")); + + Add(new Pause(this, 2000)); + + Add(new Dialogue(this, "Lets look at your " + F.ta("Passive Skills") + " now!")); + + Add(new Complete(this)); + } + + @EventHandler + public void SeismicSlam(SkillEvent event) + { + if (!AllowAction()) + return; + + if (event.GetTargets() == null) + return; + + if (!event.GetSkillName().equals("Seismic Slam")) + return; + + if (!event.GetPlayer().getName().equals(GetPlayerName())) + return; + + for (Entity ent : event.GetTargets()) + if (ent instanceof Sheep) + { + SetAllowAction(false); + IndexJump("End"); + } + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + //Recharge Dwarf Toss + Manager.Clients().Get(GetPlayerName()).Game().GetRecharge().remove("Seismic Slam"); + } + + @Override + public Part GetNext() + { + return new B06_Stampede(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B06_Stampede.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B06_Stampede.java new file mode 100644 index 000000000..ae5b62176 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B06_Stampede.java @@ -0,0 +1,116 @@ +package nautilus.game.tutorial.part.b_class_basics; + +import java.util.HashSet; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Sheep; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.F; +import mineplex.minecraft.game.classcombat.events.SkillEvent; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class B06_Stampede extends Part +{ + public HashSet _sheep = new HashSet(); + + public boolean _speedDone = false; + + public B06_Stampede(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Index(this, "Start")); + + Add(new Dialogue(this, "One of your " + F.te("Passive Skills") + " is " + F.ts("Stampede") + ".")); + Add(new Dialogue(this, F.ts("Stampede") + " will give you " + F.te("Speed") + " after sprinting for a while.")); + Add(new Dialogue(this, "Go for a little run and get some Speed!")); + Add(new AllowAction(this, true)); + + Add(new Pause(this, 30000)); + Add(new Dialogue(this, "Need me to explain it again?")); + Add(new IndexJump(this, "Start")); + + + Add(new Index(this, "Speed")); + Add(new Dialogue(this, "Easy, huh?! But it gets even better!")); + + + + Add(new Index(this, "Attack")); + + Add(new Dialogue(this, "Gain some Speed, then attack something.")); + Add(new Dialogue(this, "It'll send them flying!")); + Add(new AllowAction(this, true)); + + Add(new Pause(this, 30000)); + Add(new Dialogue(this, Dialogue.restartMessages)); + + Add(new IndexJump(this, "Attack")); + + + + Add(new Index(this, "End1")); + Add(new Dialogue(this, "Mmmmmm... yes...")); + Add(new Dialogue(this, "I'm so proud of you, I may cry.")); + Add(new Pause(this, 2000)); + Add(new Complete(this)); + + + + Add(new Index(this, "End2")); + Add(new Dialogue(this, "That wasn't a sheep... but... well done anyway.")); + Add(new Pause(this, 2000)); + Add(new Complete(this)); + } + + @EventHandler + public void Stampede(SkillEvent event) + { + if (!AllowAction()) + return; + + if (!event.GetSkillName().equals("Stampede")) + return; + + if (!event.GetPlayer().getName().equals(GetPlayerName())) + return; + + if (event.GetTargets() == null) + { + if (_speedDone) + return; + + IndexJump("Speed"); + SetAllowAction(false); + _speedDone = true; + } + else + { + if (event.GetTargets().get(0) instanceof Sheep) + { + IndexJump("End1"); + SetAllowAction(false); + } + else + { + IndexJump("End2"); + SetAllowAction(false); + } + } + } + + @Override + public Part GetNext() + { + return new B07_CripplingBlow(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B07_CripplingBlow.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B07_CripplingBlow.java new file mode 100644 index 000000000..2a5369f69 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B07_CripplingBlow.java @@ -0,0 +1,99 @@ +package nautilus.game.tutorial.part.b_class_basics; + +import org.bukkit.entity.Player; +import org.bukkit.entity.Sheep; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.F; +import mineplex.minecraft.game.classcombat.events.SkillEvent; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class B07_CripplingBlow extends Part +{ + private int _done = 0; + + public B07_CripplingBlow(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Index(this, "1")); + + Add(new Dialogue(this, "Another of your " + F.te("Passive Skills") + " is " + F.ts("Crippling Blow") + ".")); + Add(new Dialogue(this, "Your " + F.ta("Axe") + " attacks will " + F.te("Slow") + " the target for a short time.")); + Add(new Dialogue(this, "Try it on some sheep.")); + Add(new AllowAction(this, true)); + + Add(new Pause(this, 20000)); + Add(new Dialogue(this, Dialogue.restartMessages)); + Add(new IndexJump(this, "1")); + + Add(new Index(this, "2")); + + Add(new Dialogue(this, "SPLAT!")); + + Add(new Index(this, "3")); + + Add(new Dialogue(this, "Please hit a few more sheep with " + F.ts("Crippling Blow") + "!")); + Add(new Pause(this, 20000)); + + Add(new IndexJump(this, "3")); + + Add(new Index(this, "4")); + + Add(new Dialogue(this, "Well done!")); + Add(new Dialogue(this, "Did you notice a " + F.te("Spider Web") + " appears above the sheep?")); + Add(new Dialogue(this, "This is a " + F.te("Condition Icon") + ".")); + Add(new Dialogue(this, "It is showing that the sheep has " + F.te("Slow") + ".")); + Add(new Dialogue(this, "Many different conditions have " + F.te("Condition Icons") + ".")); + Add(new Dialogue(this, "You use them to see what conditions someone has!")); + + Add(new Complete(this)); + } + + @EventHandler + public void CripplingBlow(SkillEvent event) + { + if (!AllowAction()) + return; + + if (!event.GetSkillName().equals("Crippling Blow")) + return; + + if (!event.GetPlayer().getName().equals(GetPlayerName())) + return; + + if (event.GetTargets() == null) + return; + + if (!(event.GetTargets().get(0) instanceof Sheep)) + return; + + if (_done == 0) + { + _done++; + IndexJump("2"); + } + else if (_done == 8) + { + _done++; + IndexJump("4"); + } + else + { + _done++; + } + } + + @Override + public Part GetNext() + { + return new B99_Conclusion(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B08_MageClass.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B08_MageClass.java new file mode 100644 index 000000000..9b9b552fd --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B08_MageClass.java @@ -0,0 +1,72 @@ +package nautilus.game.tutorial.part.b_class_basics; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.events.ClassSetupEvent; +import mineplex.minecraft.game.classcombat.events.ClassSetupEvent.SetupType; +import mineplex.core.common.util.F; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class B08_MageClass extends Part +{ + public B08_MageClass(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Dialogue(this, "Okay, we're done with " + F.te("Brute") + " for now...")); + + Add(new Index(this, "Start")); + + Add(new Dialogue(this, "Return to the " + F.te("Class Setup Table") + ".")); + Add(new Dialogue(this, "This time, choose " + F.te("Mage Default Build") + ".")); + Add(new AllowClassSetup(this, true)); + Add(new Pause(this, 20000)); + Add(new IndexJump(this, "Start")); + } + + @EventHandler + public void ClassSetup(ClassSetupEvent event) + { + if (event.GetType() == SetupType.OpenMain) + return; + + if (event.GetType() == SetupType.ApplyDefaultBuilt) + { + if (event.GetClassType() == ClassType.Mage) + { + event.GetPlayer().closeInventory(); + SetCompleted(true); + } + else + { + event.GetPlayer().closeInventory(); + SetIndex(1); + Dialogue(event.GetPlayer(), "That's not the " + F.te("Mage Default Build") + "!"); + event.SetCancelled(true); + } + } + + else + { + event.GetPlayer().closeInventory(); + SetIndex(1); + Dialogue(event.GetPlayer(), "No! No! No! Bad!"); + event.SetCancelled(true); + } + } + + @Override + public Part GetNext() + { + return new B03_Skills(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B99_Conclusion.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B99_Conclusion.java new file mode 100644 index 000000000..27564c8e2 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/b_class_basics/B99_Conclusion.java @@ -0,0 +1,35 @@ +package nautilus.game.tutorial.part.b_class_basics; + +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class B99_Conclusion extends Part +{ + public B99_Conclusion(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + //Intro + Add(new Dialogue(this, "Alright!")); + Add(new Dialogue(this, "That's all for this tutorial!")); + Add(new Dialogue(this, "You did great. I hope you learned something!")); + Add(new Dialogue(this, "The next tutorial is " + F.te("Locked Skills") + ".")); + + Add(new CompleteTutorial(this)); + } + + @Override + public Part GetNext() + { + return null; + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C01_Brute.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C01_Brute.java new file mode 100644 index 000000000..51718031b --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C01_Brute.java @@ -0,0 +1,82 @@ +package nautilus.game.tutorial.part.c_locked_skills; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.events.ClassSetupEvent; +import mineplex.minecraft.game.classcombat.events.ClassSetupEvent.SetupType; +import mineplex.core.common.util.F; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class C01_Brute extends Part +{ + public C01_Brute(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Dialogue(this, "Meow!")); + Add(new Dialogue(this, "Let's learn about the " + F.te("Class Shop") + " and " + F.te("Skill Unlocks") + "!")); + + Add(new Pause(this, 2000)); + + Add(new Dialogue(this, "In the last tutorial, you chose " + F.te("Class Default Build") + ".")); + Add(new Dialogue(this, "This gives you a pre-selected group of " + F.te("Skills") + ".")); + Add(new Dialogue(this, "However, there are a lot more " + F.te("Skills") + " for each " + F.te("Class") + "!")); + Add(new Dialogue(this, "You will get to choose which " + F.te("Skills") + " you want to use.")); + + Add(new Index(this, "Start")); + + Add(new Dialogue(this, "Let's start by choosing " + F.te("Brute Default Build") + " again.")); + Add(new AllowClassSetup(this, true)); + Add(new Pause(this, 20000)); + Add(new IndexJump(this, "Start")); + } + + @EventHandler + public void ClassSetup(ClassSetupEvent event) + { + if (!event.GetPlayer().equals(GetPlayer())) + return; + + if (event.GetType() == SetupType.OpenMain) + return; + + if (event.GetType() == SetupType.ApplyDefaultBuilt) + { + if (event.GetClassType() == ClassType.Brute) + { + event.GetPlayer().closeInventory(); + SetCompleted(true); + } + else + { + event.GetPlayer().closeInventory(); + SetIndex(1); + Dialogue(event.GetPlayer(), "That's not the " + F.te("Brute Default Build") + "!"); + event.SetCancelled(true); + } + } + + else + { + event.GetPlayer().closeInventory(); + SetIndex(1); + Dialogue(event.GetPlayer(), "Nope!"); + event.SetCancelled(true); + } + } + + @Override + public Part GetNext() + { + return new C02_Slots(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C02_Slots.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C02_Slots.java new file mode 100644 index 000000000..20f1efa47 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C02_Slots.java @@ -0,0 +1,54 @@ +package nautilus.game.tutorial.part.c_locked_skills; + +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class C02_Slots extends Part +{ + public C02_Slots(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Dialogue(this, "Good stuff!")); + + Add(new Pause(this, 2000)); + + Add(new Dialogue(this, "Have a look at your " + F.te("Skills") + " again.")); + Add(new Dialogue(this, "Do this by opening your inventory.")); + + Add(new Dialogue(this, "Each " + F.te("Class") + " has 7 or 8 " + F.te("Skill Slots") + ".")); + Add(new Dialogue(this, F.te("Brute") + " has 7 Skill Slots;")); + Add(new Dialogue(this, "Two " + F.te("Active Slots") + "; Sword and Axe")); + Add(new Dialogue(this, "Two " + F.te("Class Passive Slots") + ".")); + Add(new Dialogue(this, "Three " + F.te("Global Passive Slots") + ".")); + Add(new Dialogue(this, "You may only have one Skill in each Slot Type.")); + + Add(new Dialogue(this, "I'll give you " + F.ta("10 Seconds") + " to have a look.")); + + Add(new Pause(this, 10000)); + + Add(new Dialogue(this, "Each " + F.te("Class") + " has a selection of " + F.te("Skills") + " for each " + F.te("Skill Slot") + ".")); + Add(new Dialogue(this, "You have to pick and choose which " + F.te("Skills") + " you want to use!")); + + Add(new Pause(this, 1000)); + + Add(new Dialogue(this, "Let's try out some other " + F.te("Sword Skills") + " for " + F.te("Brute") + "!")); + + Add(new Complete(this)); + } + + @Override + public Part GetNext() + { + return new C03_BlockToss(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C03_BlockToss.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C03_BlockToss.java new file mode 100644 index 000000000..8027d9c20 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C03_BlockToss.java @@ -0,0 +1,113 @@ +package nautilus.game.tutorial.part.c_locked_skills; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.minecraft.game.classcombat.events.SkillEvent; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class C03_BlockToss extends Part +{ + private int _throw = 0; + + public C03_BlockToss(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Dialogue(this, "System", "Inserting Block Toss...")); + Manager.Clients().Get(GetPlayer()).Class().AddSkill("Block Toss", 3); + + Add(new Pause(this, 1000)); + + Add(new Dialogue(this, "Your Swords Active Skill is now " + F.ts("Block Toss") + ".")); + Add(new Dialogue(this, "This allows you to pick up blocks and throw them!")); + + Add(new Index(this, "1")); + + Add(new Dialogue(this, F.ta("Hold Right-Click") + " to pick blocks up.")); + Add(new Dialogue(this, "Then " + F.ta("Release Right-Click") + " to throw!")); + + Add(new AllowAction(this, true)); + Add(new Dialogue(this, "Give it a try!")); + + Add(new Pause(this, 30000)); + Add(new Dialogue(this, Dialogue.restartMessages)); + Add(new IndexJump(this, "1")); + + Add(new Index(this, "2")); + + Add(new Dialogue(this, "Well done!")); + Add(new Dialogue(this, "You can use this to attack enemies, or to modify terrain!")); + + Add(new Index(this, "3")); + + Add(new Dialogue(this, "Try it a few more times, then we'll move on.")); + Add(new Pause(this, 20000)); + Add(new Dialogue(this, "Just throw a couple more blocks. It's good fun!")); + Add(new Pause(this, 20000)); + Add(new Dialogue(this, "I don't have all day...")); + Add(new Pause(this, 20000)); + + Add(new IndexJump(this, "3")); + + Add(new Index(this, "4")); + + Add(new Dialogue(this, "Perfect, you're a natural!")); + + Add(new Complete(this)); + } + + @EventHandler + public void BlockToss(SkillEvent event) + { + if (!AllowAction()) + return; + + if (!event.GetSkillName().equals("Block Toss")) + return; + + if (!event.GetPlayer().getName().equals(GetPlayerName())) + return; + + if (_throw == 0) + { + _throw++; + IndexJump("2"); + } + else if (_throw == 5) + { + _throw++; + IndexJump("4"); + } + else + { + _throw++; + } + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + //Recharge Dwarf Toss + Manager.Clients().Get(GetPlayerName()).Game().GetRecharge().remove("Block Toss"); + } + + @Override + public Part GetNext() + { + return new C04_FleshHook(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C04_FleshHook.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C04_FleshHook.java new file mode 100644 index 000000000..b9b6772c0 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C04_FleshHook.java @@ -0,0 +1,114 @@ +package nautilus.game.tutorial.part.c_locked_skills; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.minecraft.game.classcombat.events.SkillEvent; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class C04_FleshHook extends Part +{ + private int _hooked = 0; + + public C04_FleshHook(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Dialogue(this, "System", "Inserting Flesh Hook...")); + Manager.Clients().Get(GetPlayer()).Class().AddSkill("Flesh Hook", 3); + + Add(new Pause(this, 1000)); + + Add(new Dialogue(this, "Your Swords Active Skill is now " + F.ts("Flesh Hook") + ".")); + Add(new Dialogue(this, "This allows you to pull enemies towards you!")); + + Add(new Index(this, "1")); + + Add(new Dialogue(this, F.ta("Hold Right-Click") + " to charge up " + F.ts("Flesh Hook") + ".")); + Add(new Dialogue(this, "Then " + F.ta("Release Right-Click") + " to throw it!")); + + Add(new AllowAction(this, true)); + Add(new Dialogue(this, "Try hooking some of those wooly bastards!")); + + Add(new AllowAction(this, true)); + + Add(new Pause(this, 30000)); + Add(new Dialogue(this, Dialogue.restartMessages)); + Add(new IndexJump(this, "1")); + + Add(new Index(this, "2")); + + Add(new Dialogue(this, "Ahhhh, fresh meat!")); + + Add(new Index(this, "3")); + + Add(new Dialogue(this, "Torture a few more of these disgusting sheep.")); + Add(new Pause(this, 20000)); + Add(new Dialogue(this, "Give it a few more tries!")); + Add(new Pause(this, 20000)); + Add(new Dialogue(this, "Yawn...")); + Add(new Pause(this, 20000)); + + Add(new IndexJump(this, "3")); + + Add(new Index(this, "4")); + + Add(new Dialogue(this, "You're getting good at this!")); + + Add(new Complete(this)); + } + + @EventHandler + public void FleshHook(SkillEvent event) + { + if (!AllowAction()) + return; + + if (!event.GetSkillName().equals("Flesh Hook")) + return; + + if (!event.GetPlayer().getName().equals(GetPlayerName())) + return; + + if (_hooked == 0) + { + _hooked++; + IndexJump("2"); + } + else if (_hooked == 3) + { + _hooked++; + IndexJump("4"); + } + else + { + _hooked++; + } + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + //Recharge Dwarf Toss + Manager.Clients().Get(GetPlayerName()).Game().GetRecharge().remove("Flesh Hook"); + } + + @Override + public Part GetNext() + { + return new C05_LockedSkills(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C05_LockedSkills.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C05_LockedSkills.java new file mode 100644 index 000000000..5e321d97a --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C05_LockedSkills.java @@ -0,0 +1,103 @@ +package nautilus.game.tutorial.part.c_locked_skills; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.Rank; +import me.chiss.Core.Skill.ISkill; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.minecraft.account.CoreClient; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class C05_LockedSkills extends Part +{ + private boolean _prox = false; + + public C05_LockedSkills(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Pause(this, 2000)); + + Add(new Dialogue(this, "Let's talk about " + F.te("Skill Ownership") + ".")); + Add(new Dialogue(this, "You already own the " + F.te("Skills") + " in the " + F.te("Default Builds") + ".")); + + Add(new Dialogue(this, "But other " + F.te("Skills") + " are " + F.te(C.cRed + "Locked") + ".")); + Add(new Dialogue(this, "You will need to " + F.ta("Unlock") + " them, before using them.")); + Add(new Dialogue(this, "You can do this at the " + F.te("Class Shop") + ".")); + + Add(new Pause(this, 1000)); + + Add(new Index(this, "Search")); + + Add(new Dialogue(this, "Head over to the " + F.te("Class Shop") + ".")); + Add(new ForceLook(this, Manager.classShop, 0)); + Add(new AllowAction(this, true)); + + Add(new Pause(this, 20000)); + Add(new Dialogue(this, Dialogue.restartMessages)); + Add(new IndexJump(this, "Search")); + + Add(new Index(this, "Proximity")); + + Add(new Dialogue(this, "Here, you can " + F.ta("Unlock") + " new " + F.te("Skills") + ".")); + Add(new Dialogue(this, "You can do this with " + F.ta("Points") + " or " + F.te(C.cAqua + "Credits") + ".")); + Add(new Dialogue(this, "You earn " + F.ta("Points") + " by playing games, like " + F.te("Domination") + ".")); + Add(new Dialogue(this, "You receive " + F.te(C.cAqua + "Credits") + " for donating to " + F.te("BetterMC") + ".")); + + Add(new Pause(this, 1000)); + + Add(new Dialogue(this, "Let's purchase your first " + F.te("Skill") + "!")); + Add(new Dialogue(this, "I'll give you some " + F.ta("Points") + ".")); + + Add(new Complete(this)); + } + + @EventHandler + public void UpdateProximity(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!AllowAction()) + return; + + if (_prox) + return; + + if (UtilMath.offset(GetPlayer().getLocation(), Manager.classShop) < 3) + { + IndexJump("Proximity"); + _prox = true; + } + } + + @Override + public Part GetNext() + { + ISkill inferno = Manager.Skills().GetSkill("Inferno"); + + CoreClient client = Manager.Clients().Get(GetPlayer()); + + if (client.Donor().GetSalesPackagesOwned().contains(inferno.GetSalesPackageId(1)) || + client.Rank().Has(Rank.DIAMOND, false)) + { + return new C06b_Purchase(Manager, Data, GetPlayer()); + } + else + { + return new C06_Purchase(Manager, Data, GetPlayer()); + } + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C06_Purchase.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C06_Purchase.java new file mode 100644 index 000000000..52c7aabdc --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C06_Purchase.java @@ -0,0 +1,89 @@ +package nautilus.game.tutorial.part.c_locked_skills; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import me.chiss.Core.Shop.events.PurchasePackageEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class C06_Purchase extends Part +{ + public boolean browsed = false; + + public C06_Purchase(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + //Dont give if already given + if (!GetPointRemove()) + { + Manager.GivePoints(GetPlayerName(), 4000); + SetCreditRemove(true); + Add(new Dialogue(this, "System", "You received " + F.ta("4000 Points") + ".")); + } + + Add(new Pause(this, 4000)); + + Add(new Dialogue(this, "We are going to purchase " + F.ts("Inferno") + " for " + F.te("Mage") + ".")); + Add(new Dialogue(this, "Doesn't that sound fun!?")); + Add(new Dialogue(this, "It's extremely simple, just follow these steps!")); + + Add(new Index(this, "Purchase")); + + Add(new Dialogue(this, "Step 1) " + F.ta("Right-Click") + " the " + F.ts("Class Shop") + ".")); + Add(new Dialogue(this, "Step 2) " + F.ta("Left-Click") + " on " + F.ts("Mage Class") + ".")); + Add(new Dialogue(this, "Step 3) " + F.ta("Left-Click") + " on " + F.ts("Diamond") + " to change " + F.te("Currency") + ".")); + Add(new Dialogue(this, "Step 4) " + F.ta("Left-Click") + " on " + F.ts("Inferno") + ".")); + Add(new Dialogue(this, "Step 5) " + F.ta("Left-Click") + " on " + F.te(C.cYellow + "Confirm") + ".")); + + Add(new AllowClassShop(this, true)); + Add(new Dialogue(this, "Give it a try now!")); + + Add(new Pause(this, 20000)); + + Add(new Dialogue(this, Dialogue.restartMessages)); + + Add(new ForceLook(this, Manager.classSetup, 0)); + + Add(new IndexJump(this, "Purchase")); + + Add(new Index(this, "Purchased")); + + Add(new Dialogue(this, "Wow " + GetPlayerName() + ", you are just so smart!")); + + Add(new Complete(this)); + } + + @EventHandler + public void ClassShop(PurchasePackageEvent event) + { + if (!event.GetPlayerName().equals(GetPlayerName())) + return; + + if (!event.GetItemName().contains("Inferno")) + { + event.setCancelled(true); + event.SetReason("Silly rabbit, this is not Inferno!"); + IndexJump("Purchase"); + return; + } + + IndexJump("Purchased"); + this.SetCreditRemove(false); + } + + @Override + public Part GetNext() + { + return new C99_Conclusion(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C06b_Purchase.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C06b_Purchase.java new file mode 100644 index 000000000..241ea7ec6 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C06b_Purchase.java @@ -0,0 +1,40 @@ +package nautilus.game.tutorial.part.c_locked_skills; + +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class C06b_Purchase extends Part +{ + public boolean browsed = false; + + public C06b_Purchase(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Dialogue(this, "Oh...")); + Add(new Pause(this, 1000)); + Add(new Dialogue(this, "Whats this..?")); + Add(new Pause(this, 1000)); + Add(new Dialogue(this, "It seems have already unlocked " + F.te("Inferno") + ".")); + Add(new Pause(this, 1000)); + Add(new Dialogue(this, "I guess I don't need to teach you how to unlock Skills.")); + Add(new Dialogue(this, "Lucky me!")); + + Add(new Complete(this)); + } + + @Override + public Part GetNext() + { + return new C99_Conclusion(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C99_Conclusion.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C99_Conclusion.java new file mode 100644 index 000000000..ddb8c8c38 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/c_locked_skills/C99_Conclusion.java @@ -0,0 +1,34 @@ +package nautilus.game.tutorial.part.c_locked_skills; + +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class C99_Conclusion extends Part +{ + public C99_Conclusion(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + //Intro + Add(new Dialogue(this, "All done here!")); + Add(new Dialogue(this, "You've finished the " + F.te("Locked Skills") + " tutorial!")); + Add(new Dialogue(this, "The next tutorial is " + F.te("Custom Builds") + ".")); + + Add(new CompleteTutorial(this)); + } + + @Override + public Part GetNext() + { + return null; + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D01_CustomBuild.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D01_CustomBuild.java new file mode 100644 index 000000000..7d006e269 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D01_CustomBuild.java @@ -0,0 +1,84 @@ +package nautilus.game.tutorial.part.d_class_builds; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class D01_CustomBuild extends Part +{ + private boolean _prox = false; + + public D01_CustomBuild(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Dialogue(this, "Are you ready for some fun!?")); + Add(new Dialogue(this, "It's time for some sexy " + F.te("Class Custom Builds") + "!")); + + Add(new Pause(this, 2000)); + + Add(new Dialogue(this, "Alright! Where to begin...")); + Add(new Dialogue(this, "When you " + F.ta("Left-Click") + " armor in the " + F.te("Class Setup Table") + ",")); + Add(new Dialogue(this, "you receive the " + F.te("Default Build") + " for that " + F.te("Class") + ".")); + Add(new Dialogue(this, "This is a pre-made setup for each " + F.te("Class") + ".")); + + Add(new Pause(this, 1000)); + + Add(new Dialogue(this, "However, you can create your own " + F.te("Custom Builds") + "!")); + + Add(new Dialogue(this, "Let's create a new " + F.te("Custom Build") + ".")); + + Add(new Index(this, "Search")); + + Add(new Dialogue(this, "Head on down to the " + F.te("Class Setup Table") + ".")); + Add(new ForceLook(this, Manager.classSetup, 0)); + Add(new AllowAction(this, true)); + + Add(new Pause(this, 20000)); + Add(new Dialogue(this, Dialogue.restartMessages)); + + Add(new IndexJump(this, "Search")); + + Add(new Index(this, "Proximity")); + + Add(new Complete(this)); + } + + @EventHandler + public void UpdateProximity(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!AllowAction()) + return; + + if (_prox) + return; + + if (UtilMath.offset(GetPlayer().getLocation(), Manager.classSetup) < 3) + { + IndexJump("Proximity"); + _prox = true; + } + } + + + @Override + public Part GetNext() + { + return new D02_InfernoBuild(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D02_InfernoBuild.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D02_InfernoBuild.java new file mode 100644 index 000000000..637d574cc --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D02_InfernoBuild.java @@ -0,0 +1,94 @@ +package nautilus.game.tutorial.part.d_class_builds; + +import java.util.Map.Entry; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryType; + + +import me.chiss.Core.Skill.ISkill; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class D02_InfernoBuild extends Part +{ + private boolean _done = false; + + public D02_InfernoBuild(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Index(this, "Start")); + + Add(new Dialogue(this, "We'll create a " + F.te("Mage Custom Build") + " with " + F.ts("Inferno") + ".")); + + Add(new Dialogue(this, "Just follow these steps;")); + + Add(new Dialogue(this, "Step 1) " + F.ta("Right-Click") + " the " + F.te("Class Setup Table") + ".")); + Add(new Dialogue(this, "Step 2) " + F.ta("Left-Click") + " on " + F.te("Mage Custom Build") + ".")); + Add(new Dialogue(this, "Step 3) " + F.ta("Left-Click") + " on " + F.te("Edit & Save Build") + ".")); + Add(new Dialogue(this, "Step 4) " + F.ta("Left-Click") + " on " + F.ts("Inferno") + ".")); + Add(new Dialogue(this, "Step 5) Close the " + F.te("Class Setup Menu") + ".")); + + Add(new AllowClassSetup(this, true)); + + Add(new Pause(this, 30000)); + + Add(new Dialogue(this, Dialogue.restartMessages)); + + Add(new IndexJump(this, "Start")); + + Add(new Index(this, "Equip")); + + Add(new Dialogue(this, "Well done! You equipped a " + F.te("Custom Build") + " with " + F.ts("Inferno") + ".")); + Add(new Dialogue(this, "However, you need a " + F.ta("Sword") + " to use " + F.ts("Inferno") + ".")); + + Add(new Complete(this)); + } + + @EventHandler + public void UpdateEquip(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_done) + return; + + if (!AllowClassSetup()) + return; + + if (GetPlayer().getOpenInventory() != null) + if (GetPlayer().getOpenInventory().getType() == InventoryType.CHEST) + return; + for (Entry skill : Manager.Clients().Get(GetPlayer()).Class().GetSkills()) + { + if (skill.getValue() <= 0) + continue; + + if (!skill.getKey().GetName().equals("Inferno")) + continue; + + IndexJump("Equip"); + GetPlayer().closeInventory(); + + _done = true; + } + } + + @Override + public Part GetNext() + { + return new D03_Weapons(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D03_Weapons.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D03_Weapons.java new file mode 100644 index 000000000..4bf106ade --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D03_Weapons.java @@ -0,0 +1,107 @@ +package nautilus.game.tutorial.part.d_class_builds; + +import java.util.Map.Entry; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.inventory.ItemStack; + + +import me.chiss.Core.Skill.ISkill; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class D03_Weapons extends Part +{ + private boolean _done = false; + + public D03_Weapons(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Pause(this, 2000)); + + Add(new Dialogue(this, "As well as " + F.te("Skills") + ", you must also choose " + F.te("Weapons") + "!")); + + Add(new Index(this, "Start")); + + Add(new Dialogue(this, "Open your " + F.te("Custom Build") + " again.")); + Add(new Dialogue(this, "In the top right corner, you will see " + F.te("Page Turner") + ".")); + Add(new Dialogue(this, F.ta("Left-Click") + " on " + F.te("Page Turner") + " to change page.")); + Add(new Dialogue(this, "On this page, you can choose " + F.te("Weapons") + " for combat.")); + Add(new Dialogue(this, "On the next page, you can choose " + F.te("Items") + " and " + F.te("Food") + ".")); + Add(new Dialogue(this, "Create a " + F.te("Custom Build") + " with " + F.ts("Inferno") + " and " + F.ts("Standard Sword") + ".")); + + Add(new AllowClassSetup(this, true)); + + Add(new Pause(this, 30000)); + + Add(new Dialogue(this, Dialogue.restartMessages)); + + Add(new IndexJump(this, "Start")); + + Add(new Index(this, "Equip")); + + Add(new Dialogue(this, "Great job! You seem to be getting the hang of this!")); + + Add(new Complete(this)); + } + + @EventHandler + public void UpdateEquip(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_done) + return; + + if (!AllowClassSetup()) + return; + + if (GetPlayer().getOpenInventory() != null) + if (GetPlayer().getOpenInventory().getType() == InventoryType.CHEST) + return; + + for (Entry skill : Manager.Clients().Get(GetPlayer()).Class().GetSkills()) + { + if (skill.getValue() <= 0) + continue; + + if (!skill.getKey().GetName().equals("Inferno")) + continue; + + boolean sword = false; + for (int i=0 ; i<9 ; i++) + { + ItemStack stack = GetPlayer().getInventory().getItem(i); + if (stack != null && stack.getType() == Material.IRON_SWORD) + sword = true; + } + if (!sword) + continue; + + IndexJump("Equip"); + GetPlayer().closeInventory(); + + _done = true; + } + } + + @Override + public Part GetNext() + { + return new D04_Inferno(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D04_Inferno.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D04_Inferno.java new file mode 100644 index 000000000..b30412e62 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D04_Inferno.java @@ -0,0 +1,78 @@ +package nautilus.game.tutorial.part.d_class_builds; + +import org.bukkit.entity.Player; +import org.bukkit.entity.Sheep; +import org.bukkit.event.EventHandler; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import mineplex.core.common.util.F; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class D04_Inferno extends Part +{ + private int _burns = 0; + + public D04_Inferno(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Dialogue(this, F.ts("Inferno") + " is a " + F.te("Sword Skill") + ".")); + Add(new Dialogue(this, "Simply " + F.ta("Hold Right-Click") + " with your sword use it!")); + Add(new Dialogue(this, "It breathes out a flurry of fire that ignites players.")); + + Add(new Index(this, "Start")); + + Add(new Dialogue(this, "Burn some of those wooly bastards for me!")); + Add(new AllowAction(this, true)); + + Add(new Pause(this, 30000)); + Add(new IndexJump(this, "Start")); + + Add(new Index(this, "End")); + + Add(new Dialogue(this, "Ohhhh...")); + Add(new Dialogue(this, "Mmm....")); + Add(new Dialogue(this, "That was great.")); + + Add(new Complete(this)); + } + + @EventHandler + public void InfernoDamage(CustomDamageEvent event) + { + if (!AllowAction()) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) + return; + + if (!(event.GetDamageeEntity() instanceof Sheep)) + return; + + if (!damager.equals(GetPlayer())) + return; + + if (!event.GetReason().contains("Inferno")) + return; + + _burns++; + + if (_burns == 15) + IndexJump("End"); + } + + @Override + public Part GetNext() + { + return new D05_Tokens(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D05_Tokens.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D05_Tokens.java new file mode 100644 index 000000000..c78d6d083 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D05_Tokens.java @@ -0,0 +1,89 @@ +package nautilus.game.tutorial.part.d_class_builds; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryType; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class D05_Tokens extends Part +{ + private boolean _done = false; + + public D05_Tokens(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Pause(this, 4000)); + + Add(new Dialogue(this, "Alright... back to " + F.te("Custom Builds") + ".")); + Add(new Dialogue(this, "Equipping " + F.te("Skills") + " requires " + F.te("Skill Tokens") + ".")); + Add(new Dialogue(this, "Equipping " + F.te("Weapons") + " and " + F.te("Items") + " requires " + F.te("Item Tokens") + ".")); + + Add(new Dialogue(this, "You always have " + F.te("120 Skill Tokens") + " and " + F.te("120 Item Tokens") + ".")); + Add(new Dialogue(this, "They are displayed at the top of the " + F.te("Custom Build Menu") + ".")); + Add(new Dialogue(this, "You should always use all of your " + F.te("Tokens") + "!")); + + Add(new Pause(this, 2000)); + + Add(new Index(this, "Start")); + + Add(new Dialogue(this, "Create a " + F.te("Custom Build") + " for " + F.te("Ranger") + " which;")); + Add(new Dialogue(this, "a.) Uses all " + F.te("120 Skill Tokens"))); + Add(new Dialogue(this, "b.) Uses all " + F.te("120 Item Tokens"))); + Add(new Dialogue(this, "Go! Go! Go!")); + Add(new AllowClassSetup(this, true)); + + Add(new Pause(this, 30000)); + Add(new Dialogue(this, Dialogue.restartMessages)); + Add(new IndexJump(this, "Start")); + + Add(new Index(this, "Equip")); + + Add(new Dialogue(this, "Incredible!")); + + Add(new Complete(this)); + } + + @EventHandler + public void UpdateProximity(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!AllowClassSetup()) + return; + + if (_done) + return; + + if (GetPlayer().getOpenInventory() != null) + if (GetPlayer().getOpenInventory().getType() == InventoryType.CHEST) + return; + + CustomBuildToken token = Manager.Clients().Get(GetPlayer()).Donor().GetActiveCustomBuild(Manager.Classes().GetClass("Ranger")); + + if (token.ItemTokensBalance <= 0 && token.SkillTokensBalance <= 0) + { + IndexJump("Equip"); + _done = true; + } + } + + @Override + public Part GetNext() + { + return new D99_Conclusion(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D99_Conclusion.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D99_Conclusion.java new file mode 100644 index 000000000..e82574b67 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/d_class_builds/D99_Conclusion.java @@ -0,0 +1,33 @@ +package nautilus.game.tutorial.part.d_class_builds; + +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class D99_Conclusion extends Part +{ + public D99_Conclusion(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + //Intro + Add(new Dialogue(this, "Congratulations!")); + Add(new Dialogue(this, "You've finished all of the " + F.ta("Core Tutorials") + "!")); + + Add(new CompleteTutorial(this)); + } + + @Override + public Part GetNext() + { + return null; + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/m_icons/M01_Icons.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/m_icons/M01_Icons.java new file mode 100644 index 000000000..3cf2aeea1 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/m_icons/M01_Icons.java @@ -0,0 +1,34 @@ +package nautilus.game.tutorial.part.m_icons; + +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class M01_Icons extends Part +{ + public M01_Icons(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Dialogue(this, "These are " + F.te("Condition Icons") + "!")); + Add(new Dialogue(this, "When something has a " + F.te("Condition") + ",")); + Add(new Dialogue(this, "one of these is displayed above their head!")); + Add(new Dialogue(this, "This lets you see what " + F.te("Conditions") + " they have.")); + Add(new Dialogue(this, "Have a look at all the different types.")); + Add(new EndTutorial(this)); + } + + @Override + public Part GetNext() + { + return null; + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/q_secret/Q01_Secret.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/q_secret/Q01_Secret.java new file mode 100644 index 000000000..53169281c --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/q_secret/Q01_Secret.java @@ -0,0 +1,79 @@ +package nautilus.game.tutorial.part.q_secret; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class Q01_Secret extends Part +{ + private long _timer = 0; + private boolean _done = false; + + public Q01_Secret(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + _timer = System.currentTimeMillis(); + } + + @Override + public void CreateActions() + { + Add(new Pause(this, 2000)); + Add(new Dialogue(this, "Barry", "Has de matar-la! Has de matar-la!")); + Add(new Pause(this, 1000)); + Add(new SoundEffect(this, Sound.PIG_IDLE, 5f, 1f)); + Add(new Pause(this, 1000)); + Add(new SoundEffect(this, Sound.SPIDER_IDLE, 5f, 1f)); + Add(new Pause(this, 1000)); + Add(new SoundEffect(this, Sound.CHICKEN_IDLE, 5f, 1f)); + Add(new Pause(this, 1000)); + Add(new SoundEffect(this, Sound.STEP_SAND, 5f, 1f)); + + Add(new Index(this, "Loop")); + Add(new IndexJump(this, "Loop")); + + Add(new Index(this, "Failure")); + Add(new SoundEffect(this, Sound.NOTE_BASS_GUITAR, 2f, 2f)); + Add(new EndTutorial(this)); + + Add(new Index(this, "Proximity")); + Add(new Complete(this)); + } + + @EventHandler + public void UpdateProximity(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_done) + return; + + if (UtilTime.elapsed(_timer, 60000)) + { + IndexJump("Failure"); + _done = true; + } + + if (UtilMath.offset(GetPlayer().getLocation(), Manager.secPig) < 2) + { + IndexJump("Proximity"); + _done = true; + } + } + + @Override + public Part GetNext() + { + return new Q02_Pig(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/q_secret/Q02_Pig.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/q_secret/Q02_Pig.java new file mode 100644 index 000000000..ebef4b2fe --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/q_secret/Q02_Pig.java @@ -0,0 +1,76 @@ +package nautilus.game.tutorial.part.q_secret; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class Q02_Pig extends Part +{ + private long _timer = 0; + private boolean _done = false; + + public Q02_Pig(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + _timer = System.currentTimeMillis(); + } + + @Override + public void CreateActions() + { + Add(new SoundEffect(this, Sound.PIG_IDLE, 5f, 1f)); + Add(new Pause(this, 500)); + Add(new SoundEffect(this, Sound.PIG_IDLE, 5f, 1f)); + Add(new Pause(this, 500)); + Add(new SoundEffect(this, Sound.PIG_IDLE, 5f, 1f)); + Add(new Pause(this, 1000)); + Add(new SoundEffect(this, Sound.NOTE_PLING, 2f, 2f)); + + Add(new Index(this, "Loop")); + Add(new IndexJump(this, "Loop")); + + Add(new Index(this, "Failure")); + Add(new SoundEffect(this, Sound.NOTE_BASS_GUITAR, 2f, 2f)); + Add(new EndTutorial(this)); + + Add(new Index(this, "Proximity")); + Add(new Complete(this)); + } + + @EventHandler + public void UpdateProximity(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_done) + return; + + if (UtilTime.elapsed(_timer, 60000)) + { + IndexJump("Failure"); + _done = true; + } + + if (UtilMath.offset(GetPlayer().getLocation(), Manager.secSpider) < 2) + { + IndexJump("Proximity"); + _done = true; + } + } + + @Override + public Part GetNext() + { + return new Q03_Spider(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/q_secret/Q03_Spider.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/q_secret/Q03_Spider.java new file mode 100644 index 000000000..eae98f874 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/q_secret/Q03_Spider.java @@ -0,0 +1,76 @@ +package nautilus.game.tutorial.part.q_secret; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class Q03_Spider extends Part +{ + private long _timer = 0; + private boolean _done = false; + + public Q03_Spider(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + _timer = System.currentTimeMillis(); + } + + @Override + public void CreateActions() + { + Add(new SoundEffect(this, Sound.SPIDER_IDLE, 5f, 1f)); + Add(new Pause(this, 500)); + Add(new SoundEffect(this, Sound.SPIDER_IDLE, 5f, 1f)); + Add(new Pause(this, 500)); + Add(new SoundEffect(this, Sound.SPIDER_IDLE, 5f, 1f)); + Add(new Pause(this, 1000)); + Add(new SoundEffect(this, Sound.NOTE_PLING, 2f, 2f)); + + Add(new Index(this, "Loop")); + Add(new IndexJump(this, "Loop")); + + Add(new Index(this, "Failure")); + Add(new SoundEffect(this, Sound.NOTE_BASS_GUITAR, 2f, 2f)); + Add(new EndTutorial(this)); + + Add(new Index(this, "Proximity")); + Add(new Complete(this)); + } + + @EventHandler + public void UpdateProximity(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_done) + return; + + if (UtilTime.elapsed(_timer, 60000)) + { + IndexJump("Failure"); + _done = true; + } + + if (UtilMath.offset(GetPlayer().getLocation(), Manager.secChick) < 2) + { + IndexJump("Proximity"); + _done = true; + } + } + + @Override + public Part GetNext() + { + return new Q04_Chicken(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/q_secret/Q04_Chicken.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/q_secret/Q04_Chicken.java new file mode 100644 index 000000000..8c13d157b --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/q_secret/Q04_Chicken.java @@ -0,0 +1,76 @@ +package nautilus.game.tutorial.part.q_secret; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class Q04_Chicken extends Part +{ + private long _timer = 0; + private boolean _done = false; + + public Q04_Chicken(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + _timer = System.currentTimeMillis(); + } + + @Override + public void CreateActions() + { + Add(new SoundEffect(this, Sound.CHICKEN_IDLE, 5f, 1f)); + Add(new Pause(this, 500)); + Add(new SoundEffect(this, Sound.CHICKEN_IDLE, 5f, 1f)); + Add(new Pause(this, 500)); + Add(new SoundEffect(this, Sound.CHICKEN_IDLE, 5f, 1f)); + Add(new Pause(this, 1000)); + Add(new SoundEffect(this, Sound.NOTE_PLING, 2f, 2f)); + + Add(new Index(this, "Loop")); + Add(new IndexJump(this, "Loop")); + + Add(new Index(this, "Failure")); + Add(new SoundEffect(this, Sound.NOTE_BASS_GUITAR, 2f, 2f)); + Add(new EndTutorial(this)); + + Add(new Index(this, "Proximity")); + Add(new Complete(this)); + } + + @EventHandler + public void UpdateProximity(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_done) + return; + + if (UtilTime.elapsed(_timer, 60000)) + { + IndexJump("Failure"); + _done = true; + } + + if (UtilMath.offset(GetPlayer().getLocation(), Manager.secPortal) < 0.5) + { + IndexJump("Proximity"); + _done = true; + } + } + + @Override + public Part GetNext() + { + return new Q05_Catherine(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/q_secret/Q05_Catherine.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/q_secret/Q05_Catherine.java new file mode 100644 index 000000000..ff9d8ef2d --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/q_secret/Q05_Catherine.java @@ -0,0 +1,92 @@ +package nautilus.game.tutorial.part.q_secret; + +import org.bukkit.EntityEffect; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class Q05_Catherine extends Part +{ + private boolean _done = false; + + public Q05_Catherine(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new SoundEffect(this, Sound.NOTE_PLING, 2f, 2f)); + Add(new Pause(this, 1000)); + Add(new SoundEffect(this, Sound.ZOMBIE_UNFECT, 2f, 2f)); + Add(new Teleport(this, Manager.spawnB)); + + Add(new Index(this, "Loop")); + Add(new IndexJump(this, "Loop")); + + Add(new Index(this, "Proximity")); + + Add(new SoundEffect(this, Sound.GHAST_SCREAM, 0.4f, 0.4f)); + Add(new SoundEffect(this, Sound.GHAST_SCREAM, 0.4f, 0.5f)); + Add(new SoundEffect(this, Sound.GHAST_SCREAM, 0.4f, 0.6f)); + Add(new SoundEffect(this, Sound.GHAST_SCREAM, 0.4f, 0.7f)); + Add(new SoundEffect(this, Sound.GHAST_SCREAM, 0.4f, 0.8f)); + Add(new SoundEffect(this, Sound.GHAST_SCREAM, 0.4f, 0.9f)); + Add(new SoundEffect(this, Sound.GHAST_SCREAM, 0.4f, 1.0f)); + Add(new SoundEffect(this, Sound.GHAST_SCREAM, 0.4f, 1.2f)); + Add(new SoundEffect(this, Sound.GHAST_SCREAM, 0.4f, 1.3f)); + Add(new SoundEffect(this, Sound.GHAST_SCREAM, 0.4f, 1.4f)); + Add(new SoundEffect(this, Sound.GHAST_SCREAM, 0.4f, 1.5f)); + Add(new SoundEffect(this, Sound.GHAST_SCREAM, 0.4f, 1.6f)); + Add(new SoundEffect(this, Sound.GHAST_SCREAM, 0.4f, 1.7f)); + Add(new SoundEffect(this, Sound.GHAST_SCREAM, 0.4f, 1.8f)); + Add(new SoundEffect(this, Sound.GHAST_SCREAM, 0.4f, 1.9f)); + Add(new SoundEffect(this, Sound.GHAST_SCREAM, 0.4f, 2.0f)); + + Add(new AllowAction(this, true)); + } + + @EventHandler + public void UpdateProximity(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (AllowAction()) + { + UtilPlayer.kick(GetPlayer(), "Catherine", "..."); + } + + if (_done) + { + GetPlayer().playEffect(EntityEffect.HURT); + return; + } + + + if (UtilMath.offset(GetPlayer().getLocation(), Manager.secCat) < 6) + { + for (int i=0 ; i<20 ; i++) + GetPlayer().playSound(GetPlayer().getLocation(), Sound.ENDERDRAGON_DEATH, 1f, 1f); + + IndexJump("Proximity"); + _done = true; + } + } + + @Override + public Part GetNext() + { + return null; + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z01_Introduction.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z01_Introduction.java new file mode 100644 index 000000000..39ab36e43 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z01_Introduction.java @@ -0,0 +1,84 @@ +package nautilus.game.tutorial.part.z_domination; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class Z01_Introduction extends Part +{ + private boolean _prox = false; + + public Z01_Introduction(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Dialogue(this, "Hello.")); + Add(new Dialogue(this, "Let's learn about " + F.te("Domination") + "!")); + + Add(new Index(this, "Search")); + + Add(new Dialogue(this, "Let's start by heading over to " + F.te("Domination Island") + ".")); + Add(new ForceLook(this, Manager.domIsland, 0)); + Add(new AllowAction(this, true)); + + Add(new Pause(this, 20000)); + Add(new Dialogue(this, Dialogue.restartMessages)); + Add(new IndexJump(this, "Search")); + + Add(new Index(this, "Proximity")); + + Add(new Dialogue(this, "Great!")); + Add(new Dialogue(this, F.te("Domination") + " is a competitve 5v5 game!")); + + Add(new Pause(this, 1000)); + + Add(new Dialogue(this, "It uses " + F.te("Classes") + " and " + F.te("Skills") + ".")); + Add(new Dialogue(this, "You can choose your " + F.te("Class Build") + " at your teams base.")); + + Add(new Pause(this, 1000)); + + Add(new Dialogue(this, "The goal is to get " + F.ta("15000 Score") + " before the enemy team.")); + Add(new Dialogue(this, "You can receive " + F.ta("Score") + " in a number of ways...")); + Add(new Dialogue(this, "When you kill someone, your team receives " + F.ta("25 Score") + ".")); + + Add(new Complete(this)); + } + + @EventHandler + public void UpdateProximity(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!AllowAction()) + return; + + if (_prox) + return; + + if (UtilMath.offset(GetPlayer().getLocation(), Manager.domIsland) < 15) + { + IndexJump("Proximity"); + _prox = true; + } + } + + + @Override + public Part GetNext() + { + return new Z02_CapturePoints(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z02_CapturePoints.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z02_CapturePoints.java new file mode 100644 index 000000000..f81a4d193 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z02_CapturePoints.java @@ -0,0 +1,84 @@ +package nautilus.game.tutorial.part.z_domination; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class Z02_CapturePoints extends Part +{ + private boolean _prox = false; + + public Z02_CapturePoints(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Dialogue(this, "However, the best way " + F.ta("Score") + " is " + F.te("Control Points") + ".")); + Add(new Dialogue(this, "Every map has a number of " + F.te("Control Points") + " around it.")); + Add(new Dialogue(this, "You can easily see where they are, by the " + F.te("Beacon Signal") + ".")); + Add(new Dialogue(this, "For each " + F.te("Control Points") + " your team controls,")); + Add(new Dialogue(this, "you receive " + F.ta("5 Score") + " per second.")); + + Add(new Index(this, "Search")); + + Add(new Dialogue(this, "There is an example " + F.te("Control Point") + " over here.")); + Add(new ForceLook(this, Manager.domCP, 0)); + Add(new Dialogue(this, "Move onto it now.")); + Add(new AllowAction(this, true)); + + Add(new Pause(this, 20000)); + Add(new Dialogue(this, Dialogue.restartMessages)); + Add(new IndexJump(this, "Search")); + + Add(new Index(this, "Proximity")); + + Add(new Dialogue(this, "When you stand on a " + F.te("Control Point") + ", you capture it for your team.")); + Add(new Dialogue(this, "It takes a short time for it to convert to your team.")); + Add(new Dialogue(this, "Once it turns your teams color, it has been captured!")); + Add(new Dialogue(this, "After that, you can leave the " + F.te("Control Point") + ".")); + + Add(new Pause(this, 2000)); + + Add(new Dialogue(this, "Defending a " + F.te("Control Point") + " grants extra " + F.ta("1 Score") + " per second.")); + Add(new Dialogue(this, "To defend, just stay on a " + F.te("Control Point") + " you already own.")); + + Add(new Complete(this)); + } + + @EventHandler + public void UpdateProximity(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!AllowAction()) + return; + + if (_prox) + return; + + if (UtilMath.offset(GetPlayer().getLocation(), Manager.domCP) < 3) + { + IndexJump("Proximity"); + _prox = true; + } + } + + + @Override + public Part GetNext() + { + return new Z03_Emerald(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z03_Emerald.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z03_Emerald.java new file mode 100644 index 000000000..30ac81969 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z03_Emerald.java @@ -0,0 +1,79 @@ +package nautilus.game.tutorial.part.z_domination; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class Z03_Emerald extends Part +{ + private boolean _prox = false; + + public Z03_Emerald(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Dialogue(this, "The last way to get " + F.ta("Score") + " is " + F.te("Score Powerups") + ".")); + Add(new Dialogue(this, "Around each map, there are " + F.te("Score Powerups") + ".")); + Add(new Dialogue(this, "If you collect one, your team receives " + F.ta("200 Score") + ".")); + + Add(new Index(this, "Search")); + + Add(new Dialogue(this, "There is an example " + F.te("Score Powerup") + " nearby.")); + Add(new ForceLook(this, Manager.domEmerald, 0)); + Add(new Dialogue(this, "Go get it!")); + Add(new AllowAction(this, true)); + + Add(new Pause(this, 20000)); + Add(new Dialogue(this, Dialogue.restartMessages)); + Add(new IndexJump(this, "Search")); + + Add(new Index(this, "Proximity")); + + Add(new Dialogue(this, "After being collected, it takes " + F.ta("1 Minute") + " to regenerate.")); + + Add(new Pause(this, 1000)); + + Add(new Dialogue(this, "While regenerating, the " + F.te("Emerald Block") + " changes to " + F.te("Iron Block") + ".")); + Add(new Dialogue(this, "Use this to tell if its regenerating from a long distance.")); + + Add(new Complete(this)); + } + + @EventHandler + public void UpdateProximity(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!AllowAction()) + return; + + if (_prox) + return; + + if (UtilMath.offset(GetPlayer().getLocation(), Manager.domEmerald) < 2) + { + IndexJump("Proximity"); + _prox = true; + } + } + + + @Override + public Part GetNext() + { + return new Z04_Resupply(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z04_Resupply.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z04_Resupply.java new file mode 100644 index 000000000..8868b23e2 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z04_Resupply.java @@ -0,0 +1,78 @@ +package nautilus.game.tutorial.part.z_domination; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class Z04_Resupply extends Part +{ + private boolean _prox = false; + + public Z04_Resupply(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + Add(new Dialogue(this, "Another " + F.te("Powerup") + " is " + F.te("Resupply Powerups") + ".")); + Add(new Dialogue(this, "When you collect one, it replenishes your " + F.te("Class Build") + ".")); + Add(new Dialogue(this, "So if you run out of arrows, you can just resupply!")); + + Add(new Index(this, "Search")); + + Add(new Dialogue(this, "An example " + F.te("Resupply Powerup") + " is just over here.")); + Add(new ForceLook(this, Manager.domResupply, 0)); + Add(new Dialogue(this, "Head to it, but be careful not to fall!")); + Add(new AllowAction(this, true)); + + Add(new Pause(this, 20000)); + Add(new Dialogue(this, Dialogue.restartMessages)); + Add(new IndexJump(this, "Search")); + + Add(new Index(this, "Proximity")); + + Add(new Dialogue(this, "After being collected, it takes " + F.ta("1 Minute") + " to regenerate.")); + + Add(new Pause(this, 1000)); + + Add(new Dialogue(this, "While regenerating, the " + F.te("Gold Block") + " changes to " + F.te("Iron Block") + ".")); + Add(new Dialogue(this, "Use this to tell if its regenerating from a long distance.")); + + Add(new Complete(this)); + } + + @EventHandler + public void UpdateProximity(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!AllowAction()) + return; + + if (_prox) + return; + + if (UtilMath.offset(GetPlayer().getLocation(), Manager.domResupply) < 2) + { + IndexJump("Proximity"); + _prox = true; + } + } + + @Override + public Part GetNext() + { + return new Z99_Conclusion(Manager, Data, GetPlayer()); + } +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z05_Join.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z05_Join.java new file mode 100644 index 000000000..d48ac38c6 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z05_Join.java @@ -0,0 +1,6 @@ +package nautilus.game.tutorial.part.z_domination; + +public class Z05_Join +{ + +} diff --git a/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z99_Conclusion.java b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z99_Conclusion.java new file mode 100644 index 000000000..36c667b89 --- /dev/null +++ b/Plugins/Nautilus.Game.Tutorial/src/nautilus/game/tutorial/part/z_domination/Z99_Conclusion.java @@ -0,0 +1,33 @@ +package nautilus.game.tutorial.part.z_domination; + +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import nautilus.game.tutorial.TutorialData; +import nautilus.game.tutorial.TutorialManager; +import nautilus.game.tutorial.action.types.*; +import nautilus.game.tutorial.part.Part; + +public class Z99_Conclusion extends Part +{ + public Z99_Conclusion(TutorialManager manager, TutorialData data, Player player) + { + super(manager, data, player); + } + + @Override + public void CreateActions() + { + //Intro + Add(new Dialogue(this, "You can play " + F.te("Domination") + " now, at " + F.te("dom.BetterMC.com") + "!")); + Add(new Dialogue(this, "Good luck, and may you win all of the games!")); + + Add(new CompleteTutorial(this)); + } + + @Override + public Part GetNext() + { + return null; + } +} diff --git a/TestApps/LOCTester/AccountRepo.cs b/TestApps/LOCTester/AccountRepo.cs new file mode 100644 index 000000000..d7118c692 --- /dev/null +++ b/TestApps/LOCTester/AccountRepo.cs @@ -0,0 +1,49 @@ +using LOC.Core.Tokens.Client; + +namespace LOCTester +{ + using System; + using LOC.Core.Data; + using LOC.Core.Model.Account; + using LOC.Core.Model.GameServer; + using LOC.Core.Tokens; + + public class AccountRepo + { + private readonly IRestCallJsonWrapper _restCallWrapper; + + public AccountRepo(IRestCallJsonWrapper restCallWrapper) + { + _restCallWrapper = restCallWrapper; + } + + public void Test(string server) + { + _restCallWrapper.MakeCall("test", new Uri(server), RestCallType.Post, 300); + } + + public void TestNoArg(string server) + { + _restCallWrapper.MakeCall("", new Uri(server), RestCallType.Post, 300); + } + + public void TestNoArgNoResult(string server) + { + _restCallWrapper.MakeCall("", new Uri(server), RestCallType.Post, 300); + } + + public ClientToken GetAccountByName(string name, string server) + { + var loginToken = new LoginRequestToken { IpAddress = "127.0.0.1", Name = name, Server = new Server { ConnectionAddress = "localhost:25565" } }; + var uri = new Uri(server + "/PlayerAccount/Login"); + var result = _restCallWrapper.MakeCall(loginToken, uri, RestCallType.Post, 300); + return result; + } + + public void BanAccount(Punishment ban) + { + var uri = new Uri("http://localhost:53885" + "/PlayerAccount/Ban"); + var result = _restCallWrapper.MakeCall(ban, uri, RestCallType.Post, 300); + } + } +} diff --git a/TestApps/LOCTester/AdminClientConfigurationSection.cs b/TestApps/LOCTester/AdminClientConfigurationSection.cs new file mode 100644 index 000000000..b78e7b291 --- /dev/null +++ b/TestApps/LOCTester/AdminClientConfigurationSection.cs @@ -0,0 +1,15 @@ +namespace LOCTester +{ + using System.Configuration; + + class AdminClientConfigurationSection : ConfigurationSection + { + private const string BASE_SERVICE_URI_PROPERTY_NAME = "baseServiceUri"; + + [ConfigurationProperty(BASE_SERVICE_URI_PROPERTY_NAME, IsRequired = false, DefaultValue = "http://localhost:6969")] + public string BaseServiceUri + { + get { return (string)this[BASE_SERVICE_URI_PROPERTY_NAME]; } + } + } +} diff --git a/TestApps/LOCTester/CurrentConfig.cs b/TestApps/LOCTester/CurrentConfig.cs new file mode 100644 index 000000000..ba04f12e2 --- /dev/null +++ b/TestApps/LOCTester/CurrentConfig.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace LOCTester +{ + using System.Configuration; + + public class CurrentConfig : ICurrentConfig + { + private readonly Configuration _configuration; + + public CurrentConfig() + { + _configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); + + var section = (AdminClientConfigurationSection)_configuration.GetSection("adminClientConfigurationSection"); + if (section == null) + throw new ConfigurationErrorsException("Can't find the adminClientConfigurationSection in the configuration file."); + + BaseServiceUri = section.BaseServiceUri; + } + + public string BaseServiceUri { get; private set; } + + public int MachineNumber { get; private set; } + + public string MachineSerial { get; private set; } + + public string DomainName { get; private set; } + } +} diff --git a/TestApps/LOCTester/Form1.Designer.cs b/TestApps/LOCTester/Form1.Designer.cs new file mode 100644 index 000000000..b70c403d1 --- /dev/null +++ b/TestApps/LOCTester/Form1.Designer.cs @@ -0,0 +1,390 @@ +namespace LOCTester +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.txtAdmin = new System.Windows.Forms.TextBox(); + this.txtUser = new System.Windows.Forms.TextBox(); + this.txtDetails = new System.Windows.Forms.TextBox(); + this.txtReason = new System.Windows.Forms.TextBox(); + this.button2 = new System.Windows.Forms.Button(); + this.txtAccountLookup = new System.Windows.Forms.TextBox(); + this.lblBanned = new System.Windows.Forms.Label(); + this.lblBanMessage = new System.Windows.Forms.Label(); + this.txtKillerName = new System.Windows.Forms.TextBox(); + this.btnSubmitStats = new System.Windows.Forms.Button(); + this.txtVictimName = new System.Windows.Forms.TextBox(); + this.txtGamePlayerCount = new System.Windows.Forms.TextBox(); + this.txtGameLength = new System.Windows.Forms.TextBox(); + this.txtGameStarted = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.cmbVictimClass = new System.Windows.Forms.ComboBox(); + this.cmbKillerClass = new System.Windows.Forms.ComboBox(); + this.lblTimeToRetrieve = new System.Windows.Forms.Label(); + this.txtCount = new System.Windows.Forms.TextBox(); + this.txtServer = new System.Windows.Forms.TextBox(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(12, 120); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 0; + this.button1.Text = "Ban"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // txtAdmin + // + this.txtAdmin.Location = new System.Drawing.Point(12, 12); + this.txtAdmin.Name = "txtAdmin"; + this.txtAdmin.Size = new System.Drawing.Size(75, 20); + this.txtAdmin.TabIndex = 1; + // + // txtUser + // + this.txtUser.Location = new System.Drawing.Point(12, 38); + this.txtUser.Name = "txtUser"; + this.txtUser.Size = new System.Drawing.Size(75, 20); + this.txtUser.TabIndex = 3; + // + // txtDetails + // + this.txtDetails.Location = new System.Drawing.Point(12, 90); + this.txtDetails.Name = "txtDetails"; + this.txtDetails.Size = new System.Drawing.Size(75, 20); + this.txtDetails.TabIndex = 4; + // + // txtReason + // + this.txtReason.Location = new System.Drawing.Point(12, 64); + this.txtReason.Name = "txtReason"; + this.txtReason.Size = new System.Drawing.Size(75, 20); + this.txtReason.TabIndex = 5; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(218, 121); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 6; + this.button2.Text = "GetInfo"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // txtAccountLookup + // + this.txtAccountLookup.Location = new System.Drawing.Point(137, 123); + this.txtAccountLookup.Name = "txtAccountLookup"; + this.txtAccountLookup.Size = new System.Drawing.Size(75, 20); + this.txtAccountLookup.TabIndex = 7; + // + // lblBanned + // + this.lblBanned.AutoSize = true; + this.lblBanned.Location = new System.Drawing.Point(133, 38); + this.lblBanned.Name = "lblBanned"; + this.lblBanned.Size = new System.Drawing.Size(54, 13); + this.lblBanned.TabIndex = 8; + this.lblBanned.Text = "lblBanned"; + // + // lblBanMessage + // + this.lblBanMessage.AutoSize = true; + this.lblBanMessage.Location = new System.Drawing.Point(133, 57); + this.lblBanMessage.Name = "lblBanMessage"; + this.lblBanMessage.Size = new System.Drawing.Size(79, 13); + this.lblBanMessage.TabIndex = 9; + this.lblBanMessage.Text = "lblBanMessage"; + // + // txtKillerName + // + this.txtKillerName.Location = new System.Drawing.Point(540, 90); + this.txtKillerName.Name = "txtKillerName"; + this.txtKillerName.Size = new System.Drawing.Size(75, 20); + this.txtKillerName.TabIndex = 10; + // + // btnSubmitStats + // + this.btnSubmitStats.Location = new System.Drawing.Point(540, 194); + this.btnSubmitStats.Name = "btnSubmitStats"; + this.btnSubmitStats.Size = new System.Drawing.Size(75, 23); + this.btnSubmitStats.TabIndex = 11; + this.btnSubmitStats.Text = "Submit Stats"; + this.btnSubmitStats.UseVisualStyleBackColor = true; + // + // txtVictimName + // + this.txtVictimName.Location = new System.Drawing.Point(540, 142); + this.txtVictimName.Name = "txtVictimName"; + this.txtVictimName.Size = new System.Drawing.Size(75, 20); + this.txtVictimName.TabIndex = 13; + // + // txtGamePlayerCount + // + this.txtGamePlayerCount.Location = new System.Drawing.Point(540, 64); + this.txtGamePlayerCount.Name = "txtGamePlayerCount"; + this.txtGamePlayerCount.Size = new System.Drawing.Size(75, 20); + this.txtGamePlayerCount.TabIndex = 15; + // + // txtGameLength + // + this.txtGameLength.Location = new System.Drawing.Point(540, 38); + this.txtGameLength.Name = "txtGameLength"; + this.txtGameLength.Size = new System.Drawing.Size(75, 20); + this.txtGameLength.TabIndex = 16; + // + // txtGameStarted + // + this.txtGameStarted.Location = new System.Drawing.Point(540, 12); + this.txtGameStarted.Name = "txtGameStarted"; + this.txtGameStarted.Size = new System.Drawing.Size(75, 20); + this.txtGameStarted.TabIndex = 17; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(488, 15); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(41, 13); + this.label1.TabIndex = 18; + this.label1.Text = "Started"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(488, 41); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(40, 13); + this.label2.TabIndex = 19; + this.label2.Text = "Length"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(461, 67); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(67, 13); + this.label3.TabIndex = 20; + this.label3.Text = "Player Count"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(488, 93); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(29, 13); + this.label4.TabIndex = 21; + this.label4.Text = "Killer"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(488, 123); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(32, 13); + this.label5.TabIndex = 22; + this.label5.Text = "Class"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(488, 149); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(35, 13); + this.label6.TabIndex = 23; + this.label6.Text = "Victim"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(488, 175); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(32, 13); + this.label7.TabIndex = 24; + this.label7.Text = "Class"; + // + // cmbVictimClass + // + this.cmbVictimClass.FormattingEnabled = true; + this.cmbVictimClass.Location = new System.Drawing.Point(540, 167); + this.cmbVictimClass.Name = "cmbVictimClass"; + this.cmbVictimClass.Size = new System.Drawing.Size(75, 21); + this.cmbVictimClass.TabIndex = 25; + // + // cmbKillerClass + // + this.cmbKillerClass.FormattingEnabled = true; + this.cmbKillerClass.Location = new System.Drawing.Point(540, 116); + this.cmbKillerClass.Name = "cmbKillerClass"; + this.cmbKillerClass.Size = new System.Drawing.Size(75, 21); + this.cmbKillerClass.TabIndex = 26; + // + // lblTimeToRetrieve + // + this.lblTimeToRetrieve.AutoSize = true; + this.lblTimeToRetrieve.Location = new System.Drawing.Point(133, 204); + this.lblTimeToRetrieve.Name = "lblTimeToRetrieve"; + this.lblTimeToRetrieve.Size = new System.Drawing.Size(95, 13); + this.lblTimeToRetrieve.TabIndex = 27; + this.lblTimeToRetrieve.Text = "Time To Retrieve :"; + this.lblTimeToRetrieve.Click += new System.EventHandler(this.label8_Click); + // + // txtCount + // + this.txtCount.Location = new System.Drawing.Point(136, 172); + this.txtCount.Name = "txtCount"; + this.txtCount.Size = new System.Drawing.Size(30, 20); + this.txtCount.TabIndex = 28; + // + // txtServer + // + this.txtServer.Location = new System.Drawing.Point(137, 148); + this.txtServer.Name = "txtServer"; + this.txtServer.Size = new System.Drawing.Size(75, 20); + this.txtServer.TabIndex = 29; + this.txtServer.Text = "http://"; + // + // button3 + // + this.button3.Location = new System.Drawing.Point(172, 170); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(40, 23); + this.button3.TabIndex = 30; + this.button3.Text = "Test"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button4 + // + this.button4.Location = new System.Drawing.Point(218, 170); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(74, 23); + this.button4.TabIndex = 31; + this.button4.Text = "TestNoArg"; + this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // button5 + // + this.button5.Location = new System.Drawing.Point(298, 170); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(111, 23); + this.button5.TabIndex = 32; + this.button5.Text = "TestNoArgNoResult"; + this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.button5_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(756, 262); + this.Controls.Add(this.button5); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.txtServer); + this.Controls.Add(this.txtCount); + this.Controls.Add(this.lblTimeToRetrieve); + this.Controls.Add(this.cmbKillerClass); + this.Controls.Add(this.cmbVictimClass); + this.Controls.Add(this.label7); + this.Controls.Add(this.label6); + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.txtGameStarted); + this.Controls.Add(this.txtGameLength); + this.Controls.Add(this.txtGamePlayerCount); + this.Controls.Add(this.txtVictimName); + this.Controls.Add(this.btnSubmitStats); + this.Controls.Add(this.txtKillerName); + this.Controls.Add(this.lblBanMessage); + this.Controls.Add(this.lblBanned); + this.Controls.Add(this.txtAccountLookup); + this.Controls.Add(this.button2); + this.Controls.Add(this.txtReason); + this.Controls.Add(this.txtDetails); + this.Controls.Add(this.txtUser); + this.Controls.Add(this.txtAdmin); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.TextBox txtAdmin; + private System.Windows.Forms.TextBox txtUser; + private System.Windows.Forms.TextBox txtDetails; + private System.Windows.Forms.TextBox txtReason; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.TextBox txtAccountLookup; + private System.Windows.Forms.Label lblBanned; + private System.Windows.Forms.Label lblBanMessage; + private System.Windows.Forms.TextBox txtKillerName; + private System.Windows.Forms.Button btnSubmitStats; + private System.Windows.Forms.TextBox txtVictimName; + private System.Windows.Forms.TextBox txtGamePlayerCount; + private System.Windows.Forms.TextBox txtGameLength; + private System.Windows.Forms.TextBox txtGameStarted; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.ComboBox cmbVictimClass; + private System.Windows.Forms.ComboBox cmbKillerClass; + private System.Windows.Forms.Label lblTimeToRetrieve; + private System.Windows.Forms.TextBox txtCount; + private System.Windows.Forms.TextBox txtServer; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button5; + } +} + diff --git a/TestApps/LOCTester/Form1.cs b/TestApps/LOCTester/Form1.cs new file mode 100644 index 000000000..2733782ed --- /dev/null +++ b/TestApps/LOCTester/Form1.cs @@ -0,0 +1,156 @@ +namespace LOCTester +{ + using System; + using System.Collections.Generic; + using System.Threading; + using System.Windows.Forms; + using LOC.Core; + using LOC.Core.DependencyResolution; + using LOC.Core.Model.Account; + using LOC.Core.Tokens; + + public partial class Form1 : Form + { + private AccountRepo _accountRepo; + private int _totalLoadTime; + private int _maxThreadCount; + private int _threadCount; + + public Form1() + { + InitializeComponent(); + _accountRepo = Resolver.Current.GetService(); + } + + private void button1_Click(object sender, EventArgs e) + { + + var ban = new Punishment(); + ban.PunishmentId = -1; + ban.Reason = txtReason.Text; + + _accountRepo.BanAccount(ban); + } + + private void button2_Click(object sender, EventArgs e) + { + _totalLoadTime = 0; + _threadCount = 0; + ThreadStart work = Login; + _maxThreadCount = int.Parse(txtCount.Text); + + for (int i = 0; i < _maxThreadCount; i++) + { + Thread thread = new Thread(work); + thread.Start(); + } + } + + private void Login() + { + int time = Environment.TickCount; + var account = _accountRepo.GetAccountByName(txtAccountLookup.Text, txtServer.Text); + + _totalLoadTime += Environment.TickCount - time; + _threadCount++; + + CheckCount(); + } + + private void Test() + { + int time = Environment.TickCount; + _accountRepo.Test(txtServer.Text + "/PlayerAccount/Test"); + + _totalLoadTime += Environment.TickCount - time; + _threadCount++; + + CheckCount(); + } + + private void TestNoArg() + { + int time = Environment.TickCount; + _accountRepo.TestNoArg(txtServer.Text + "/PlayerAccount/TestNoArg"); + + _totalLoadTime += Environment.TickCount - time; + _threadCount++; + + CheckCount(); + } + + private void TestNoArgNoResult() + { + int time = Environment.TickCount; + _accountRepo.TestNoArgNoResult(txtServer.Text + "/PlayerAccount/TestNoArgNoReturn"); + + _totalLoadTime += Environment.TickCount - time; + _threadCount++; + + CheckCount(); + } + + private void CheckCount() + { + if (_threadCount == _maxThreadCount) + { + if (lblTimeToRetrieve.InvokeRequired) + lblTimeToRetrieve.Invoke(new Action(() => + { lblTimeToRetrieve.Text = (_totalLoadTime/_threadCount) + "ms on average for each call"; })); + } + } + + private void label8_Click(object sender, EventArgs e) + { + + } + + private void button3_Click(object sender, EventArgs e) + { + lblTimeToRetrieve.Text = "Testing..."; + + _totalLoadTime = 0; + _threadCount = 0; + ThreadStart work = Test; + _maxThreadCount = int.Parse(txtCount.Text); + + for (int i = 0; i < _maxThreadCount; i++) + { + Thread thread = new Thread(work); + thread.Start(); + } + } + + private void button4_Click(object sender, EventArgs e) + { + lblTimeToRetrieve.Text = "Testing..."; + + _totalLoadTime = 0; + _threadCount = 0; + ThreadStart work = TestNoArg; + _maxThreadCount = int.Parse(txtCount.Text); + + for (int i = 0; i < _maxThreadCount; i++) + { + Thread thread = new Thread(work); + thread.Start(); + } + } + + private void button5_Click(object sender, EventArgs e) + { + lblTimeToRetrieve.Text = "Testing..."; + + _totalLoadTime = 0; + _threadCount = 0; + ThreadStart work = TestNoArgNoResult; + _maxThreadCount = int.Parse(txtCount.Text); + + for (int i = 0; i < _maxThreadCount; i++) + { + Thread thread = new Thread(work); + thread.Start(); + } + } + } +} diff --git a/TestApps/LOCTester/Form1.resx b/TestApps/LOCTester/Form1.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TestApps/LOCTester/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TestApps/LOCTester/ICurrentConfig.cs b/TestApps/LOCTester/ICurrentConfig.cs new file mode 100644 index 000000000..19fd2875e --- /dev/null +++ b/TestApps/LOCTester/ICurrentConfig.cs @@ -0,0 +1,7 @@ +namespace LOCTester +{ + public interface ICurrentConfig + { + string BaseServiceUri { get; } + } +} diff --git a/TestApps/LOCTester/LOCTester.csproj b/TestApps/LOCTester/LOCTester.csproj new file mode 100644 index 000000000..57f78a8ab --- /dev/null +++ b/TestApps/LOCTester/LOCTester.csproj @@ -0,0 +1,101 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {418496EF-36D6-4AE0-B48F-393D45E124CA} + WinExe + Properties + LOCTester + LOCTester + v4.0 + + + 512 + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {A994B28E-8AAA-4A53-BDFE-0E72F1B0F4AD} + LOC.Core + + + + + \ No newline at end of file diff --git a/TestApps/LOCTester/Program.cs b/TestApps/LOCTester/Program.cs new file mode 100644 index 000000000..62cd4c3dd --- /dev/null +++ b/TestApps/LOCTester/Program.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +namespace LOCTester +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/TestApps/LOCTester/Properties/AssemblyInfo.cs b/TestApps/LOCTester/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..4964740d5 --- /dev/null +++ b/TestApps/LOCTester/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("LOCTester")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Windows User")] +[assembly: AssemblyProduct("LOCTester")] +[assembly: AssemblyCopyright("Copyright © Windows User 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ec5c36aa-8a7e-4c77-9b05-30c6094ea9ee")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/TestApps/LOCTester/Properties/Resources.Designer.cs b/TestApps/LOCTester/Properties/Resources.Designer.cs new file mode 100644 index 000000000..82fcd0939 --- /dev/null +++ b/TestApps/LOCTester/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.269 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace LOCTester.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LOCTester.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/TestApps/LOCTester/Properties/Resources.resx b/TestApps/LOCTester/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/TestApps/LOCTester/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TestApps/LOCTester/Properties/Settings.Designer.cs b/TestApps/LOCTester/Properties/Settings.Designer.cs new file mode 100644 index 000000000..fbc537ae5 --- /dev/null +++ b/TestApps/LOCTester/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.269 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace LOCTester.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/TestApps/LOCTester/Properties/Settings.settings b/TestApps/LOCTester/Properties/Settings.settings new file mode 100644 index 000000000..39645652a --- /dev/null +++ b/TestApps/LOCTester/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/TestApps/LOCTester/app.config b/TestApps/LOCTester/app.config new file mode 100644 index 000000000..2bd078d0c --- /dev/null +++ b/TestApps/LOCTester/app.config @@ -0,0 +1,18 @@ + + + + +
+ + + + + + \ No newline at end of file diff --git a/TestApps/LOCTester/bin/Debug/EntityFramework.dll b/TestApps/LOCTester/bin/Debug/EntityFramework.dll new file mode 100644 index 000000000..8caef36ac Binary files /dev/null and b/TestApps/LOCTester/bin/Debug/EntityFramework.dll differ diff --git a/TestApps/LOCTester/bin/Debug/EntityFramework.xml b/TestApps/LOCTester/bin/Debug/EntityFramework.xml new file mode 100644 index 000000000..4057d68a4 --- /dev/null +++ b/TestApps/LOCTester/bin/Debug/EntityFramework.xml @@ -0,0 +1,18061 @@ + + + + EntityFramework + + + + + Specifies the database column that a property is mapped to. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The name of the column the property is mapped to. + + + + The name of the column the property is mapped to. + + + + + The zero-based order of the column the property is mapped to. + + + + + The database provider specific data type of the column the property is mapped to. + + + + + Denotes that the class is a complex type. + Complex types are non-scalar properties of entity types that enable scalar properties to be organized within entities. + Complex types do not have keys and cannot be managed by the Entity Framework apart from the parent object. + + + + + Specifies how the database generates values for a property. + + + + + Initializes a new instance of the class. + + The pattern used to generate values for the property in the database. + + + + The pattern used to generate values for the property in the database. + + + + + The pattern used to generate values for a property in the database. + + + + + The database does not generate values. + + + + + The database generates a value when a row is inserted. + + + + + The database generates a value when a row is inserted or updated. + + + + + Denotes a property used as a foreign key in a relationship. + The annotation may be placed on the foreign key property and specify the associated navigation property name, + or placed on a navigation property and specify the associated foreign key name. + + + + + Initializes a new instance of the class. + + + If placed on a foreign key property, the name of the associated navigation property. + If placed on a navigation property, the name of the associated foreign key(s). + If a navigation property has multiple foreign keys, a comma separated list should be supplied. + + + + + If placed on a foreign key property, the name of the associated navigation property. + If placed on a navigation property, the name of the associated foreign key(s). + + + + + Specifies the inverse of a navigation property that represents the other end of the same relationship. + + + + + Initializes a new instance of the class. + + The navigation property representing the other end of the same relationship. + + + + The navigation property representing the other end of the same relationship. + + + + + Specifies the maximum length of array/string data allowed in a property. + + + + + Initializes a new instance of the class. + + + The maximum allowable length of array/string data. + Value must be greater than zero. + + + + + Initializes a new instance of the class. + The maximum allowable length supported by the database will be used. + + + + + Determines whether a specified object is valid. (Overrides ) + + + This method returns true if the is null. + It is assumed the is used if the value may not be null. + + The object to validate. + true if the value is null or less than or equal to the specified maximum length, otherwise false + Length is zero or less than negative one. + + + + Applies formatting to a specified error message. (Overrides ) + + The name to include in the formatted string. + A localized string to describe the maximum acceptable length. + + + + Checks that Length has a legal value. Throws InvalidOperationException if not. + + + + + Gets the maximum allowable length of the array/string data. + + + + + Specifies the minimum length of array/string data allowed in a property. + + + + + Initializes a new instance of the class. + + + The minimum allowable length of array/string data. + Value must be greater than or equal to zero. + + + + + Determines whether a specified object is valid. (Overrides ) + + + This method returns true if the is null. + It is assumed the is used if the value may not be null. + + The object to validate. + true if the value is null or greater than or equal to the specified minimum length, otherwise false + Length is less than zero. + + + + Applies formatting to a specified error message. (Overrides ) + + The name to include in the formatted string. + A localized string to describe the minimum acceptable length. + + + + Checks that Length has a legal value. Throws InvalidOperationException if not. + + + + + Gets the minimum allowable length of the array/string data. + + + + + Denotes that a property or class should be excluded from database mapping. + + + + + Specifies the database table that a class is mapped to. + + + + + Initializes a new instance of the class. + + The name of the table the class is mapped to. + + + + The name of the table the class is mapped to. + + + + + The schema of the table the class is mapped to. + + + + + The base for all all Entity Data Model (EDM) types that represent a type from the EDM type system. + + + + + Represents an item in an Entity Data Model (EDM) . + + + + + The base for all all Entity Data Model (EDM) item types that with a Name property that represents a qualified (can be dotted) name. + + + + + The base for all all Entity Data Model (EDM) item types that with a property. + + + + + The base for all all Entity Data Model (EDM) types that support annotation using . + + + + + EdmDataModelItem is the base for all types in the Entity Data Model (EDM) metadata construction and modification API. + + + + + DataModelItem is the base for all types in the EDM metadata reflection, construction and modification API. + + + + + Gets an value indicating which Entity Data Model (EDM) concept is represented by this item. + + + + + IAnnotatedDataModelItem is implemented by model-specific base types for all types with an property. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets or sets the currently assigned annotations. + + + + + Returns all EdmItem children directly contained by this EdmItem. + + + + + INamedDataModelItem is implemented by model-specific base types for all types with a property. + + + + + Gets or sets the currently assigned name. + + + + + Gets or sets the currently assigned name. + + + + + Gets a value indicating whether this type is abstract. + + + + + Gets the optional base type of this type. + + + + + EdmStructuralMember is the base for all types that represent members of structural items in the Entity Data Model (EDM) metadata construction and modification API. + + + + + Represents information about a database connection. + + + + + Creates a new instance of DbConnectionInfo representing a connection that is specified in the application configuration file. + + The name of the connection string in the application configuration. + + + + Creates a new instance of DbConnectionInfo based on a connection string. + + The connection string to use for the connection. + The name of the provider to use for the connection. Use 'System.Data.SqlClient' for SQL Server. + + + + Gets the connection information represented by this instance. + + Configuration to use if connection comes from the configuration file. + + + + Instances of this class are used to create DbConnection objects for + SQL Server LocalDb based on a given database name or connection string. + + + An instance of this class can be set on the class or in the + app.config/web.config for the application to cause all DbContexts created with no + connection information or just a database name to use SQL Server LocalDb by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Implementations of this interface are used to create DbConnection objects for + a type of database server based on a given database name. + An Instance is set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use a certain type of database server by default. + Two implementations of this interface are provided: + is used to create connections to Microsoft SQL Server, including EXPRESS editions. + is used to create connections to Microsoft SQL + Server Compact Editions. + Other implementations for other database servers can be added as needed. + Note that implementations should be thread safe or immutable since they may + be accessed by multiple threads at the same time. + + + + + Creates a connection based on the given database name or connection string. + + The database name or connection string. + An initialized DbConnection. + + + + Creates a new instance of the connection factory for the given version of LocalDb. + For SQL Server 2012 LocalDb use "v11.0". + + The LocalDb version to use. + + + + Creates a new instance of the connection factory for the given version of LocalDb. + For SQL Server 2012 LocalDb use "v11.0". + + + The LocalDb version to use. + + The connection string to use for options to the database other than the 'Initial Catalog', + 'Data Source', and 'AttachDbFilename'. + The 'Initial Catalog' and 'AttachDbFilename' will be prepended to this string based on the + database name when CreateConnection is called. + The 'Data Source' will be set based on the LocalDbVersion argument. + + + + + Creates a connection for SQL Server LocalDb based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + The connection string to use for options to the database other than the 'Initial Catalog', + 'Data Source', and 'AttachDbFilename'. + The 'Initial Catalog' and 'AttachDbFilename' will be prepended to this string based on the + database name when CreateConnection is called. + The 'Data Source' will be set based on the LocalDbVersion argument. + The default is 'Integrated Security=True; MultipleActiveResultSets=True;'. + + + + + Encapsulates a cloned and store . Note that these + objects are disposable and should be used in a using block to ensure both the cloned context and the + cloned connection are disposed. + + + + + For mocking. + + + + + Creates a clone of the given . The underlying of + the context is also cloned and the given connection string is used for the connection string of + the cloned connection. + + + + + Finds the assemblies that were used for loading o-space types in the source context + and loads those assemblies in the cloned context. + + + + + Disposes both the underlying ObjectContext and its store connection. + + + + + The cloned context. + + + + + This is always the store connection of the underlying ObjectContext. + + + + + Represents setting the database initializer for a specific context type + + + + + Represents a parameter to be passed to a method + + + + + Represents a series of parameters to pass to a method + + + + + Adds a new parameter to the collection + Used for unit testing + + + + + Represents the configuration for a series of contexts + + + + + Adds a new context to the collection + Used for unit testing + + + + + Represents the configuration for a specific context type + + + + + Represents setting the default connection factory + + + + + Represents all Entity Framework related configuration + + + + + Handles creating databases either using the core provider or the Migrations pipeline. + + + + + Creates a database using the core provider (i.e. ObjectContext.CreateDatabase) or + by using Code First Migrations to create an empty database + and the perform an automatic migration to the current model. + Migrations is used if Code First is being used and the EF provider is for SQL Server + or SQL Compact. The core is used for non-Code First models and for other providers even + when using Code First. + + + + + A DbContext instance represents a combination of the Unit Of Work and Repository patterns such that + it can be used to query from a database and group together changes that will then be written + back to the store as a unit. + DbContext is conceptually similar to ObjectContext. + + + DbContext is usually used with a derived type that contains properties for + the root entities of the model. These sets are automatically initialized when the + instance of the derived class is created. This behavior can be modified by applying the + attribute to either the entire derived context + class, or to individual properties on the class. + + The Entity Data Model backing the context can be specified in several ways. When using the Code First + approach, the properties on the derived context are used to build a model + by convention. The protected OnModelCreating method can be overridden to tweak this model. More + control over the model used for the Model First approach can be obtained by creating a + explicitly from a and passing this model to one of the DbContext constructors. + + When using the Database First or Model First approach the Entity Data Model can be created using the + Entity Designer (or manually through creation of an EDMX file) and then this model can be specified using + entity connection string or an object. + + The connection to the database (including the name of the database) can be specified in several ways. + If the parameterless DbContext constructor is called from a derived context, then the name of the derived context + is used to find a connection string in the app.config or web.config file. If no connection string is found, then + the name is passed to the DefaultConnectionFactory registered on the class. The connection + factory then uses the context name as the database name in a default connection string. (This default connection + string points to .\SQLEXPRESS on the local machine unless a different DefaultConnectionFactory is registered.) + + Instead of using the derived context name, the connection/database name can also be specified explicitly by + passing the name to one of the DbContext constructors that takes a string. The name can also be passed in + the form "name=myname", in which case the name must be found in the config file or an exception will be thrown. + + Note that the connection found in the app.config or web.config file can be a normal database connection + string (not a special Entity Framework connection string) in which case the DbContext will use Code First. + However, if the connection found in the config file is a special Entity Framework connection string, then the + DbContext will use Database/Model First and the model specified in the connection string will be used. + + An existing or explicitly created DbConnection can also be used instead of the database/connection name. + + A can be applied to a class derived from DbContext to set the + version of conventions used by the context when it creates a model. If no attribute is applied then the + latest version of conventions will be used. + + + + + Interface implemented by objects that can provide an instance. + The class implements this interface to provide access to the underlying + ObjectContext. + + + + + Gets the object context. + + The object context. + + + + Constructs a new context instance using conventions to create the name of the database to + which a connection will be made. The by-convention name is the full name (namespace + class name) + of the derived context class. + See the class remarks for how this is used to create a connection. + + + + + Constructs a new context instance using conventions to create the name of the database to + which a connection will be made, and initializes it from the given model. + The by-convention name is the full name (namespace + class name) of the derived context class. + See the class remarks for how this is used to create a connection. + + The model that will back this context. + + + + Constructs a new context instance using the given string as the name or connection string for the + database to which a connection will be made. + See the class remarks for how this is used to create a connection. + + Either the database name or a connection string. + + + + Constructs a new context instance using the given string as the name or connection string for the + database to which a connection will be made, and initializes it from the given model. + See the class remarks for how this is used to create a connection. + + Either the database name or a connection string. + The model that will back this context. + + + + Constructs a new context instance using the existing connection to connect to a database. + The connection will not be disposed when the context is disposed. + + An existing connection to use for the new context. + If set to true the connection is disposed when + the context is disposed, otherwise the caller must dispose the connection. + + + + Constructs a new context instance using the existing connection to connect to a database, + and initializes it from the given model. + The connection will not be disposed when the context is disposed. + An existing connection to use for the new context. + The model that will back this context. + If set to true the connection is disposed when + the context is disposed, otherwise the caller must dispose the connection. + + + + + Constructs a new context instance around an existing ObjectContext. + An existing ObjectContext to wrap with the new context. + If set to true the ObjectContext is disposed when + the DbContext is disposed, otherwise the caller must dispose the connection. + + + + + Initializes the internal context, discovers and initializes sets, and initializes from a model if one is provided. + + + + + Discovers DbSets and initializes them. + + + + + This method is called when the model for a derived context has been initialized, but + before the model has been locked down and used to initialize the context. The default + implementation of this method does nothing, but it can be overridden in a derived class + such that the model can be further configured before it is locked down. + + + Typically, this method is called only once when the first instance of a derived context + is created. The model for that context is then cached and is for all further instances of + the context in the app domain. This caching can be disabled by setting the ModelCaching + property on the given ModelBuidler, but note that this can seriously degrade performance. + More control over caching is provided through use of the DbModelBuilder and DbContextFactory + classes directly. + + The builder that defines the model for the context being created. + + + + Internal method used to make the call to the real OnModelCreating method. + + The model builder. + + + + Returns a DbSet instance for access to entities of the given type in the context, + the ObjectStateManager, and the underlying store. + + + See the DbSet class for more details. + + The type entity for which a set should be returned. + A set for the given entity type. + + + + Returns a non-generic DbSet instance for access to entities of the given type in the context, + the ObjectStateManager, and the underlying store. + + The type of entity for which a set should be returned. + A set for the given entity type. + + See the DbSet class for more details. + + + + + Saves all changes made in this context to the underlying database. + + The number of objects written to the underlying database. + Thrown if the context has been disposed. + + + + Validates tracked entities and returns a Collection of containing validation results. + + + Collection of validation results for invalid entities. The collection is never null and must not contain null + values or results for valid entities. + + + 1. This method calls DetectChanges() to determine states of the tracked entities unless + DbContextConfiguration.AutoDetectChangesEnabled is set to false. + 2. By default only Added on Modified entities are validated. The user is able to change this behavior + by overriding ShouldValidateEntity method. + + + + + Extension point allowing the user to override the default behavior of validating only + added and modified entities. + + DbEntityEntry instance that is supposed to be validated. + true to proceed with validation. false otherwise. + + + + Extension point allowing the user to customize validation of an entity or filter out validation results. + Called by . + + DbEntityEntry instance to be validated. + User defined dictionary containing additional info for custom validation. + It will be passed to + and will be exposed as . + This parameter is optional and can be null. + Entity validation result. Possibly null when overridden. + + + + Internal method that calls the protected ValidateEntity method. + + DbEntityEntry instance to be validated. + User defined dictionary containing additional info for custom validation. + It will be passed to + and will be exposed as . + This parameter is optional and can be null. + Entity validation result. Possibly null when ValidateEntity is overridden. + + + + Gets a object for the given entity providing access to + information about the entity and the ability to perform actions on the entity. + + The type of the entity. + The entity. + An entry for the entity. + + + + Gets a object for the given entity providing access to + information about the entity and the ability to perform actions on the entity. + + The entity. + An entry for the entity. + + + + Calls the protected Dispose method. + + + + + Disposes the context. The underlying is also disposed if it was created + is by this context or ownership was passed to this context when this context was created. + The connection to the database ( object) is also disposed if it was created + is by this context or ownership was passed to this context when this context was created. + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Creates a Database instance for this context that allows for creation/deletion/existence checks + for the underlying database. + + + + + Returns the Entity Framework ObjectContext that is underlying this context. + + Thrown if the context has been disposed. + + + + Provides access to features of the context that deal with change tracking of entities. + + An object used to access features that deal with change tracking. + + + + Provides access to configuration options for the context. + + An object used to access configuration options. + + + + Provides access to the underlying InternalContext for other parts of the internal design. + + + + + A simple representation of an app.config or web.config file. + + + + + Initializes a new instance of AppConfig based on supplied configuration + + Configuration to load settings from + + + + Initializes a new instance of AppConfig based on supplied connection strings + The default configuration for database initializers and default connection factory will be used + + Connection strings to be used + + + + Initializes a new instance of AppConfig based on the for the AppDomain + + + Use AppConfig.DefaultInstance instead of this constructor + + + + + Appies any database intializers specified in the configuration + + + + + Appies any database intializers specified in the configuration + + + Value indicating if initializers should be re-applied if they have already been applied in this AppDomain + + + + + Gets the specified connection string from the configuration + + Name of the connection string to get + The connection string, or null if there is no connection string with the specified name + + + + Gets the default connection factory based on the configuration + + + + + Gets a singleton instance of configuration based on the for the AppDomain + + + + + Acts as a proxy for that for the most part just passes calls + through to the real object but uses virtual methods/properties such that uses of the object + can be mocked. + + + + + Encapsulates information read from the application config file that specifies a database initializer + and allows that initializer to be dynamically applied. + + + + + Initializes a new instance of the class. + + The key from the entry in the config file. + The value from the enrty in the config file. + + + + Uses the context type and initializer type specified in the config to create an initializer instance + and set it with the DbDbatabase.SetInitializer method. + + + + + Reads all initializers from the application config file and sets them using the Database class. + + + + + Calculates the model hash values used the EdmMetadata table from EF 4.1/4.2. + + + + + Calculates an SHA256 hash of the EDMX from the given code first model. This is the hash stored in + the database in the EdmMetadata table in EF 4.1/4.2. The hash is always calculated using a v2 schema + as was generated by EF 4.1/4.2 and with the entity included in the model. + + + + + Acts as a proxy for that for the most part just passes calls + through to the real object but uses virtual methods/properties such that uses of the object + can be mocked. + + + + + An implementation of that will use Code First Migrations + to update the database to the latest version. + + + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + Initializes a new instance of the MigrateDatabaseToLatestVersion class. + + + + + Initializes a new instance of the MigrateDatabaseToLatestVersion class that will + use a specific connection string from the configuration file to connect to + the database to perform the migration. + + The name of the connection string to use for migration. + + + + + + + Helper class that is used to configure a column. + + + + + Creates a new column definition to store Binary data. + + Value indicating whether or not the column allows null values. + The maximum allowable length of the array data. + Value indicating whether or not all data should be padded to the maximum length. + Value indicating whether or not the maximum length supported by the database provider should be used. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + Value indicating whether or not this column should be configured as a timestamp. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Boolean data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Byte data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store DateTime data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Decimal data. + + Value indicating whether or not the column allows null values. + The numeric precision of the column. + The numeric scale of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + Value indicating whether or not the database will generate values for this column during insert. + The newly constructed column definition. + + + + Creates a new column definition to store Double data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store GUID data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Single data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Short data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Integer data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Long data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store String data. + + Value indicating whether or not the column allows null values. + The maximum allowable length of the string data. + Value indicating whether or not all data should be padded to the maximum length. + Value indicating whether or not the maximum length supported by the database provider should be used. + Value indicating whether or not the column supports Unicode content. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Time data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store DateTimeOffset data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Helper class that is used to further configure a table being created from a CreateTable call on . + + + + + Initializes a new instance of the TableBuilder class. + + The table creation operation to be further configured. + The migration the table is created in. + + + + Specifies a primary key for the table. + + + A lambda expression representing the property to be used as the primary key. + C#: t => t.Id + VB.Net: Function(t) t.Id + + If the primary key is made up of multiple properties then specify an anonymous type including the properties. + C#: t => new { t.Id1, t.Id2 } + VB.Net: Function(t) New With { t.Id1, t.Id2 } + + + The name of the primary key. + If null is supplied, a default name will be generated. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Specifies an index to be created on the table. + + + A lambda expression representing the property to be indexed. + C#: t => t.PropertyOne + VB.Net: Function(t) t.PropertyOne + + If multiple properties are to be indexed then specify an anonymous type including the properties. + C#: t => new { t.PropertyOne, t.PropertyTwo } + VB.Net: Function(t) New With { t.PropertyOne, t.PropertyTwo } + + A value indicating whether or not this is a unique index. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Specifies a foreign key constraint to be created on the table. + + Name of the table that the foreign key constraint targets. + + A lambda expression representing the properties of the foreign key. + C#: t => t.PropertyOne + VB.Net: Function(t) t.PropertyOne + + If multiple properties make up the foreign key then specify an anonymous type including the properties. + C#: t => new { t.PropertyOne, t.PropertyTwo } + VB.Net: Function(t) New With { t.PropertyOne, t.PropertyTwo } + + A value indicating whether or not cascade delete should be configured on the foreign key constraint. + + + The name of this foreign key constraint. + If no name is supplied, a default name will be calculated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Base class for code-based migrations. + + + + + Operations to be performed during the upgrade process. + + + + + Operations to be performed during the downgrade process. + + + + + Adds an operation to create a new table. + + + The columns in this create table operation. + You do not need to specify this type, it will be inferred from the columnsAction parameter you supply. + + The name of the table. Schema name is optional, if no schema is specified then dbo is assumed. + + An action that specifies the columns to be included in the table. + i.e. t => new { Id = t.Int(identity: true), Name = t.String() } + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + An object that allows further configuration of the table creation operation. + + + + Adds an operation to create a new foreign key constraint. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key column. + + The table that contains the column this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The column this foreign key references. + If no value is supplied the primary key of the principal table will be referenced. + + + A value indicating if cascade delete should be configured for the foreign key relationship. + If no value is supplied, cascade delete will be off. + + + The name of the foreign key constraint in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new foreign key constraint. + + + The table that contains the foreign key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key columns. + + The table that contains the columns this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The columns this foreign key references. + If no value is supplied the primary key of the principal table will be referenced. + + + A value indicating if cascade delete should be configured for the foreign key relationship. + If no value is supplied, cascade delete will be off. + + + The name of the foreign key constraint in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on its name. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the foreign key constraint in the database. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on the column it targets. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key column. + + The table that contains the column this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + The columns this foreign key references. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on the columns it targets. + + + The table that contains the foreign key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key columns. + + The table that contains the columns this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + The columns this foreign key references. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a table. + + + The name of the table to be dropped. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to move a table to a new schema. + + + The name of the table to be moved. + Schema name is optional, if no schema is specified then dbo is assumed. + + The schema the table is to be moved to. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to rename a table. To change the schema of a table use MoveTable + + + The name of the table to be renamed. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The new name for the table. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to rename a column. + + + The name of the table that contains the column to be renamed. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be renamed. + The new name for the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to add a column to an existing table. + + + The name of the table to add the column to. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The name of the column to be added. + + + An action that specifies the column to be added. + i.e. c => c.Int(nullable: false, defaultValue: 3) + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing column. + + + The name of the table to drop the column from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to alter the definition of an existing column. + + + The name of the table the column exists in. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be changed. + + An action that specifies the new definition for the column. + i.e. c => c.String(nullable: false, defaultValue: "none") + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new primary key. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The primary key column. + + The name of the primary key in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new primary key based on multiple columns. + + + The table that contains the primary key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The primary key columns. + + The name of the primary key in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing primary key that does not have the default name. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the primary key to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing primary key that was created with the default name. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create an index on a single column. + + + The name of the table to create the index on. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to create the index on. + + A value indicating if this is a unique index. + If no value is supplied a non-unique index will be created. + + + The name to use for the index in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create an index on multiple columns. + + + The name of the table to create the index on. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the columns to create the index on. + + A value indicating if this is a unique index. + If no value is supplied a non-unique index will be created. + + + The name to use for the index in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an index based on its name. + + + The name of the table to drop the index from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the index to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an index based on the columns it targets. + + + The name of the table to drop the index from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column(s) the index targets. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to execute a SQL command. + + The SQL to be executed. + + A value indicating if the SQL should be executed outside of the + transaction being used for the migration process. + If no value is supplied the SQL will be executed within the transaction. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Configuration relating to the use of migrations for a given model. + You will typically create a configuration class that derives + from rather than + using this class. + + + + + Initializes a new instance of the DbMigrationsConfiguration class. + + + + + Adds a new SQL generator to be used for a given database provider. + + Name of the database provider to set the SQL generator for. + The SQL generator to be used. + + + + Gets the SQL generator that is set to be used with a given database provider. + + Name of the database provider to get the SQL generator for. + The SQL generator that is set for the database provider. + + + + Gets or sets a value indicating if automatic migrations can be used when migration the database. + + + + + Gets or sets a value indicating if data loss is acceptable during automatic migration. + If set to false an exception will be thrown if data loss may occur as part of an automatic migration. + + + + + Gets or sets the derived DbContext representing the model to be migrated. + + + + + Gets or sets the namespace used for code-based migrations. + + + + + Gets or sets the sub-directory that code-based migrations are stored in. + + + + + Gets or sets the code generator to be used when scaffolding migrations. + + + + + Gets or sets the assembly containing code-based migrations. + + + + + Gets or sets a value to override the connection of the database to be migrated. + + + + + Gets or sets the timeout value used for the individual commands within a + migration. A null value indicates that the default value of the underlying + provider will be used. + + + + + Configuration relating to the use of migrations for a given model. + + The context representing the model that this configuration applies to. + + + + Initializes a new instance of the DbMigrationsConfiguration class. + + + + + Runs after upgrading to the latest migration to allow seed data to be updated. + + Context to be used for updating seed data. + + + + DbMigrator is used to apply existing migrations to a database. + DbMigrator can be used to upgrade and downgrade to any given migration. + To scaffold migrations based on changes to your model use + + + + + Base class for decorators that wrap the core + + + + + Initializes a new instance of the MigratorBase class. + + The migrator that this decorator is wrapping. + + + + Gets a list of the pending migrations that have not been applied to the database. + + List of migration Ids + + + + Updates the target database to the latest migration. + + + + + Updates the target database to a given migration. + + The migration to upgrade/downgrade to. + + + + Gets a list of the migrations that are defined in the assembly. + + List of migration Ids + + + + Gets a list of the migrations that have been applied to the database. + + List of migration Ids + + + + Gets the configuration being used for the migrations process. + + + + + Migration Id representing the state of the database before any migrations are applied. + + + + + Initializes a new instance of the DbMigrator class. + + Configuration to be used for the migration process. + + + + Gets all migrations that are defined in the configured migrations assembly. + + + + + Gets all migrations that have been applied to the target database. + + + + + Gets all migrations that are defined in the assembly but haven't been applied to the target database. + + + + + Updates the target database to a given migration. + + The migration to upgrade/downgrade to. + + + + Gets the configuration that is being used for the migration process. + + + + + A set of extension methods for + + + + + Adds or updates entities by key when SaveChanges is called. Equivalent to an "upsert" operation + from database terminology. + This method can useful when seeding data using Migrations. + + The entities to add or update. + + When the parameter is a custom or fake IDbSet implementation, this method will + attempt to locate and invoke a public, instance method with the same signature as this extension method. + + + + + Adds or updates entities by a custom identification expression when SaveChanges is called. + Equivalent to an "upsert" operation from database terminology. + This method can useful when seeding data using Migrations. + + + An expression specifying the properties that should be used when determining + whether an Add or Update operation should be performed. + + The entities to add or update. + + When the parameter is a custom or fake IDbSet implementation, this method will + attempt to locate and invoke a public, instance method with the same signature as this extension method. + + + + + Generates C# code for a code-based migration. + + + + + Base class for providers that generate code for code-based migrations. + + + + + Generates the code that should be added to the users project. + + Unique identifier of the migration. + Operations to be performed by the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Gets the namespaces that must be output as "using" or "Imports" directives to handle + the code generated by the given operations. + + The operations for which code is going to be generated. + An ordered list of namespace names. + + + + Gets the default namespaces that must be output as "using" or "Imports" directives for + any code generated. + + A value indicating if this class is being generated for a code-behind file. + An ordered list of namespace names. + + + + + + + Generates the primary code file that the user can view and edit. + + Operations to be performed by the migration. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates the code behind file with migration metadata. + + Unique identifier of the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates a property to return the source or target model in the code behind file. + + Name of the property. + Value to be returned. + Text writer to add the generated code to. + + + + Generates a namespace, using statements and class definition. + + Namespace that code should be generated in. + Name of the class that should be generated. + Text writer to add the generated code to. + Base class for the generated class. + A value indicating if this class is being generated for a code-behind file. + Namespaces for which using directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used. + + + + Generates the closing code for a class that was started with WriteClassStart. + + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify a set of column names using a lambda expression. + + The columns to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify the definition for a . + + The column definition to generate code for. + Text writer to add the generated code to. + A value indicating whether to include the column name in the definition. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column of unknown data type. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Removes any invalid characters from the name of an database artifact. + + The name to be scrubbed. + The scrubbed name. + + + + Gets the type name to use for a column of the given data type. + + The data type to translate. + The type name to use in the generated migration. + + + + Quotes an identifier using appropriate escaping to allow it to be stored in a string. + + The identifier to be quoted. + The quoted identifier. + + + + Scaffolds code-based migrations to apply pending model changes to the database. + + + + + Initializes a new instance of the MigrationScaffolder class. + + Configuration to be used for scaffolding. + + + + Scaffolds a code based migration to apply any pending model changes to the database. + + The name to use for the scaffolded migration. + The scaffolded migration. + + + + Scaffolds a code based migration to apply any pending model changes to the database. + + The name to use for the scaffolded migration. + Whether or not to include model changes. + The scaffolded migration. + + + + Scaffolds the initial code-based migration corresponding to a previously run database initializer. + + The scaffolded migration. + + + + Gets or sets the namespace used in the migration's generated code. + + By default, this is the same as MigrationsNamespace on the migrations + configuration object passed into the constructor. For VB.NET projects, this + will need to be updated to take into account the project's root namespace. + + + + + Represents a code-based migration that has been scaffolded and is ready to be written to a file. + + + + + Gets or sets the unique identifier for this migration. + Typically used for the file name of the generated code. + + + + + Gets or sets the scaffolded migration code that the user can edit. + + + + + Gets or sets the scaffolded migration code that should be stored in a code behind file. + + + + + Gets or sets the programming language used for this migration. + Typically used for the file extension of the generated code. + + + + + Gets or sets the subdirectory in the user's project that this migration should be saved in. + + + + + Gets a dictionary of string resources to add to the migration resource file. + + + + + Represents an exception that occurred while running an operation in another AppDomain in the . + + + + + Initializes a new instance of the ToolingException class. + + Error that explains the reason for the exception. + The type of the exception that was thrown. + The stack trace of the exception that was thrown. + + + + + + + + + + Gets the type of the exception that was thrown. + + + + + Gets the stack trace of the exception that was thrown. + + + + + Helper class that is used by design time tools to run migrations related + commands that need to interact with an application that is being edited + in Visual Studio. + + Because the application is being edited the assemblies need to + be loaded in a separate AppDomain to ensure the latest version + is always loaded. + + The App/Web.config file from the startup project is also copied + to ensure that any configuration is applied. + + + + + Initializes a new instance of the ToolingFacade class. + + + The name of the assembly that contains the migrations configuration to be used. + + + The namespace qualified name of migrations configuration to be used. + + + The working directory containing the compiled assemblies. + + + The path of the config file from the startup project. + + + The path of the application data directory from the startup project. + Typically the App_Data directory for web applications or the working directory for executables. + + + The connection to the database to be migrated. + If null is supplied, the default connection for the context will be used. + + + + + Releases all unmanaged resources used by the facade. + + + + + Gets the fully qualified name of all types deriving from . + + All context types found. + + + + Gets the fully qualified name of a type deriving from . + + The name of the context type. If null, the single context type found in the assembly will be returned. + The context type found. + + + + Gets a list of all migrations that have been applied to the database. + + Ids of applied migrations. + + + + Gets a list of all migrations that have not been applied to the database. + + Ids of pending migrations. + + + + Updates the database to the specified migration. + + + The Id of the migration to migrate to. + If null is supplied, the database will be updated to the latest migration. + + Value indicating if data loss during automatic migration is acceptable. + + + + Generates a SQL script to migrate between two migrations. + + + The migration to update from. + If null is supplied, a script to update the current database will be produced. + + + The migration to update to. + If null is supplied, a script to update to the latest migration will be produced. + + Value indicating if data loss during automatic migration is acceptable. + The generated SQL script. + + + + Scaffolds a code-based migration to apply any pending model changes. + + The name for the generated migration. + The programming language of the generated migration. + The root namespace of the project the migration will be added to. + Whether or not to include model changes. + The scaffolded migration. + + + + Scaffolds the initial code-based migration corresponding to a previously run database initializer. + + The programming language of the generated migration. + The root namespace of the project the migration will be added to. + The scaffolded migration. + + + + + + + Releases all resources used by the facade. + + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + + Gets or sets an action to be run to log information. + + + + + Gets or sets an action to be run to log warnings. + + + + + Gets or sets an action to be run to log verbose information. + + + + + Base class for loggers that can be used for the migrations process. + + + + + Logs an informational message. + + The message to be logged. + + + + Logs a warning that the user should be made aware of. + + The message to be logged. + + + + Logs some additional information that should only be presented to the user if they request verbose output. + + The message to be logged. + + + + Generates VB.Net code for a code-based migration. + + + + + + + + Generates the primary code file that the user can view and edit. + + Operations to be performed by the migration. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates the code behind file with migration metadata. + + Unique identifier of the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates a property to return the source or target model in the code behind file. + + Name of the property. + Value to be returned. + Text writer to add the generated code to. + + + + Generates a namespace, using statements and class definition. + + Namespace that code should be generated in. + Name of the class that should be generated. + Text writer to add the generated code to. + Base class for the generated class. + A value indicating if this class is being generated for a code-behind file. + Namespaces for which Imports directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used. + + + + Generates the closing code for a class that was started with WriteClassStart. + + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify a set of column names using a lambda expression. + + The columns to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify the definition for a . + + The column definition to generate code for. + Text writer to add the generated code to. + A value indicating whether to include the column name in the definition. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column of unknown data type. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Removes any invalid characters from the name of an database artifact. + + The name to be scrubbed. + The scrubbed name. + + + + Gets the type name to use for a column of the given data type. + + The data type to translate. + The type name to use in the generated migration. + + + + Quotes an identifier using appropriate escaping to allow it to be stored in a string. + + The identifier to be quoted. + The quoted identifier. + + + + This class is used by Code First Migrations to read and write migration history + from the database. It is not intended to be used by other code and is only public + so that it can be accessed by EF when running under partial trust. It may be + changed or removed in the future. + + + + + Gets or sets the Id of the migration this row represents. + + + + + Gets or sets the date and time that this migrations history entry was created. + + + + + Gets or sets the state of the model after this migration was applied. + + + + + Gets or sets the version of Entity Framework that created this entry. + + + + + This is a version of the HistoryContext that still includes CreatedOn in its model. + It is used when figuring out whether or not the CreatedOn column exists and so should + be dropped. + + + + + Represents an error that occurs when an automatic migration would result in data loss. + + + + + Represents errors that occur inside the Code First Migrations pipeline. + + + + + Initializes a new instance of the MigrationsException class. + + + + + Initializes a new instance of the MigrationsException class. + + The message that describes the error. + + + + Initializes a new instance of the MigrationsException class. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the MigrationsException class with serialized data. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + + + Initializes a new instance of the AutomaticDataLossException class. + + The message that describes the error. + + + + Represents an error that occurs when there are pending model changes after applying the last migration and automatic migration is disabled. + + + + + Initializes a new instance of the AutomaticMigrationsDisabledException class. + + The message that describes the error. + + + + Provides additional metadata about a code-based migration. + + + + + Gets the unique identifier for the migration. + + + + + Gets the state of the model before this migration is run. + + + + + Gets the state of the model after this migration is run. + + + + + Decorator to provide logging during migrations operations.. + + + + + Initializes a new instance of the MigratorLoggingDecorator class. + + The migrator that this decorator is wrapping. + The logger to write messages to. + + + + Decorator to produce a SQL script instead of applying changes to the database. + Using this decorator to wrap will prevent + from applying any changes to the target database. + + + + + Initializes a new instance of the MigratorScriptingDecorator class. + + The migrator that this decorator is wrapping. + + + + + Represents a column being added to a table. + + + + + Represents an operation to modify a database schema. + + + + + Initializes a new instance of the MigrationOperation class. + + + + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets additional arguments that may be processed by providers. + + + + + Gets an operation that will revert this operation. + + + + + Gets a value indicating if this operation may result in data loss. + + + + + Initializes a new instance of the AddColumnOperation class. + + The name of the table the column should be added to. + Details of the column being added. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column should be added to. + + + + + Gets the details of the column being added. + + + + + Gets an operation that represents dropping the added column. + + + + + + + + Represents a foreign key constraint being added to a table. + + + + + Base class for changes that affect foreign key constraints. + + + + + Initializes a new instance of the ForeignKeyOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the name of the table that the foreign key constraint targets. + + + + + Gets or sets the name of the table that the foreign key columns exist in. + + + + + The names of the foreign key column(s). + + + + + Gets a value indicating if a specific name has been supplied for this foreign key constraint. + + + + + Gets or sets the name of this foreign key constraint. + If no name is supplied, a default name will be calculated. + + + + + Initializes a new instance of the AddForeignKeyOperation class. + The PrincipalTable, PrincipalColumns, DependentTable and DependentColumns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to create an index on the foreign key column(s). + + An operation to add the index. + + + + The names of the column(s) that the foreign key constraint should target. + + + + + Gets or sets a value indicating if cascade delete should be configured on the foreign key constraint. + + + + + Gets an operation to drop the foreign key constraint. + + + + + + + + Represents adding a primary key to a table. + + + + + Common base class to represent operations affecting primary keys. + + + + + Initializes a new instance of the PrimaryKeyOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the name of the table that contains the primary key. + + + + + Gets the column(s) that make up the primary key. + + + + + Gets a value indicating if a specific name has been supplied for this primary key. + + + + + Gets or sets the name of this primary key. + If no name is supplied, a default name will be calculated. + + + + + + + + Initializes a new instance of the AddPrimaryKeyOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to drop the primary key. + + + + + Represents altering an existing column. + + + + + Initializes a new instance of the AlterColumnOperation class. + + The name of the table that the column belongs to. + Details of what the column should be altered to. + Value indicating if this change will result in data loss. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the AlterColumnOperation class. + + The name of the table that the column belongs to. + Details of what the column should be altered to. + Value indicating if this change will result in data loss. + An operation to revert this alteration of the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table that the column belongs to. + + + + + Gets the new definition for the column. + + + + + Gets an operation that represents reverting the alteration. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents information about a column. + + + + + Initializes a new instance of the class. + + The data type for this column. + + + + Initializes a new instance of the class. + + The data type for this column. + + Additional details about the data type. + This includes details such as maximum length, nullability etc. + + + + + Determines if this column is a narrower data type than another column. + Used to determine if altering the supplied column definition to this definition will result in data loss. + + The column to compare to. + Details of the database provider being used. + True if this column is of a narrower data type. + + + + Gets the data type for this column. + + + + + Gets the CLR type corresponding to the database type of this column. + + + + + Gets the default value for the CLR type corresponding to the database type of this column. + + + + + Gets additional details about the data type of this column. + This includes details such as maximum length, nullability etc. + + + + + Gets or sets the name of the column. + + + + + Gets or sets a provider specific data type to use for this column. + + + + + Gets or sets a value indicating if this column can store null values. + + + + + Gets or sets a value indicating if values for this column will be generated by the database using the identity pattern. + + + + + Gets or sets the maximum length for this column. + Only valid for array data types. + + + + + Gets or sets the precision for this column. + Only valid for decimal data types. + + + + + Gets or sets the scale for this column. + Only valid for decimal data types. + + + + + Gets or sets a constant value to use as the default value for this column. + + + + + Gets or sets a SQL expression used as the default value for this column. + + + + + Gets or sets a value indicating if this column is fixed length. + Only valid for array data types. + + + + + Gets or sets a value indicating if this column supports Unicode characters. + Only valid for textual data types. + + + + + Gets or sets a value indicating if this column should be configured as a timestamp. + + + + + Represents creating a database index. + + + + + Common base class for operations affecting indexes. + + + + + Initializes a new instance of the IndexOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the table the index belongs to. + + + + + Gets or sets the columns that are indexed. + + + + + Gets a value indicating if a specific name has been supplied for this index. + + + + + Gets or sets the name of this index. + If no name is supplied, a default name will be calculated. + + + + + Initializes a new instance of the CreateIndexOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets a value indicating if this is a unique index. + + + + + Gets an operation to drop this index. + + + + + + + + Represents creating a table. + + + + + Initializes a new instance of the CreateTableOperation class. + + Name of the table to be created. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be created. + + + + + Gets the columns to be included in the new table. + + + + + Gets or sets the primary key for the new table. + + + + + Gets an operation to drop the table. + + + + + + + + Represents deleting a new record from the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Common base class for operations that affect the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Initializes a new instance of the HistoryOperation class. + + Name of the migrations history table. + Name of the migration being affected. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the migrations history table. + + + + + Gets the name of the migration being affected. + + + + + + + + Initializes a new instance of the DeleteHistoryOperation class. + + Name of the migrations history table. + Id of the migration record to be deleted. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Represents a column being dropped from a table. + + + + + Initializes a new instance of the DropColumnOperation class. + + The name of the table the column should be dropped from. + The name of the column to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropColumnOperation class. + + The name of the table the column should be dropped from. + The name of the column to be dropped. + The operation that represents reverting the drop operation. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column should be dropped from. + + + + + Gets the name of the column to be dropped. + + + + + Gets an operation that represents reverting dropping the column. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents a foreign key constraint being dropped from a table. + + + + + Initializes a new instance of the DropForeignKeyOperation class. + The PrincipalTable, DependentTable and DependentColumns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropForeignKeyOperation class. + + The operation that represents reverting dropping the foreign key constraint. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to drop the associated index on the foreign key column(s). + + An operation to drop the index. + + + + Gets an operation that represents reverting dropping the foreign key constraint. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents dropping an existing index. + + + + + Initializes a new instance of the DropIndexOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropIndexOperation class. + + The operation that represents reverting dropping the index. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation that represents reverting dropping the index. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents dropping a primary key from a table. + + + + + Initializes a new instance of the DropPrimaryKeyOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to add the primary key. + + + + + Represents dropping an existing table. + + + + + Initializes a new instance of the DropTableOperation class. + + The name of the table to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropTableOperation class. + + The name of the table to be dropped. + An operation that represents reverting dropping the table. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be dropped. + + + + + Gets an operation that represents reverting dropping the table. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents inserting a new record into the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Initializes a new instance of the InsertHistoryOperation class. + + Name of the migrations history table. + Id of the migration record to be inserted. + Value to be stored in the model column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the value to store in the history table representing the target model of the migration. + + + + + Gets the value to store in the history table indicating the version of Entity Framework used to produce this migration. + + + + + + + + Represents moving a table from one schema to another. + + + + + Initializes a new instance of the MoveTableOperation class. + + Name of the table to be moved. + Name of the schema to move the table to. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be moved. + + + + + Gets the name of the schema to move the table to. + + + + + Gets an operation that moves the table back to its original schema. + + + + + + + + Represents renaming an existing column. + + + + + Initializes a new instance of the RenameColumnOperation class. + + Name of the table the column belongs to. + Name of the column to be renamed. + New name for the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column belongs to. + + + + + Gets the name of the column to be renamed. + + + + + Gets the new name for the column. + + + + + Gets an operation that reverts the rename. + + + + + + + + Represents renaming an existing table. + + + + + Initializes a new instance of the RenameTableOperation class. + + Name of the table to be renamed. + New name for the table. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be renamed. + + + + + Gets the new name for the table. + + + + + Gets an operation that reverts the rename. + + + + + + + + Represents a provider specific SQL statement to be executed directly against the target database. + + + + + Initializes a new instance of the SqlOperation class. + + The SQL to be executed. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the SQL to be executed. + + + + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + + + + Common base class for providers that convert provider agnostic migration + operations into database provider specific SQL commands. + + + + + Converts a set of migration operations into database provider specific SQL. + + The operations to be converted. + Token representing the version of the database being targeted. + A list of SQL statements to be executed to perform the migration operations. + + + + Represents a migration operation that has been translated into a SQL statement. + + + + + Gets or sets the SQL to be executed to perform this migration operation. + + + + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + Provider to convert provider agnostic migration operations into SQL commands + that can be run against Microsoft SQL Server Compact Edition. + + + + + Provider to convert provider agnostic migration operations into SQL commands + that can be run against a Microsoft SQL Server database. + + + + + Converts a set of migration operations into Microsoft SQL Server specific SQL. + + The operations to be converted. + Token representing the version of SQL Server being targeted (i.e. "2005", "2008"). + A list of SQL statements to be executed to perform the migration operations. + + + + Creates an empty connection for the current provider. + Allows derived providers to use connection other than . + + + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL to mark a table as a system table. + Generated SQL should be added using the Statement method. + + The table to mark as a system table. + + + + Generates SQL to create a database schema. + Generated SQL should be added using the Statement method. + + The name of the schema to create. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL to specify a constant byte[] default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant bool default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant DateTime default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant DateTimeOffset default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant Guid default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant string default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant TimeSpan default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify the data type of a column. + This method just generates the actual type, not the SQL to create the column. + + The definition of the column. + SQL representing the data type. + + + + Generates a quoted name. The supplied name may or may not contain the schema. + + The name to be quoted. + The quoted name. + + + + Quotes an identifier for SQL Server. + + The identifier to be quoted. + The quoted identifier. + + + + Adds a new Statement to be executed against the database. + + The statement to be executed. + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + Gets a new that can be used to build SQL. + + This is just a helper method to create a writer. Writing to the writer will + not cause SQL to be registered for execution. You must pass the generated + SQL to the Statement method. + + An empty text writer to use for SQL generation. + + + + Adds a new Statement to be executed against the database. + + The writer containing the SQL to be executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Utility class to prep the user's config file to run in an AppDomain + + + + + Updates a config file by adding binding redirects for EntityFramework.dll. + This ensures that the user's code can be ran in an AppDomain and the exact + same version of the assembly will be used for both domains. + + That path of the user's config file. Can also be null or a path to an non-existent file. + The path of the updated config file. It is the caller's responsibility to delete this. + + + + The same as but works in partial trust. + + + + + Specifies the default tab string. This field is constant. + + + + + Initializes a new instance of the IndentedTextWriter class using the specified text writer and default tab string. + + The to use for output. + + + + Initializes a new instance of the IndentedTextWriter class using the specified text writer and tab string. + + The to use for output. + The tab string to use for indentation. + + + + Closes the document being written to. + + + + + Flushes the stream. + + + + + Outputs the tab string once for each level of indentation according to the property. + + + + + Writes the specified string to the text stream. + + The string to write. + + + + Writes the text representation of a Boolean value to the text stream. + + The Boolean value to write. + + + + Writes a character to the text stream. + + The character to write. + + + + Writes a character array to the text stream. + + The character array to write. + + + + Writes a subarray of characters to the text stream. + + The character array to write data from. + Starting index in the buffer. + The number of characters to write. + + + + Writes the text representation of a Double to the text stream. + + The double to write. + + + + Writes the text representation of a Single to the text stream. + + The single to write. + + + + Writes the text representation of an integer to the text stream. + + The integer to write. + + + + Writes the text representation of an 8-byte integer to the text stream. + + The 8-byte integer to write. + + + + Writes the text representation of an object to the text stream. + + The object to write. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string. + The object to write into the formatted string. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string to use. + The first object to write into the formatted string. + The second object to write into the formatted string. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string to use. + The argument array to output. + + + + Writes the specified string to a line without tabs. + + The string to write. + + + + Writes the specified string, followed by a line terminator, to the text stream. + + The string to write. + + + + Writes a line terminator. + + + + + Writes the text representation of a Boolean, followed by a line terminator, to the text stream. + + The Boolean to write. + + + + Writes a character, followed by a line terminator, to the text stream. + + The character to write. + + + + Writes a character array, followed by a line terminator, to the text stream. + + The character array to write. + + + + Writes a subarray of characters, followed by a line terminator, to the text stream. + + The character array to write data from. + Starting index in the buffer. + The number of characters to write. + + + + Writes the text representation of a Double, followed by a line terminator, to the text stream. + + The double to write. + + + + Writes the text representation of a Single, followed by a line terminator, to the text stream. + + The single to write. + + + + Writes the text representation of an integer, followed by a line terminator, to the text stream. + + The integer to write. + + + + Writes the text representation of an 8-byte integer, followed by a line terminator, to the text stream. + + The 8-byte integer to write. + + + + Writes the text representation of an object, followed by a line terminator, to the text stream. + + The object to write. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string. + The object to write into the formatted string. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string to use. + The first object to write into the formatted string. + The second object to write into the formatted string. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string to use. + The argument array to output. + + + + Writes the text representation of a UInt32, followed by a line terminator, to the text stream. + + A UInt32 to output. + + + + Gets the encoding for the text writer to use. + + + An that indicates the encoding for the text writer to use. + + + + + Gets or sets the new line character to use. + + + The new line character to use. + + + + + Gets or sets the number of spaces to indent. + + + The number of spaces to indent. + + + + + Gets the to use. + + + The to use. + + + + + Used for generating values that are always in sequential + order for the calling thread. + + + + + Returns the value of unless this value would be the same as the + last value returned by this thread calling this method, in which case the thread pushes the value + a little bit into the future. The comparison is in terms of the form used to store migration ID + in the database--i.e. to the 1/10 second. + + + There should never be any pushing to the future involved for normal use of migrations, but when + this method is called in rapid succession while testing or otherwise calling the DbMigrator APIs + there may be occasional sleeping. + + + + + Same as UtcNow method bur returns the time in the timestamp format used in migration IDs. + + + + + Convention to apply column ordering specified via + or the API. This convention throws if a duplicate configured column order + is detected. + + + + + Convention to apply column ordering specified via + or the API. + + + + + Identifies conventions that can be removed from a instance. + + /// + Note that implementations of this interface must be immutable. + + + + + Strongly-typed and parameterized string resources. + + + + + A string like "Applying automatic migration: {0}." + + + + + A string like "Reverting automatic migration: {0}." + + + + + A string like "Applying code-based migration: {0}." + + + + + A string like "Reverting code-based migration: {0}." + + + + + A string like "Applying code-based migrations: [{1}]." + + + + + A string like "Reverting migrations: [{1}]." + + + + + A string like "Target database is already at version {0}." + + + + + A string like "Target database is: {0}." + + + + + A string like "'{1}' (DataSource: {0}, Provider: {2}, Origin: {3})" + + + + + A string like "The specified target migration '{0}' does not exist. Ensure that target migration refers to an existing migration id." + + + + + A string like "The Foreign Key on table '{0}' with columns '{1}' could not be created because the principal key columns could not be determined. Use the AddForeignKey fluent API to fully specify the Foreign Key." + + + + + A string like "'{0}' is not a valid target migration. When targeting a previously applied automatic migration, use the full migration id including timestamp." + + + + + A string like "'{0}' is not a valid migration. Code-based migrations must be used for both source and target when scripting the upgrade between them." + + + + + A string like "The target context '{0}' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory." + + + + + A string like "The specified migration name '{0}' is ambiguous. Specify the full migration id including timestamp instead." + + + + + A string like "The migrations configuration type '{0}' was not be found in the assembly '{1}'." + + + + + A string like "More than one migrations configuration type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the one to use." + + + + + A string like "No migrations configuration type was found in the assembly '{0}'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)." + + + + + A string like "More than one migrations configuration type was found in the assembly '{0}'. Specify the name of the one to use." + + + + + A string like "The type '{0}' is not a migrations configuration type." + + + + + A string like "The migrations configuration type '{0}' must have a public default constructor." + + + + + A string like "The migrations configuration type '{0}' must not be abstract." + + + + + A string like "The migrations configuration type '{0}' must not be generic." + + + + + A string like "In VB.NET projects, the migrations namespace '{0}' must be under the root namespace '{1}'. Update the migrations project's root namespace to allow classes under the migrations namespace to be added." + + + + + + A string like "No MigrationSqlGenerator found for provider '{0}'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators." + + + + + A string like "Could not load assembly '{0}'. (If you are using Code First Migrations inside Visual Studio this can happen if the startUp project for your solution does not reference the project that contains your migrations. You can either change the startUp project for your solution or use the -StartUpProjectName parameter.)" + + + + + A string like "No context type was found in the assembly '{0}'." + + + + + A string like "More than one context type was found in the assembly '{0}'." + + + + + A string like "To enable migrations for {0}, use Enable-Migrations -ContextTypeName {0}." + + + + + A string like "The context type '{0}' was not found in the assembly '{1}'." + + + + + A string like "More than one context type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the context." + + + + + A string like "The argument '{0}' cannot be null, empty or contain only white space." + + + + + A string like "The argument property '{0}' cannot be null." + + + + + A string like "The precondition '{0}' failed. {1}" + + + + + A string like "The type '{0}' has already been configured as a complex type. It cannot be reconfigured as an entity type." + + + + + A string like "The type '{0}' has already been configured as an entity type. It cannot be reconfigured as a complex type." + + + + + A string like "The key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + A string like "The foreign key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + A string like "The property '{0}' is not a declared property on type '{1}'. Verify that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property." + + + + + A string like "The navigation property '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property." + + + + + A string like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'." + + + + + A string like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. Use dotted paths for nested properties: C#: 't => t.MyProperty.MyProperty' VB.Net: 'Function(t) t.MyProperty.MyProperty'." + + + + + A string like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + A string like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + + A string like "Conflicting configuration settings were specified for property '{0}' on type '{1}': {2}" + + + + + A string like "Conflicting configuration settings were specified for column '{0}' on table '{1}': {2}" + + + + + A string like "{0} = {1} conflicts with {2} = {3}" + + + + + A string like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from ComplexObject." + + + + + A string like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject." + + + + + A string like "The navigation property '{0}' declared on type '{1}' cannot be the inverse of itself." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting foreign keys." + + + + + A string like "Values of incompatible types ('{1}' and '{2}') were assigned to the '{0}' discriminator column. Values of the same type must be specified. To explicitly specify the type of the discriminator column use the HasColumnType method." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting mapping information." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting cascade delete operations using 'WillCascadeOnDelete'." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting multiplicities." + + + + + A string like "The MaxLengthAttribute on property '{0}' on type '{1} is not valid. The Length value must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "The StringLengthAttribute on property '{0}' on type '{1}' is not valid. The maximum length must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "Unable to determine composite primary key ordering for type '{0}'. Use the ColumnAttribute or the HasKey method to specify an order for composite primary keys." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. Name must not be empty." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The foreign key name '{2}' was not found on the dependent type '{3}'. The Name value should be a comma separated list of foreign key property names." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The navigation property '{2}' was not found on the dependent type '{1}'. The Name value should be a valid navigation property name." + + + + + A string like "Unable to determine a composite foreign key ordering for foreign key on type {0}. When using the ForeignKey data annotation on composite foreign key properties ensure order is specified by using the Column data annotation or the fluent API." + + + + + A string like "The InversePropertyAttribute on property '{2}' on type '{3}' is not valid. The property '{0}' is not a valid navigation property on the related type '{1}'. Ensure that the property exists and is a valid reference or collection navigation property." + + + + + A string like "A relationship cannot be established from property '{0}' on type '{1}' to property '{0}' on type '{1}'. Check the values in the InversePropertyAttribute to ensure relationship definitions are unique and reference from one navigation property to its corresponding inverse navigation property." + + + + + A string like "\t{0}: {1}: {2}" + + + + + A string like "A key is registered for the derived type '{0}'. Keys can only be registered for the root type '{1}'." + + + + + A string like "The {0} value '{1}' already exists in the user-defined dictionary." + + + + + A string like "The type '{0}' has already been mapped to table '{1}'. Specify all mapping aspects of a table in a single Map call." + + + + + A string like "Map was called more than once for type '{0}' and at least one of the calls didn't specify the target table name." + + + + + A string like "The derived type '{0}' has already been mapped using the chaining syntax. A derived type can only be mapped once using the chaining syntax." + + + + + A string like "An "is not null" condition cannot be specified on property '{0}' on type '{1}' because this property is not included in the model. Check that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation." + + + + + A string like "Values of type '{0}' cannot be used as type discriminator values. Supported types include byte, signed byte, bool, int16, int32, int64, and string." + + + + + A string like "Unable to add the convention '{0}'. Could not find an existing convention of type '{1}' in the current convention set." + + + + + A string like "Not all properties for type '{0}' have been mapped. Either map those properties or explicitly excluded them from the model." + + + + + A string like "Unable to determine the provider name for connection of type '{0}'." + + + + + A string like "The qualified table name '{0}' contains an invalid schema name. Schema names must have a non-zero length." + + + + + A string like "The qualified table name '{0}' contains an invalid table name. Table names must have a non-zero length." + + + + + A string like "Properties for type '{0}' can only be mapped once. Ensure the MapInheritedProperties method is only used during one call to the Map method." + + + + + A string like "Properties for type '{0}' can only be mapped once. Ensure the Properties method is used and that repeated calls specify each non-key property only once." + + + + + A string like "Properties for type '{0}' can only be mapped once. The non-key property '{1}' is mapped more than once. Ensure the Properties method specifies each non-key property only once." + + + + + A string like "The property '{1}' on type '{0}' cannot be mapped because it has been explicitly excluded from the model or it is of a type not supported by the DbModelBuilderVersion being used." + + + + + A string like "The entity types '{0}' and '{1}' cannot share table '{2}' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them." + + + + + A string like "You cannot use Ignore method on the property '{0}' on type '{1}' because this type inherits from the type '{2}' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type." + + + + + A string like "The property '{0}' cannot be used as a key property on the entity '{1}' because the property type is not a valid key type. Only scalar types, string and byte[] are supported key types." + + + + + A string like "The specified table '{0}' was not found in the model. Ensure that the table name has been correctly specified." + + + + + A string like "The specified association foreign key columns '{0}' are invalid. The number of columns specified must match the number of primary key columns." + + + + + A string like "Unable to determine the principal end of an association between the types '{0}' and '{1}'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." + + + + + A string like "The abstract type '{0}' has no mapped descendents and so cannot be mapped. Either remove '{0}' from the model or add one or more types deriving from '{0}' to the model. " + + + + + A string like "The type '{0}' cannot be mapped as defined because it maps inherited properties from types that use entity splitting or another form of inheritance. Either choose a different inheritance mapping strategy so as to not map inherited properties, or change all types in the hierarchy to map inherited properties and to not use splitting. " + + + + + A string like "The table '{0}' was configured but is not used in any mappings. Verify the mapping configuration for '{0}' is correct." + + + + + A string like "The configured column orders for the table '{0}' contains duplicates. Ensure the specified column order values are distinct." + + + + + A string like "The enum or spatial property '{1}' on type '{0}' cannot be mapped. Use DbModelBuilderVersion 'V5_0' or later to map enum or spatial properties." + + + + + A string like "Multiple potential primary key properties named '{0}' but differing only by case were found on entity type '{1}'. Configure the primary key explicitly using the HasKey fluent API or the KeyAttribute data annotation." + + + + + A string like "Cannot get value for property '{0}' from entity of type '{1}' because the property has no get accessor." + + + + + A string like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor." + + + + + + A string like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor and is in the '{2}' state." + + + + + A string like "Member '{0}' cannot be called for property '{1}' on entity of type '{2}' because the property is not part of the Entity Data Model." + + + + + + A string like "Cannot call the {0} method for an entity of type '{1}' on a DbSet for entities of type '{2}'. Only entities of type '{2}' or derived from type '{2}' can be added, attached, or removed." + + + + + A string like "Cannot call the Create method for the type '{0}' on a DbSet for entities of type '{1}'. Only entities of type '{1}' or derived from type '{1}' can be created." + + + + + + + A string like "The property '{0}' on type '{1}' is a collection navigation property. The Collection method should be used instead of the Reference method." + + + + + A string like "The property '{0}' on type '{1}' is a reference navigation property. The Reference method should be used instead of the Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a navigation property. The Reference and Collection methods can only be used with navigation properties. Use the Property or ComplexProperty method." + + + + + A string like "The property '{0}' on type '{1}' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a complex property. The ComplexProperty method can only be used with complex properties. Use the Property, Reference or Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a primitive property, complex property, collection navigation property, or reference navigation property." + + + + + A string like ""The property '{0}' from the property path '{1}' is not a complex property on type '{2}'. Property paths must be composed of complex properties for all except the final property."" + + + + + A string like ""The property path '{0}' cannot be used for navigation properties. Property paths can only be used to access primitive or complex properties."" + + + + + A string like "The navigation property '{0}' on entity type '{1}' cannot be used for entities of type '{2}' because it refers to entities of type '{3}'." + + + + + A string like "The generic type argument '{0}' cannot be used with the Member method when accessing the collection navigation property '{1}' on entity type '{2}'. The generic type argument '{3}' must be used instead." + + + + + A string like "The property '{0}' on entity type '{1}' cannot be used for objects of type '{2}' because it is a property for objects of type '{3}'." + + + + + A string like "The expression passed to method {0} must represent a property defined on the type '{1}'." + + + + + A string like "{0} cannot be used for entities in the {1} state." + + + + + A string like "Cannot set non-nullable property '{0}' of type '{1}' to null on object of type '{2}'." + + + + + A string like "The property '{0}' in the entity of type '{1}' is null. Store values cannot be obtained for an entity with a null complex property." + + + + + A string like "Cannot assign value of type '{0}' to property '{1}' of type '{2}' in property values for type '{3}'." + + + + + A string like "The '{0}' property does not exist or is not mapped for the type '{1}'." + + + + + A string like "Cannot copy values from DbPropertyValues for type '{0}' into DbPropertyValues for type '{1}'." + + + + + A string like "Cannot copy from property values for object of type '{0}' into property values for object of type '{1}'." + + + + + A string like "The value of the complex property '{0}' on entity of type '{1}' is null. Complex properties cannot be set to null and values cannot be set for null complex properties." + + + + + A string like "The value of the nested property values property '{0}' on the values for entity of type '{1}' is null. Nested property values cannot be set to null and values cannot be set for null complex properties." + + + + + A string like "Cannot set the value of the nested property '{0}' because value of the complex property '{1}' to which it belongs is null." + + + + + A string like "Cannot set the original value of the nested property '{0}' because the original value of the complex property '{1}' to which it belongs is null." + + + + + A string like "The model backing the '{0}' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)." + + + + + A string like "Database '{0}' cannot be created because it already exists." + + + + + + + A string like "Failed to set database initializer of type '{0}' for DbContext type '{1}' specified in the application configuration. See inner exception for details." + + + + + A string like "Configuration for DbContext type '{0}' is specified multiple times in the application configuration. Each context can only be configured once." + + + + + A string like "Failed to set Database.DefaultConnectionFactory to an instance of the '{0}' type as specified in the application configuration. See inner exception for details." + + + + + A string like "The type '{0}' could not be found. The type name must be an assembly-qualified name." + + + + + A string like "The connection string '{0}' in the application's configuration file does not contain the required providerName attribute."" + + + + + A string like "The entity found was of type {0} when an entity of type {1} was requested." + + + + + A string like "The type '{0}' is mapped as a complex type. The Set method, DbSet objects, and DbEntityEntry objects can only be used with entity types, not complex types." + + + + + A string like "The type '{0}' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute." + + + + + A string like "The entity type {0} is not part of the model for the current context." + + + + + A string like "No connection string named '{0}' could be found in the application config file." + + + + + A string like "The collection navigation property '{0}' on the entity of type '{1}' cannot be set because the entity type does not define a navigation property with a set accessor." + + + + + A string like "Multiple object sets per type are not supported. The object sets '{0}' and '{1}' can both contain instances of type '{2}'." + + + + + A string like "The context type '{0}' must have a public constructor taking an EntityConnection." + + + + + A string like "An unexpected exception was thrown during validation of '{0}' when invoking {1}.IsValid. See the inner exception for details." + + + + + A string like "An unexpected exception was thrown during validation of '{0}' when invoking {1}.Validate. See the inner exception for details." + + + + + A string like "The database name '{0}' is not supported because it is an MDF file name. A full connection string must be provided to attach an MDF file." + + + + + A string like "The context factory type '{0}' must have a public default constructor." + + + + + A string like "The '{0}' property of EdmPrimitiveType is fixed and cannot be set." + + + + + A string like "The namespace '{0}' is a system namespace and cannot be used by other schemas. Choose another namespace name." + + + + + A string like "Role '{0}' in AssociationSets '{1}' and '{2}' refers to the same EntitySet '{3}' in EntityContainer '{4}'. Make sure that if two or more AssociationSets refer to the same AssociationType, the ends do not refer to the same EntitySet." + + + + + A string like "The referenced EntitySet '{0}' for End '{1}' could not be found in the containing EntityContainer." + + + + + A string like "Type '{0}' is derived from type '{1}' that is the type for EntitySet '{2}'. Type '{0}' defines new concurrency requirements that are not allowed for subtypes of base EntitySet types." + + + + + A string like "EntitySet '{0}' is based on type '{1}' that has no keys defined." + + + + + A string like "The end name '{0}' is already defined." + + + + + A string like "The key specified in EntityType '{0}' is not valid. Property '{1}' is referenced more than once in the Key element." + + + + + A string like "Property '{0}' has a CollectionKind specified but is not a collection property." + + + + + A string like "Property '{0}' has a CollectionKind specified. CollectionKind is only supported in version 1.1 EDM models." + + + + + A string like "ComplexType '{0}' is marked as abstract. Abstract ComplexTypes are only supported in version 1.1 EDM models." + + + + + A string like "ComplexType '{0}' has a BaseType specified. ComplexType inheritance is only supported in version 1.1 EDM models." + + + + + A string like "Key part '{0}' for type '{1}' is not valid. All parts of the key must be non-nullable." + + + + + A string like "The property '{0}' in EntityType '{1}' is not valid. All properties that are part of the EntityKey must be of PrimitiveType." + + + + + A string like "Key usage is not valid. The {0} class cannot define keys because one of its base classes ('{1}') defines keys." + + + + + A string like "EntityType '{0}' has no key defined. Define the key for this EntityType." + + + + + A string like "NavigationProperty is not valid. Role '{0}' or Role '{1}' is not defined in Relationship '{2}'." + + + + + A string like "End '{0}' on relationship '{1}' cannot have an operation specified because its multiplicity is '*'. Operations cannot be specified on ends with multiplicity '*'." + + + + + A string like "Each Name and PluralName in a relationship must be unique. '{0}' is already defined." + + + + + A string like "In relationship '{0}', the Principal and Dependent Role of the referential constraint refer to the same Role in the relationship type." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Valid values for multiplicity for the Principal Role are '0..1' or '1'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because all the properties in the Dependent Role are nullable, multiplicity of the Principal Role must be '0..1'." + + + + + A string like "Multiplicity conflicts with the referential constraint in Role '{0}' in relationship '{1}'. Because at least one of the properties in the Dependent Role is non-nullable, multiplicity of the Principal Role must be '1'." + + + + + A string like "Multiplicity conflicts with the referential constraint in Role '{0}' in relationship '{1}'. Because all of the properties in the Dependent Role are non-nullable, multiplicity of the Principal Role must be '1'." + + + + + A string like "Properties referred by the Dependent Role '{0}' must be a subset of the key of the EntityType '{1}' referred to by the Dependent Role in the referential constraint for relationship '{2}'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because the Dependent Role refers to the key properties, the upper bound of the multiplicity of the Dependent Role must be '1'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because the Dependent Role properties are not the key properties, the upper bound of the multiplicity of the Dependent Role must be '*'." + + + + + A string like "The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property '{0}' on entity '{1}' does not match the type of property '{2}' on entity '{3}' in the referential constraint '{4}'." + + + + + A string like "There is no property with name '{0}' defined in the type referred to by Role '{1}'." + + + + + A string like "A nullable ComplexType is not supported. Property '{0}' must not allow nulls." + + + + + A string like "A property cannot be of type '{0}'. The property type must be a ComplexType or a PrimitiveType." + + + + + A string like "Each member name in an EntityContainer must be unique. A member with name '{0}' is already defined." + + + + + A string like "Each type name in a schema must be unique. Type name '{0}' is already defined." + + + + + A string like "Name '{0}' cannot be used in type '{1}'. Member names cannot be the same as their enclosing type." + + + + + A string like "Each property name in a type must be unique. Property name '{0}' is already defined." + + + + + A string like "A cycle was detected in the type hierarchy of '{0}'." + + + + + A string like "A property cannot be of type '{0}'. The property type must be a ComplexType, a PrimitiveType, or a CollectionType." + + + + + A string like "A property cannot be of type {0}. The property type must be a ComplexType, a PrimitiveType or an EnumType." + + + + + A string like "The specified name must not be longer than 480 characters: '{0}'." + + + + + A string like "The specified name is not allowed: '{0}'." + + + + + A string like "The field {0} must be a string or array type with a maximum length of '{1}'." + + + + + A string like "The field {0} must be a string or array type with a minimum length of '{1}'." + + + + + A string like "No connection string named '{0}' could be found in the application config file." + + + + + A string like "AutomaticMigration" + + + + + A string like "BootstrapMigration" + + + + + A string like "InitialCreate" + + + + + A string like "Automatic migration was not applied because it would result in data loss." + + + + + A string like "[Inserting migration history record]" + + + + + A string like "[Deleting migration history record]" + + + + + A string like "[Updating EdmMetadata model hash]" + + + + + A string like "Running Seed method." + + + + + A string like "No pending code-based migrations." + + + + + A string like "Explicit" + + + + + A string like "Upgrading history table." + + + + + A string like "Cannot scaffold the next migration because the target database was created with a version of Code First earlier than EF 4.3 and does not contain the migrations history table. To start using migrations against this database, ensure the current model is compatible with the target database and execute the migrations Update process. (In Visual Studio you can use the Update-Database command from Package Manager Console to execute the migrations Update process)." + + + + + A string like "Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration." + + + + + A string like "Scripting the downgrade between two specified migrations is not supported." + + + + + A string like "Direct column renaming is not supported by SQL Server Compact. To rename a column in SQL Server Compact, you will need to recreate it." + + + + + A string like "One or more validation errors were detected during model generation:" + + + + + A string like "A circular ComplexType hierarchy was detected. Self-referencing ComplexTypes are not supported." + + + + + A string like "Connection to the database failed. The connection string is configured with an invalid LocalDB server name. This may have been set in 'global.asax' by a pre-release version of MVC4. The default connection factory is now set in web.config so the line in 'global.asax' starting with 'Database.DefaultConnectionFactory = ' should be removed. See http://go.microsoft.com/fwlink/?LinkId=243166 for details." + + + + + A string like "An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct." + + + + + A string like "Setting IsModified to false for a modified property is not supported." + + + + + A string like "An error occurred while saving entities that do not expose foreign key properties for their relationships. The EntityEntries property will return null because a single entity cannot be identified as the source of the exception. Handling of exceptions while saving can be made easier by exposing foreign key properties in your entity types. See the InnerException for details." + + + + + A string like "The set of property value names is read-only." + + + + + A string like "A property of a complex type must be set to an instance of the generic or non-generic DbPropertyValues class for that type." + + + + + A string like "Model compatibility cannot be checked because the DbContext instance was not created using Code First patterns. DbContext instances created from an ObjectContext or using an EDMX file cannot be checked for compatibility." + + + + + A string like "Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions." + + + + + A string like "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations." + + + + + A string like "The context cannot be used while the model is being created." + + + + + A string like "The DbContext class cannot be used with models that have multiple entity sets per type (MEST)." + + + + + A string like "The operation cannot be completed because the DbContext has been disposed." + + + + + A string like "The provider factory returned a null connection." + + + + + A string like "The DbConnectionFactory instance returned a null connection." + + + + + A string like "The number of primary key values passed must match number of primary key values defined on the entity." + + + + + A string like "The type of one of the primary key values did not match the type defined in the entity. See inner exception for details." + + + + + A string like "Multiple entities were found in the Added state that match the given primary key values." + + + + + A string like "Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList()." + + + + + A string like "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties." + + + + + A string like "Cannot initialize a DbContext from an entity connection string or an EntityConnection instance together with a DbCompiledModel. If an entity connection string or EntityConnection instance is used, then the model will be created from the metadata in the connection. If a DbCompiledModel is used, then the connection supplied should be a standard database connection (for example, a SqlConnection instance) rather than an entity connection." + + + + + A string like "Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used." + + + + + A string like "Validation failed for one or more entities. See 'EntityValidationErrors' property for more details." + + + + + A string like "An exception occurred while initializing the database. See the InnerException for details." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing ObjectContext is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing DbCompiledModel is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Code generated using the T4 templates for Database First and Model First development may not work correctly if used in Code First mode. To continue using Database First or Model First ensure that the Entity Framework connection string is specified in the config file of executing application. To use these classes, that were generated from Database First or Model First, with Code First add any additional configuration using attributes or the DbModelBuilder API and then remove the code that throws this exception." + + + + + A string like "The generic 'Set' method cannot be called with a proxy type. Either use the actual entity type or call the non-generic 'Set' method." + + + + + A string like "NavigationProperty is not valid. The FromRole and ToRole are the same." + + + + + A string like "OnDelete can be specified on only one End of an EdmAssociation." + + + + + A string like "The number of properties in the Dependent and Principal Roles in a relationship constraint must be identical." + + + + + A string like "The name is missing or not valid." + + + + + A string like "AssociationEnd must not be null." + + + + + A string like "DependentEnd must not be null." + + + + + A string like "DependentProperties must not be empty." + + + + + A string like "Association must not be null." + + + + + A string like "ResultEnd must not be null." + + + + + A string like "EntityType must not be null." + + + + + A string like "ElementType must not be null." + + + + + A string like "ElementType must not be null." + + + + + A string like "SourceSet must not be null." + + + + + A string like "TargetSet must not be null." + + + + + A string like "The type is not a valid EdmTypeReference." + + + + + A string like "Serializer can only serialize an EdmModel that has one EdmNamespace and one EdmEntityContainer." + + + + + A string like "MaxLengthAttribute must have a Length value that is greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "MinLengthAttribute must have a Length value that is zero or greater." + + + + + A string like "The connection can not be overridden because this context was created from an existing ObjectContext." + + + + + A string like "Can not override the connection for this context with a standard DbConnection because the original connection was an EntityConnection." + + + + + A string like "Can not override the connection for this context with an EntityConnection because the original connection was a standard DbConnection." + + + + + Strongly-typed and parameterized exception factory. + + + + + Migrations.Infrastructure.AutomaticDataLossException with message like "Automatic migration was not applied because it would result in data loss." + + + + + Migrations.Infrastructure.MigrationsException with message like "Cannot scaffold the next migration because the target database was created with a version of Code First earlier than EF 4.3 and does not contain the migrations history table. To start using migrations against this database, ensure the current model is compatible with the target database and execute the migrations Update process. (In Visual Studio you can use the Update-Database command from Package Manager Console to execute the migrations Update process)." + + + + + Migrations.Infrastructure.MigrationsException with message like "The specified target migration '{0}' does not exist. Ensure that target migration refers to an existing migration id." + + + + + Migrations.Infrastructure.MigrationsException with message like "The Foreign Key on table '{0}' with columns '{1}' could not be created because the principal key columns could not be determined. Use the AddForeignKey fluent API to fully specify the Foreign Key." + + + + + Migrations.Infrastructure.MigrationsException with message like "'{0}' is not a valid target migration. When targeting a previously applied automatic migration, use the full migration id including timestamp." + + + + + Migrations.Infrastructure.MigrationsException with message like "'{0}' is not a valid migration. Code-based migrations must be used for both source and target when scripting the upgrade between them." + + + + + Migrations.Infrastructure.MigrationsException with message like "The target context '{0}' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory." + + + + + Migrations.Infrastructure.MigrationsException with message like "The specified migration name '{0}' is ambiguous. Specify the full migration id including timestamp instead." + + + + + Migrations.Infrastructure.AutomaticMigrationsDisabledException with message like "Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration." + + + + + Migrations.Infrastructure.MigrationsException with message like "Scripting the downgrade between two specified migrations is not supported." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' was not be found in the assembly '{1}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one migrations configuration type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the one to use." + + + + + Migrations.Infrastructure.MigrationsException with message like "No migrations configuration type was found in the assembly '{0}'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one migrations configuration type was found in the assembly '{0}'. Specify the name of the one to use." + + + + + Migrations.Infrastructure.MigrationsException with message like "The type '{0}' is not a migrations configuration type." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must have a public default constructor." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must not be abstract." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must not be generic." + + + + + Migrations.Infrastructure.MigrationsException with message like "Direct column renaming is not supported by SQL Server Compact. To rename a column in SQL Server Compact, you will need to recreate it." + + + + + Migrations.Infrastructure.MigrationsException with message like "In VB.NET projects, the migrations namespace '{0}' must be under the root namespace '{1}'. Update the migrations project's root namespace to allow classes under the migrations namespace to be added." + + + + + + Migrations.Infrastructure.MigrationsException with message like "No MigrationSqlGenerator found for provider '{0}'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators." + + + + + Migrations.Infrastructure.MigrationsException with message like "No context type was found in the assembly '{0}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "The context type '{0}' was not found in the assembly '{1}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one context type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the context." + + + + + ArgumentException with message like "The argument '{0}' cannot be null, empty or contain only white space." + + + + + ArgumentException with message like "The argument property '{0}' cannot be null." + + + + + ArgumentException with message like "The precondition '{0}' failed. {1}" + + + + + InvalidOperationException with message like "The type '{0}' has already been configured as a complex type. It cannot be reconfigured as an entity type." + + + + + InvalidOperationException with message like "The type '{0}' has already been configured as an entity type. It cannot be reconfigured as a complex type." + + + + + InvalidOperationException with message like "The key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + InvalidOperationException with message like "The foreign key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + InvalidOperationException with message like "The property '{0}' is not a declared property on type '{1}'. Verify that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property." + + + + + InvalidOperationException with message like "The navigation property '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property." + + + + + InvalidOperationException with message like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'." + + + + + InvalidOperationException with message like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. Use dotted paths for nested properties: C#: 't => t.MyProperty.MyProperty' VB.Net: 'Function(t) t.MyProperty.MyProperty'." + + + + + InvalidOperationException with message like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + InvalidOperationException with message like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + + InvalidOperationException with message like "Conflicting configuration settings were specified for property '{0}' on type '{1}': {2}" + + + + + InvalidOperationException with message like "Conflicting configuration settings were specified for column '{0}' on table '{1}': {2}" + + + + + InvalidOperationException with message like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from ComplexObject." + + + + + InvalidOperationException with message like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' cannot be the inverse of itself." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting foreign keys." + + + + + MappingException with message like "Values of incompatible types ('{1}' and '{2}') were assigned to the '{0}' discriminator column. Values of the same type must be specified. To explicitly specify the type of the discriminator column use the HasColumnType method." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting mapping information." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting cascade delete operations using 'WillCascadeOnDelete'." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting multiplicities." + + + + + InvalidOperationException with message like "The MaxLengthAttribute on property '{0}' on type '{1} is not valid. The Length value must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "The StringLengthAttribute on property '{0}' on type '{1}' is not valid. The maximum length must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "Unable to determine composite primary key ordering for type '{0}'. Use the ColumnAttribute or the HasKey method to specify an order for composite primary keys." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. Name must not be empty." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The foreign key name '{2}' was not found on the dependent type '{3}'. The Name value should be a comma separated list of foreign key property names." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The navigation property '{2}' was not found on the dependent type '{1}'. The Name value should be a valid navigation property name." + + + + + InvalidOperationException with message like "Unable to determine a composite foreign key ordering for foreign key on type {0}. When using the ForeignKey data annotation on composite foreign key properties ensure order is specified by using the Column data annotation or the fluent API." + + + + + InvalidOperationException with message like "The InversePropertyAttribute on property '{2}' on type '{3}' is not valid. The property '{0}' is not a valid navigation property on the related type '{1}'. Ensure that the property exists and is a valid reference or collection navigation property." + + + + + InvalidOperationException with message like "A relationship cannot be established from property '{0}' on type '{1}' to property '{0}' on type '{1}'. Check the values in the InversePropertyAttribute to ensure relationship definitions are unique and reference from one navigation property to its corresponding inverse navigation property." + + + + + InvalidOperationException with message like "A key is registered for the derived type '{0}'. Keys can only be registered for the root type '{1}'." + + + + + InvalidOperationException with message like "The type '{0}' has already been mapped to table '{1}'. Specify all mapping aspects of a table in a single Map call." + + + + + InvalidOperationException with message like "Map was called more than once for type '{0}' and at least one of the calls didn't specify the target table name." + + + + + InvalidOperationException with message like "The derived type '{0}' has already been mapped using the chaining syntax. A derived type can only be mapped once using the chaining syntax." + + + + + InvalidOperationException with message like "An "is not null" condition cannot be specified on property '{0}' on type '{1}' because this property is not included in the model. Check that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation." + + + + + ArgumentException with message like "Values of type '{0}' cannot be used as type discriminator values. Supported types include byte, signed byte, bool, int16, int32, int64, and string." + + + + + InvalidOperationException with message like "Unable to add the convention '{0}'. Could not find an existing convention of type '{1}' in the current convention set." + + + + + InvalidOperationException with message like "Not all properties for type '{0}' have been mapped. Either map those properties or explicitly excluded them from the model." + + + + + NotSupportedException with message like "Unable to determine the provider name for connection of type '{0}'." + + + + + ArgumentException with message like "The qualified table name '{0}' contains an invalid schema name. Schema names must have a non-zero length." + + + + + ArgumentException with message like "The qualified table name '{0}' contains an invalid table name. Table names must have a non-zero length." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. Ensure the MapInheritedProperties method is only used during one call to the Map method." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. Ensure the Properties method is used and that repeated calls specify each non-key property only once." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. The non-key property '{1}' is mapped more than once. Ensure the Properties method specifies each non-key property only once." + + + + + InvalidOperationException with message like "The property '{1}' on type '{0}' cannot be mapped because it has been explicitly excluded from the model or it is of a type not supported by the DbModelBuilderVersion being used." + + + + + InvalidOperationException with message like "The entity types '{0}' and '{1}' cannot share table '{2}' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them." + + + + + InvalidOperationException with message like "You cannot use Ignore method on the property '{0}' on type '{1}' because this type inherits from the type '{2}' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type." + + + + + InvalidOperationException with message like "The property '{0}' cannot be used as a key property on the entity '{1}' because the property type is not a valid key type. Only scalar types, string and byte[] are supported key types." + + + + + InvalidOperationException with message like "The specified table '{0}' was not found in the model. Ensure that the table name has been correctly specified." + + + + + InvalidOperationException with message like "The specified association foreign key columns '{0}' are invalid. The number of columns specified must match the number of primary key columns." + + + + + InvalidOperationException with message like "A circular ComplexType hierarchy was detected. Self-referencing ComplexTypes are not supported." + + + + + InvalidOperationException with message like "Unable to determine the principal end of an association between the types '{0}' and '{1}'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." + + + + + InvalidOperationException with message like "The abstract type '{0}' has no mapped descendents and so cannot be mapped. Either remove '{0}' from the model or add one or more types deriving from '{0}' to the model. " + + + + + NotSupportedException with message like "The type '{0}' cannot be mapped as defined because it maps inherited properties from types that use entity splitting or another form of inheritance. Either choose a different inheritance mapping strategy so as to not map inherited properties, or change all types in the hierarchy to map inherited properties and to not use splitting. " + + + + + InvalidOperationException with message like "The table '{0}' was configured but is not used in any mappings. Verify the mapping configuration for '{0}' is correct." + + + + + InvalidOperationException with message like "The configured column orders for the table '{0}' contains duplicates. Ensure the specified column order values are distinct." + + + + + NotSupportedException with message like "The enum or spatial property '{1}' on type '{0}' cannot be mapped. Use DbModelBuilderVersion 'V5_0' or later to map enum or spatial properties." + + + + + InvalidOperationException with message like "Multiple potential primary key properties named '{0}' but differing only by case were found on entity type '{1}'. Configure the primary key explicitly using the HasKey fluent API or the KeyAttribute data annotation." + + + + + InvalidOperationException with message like "Cannot get value for property '{0}' from entity of type '{1}' because the property has no get accessor." + + + + + InvalidOperationException with message like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor." + + + + + + NotSupportedException with message like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor and is in the '{2}' state." + + + + + InvalidOperationException with message like "Member '{0}' cannot be called for property '{1}' on entity of type '{2}' because the property is not part of the Entity Data Model." + + + + + + ArgumentException with message like "Cannot call the {0} method for an entity of type '{1}' on a DbSet for entities of type '{2}'. Only entities of type '{2}' or derived from type '{2}' can be added, attached, or removed." + + + + + ArgumentException with message like "Cannot call the Create method for the type '{0}' on a DbSet for entities of type '{1}'. Only entities of type '{1}' or derived from type '{1}' can be created." + + + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is a collection navigation property. The Collection method should be used instead of the Reference method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is a reference navigation property. The Reference method should be used instead of the Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a navigation property. The Reference and Collection methods can only be used with navigation properties. Use the Property or ComplexProperty method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a complex property. The ComplexProperty method can only be used with complex properties. Use the Property, Reference or Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a primitive property, complex property, collection navigation property, or reference navigation property." + + + + + ArgumentException with message like ""The property '{0}' from the property path '{1}' is not a complex property on type '{2}'. Property paths must be composed of complex properties for all except the final property."" + + + + + NotSupportedException with message like "Setting IsModified to false for a modified property is not supported." + + + + + ArgumentException with message like ""The property path '{0}' cannot be used for navigation properties. Property paths can only be used to access primitive or complex properties."" + + + + + ArgumentException with message like "The navigation property '{0}' on entity type '{1}' cannot be used for entities of type '{2}' because it refers to entities of type '{3}'." + + + + + ArgumentException with message like "The generic type argument '{0}' cannot be used with the Member method when accessing the collection navigation property '{1}' on entity type '{2}'. The generic type argument '{3}' must be used instead." + + + + + ArgumentException with message like "The property '{0}' on entity type '{1}' cannot be used for objects of type '{2}' because it is a property for objects of type '{3}'." + + + + + ArgumentException with message like "The expression passed to method {0} must represent a property defined on the type '{1}'." + + + + + InvalidOperationException with message like "{0} cannot be used for entities in the {1} state." + + + + + InvalidOperationException with message like "Cannot set non-nullable property '{0}' of type '{1}' to null on object of type '{2}'." + + + + + InvalidOperationException with message like "The property '{0}' in the entity of type '{1}' is null. Store values cannot be obtained for an entity with a null complex property." + + + + + InvalidOperationException with message like "Cannot assign value of type '{0}' to property '{1}' of type '{2}' in property values for type '{3}'." + + + + + NotSupportedException with message like "The set of property value names is read-only." + + + + + ArgumentException with message like "The '{0}' property does not exist or is not mapped for the type '{1}'." + + + + + ArgumentException with message like "Cannot copy values from DbPropertyValues for type '{0}' into DbPropertyValues for type '{1}'." + + + + + ArgumentException with message like "Cannot copy from property values for object of type '{0}' into property values for object of type '{1}'." + + + + + ArgumentException with message like "A property of a complex type must be set to an instance of the generic or non-generic DbPropertyValues class for that type." + + + + + InvalidOperationException with message like "The value of the complex property '{0}' on entity of type '{1}' is null. Complex properties cannot be set to null and values cannot be set for null complex properties." + + + + + InvalidOperationException with message like "The value of the nested property values property '{0}' on the values for entity of type '{1}' is null. Nested property values cannot be set to null and values cannot be set for null complex properties." + + + + + InvalidOperationException with message like "Cannot set the value of the nested property '{0}' because value of the complex property '{1}' to which it belongs is null." + + + + + InvalidOperationException with message like "Cannot set the original value of the nested property '{0}' because the original value of the complex property '{1}' to which it belongs is null." + + + + + InvalidOperationException with message like "The model backing the '{0}' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)." + + + + + InvalidOperationException with message like "Database '{0}' cannot be created because it already exists." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the DbContext instance was not created using Code First patterns. DbContext instances created from an ObjectContext or using an EDMX file cannot be checked for compatibility." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations." + + + + + + + InvalidOperationException with message like "Failed to set database initializer of type '{0}' for DbContext type '{1}' specified in the application configuration. See inner exception for details." + + + + + InvalidOperationException with message like "Configuration for DbContext type '{0}' is specified multiple times in the application configuration. Each context can only be configured once." + + + + + InvalidOperationException with message like "Failed to set Database.DefaultConnectionFactory to an instance of the '{0}' type as specified in the application configuration. See inner exception for details." + + + + + InvalidOperationException with message like "The type '{0}' could not be found. The type name must be an assembly-qualified name." + + + + + InvalidOperationException with message like "The context cannot be used while the model is being created." + + + + + InvalidOperationException with message like "The DbContext class cannot be used with models that have multiple entity sets per type (MEST)." + + + + + InvalidOperationException with message like "The operation cannot be completed because the DbContext has been disposed." + + + + + InvalidOperationException with message like "The provider factory returned a null connection." + + + + + InvalidOperationException with message like "The connection string '{0}' in the application's configuration file does not contain the required providerName attribute."" + + + + + InvalidOperationException with message like "The DbConnectionFactory instance returned a null connection." + + + + + ArgumentException with message like "The number of primary key values passed must match number of primary key values defined on the entity." + + + + + ArgumentException with message like "The type of one of the primary key values did not match the type defined in the entity. See inner exception for details." + + + + + InvalidOperationException with message like "The entity found was of type {0} when an entity of type {1} was requested." + + + + + InvalidOperationException with message like "Multiple entities were found in the Added state that match the given primary key values." + + + + + InvalidOperationException with message like "The type '{0}' is mapped as a complex type. The Set method, DbSet objects, and DbEntityEntry objects can only be used with entity types, not complex types." + + + + + InvalidOperationException with message like "The type '{0}' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute." + + + + + InvalidOperationException with message like "The entity type {0} is not part of the model for the current context." + + + + + NotSupportedException with message like "Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList()." + + + + + ArgumentException with message like "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties." + + + + + InvalidOperationException with message like "No connection string named '{0}' could be found in the application config file." + + + + + InvalidOperationException with message like "Cannot initialize a DbContext from an entity connection string or an EntityConnection instance together with a DbCompiledModel. If an entity connection string or EntityConnection instance is used, then the model will be created from the metadata in the connection. If a DbCompiledModel is used, then the connection supplied should be a standard database connection (for example, a SqlConnection instance) rather than an entity connection." + + + + + NotSupportedException with message like "The collection navigation property '{0}' on the entity of type '{1}' cannot be set because the entity type does not define a navigation property with a set accessor." + + + + + NotSupportedException with message like "Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used." + + + + + InvalidOperationException with message like "Multiple object sets per type are not supported. The object sets '{0}' and '{1}' can both contain instances of type '{2}'." + + + + + InvalidOperationException with message like "The context type '{0}' must have a public constructor taking an EntityConnection." + + + + + NotSupportedException with message like "The database name '{0}' is not supported because it is an MDF file name. A full connection string must be provided to attach an MDF file." + + + + + DataException with message like "An exception occurred while initializing the database. See the InnerException for details." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing ObjectContext is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing DbCompiledModel is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + InvalidOperationException with message like "The context factory type '{0}' must have a public default constructor." + + + + + InvalidOperationException with message like "The generic 'Set' method cannot be called with a proxy type. Either use the actual entity type or call the non-generic 'Set' method." + + + + + InvalidOperationException with message like "MaxLengthAttribute must have a Length value that is greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "MinLengthAttribute must have a Length value that is zero or greater." + + + + + InvalidOperationException with message like "No connection string named '{0}' could be found in the application config file." + + + + + InvalidOperationException with message like "The connection can not be overridden because this context was created from an existing ObjectContext." + + + + + InvalidOperationException with message like "Can not override the connection for this context with a standard DbConnection because the original connection was an EntityConnection." + + + + + InvalidOperationException with message like "Can not override the connection for this context with an EntityConnection because the original connection was a standard DbConnection." + + + + + The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument. + + + + + The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method. + + + + + The exception that is thrown when the author has yet to implement the logic at this point in the program. This can act as an exception based TODO tag. + + + + + The exception that is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or write to a stream that does not support the invoked functionality. + + + + + AutoGenerated resource class. Usage: + + string s = EntityRes.GetString(EntityRes.MyIdenfitier); + + + + + Allows the construction and modification of a user-specified annotation (name-value pair) on a instance. + + + + + Gets or sets an optional namespace that can be used to distinguish the annotation from others with the same value. + + + + + Gets or sets the name of the annotation. + + + + + Gets or sets the value of the annotation. + + + + + + + + + DataModelEventArgs is the base argument type for all events raised by consumers of Entity Data Model (EDM) models. + + + + + Gets a value indicating the that caused the event to be raised. + + + + + Gets an optional value indicating which property of the source item caused the event to be raised. + + + + + Gets a value that identifies the specific error that is being raised. + + + + + Gets an optional descriptive message the describes the error that is being raised. + + + + + DbAliasedMetadataItem provides the base type for all Database Metadata types that can have an optional that should be used instead of the item's when referring to the item in the database. + + + + + NamedDbItem is the base for all types in the Database Metadata construction and modification API with a property. + + + + + The base for all all Database Metadata types that support annotation using . + + + + + DbDataModelItem is the base for all types in the Database Metadata construction and modification API. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets or sets the currently assigned name. + + + + + Gets an optional alternative identifier that should be used when referring to this item in the database. + + + + + When implemented in derived types, allows the construction and modification of a column in a Database Metadata table or row. + + + + + Gets or sets a string indicating the database-specific type of the column. + + + + + Gets or sets a value indicating whether the column is nullable. + + + + + Gets or sets an optional instance that applies additional constraints to the referenced database-specific type of the column. + + + + + Allows the construction and modification of a database in a Database Metadata model. + + + + + Gets or sets an optional value that indicates the database model version. + + + + + Gets or sets the collection of instances that specifies the schemas within the database. + + + + + Allows the construction and modification of a foreign key constraint sourced by a instance. + + + + + Gets or sets the to take when a delete operation is attempted. + + + + + Indicates which Database Metadata concept is represented by a given item. + + + + + Database Kind + + + + + Schema Kind + + + + + Foreign Key Constraint Kind + + + + + Function Kind + + + + + Function Parameter Kind + + + + + Function Return or Parameter Type Kind + + + + + Row Column Kind + + + + + Table Kind + + + + + Table Column Kind + + + + + Primitive Facets Kind + + + + + Specifies the action to take on a given operation. + + + + + Default behavior + + + + + Restrict the operation + + + + + Cascade the operation + + + + + Allows the construction and modification of additional constraints that can be applied to a specific use of a primitive type in a Database Metadata item. + + + + + Returns true if any facet value property currently has a non-null value; otherwise returns false . + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have a fixed or variable length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have its intrinsic maximum length, rather than a specific value. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to be Unicode or non-Unicode. + + + + + Gets or sets an optional value indicating the current constraint on the type's maximum length. + + + + + Gets or sets an optional value indicating the current constraint on the type's precision. + + + + + Gets or sets an optional value indicating the current constraint on the type's scale. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating whether the spatial type is to be type checked strictly. + + + + + Allows the construction and modification of a database schema in a database model. + + + + + Gets or sets the collection of instances that specifies the tables declared within the schema. + + + + + DbSchemaMetadataItem is the base for all types that can be contained in a schema. + + + + + Allows the construction and modification of a column in a table. + + + + + Gets or sets a value indicating whether the column is part of the table's primary key. + + + + + Gets or sets a value indicating if and how the value of the column is automatically generated. + + + + + Gets or sets an optional value indicating the collation specific to this table column. + + + + + Gets or sets an optional value that specifies the default value for the column. + + + + + Allows the construction and modification a table in a database schema. + + + + + Gets or sets the collection of instances that specifies the columns present within the table. + + + + + Gets or sets the collection of instances from the collection of the table that are part of the primary key. + + + + + Gets or sets the collection of instances that defines the foreign key constraints sourced from the table. + + + + + Represents a specific use of a type in a Database Metadata item. + + + + + Gets or sets an optional instance that applies additional constraints to a referenced primitive type. + + + Accessing this property forces the creation of a DbPrimitiveTypeFacets value if no value has previously been set. Use to determine whether or not this property currently has a value. + + + + + Gets or sets a value indicating whether the represented type is a collection type. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered nullable. + + + + + Gets a value indicating whether the type has been configured as a row type by the addition of one or more RowColumns. + + + + + Represents the mapping of an EDM association end ( ) as a collection of property mappings ( ). + + + + + DbMappingMetadataItem is the base for all types in the EDM-to-Database Mapping construction and modification API that support annotation using . + + + + + DbMappingModelItem is the base for all types in the EDM-to-Database Mapping construction and modification API. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets an value representing the association end that is being mapped. + + + + + Gets the collection of s that specifies how the association end key properties are mapped to the table. + + + + + Gets an value representing the association set that is being mapped. + + + + + Gets a value representing the table to which the entity type's properties are being mapped. + + + + + Gets the collection of s that specifies the constant or null values that columns in must have for this type mapping to apply. + + + + + Allows the construction and modification of a condition for a column in a database table. + + + + + Gets or sets a value representing the table column which must contain for this condition to hold. + + + + + Gets or sets the value that must contain for this condition to hold. + + + + + Gets or sets an value representing the model that is being mapped. + + + + + Gets or sets a value representing the database that is the target of the mapping. + + + + + Gets or sets the collection of s that specifies how the model's entity containers are mapped to the database. + + + + + Represents the mapping of an entity property to a column in a database table. + + + + + Gets or sets the collection of instances that defines the mapped property, beginning from a property declared by the mapped entity type and optionally proceeding through properties of complex property result types. + + + + + Gets or sets a value representing the table column to which the entity property is being mapped. + + + + + Allows the construction and modification of the mapping of an EDM entity container ( ) to a database ( ). + + + + + Gets or sets an value representing the entity container that is being mapped. + + + + + Gets or sets the collection of s that specifies how the container's entity sets are mapped to the database. + + + + + Gets the collection of s that specifies how the container's association sets are mapped to the database. + + + + + Allows the construction and modification of the mapping of an EDM entity set ( ) to a database ( ). + + + + + Gets or sets an value representing the entity set that is being mapped. + + + + + Gets or sets the collection of s that specifies how the set's entity types are mapped to the database. + + + + + Allows the construction and modification of a complete or partial mapping of an EDM entity type ( ) or type hierarchy to a specific database table ( ). + + + + + Gets or sets an value representing the entity type or hierarchy that is being mapped. + + + + + Gets or sets a value indicating whether this type mapping applies to and all its direct or indirect subtypes ( true ), or only to ( false ). + + + + + Gets a value representing the table to which the entity type's properties are being mapped. + + + + + Gets the collection of s that specifies how the type's properties are mapped to the table. + + + + + Gets the collection of s that specifies the constant or null values that columns in must have for this type mapping fragment to apply. + + + + + Indicates which EDM-to-Database Mapping concept is represented by a given item. + + + + + Database Mapping Kind + + + + + Entity Container Mapping Kind + + + + + Entity Set Mapping Kind + + + + + Association Set Mapping Kind + + + + + Entity Type Mapping Kind + + + + + Query View Mapping Kind + + + + + Entity Type Mapping Fragment Kind + + + + + Edm Property Mapping Kind + + + + + Association End Mapping Kind + + + + + Column Condition Kind + + + + + Property Condition Kind + + + + + Allows the construction and modification of a constraint applied to an Entity Data Model (EDM) association. + + + + + Gets or sets the that represents the 'dependent' end of the constraint; properties from this association end's entity type contribute to the collection. + + + + + Gets or sets the collection of instances from the of the constraint. The values of these properties are constrained against the primary key values of the remaining, 'principal' association end's entity type. + + + + + Allows the construction and modification of one end of an Entity Data Model (EDM) association. + + + + + Gets or sets the entity type referenced by this association end. + + + + + Gets or sets the of this association end, which indicates the multiplicity of the end and whether or not it is required. + + + + + Gets or sets the to take when a delete operation is attempted. + + + + + Indicates the multiplicity of an and whether or not it is required. + + + + + Allows the construction and modification of an association set in an Entity Data Model (EDM) ). + + + + + Represents an item in an Entity Data Model (EDM) . + + + + + Gets or sets the that specifies the association type for the set. + + + + + Gets or sets the that specifies the entity set corresponding to the association end for this association set. + + + + + Gets or sets the that specifies the entity set corresponding to the association end for this association set. + + + + + + The base for all all Entity Data Model (EDM) types that represent a structured type from the EDM type system. + + + + + Gets or sets the that defines the source end of the association. + + + + + Gets or sets the that defines the target end of the association. + + + + + Gets or sets the optional constraint that indicates whether the relationship is an independent association (no constraint present) or a foreign key relationship ( specified). + + + + + Collection semantics for properties. + + + + + The property does not have a collection type or does not specify explicit collection semantics. + + + + + The property is an unordered collection that may contain duplicates. + + + + + The property is an ordered collection that may contain duplicates. + + + + + Allows the construction and modification of a complex type in an Entity Data Model (EDM) . + + + + + Gets or sets the optional that indicates the base complex type of the complex type. + + + + + Gets or sets a value indicating whether the complex type is abstract. + + + + + Gets or sets the collection of instances that describe the (scalar or complex) properties of the complex type. + + + + + Concurrency mode for properties. + + + + + Default concurrency mode: the property is never validated at write time + + + + + Fixed concurrency mode: the property is always validated at write time + + + + + Allows the construction and modification of an entity container in an Entity Data Model (EDM) . + + + + + Gets all s declared within the namspace. Includes s and s. + + + + + Gets or sets the collection of s that specifies the association sets within the container. + + + + + Gets or sets the collection of s that specifies the entity sets within the container. + + + + + Allows the construction and modification of an entity set in an Entity Data Model (EDM) . + + + + + Gets or sets the that specifies the entity type for the set. + + + + + Allows the construction and modification of an entity type in an Entity Data Model (EDM) . + + + + + Gets or sets the optional that indicates the base entity type of the entity type. + + + + + Gets or sets a value indicating whether the entity type is abstract. + + + + + Gets or sets the collection of s that specifies the properties declared by the entity type. + + + + + Gets or sets the collection of s that indicates which properties from the collection are part of the entity key. + + + + + Gets or sets the optional collection of s that specifies the navigation properties declared by the entity type. + + + + + Indicates which Entity Data Model (EDM) concept is represented by a given item. + + + + + Association End Kind + + + + + Association Set Kind + + + + + Association Type Kind + + + + + Collection Type Kind + + + + + Complex Type Kind + + + + + Entity Container Kind + + + + + Entity Set Kind + + + + + Entity Type Kind + + + + + Function Group Kind + + + + + Function Overload Kind + + + + + Function Import Kind + + + + + Function Parameter Kind + + + + + Navigation Property Kind + + + + + EdmProperty Type Kind + + + + + Association Constraint Type Kind + + + + + Ref Type Kind + + + + + Row Column Kind + + + + + Row Type Kind + + + + + Type Reference Kind + + + + + Model Kind + + + + + Namespace Kind + + + + + Primitive Facets Kind + + + + + Primitive Type Kind + + + + + Enum Type Kind + + + + + Enum Type Member Kind + + + + + EdmModel is the top-level container for namespaces and entity containers belonging to the same logical Entity Data Model (EDM) model. + + + + + Gets or sets an optional value that indicates the entity model version. + + + + + Gets or sets the containers declared within the model. + + + + + Gets or sets the namespaces declared within the model. + + + + + Allows the construction and modification of a namespace in an . + + + + + Gets all s declared within the namspace. Includes s, s, s. + + + + + Gets or sets the s declared within the namespace. + + + + + Gets or sets the s declared within the namespace. + + + + + Gets or sets the s declared within the namespace. + + + + + Allows the construction and modification of an Entity Data Model (EDM) navigation property. + + + + + Gets or sets the that specifies the association over which navigation takes place. + + + + + Gets or sets the that specifies which association end is the 'destination' end of the navigation and produces the navigation property result. + + + + + Specifies the action to take on a given operation. + + + + + Default behavior + + + + + Restrict the operation + + + + + Cascade the operation + + + + + Represents one of the fixed set of Entity Data Model (EDM) primitive types. + + + + + The base for all all Entity Data Model (EDM) types that represent a scalar type from the EDM type system. + + + + + Retrieves the EdmPrimitiveType instance with the corresponding to the specified value, if any. + + The name of the primitive type instance to retrieve + The EdmPrimitiveType with the specified name, if successful; otherwise null . + true if the given name corresponds to an EDM primitive type name; otherwise false . + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets an value that indicates which Entity Data Model (EDM) primitive type this type represents. + + + + + Allows the construction and modification of additional constraints that can be applied to a specific use of a primitive type in an Entity Data Model (EDM) item. See . + + + + + Returns true if any facet value property currently has a non-null value; otherwise returns false . + + + + + Gets or sets an optional value indicating the current constraint on the type's maximum length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have its intrinsic maximum length, rather than a specific value. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have a fixed or variable length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to be Unicode or non-Unicode. + + + + + Gets or sets an optional value indicating the current constraint on the type's precision. + + + + + Gets or sets an optional value indicating the current constraint on the type's scale. + + + + + Gets or sets an optional value indicating that the current spatial type's SRID is unconstrained. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating whether the spatial type is to be type checked strictly. + + + + + Primitive Types as defined by the Entity Data Model (EDM). + + + + + Binary Type Kind + + + + + Boolean Type Kind + + + + + Byte Type Kind + + + + + DateTime Type Kind + + + + + Decimal Type Kind + + + + + Double Type Kind + + + + + Guid Type Kind + + + + + Single Type Kind + + + + + SByte Type Kind + + + + + Int16 Type Kind + + + + + Int32 Type Kind + + + + + Int64 Type Kind + + + + + String Type Kind + + + + + Time Type Kind + + + + + DateTimeOffset Type Kind + + + + + Geometry Type Kind + + + + + Geography Type Kind + + + + + Geometric point type kind + + + + + Geometric linestring type kind + + + + + Geometric polygon type kind + + + + + Geometric multi-point type kind + + + + + Geometric multi-linestring type kind + + + + + Geometric multi-polygon type kind + + + + + Geometric collection type kind + + + + + Geographic point type kind + + + + + Geographic linestring type kind + + + + + Geographic polygon type kind + + + + + Geographic multi-point type kind + + + + + Geographic multi-linestring type kind + + + + + Geographic multi-polygon type kind + + + + + Geographic collection type kind + + + + + Allows the construction and modification of a primitive- or complex-valued property of an Entity Data Model (EDM) entity or complex type. + + + + + Gets or sets an value that indicates which collection semantics - if any - apply to the property. + + + + + Gets or sets a value that indicates whether the property is used for concurrency validation. + + + + + Gets or sets on optional value that indicates an initial default value for the property. + + + + + Gets or sets an that specifies the result type of the property. + + + + + Enumerates all s declared or inherited by an . + + + + + Allows the construction and modification of a specific use of a type in an Entity Data Model (EDM) item. See for examples. + + + + + Gets or sets a value indicating the collection rank of the type reference. A collection rank greater than zero indicates that the type reference represents a collection of its referenced . + + + + + Gets or sets a value indicating the referenced by this type reference. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered nullable. + + + + + Gets or sets an optional instance that applies additional constraints to a referenced primitive type. + + + Accessing this property forces the creation of an EdmPrimitiveTypeFacets value if no value has previously been set. Use to determine whether or not this property currently has a value. + + + + + Gets a value indicating whether the property of this type reference has been assigned an value with at least one facet value specified. + + + + + Indicates whether this type reference represents a collection of its referenced (when is greater than zero) or not. + + + + + Indicates whether the property of this type reference currently refers to an , is not a collection type, and does not have primitive facet values specified. + + + + + Gets the currently referred to by this type reference, or null if the type reference is a collection type or does not refer to a complex type. + + + + + Indicates whether the property of this type reference currently refers to an and is not a collection type. + + + + + Gets the currently referred to by this type reference, or null if the type reference is a collection type or does not refer to a primitive type. + + + + + Contains constant values that apply to the EDM model, regardless of source (for CSDL specific constants see ). + + + + + Parsing code taken from System.dll's System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(string) method to avoid LinkDemand needed to call this method + + + + + + + + + + + Constants for CSDL XML. + + + + + Constants for C-S MSL XML. + + + + + Constants for SSDL XML. + + + + + The acceptable range for this enum is 0000 - 0999; the range 10,000-15,000 is reserved for tools. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Precision out of range + + + + + Scale out of range + + + + + + + + + + + + + One of the required facets is missing + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The facet isn't allow by the property type. + + + + + This facet value is constant and is specified in the schema + + + + + + + + + + + + + Multiplicity value was malformed + + + + + The value for the Action attribute is invalid or not allowed in the current context + + + + + An error occurred processing the On<Operation> elements + + + + + Ends were given for the Property element of a EntityContainer that is not a RelationshipSet + + + + + The extent name used in the EntittyContainerType End does not match the name of any of the EntityContainerProperties in the containing EntityContainer + + + + + An end element was not given, and cannot be inferred because too many EntityContainerEntitySet elements that are good possibilities. + + + + + An end element was not given, and cannot be inferred because there is no EntityContainerEntitySets that are the correct type to be used as an EntitySet. + + + + + Not a valid parameter direction for the parameter in a function + + + + + Unable to infer an optional schema part, to resolve this; be more explicit + + + + + Invalid facet attribute(s) specified in provider manifest + + + + + Invalid role value in the relationship constraint + + + + + Invalid Property in relationship constraint + + + + + Type mismatch between ToProperty and FromProperty in the relationship constraint + + + + + Invalid multiplicity in FromRole in the relationship constraint + + + + + The number of properties in the FromProperty and ToProperty in the relationship constraint must be identical + + + + + No Properties defined in either FromProperty or ToProperty in the relationship constraint + + + + + Missing constraint in relationship type in ssdl + + + + + Same role referred in the ToRole and FromRole of a referential constraint + + + + + Invalid value for attribute ParameterTypeSemantics + + + + + Invalid type used for a Relationship End Type + + + + + Invalid PrimitiveTypeKind + + + + + Invalid TypeConversion DestinationType + + + + + Expected a integer value between 0 - 255 + + + + + Invalid Type specified in function + + + + + Precision must not be greater than 28 + + + + + Properties that are part of entity key must be of scalar type + + + + + Binary type properties which are part of entity key are currently not supported + + + + + The primitive type kind does not have a preferred mapping + + + + + More than one PreferredMapping for a PrimitiveTypeKind + + + + + End with * multiplicity cannot have operations specified + + + + + EntitySet type has no keys + + + + + InvalidNumberOfParametersForAggregateFunction + + + + + InvalidParameterTypeForAggregateFunction + + + + + Composable functions must declare a return type. + + + + + Non-composable functions must not declare a return type. + + + + + Non-composable functions do not permit the aggregate; niladic; or built-in attributes. + + + + + Composable functions can not include command text attribute. + + + + + Functions should not declare both a store name and command text (only one or the other can be used). + + + + + SystemNamespace + + + + + Empty DefiningQuery text + + + + + Schema, Table and DefiningQuery are all specified, and are mutually exclusive + + + + + ConcurrencyMode value was malformed + + + + + Concurrency can't change for any sub types of an EntitySet type. + + + + + Function import return type must be either empty, a collection of entities, or a singleton scalar. + + + + + Function import specifies a non-existent entity set. + + + + + Function import specifies entity type return but no entity set. + + + + + Function import specifies entity type that does not derive from element type of entity set. + + + + + Function import specifies a binding to an entity set but does not return entities. + + + + + InternalError + + + + + Same Entity Set Taking part in the same role of the relationship set in two different relationship sets + + + + + Entity key refers to the same property twice + + + + + Function declares a ReturnType attribute and element + + + + + Nullable Complex Type not supported in Edm V1 + + + + + Only Complex Collections supported in Edm V1.1 + + + + + No Key defined on Entity Type + + + + + Invalid namespace specified in using element + + + + + Need not specify system namespace in using + + + + + Cannot use a reserved/system namespace as alias + + + + + Invalid qualification specified for type + + + + + Invalid Entity Container Name in extends attribute + + + + + Invalid CollectionKind value in property CollectionKind attribute + + + + + Must specify namespace or alias of the schema in which this type is defined + + + + + Entity Container cannot extend itself + + + + + Failed to retrieve provider manifest + + + + + Mismatched Provider Manifest token values in SSDL artifacts + + + + + Missing Provider Manifest token value in SSDL artifact(s) + + + + + Empty CommandText element + + + + + Inconsistent Provider values in SSDL artifacts + + + + + Inconsistent Provider Manifest token values in SSDL artifacts + + + + + Duplicated Function overloads + + + + + InvalidProvider + + + + + FunctionWithNonEdmTypeNotSupported + + + + + ComplexTypeAsReturnTypeAndDefinedEntitySet + + + + + ComplexTypeAsReturnTypeAndDefinedEntitySet + + + + unused 179, + unused 180, + unused 181, + + In model functions facet attribute is allowed only on ScalarTypes + + + + + Captures several conditions where facets are placed on element where it should not exist. + + + + + Return type has not been declared + + + + + Invalid value in the EnumTypeOption + + + + + The structural annotation cannot use codegen namespaces + + + + + Function and type cannot have the same fully qualified name + + + + + Cannot load different version of schema in the same ItemCollection + + + + + Expected bool value + + + + + End without Multiplicity specified + + + + + In SSDL, if composable function returns a collection of rows (TVF), all row properties must be of scalar types. + + + + + The name of NamedEdmItem must not be empty or white space only + + + + + EdmTypeReference is empty + + Unused 199; + + + + Serializes an that conforms to the restrictions of a single CSDL schema file to an XML writer. The model to be serialized must contain a single and a single . + + + + + Serialize the to the XmlWriter. + + The EdmModel to serialize, mut have only one and one + The XmlWriter to serialize to + + + + Serialize the to the XmlWriter + + The DbModel to serialize + The XmlWriter to serialize to + + + + Serialize the to the + + The DbDatabaseMetadata to serialize + Provider information on the Schema element + ProviderManifestToken information on the Schema element + The XmlWriter to serialize to + + + + + author/email + + + + + author/name + + + + + author/uri + + + + + published + + + + + rights + + + + + summary + + + + + title + + + + + contributor/email + + + + + contributor/name + + + + + contributor/uri + + + + + category/@label + + + + + Plaintext + + + + + HTML + + + + + XHTML + + + + + updated + + + + + link/@href + + + + + link/@rel + + + + + link/@type + + + + + link/@hreflang + + + + + link/@title + + + + + link/@length + + + + + category/@term + + + + + category/@scheme + + + + + Return role name pair + + + + + + + + The context for DataModel Validation + + + + + Returns true if the given two ends are similar - the relationship type that this ends belongs to is the same and the entity set refered by the ends are same and they are from the same role + + + + + + + + Return true if the Referential Constraint on the association is ready for further validation, otherwise return false. + + + + + + + Resolves the given property names to the property in the item Also checks whether the properties form the key for the given type and whether all the properties are nullable or not + + + + + + + + + + + Return true if the namespaceName is a Edm System Namespace + + + + + + + Return true if the entityType is a subtype of any entity type in the dictionary keys, and return the corresponding entry EntitySet value. Otherwise return false. + + + + + + + + + Return true if any of the properties in the EdmEntityType defines ConcurrencyMode. Otherwise return false. + + + + + + + Add member name to the Hash set, raise an error if the name exists already. + + + + + + + + + If the string is null, empty, or only whitespace, return false, otherwise return true + + + + + + + Determine if a cycle exists in the type hierarchy: use two pointers to walk the chain, if one catches up with the other, we have a cycle. + + true if a cycle exists in the type hierarchy, false otherwise + + + + RuleSet for DataModel Validation + + + + + Get the related rules given certain DataModelItem + + The to validate + A collection of + + + + Data Model Validator + + + + + Validate the and all of its properties given certain version. + + The root of the model to be validated + True to validate the syntax, otherwise false + + + + The RuleSet for EdmModel + + + + + Get based on version + + a double value of version + + + + + The context for EdmModel Validation + + + + + Visitor for EdmModel Validation + + + + + Edm Model Validator + + + + + validate the from the root with the context + + The root to validate from + The validation context + + + + An implementation of IDatabaseInitializer that will recreate and optionally re-seed the + database only if the database does not exist. + To seed the database, create a derived class and override the Seed method. + + The type of the context. + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + An instances of this class is obtained from an object and can be used + to manage the actual database backing a DbContext or connection. + This includes creating, deleting, and checking for the existence of a database. + Note that deletion and checking for existence of a database can be performed using just a + connection (i.e. without a full context) by using the static methods of this class. + + + + + Creates a Database backed by the given context. This object can be used to create a database, + check for database existence, and delete a database. + + The context that defines the database connection and model. + + + + Gets or sets the database initialization strategy. The database initialization strategy is called when instance + is initialized from a . The strategy can optionally check for database existence, create a new database, and + seed the database with data. + The default strategy is an instance of . + + The type of the context. + The strategy. + The database creation strategy. + + + + Internal version of SetInitializer that allows the strategy to be locked such that it cannot be replaced + by another call to SetInitializer. This allows strategies set in the app.config to win over strategies set + in code. + + The type of the context. + The strategy. + if set to true then the strategy is locked. + + + + Runs the the registered on this context. + + If "force" is set to true, then the initializer is run regardless of whether or not it + has been run before. This can be useful if a database is deleted while an app is running + and needs to be reinitialized. + + If "force" is set to false, then the initializer is only run if it has not already been + run for this context, model, and connection in this app domain. This method is typically + used when it is necessary to ensure that the database has been created and seeded + before starting some operation where doing so lazily will cause issues, such as when the + operation is part of a transaction. + + if set to true the initializer is run even if it has already been run. + + + + Checks whether or not the database is compatible with the the current Code First model. + + + Model compatibility currently uses the following rules. + + If the context was created using either the Model First or Database First approach then the + model is assumed to be compatible with the database and this method returns true. + + For Code First the model is considered compatible if the model is stored in the database + in the Migrations history table and that model has no differences from the current model as + determined by Migrations model differ. + + If the model is not stored in the database but an EF 4.1/4.2 model hash is found instead, + then this is used to check for compatibility. + + + If set to true then an exception will be thrown if no model metadata is found in + the database. If set to false then this method will return true if metadata + is not found. + + True if the model hash in the context and the database match; false otherwise. + + + + + Creates a new database on the database server for the model defined in the backing context. + Note that calling this method before the database initialization strategy has run will disable + executing that strategy. + + + + + Creates a new database on the database server for the model defined in the backing context, but only + if a database with the same name does not already exist on the server. + + True if the database did not exist and was created; false otherwise. + + + + Checks whether or not the database exists on the server. + + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + Calling this method from outside of an initializer will mark the database as having + not been initialized. This means that if an attempt is made to use the database again + after it has been deleted, then any initializer set will run again and, usually, will + try to create the database again automatically. + + True if the database did exist and was deleted; false otherwise. + + + + Checks whether or not the database exists on the server. + The connection to the database is created using the given database name or connection string + in the same way as is described in the documentation for the class. + + The database name or a connection string to the database. + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + The connection to the database is created using the given database name or connection string + in the same way as is described in the documentation for the class. + + The database name or a connection string to the database. + True if the database did exist and was deleted; false otherwise. + + + + Checks whether or not the database exists on the server. + + An existing connection to the database. + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + + An existing connection to the database. + True if the database did exist and was deleted; false otherwise. + + + + Resets the DefaultConnectionFactory to its initial value. + Currently, this method is only used by test code. + + + + + Performs the operation defined by the given delegate using the given lazy connection, ensuring + that the lazy connection is disposed after use. + + Information used to create a DbConnection. + The operation to perform. + The return value of the operation. + + + + Performs the operation defined by the given delegate against a connection. The connection + is either the connection accessed from the context backing this object, or is obtained from + the connection information passed to one of the static methods. + + The connection to use. + The operation to perform. + The return value of the operation. + + + + Returns an empty ObjectContext that can be used to perform delete/exists operations. + + The connection for which to create an ObjectContext + The empty context. + + + + Creates a raw SQL query that will return elements of the given generic type. + The type can be any type that has properties that match the names of the columns returned + from the query, or can be a simple primitive type. The type does not have to be an + entity type. The results of this query are never tracked by the context even if the + type of object returned is an entity type. Use the + method to return entities that are tracked by the context. + + The type of object returned by the query. + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Creates a raw SQL query that will return elements of the given type. + The type can be any type that has properties that match the names of the columns returned + from the query, or can be a simple primitive type. The type does not have to be an + entity type. The results of this query are never tracked by the context even if the + type of object returned is an entity type. Use the + method to return entities that are tracked by the context. + + The type of object returned by the query. + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Executes the given DDL/DML command against the database. + + The command string. + The parameters to apply to the command string. + The result returned by the database after executing the command. + + + + Returns the connection being used by this context. This may cause the + connection to be created if it does not already exist. + + Thrown if the context has been disposed. + + + + Returns the as a delegate that can be called with + an instance of the that owns this Database object, or returns null if + there is no initializer set for this context type. + + The initializer delegate or null. + + + + The connection factory to use when creating a from just + a database name or a connection string. + + + This is used when just a database name or connection string is given to or when + the no database name or connection is given to DbContext in which case the name of + the context class is passed to this factory in order to generate a DbConnection. + By default, the instance to use is read from the applications .config + file from the "EntityFramework DefaultConnectionFactory" entry in appSettings. If no entry is found in + the config file then is used. Setting this property in code + always overrides whatever value is found in the config file. + + + + + Checks wether or not the DefaultConnectionFactory has been set to something other than its default value. + + + + + + + Common code for generic and non-generic string Include. + + + + + + Returns a new query where the entities returned will not be cached in the + or . This method works by calling the AsNoTracking method of the + underlying query object. If the underlying query object does not have a AsNoTracking method, + then calling this method will have no affect. + + The element type. + The source query. + A new query with NoTracking applied, or the source query if NoTracking is not supported. + + + + Returns a new query where the entities returned will not be cached in the + or . This method works by calling the AsNoTracking method of the + underlying query object. If the underlying query object does not have a AsNoTracking method, + then calling this method will have no affect. + + The source query. + A new query with NoTracking applied, or the source query if NoTracking is not supported. + + + + Common code for generic and non-generic AsNoTracking. + + + + + Enumerates the query such that for server queries such as those of , , + , and others the results of the query will be loaded into the associated , + or other cache on the client. + This is equivalent to calling ToList and then throwing away the list without the overhead of actually creating the list. + + The source query. + + + + Returns an implementation that stays in sync with the given . + + The element type. + The collection that the binding list will stay in sync with. + The binding list. + + + + DbModelBuilder is used to map CLR classes to a database schema. + This code centric approach to building an Entity Data Model (EDM) model is known as 'Code First'. + + + DbModelBuilder is typically used to configure a model by overriding . + You can also use DbModelBuilder independently of DbContext to build a model and then construct a + or . + The recommended approach, however, is to use OnModelCreating in as + the workflow is more intuitive and takes care of common tasks, such as caching the created model. + + Types that form your model are registered with DbModelBuilder and optional configuration can be + performed by applying data annotations to your classes and/or using the fluent style DbModelBuilder + API. + + When the Build method is called a set of conventions are run to discover the initial model. + These conventions will automatically discover aspects of the model, such as primary keys, and + will also process any data annotations that were specified on your classes. Finally + any configuration that was performed using the DbModelBuilder API is applied. + + Configuration done via the DbModelBuilder API takes precedence over data annotations which + in turn take precedence over the default conventions. + + + + + Initializes a new instance of the class. + + The process of discovering the initial model will use the set of conventions included + in the most recent version of the Entity Framework installed on your machine. + + + Upgrading to newer versions of the Entity Framework may cause breaking changes + in your application because new conventions may cause the initial model to be + configured differently. There is an alternate constructor that allows a specific + version of conventions to be specified. + + + + + Initializes a new instance of the class that will use + a specific set of conventions to discover the initial model. + + The version of conventions to be used. + + + + Excludes a type from the model. This is used to remove types from the model that were added + by convention during initial model discovery. + + The type to be excluded. + The same DbModelBuilder instance so that multiple calls can be chained. + + + + Excludes a type(s) from the model. This is used to remove types from the model that were added + by convention during initial model discovery. + + The types to be excluded from the model. + The same DbModelBuilder instance so that multiple calls can be chained. + + + + Registers an entity type as part of the model and returns an object that can be used to + configure the entity. This method can be called multiple times for the same entity to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified entity type. + + + + Registers a type as an entity in the model and returns an object that can be used to + configure the entity. This method can be called multiple times for the same type to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified entity type. + + + + Registers a type as a complex type in the model and returns an object that can be used to + configure the complex type. This method can be called multiple times for the same type to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified complex type. + + + + Creates a based on the configuration performed using this builder. + The connection is used to determine the database provider being used as this + affects the database layer of the generated model. + + Connection to use to determine provider information. + The model that was built. + + + + Creates a based on the configuration performed using this builder. + Provider information must be specified because this affects the database layer of the generated model. + For SqlClient the invariant name is 'System.Data.SqlClient' and the manifest token is the version year (i.e. '2005', '2008' etc.) + + The database provider that the model will be used with. + The model that was built. + + + + Provides access to the settings of this DbModelBuilder that deal with conventions. + + + + + Gets the for this DbModelBuilder. + The registrar allows derived entity and complex type configurations to be registered with this builder. + + + + + A value from this enumeration can be provided directly to the + class or can be used in the applied to + a class derived from . The value used defines which version of + the DbContext and DbModelBuilder conventions should be used when building a model from + code--also know as "Code First". + + + Using DbModelBuilderVersion.Latest ensures that all the latest functionality is available + when upgrading to a new release of the Entity Framework. However, it may result in an + application behaving differently with the new release than it did with a previous release. + This can be avoided by using a specific version of the conventions, but if a version + other than the latest is set then not all the latest functionality will be available. + + + + + Indicates that the latest version of the and + conventions should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 4.1 + through 4.3 should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 5.0 + when targeting .NET 4 should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 5.0 + when targeting .NET 4.5 should be used. + + + + + This attribute can be applied to a class derived from to set which + version of the DbContext and conventions should be used when building + a model from code--also know as "Code First". See the + enumeration for details about DbModelBuilder versions. + + + If the attribute is missing from DbContextthen DbContext will always use the latest + version of the conventions. This is equivalent to using DbModelBuilderVersion.Latest. + + + + + Initializes a new instance of the class. + + The conventions version to use. + + + + Gets the conventions version. + + The conventions version. + + + + A non-generic version of which can be used when the type of entity + is not known at build time. + + + + + Represents a non-generic LINQ to Entities query against a DbContext. + + + + + An internal interface implemented by and that allows access to + the internal query without using reflection. + + + + + The underlying internal set. + + + + + Internal constructor prevents external classes deriving from DbQuery. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + Instead populate a DbSet with data, for example by using the Load extension method, and + then bind to local data. For WPF bind to DbSet.Local. For Windows Forms bind to + DbSet.Local.ToBindingList(). + + + Never returns; always throws. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Returns the equivalent generic object. + + The type of element for which the query was created. + The generic set object. + + + + Returns a representation of the underlying query. + + + The query string. + + + + + Returns false. + + false. + + + + The IQueryable element type. + + + + + The IQueryable LINQ Expression. + + + + + The IQueryable provider. + + + + + Gets the underlying internal query object. + + The internal query. + + + + The internal query object that is backing this DbQuery + + + + + An internal interface implemented by and that allows access to + the internal set without using reflection. + + + + + The underlying internal set. + + + + + Internal constructor prevents external classes deriving from DbSet. + + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Returns the equivalent generic object. + + The type of entity for which the set was created. + The generic set object. + + + + Creates a raw SQL query that will return entities in this set. By default, the + entities returned are tracked by the context; this can be changed by calling + AsNoTracking on the returned. + Note that the entities returned are always of the type for this set and never of + a derived type. If the table or tables queried may contain data for other entity + types, then the SQL query must be written appropriately to ensure that only entities of + the correct type are returned. + + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + The internal IQueryable that is backing this DbQuery + + + + + Gets the underlying internal set. + + The internal set. + + + + A DbSet represents the collection of all entities in the context, or that can be queried from the + database, of a given type. DbSet objects are created from a DbContext using the DbContext.Set method. + + + Note that DbSet does not support MEST (Multiple Entity Sets per Type) meaning that there is always a + one-to-one correlation between a type and a set. + + The type that defines the set. + + + + Represents a LINQ to Entities query against a DbContext. + + The type of entity to query for. + + + + Creates a new query that will be backed by the given internal query object. + + The backing query. + + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Throws an exception indicating that binding directly to a store query is not supported. + Instead populate a DbSet with data, for example by using the Load extension method, and + then bind to local data. For WPF bind to DbSet.Local. For Windows Forms bind to + DbSet.Local.ToBindingList(). + + + Never returns; always throws. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Returns a representation of the underlying query. + + + The query string. + + + + + Returns a new instance of the non-generic class for this query. + + A non-generic version. + + + + Returns false. + + false. + + + + The IQueryable element type. + + + + + The IQueryable LINQ Expression. + + + + + The IQueryable provider. + + + + + The internal query object that is backing this DbQuery + + + + + The internal query object that is backing this DbQuery + + + + + An IDbSet represents the collection of all entities in the context, or that can be queried from the + database, of a given type. DbSet is a concrete implementation of IDbSet. + + The type that defines the set. + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + Creates a new set that will be backed by the given . + + The internal set. + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Returns the equivalent non-generic object. + + The non-generic set object. + + + + Creates a raw SQL query that will return entities in this set. By default, the + entities returned are tracked by the context; this can be changed by calling + AsNoTracking on the returned. + Note that the entities returned are always of the type for this set and never of + a derived type. If the table or tables queried may contain data for other entity + types, then the SQL query must be written appropriately to ensure that only entities of + the correct type are returned. + + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + The internal IQueryable that is backing this DbQuery + + + + + An implementation of IDatabaseInitializer that will always recreate and optionally re-seed the + database the first time that a context is used in the app domain. + To seed the database, create a derived class and override the Seed method. + + The type of the context. + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + An implementation of IDatabaseInitializer that will DELETE, recreate, and optionally re-seed the + database only if the model has changed since the database was created. + + + Whether or not the model has changed is determined by the + method. + To seed the database create a derived class and override the Seed method. + + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + Returned by the ChangeTracker method of to provide access to features of + the context that are related to change tracking of entities. + + + + + Initializes a new instance of the class. + + The internal context. + + + + Gets objects for all the entities tracked by this context. + + The entries. + + + + Gets objects for all the entities of the given type + tracked by this context. + + The type of the entity. + The entries. + + + + Detects changes made to the properties and relationships of POCO entities. Note that some types of + entity (such as change tracking proxies and entities that derive from ) + report changes automatically and a call to DetectChanges is not normally needed for these types of entities. + Also note that normally DetectChanges is called automatically by many of the methods of + and its related classes such that it is rare that this method will need to be called explicitly. + However, it may be desirable, usually for performance reasons, to turn off this automatic calling of + DetectChanges using the AutoDetectChangesEnabled flag from . + + + + + A non-generic version of the class. + + + + + This is an abstract base class use to represent a scalar or complex property, or a navigation property + of an entity. Scalar and complex properties use the derived class , + reference navigation properties use the derived class , and collection + navigation properties use the derived class . + + + + + Creates a from information in the given . + This method will create an instance of the appropriate subclass depending on the metadata contained + in the InternalMemberEntry instance. + + The internal member entry. + The new entry. + + + + Validates this property. + + + Collection of objects. Never null. If the entity is valid the collection will be empty. + + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the name of the property. + + The property name. + + + + Gets or sets the current value of this property. + + The current value. + + + + The to which this member belongs. + + An entry for the entity that owns this member. + + + + Gets the backing this object. + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal collection entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the collection of entities from the database. + Note that entities that already exist in the context are not overwritten with values from the database. + + + + + Returns the query that would be used to load this collection from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database, such + as counting the number of entities in the collection in the database without actually loading them. + + A query for the collection. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the collection element. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the collection of entities has been loaded from the database. + + true if the collection is loaded; otherwise, false. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Gets the backing this object as an . + + The internal member entry. + + + + Instances of this class are returned from the Collection method of + and allow operations such as loading to + be performed on the an entity's collection navigation properties. + + The type of the entity to which this property belongs. + The type of the element in the collection of entities. + + + + This is an abstract base class use to represent a scalar or complex property, or a navigation property + of an entity. Scalar and complex properties use the derived class , + reference navigation properties use the derived class , and collection + navigation properties use the derived class . + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + This method will create an instance of the appropriate subclass depending on the metadata contained + in the InternalMemberEntry instance. + + The internal member entry. + The new entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Validates this property. + + + Collection of objects. Never null. If the entity is valid the collection will be empty. + + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets the underlying . + + The internal member entry. + + + + The to which this member belongs. + + An entry for the entity that owns this member. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal collection entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the collection of entities from the database. + Note that entities that already exist in the context are not overwritten with values from the database. + + + + + Returns the query that would be used to load this collection from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database, such + as counting the number of entities in the collection in the database without actually loading them. + + A query for the collection. + + + + Returns a new instance of the non-generic class for + the navigation property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the collection of entities has been loaded from the database. + + true if the collection is loaded; otherwise, false. + + + + Gets the underlying as an . + + The internal member entry. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + An immutable representation of an Entity Data Model (EDM) model that can be used to create an + or can be passed to the constructor of a . + For increased performance, instances of this type should be cached and re-used to construct contexts. + + + + + For mocking. + + + + + Creates a model for the given EDM metadata model. + + The EDM metadata model. + + + + Creates an instance of ObjectContext or class derived from ObjectContext. Note that an instance + of DbContext can be created instead by using the appropriate DbContext constructor. + If a derived ObjectContext is used, then it must have a public constructor with a single + EntityConnection parameter. + The connection passed is used by the ObjectContext created, but is not owned by the context. The caller + must dispose of the connection once the context has been disposed. + + The type of context to create. + An existing connection to a database for use by the context. + + + + + Gets a cached delegate (or creates a new one) used to call the constructor for the given derived ObjectContext type. + + + + + A snapshot of the that was used to create this compiled model. + + + + + The provider info (provider name and manifest token) that was used to create this model. + + + + + A non-generic version of the class. + + + + + A non-generic version of the class. + + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the original value of this property. + + The original value. + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets or sets a value indicating whether the value of this property has been modified since + it was loaded from the database. + + + true if this instance is modified; otherwise, false. + + + + + The to which this property belongs. + + An entry for the entity that owns this property. + + + + The of the property for which this is a nested property. + This method will only return a non-null entry for properties of complex objects; it will + return null for properties of the entity itself. + + An entry for the parent complex property, or null if this is an entity property. + + + + Gets the backing this object. + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The name of the nested property. + An object representing the nested property. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the complex property. + The equivalent generic object. + + + + Instances of this class are returned from the ComplexProperty method of + and allow access to the state of a complex property. + + The type of the entity to which this property belongs. + The type of the property. + + + + Instances of this class are returned from the Property method of + and allow access to the state of the scalar + or complex property. + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the original value of this property. + + The original value. + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets or sets a value indicating whether the value of this property has been modified since + it was loaded from the database. + + + true if this instance is modified; otherwise, false. + + + + + The to which this property belongs. + + An entry for the entity that owns this property. + + + + The of the property for which this is a nested property. + This method will only return a non-null entry for properties of complex objects; it will + return null for properties of the entity itself. + + An entry for the parent complex property, or null if this is an entity property. + + + + Gets the underlying as an . + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The type of the nested property. + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The type of the nested property. + An expression representing the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The type of the nested property. + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The type of the nested property. + An expression representing the nested property. + An object representing the nested property. + + + + Describes the origin of the database connection string associated with a . + + + + + The connection string was created by convention. + + + + + The connection string was read from external configuration. + + + + + The connection string was explicitly specified at runtime. + + + + + The connection string was overriden by connection information supplied to DbContextInfo. + + + + + Returned by the Configuration method of to provide access to configuration + options for the context. + + + + + Initializes a new instance of the class. + + The internal context. + + + + Gets or sets a value indicating whether lazy loading of relationships exposed as + navigation properties is enabled. Lazy loading is enabled by default. + + true if lazy loading is enabled; otherwise, false. + + + + Gets or sets a value indicating whether or not the framework will create instances of + dynamically generated proxy classes whenever it creates an instance of an entity type. + Note that even if proxy creation is enabled with this flag, proxy instances will only + be created for entity types that meet the requirements for being proxied. + Proxy creation is enabled by default. + + true if proxy creation is enabled; otherwise, false. + + + + + Gets or sets a value indicating whether tracked entities should be validated automatically when + is invoked. + The default value is true. + + + + + Provides runtime information about a given type. + + + + + Creates a new instance representing a given type. + + The type deriving from . + + + + Creates a new instance representing a given targeting a specific database. + + The type deriving from . + Connection information for the database to be used. + + + + Creates a new instance representing a given type. An external list of + connection strings can be supplied and will be used during connection string resolution in place + of any connection strings specified in external configuration files. + + + It is preferable to use the constructor that accepts the entire config document instead of using this + constructor. Providing the entire config document allows DefaultConnectionFactroy entries in the config + to be found in addition to explicitly specified connection strings. + + The type deriving from . + A collection of connection strings. + + + + Creates a new instance representing a given type. An external config + object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + + The type deriving from . + An object representing the config file. + + + + Creates a new instance representing a given , targeting a specific database. + An external config object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + + The type deriving from . + An object representing the config file. + Connection information for the database to be used. + + + + Creates a new instance representing a given type. A + can be supplied in order to override the default determined provider used when constructing + the underlying EDM model. + + The type deriving from . + A specifying the underlying ADO.NET provider to target. + + + + Creates a new instance representing a given type. An external config + object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + A can be supplied in order to override the default determined + provider used when constructing the underlying EDM model. This can be useful to prevent EF from + connecting to discover a manifest token. + + The type deriving from . + An object representing the config file. + A specifying the underlying ADO.NET provider to target. + + + + Called internally when a context info is needed for an existing context, which may not be constructable. + + The context instance to get info from. + + + + If instances of the underlying type can be created, returns + a new instance; otherwise returns null. + + A instance. + + + + The concrete type. + + + + + Whether or not instances of the underlying type can be created. + + + + + The connection string used by the underlying type. + + + + + The connection string name used by the underlying type. + + + + + The ADO.NET provider name of the connection used by the underlying type. + + + + + The origin of the connection string used by the underlying type. + + + + + An action to be run on the DbModelBuilder after OnModelCreating has been run on the context. + + + + + A non-generic version of the class. + + + + + Initializes a new instance of the class. + + The internal entry. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + Note that changing the values in the returned dictionary will not update the values in the database. + If the entity is not found in the database then null is returned. + + The store values. + + + + Reloads the entity from the database overwriting any property values with values from the database. + The entity will be in the Unchanged state after calling this method. + + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The name of the property. + An object representing the property. + + + + Gets an object that represents a complex property of this entity. + + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The name of the member. + An object representing the member. + + + + Returns a new instance of the generic class for the given + generic type for the tracked entity represented by this object. + Note that the type of the tracked entity must be compatible with the generic type or + an exception will be thrown. + + The type of the entity. + A generic version. + + + + Validates this instance and returns validation result. + + + Entity validation result. Possibly null if + method is overridden. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the entity. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + + The original values. + + + + Gets InternalEntityEntry object for this DbEntityEntry instance. + + + + + Instances of this class provide access to information about and control of entities that + are being tracked by the . Use the Entity or Entities methods of + the context to obtain objects of this type. + + The type of the entity. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + Note that changing the values in the returned dictionary will not update the values in the database. + If the entity is not found in the database then null is returned. + + The store values. + + + + Reloads the entity from the database overwriting any property values with values from the database. + The entity will be in the Unchanged state after calling this method. + + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The type of the property. + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The type of the property. + An expression representing the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The type of elements in the collection. + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The type of elements in the collection. + An expression representing the navigation property. + An object representing the navigation property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The name of the property. + An object representing the property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The type of the property. + The name of the property. + An object representing the property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The type of the property. + An expression representing the property. + An object representing the property. + + + + Gets an object that represents a complex property of this entity. + + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a complex property of this entity. + + The type of the complex property. + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a complex property of this entity. + + The type of the complex property. + An expression representing the complex property. + An object representing the complex property. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The name of the member. + An object representing the member. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The type of the member. + The name of the member. + An object representing the member. + + + + Returns a new instance of the non-generic class for + the tracked entity represented by this object. + + A non-generic version. + + + + Validates this instance and returns validation result. + + + Entity validation result. Possibly null if + method is overridden. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the entity. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + + The original values. + + + + Represents an Entity Data Model (EDM) created by the . + The Compile method can be used to go from this EDM representation to a + which is a compiled snapshot of the model suitable for caching and creation of + or instances. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + Creates a for this mode which is a compiled snapshot + suitable for caching and creation of instances. + + The compiled model. + + + + A snapshot of the that was used to create this compiled model. + + + + + A collection of all the properties for an underlying entity or complex object. + + + An instance of this class can be converted to an instance of the generic class + using the Cast method. + Complex properties in the underlying entity or complex object are represented in + the property values as nested instances of this class. + + + + + Initializes a new instance of the class. + + The internal dictionary. + + + + Creates an object of the underlying type for this dictionary and hydrates it with property + values from this dictionary. + + The properties of this dictionary copied into a new object. + + + + Sets the values of this dictionary by reading values out of the given object. + The given object can be of any type. Any property on the object with a name that + matches a property name in the dictionary and can be read will be read. Other + properties will be ignored. This allows, for example, copying of properties from + simple Data Transfer Objects (DTOs). + + The object to read values from. + + + + Creates a new dictionary containing copies of all the properties in this dictionary. + Changes made to the new dictionary will not be reflected in this dictionary and vice versa. + + A clone of this dictionary. + + + + Sets the values of this dictionary by reading values from another dictionary. + The other dictionary must be based on the same type as this dictionary, or a type derived + from the type for this dictionary. + + The dictionary to read values from. + + + + Gets the value of the property just like using the indexed property getter but + typed to the type of the generic parameter. This is useful especially with + nested dictionaries to avoid writing expressions with lots of casts. + + The type of the property. + Name of the property. + The value of the property. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + Gets or sets the value of the property with the specified property name. + The value may be a nested instance of this class. + + The property name. + The value of the property. + + + + Gets the internal dictionary. + + The internal dictionary. + + + + A non-generic version of the class. + + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal reference entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the entity from the database. + Note that if the entity already exists in the context, then it will not overwritten with values from the database. + + + + + Returns the query that would be used to load this entity from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database. + + A query for the entity. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the entity has been loaded from the database. + + true if the entity is loaded; otherwise, false. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Gets the backing this object as an . + + The internal member entry. + + + + Instances of this class are returned from the Reference method of + and allow operations such as loading to + be performed on the an entity's reference navigation properties. + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal reference entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the entity from the database. + Note that if the entity already exists in the context, then it will not overwritten with values from the database. + + + + + Returns the query that would be used to load this entity from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database. + + A query for the entity. + + + + Returns a new instance of the non-generic class for + the navigation property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the entity has been loaded from the database. + + true if the entity is loaded; otherwise, false. + + + + Gets the underlying as an . + + The internal member entry. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Represents a SQL query for entities that is created from a + and is executed using the connection from that context. + Instances of this class are obtained from the instance for the + entity type. The query is not executed when this object is created; it is executed + each time it is enumerated, for example by using foreach. + SQL queries for non-entities are created using the . + See for a generic version of this class. + + + + + Initializes a new instance of the class. + + The internal query. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a new query where the results of the query will not be tracked by the associated + . + + A new query with no-tracking applied. + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Gets the internal query. + + The internal query. + + + + Returns false. + + false. + + + + Represents a SQL query for entities that is created from a + and is executed using the connection from that context. + Instances of this class are obtained from the instance for the + entity type. The query is not executed when this object is created; it is executed + each time it is enumerated, for example by using foreach. + SQL queries for non-entities are created using the . + See for a non-generic version of this class. + + + + + Executes the query and returns an enumerator for the elements. + + An + + object that can be used to iterate through the elements. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a new query where the results of the query will not be tracked by the associated + . + + A new query with no-tracking applied. + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Gets the internal query. + + The internal query. + + + + Returns false. + + false. + + + + Exception thrown by when it was expected that SaveChanges for an entity would + result in a database update but in fact no rows in the database were affected. This usually indicates + that the database has been concurrently updated such that a concurrency token that was expected to match + did not actually match. + Note that state entries referenced by this exception are not serialized due to security and accesses to + the state entries after serialization will return null. + + + + + + Initializes a new instance of the class. + + The internal context. + The inner exception. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Subscribes the SerializeObjectState event. + + + + + Gets objects that represents the entities that could not + be saved to the database. + + The entries representing the entities that could not be saved. + + + + Holds exception state that will be serialized when the exception is serialized. + + + + + Completes the deserialization. + + The deserialized object. + + + + Gets or sets a value indicating whether the exception involved independent associations. + + + + + Initializes a new instance of the class. + + The context. + The inner exception. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Represents an entity used to store metadata about an EDM in the database. + + + + + Attempts to get the model hash calculated by Code First for the given context. + This method will return null if the context is not being used in Code First mode. + + The context. + The hash string. + + + + Gets or sets the ID of the metadata entity, which is currently always 1. + + The id. + + + + Gets or sets the model hash which is used to check whether the model has + changed since the database was created from it. + + The model hash. + + + + Contains methods used to access the Entity Data Model created by Code First in the EDMX form. + These methods are typically used for debugging when there is a need to look at the model that + Code First creates internally. + + + + + Uses Code First with the given context and writes the resulting Entity Data Model to the given + writer in EDMX form. This method can only be used with context instances that use Code First + and create the model internally. The method cannot be used for contexts created using Database + First or Model First, for contexts created using a pre-existing , or + for contexts created using a pre-existing . + + The context. + The writer. + + + + Writes the Entity Data Model represented by the given to the + given writer in EDMX form. + + An object representing the EDM. + The writer. + + + + A factory for creating derived instances. Implement this + interface to enable design-time services for context types that do not have a + public default constructor. + + At design-time, derived instances can be created in order to enable specific + design-time experiences such as model rendering, DDL generation etc. To enable design-time instantiation + for derived types that do not have a public, default constructor, implement + this interface. Design-time services will auto-discover implementations of this interface that are in the + same assembly as the derived type. + + + + + + Creates a new instance of a derived type. + + An instance of TContext + + + + This convention causes DbModelBuilder to include metadata about the model + when it builds the model. When creates a model by convention it will + add this convention to the list of those used by the DbModelBuilder. This will then result in + model metadata being written to the database if the DbContext is used to create the database. + This can then be used as a quick check to see if the model has changed since the last time it was + used against the database. + This convention can be removed from the conventions by overriding + the OnModelCreating method on a derived DbContext class. + + + + + Adds metadata to the given model configuration. + + The model configuration. + + + + This convention uses the name of the derived + class as the container for the conceptual model built by + Code First. + + + + + Initializes a new instance of the class. + + The model container name. + + + + Applies the convention to the given model. + + The model. + + + + This convention uses the namespace of the derived + class as the namespace of the conceptual model built by + Code First. + + + + + Initializes a new instance of the class. + + The model namespace. + + + + Applies the convention to the given model. + + The model. + + + + Instances of this class are used internally to create constant expressions for + that are inserted into the expression tree to replace references to + and . + + The type of the element. + + + + Private constructor called by the Create factory method. + + The query. + + + + Factory method called by CreateDelegate to create an instance of this class. + + The query, which must be a generic object of the expected type. + A new instance. + + + + The public property expected in the LINQ expression tree. + + The query. + + + + Instances of this class are used to create DbConnection objects for + SQL Server Compact Edition based on a given database name or connection string. + + + It is necessary to provide the provider invariant name of the SQL Server Compact + Edition to use when creating an instance of this class. This is because different + versions of SQL Server Compact Editions use different invariant names. + An instance of this class can be set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use SQL Server Compact Edition by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Creates a new connection factory with empty (default) DatabaseDirectory and BaseConnectionString + properties. + + The provider invariant name that specifies the version of SQL Server Compact Edition that should be used. + + + + Creates a new connection factory with the given DatabaseDirectory and BaseConnectionString properties. + + + The provider invariant name that specifies the version of SQL Server Compact Edition that should be used. + + + The path to prepend to the database name that will form the file name used by SQL Server Compact Edition + when it creates or reads the database file. An empty string means that SQL Server Compact Edition will use + its default for the database file location. + + + The connection string to use for options to the database other than the 'Data Source'. The Data Source will + be prepended to this string based on the database name when CreateConnection is called. + + + + + Creates a connection for SQL Server Compact Edition based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + The path to prepend to the database name that will form the file name used by + SQL Server Compact Edition when it creates or reads the database file. + The default value is "|DataDirectory|", which means the file will be placed + in the designated data directory. + + + + + The connection string to use for options to the database other than the 'Data Source'. + The Data Source will be prepended to this string based on the database name when + CreateConnection is called. + The default is the empty string, which means no other options will be used. + + + + + The provider invariant name that specifies the version of SQL Server Compact Edition + that should be used. + + + + + Instances of this class are used to create DbConnection objects for + SQL Server based on a given database name or connection string. By default, the connection is + made to '.\SQLEXPRESS'. This can be changed by changing the base connection + string when constructing a factory instance. + + + An instance of this class can be set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use SQL Server by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Creates a new connection factory with a default BaseConnectionString property of + 'Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True'. + + + + + Creates a new connection factory with the given BaseConnectionString property. + + + The connection string to use for options to the database other than the 'Initial Catalog'. The 'Initial Catalog' will + be prepended to this string based on the database name when CreateConnection is called. + + + + + Creates a connection for SQL Server based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + Remove hard dependency on DbProviderFactories. + + + + + The connection string to use for options to the database other than the 'Initial Catalog'. + The 'Initial Catalog' will be prepended to this string based on the database name when + CreateConnection is called. + The default is 'Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True'. + + + + + This attribute can be applied to either an entire derived class or to + individual or properties on that class. When applied + any discovered or properties will still be included + in the model but will not be automatically initialized. + + + + + Thrown when a context is generated from the templates in Database First or Model + First mode and is then used in Code First mode. + + + Code generated using the T4 templates provided for Database First and Model First use may not work + correctly if used in Code First mode. To use these classes with Code First please add any additional + configuration using attributes or the DbModelBuilder API and then remove the code that throws this + exception. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The object that holds the serialized object data. + The contextual information about the source or destination. + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Implements ICachedMetadataWorkspace for a Code First model. + + + + + Represents an object that holds a cached copy of a MetadataWorkspace and optionally the + assemblies containing entity types to use with that workspace. + + + + + Gets the MetadataWorkspace, potentially lazily creating it if it does not already exist. + If the workspace is not compatible with the provider manifest obtained from the given + connection then an exception is thrown. + + The connection to use to create or check SSDL provider info. + The workspace. + + + + The list of assemblies that contain entity types for this workspace, which may be empty, but + will never be null. + + + + + The default container name for code first is the container name that is set from the DbModelBuilder + + + + + The provider info used to construct the workspace. + + + + + Builds and stores the workspace based on the given code first configuration. + + The code first EDM model. + + + + Gets the . + If the workspace is not compatible with the provider manifest obtained from the given + connection then an exception is thrown. + + The connection to use to create or check SSDL provider info. + The workspace. + + + + The default container name for code first is the container name that is set from the DbModelBuilder + + + + + The list of assemblies that contain entity types for this workspace, which may be empty, but + will never be null. + + + + + The provider info used to construct the workspace. + + + + + The methods here are called from multiple places with an ObjectContext that may have + been created in a variety of ways and ensure that the same code is run regardless of + how the context was created. + + + + + Used a delegate to do the actual creation once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + Note however that a context obtained from only a connection will have no model and so + will result in an empty database. + + + + + Used a delegate to do the actual existence check once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + + + + + Used a delegate to do the actual check/delete once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given set of entity types and DbSet initializer delegate. + + + + + The entity types part of the pair. + + + + + The DbSet properties initializer part of the pair. + + + + + Static helper methods only. + + + + + Checks whether the given value is null and throws ArgumentNullException if it is. + This method should only be used in places where Code Contracts are compiled out in the + release build but we still need public surface null-checking, such as where a public + abstract class is implemented by an internal concrete class. + + + + + Checks whether the given string is null, empty, or just whitespace, and throws appropriately + if the check fails. + This method should only be used in places where Code Contracts are compiled out in the + release build but we still need public surface checking, such as where a public + abstract class is implemented by an internal concrete class. + + + + + Given two key values that may or may not be byte arrays, this method determines + whether or not they are equal. For non-binary key values, this is equivalent + to Object.Equals. For binary keys, it is by comparison of every byte in the + arrays. + + + + + Provides a standard helper method for quoting identifiers + + Identifier to be quoted. Does not validate that this identifier is valid. + Quoted string + + + + Checks the given string which might be a database name or a connection string and determines + whether it should be treated as a name or connection string. Currently, the test is simply + whether or not the string contains an '=' character--if it does, then it should be treated + as a connection string. + + The name or connection string. + true if the string should be treated as a connection string; false if it should be treated as a name. + + + + Determines whether the given string should be treated as a database name directly (it contains no '='), + is in the form name=foo, or is some other connection string. If it is a direct name or has name=, then + the name is extracted and the method returns true. + + The name or connection string. + The name. + True if a name is found; false otherwise. + + + + Determines whether the given string is a full EF connection string with provider, provider connection string, + and metadata parts, or is is instead some other form of connection string. + + The name or connection string. + true if the given string is an EF connection string; otherwise, false. + + + + + Parses a property selector expression used for the expression-based versions of the Property, Collection, Reference, + etc methods on and + classes. + + The type of the entity. + The type of the property. + The property. + Name of the method. + Name of the param. + The property name. + + + + Called recursively to parse an expression tree representing a property path such + as can be passed to Include or the Reference/Collection/Property methods of . + This involves parsing simple property accesses like o => o.Products as well as calls to Select like + o => o.Products.Select(p => p.OrderLines). + + The expression to parse. + The expression parsed into an include path, or null if the expression did not match. + True if matching succeeded; false if the expression could not be parsed. + + + + Gets a cached dictionary mapping property names to property types for all the properties + in the given type. + + + + + Gets a dictionary of compiled property setter delegates for the underlying types. + The dictionary is cached for the type in the app domain. + + + + + Used by the property setter delegates to throw for attempts to set null onto + non-nullable properties or otherwise go ahead and set the property. + + + + + Gets a dictionary of compiled property getter delegates for the underlying types. + The dictionary is cached for the type in the app domain. + + + + + Creates a new with the NoTracking merge option applied. + The query object passed in is not changed. + + The query. + A new query with NoTracking applied. + + + + Converts to + + + Name of the property being validated with ValidationAttributes. Null for type-level validation. + + + ValidationResults instances to be converted to instances. + + + An created based on the + . + + + class contains a property with names of properties the error applies to. + On the other hand each applies at most to a single property. As a result for + each name in ValidationResult.MemberNames one will be created (with some + exceptions for special cases like null or empty .MemberNames or null names in the .MemberNames). + + + + + Calculates a "path" to a property. For primitive properties on an entity type it is just the + name of the property. Otherwise it is a dot separated list of names of the property and all + its ancestor properties starting from the entity. + + Property for which to calculate the path. + Dot separated path to the property. + + + + Gets names of the property and its ancestor properties as enumerable walking "bottom-up". + + Property for which to get the segments. + Names of the property and its ancestor properties. + + + + Gets an type for the given element type. + + Type of the element. + The collection type. + + + + Creates a database name given a type derived from DbContext. This handles nested and + generic classes. No attempt is made to ensure that the name is not too long since this + is provider specific. If a too long name is generated then the provider will throw and + the user must correct by specifying their own name in the DbContext constructor. + + Type of the context. + The database name to use. + + + + A local (in-memory) view of the entities in a DbSet. + This view contains Added entities and does not contain Deleted entities. The view extends + from and hooks up events between the collection and the + state manager to keep the view in sync. + + The type of the entity. + + + + Initializes a new instance of the class for entities + of the given generic type in the given internal context. + + The internal context. + + + + Called by the base class when the collection changes. + This method looks at the change made to the collection and reflects those changes in the + state manager. + + The instance containing the event data. + + + + Handles events from the state manager for entities entering, leaving, or being marked as deleted. + The local view is kept in sync with these changes. + + The sender. + The instance containing the event data. + + + + Clears the items by calling remove on each item such that we get Remove events that + can be tracked back to the state manager, rather than a single Reset event that we + cannot deal with. + + + + + Adds a contains check to the base implementation of InsertItem since we can't support + duplicate entities in the set. + + The index at which to insert. + The item to insert. + + + + Returns a cached binding list implementation backed by this ObservableCollection. + + The binding list. + + + + Service used to search for instance properties on a DbContext class that can + be assigned a DbSet instance. Also, if the the property has a public setter, + then a delegate is compiled to set the property to a new instance of DbSet. + All of this information is cached per app domain. + + + + + Creates a set discovery service for the given derived context. + + + + + Processes the given context type to determine the DbSet or IDbSet + properties and collect root entity types from those properties. Also, delegates are + created to initialize any of these properties that have public setters. + If the type has been processed previously in the app domain, then all this information + is returned from a cache. + + A dictionary of potential entity type to the list of the names of the properties that used the type. + + + + Calls the public setter on any property found to initialize it to a new instance of DbSet. + + + + + Registers the entities and their entity set name hints with the given . + + The model builder. + + + + Returns false if SuppressDbSetInitializationAttribute is found on the property or the class, otherwise + returns true. + + + + + Determines whether or not an instance of DbSet/ObjectSet can be assigned to a property of the given type. + + The type to check. + The entity type of the DbSet/ObjectSet that can be assigned, or null if no set type can be assigned. + + + + + A EagerInternalConnection object wraps an already existing DbConnection object. + + + + + InternalConnection objects manage DbConnections. + Two concrete base classes of this abstract interface exist: + and . + + + + + IInternalConnection objects manage DbConnections. + Two concrete implementations of this interface exist--LazyInternalConnection and EagerInternalConnection. + + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Returns the underlying DbConnection. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if the connection contains model info; otherwise, false. + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strins. + + + + + Gets or sets the provider to be used when creating the underlying connection. + + + + + Gets the name of the underlying connection string. + + + + + Gets the original connection string. + + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Called after the connection is initialized for the first time. + + + + + Adds a tracking cookie to the connection string for SqlConnections. Returns the + possibly modified store connection string. + + + + + Returns the underlying DbConnection. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if the connection contains model info; otherwise, false. + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strins. + + + + + Gets or sets the provider to be used when creating the underlying connection. + + + + + Gets the name of the underlying connection string. + + + + + Gets the original connection string. + + + + + Gets or sets the underlying object. No initialization is done when the + connection is obtained, and it can also be set to null. + + The underlying connection. + + + + Creates a new EagerInternalConnection that wraps an existing DbConnection. + + An existing connection. + If set to true then the underlying connection should be disposed when this object is disposed. + + + + Dispose the existing connection is the original caller has specified that it should be disposed + by the framework. + + + + + Returns the origin of the underlying connection string. + + + + + An is an where the + instance that it wraps is set immediately at construction time rather than being created lazily. In this case + the internal context may or may not own the instance but will only dispose it + if it does own it. + + + + + An underlies every instance of and wraps an + instance. + The also acts to expose necessary information to other parts of the design in a + controlled manner without adding a lot of internal methods and properties to the + class itself. + Two concrete classes derive from this abstract class - and + . + + + + + Initializes the object with its owner. + + The owner . + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Creates a new temporary based on the same metadata and connection as the real + and sets it as the context to use DisposeTempObjectContext is called. + This allows this internal context and its DbContext to be used for transient operations + such as initializing and seeding the database, after which it can be thrown away. + This isolates the real from any changes made and and saves performed. + + + + + If a temporary ObjectContext was set with UseTempObjectContext, then this method disposes that context + and returns this internal context and its DbContext to using the real ObjectContext. + + + + + Called by methods of to create a database either using the Migrations pipeline + if possible and the core provider otherwise. + + The context to use for core provider calls. + + + + Internal implementation of . + + True if the model hash in the context and the database match; false otherwise. + + + + Checks whether the given model (an EDMX document) matches the current model. + + + + + Queries the database for a model hash and returns it if found or returns null if the table + or the row doesn't exist in the database. + + The model hash, or null if not found. + + + + Queries the database for a model stored in the MigrationHistory table and returns it as an EDMX, or returns + null if the database does not contain a model. + + + + + Saves the model hash from the context to the database. + + + + + Performs the initialization action that may result in a and + handle the exception to provide more meaning to the user. + + The action. + + + + Registers for the ObjectStateManagerChanged event on the underlying ObjectStateManager. + This is a virtual method on this class so that it can be mocked. + + The event handler. + + + + Checks whether or not the given object is in the context in any state other than Deleted. + This is a virtual method on this class so that it can be mocked. + + The entity. + true if the entity is in the context and not deleted; otherwise false. + + + + Saves all changes made in this context to the underlying database. + + The number of objects written to the underlying database. + + + + Initializes this instance, which means both the context is initialized and the underlying + database is initialized. + + + + + Initializes the underlying ObjectContext but does not cause the database to be initialized. + + + + + Marks the database as having not been initialized. This is called when the app calls Database.Delete so + that the database if the app attempts to then use the database again it will be re-initialized automatically. + + + + + Runs the unless it has already been run or there + is no initializer for this context type in which case this method does nothing. + + + + + Marks the database as having been initialized without actually running the . + + + + + Runs the if one has been set for this context type. + Calling this method will always cause the initializer to run even if the database is marked + as initialized. + + + + + Disposes the context. Override the DisposeContext method to perform + additional work when disposing. + + + + + Performs additional work to dispose a context. + + + + + Calls DetectChanges on the underlying if AutoDetectChangesEnabled is + true or if force is set to true. + + if set to true then DetectChanges is called regardless of the value of AutoDetectChangesEnabled. + + + + Returns the DbSet instance for the given entity type. + This property is virtual and returns to that it can be mocked. + + The entity type for which a set should be returned. + A set for the given entity type. + + + + Returns the non-generic instance for the given entity type. + This property is virtual and returns to that it can be mocked. + + The entity type for which a set should be returned. + A set for the given entity type. + + + + Creates an internal set using an app domain cached delegate. + + Type of the entity. + The set. + + + + Returns the entity set and the base type for that entity set for the given type. + This method does o-space loading if required and throws if the type is not in the model. + + The entity type to lookup. + The entity set and base type pair. + + + + Returns the entity set and the base type for that entity set for the given type if that + type is mapped in the model, otherwise returns null. + This method does o-space loading if required. + + The entity type to lookup. + The entity set and base type pair, or null if not found. + + + + Checks whether or not the given entity type is mapped in the model. + + The entity type to lookup. + True if the type is mapped as an entity; false otherwise. + + + + Gets the local entities of the type specified from the state manager. That is, all + Added, Modified, and Unchanged entities of the given type. + + The type of entity to get. + The entities. + + + + Executes the given SQL query against the database backing this context. The results are not materialized as + entities or tracked. + + The type of the element. + The SQL. + The parameters. + The query results. + + + + Executes the given SQL query against the database backing this context. The results are not materialized as + entities or tracked. + + Type of the element. + The SQL. + The parameters. + The query results. + + + + Calls the generic ExecuteSqlQuery but with a non-generic return type so that it + has the correct signature to be used with CreateDelegate above. + + + + + Executes the given SQL command against the database backing this context. + + The SQL. + The parameters. + The return value from the database. + + + + Gets the underlying for the given entity, or returns null if the entity isn't tracked by this context. + This method is virtual so that it can be mocked. + + The entity. + The state entry or null. + + + + Gets the underlying objects for all entities tracked by + this context. + This method is virtual so that it can be mocked. + + State entries for all tracked entities. + + + + Gets the underlying objects for all entities of the given + type tracked by this context. + This method is virtual so that it can be mocked. + + The type of the entity. + State entries for all tracked entities of the given type. + + + + Helper method that gets the underlying objects for all entities that + match the given predicate. + + + + + Wraps the given in either a or + a depending on the actual exception type and the state + entries involved. + + The update exception. + A new exception wrapping the given exception. + + + + Uses the underlying context to create an entity such that if the context is configured + to create proxies and the entity is suitable then a proxy instance will be returned. + This method is virtual so that it can be mocked. + + The type of the entity. + The new entity instance. + + + + Uses the underlying context to create an entity such that if the context is configured + to create proxies and the entity is suitable then a proxy instance will be returned. + This method is virtual so that it can be mocked. + + The type of entity to create. + The new entity instance. + + + + This method is used by CreateDelegate to transform the CreateObject method with return type TEntity + into a method with return type object which matches the required type of the delegate. + + + + + Replaces the connection that will be used by this context. + The connection can only be changed before the context is initialized. + + The new connection. + + + + Throws if the context has been disposed. + + + + + Checks whether or not the internal cache of types to entity sets has been initialized, + and initializes it if necessary. + + + + + Forces all DbSets to be initialized, which in turn causes o-space loading to happen + for any entity type for which we have a DbSet. This includes all DbSets that were + discovered on the user's DbContext type. + + + + + Performs o-space loading for the type and returns false if the type is not in the model. + + + + + Performs o-space loading for the type and throws if the type is not in the model. + + Type of the entity. + + + + Returns true if the given entity type does not have EdmEntityTypeAttribute but is in + an assembly that has EdmSchemaAttribute. This indicates mixing of POCO and EOCO in the + same assembly, which is something that we don't support. + + + + + Determines whether or not the given clrType is mapped to a complex type. Assumes o-space loading has happened. + + + + + Updates the cache of types to entity sets either for the first time or after potentially + doing some o-space loading. + + + + + The public context instance that owns this internal context. + + + + + Returns the underlying . + + + + + Gets the temp object context, or null if none has been set. + + The temp object context. + + + + The compiled model created from the Code First pipeline, or null if Code First was + not used to create this context. + Causes the Code First pipeline to be run to create the model if it has not already been + created. + + + + + Set to true when a database initializer is performing some actions, such as creating or deleting + a database, or seeding the database. + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + Gets or sets a value indicating whether lazy loading is enabled. + + + + + Gets or sets a value indicating whether proxy creation is enabled. + + + + + Gets or sets a value indicating whether DetectChanges is called automatically in the API. + + + + + Gets or sets a value indicating whether to validate entities when is called. + + + + + True if the context has been disposed. + + + + + The connection underlying this context. Accessing this property does not cause the context + to be initialized, only its connection. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries, + database intializers and connection strings. + + + + + Gets or sets the provider details to be used when building the EDM model. + + + + + Gets the name of the underlying connection string. + + + + + Gets the provider name bsing used either using a cached value or getting it from + the DbConnection in use. + + + + + Gets or sets a custom OnModelCreating action. + + + + + Gets the DatabaseOperations instance to use to perform Create/Delete/Exists operations + against the database. + Note that this virtual property can be mocked to help with unit testing. + + + + + Gets instance used to create validators and validation contexts. + This property is virtual to allow mocking. + + + + + For mocking. + + + + + Constructs an for an already existing . + + The owner . + The existing . + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Does nothing, since the already exists. + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Disposes the context. The underlying is also disposed if it is owned. + + + + + + + + Returns the underlying . + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + The connection underlying this context. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets a value indicating whether lazy loading is enabled. This is just a wrapper + over the same flag in the underlying . + + + + + Gets or sets a value indicating whether proxy creation is enabled. This is just a wrapper + over the same flag in the underlying ObjectContext. + + + + + An implementation of that represents a clone of another + dictionary. That is, all the property values have been been copied into this dictionary. + + + + + The internal class used to implement . + This internal class allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal context with which the entity of complex object is associated. + The type of the entity or complex object. + If set to true this is a dictionary for an entity, otherwise it is a dictionary for a complex object. + + + + Implemented by subclasses to get the dictionary item for a given property name. + Checking that the name is valid should happen before this method is called such + that subclasses do not need to perform the check. + + Name of the property. + An item for the given name. + + + + Creates an object of the underlying type for this dictionary and hydrates it with property + values from this dictionary. + + The properties of this dictionary copied into a new object. + + + + Creates an instance of the underlying type for this dictionary, which may either be an entity type (in which + case CreateObject on the context is used) or a non-entity type (in which case the empty constructor is used.) + In either case, app domain cached compiled delegates are used to do the creation. + + + + + Sets the values of this dictionary by reading values out of the given object. + The given object must be of the type that this dictionary is based on. + + The object to read values from. + + + + Creates a new dictionary containing copies of all the properties in this dictionary. + Changes made to the new dictionary will not be reflected in this dictionary and vice versa. + + A clone of this dictionary. + + + + Sets the values of this dictionary by reading values from another dictionary. + The other dictionary must be based on the same type as this dictionary, or a type derived + from the type for this dictionary. + + The dictionary to read values from. + + + + Gets the dictionary item for the property with the given name. + This method checks that the given name is valid. + + The property name. + The item. + + + + Sets the value of the property only if it is different from the current value and is not + an invalid attempt to set a complex property. + + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + Gets or sets the value of the property with the specified property name. + The value may be a nested instance of this class. + + The property name. + The value of the property. + + + + Gets the entity type of complex type that this dictionary is based on. + + The type of the object underlying this dictionary. + + + + Gets the internal context with which the underlying entity or complex type is associated. + + The internal context. + + + + Gets a value indicating whether the object for this dictionary is an entity or a complex object. + + true if this this is a dictionary for an entity; false if it is a dictionary for a complex object. + + + + Initializes a new instance of the class by copying + values from the given dictionary. + + The dictionary to clone. + If non-null, then the values for the new dictionary are taken from this record rather than from the original dictionary. + + + + Gets the dictionary item for a given property name. + + Name of the property. + An item for the given name. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + An implementation of for an item in a . + + + + + Represents an item in an representing a property name/value. + + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + true If this instance represents a complex property; otherwise, false. + + + + Gets the type of the underlying property. + + The property type. + + + + Initializes a new instance of the class. + + The name. + The value. + The type. + If set to true this item represents a complex property. + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + + true If this instance represents a complex property; otherwise, false. + + + + + Gets the type of the underlying property. + + The property type. + + + + An implementation of that is based on an existing + instance. + + + + + Initializes a new instance of the class. + + The internal context. + The type. + The data record. + If set to true this is a dictionary for an entity, otherwise it is a dictionary for a complex object. + + + + Gets the dictionary item for a given property name. + + Name of the property. + An item for the given name. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + An implementation of for an item in a . + + + + + Initializes a new instance of the class. + + The data record. + The ordinal. + The value. + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + + true If this instance represents a complex property; otherwise, false. + + + + + Gets the type of the underlying property. + + The property type. + + + + This is version of an internal interface that already exists in System.Data.Entity that + is implemented by . Using this interface allows state + entries to be mocked for unit testing. The plan is to remove this version of the + interface and use the one in System.Data.Entity once we roll into the framework. + Note that some members may need to be added to the interface in the framework when + we combine the two. + + + + + The internal class used to implement and + . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Base class for and + containing common code for collection and reference navigation property entries. + + + + + Base class for all internal entries that represent different kinds of properties. + + + + + Initializes a new instance of the class. + + The internal entity entry. + The member metadata. + + + + Validates this property. + + A sequence of validation errors for this property. Empty if no errors. Never null. + + + + Creates a new non-generic backed by this internal entry. + The actual subtype of the DbMemberEntry created depends on the metadata of this internal entry. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The actual subtype of the DbMemberEntry created depends on the metadata of this internal entry. + + The type of the entity. + The type of the property. + The new entry. + + + + Gets the property name. + The property is virtual to allow mocking. + + The property name. + + + + Gets or sets the current value of the navigation property. + + The current value. + + + + Gets the internal entity entry property belongs to. + This property is virtual to allow mocking. + + The internal entity entry. + + + + Gets the entry metadata. + + The entry metadata. + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Calls Load on the underlying . + + + + + Uses CreateSourceQuery on the underlying to create a query for this + navigation property. + + + + + Gets the navigation property value from the object. + + The entity. + The navigation property value. + + + + Validates that the owning entity entry is associated with an underlying and + is not just wrapping a non-attached entity. + If the entity is not detached, then the RelatedEnd for this navigation property is obtained. + + + + + Calls IsLoaded on the underlying . + + + + + Gets the related end, which will be null if the entity is not being tracked. + + The related end. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + This property is virtual so that it can be mocked. + + The current value. + + + + Gets a delegate that can be used to get the value of the property directly from the entity. + Returns null if the property does not have an accessible getter. + + The getter delegate, or null. + + + + Gets a delegate that can be used to set the value of the property directly on the entity. + Returns null if the property does not have an accessible setter. + + The setter delegate, or null. + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Gets the navigation property value from the object. + Since for a collection the related end is an , it means + that the internal representation of the navigation property is just the related end. + + The entity. + The navigation property value. + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Creates a new generic backed by this internal entry. + The actual subtype of the DbCollectionEntry created depends on the metadata of this internal entry. + + The type of the entity. + The type of the element. + The new entry. + + + + Creates a object for the given entity type + and collection element type. + + The type of the entity. + The type of the property. + Type of the element. + The set. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + + The current value. + + + + The internal class used to implement + and . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal context. + The state entry. + + + + Initializes a new instance of the class for an + entity which may or may not be attached to the context. + + The internal context. + The entity. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + + The store values. + + + + Appends a query for the properties in the entity to the given string builder that is being used to + build the eSQL query. This method may be called recursively to query for all the sub-properties of + a complex property. + + The query builder. + The qualifier with which to prefix each property name. + The dictionary that acts as a template for the properties to query. + + + + Validates that a dictionary can be obtained for the state of the entity represented by this entry. + + The method name being used to request a dictionary. + The state that is invalid for the request being processed. + + + + Calls Refresh with StoreWins on the underlying state entry. + + + + + Gets an internal object representing a reference navigation property. + This method is virtual to allow mocking. + + The navigation property. + The type of entity requested, which may be 'object' or null if any type can be accepted. + The entry. + + + + Gets an internal object representing a collection navigation property. + This method is virtual to allow mocking. + + The navigation property. + The type of entity requested, which may be 'object' or null f any type can be accepted. + The entry. + + + + Gets an internal object representing a navigation, scalar, or complex property. + This method is virtual to allow mocking. + + Name of the property. + The type of entity requested, which may be 'object' if any type can be accepted. + The entry. + + + + Gets an internal object representing a scalar or complex property. + This method is virtual to allow mocking. + + The property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Gets an internal object representing a scalar or complex property. + The property may be a nested property on the given . + + The parent property entry, or null if this is a property directly on the entity. + Name of the property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Gets an internal object representing a scalar or complex property. + The property may be a nested property on the given . + + The parent property entry, or null if this is a property directly on the entity. + Name of the property. + The property split out into its parts. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Checks that the given property name is a navigation property and is either a reference property or + collection property according to the value of requireCollection. + + + + + Gets metadata for the given property if that property is a navigation property or returns null + if it is not a navigation property. + + Name of the property. + Navigation property metadata or null. + + + + Gets the type of entity or entities at the target end of the given navigation property. + + The navigation property. + The CLR type of the entity or entities at the other end. + + + + Gets the related end for the navigation property with the given name. + + The navigation property. + + + + + Uses EDM metadata to validate that the property name exists in the model and represents a scalar or + complex property or exists in the CLR type. + This method is public and virtual so that it can be mocked. + + The property name. + The type on which the property is declared. + The type of object requested, which may be 'object' if any type can be accepted. + Metadata for the property. + + + + Splits the given property name into parts delimited by dots. + + Name of the property. + The parts of the name. + + + + Validates that this entry is associated with an underlying and + is not just wrapping a non-attached entity. + + + + + Validates entity represented by this entity entry. + This method is virtual to allow mocking. + + User defined dictionary containing additional info for custom validation. This parameter is optional and can be null. + containing validation result. Never null. + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the tracked entity. + This property is virtual to allow mocking. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + This property is virtual to allow mocking. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + This property is virtual to allow mocking. + + The original values. + + + + Checks whether or not this entry is associated with an underlying or + is just wrapping a non-attached entity. + + + + + Gets the type of the entity being tracked. + + The type of the entity. + + + + Gets the c-space entity type for this entity from the EDM. + + + + + Gets the underlying object state entry. + + + + + Gets the internal context. + + The internal context. + + + + A concrete implementation of used for properties of entities. + + + + + The internal class used to implement and + . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal entry. + The property info. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. If this is a property of an entity, then this method returns + true if the property is modified. If this is a property of a complex object, then + this method returns true if the top-level complex property on the entity is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + If this is a property of an entity, then this method marks it as modified. + If this is a property of a complex object, then this method marks the top-level + complex property as modified. + + + + + Throws if the user attempts to set a complex property to null. + + The value. + + + + Sets the given value directly onto the underlying entity object. + + The value. + True if the property had a setter that we could attempt to call; false if no setter was available. + + + + Sets the property value, potentially by setting individual nested values for a complex + property. + + The value. + + + + Gets an internal object representing a scalar or complex property of this property, + which must be a mapped complex property. + This method is virtual to allow mocking. + + The property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Validates that the owning entity entry is associated with an underlying and + is not just wrapping a non-attached entity. + + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent entity or complex property. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent entity or complex property. + That is, the original values that contains the value for this property. + + The parent original values. + + + + A delegate that reads the value of this property. + May be null if there is no way to set the value due to missing accessors on the type. + + + + + A delegate that sets the value of this property. + May be null if there is no way to set the value due to missing accessors on the type. + + + + + Gets or sets the original value. + Note that complex properties are returned as objects, not property values. + + + + + Gets or sets the current value. + Note that complex properties are returned as objects, not property values. + Also, for complex properties, the object returned is the actual complex object from the entity + and setting the complex object causes the actual object passed to be set onto the entity. + + The current value. + + + + Gets or sets a value indicating whether this property is modified. + + + + + Gets the property metadata. + + The property metadata. + + + + Initializes a new instance of the class. + + The internal entry. + The property info. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. Since this is a property of an entity this method returns + true if the property is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + Since this is a property of an entity this method marks it as modified. + + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent entity. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent entity. + That is, the original values that contains the value for this property. + + The parent original values. + + + + A concrete implementation of used for properties of complex objects. + + + + + Initializes a new instance of the class. + + The parent property entry. + The property metadata. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. Since this is a property of a complex object + this method returns true if the top-level complex property on the entity is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + Since this is a property of a complex object this method marks the top-level + complex property as modified. + + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent complex property. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent complex property. + That is, the original values that contains the value for this property. + + The parent original values. + + + + The internal class used to implement , + and . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Gets the navigation property value from the object. + For reference navigation properties, this means getting the value from the + object. + + The entity. + The navigation property value. + + + + Sets the navigation property value onto the object. + For reference navigation properties, this means setting the value onto the + object. + + The entity. + The value. + + + + Sets the given value on the given which must be an + . + This method is setup in such a way that it can easily be used by CreateDelegate without any + dynamic code generation needed. + + The type of the related entity. + The entity reference. + The value. + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + + The current value. + + + + Contains metadata about a member of an entity type or complex type. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry if the new entry is nested, otherwise null. + The new entry. + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets the name of the property. + + The name. + + + + Gets the type of the entity or complex object that on which the member is declared. + + The type that the member is declared on. + + + + Gets the type of element for the property, which for non-collection properties + is the same as the MemberType and which for collection properties is the type + of element contained in the collection. + + The type of the element. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + The types of member entries supported. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + if set to true this is a collection nav prop. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry which will always be null for navigation entries. + The new entry. + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + Contains metadata for a property of a complex object or entity. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + if set to true the property is mapped in the EDM. + if set to true the property is a complex property. + + + + Validates that the given name is a property of the declaring type (either on the CLR type or in the EDM) + and that it is a complex or scalar property rather than a nav property and then returns metadata about + the property. + + The internal context. + The type that the property is declared on. + The type of property requested, which may be 'object' if any type can be accepted. + Name of the property. + Metadata about the property, or null if the property does not exist or is a navigation property. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry if the new entry is nested, otherwise null. + The new entry. + + + + Gets a value indicating whether this is a complex property. + That is, not whether or not this is a property on a complex object, but rather if the + property itself is a complex property. + + + true if this instance is complex; otherwise, false. + + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets a value indicating whether this instance is mapped in the EDM. + + true if this instance is mapped; otherwise, false. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + An implementation of that wraps an existing set but makes + it read-only. + + + + + + Initializes a new instance of the class wrapped around + another existing set. + + The existing set. + + + + This is a temporary adapter class that wraps an and + presents it as an . This class will be removed once + we roll into the System.Data.Entity assembly. See + for more details. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given EntitySet and BaseType. + + + + + The EntitySet part of the pair. + + + + + The BaseType part of the pair. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given database initializer delegate and a flag + indicating whether or not it is locked. + + + + + The initializer delegate. + + + + + A flag indicating whether or not the initializer is locked and should not be changed. + + + + + Represents a raw SQL query against the context for any type where the results are never + associated with an entity set and are never tracked. + + + + + Represents a raw SQL query against the context that may be for entities in an entity set + or for some other non-entity element type. + + + + + Initializes a new instance of the class. + + The SQL. + The parameters. + + + + If the query is would track entities, then this method returns a new query that will + not track entities. + + A no-tracking query. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Gets the SQL query string, + + The SQL query. + + + + Gets the parameters. + + The parameters. + + + + Returns false. + + false. + + + + Initializes a new instance of the class. + + The internal context. + Type of the element. + The SQL. + The parameters. + + + + Returns this query since it can never be a tracking query. + + This instance. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Generic wrapper around to allow results to be + returned as generic + + The type of the element. + + + + Executes the query and returns an enumerator for the elements. + + An + + object that can be used to iterate through the elements. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Returns false. + + false. + + + + Represents a raw SQL query against the context for entities in an entity set. + + + + + Initializes a new instance of the class. + + The set. + The SQL. + if set to true then the entities will not be tracked. + The parameters. + + + + If the query is would track entities, then this method returns a new query that will + not track entities. + + A no-tracking query. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Gets a value indicating whether this instance is set to track entities or not. + + + true if this instance is no-tracking; otherwise, false. + + + + + A LazyInternalConnection object manages information that can be used to create a DbConnection object and + is responsible for creating that object and disposing it. + + + + + Creates a new LazyInternalConnection using convention to calculate the connection. + The DbConnection object will be created lazily on demand and will be disposed when the LazyInternalConnection is disposed. + + Either the database name or a connection string. + + + + Creates a new LazyInternalConnection targeting a specific database. + The DbConnection object will be created lazily on demand and will be disposed when the LazyInternalConnection is disposed. + + The connection to target. + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Disposes the underlying DbConnection. + Note that dispose actually puts the LazyInternalConnection back to its initial state such that + it can be used again. + + + + + + Searches the app.config/web.config file for a connection that matches the given name. + The connection might be a store connection or an EF connection. + + The connection name. + + True if a connection from the app.config file was found and used. + + + + Attempts to locate a connection entry in the configuration based on the supplied context name. + + The name to search for. + The configuration to search in. + Connection string if found, otherwise null. + + + + Initializes the connection based on a connection string. + + The settings to initialize from. + + + + Returns the underlying DbConnection, creating it first if it does not already exist. + + + + + Returns the origin of the underlying connection string. + + + + + Gets the name of the underlying connection string. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if connection contain model info; otherwise, false. + + + + Gets a value indicating if the lazy connection has been initialized. + + + + + A is a concrete type that will lazily create the + underlying when needed. The created is owned by the + internal context and will be disposed when the internal context is disposed. + + + + + Constructs a for the given owner that will be initialized + on first use. + + The owner . + Responsible for creating a connection lazily when the context is used for the first time. + The model, or null if it will be created by convention + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Saves all changes made in this context to the underlying database, but only if the + context has been initialized. If the context has not been initialized, then this + method does nothing because there is nothing to do; in particular, it does not + cause the context to be initialized. + + The number of objects written to the underlying database. + + + + Disposes the context. The underlying is also disposed. + The connection to the database ( object) is also disposed if it was created by + the context, otherwise it is not disposed. + + + + + + + + Initializes the underlying . + + + + + Creates an immutable, cacheable representation of the model defined by this builder. + This model can be used to create an or can be passed to a + constructor to create a for this model. + + + + + + Creates and configures the instance that will be used to build the + . + + The builder. + + + + Marks the database as having not been initialized. This is called when the app calls Database.Delete so + that the database if the app attempts to then use the database again it will be re-initialized automatically. + + + + + Marks the database as having been initialized without actually running the . + + + + + Runs the unless it has already been run or there + is no initializer for this context type in which case this method does nothing. + + + + + Performs some action (which may do nothing) in such a way that it is guaranteed only to be run + once for the model and connection in this app domain, unless it fails by throwing an exception, + in which case it will be re-tried next time the context is initialized. + + The action. + + + + Returns the underlying . + + + + + The compiled model created from the Code First pipeline, or null if Code First was + not used to create this context. + Causes the Code First pipeline to be run to create the model if it has not already been + created. + + + + + The actually being used, which may be the + temp context for initialization or the real context. + + + + + The connection underlying this context. Accessing this property does not cause the context + to be initialized, only its connection. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strings. + + + + + Gets the name of the underlying connection string. + + + + + Gets or sets the provider details to be used when building the EDM model. + + + + + + + + Gets or sets a custom OnModelCreating action. + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + Gets or sets a value indicating whether lazy loading is enabled. + If the exists, then this property acts as a wrapper over the flag stored there. + If the has not been created yet, then we store the value given so we can later + use it when we create the . This allows the flag to be changed, for example in + a DbContext constructor, without it causing the to be created. + + + + + Gets or sets a value indicating whether proxy creation is enabled. + If the ObjectContext exists, then this property acts as a wrapper over the flag stored there. + If the ObjectContext has not been created yet, then we store the value given so we can later + use it when we create the ObjectContext. This allows the flag to be changed, for example in + a DbContext constructor, without it causing the ObjectContext to be created. + + + + + A wrapping query provider that performs expression transformation and then delegates + to the provider. The objects returned are always instances + of . This provider is associated with generic objects. + + + + + Creates a provider that wraps the given provider. + + The provider to wrap. + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a . + + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a where T is determined + from the element type of the ObjectQuery. + + + + + By default, calls the same method on the wrapped provider. + + + + + By default, calls the same method on the wrapped provider. + + + + + Creates an appropriate generic IQueryable using Reflection and the underlying ElementType of + the given ObjectQuery. + + + + + Performs expression replacement and then delegates to the wrapped provider to create an + . + + + + + Wraps the given as a where T is determined + from the element type of the ObjectQuery. + + + + + Gets the internal context. + + The internal context. + + + + A LINQ expression visitor that finds uses with equivalent + instances. + + + + + Replaces calls to DbContext.Set() with an expression for the equivalent . + + The node to replace. + A new node, which may have had the replacement made. + + + + Replaces a or property with a constant expression + for the underlying . + + The node to replace. + A new node, which may have had the replacement made. + + + + Processes the fields in each constant expression and replaces instances with + the underlying ObjectQuery instance. This handles cases where the query has a closure + containing values. + + + + + Gets a value from the given member, or returns null + if the member doesn't contain a DbContext instance. + + The expression for the object for the member, which may be null for a static member. + The member. + The context or null. + + + + Gets the instance from the given instance or static member, returning null + if the member does not contain a DbContext instance. + + The member. + The value of the object to get the instance from, or null if the member is static. + The context instance or null. + + + + Takes a or and creates an expression + for the underlying . + + + + + Takes a or and extracts the underlying . + + + + + A non-generic interface implemented by that allows operations on + any query object without knowing the type to which it applies. + + + + + An interface implemented by . + + The type of the element. + + + + A non-generic interface implemented by that allows operations on + any set object without knowing the type to which it applies. + + + + + An interface implemented by . + + + + + An instance of this internal class is created whenever an instance of the public + class is needed. This allows the public surface to be non-generic, while the runtime type created + still implements . + + The type of the element. + + + + Creates a new query that will be backed by the given internal query object. + + The backing query. + + + + See comments in . + + + + + See comments in . + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the underlying internal query object. + + The internal query. + + + + An instance of this internal class is created whenever an instance of the public + class is needed. This allows the public surface to be non-generic, while the runtime type created + still implements . + + The type of the entity. + + + + Creates a new set that will be backed by the given internal set. + + The internal set. + + + + Creates an instance of this class. This method is used with CreateDelegate to cache a delegate + that can create a generic instance without calling MakeGenericType every time. + + + The internal set to wrap, or null if a new internal set should be created. + The set. + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the underlying internal query object. + + The internal query. + + + + Gets the underlying internal set. + + The internal set. + + + + See comments in . + + + + + An InternalQuery underlies every instance of DbSet and DbQuery. It acts to lazily initialize a InternalContext as well + as an ObjectQuery and EntitySet the first time that it is used. The InternalQuery also acts to expose necessary + information to other parts of the design in a controlled manner without adding a lot of internal methods and + properties to the DbSet and DbQuery classes themselves. + + The type of entity to query for. + + + + Creates a new query that will be backed by the given InternalContext. + + The backing context. + + + + Creates a new internal query based on the information in an existing query together with + a new underlying ObjectQuery. + + + + + Resets the query to its uninitialized state so that it will be re-lazy initialized the next + time it is used. This allows the ObjectContext backing a DbContext to be switched out. + + + + + Updates the underlying ObjectQuery with the given include path. + + The include path. + A new query containing the defined include path. + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Performs lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that the query can be used. + + + + + Returns a representation of the underlying query, equivalent + to ToTraceString on ObjectQuery. + + + The query string. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + The underlying InternalContext. + + + + + The underlying ObjectQuery. + + + + + The underlying ObjectQuery. + + + + + The LINQ query expression. + + + + + The LINQ query provider for the underlying . + + + + + The IQueryable element type. + + + + + Creates a new query that will be backed by the given InternalContext. + + The backing context. + + + + Resets the set to its uninitialized state so that it will be re-lazy initialized the next + time it is used. This allows the ObjectContext backing a DbContext to be switched out. + + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Finds an entity in the state manager with the given primary key values, or returns null + if no such entity can be found. This includes looking for Added entities with the given + key values. + + + + + Finds an entity in the store with the given primary key values, or returns null + if no such entity can be found. This code is adapted from TryGetObjectByKey to + include type checking in the query. + + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + This method is virtual so that it can be mocked. + + The entity to attach. + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + This method is virtual so that it can be mocked. + + The entity to add. + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + This method is virtual so that it can be mocked. + + The entity to remove. + + + + This method checks whether an entity is already in the context. If it is, then the state + is changed to the new state given. If it isn't, then the action delegate is executed to + either Add or Attach the entity. + + A delegate to Add or Attach the entity. + The new state to give the entity if it is already in the context. + The entity. + Name of the method. + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Performs lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that the query can be used. + This method is virtual so that it can be mocked. + + + + + Attempts to perform lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that o-space loading has happened and the query can be used. This method doesn't throw if the type + for the set is not mapped. + + + + + Creates an underlying for this set. + + if set to true then the query is set to be no-tracking. + The query. + + + + Returns a representation of the underlying query, equivalent + to ToTraceString on ObjectQuery. + + + The query string. + + + + + Updates the underlying ObjectQuery with the given include path. + + The include path. + A new query containing the defined include path. + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Executes the given SQL query against the database materializing entities into the entity set that + backs this set. + + The SQL quey. + if true then the entities are not tracked, otherwise they are. + The parameters. + The query results. + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the ObservableCollection representing the local view for the set based on this query. + + + + + The underlying ObjectQuery. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet name. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet name, quoted for ESQL. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet. Accessing this property will trigger lazy initialization of the query. + + + + + The base type for the underlying entity set. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying InternalContext. Accessing this property will trigger lazy initialization of the query. + + + + + The LINQ query expression. + + + + + The LINQ query provider for the underlying . + + + + + A wrapping query provider that performs expression transformation and then delegates + to the provider. The objects returned + are always instances of when the generic CreateQuery method is + used and are instances of when the non-generic CreateQuery method + is used. This provider is associated with non-generic objects. + + + + + Creates a provider that wraps the given provider. + + The provider to wrap. + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a . + + + + + Delegates to the wrapped provider except returns instances of . + + + + + Creates an appropriate generic IQueryable using Reflection and the underlying ElementType of + the given ObjectQuery. + + + + + Extends to create a sortable binding list that stays in + sync with an underlying . That is, when items are added + or removed from the binding list, they are added or removed from the ObservableCollecion, and + vice-versa. + + The list element type. + + + + An extended BindingList implementation that implements sorting. + This class was adapted from the LINQ to SQL class of the same name. + + The element type. + + + + Initializes a new instance of the class with the + the given underlying list. Note that sorting is dependent on having an actual + rather than some other ICollection implementation. + + The list. + + + + Applies sorting to the list. + + The property to sort by. + The sort direction. + + + + Stops sorting. + + + + + Gets a value indicating whether this list is sorted. + + + true if this instance is sorted; otherwise, false. + + + + + Gets the sort direction. + + The sort direction. + + + + Gets the sort property being used to sort. + + The sort property. + + + + Returns true indicating that this list supports sorting. + + true. + + + + Implements comparing for the implementation. + + + + + Initializes a new instance of the class + for sorting the list. + + The property to sort by. + The sort direction. + + + + Compares two instances of items in the list. + + The left item to compare. + The right item to compare. + + + + + Determines whether this instance can sort for the specified type. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Determines whether this instance can sort for the specified type using IComparable. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Determines whether this instance can sort for the specified type using ToString. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Initializes a new instance of a binding list backed by the given + + The obervable collection. + + + + Creates a new item to be added to the binding list. + + The new item. + + + + Cancels adding of a new item that was started with AddNew. + + Index of the item. + + + + Removes all items from the binding list and underlying ObservableCollection. + + + + + Ends the process of adding a new item that was started with AddNew. + + Index of the item. + + + + Inserts the item into the binding list at the given index. + + The index. + The item. + + + + Removes the item at the specified index. + + The index. + + + + Sets the item into the list at the given position. + + The index to insert at. + The item. + + + + Event handler to update the binding list when the underlying observable collection changes. + + The sender. + Data indicating how the collection has changed. + + + + Adds the item to the underlying observable collection. + + The item. + + + + Removes the item from the underlying from observable collection. + + The item. + + + + Adapted from to allow the initializer to take an input object and + to do one-time initialization that only has side-effects and doesn't return a value. + + The type of the input. + + + + Initializes a new instance of the class. + + The action. + + + + Performs the action unless it has already been successfully performed before. + + The input to the action; ignored if the action has already succeeded. + + + + Adapted from to allow the initializer to take an input object and + to retry initialization if it has previously failed. + + + This class can only be used to initialize reference types that will not be null when + initialized. + + The type of the input. + The type of the result. + + + + Initializes a new instance of the class. + + The value factory. + + + + Gets the value, possibly by running the initializer if it has not been run before or + if all previous times it ran resulted in exceptions. + + The input to the initializer; ignored if initialization has already succeeded. + The initialized object. + + + + Validates a property of a given EDM complex type. + + + This is a composite validator for a complex property of an entity. + + + + + Validates a property of a given EDM property type. + + + This is a composite validator for a property of an entity or a complex type. + + + + + Simple validators for the corresponding property. + + + + + Name of the property the validator was created for. + + + + + Creates an instance of for a given EDM property. + + The EDM property name. + Validators used to validate the given property. + + + + Validates a property. + + Validation context. Never null. + Property to validate. Never null. + Validation errors as . Empty if no errors. Never null. + + + + + Simple validators for the corresponding property. + + + + + Gets the name of the property the validator was created for. + + + + + The complex type validator. + + + + + Creates an instance of for a given complex property. + + The complex property name. + Validators used to validate the given property. + Complex type validator. + + + + Validates a complex property. + + Validation context. Never null. + Property to validate. Never null. + Validation errors as . Empty if no errors. Never null. + + + + + Validator used to validate a property of a given EDM ComplexType. + + + This is a composite validator. + + + + + Validator used to validate an entity of a given EDM Type. + + + This is a composite validator for an EDM Type. + + + + + Creates an instance for a given EDM type. + + Property validators. + Type level validators. + + + + Validates an instance. + + Entity validation context. Must not be null. + The entry for the complex property. Null if validating an entity. + instance. Never null. + + Protected so it doesn't appear on EntityValidator. + + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Returns a validator for a child property. + + Name of the child property for which to return a validator. + + Validator for a child property. Possibly null if there are no validators for requested property. + + + + + Creates an instance for a given EDM complex type. + + Property validators. + Type level validators. + + + + Validates an instance. + + Entity validation context. Must not be null. + The entry for the complex property. Null if validating an entity. + instance. Never null. + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Contains information needed to validate an entity or its properties. + + + + + The entity being validated or the entity that owns the property being validated. + + + + + Initializes a new instance of EntityValidationContext class. + + + The entity being validated or the entity that owns the property being validated. + + + External contexts needed for validation. + + + + + External context needed for validation. + + + + + Gets the entity being validated or the entity that owns the property being validated. + + + + + Validator used to validate an entity of a given EDM EntityType. + + + This is a top level, composite validator. This is also an entry point to getting an entity + validated as validation of an entity is always started by calling Validate method on this type. + + + + + Creates an instance for a given EDM entity type. + + Property validators. + Entity type level validators. + + + + Validates an entity. + + Entity validation context. Must not be null. + instance. Never null. + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Builds validators based on s specified on entity CLR types and properties + as well as based on presence of implementation on entity and complex + type CLR types. It's not sealed and not static for mocking purposes. + + + + + Builds an for the given . + + The entity entry to build the validator for. + Whether the currently processed type is the target type or one of the ancestor types. + + + for the given . Possibly null + if no validation has been specified for this entity type. + + + + + Builds the validator for a given and the corresponding + . + + The CLR type that corresponds to the EDM complex type. + The EDM complex type that type level validation is built for. + A for the given complex type. May be null if no validation specified. + + + + Extracted method from BuildEntityValidator and BuildComplexTypeValidator + + + + + Build validators for the and the corresponding + or . + + Properties to build validators for. + Non-navigation EDM properties. + Navigation EDM properties. + A list of validators. Possibly empty, never null. + + + + Builds a for the given and the corresponding + . If the property is a complex type, type level validators will be built here as + well. + + The CLR property to build the validator for. + The EDM property to build the validator for. + + for the given . Possibly null + if no validation has been specified for this property. + + + + + Builds a for the given transient . + + The CLR property to build the validator for. + + for the given . Possibly null + if no validation has been specified for this property. + + + + + Builds s for given that derive from + . + + Attributes used to build validators. + + A list of s built from . + Possibly empty, never null. + + + + + Returns all non-static non-indexed CLR properties from the . + + The CLR to get the properties from. + + A collection of CLR properties. Possibly empty, never null. + + + + + Builds validators based on the facets of : + * If .Nullable facet set to false adds a validator equivalent to the RequiredAttribute + * If the .MaxLength facet is specified adds a validator equivalent to the MaxLengthAttribute. + However the validator isn't added if .IsMaxLength has been set to true. + + The CLR property to build the facet validators for. + The property for which facet validators will be created + A collection of validators. + + + + Abstracts simple validators used to validate entities and properties. + + + + + Validates an entity or a property. + + Validation context. Never null. + Property to validate. Can be null for type level validation. + Validation error as. Empty if no errors. Never null. + + + + + Contract for IValidator.Validate method. + + Validation context. + Property. + Nothing - always throws. + + + + Validates entities or complex types implementing IValidatableObject interface. + + + + + Display attribute used to specify the display name for an entity or complex property. + + + + + Validates an entity or a complex type implementing IValidatableObject interface. + This method is virtual to allow mocking. + + Validation context. Never null. + + Property to validate. Null if this is the entity that will be validated. Never null if this + is the complex type that will be validated. + + Validation error as . Empty if no errors. Never null. + + + Note that is used to figure out what needs to be validated. If it not null the complex + type will be validated otherwise the entity will be validated. + Also if this is an IValidatableObject complex type but the instance (.CurrentValue) is null we won't validate + anything and will not return any errors. The reason for this is that Validation is supposed to validate using + information the user provided and not some additional implicit rules. (ObjectContext will throw for operations + that involve null complex properties). + + + + + Validates a property, complex property or an entity using validation attributes the property + or the complex/entity type is decorated with. + + + Note that this class is used for validating primitive properties using attributes declared on the property + (property level validation) and complex properties and entities using attributes declared on the type + (type level validation). + + + + + Display attribute used to specify the display name for a property or entity. + + + + + Validation attribute used to validate a property or an entity. + + + + + Creates an instance of class. + + + Validation attribute used to validate a property or an entity. + + + + + Validates a property or an entity. + + Validation context. Never null. + Property to validate. Null for entity validation. Not null for property validation. + + + Validation errors as . Empty if no errors, never null. + + + + + Used to cache and retrieve generated validators and to create context for validating entities or properties. + + + + + Collection of validators keyed by the entity CLR type. Note that if there's no validation for a given type + it will be associated with a null validator. + + + + + Initializes a new instance of class. + + + + + Returns a validator to validate . + + Entity the validator is requested for. + + to validate . Possibly null if no validation + has been specified for the entity. + + + + + Returns a validator to validate . + + Navigation property the validator is requested for. + + Validator to validate . Possibly null if no validation + has been specified for the requested property. + + + + + Gets a validator for the . + + Entity validator. + Property to get a validator for. + + Validator to validate . Possibly null if there is no validation for the + . + + + For complex properties this method walks up the type hierarchy to get to the entity level and then goes down + and gets a validator for the child property that is an ancestor of the property to validate. If a validator + returned for an ancestor is null it means that there is no validation defined beneath and the method just + propagates (and eventually returns) null. + + + + + Creates for . + + Entity entry for which a validation context needs to be created. + User defined dictionary containing additional info for custom validation. This parameter is optional and can be null. + An instance of class. + + + + + A wrapper around EntityKey that allows key/values pairs that have null values to + be used. This allows Added entities with null key values to be searched for in + the ObjectStateManager. + + + + The key name/key value pairs, where some key values may be null + + + + Creates a new WrappedEntityKey instance. + + The entity set that the key belongs to. + The fully qualified name of the given entity set. + The key values, which may be null or contain null values. + The name of the parameter passed for keyValue by the user, which is used when throwing exceptions. + + + + True if any of the key values are null, which means that the EntityKey will also be null. + + + + + An actual EntityKey, or null if any of the key values are null. + + + + + The key name/key value pairs of the key, in which some of the key values may be null. + + + + + Allows configuration to be performed for an complex type in a model. + + A ComplexTypeConfiguration can be obtained via the ComplexType method on + or a custom type derived from ComplexTypeConfiguration + can be registered via the Configurations property on . + + The complex type to be configured. + + + + Allows configuration to be performed for a type in a model. + + The type to be configured. + + + + Configures a property that is defined on this type. + + The type of the property being configured. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + The type of the property being configured. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Excludes a property from the model so that it will not be mapped to the database. + + The type of the property to be ignored. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + + + + Initializes a new instance of ComplexTypeConfiguration + + + + + Allows derived configuration classes for entities and complex types to be registered with a . + + + Derived configuration classes are created by deriving from + or and using a type to be included in the model as the generic + parameter. + + Configuration can be performed without creating derived configuration classes via the Entity and ComplexType + methods on . + + + + + Adds an to the . + Only one can be added for each type in a model. + + The entity type being configured. + The entity type configuration to be added. + The same ConfigurationRegistrar instance so that multiple calls can be chained. + + + + Adds an to the . + Only one can be added for each type in a model. + + The complex type being configured. + The complex type configuration to be added + The same ConfigurationRegistrar instance so that multiple calls can be chained. + + + + Allows the conventions used by a instance to be customized. + Currently removal of one or more default conventions is the only supported operation. + The default conventions can be found in the System.Data.Entity.ModelConfiguration.Conventions namespace. + + + + + Disables a convention for the . + The default conventions that are available for removal can be found in the System.Data.Entity.ModelConfiguration.Conventions namespace. + + The type of the convention to be disabled. + + + + Configures the table and column mapping for an entity type or a sub-set of properties from an entity type. + This configuration functionality is available via the Code First Fluent API, see . + + The entity type to be mapped. + + + + Configures the properties that will be included in this mapping fragment. + If this method is not called then all properties that have not yet been + included in a mapping fragment will be configured. + + An anonymous type including the properties to be mapped. + + A lambda expression to an anonymous type that contains the properties to be mapped. + C#: t => new { t.Id, t.Property1, t.Property2 } + VB.Net: Function(t) New With { p.Id, t.Property1, t.Property2 } + + + + + Re-maps all properties inherited from base types. + + When configuring a derived type to be mapped to a separate table this will cause all properties to + be included in the table rather than just the non-inherited properties. This is known as + Table per Concrete Type (TPC) mapping. + + + + + Configures the table name to be mapped to. + + Name of the table. + + + + Configures the table name and schema to be mapped to. + + Name of the table. + Schema of the table. + + + + Configures the discriminator column used to differentiate between types in an inheritance hierarchy. + + The name of the discriminator column. + A configuration object to further configure the discriminator column and values. + + + + Configures the discriminator condition used to differentiate between types in an inheritance hierarchy. + + The type of the property being used to discriminate between types. + + A lambda expression representing the property being used to discriminate between types. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object to further configure the discriminator condition. + + + + Moves a foreign key constraint from oldTable to newTable and updates column references + + + + + Move any FK constraints that are now completely in newTable and used to refer to oldColumn + + + + + Configures a condition used to discriminate between types in an inheritance hierarchy based on the values assigned to a property. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the condition to require a value in the property. + + Rows that do not have a value assigned to column that this property is stored in are + assumed to be of the base type of this entity type. + + + + + Populate the table mapping structure + + + + + Sets nullability for association set mappings' foreign keys for 1:* and 1:0..1 associations + when no base types share the the association set mapping's table + + + + + Makes sure only the required property mappings are present + + + + + Determines if the table and entity type need mapping, and if not, removes the existing entity type mapping + + + + + Configures a database column used to store a string values. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the column to allow the maximum length supported by the database provider. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + + Configures the column to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be variable length. + Columns are variable length by default. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be optional. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be required. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column. + + Name of the database provider specific data type. + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column. + + The order that this column should appear in the database table. + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to support Unicode string content. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the column supports Unicode string content. + + + Value indicating if the column supports Unicode string content or not. + Specifying 'null' will remove the Unicode facet from the column. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures a discriminator column used to differentiate between types in an inheritance hierarchy. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + Type of the discriminator value. + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + Type of the discriminator value. + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Initializes configurations in the ModelConfiguration so that configuration data + is in a single place + + + + + Configures a many relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be many:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:required with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:required without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:optional with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:optional without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures an optional relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be optional:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:required with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:required without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + + A lambda expression representing the navigation property on the other end of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + A configuration object that can be used to further configure the relationship. + + + + Configures an required relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be required:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:optional with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:optional without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required with a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required without a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required with a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required without a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + A configuration object that can be used to further configure the relationship. + + + + Base class for configuring a property on an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + True if the NavigationProperty's declaring type is the principal end, false if it is not, null if it is not known + + + + + Base class for performing configuration of a relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures a relationship that can support cascade on delete functionality. + + + + + Configures cascade delete to be on for the relationship. + + + + + Configures whether or not cascade delete is on for the relationship. + + Value indicating if cascade delete is on or not. + + + + Configures a relationship that can support foreign key properties that are exposed in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + The dependent entity type. + + + + Configures a relationship that can only support foreign key properties that are not exposed in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the relationship to use foreign key property(s) that are not exposed in the object model. + The column(s) and table can be customized by specifying a configuration action. + If an empty configuration action is specified then column name(s) will be generated by convention. + If foreign key properties are exposed in the object model then use the HasForeignKey method. + Not all relationships support exposing foreign key properties in the object model. + + Action that configures the foreign key column(s) and table. + + A configuration object that can be used to further configure the relationship. + + + + + Configures the relationship to use foreign key property(s) that are exposed in the object model. + If the foreign key property(s) are not exposed in the object model then use the Map method. + + The type of the key. + + A lambda expression representing the property to be used as the foreign key. + If the foreign key is made up of multiple properties then specify an anonymous type including the properties. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the principal entity type. + + A configuration object that can be used to further configure the relationship. + + + + Configures the table and column mapping of a relationship that does not expose foreign key properties in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the name of the column(s) for the foreign key. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table name that the foreign key column(s) reside in. + The table that is specified must already be mapped for the entity type. + + If you want the foreign key(s) to reside in their own table then use the Map method + on to perform + entity splitting to create the table with just the primary key property. Foreign keys can + then be added to the table via this method. + + Name of the table. + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table name and schema that the foreign key column(s) reside in. + The table that is specified must already be mapped for the entity type. + + If you want the foreign key(s) to reside in their own table then use the Map method + on to perform + entity splitting to create the table with just the primary key property. Foreign keys can + then be added to the table via this method. + + Name of the table. + Schema of the table. + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table and column mapping of a many:many relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the join table name for the relationship. + + Name of the table. + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the join table name and schema for the relationship. + + Name of the table. + Schema of the table. + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the column(s) for the left foreign key. + The left foreign key represents the navigation property specified in the HasMany call. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the column(s) for the right foreign key. + The right foreign key represents the navigation property specified in the WithMany call. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures a many:many relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the foreign key column(s) and table used to store the relationship. + + Action that configures the foreign key column(s) and table. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Used to configure a property with length facets for an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Used to configure a primitive property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to allow the maximum length supported by the database provider. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property and a default length will be used for the database column. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + Properties are variable length by default. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to allow the maximum length supported by the database provider. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + properties are variable length by default. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + properties are optional by default. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be a row version in the database. + The actual data type will vary depending on the database provider being used. + Setting the property to be a row version will automatically configure it to be an + optimistic concurrency token. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + properties are required by default. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the precision of the property. + If the database provider does not support precision for the data type of the column then the value is ignored. + + Precision of the property. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + properties are required by default. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the precision and scale of the property. + + The precision of the property. + The scale of the property. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to allow the maximum length supported by the database provider. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property and a default length will be used for the database column.. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + properties are variable length by default. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + properties are optional by default. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to support Unicode string content. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property supports Unicode string content. + + + Value indicating if the property supports Unicode string content or not. + Specifying 'null' will remove the Unicode facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Indicates what parts of a configuration are overridable. + + + + + Nothing in the configuration is overridable. + + + + + The configuration values related to C-Space are overridable. + + + + + The configuration values only related to S-Space are overridable. + + + + + True if this configuration can be replaced in the model configuration, false otherwise + This is only set to true for configurations that are registered automatically via the DbContext + + + + + Base class for conventions that process CLR attributes found in the model. + + The type of member to look for. + The type of the configuration to look for. + The type of the attribute to look for. + + + + Convention to process instances of found on properties in the model + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on foreign key properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on navigation properties in the model. + + + + + Convention to process instances of found on primitive properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to detect navigation properties to be inverses of each other when only one pair + of navigation properties exists between the related types. + + + + + Convention to configure a type as a complex type if it has no primary key, no mapped base type and no navigation properties. + + + + + Convention to convert any data types that were explicitly specified, via data annotations or API, + to be lower case. The default SqlClient provider is case sensitive and requires data types to be lower case. This convention + allows the and API to be case insensitive. + + + + + Convention to add a cascade delete to the join table from both tables involved in a many to many relationship. + + + + + Convention to ensure an invalid/unsupported mapping is not created when mapping inherited properties + + + + + Convention to set the table name to be a pluralized version of the entity type name. + + + + + Convention to set precision to 18 and scale to 2 for decimal properties. + + + + + Convention to move primary key properties to appear first. + + + + + Convention to distinguish between optional and required relationships based on CLR nullability of the foreign key property. + + + + + Convention to process instances of found on navigation properties in the model. + + + + + Convention to detect primary key properties. + Recognized naming patterns in order of precedence are: + 1. 'Id' + 2. [type name]Id + Primary key detection is case insensitive. + + + + + Convention to discover foreign key properties whose names are a combination + of the dependent navigation property name and the principal type primary key property name(s). + + + + + Convention to enable cascade delete for any required relationships. + + + + + Convention to configure the primary key(s) of the dependent entity type as foreign key(s) in a one:one relationship. + + + + + Convention to set the entity set name to be a pluralized version of the entity type name. + + + + + Convention to discover foreign key properties whose names match the principal type primary key property name(s). + + + + + Convention to set a default maximum length of 128 for properties whose type supports length facets. + + + + + Convention to set a default maximum length of 4000 for properties whose type supports length facets when SqlCe is the provider. + + + + + Convention to configure integer primary keys to be identity. + + + + + Checks for the PK property being an FK in a different table. A PK which is also an FK but + in the same table is used for table splitting and can still be an identity column because + the update pipeline is only inserting into one column of one table. + + + + + Convention to discover foreign key properties whose names are a combination + of the principal type name and the principal type primary key property name(s). + + + + + This class provide service for both the singularization and pluralization, it takes the word pairs + in the ctor following the rules that the first one is singular and the second one is plural. + + + + + Factory method for PluralizationService. Only support english pluralization. + Please set the PluralizationService on the System.Data.Entity.Design.EntityModelSchemaGenerator + to extend the service to other locales. + + CultureInfo + PluralizationService + + + + captalize the return word if the parameter is capitalized + if word is "Table", then return "Tables" + + + + + + + + separate one combine word in to two parts, prefix word and the last word(suffix word) + + + + + + + + return true when the word is "[\s]*" or leading or tailing with spaces + or contains non alphabetical characters + + + + + + + This method allow you to add word to internal PluralizationService of English. + If the singluar or the plural value was already added by this method, then an ArgumentException will be thrown. + + + + + + + Attempt to determine the principal and dependent ends of this association. + + The following table illustrates the solution space. + + Source | Target || Prin | Dep | + -------|--------||-------|-------| + 1 | 1 || - | - | + 1 | 0..1 || Sr | Ta | + 1 | * || Sr | Ta | + 0..1 | 1 || Ta | Sr | + 0..1 | 0..1 || - | - | + 0..1 | * || Sr | Ta | + * | 1 || Ta | Sr | + * | 0..1 || Ta | Sr | + * | * || - | - | + + + + + Allows configuration to be performed for an entity type in a model. + + An EntityTypeConfiguration can be obtained via the Entity method on + or a custom type derived from EntityTypeConfiguration + can be registered via the Configurations property on . + + + + + Initializes a new instance of EntityTypeConfiguration + + + + + Configures the primary key property(s) for this entity type. + + The type of the key. + + A lambda expression representing the property to be used as the primary key. + C#: t => t.Id + VB.Net: Function(t) t.Id + + If the primary key is made up of multiple properties then specify an anonymous type including the properties. + C#: t => new { t.Id1, t.Id2 } + VB.Net: Function(t) New With { t.Id1, t.Id2 } + + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures the entity set name to be used for this entity type. + The entity set name can only be configured for the base type in each set. + + The name of the entity set. + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures the table name that this entity type is mapped to. + + The name of the table. + + + + Configures the table name that this entity type is mapped to. + + The name of the table. + The database schema of the table. + + + + Allows advanced configuration related to how this entity type is mapped to the database schema. + By default, any configuration will also apply to any type derived from this entity type. + + Derived types can be configured via the overload of Map that configures a derived type or + by using an EntityTypeConfiguration for the derived type. + + The properties of an entity can be split between multiple tables using multiple Map calls. + + Calls to Map are additive, subsequent calls will not override configuration already preformed via Map. + + An action that performs configuration against an . + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Allows advanced configuration related to how a derived entity type is mapped to the database schema. + Calls to Map are additive, subsequent calls will not override configuration already preformed via Map. + + The derived entity type to be configured. + An action that performs configuration against an . + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures an optional relationship from this entity type. + Instances of the entity type will be able to be saved to the database without this relationship being specified. + The foreign key in the database will be nullable. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures a required relationship from this entity type. + Instances of the entity type will not be able to be saved to the database unless this relationship is specified. + The foreign key in the database will be non-nullable. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures a many relationship from this entity type. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Handles mapping from a CLR property to an EDM assocation and nav. prop. + + + + + Exception thrown by during model creation when an invalid model is generated. + + + + + Initializes a new instance of ModelValidationException + + + + + Initializes a new instance of ModelValidationException + + The exception message. + + + + Initializes a new instance of ModelValidationException + + The exception message. + The inner exception. + + + + Code Contracts hook methods - Called when contracts fail. Here we detect the most common preconditions + so we can throw the correct exceptions. It also means that we can write preconditions using the + simplest Contract.Requires() form. + + + + + Returns true if a variable of this type can be assigned a null value + + + + True if a reference type or a nullable value type, + false otherwise + + + + + Exception thrown from when validating entities fails. + + + + + Initializes a new instance of DbEntityValidationException + + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + Validation results. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + The inner exception. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + Validation results. + The inner exception. + + + + Subscribes the SerializeObjectState event. + + + + + Validation results. + + + + + Holds exception state that will be serialized when the exception is serialized. + + + + + Validation results. + + + + + Completes the deserialization. + + The deserialized object. + + + + Validation results. + + + + + Represents validation results for single entity. + + + + + Entity entry the results applies to. Never null. + + + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Creates an instance of class. + + + Entity entry the results applies to. Never null. + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Creates an instance of class. + + + Entity entry the results applies to. Never null. + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Gets an instance of the results applies to. + + + + + Gets validation errors. Never null. + + + + + Gets an indicator if the entity is valid. + + + + + Exception thrown from when an exception is thrown from the validation + code. + + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + The inner exception. + + + + Initializes a new instance of DbUnexpectedValidationException with the specified serialization info and + context. + + The serialization info. + The streaming context. + + + + Validation error. Can be either entity or property level validation error. + + + + + Name of the invalid property. Can be null (e.g. for entity level validations) + + + + + Validation error message. + + + + + Creates an instance of . + + Name of the invalid property. Can be null. + Validation error message. Can be null. + + + + Gets name of the invalid property. + + + + + Gets validation error message. + + + + diff --git a/TestApps/LOCTester/bin/Debug/LOC.Core.dll b/TestApps/LOCTester/bin/Debug/LOC.Core.dll new file mode 100644 index 000000000..b75de43c2 Binary files /dev/null and b/TestApps/LOCTester/bin/Debug/LOC.Core.dll differ diff --git a/TestApps/LOCTester/bin/Debug/LOC.Core.pdb b/TestApps/LOCTester/bin/Debug/LOC.Core.pdb new file mode 100644 index 000000000..6cb8b88dc Binary files /dev/null and b/TestApps/LOCTester/bin/Debug/LOC.Core.pdb differ diff --git a/TestApps/LOCTester/bin/Debug/LOCTester.exe b/TestApps/LOCTester/bin/Debug/LOCTester.exe new file mode 100644 index 000000000..51c3bdca0 Binary files /dev/null and b/TestApps/LOCTester/bin/Debug/LOCTester.exe differ diff --git a/TestApps/LOCTester/bin/Debug/LOCTester.exe.config b/TestApps/LOCTester/bin/Debug/LOCTester.exe.config new file mode 100644 index 000000000..2bd078d0c --- /dev/null +++ b/TestApps/LOCTester/bin/Debug/LOCTester.exe.config @@ -0,0 +1,18 @@ + + + + +
+ + + + + + \ No newline at end of file diff --git a/TestApps/LOCTester/bin/Debug/LOCTester.pdb b/TestApps/LOCTester/bin/Debug/LOCTester.pdb new file mode 100644 index 000000000..92a434b17 Binary files /dev/null and b/TestApps/LOCTester/bin/Debug/LOCTester.pdb differ diff --git a/TestApps/LOCTester/bin/Debug/LOCTester.vshost.exe b/TestApps/LOCTester/bin/Debug/LOCTester.vshost.exe new file mode 100644 index 000000000..bb84a51ac Binary files /dev/null and b/TestApps/LOCTester/bin/Debug/LOCTester.vshost.exe differ diff --git a/TestApps/LOCTester/bin/Debug/LOCTester.vshost.exe.config b/TestApps/LOCTester/bin/Debug/LOCTester.vshost.exe.config new file mode 100644 index 000000000..2bd078d0c --- /dev/null +++ b/TestApps/LOCTester/bin/Debug/LOCTester.vshost.exe.config @@ -0,0 +1,18 @@ + + + + +
+ + + + + + \ No newline at end of file diff --git a/TestApps/LOCTester/bin/Debug/LOCTester.vshost.exe.manifest b/TestApps/LOCTester/bin/Debug/LOCTester.vshost.exe.manifest new file mode 100644 index 000000000..061c9ca95 --- /dev/null +++ b/TestApps/LOCTester/bin/Debug/LOCTester.vshost.exe.manifest @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/TestApps/LOCTester/bin/Debug/Newtonsoft.Json.dll b/TestApps/LOCTester/bin/Debug/Newtonsoft.Json.dll new file mode 100644 index 000000000..dc9283f4c Binary files /dev/null and b/TestApps/LOCTester/bin/Debug/Newtonsoft.Json.dll differ diff --git a/TestApps/LOCTester/bin/Debug/Newtonsoft.Json.xml b/TestApps/LOCTester/bin/Debug/Newtonsoft.Json.xml new file mode 100644 index 000000000..ee891563c --- /dev/null +++ b/TestApps/LOCTester/bin/Debug/Newtonsoft.Json.xml @@ -0,0 +1,7343 @@ + + + + Newtonsoft.Json + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class with the specified . + + + + + Reads the next JSON token from the stream. + + true if the next token was read successfully; false if there are no more tokens to read. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Skips the children of the current token. + + + + + Sets the current token. + + The new token. + + + + Sets the current token and value. + + The new token. + The value. + + + + Sets the state based on current token type. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Releases unmanaged and - optionally - managed resources + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Changes the to Closed. + + + + + Gets the current reader state. + + The current reader state. + + + + Gets or sets a value indicating whether the underlying stream or + should be closed when the reader is closed. + + + true to close the underlying stream or when + the reader is closed; otherwise false. The default is true. + + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + Get or set how time zones are handling when reading JSON. + + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Gets the type of the current JSON token. + + + + + Gets the text value of the current JSON token. + + + + + Gets The Common Language Runtime (CLR) type for the current JSON token. + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Gets the path of the current JSON token. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Specifies the state of the reader. + + + + + The Read method has not been called. + + + + + The end of the file has been reached successfully. + + + + + Reader is at a property. + + + + + Reader is at the start of an object. + + + + + Reader is in an object. + + + + + Reader is at the start of an array. + + + + + Reader is in an array. + + + + + The Close method has been called. + + + + + Reader has just read a value. + + + + + Reader is at the start of a constructor. + + + + + Reader in a constructor. + + + + + An error occurred that prevents the read operation from continuing. + + + + + The end of the file has been reached successfully. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The reader. + + + + Initializes a new instance of the class. + + The stream. + if set to true the root object will be read as a JSON array. + The used when reading values from BSON. + + + + Initializes a new instance of the class. + + The reader. + if set to true the root object will be read as a JSON array. + The used when reading values from BSON. + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + + A . This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Changes the to Closed. + + + + + Gets or sets a value indicating whether binary data reading should compatible with incorrect Json.NET 3.5 written binary. + + + true if binary data reading will be compatible with incorrect Json.NET 3.5 written binary; otherwise, false. + + + + + Gets or sets a value indicating whether the root object will be read as a JSON array. + + + true if the root object will be read as a JSON array; otherwise, false. + + + + + Gets or sets the used when reading values from BSON. + + The used when reading values from BSON. + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Creates an instance of the JsonWriter class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the end of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the end of an array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end constructor. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes the end of the current Json object or array. + + + + + Writes the current token. + + The to read the token from. + + + + Writes the specified end token. + + The end token to write. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON without changing the writer's state. + + The raw JSON to write. + + + + Writes raw JSON where a value is expected and updates the writer's state. + + The raw JSON to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + An error will raised if the value cannot be written as a single JSON token. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Gets or sets a value indicating whether the underlying stream or + should be closed when the writer is closed. + + + true to close the underlying stream or when + the writer is closed; otherwise false. The default is true. + + + + + Gets the top. + + The top. + + + + Gets the state of the writer. + + + + + Gets the path of the writer. + + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling when writing JSON. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The writer. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Writes the end. + + The token. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes raw JSON where a value is expected and updates the writer's state. + + The raw JSON to write. + + + + Writes the beginning of a Json array. + + + + + Writes the beginning of a Json object. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Closes this stream and the underlying stream. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value that represents a BSON object id. + + + + + + Writes a BSON regex. + + The regex pattern. + The regex options. + + + + Gets or sets the used when writing values to BSON. + When set to no conversion will occur. + + The used when writing values to BSON. + + + + Represents a BSON Oid (object id). + + + + + Initializes a new instance of the class. + + The Oid value. + + + + Gets or sets the value of the Oid. + + The value of the Oid. + + + + Converts a binary value to and from a base 64 string value. + + + + + Converts an object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets the of the JSON produced by the JsonConverter. + + The of the JSON produced by the JsonConverter. + + + + Gets a value indicating whether this can read JSON. + + true if this can read JSON; otherwise, false. + + + + Gets a value indicating whether this can write JSON. + + true if this can write JSON; otherwise, false. + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Create a custom object + + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Creates an object which will then be populated by the serializer. + + Type of the object. + + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets a value indicating whether this can write JSON. + + + true if this can write JSON; otherwise, false. + + + + + Provides a base class for converting a to and from JSON. + + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an Entity Framework EntityKey to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an ExpandoObject to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets a value indicating whether this can write JSON. + + + true if this can write JSON; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON and BSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON and BSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an to and from its name string value. + + + Converts an to and from its name string value. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + A cached representation of the Enum string representation to respect per Enum field name. + + The type of the Enum. + A map of enum field name to either the field name, or the configured enum member name (). + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets or sets a value indicating whether the written enum text should be camel case. + + true if the written enum text will be camel case; otherwise, false. + + + + Specifies how constructors are used when initializing objects during deserialization by the . + + + + + First attempt to use the public default constructor, then fall back to single paramatized constructor, then the non-public default constructor. + + + + + Json.NET will use a non-public default constructor before falling back to a paramatized constructor. + + + + + Converts a to and from a string (e.g. "1.2.3.4"). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing property value of the JSON that is being converted. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Specifies how dates are formatted when writing JSON text. + + + + + Dates are written in the ISO 8601 format, e.g. "2012-03-21T05:40Z". + + + + + Dates are written in the Microsoft JSON format, e.g. "\/Date(1198908717056)\/". + + + + + Specifies how to treat the time value when converting between string and . + + + + + Treat as local time. If the object represents a Coordinated Universal Time (UTC), it is converted to the local time. + + + + + Treat as a UTC. If the object represents a local time, it is converted to a UTC. + + + + + Treat as a local time if a is being converted to a string. + If a string is being converted to , convert to a local time if a time zone is specified. + + + + + Time zone information should be preserved when converting. + + + + + Specifies formatting options for the . + + + + + No special formatting is applied. This is the default. + + + + + Causes child objects to be indented according to the and settings. + + + + + Instructs the to use the specified constructor when deserializing that object. + + + + + Represents a raw JSON string. + + + + + Represents a value in JSON (string, integer, date, etc). + + + + + Represents an abstract JSON token. + + + + + Represents a collection of objects. + + The type of token + + + + Gets the with the specified key. + + + + + + Provides an interface to enable a class to return line and position information. + + + + + Gets a value indicating whether the class can return line information. + + + true if LineNumber and LinePosition can be provided; otherwise, false. + + + + + Gets the current line number. + + The current line number or 0 if no line information is available (for example, HasLineInfo returns false). + + + + Gets the current line position. + + The current line position or 0 if no line information is available (for example, HasLineInfo returns false). + + + + Compares the values of two tokens, including the values of all descendant tokens. + + The first to compare. + The second to compare. + true if the tokens are equal; otherwise false. + + + + Adds the specified content immediately after this token. + + A content object that contains simple content or a collection of content objects to be added after this token. + + + + Adds the specified content immediately before this token. + + A content object that contains simple content or a collection of content objects to be added before this token. + + + + Returns a collection of the ancestor tokens of this token. + + A collection of the ancestor tokens of this token. + + + + Returns a collection of the sibling tokens after this token, in document order. + + A collection of the sibling tokens after this tokens, in document order. + + + + Returns a collection of the sibling tokens before this token, in document order. + + A collection of the sibling tokens before this token, in document order. + + + + Gets the with the specified key converted to the specified type. + + The type to convert the token to. + The token key. + The converted token value. + + + + Returns a collection of the child tokens of this token, in document order. + + An of containing the child tokens of this , in document order. + + + + Returns a collection of the child tokens of this token, in document order, filtered by the specified type. + + The type to filter the child tokens on. + A containing the child tokens of this , in document order. + + + + Returns a collection of the child values of this token, in document order. + + The type to convert the values to. + A containing the child values of this , in document order. + + + + Removes this token from its parent. + + + + + Replaces this token with the specified token. + + The value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Returns the indented JSON for this token. + + + The indented JSON for this token. + + + + + Returns the JSON for this token using the given formatting and converters. + + Indicates how the output is formatted. + A collection of which will be used when writing the token. + The JSON for this token using the given formatting and converters. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Creates an for this token. + + An that can be used to read this token and its descendants. + + + + Creates a from an object. + + The object that will be used to create . + A with the value of the specified object + + + + Creates a from an object using the specified . + + The object that will be used to create . + The that will be used when reading the object. + A with the value of the specified object + + + + Creates the specified .NET type from the . + + The new object created from the JSON value. + + + + Creates the specified .NET type from the using the specified . + + The that will be used when creating the object. + The new object created from the JSON value. + + + + Creates a from a . + + An positioned at the token to read into this . + + An that contains the token and its descendant tokens + that were read from the reader. The runtime type of the token is determined + by the token type of the first token encountered in the reader. + + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from a . + + An positioned at the token to read into this . + + An that contains the token and its descendant tokens + that were read from the reader. The runtime type of the token is determined + by the token type of the first token encountered in the reader. + + + + + Selects the token that matches the object path. + + + The object path from the current to the + to be returned. This must be a string of property names or array indexes separated + by periods, such as Tables[0].DefaultView[0].Price in C# or + Tables(0).DefaultView(0).Price in Visual Basic. + + The that matches the object path or a null reference if no matching token is found. + + + + Selects the token that matches the object path. + + + The object path from the current to the + to be returned. This must be a string of property names or array indexes separated + by periods, such as Tables[0].DefaultView[0].Price in C# or + Tables(0).DefaultView(0).Price in Visual Basic. + + A flag to indicate whether an error should be thrown if no token is found. + The that matches the object path. + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Creates a new instance of the . All child tokens are recursively cloned. + + A new instance of the . + + + + Gets a comparer that can compare two tokens for value equality. + + A that can compare two nodes for value equality. + + + + Gets or sets the parent. + + The parent. + + + + Gets the root of this . + + The root of this . + + + + Gets the node type for this . + + The type. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Gets the next sibling token of this node. + + The that contains the next sibling token. + + + + Gets the previous sibling token of this node. + + The that contains the previous sibling token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Get the first child token of this token. + + A containing the first child token of the . + + + + Get the last child token of this token. + + A containing the last child token of the . + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Creates a comment with the given value. + + The value. + A comment with the given value. + + + + Creates a string with the given value. + + The value. + A string with the given value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Indicates whether the current object is equal to another object of the same type. + + + true if the current object is equal to the parameter; otherwise, false. + + An object to compare with this object. + + + + Determines whether the specified is equal to the current . + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + + The parameter is null. + + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format. + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format provider. + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format. + The format provider. + + A that represents this instance. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. + + An object to compare with this instance. + + A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: + Value + Meaning + Less than zero + This instance is less than . + Zero + This instance is equal to . + Greater than zero + This instance is greater than . + + + is not the same type as this instance. + + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Gets the node type for this . + + The type. + + + + Gets or sets the underlying token value. + + The underlying token value. + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class. + + The raw json. + + + + Creates an instance of with the content of the reader's current token. + + The reader. + An instance of with the content of the reader's current token. + + + + Indicating whether a property is required. + + + + + The property is not required. The default state. + + + + + The property must be defined in JSON but can be a null value. + + + + + The property must be defined in JSON and cannot be a null value. + + + + + Contract details for a used by the . + + + + + Contract details for a used by the . + + + + + Gets the underlying type for the contract. + + The underlying type for the contract. + + + + Gets or sets the type created during deserialization. + + The type created during deserialization. + + + + Gets or sets whether this type contract is serialized as a reference. + + Whether this type contract is serialized as a reference. + + + + Gets or sets the default for this contract. + + The converter. + + + + Gets or sets the method called immediately after deserialization of the object. + + The method called immediately after deserialization of the object. + + + + Gets or sets the method called during deserialization of the object. + + The method called during deserialization of the object. + + + + Gets or sets the method called after serialization of the object graph. + + The method called after serialization of the object graph. + + + + Gets or sets the method called before serialization of the object. + + The method called before serialization of the object. + + + + Gets or sets the default creator method used to create the object. + + The default creator method used to create the object. + + + + Gets or sets a value indicating whether the default creator is non public. + + true if the default object creator is non-public; otherwise, false. + + + + Gets or sets the method called when an error is thrown during the serialization of the object. + + The method called when an error is thrown during the serialization of the object. + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets the object's properties. + + The object's properties. + + + + Gets or sets the property name resolver. + + The property name resolver. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the ISerializable object constructor. + + The ISerializable object constructor. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Get and set values for a using dynamic methods. + + + + + Provides methods to get and set values. + + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + Initializes a new instance of the class. + + The member info. + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + Provides data for the Error event. + + + + + Initializes a new instance of the class. + + The current object. + The error context. + + + + Gets the current object the error event is being raised against. + + The current object the error event is being raised against. + + + + Gets the error context. + + The error context. + + + + Represents a view of a . + + + + + Initializes a new instance of the class. + + The name. + Type of the property. + + + + When overridden in a derived class, returns whether resetting an object changes its value. + + + true if resetting the component changes its value; otherwise, false. + + The component to test for reset capability. + + + + + When overridden in a derived class, gets the current value of the property on a component. + + + The value of a property for a given component. + + The component with the property for which to retrieve the value. + + + + + When overridden in a derived class, resets the value for this property of the component to the default value. + + The component with the property value that is to be reset to the default value. + + + + + When overridden in a derived class, sets the value of the component to a different value. + + The component with the property value that is to be set. + The new value. + + + + + When overridden in a derived class, determines a value indicating whether the value of this property needs to be persisted. + + + true if the property should be persisted; otherwise, false. + + The component with the property to be examined for persistence. + + + + + When overridden in a derived class, gets the type of the component this property is bound to. + + + A that represents the type of component this property is bound to. When the or methods are invoked, the object specified might be an instance of this type. + + + + + When overridden in a derived class, gets a value indicating whether this property is read-only. + + + true if the property is read-only; otherwise, false. + + + + + When overridden in a derived class, gets the type of the property. + + + A that represents the type of the property. + + + + + Gets the hash code for the name of the member. + + + + The hash code for the name of the member. + + + + + Used to resolve references when serializing and deserializing JSON by the . + + + + + Resolves a reference to its object. + + The serialization context. + The reference to resolve. + The object that + + + + Gets the reference for the sepecified object. + + The serialization context. + The object to get a reference for. + The reference to the object. + + + + Determines whether the specified object is referenced. + + The serialization context. + The object to test for a reference. + + true if the specified object is referenced; otherwise, false. + + + + + Adds a reference to the specified object. + + The serialization context. + The reference. + The object to reference. + + + + Specifies reference handling options for the . + + + + + Do not preserve references when serializing types. + + + + + Preserve references when serializing into a JSON object structure. + + + + + Preserve references when serializing into a JSON array structure. + + + + + Preserve references when serializing. + + + + + Instructs the how to serialize the collection. + + + + + Instructs the how to serialize the object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets the id. + + The id. + + + + Gets or sets the title. + + The title. + + + + Gets or sets the description. + + The description. + + + + Gets or sets a value that indicates whether to preserve object reference data. + + + true to keep object reference; otherwise, false. The default is false. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a flag indicating whether the array can contain null items + + A flag indicating whether the array can contain null items. + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets a value indicating whether null items are allowed in the collection. + + true if null items are allowed in the collection; otherwise, false. + + + + Specifies default value handling options for the . + + + + + Include members where the member value is the same as the member's default value when serializing objects. + Included members are written to JSON. Has no effect when deserializing. + + + + + Ignore members where the member value is the same as the member's default value when serializing objects + so that is is not written to JSON, and ignores setting members when the JSON value equals the member's default value. + + + + + Members with a default value but no JSON will be set to their default value when deserializing. + + + + + Ignore members where the member value is the same as the member's default value when serializing objects + and sets members to their default value when deserializing. + + + + + Instructs the to use the specified when serializing the member or class. + + + + + Initializes a new instance of the class. + + Type of the converter. + + + + Gets the type of the converter. + + The type of the converter. + + + + Instructs the how to serialize the object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified member serialization. + + The member serialization. + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets the member serialization. + + The member serialization. + + + + Specifies the settings on a object. + + + + + Initializes a new instance of the class. + + + + + Gets or sets how reference loops (e.g. a class referencing itself) is handled. + + Reference loop handling. + + + + Gets or sets how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + Missing member handling. + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets or sets how null values are handled during serialization and deserialization. + + Null value handling. + + + + Gets or sets how null default are handled during serialization and deserialization. + + The default value handling. + + + + Gets or sets a collection that will be used during serialization. + + The converters. + + + + Gets or sets how object references are preserved by the serializer. + + The preserve references handling. + + + + Gets or sets how type name writing and reading is handled by the serializer. + + The type name handling. + + + + Gets or sets how a type name assembly is written and resolved by the serializer. + + The type name assembly format. + + + + Gets or sets how constructors are used during deserialization. + + The constructor handling. + + + + Gets or sets the contract resolver used by the serializer when + serializing .NET objects to JSON and vice versa. + + The contract resolver. + + + + Gets or sets the used by the serializer when resolving references. + + The reference resolver. + + + + Gets or sets the used by the serializer when resolving type names. + + The binder. + + + + Gets or sets the error handler called during serialization and deserialization. + + The error handler called during serialization and deserialization. + + + + Gets or sets the used by the serializer when invoking serialization callback methods. + + The context. + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling during serialization and deserialization. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Represents a reader that provides validation. + + + + + Initializes a new instance of the class that + validates the content returned from the given . + + The to read from while validating. + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. + + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Sets an event handler for receiving schema validation errors. + + + + + Gets the text value of the current Json token. + + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Gets the path of the current JSON token. + + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + + Gets the type of the current Json token. + + + + + + Gets the Common Language Runtime (CLR) type for the current Json token. + + + + + + Gets or sets the schema. + + The schema. + + + + Gets the used to construct this . + + The specified in the constructor. + + + + Compares tokens to determine whether they are equal. + + + + + Determines whether the specified objects are equal. + + The first object of type to compare. + The second object of type to compare. + + true if the specified objects are equal; otherwise, false. + + + + + Returns a hash code for the specified object. + + The for which a hash code is to be returned. + A hash code for the specified object. + The type of is a reference type and is null. + + + + Specifies the member serialization options for the . + + + + + All public members are serialized by default. Members can be excluded using or . + This is the default member serialization mode. + + + + + Only members must be marked with or are serialized. + This member serialization mode can also be set by marking the class with . + + + + + All public and private fields are serialized. Members can be excluded using or . + This member serialization mode can also be set by marking the class with . + + + + + Specifies how object creation is handled by the . + + + + + Reuse existing objects, create new objects when needed. + + + + + Only reuse existing objects. + + + + + Always create new objects. + + + + + Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Gets or sets the date time styles used when converting a date to and from JSON. + + The date time styles used when converting a date to and from JSON. + + + + Gets or sets the date time format used when converting a date to and from JSON. + + The date time format used when converting a date to and from JSON. + + + + Gets or sets the culture used when converting a date to and from JSON. + + The culture used when converting a date to and from JSON. + + + + Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing property value of the JSON that is being converted. + The calling serializer. + The object value. + + + + Converts XML to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The calling serializer. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Checks if the attributeName is a namespace attribute. + + Attribute name to test. + The attribute name prefix if it has one, otherwise an empty string. + True if attribute name is for a namespace attribute, otherwise false. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Gets or sets the name of the root element to insert when deserializing to XML if the JSON structure has produces multiple root elements. + + The name of the deserialize root element. + + + + Gets or sets a flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + true if the array attibute is written to the XML; otherwise, false. + + + + Gets or sets a value indicating whether to write the root JSON object. + + true if the JSON root object is omitted; otherwise, false. + + + + Represents a reader that provides fast, non-cached, forward-only access to JSON text data. + + + + + Initializes a new instance of the class with the specified . + + The TextReader containing the XML data to read. + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Changes the state to closed. + + + + + Gets a value indicating whether the class can return line information. + + + true if LineNumber and LinePosition can be provided; otherwise, false. + + + + + Gets the current line number. + + + The current line number or 0 if no line information is available (for example, HasLineInfo returns false). + + + + + Gets the current line position. + + + The current line position or 0 if no line information is available (for example, HasLineInfo returns false). + + + + + Instructs the to always serialize the member with the specified name. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified name. + + Name of the property. + + + + Gets or sets the null value handling used when serializing this property. + + The null value handling. + + + + Gets or sets the default value handling used when serializing this property. + + The default value handling. + + + + Gets or sets the reference loop handling used when serializing this property. + + The reference loop handling. + + + + Gets or sets the object creation handling used when deserializing this property. + + The object creation handling. + + + + Gets or sets the type name handling used when serializing this property. + + The type name handling. + + + + Gets or sets whether this property's value is serialized as a reference. + + Whether this property's value is serialized as a reference. + + + + Gets or sets the order of serialization and deserialization of a member. + + The numeric order of serialization or deserialization. + + + + Gets or sets the name of the property. + + The name of the property. + + + + Gets or sets a value indicating whether this property is required. + + + A value indicating whether this property is required. + + + + + Instructs the not to serialize the public field or public read/write property value. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Creates an instance of the JsonWriter class using the specified . + + The TextWriter to write to. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the specified end token. + + The end token to write. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + + + + + Gets or sets which character to use to quote attribute values. + + + + + Gets or sets which character to use for indenting when is set to Formatting.Indented. + + + + + Gets or sets a value indicating whether object names will be surrounded with quotes. + + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Gets the line number indicating where the error occurred. + + The line number indicating where the error occurred. + + + + Gets the line position indicating where the error occurred. + + The line position indicating where the error occurred. + + + + Gets the path to the JSON where the error occurred. + + The path to the JSON where the error occurred. + + + + Represents a collection of . + + + + + Provides methods for converting between common language runtime types and JSON types. + + + + + Represents JavaScript's boolean value true as a string. This field is read-only. + + + + + Represents JavaScript's boolean value false as a string. This field is read-only. + + + + + Represents JavaScript's null as a string. This field is read-only. + + + + + Represents JavaScript's undefined as a string. This field is read-only. + + + + + Represents JavaScript's positive infinity as a string. This field is read-only. + + + + + Represents JavaScript's negative infinity as a string. This field is read-only. + + + + + Represents JavaScript's NaN as a string. This field is read-only. + + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation using the specified. + + The value to convert. + The format the date will be converted to. + The time zone handling when the date is converted to a string. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation using the specified. + + The value to convert. + The format the date will be converted to. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + The string delimiter character. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Serializes the specified object to a JSON string. + + The object to serialize. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string. + + The object to serialize. + Indicates how the output is formatted. + + A JSON string representation of the object. + + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A JSON string representation of the object. + + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Deserializes the JSON to a .NET object. + + The JSON to deserialize. + The deserialized object from the Json string. + + + + Deserializes the JSON to a .NET object. + + The JSON to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The of object being deserialized. + The deserialized object from the Json string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + The deserialized object from the Json string. + + + + Deserializes the JSON to the given anonymous type. + + + The anonymous type to deserialize to. This can't be specified + traditionally and must be infered from the anonymous type passed + as a parameter. + + The JSON to deserialize. + The anonymous type object. + The deserialized anonymous type from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The object to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize to. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize to. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + + + Populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + + + Asynchronously populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous populate operation. + + + + + Serializes the XML node to a JSON string. + + The node to serialize. + A JSON string of the XmlNode. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + A JSON string of the XmlNode. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + Omits writing the root object. + A JSON string of the XmlNode. + + + + Deserializes the XmlNode from a JSON string. + + The JSON string. + The deserialized XmlNode + + + + Deserializes the XmlNode from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + The deserialized XmlNode + + + + Deserializes the XmlNode from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + + A flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + The deserialized XmlNode + + + + Serializes the to a JSON string. + + The node to convert to JSON. + A JSON string of the XNode. + + + + Serializes the to a JSON string. + + The node to convert to JSON. + Indicates how the output is formatted. + A JSON string of the XNode. + + + + Serializes the to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + Omits writing the root object. + A JSON string of the XNode. + + + + Deserializes the from a JSON string. + + The JSON string. + The deserialized XNode + + + + Deserializes the from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + The deserialized XNode + + + + Deserializes the from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + + A flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + The deserialized XNode + + + + The exception thrown when an error occurs during Json serialization or deserialization. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Serializes and deserializes objects into and from the JSON format. + The enables you to control how objects are encoded into JSON. + + + + + Initializes a new instance of the class. + + + + + Creates a new instance using the specified . + + The settings to be applied to the . + A new instance using the specified . + + + + Populates the JSON values onto the target object. + + The that contains the JSON structure to reader values from. + The target object to populate values onto. + + + + Populates the JSON values onto the target object. + + The that contains the JSON structure to reader values from. + The target object to populate values onto. + + + + Deserializes the Json structure contained by the specified . + + The that contains the JSON structure to deserialize. + The being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The type of the object to deserialize. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Occurs when the errors during serialization and deserialization. + + + + + Gets or sets the used by the serializer when resolving references. + + + + + Gets or sets the used by the serializer when resolving type names. + + + + + Gets or sets how type name writing and reading is handled by the serializer. + + + + + Gets or sets how a type name assembly is written and resolved by the serializer. + + The type name assembly format. + + + + Gets or sets how object references are preserved by the serializer. + + + + + Get or set how reference loops (e.g. a class referencing itself) is handled. + + + + + Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + + + + Get or set how null values are handled during serialization and deserialization. + + + + + Get or set how null default are handled during serialization and deserialization. + + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets or sets how constructors are used during deserialization. + + The constructor handling. + + + + Gets a collection that will be used during serialization. + + Collection that will be used during serialization. + + + + Gets or sets the contract resolver used by the serializer when + serializing .NET objects to JSON and vice versa. + + + + + Gets or sets the used by the serializer when invoking serialization callback methods. + + The context. + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling during serialization and deserialization. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Contains the LINQ to JSON extension methods. + + + + + Returns a collection of tokens that contains the ancestors of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the ancestors of every node in the source collection. + + + + Returns a collection of tokens that contains the descendants of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the descendants of every node in the source collection. + + + + Returns a collection of child properties of every object in the source collection. + + An of that contains the source collection. + An of that contains the properties of every object in the source collection. + + + + Returns a collection of child values of every object in the source collection with the given key. + + An of that contains the source collection. + The token key. + An of that contains the values of every node in the source collection with the given key. + + + + Returns a collection of child values of every object in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child values of every object in the source collection with the given key. + + The type to convert the values to. + An of that contains the source collection. + The token key. + An that contains the converted values of every node in the source collection with the given key. + + + + Returns a collection of converted child values of every object in the source collection. + + The type to convert the values to. + An of that contains the source collection. + An that contains the converted values of every node in the source collection. + + + + Converts the value. + + The type to convert the value to. + A cast as a of . + A converted value. + + + + Converts the value. + + The source collection type. + The type to convert the value to. + A cast as a of . + A converted value. + + + + Returns a collection of child tokens of every array in the source collection. + + The source collection type. + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child tokens of every array in the source collection. + + An of that contains the source collection. + The type to convert the values to. + The source collection type. + An that contains the converted values of every node in the source collection. + + + + Returns the input typed as . + + An of that contains the source collection. + The input typed as . + + + + Returns the input typed as . + + The source collection type. + An of that contains the source collection. + The input typed as . + + + + Represents a JSON constructor. + + + + + Represents a token that can contain other tokens. + + + + + Raises the event. + + The instance containing the event data. + + + + Raises the event. + + The instance containing the event data. + + + + Raises the event. + + The instance containing the event data. + + + + Returns a collection of the child tokens of this token, in document order. + + + An of containing the child tokens of this , in document order. + + + + + Returns a collection of the child values of this token, in document order. + + The type to convert the values to. + + A containing the child values of this , in document order. + + + + + Returns a collection of the descendant tokens for this token in document order. + + An containing the descendant tokens of the . + + + + Adds the specified content as children of this . + + The content to be added. + + + + Adds the specified content as the first children of this . + + The content to be added. + + + + Creates an that can be used to add tokens to the . + + An that is ready to have content written to it. + + + + Replaces the children nodes of this token with the specified content. + + The content. + + + + Removes the child nodes from this token. + + + + + Occurs when the list changes or an item in the list changes. + + + + + Occurs before an item is added to the collection. + + + + + Occurs when the items list of the collection has changed, or the collection is reset. + + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Get the first child token of this token. + + + A containing the first child token of the . + + + + + Get the last child token of this token. + + + A containing the last child token of the . + + + + + Gets the count of child JSON tokens. + + The count of child JSON tokens + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name. + + The constructor name. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets or sets the name of this constructor. + + The constructor name. + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a collection of objects. + + The type of token + + + + An empty collection of objects. + + + + + Initializes a new instance of the struct. + + The enumerable. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + + + + Determines whether the specified is equal to this instance. + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the with the specified key. + + + + + + Represents a JSON object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Gets an of this object's properties. + + An of this object's properties. + + + + Gets a the specified name. + + The property name. + A with the specified name or null. + + + + Gets an of this object's property values. + + An of this object's property values. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Creates a from an object. + + The object that will be used to create . + The that will be used to read the object. + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Adds the specified property name. + + Name of the property. + The value. + + + + Removes the property with the specified name. + + Name of the property. + true if item was successfully removed; otherwise, false. + + + + Tries the get value. + + Name of the property. + The value. + true if a value was successfully retrieved; otherwise, false. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Raises the event with the provided arguments. + + Name of the property. + + + + Raises the event with the provided arguments. + + Name of the property. + + + + Returns the properties for this instance of a component. + + + A that represents the properties for this component instance. + + + + + Returns the properties for this instance of a component using the attribute array as a filter. + + An array of type that is used as a filter. + + A that represents the filtered properties for this component instance. + + + + + Returns a collection of custom attributes for this instance of a component. + + + An containing the attributes for this object. + + + + + Returns the class name of this instance of a component. + + + The class name of the object, or null if the class does not have a name. + + + + + Returns the name of this instance of a component. + + + The name of the object, or null if the object does not have a name. + + + + + Returns a type converter for this instance of a component. + + + A that is the converter for this object, or null if there is no for this object. + + + + + Returns the default event for this instance of a component. + + + An that represents the default event for this object, or null if this object does not have events. + + + + + Returns the default property for this instance of a component. + + + A that represents the default property for this object, or null if this object does not have properties. + + + + + Returns an editor of the specified type for this instance of a component. + + A that represents the editor for this object. + + An of the specified type that is the editor for this object, or null if the editor cannot be found. + + + + + Returns the events for this instance of a component using the specified attribute array as a filter. + + An array of type that is used as a filter. + + An that represents the filtered events for this component instance. + + + + + Returns the events for this instance of a component. + + + An that represents the events for this component instance. + + + + + Returns an object that contains the property described by the specified property descriptor. + + A that represents the property whose owner is to be found. + + An that represents the owner of the specified property. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Occurs when a property value changes. + + + + + Occurs when a property value is changing. + + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets or sets the with the specified property name. + + + + + + Represents a JSON array. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Creates a from an object. + + The object that will be used to create . + The that will be used to read the object. + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Determines the index of a specific item in the . + + The object to locate in the . + + The index of if found in the list; otherwise, -1. + + + + + Inserts an item to the at the specified index. + + The zero-based index at which should be inserted. + The object to insert into the . + + is not a valid index in the . + The is read-only. + + + + Removes the item at the specified index. + + The zero-based index of the item to remove. + + is not a valid index in the . + The is read-only. + + + + Adds an item to the . + + The object to add to the . + The is read-only. + + + + Removes all items from the . + + The is read-only. + + + + Determines whether the contains a specific value. + + The object to locate in the . + + true if is found in the ; otherwise, false. + + + + + Removes the first occurrence of a specific object from the . + + The object to remove from the . + + true if was successfully removed from the ; otherwise, false. This method also returns false if is not found in the original . + + The is read-only. + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets or sets the at the specified index. + + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class. + + The token to read from. + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Initializes a new instance of the class writing to the given . + + The container being written to. + + + + Initializes a new instance of the class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end. + + The token. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Gets the token being writen. + + The token being writen. + + + + Represents a JSON property. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class. + + The property name. + The property content. + + + + Initializes a new instance of the class. + + The property name. + The property content. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets the property name. + + The property name. + + + + Gets or sets the property value. + + The property value. + + + + Gets the node type for this . + + The type. + + + + Specifies the type of token. + + + + + No token type has been set. + + + + + A JSON object. + + + + + A JSON array. + + + + + A JSON constructor. + + + + + A JSON object property. + + + + + A comment. + + + + + An integer value. + + + + + A float value. + + + + + A string value. + + + + + A boolean value. + + + + + A null value. + + + + + An undefined value. + + + + + A date value. + + + + + A raw JSON value. + + + + + A collection of bytes value. + + + + + A Guid value. + + + + + A Uri value. + + + + + A TimeSpan value. + + + + + Contains the JSON schema extension methods. + + + + + Determines whether the is valid. + + The source to test. + The schema to test with. + + true if the specified is valid; otherwise, false. + + + + + Determines whether the is valid. + + The source to test. + The schema to test with. + When this method returns, contains any error messages generated while validating. + + true if the specified is valid; otherwise, false. + + + + + Validates the specified . + + The source to test. + The schema to test with. + + + + Validates the specified . + + The source to test. + The schema to test with. + The validation event handler. + + + + Returns detailed information about the schema exception. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Gets the line number indicating where the error occurred. + + The line number indicating where the error occurred. + + + + Gets the line position indicating where the error occurred. + + The line position indicating where the error occurred. + + + + Gets the path to the JSON where the error occurred. + + The path to the JSON where the error occurred. + + + + Resolves from an id. + + + + + Initializes a new instance of the class. + + + + + Gets a for the specified id. + + The id. + A for the specified id. + + + + Gets or sets the loaded schemas. + + The loaded schemas. + + + + Specifies undefined schema Id handling options for the . + + + + + Do not infer a schema Id. + + + + + Use the .NET type name as the schema Id. + + + + + Use the assembly qualified .NET type name as the schema Id. + + + + + Returns detailed information related to the . + + + + + Gets the associated with the validation error. + + The JsonSchemaException associated with the validation error. + + + + Gets the path of the JSON location where the validation error occurred. + + The path of the JSON location where the validation error occurred. + + + + Gets the text description corresponding to the validation error. + + The text description. + + + + Represents the callback method that will handle JSON schema validation events and the . + + + + + Resolves member mappings for a type, camel casing property names. + + + + + Used by to resolves a for a given . + + + + + Used by to resolves a for a given . + + + + + Resolves the contract for a given type. + + The type to resolve a contract for. + The contract for a given type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + If set to true the will use a cached shared with other resolvers of the same type. + Sharing the cache will significantly performance because expensive reflection will only happen once but could cause unexpected + behavior if different instances of the resolver are suppose to produce different results. When set to false it is highly + recommended to reuse instances with the . + + + + + Resolves the contract for a given type. + + The type to resolve a contract for. + The contract for a given type. + + + + Gets the serializable members for the type. + + The type to get serializable members for. + The serializable members for the type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates the constructor parameters. + + The constructor to create properties for. + The type's member properties. + Properties for the given . + + + + Creates a for the given . + + The matching member property. + The constructor parameter. + A created for the given . + + + + Resolves the default for the contract. + + Type of the object. + + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Determines which contract type is created for the given type. + + Type of the object. + A for the given type. + + + + Creates properties for the given . + + The type to create properties for. + /// The member serialization mode for the type. + Properties for the given . + + + + Creates the used by the serializer to get and set values from a member. + + The member. + The used by the serializer to get and set values from a member. + + + + Creates a for the given . + + The member's parent . + The member to create a for. + A created for the given . + + + + Resolves the name of the property. + + Name of the property. + Name of the property. + + + + Gets a value indicating whether members are being get and set using dynamic code generation. + This value is determined by the runtime permissions available. + + + true if using dynamic code generation; otherwise, false. + + + + + Gets or sets the default members search flags. + + The default members search flags. + + + + Gets or sets a value indicating whether compiler generated members should be serialized. + + + true if serialized compiler generated members; otherwise, false. + + + + + Gets or sets a value indicating whether to ignore the interface when serializing and deserializing types. + + + true if the interface will be ignored when serializing and deserializing types; otherwise, false. + + + + + Gets or sets a value indicating whether to ignore the attribute when serializing and deserializing types. + + + true if the attribute will be ignored when serializing and deserializing types; otherwise, false. + + + + + Initializes a new instance of the class. + + + + + Resolves the name of the property. + + Name of the property. + The property name camel cased. + + + + The default serialization binder used when resolving and loading classes from type names. + + + + + When overridden in a derived class, controls the binding of a serialized object to a type. + + Specifies the name of the serialized object. + Specifies the name of the serialized object. + + The type of the object the formatter creates a new instance of. + + + + + When overridden in a derived class, controls the binding of a serialized object to a type. + + The type of the object the formatter creates a new instance of. + Specifies the name of the serialized object. + Specifies the name of the serialized object. + + + + Provides information surrounding an error. + + + + + Gets or sets the error. + + The error. + + + + Gets the original object that caused the error. + + The original object that caused the error. + + + + Gets the member that caused the error. + + The member that caused the error. + + + + Gets the path of the JSON location where the error occurred. + + The path of the JSON location where the error occurred. + + + + Gets or sets a value indicating whether this is handled. + + true if handled; otherwise, false. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets the of the collection items. + + The of the collection items. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the property name resolver. + + The property name resolver. + + + + Gets the of the dictionary keys. + + The of the dictionary keys. + + + + Gets the of the dictionary values. + + The of the dictionary values. + + + + Maps a JSON property to a .NET member or constructor parameter. + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Gets or sets the name of the property. + + The name of the property. + + + + Gets or sets the type that declared this property. + + The type that declared this property. + + + + Gets or sets the order of serialization and deserialization of a member. + + The numeric order of serialization or deserialization. + + + + Gets or sets the name of the underlying member or parameter. + + The name of the underlying member or parameter. + + + + Gets the that will get and set the during serialization. + + The that will get and set the during serialization. + + + + Gets or sets the type of the property. + + The type of the property. + + + + Gets or sets the for the property. + If set this converter takes presidence over the contract converter for the property type. + + The converter. + + + + Gets the member converter. + + The member converter. + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + + Gets a value indicating whether this is readable. + + true if readable; otherwise, false. + + + + Gets a value indicating whether this is writable. + + true if writable; otherwise, false. + + + + Gets the default value. + + The default value. + + + + Gets a value indicating whether this is required. + + A value indicating whether this is required. + + + + Gets a value indicating whether this property preserves object references. + + + true if this instance is reference; otherwise, false. + + + + + Gets the property null value handling. + + The null value handling. + + + + Gets the property default value handling. + + The default value handling. + + + + Gets the property reference loop handling. + + The reference loop handling. + + + + Gets the property object creation handling. + + The object creation handling. + + + + Gets or sets the type name handling. + + The type name handling. + + + + Gets or sets a predicate used to determine whether the property should be serialize. + + A predicate used to determine whether the property should be serialize. + + + + Gets or sets a predicate used to determine whether the property should be serialized. + + A predicate used to determine whether the property should be serialized. + + + + Gets or sets an action used to set whether the property has been deserialized. + + An action used to set whether the property has been deserialized. + + + + A collection of objects. + + + + + Initializes a new instance of the class. + + The type. + + + + When implemented in a derived class, extracts the key from the specified element. + + The element from which to extract the key. + The key for the specified element. + + + + Adds a object. + + The property to add to the collection. + + + + Gets the closest matching object. + First attempts to get an exact case match of propertyName and then + a case insensitive match. + + Name of the property. + A matching property if found. + + + + Gets a property by property name. + + The name of the property to get. + Type property name string comparison. + A matching property if found. + + + + Specifies missing member handling options for the . + + + + + Ignore a missing member and do not attempt to deserialize it. + + + + + Throw a when a missing member is encountered during deserialization. + + + + + Specifies null value handling options for the . + + + + + Include null values when serializing and deserializing objects. + + + + + Ignore null values when serializing and deserializing objects. + + + + + Specifies reference loop handling options for the . + + + + + Throw a when a loop is encountered. + + + + + Ignore loop references and do not serialize. + + + + + Serialize loop references. + + + + + An in-memory representation of a JSON Schema. + + + + + Initializes a new instance of the class. + + + + + Reads a from the specified . + + The containing the JSON Schema to read. + The object representing the JSON Schema. + + + + Reads a from the specified . + + The containing the JSON Schema to read. + The to use when resolving schema references. + The object representing the JSON Schema. + + + + Load a from a string that contains schema JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Parses the specified json. + + The json. + The resolver. + A populated from the string that contains JSON. + + + + Writes this schema to a . + + A into which this method will write. + + + + Writes this schema to a using the specified . + + A into which this method will write. + The resolver used. + + + + Returns a that represents the current . + + + A that represents the current . + + + + + Gets or sets the id. + + + + + Gets or sets the title. + + + + + Gets or sets whether the object is required. + + + + + Gets or sets whether the object is read only. + + + + + Gets or sets whether the object is visible to users. + + + + + Gets or sets whether the object is transient. + + + + + Gets or sets the description of the object. + + + + + Gets or sets the types of values allowed by the object. + + The type. + + + + Gets or sets the pattern. + + The pattern. + + + + Gets or sets the minimum length. + + The minimum length. + + + + Gets or sets the maximum length. + + The maximum length. + + + + Gets or sets a number that the value should be divisble by. + + A number that the value should be divisble by. + + + + Gets or sets the minimum. + + The minimum. + + + + Gets or sets the maximum. + + The maximum. + + + + Gets or sets a flag indicating whether the value can not equal the number defined by the "minimum" attribute. + + A flag indicating whether the value can not equal the number defined by the "minimum" attribute. + + + + Gets or sets a flag indicating whether the value can not equal the number defined by the "maximum" attribute. + + A flag indicating whether the value can not equal the number defined by the "maximum" attribute. + + + + Gets or sets the minimum number of items. + + The minimum number of items. + + + + Gets or sets the maximum number of items. + + The maximum number of items. + + + + Gets or sets the of items. + + The of items. + + + + Gets or sets the of properties. + + The of properties. + + + + Gets or sets the of additional properties. + + The of additional properties. + + + + Gets or sets the pattern properties. + + The pattern properties. + + + + Gets or sets a value indicating whether additional properties are allowed. + + + true if additional properties are allowed; otherwise, false. + + + + + Gets or sets the required property if this property is present. + + The required property if this property is present. + + + + Gets or sets the identity. + + The identity. + + + + Gets or sets the a collection of valid enum values allowed. + + A collection of valid enum values allowed. + + + + Gets or sets a collection of options. + + A collection of options. + + + + Gets or sets disallowed types. + + The disallow types. + + + + Gets or sets the default value. + + The default value. + + + + Gets or sets the extend . + + The extended . + + + + Gets or sets the format. + + The format. + + + + Generates a from a specified . + + + + + Generate a from the specified type. + + The type to generate a from. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + The used to resolve schema references. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + Specify whether the generated root will be nullable. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + The used to resolve schema references. + Specify whether the generated root will be nullable. + A generated from the specified type. + + + + Gets or sets how undefined schemas are handled by the serializer. + + + + + Gets or sets the contract resolver. + + The contract resolver. + + + + The value types allowed by the . + + + + + No type specified. + + + + + String type. + + + + + Float type. + + + + + Integer type. + + + + + Boolean type. + + + + + Object type. + + + + + Array type. + + + + + Null type. + + + + + Any type. + + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the object member serialization. + + The member object serialization. + + + + Gets the object's properties. + + The object's properties. + + + + Gets the constructor parameters required for any non-default constructor + + + + + Gets or sets the override constructor used to create the object. + This is set when a constructor is marked up using the + JsonConstructor attribute. + + The override constructor. + + + + Gets or sets the parametrized constructor used to create the object. + + The parametrized constructor. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Get and set values for a using reflection. + + + + + Initializes a new instance of the class. + + The member info. + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + When applied to a method, specifies that the method is called when an error occurs serializing an object. + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic that returns a result + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic, but uses one of the arguments for + the result. + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic, but uses one of the arguments for + the result. + + + + + Returns a Restrictions object which includes our current restrictions merged + with a restriction limiting our type + + + + + Represents a method that constructs an object. + + + + + Specifies type name handling options for the . + + + + + Do not include the .NET type name when serializing types. + + + + + Include the .NET type name when serializing into a JSON object structure. + + + + + Include the .NET type name when serializing into a JSON array structure. + + + + + Always include the .NET type name when serializing. + + + + + Include the .NET type name when the type of the object being serialized is not the same as its declared type. + + + + + Converts the value to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert the value to. + The converted type. + + + + Converts the value to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert the value to. + The converted value if the conversion was successful or the default value of T if it failed. + + true if initialValue was converted successfully; otherwise, false. + + + + + Converts the value to the specified type. If the value is unable to be converted, the + value is checked whether it assignable to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert or cast the value to. + + The converted type. If conversion was unsuccessful, the initial value + is returned if assignable to the target type. + + + + + Gets a dictionary of the names and values of an Enum type. + + + + + + Gets a dictionary of the names and values of an Enum type. + + The enum type to get names and values for. + + + + + Specifies the type of Json token. + + + + + This is returned by the if a method has not been called. + + + + + An object start token. + + + + + An array start token. + + + + + A constructor start token. + + + + + An object property name. + + + + + A comment. + + + + + Raw JSON. + + + + + An integer. + + + + + A float. + + + + + A string. + + + + + A boolean. + + + + + A null token. + + + + + An undefined token. + + + + + An object end token. + + + + + An array end token. + + + + + A constructor end token. + + + + + A Date. + + + + + Byte data. + + + + + Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Adds the elements of the specified collection to the specified generic IList. + + The list to add to. + The collection of elements to add. + + + + Returns the index of the first occurrence in a sequence by using a specified IEqualityComparer. + + The type of the elements of source. + A sequence in which to locate a value. + The object to locate in the sequence + An equality comparer to compare values. + The zero-based index of the first occurrence of value within the entire sequence, if found; otherwise, –1. + + + + Gets the type of the typed collection's items. + + The type. + The type of the typed collection's items. + + + + Gets the member's underlying type. + + The member. + The underlying type of the member. + + + + Determines whether the member is an indexed property. + + The member. + + true if the member is an indexed property; otherwise, false. + + + + + Determines whether the property is an indexed property. + + The property. + + true if the property is an indexed property; otherwise, false. + + + + + Gets the member's value on the object. + + The member. + The target object. + The member's value on the object. + + + + Sets the member's value on the target object. + + The member. + The target. + The value. + + + + Determines whether the specified MemberInfo can be read. + + The MemberInfo to determine whether can be read. + /// if set to true then allow the member to be gotten non-publicly. + + true if the specified MemberInfo can be read; otherwise, false. + + + + + Determines whether the specified MemberInfo can be set. + + The MemberInfo to determine whether can be set. + if set to true then allow the member to be set non-publicly. + if set to true then allow the member to be set if read-only. + + true if the specified MemberInfo can be set; otherwise, false. + + + + + Determines whether the string is all white space. Empty string will return false. + + The string to test whether it is all white space. + + true if the string is all white space; otherwise, false. + + + + + Nulls an empty string. + + The string. + Null if the string was null, otherwise the string unchanged. + + + + Specifies the state of the . + + + + + An exception has been thrown, which has left the in an invalid state. + You may call the method to put the in the Closed state. + Any other method calls results in an being thrown. + + + + + The method has been called. + + + + + An object is being written. + + + + + A array is being written. + + + + + A constructor is being written. + + + + + A property is being written. + + + + + A write method has not been called. + + + + diff --git a/TestApps/LOCTester/bin/Debug/StructureMap.dll b/TestApps/LOCTester/bin/Debug/StructureMap.dll new file mode 100644 index 000000000..28a17b021 Binary files /dev/null and b/TestApps/LOCTester/bin/Debug/StructureMap.dll differ diff --git a/TestApps/LOCTester/bin/Debug/StructureMap.pdb b/TestApps/LOCTester/bin/Debug/StructureMap.pdb new file mode 100644 index 000000000..6c4dd1f78 Binary files /dev/null and b/TestApps/LOCTester/bin/Debug/StructureMap.pdb differ diff --git a/TestApps/LOCTester/bin/Debug/StructureMap.xml b/TestApps/LOCTester/bin/Debug/StructureMap.xml new file mode 100644 index 000000000..6376709c4 --- /dev/null +++ b/TestApps/LOCTester/bin/Debug/StructureMap.xml @@ -0,0 +1,3931 @@ + + + + StructureMap + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Get the object of type T that is valid for this build session. + + + + + + + Get the object of type T that is valid for this build session by name. + + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Register a default object for the given PluginType that will + be used throughout the rest of the current object request + + + + + + + Same as GetInstance, but can gracefully return null if + the Type does not already exist + + + + + + + Same as GetInstance(name), but can gracefully return null if + the Type and name does not already exist + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Gets all objects in the current object graph that can be cast + to T that have already been created + + + + + + + Creates/Resolves every configured instance of PlutinType T + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Gets a reference to the BuildStack for this build session + + + + + The concrete type of the immediate parent object in the object graph + + + + + Gets the root "frame" of the object request + + + + + The requested instance name of the object graph + + + + + Expression Builder that has grammars for defining policies at the + PluginType level. This expression is used for registering + open generic types + + + + + Convenience method that sets the default concrete type of the PluginType. The "concreteType" + can only accept types that do not have any primitive constructor arguments. + StructureMap has to know how to construct all of the constructor argument types. + + + + + + + Use this configured Instance as is + + + + + + Shorter way to call TheDefaultIsConcreteType + + + + + + + Shortcut to add a value by type + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Configure this type as the supplied value + + + + + + Sets the object creation of the instances of the PluginType. For example: PerRequest, + Singleton, ThreadLocal, HttpContext, or Hybrid + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Registers an IBuildInterceptor for this Plugin Type that executes before + any object of this PluginType is created. IBuildInterceptor's can be + used to create a custom scope + + + + + + + Convenience method to mark a PluginFamily as a Singleton + + + + + + Convenience method to mark a PluginFamily as a Hybrid lifecycle + + + + + + Convenience method to mark a PluginFamily as HttpContext scoped + + + + + + + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. You can also chain other declarations after + this method to add constructor and setter arguments + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type by a specified name. You can also chain other declarations after + this method to add constructor and setter arguments + + + + + + + + Specify the value of this explicit argument + + + + + + + Pass in additional arguments by type T + + + + + + + + Pass in additional arguments by type + + + + + + + + Pass in additional arguments by name + + + + + + + Gets the default instance of type T using the explicitly configured arguments from the "args" + + + + + + + Gets a named instance of type T using the explicitly configured arguments from teh "args" + + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + Gets all configured instances of type T using explicitly configured arguments + + + + + + + Returns the System.Reflection.ConstructorInfo for the PluggedType. Uses either + the "greediest" constructor with the most arguments or the constructor function + marked with the [DefaultConstructor] + + + + + + The InstanceKey of the default instance of the PluginFamily + + + + + The CLR Type that defines the "Plugin" interface for the PluginFamily + + + + + Add an Assembly to the scanning operation + + + + + + Add an Assembly by name to the scanning operation + + + + + + Add the currently executing Assembly to the scanning operation + + + + + Add the Assembly that contains type T to the scanning operation + + + + + + Add the Assembly that contains type to the scanning operation + + + + + + Sweep the designated path and add any Assembly's found in this folder to the + scanning operation + + + + + + Sweep the designated path and add any Assembly's found in this folder to the + scanning operation. The assemblyFilter can be used to filter or limit the + Assembly's that are picked up. + + + + + + + Sweep the application base directory of current app domain and add any Assembly's + found to the scanning operation. + + + + + Sweep the application base directory of current app domain and add any Assembly's + found to the scanning operation. The assemblyFilter can be used to filter or limit the + Assembly's that are picked up. + + + + + Adds an ITypeScanner object to the scanning operation + + + + + + Creates and adds a new ITypeScanner of type T to this scanning operation + + + + + + Directs the scanning operation to automatically detect and include any Registry + classes found in the Assembly's being scanned + + + + + Add all concrete types of the Plugin Type as Instances of Plugin Type + + + + + + Add all concrete types of the Plugin Type as Instances of Plugin Type + + + + + + Makes this scanning operation ignore all [PluginFamily] and [Pluggable] attributes + + + + + Exclude types that match the Predicate from being scanned + + + + + + Exclude all types in this nameSpace or its children from the scanning operation + + + + + + Exclude all types in this nameSpace or its children from the scanning operation + + + + + + Only include types matching the Predicate in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Only include types from this nameSpace or its children in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Only include types from this nameSpace or its children in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Exclude this specific type from the scanning operation + + + + + + Adds a registration convention to be applied to all the types in this + logical "scan" operation + + + + + + Adds a registration convention to be applied to all the types in this + logical "scan" operation + + + + + Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete + class named "Something" that implements "ISomething" will be automatically + added to PluginType "ISomething" + + + + + Scans for PluginType's and Concrete Types that close the given open generic type + + + + + + + + + Automatically registers all concrete types without primitive arguments + against its first interface, if any + + + + + Directs the scanning to automatically register any type that is the single + implementation of an interface against that interface. + The filters apply + + + + + Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete + class named "Something" that implements "ISomething" will be automatically + added to PluginType "ISomething" + + + + + Scans for PluginType's and Concrete Types that close the given open generic type + + + + + + + + + Automatically registers all concrete types without primitive arguments + against its first interface, if any + + + + + Directs the scanning to automatically register any type that is the single + implementation of an interface against that interface. + The filters apply + + + + + A TypeInterceptor that is only applied if the MatchesType() + method is true for a given Type + + + + + An InstanceInterceptor can be registered on a per-Instance basis + to act on, or even replace, the object that is created before + it is passed back to the caller. This is primarily a hook + for runtime AOP scenarios. + + + + + Does this TypeInterceptor apply to the given type? + + + + + + + Specify how objects matching the Type predicate + will be intercepted + + + + + + Specify how objects matching the Type predicate + will be intercepted + + + + + + Used for auto-mocking container. When the factory is missing, we can generate a mock for it + + + + + An Instance class that builds objects by calling a constructor function on a concrete type + and filling setter properties. ConfiguredInstance should only be used for open generic types. + Favor SmartInstance{T} for all other usages. + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE + + + + + + + Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE + + + + + + + Inline definition of a constructor or a setter property dependency + + + + + + + Starts the definition of a child instance specifying the argument name + in the case of a constructor function that consumes more than one argument + of type T + + + + + + + + Inline definition of a constructor dependency + + + + + + + + Inline definition of a setter dependency + + + + + + + + Start the definition of a primitive argument to a constructor argument + + + + + + + Configure a primitive constructor argument + + + + + + + Configures an array of Instance's for the array dependency + + + + + + + Part of the Fluent Interface, represents a nonprimitive argument to a + constructure function + + + + + Use a previously configured and named instance for the child + + + + + + + Start the definition of a child instance by defining the concrete type + + + + + + + Start the definition of a child instance by defining the concrete type + + + + + + + Registers a configured instance to use as the argument to the parent's + constructor + + + + + + + Directs StructureMap to fill this dependency with the Default Instance of the + constructor or property type + + + + + + Base class for many of the Instance subclasses to support + method chaining in the Registry DSL for common options + + + + + + Set the name of this Instance + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + + Register an InstanceInterceptor with this Instance + + + + + + + Used to override the constructor of a class to be used by StructureMap to create + a Pluggable object + + + + + Examines a System.Type object and determines the ConstructorInfo to use in creating + instances of the Type + + + + + + + Used to implicitly mark a class as a Plugin candidate for StructureMap + + + + + Determines whether a Type object is marked as Pluggable + + + + + + + The ConcreteKey alias of the Type + + + + + Declares a class, abstract class, or interface to be the target of a PluginFamily in the container + + + + + Determines if a Type object is marked as a PluginFamily + + + + + + + If set, determines the shared "scope" of the instance -- PerRequest, Singleton, ThreadLocal, + HttpContext, etc. + + + + + InstanceKey of the default instance. Used to implicitly define the default without + declaring the instance in StructureMap.config + + + + + Declares the target to be built by StructureMap as a Singleton. One object instance will + be created for each named instance + + + + + Marks a Property in a Pluggable class as filled by setter injection + + + + + Marks a method with no parameters as a method that validates an instance. StructureMap + uses this method to validate the configuration file. If the method does not throw an + exception, the object is assumed to be valid. + + + + + Returns an array of any MethodInfo's on a Type that are marked as ValidationMethod + + CLR Type to search for validation methods + + + + + Constants for the names of Xml nodes and attributes in the StructureMap.config + file + + + + + The name of the default configuration file. The value is always StructurMap.config + + + + + Returns the absolute path to the StructureMap.config file + + + + + + Expression Builder that has grammars for defining policies at the + PluginType level + + + + + Add multiple Instance's to this PluginType + + + + + + + Conditional binding of instances + + + + + + + Access to all of the uncommon Instance types + + + + + + + Access to all of the uncommon Instance types + + + + + + + Convenience method that sets the default concrete type of the PluginType. Type T + can only accept types that do not have any primitive constructor arguments. + StructureMap has to know how to construct all of the constructor argument types. + + + + + + + + Shorthand to say TheDefault.Is.ConstructedBy(func) + + + + + + + Shorthand to say TheDefault.Is.ConstructedBy(func) + + + + + + + Shorthand to say TheDefault.IsThis(@object) + + + + + + + Sets the object creation of the instances of the PluginType. For example: PerRequest, + Singleton, ThreadLocal, HttpContext, or Hybrid + + + + + + + Convenience method to mark a PluginFamily as a Singleton + + + + + + Convenience method to mark a PluginFamily as a Transient + + + + + + Convenience method to mark a PluginFamily as a Hybrid lifecycle + + + + + + Convenience method to mark a PluginFamily as HttpContext scoped + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Adds an Interceptor to only this PluginType + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Registers an ILifecycle for this Plugin Type that executes before + any object of this PluginType is created. ILifecycle's can be + used to create a custom scope + + + + + + + Largely deprecated and unnecessary with the ability to add Xml configuration files + + + + + + + Forces StructureMap to always use a unique instance to + stop the "BuildSession" caching + + + + + + Adds the object to to the PLUGINTYPE + + + + + + + Add an Instance to this type created by a Lambda + + + + + + + Define the Default Instance for this PluginType + + + + + Expression class to help define a runtime Profile + + + + + Starts the definition of the default instance for the containing Profile. This is + still valid, but Type() is recommended + + + + + + + Designate or define the Instance for a type within + this Profile + + + + + + + Use statement to define the Profile defaults for a Generic type + + + + + + + Expression Builder inside of a Profile creation for + open generic types + + + + + Use this concreteType for the Instance of this Profile for the PluginType + + + + + + + Use this concreteType for the Instance of this Profile for the PluginType + + + + + + + Use this Instance for the Profile Instance of this Plugin Type + + + + + + + Use the named Instance as the Profile Instance for this PluginType + + + + + + + Use the named Instance as the Profile Instance for this PluginType + + + + + + + For this type and profile, build the object with this Lambda + + + + + + + Expression Builder within defining a Profile + + + + + + Use a named, preconfigured instance as the default instance for this profile + + + + + + + Use a named, preconfigured instance as the default instance for this profile + + + + + + + Define the default instance of the PluginType for the containing Profile + + + + + + + For this Profile, use an Instance with this Func + + + + + + + For this Profile, use an Instance with this Func + + + + + + + For this Profile, use this object + + + + + + + Access to the uncommon types of Instance + + + + + + For this Profile, use the Concrete Type + + + + + + + For this profile, use this concrete type + + + + + + + A Registry class provides methods and grammars for configuring a Container or ObjectFactory. + Using a Registry subclass is the recommended way of configuring a StructureMap Container. + + + public class MyRegistry : Registry + { + public MyRegistry() + { + ForRequestedType(typeof(IService)).TheDefaultIsConcreteType(typeof(Service)); + } + } + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Imports the configuration from another registry into this registry. + + + + + + Imports the configuration from another registry into this registry. + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + This method is a shortcut for specifying the default constructor and + setter arguments for a ConcreteType. ForConcreteType is shorthand for: + ForRequestedType[T]().Use[T].************** + when the PluginType and ConcreteType are the same Type + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Convenience method. Equivalent of ForRequestedType[PluginType]().AsSingletons() + + + + + + + Uses the configuration expressions of this Registry to create a PluginGraph + object that could be used to initialize a Container. This method is + mostly for internal usage, but might be helpful for diagnostics + + + + + + Adds an additional, non-Default Instance to the PluginType T. + + + + + + + Adds an additional, non-Default Instance to the designated pluginType + This method is mostly meant for open generic types + + + + + + + Expression Builder to define the defaults for a named Profile. Each call + to CreateProfile is additive. + + + + + + + An alternative way to use CreateProfile that uses ProfileExpression + as a Nested Closure. This usage will result in cleaner code for + multiple declarations + + + + + + + Registers a new TypeInterceptor object with the Container + + + + + + Allows you to define a TypeInterceptor inline with Lambdas or anonymous delegates + + + + + IfTypeMatches( ... ).InterceptWith( o => new ObjectWrapper(o) ); + + + + + Designates a policy for scanning assemblies to auto + register types + + + + + + Directs StructureMap to always inject dependencies into any and all public Setter properties + of the type PLUGINTYPE. + + + + + + + Creates automatic "policies" for which public setters are considered mandatory + properties by StructureMap that will be "setter injected" as part of the + construction process. + + + + + + Use to programmatically select the constructor function of a concrete + class. Applies globally to all Containers in a single AppDomain. + + + + + + + All requests For the "TO" types will be filled by fetching the "FROM" + type and casting it to "TO" + GetInstance(typeof(TO)) basically becomes (TO)GetInstance(typeof(FROM)) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( @object ) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( instance ) + + + + + + + + Shorthand for ForRequestedType(pluginType) + + + + + + + + Advanced Usage Only! Skips the Registry and goes right to the inner + Semantic Model of StructureMap. Use with care + + + + + + Adds the concreteType as an Instance of the pluginType. Mostly useful + for conventions + + + + + + + Adds the concreteType as an Instance of the pluginType with a name. Mostly + useful for conventions + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType. + Mostly useful for conventions + + + + + + Imports the configuration from another registry into this registry. + + + + + + Imports the configuration from another registry into this registry. + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + This method is a shortcut for specifying the default constructor and + setter arguments for a ConcreteType. ForConcreteType is shorthand for: + For[T]().Use[T].************** + when the PluginType and ConcreteType are the same Type + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Convenience method. Equivalent of ForRequestedType[PluginType]().Singletons() + + + + + + + Uses the configuration expressions of this Registry to create a PluginGraph + object that could be used to initialize a Container. This method is + mostly for internal usage, but might be helpful for diagnostics + + + + + + Adds an additional, non-Default Instance to the PluginType T. + + + + + + + Adds an additional, non-Default Instance to the designated pluginType + This method is mostly meant for open generic types + + + + + + + Expression Builder to define the defaults for a named Profile. Each call + to CreateProfile is additive. + + + + + + + An alternative way to use CreateProfile that uses ProfileExpression + as a Nested Closure. This usage will result in cleaner code for + multiple declarations + + + + + + + Registers a new TypeInterceptor object with the Container + + + + + + Allows you to define a TypeInterceptor inline with Lambdas or anonymous delegates + + + + + IfTypeMatches( ... ).InterceptWith( o => new ObjectWrapper(o) ); + + + + + Designates a policy for scanning assemblies to auto + register types + + + + + + Directs StructureMap to always inject dependencies into any and all public Setter properties + of the type PLUGINTYPE. + + + + + + + Creates automatic "policies" for which public setters are considered mandatory + properties by StructureMap that will be "setter injected" as part of the + construction process. + + + + + + Use to programmatically select the constructor function of a concrete + class. Applies globally to all Containers in a single AppDomain. + + + + + + + All requests For the "TO" types will be filled by fetching the "FROM" + type and casting it to "TO" + GetInstance(typeof(TO)) basically becomes (TO)GetInstance(typeof(FROM)) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( @object ) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( instance ) + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + + Advanced Usage Only! Skips the Registry and goes right to the inner + Semantic Model of StructureMap. Use with care + + + + + + Define the constructor and setter arguments for the default T + + + + + + Thrown by IProperty classes when an invalid value is applied to + a property of an InstanceGraph + + + + + Main exception for StructureMap. Use the ErrorCode to aid in troubleshooting + StructureMap problems + + + + + Represents a concrete class that can be built by StructureMap as an instance of the parent + PluginFamily’s PluginType. The properties of a Plugin are the CLR Type of the concrete class, + and the human-friendly concrete key that StructureMap will use to identify the Type. + + + + + The ConcreteKey that identifies the Plugin within a PluginFamily + + + + + The concrete CLR Type represented by the Plugin + + + + + Property's that will be filled by setter injection + + + + + Conceptually speaking, a PluginFamily object represents a point of abstraction or variability in + the system. A PluginFamily defines a CLR Type that StructureMap can build, and all of the possible + Plugin’s implementing the CLR Type. + + + + + The CLR Type that defines the "Plugin" interface for the PluginFamily + + + + + The InstanceKey of the default instance of the PluginFamily + + + + + Custom collection class for PluginFamily's + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Models the runtime configuration of a StructureMap Container + + + + + Closes the PluginGraph for adding or removing members. Runs all the AssemblyScanner's + and attempts to attach concrete types to the proper plugin types. Calculates the Profile defaults. + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Adds an AssemblyScanner to the PluginGraph. Used for Testing. + + + + + + Add configuration to a PluginGraph with the Registry DSL + + + + + + Designates whether a PluginGraph has been "Sealed." + + + + + Represents a PropertyInfo of a Plugin.PluggedType that is filled by Setter Injection + + + + + Custom collection class for SetterProperty objects + + + + + Designates a CLR type that is loaded by name. + + + + + Interface for a "Factory" pattern class that creates object instances of the PluginType + + + + + The main "container" object that implements the Service Locator pattern + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates or finds the named instance of T + + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Gets all configured instances of type T using explicitly configured arguments from the "args" + + + + + + + + Gets the default instance of type T using the explicitly configured arguments from the "args" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + Gets the named instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + + Starts a "Nested" Container for atomic, isolated access + + + + + + Starts a new "Nested" Container for atomic, isolated service location. Opens + + + + + + + Provides queryable access to the configured PluginType's and Instances of this Container + + + + + The name of the container. By default this is set to + a random Guid. This is a convience property to + assist with debugging. Feel free to set to anything, + as this is not used in any logic. + + + + + Default implementation of IInstanceFactory + + + + + Constructor to use when troubleshooting possible configuration issues. + + + + + + Constructor to create an Container + + PluginGraph containing the instance and type definitions + for the Container + + + + Creates or finds the named instance of T + + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + Gets all configured instances of type T using explicitly configured arguments from the "args" + + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + + Starts a "Nested" Container for atomic, isolated access + + + + + + Starts a new "Nested" Container for atomic, isolated service location. Opens + + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Sets the default instance for the PluginType + + + + + + + Provides queryable access to the configured PluginType's and Instances of this Container + + + + + The name of the container. By default this is set to + a random Guid. This is a convience property to + assist with debugging. Feel free to set to anything, + as this is not used in any logic. + + + + + GoF Memento representing an Object Instance + + + + + Retrieves the named property value as a string + + + + + + + Template method for implementation specific retrieval of the named property + + + + + + + Returns the named child InstanceMemento + + + + + + + Template method for implementation specific retrieval of the named property + + + + + + + This method is made public for testing. It is not necessary for normal usage. + + + + + + Used to create a templated InstanceMemento + + + + + + + The named type of the object instance represented by the InstanceMemento. Translates to a concrete + type + + + + + The named key of the object instance represented by the InstanceMemento + + + + + Gets the referred template name + + + + + + Template pattern property specifying whether the InstanceMemento is simply a reference + to another named instance. Useful for child objects. + + + + + Template pattern property specifying the instance key that the InstanceMemento refers to + + + + + Is the InstanceMemento a reference to the default instance of the plugin type? + + + + + A TypeInterceptor that always applies to all Instances of a given Plugin Type + + + + + Abstract class that is the supertype of all storage and retrieval mechanisms of + InstanceMemento instances + + + + + Retrieves the named InstanceMemento + + The instanceKey of the requested InstanceMemento + + + + + Retrieves an array of all InstanceMemento's stored by this MementoSource + + + + + + Template pattern method. Determines if the MementoSource contains a definition for the + requested instanceKey. + + + + + + + Template pattern method. Retrieves an InstanceMemento for the instanceKey + + + + + + + The type of MementoSource + + + + + String description of the MementoSource. Used in the StructureMap-Client UI. + + + + + An in-memory implementation of InstanceMemento. + + + + + Creates an instance of MemoryInstanceMemento that represents a reference to another + instance. + + The referenced instance key to another instance + + + + + Creates a MemoryInstanceMemento that represents a reference to the default instance + of a plugin type. + + + + + + Constructs a MemoryInstanceMemento without properties + + The concrete key of the plugin type + The identifying instance key + + + + Constructs a MemoryInstanceMemento with properties + + The concrete key of the plugin type + The identifying instance key + NameValueCollection of instance properties + + + + Sets the value of the named property + + + + + + + Deletes a named property from the DefaultInstanceMemento + + + + + + Links a child InstanceMemento as a named property + + + + + + + Links an array of InstanceMemento's to a named array property + + + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + The main static Facade for the StructureMap container + + + + + Restarts ObjectFactory and blows away all Singleton's and cached instances. Use with caution. + + + + + Remove and dispose all objects scoped by HttpContext. Call this method at the *end* of an Http request to clean up resources + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the named instance of T + + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Provides queryable access to the configured PluginType's and Instances of the inner Container + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + Reads configuration XML documents and builds the structures necessary to initialize + the Container/IInstanceFactory/InstanceBuilder/ObjectInstanceActivator objects + + + + + Reads the configuration information and returns the PluginGraph definition of + plugin families and plugin's + + + + + + Generic implementation of an XmlMementoSource + + + + + Base class for all MementoSource classes that store InstanceMemento's as + node-normalized Xml + + + + + Implementation of MementoSource that stores and retrieves an XmlInstanceMemento per file in a named directory. + DirectoryXmlMementoSource is meant to simplify complicated object graph configurations by isolating each instance to a separate + editable file. + + + + + Stores an Xml InstanceMemento per file in a directory + + A ";" delimited list of directories to look for mementos. DirectoryXmlMementoSource + will use the FIRST directory it finds + The file extension of the InstanceMemento files without a dot. Typically "xml" + NodeNormalized or AttributeNormalized + + + + Implementation of MementoSource that stores and retrieves an XmlInstanceMemento per Embedded Resource file + in a named namespace. EmbeddedFolderXmlMementoSource is meant to simplify complicated object graph configurations + by isolating each instance to a separate + editable file. + + NodeNormalized or AttributeNormalized + The name of the Assembly with the embedded resources + The root namespace of all of the mementos. + The file extension of the memento files - "xml" + + + + An in-memory MementoSource + + + + + Retrieves Xml InstanceMemento's from an xml file stored as an embedded resource in an assembly. + + Designates the nodes that are memento nodes + NodeNormalized or AttributeNormalized + The name of the Assembly the file is embedded into + The path to the embedded resource within the file + + + + Default Constructor + + MementoSource that contains the Memento Templates + MementoSource that contains instances consisting of Template valuee + + + + Stores Attribute-normalized InstanceMemento's in an external file + + + + + Implementation of XmlMementoSource that reads InstanceMemento's from an external file. + Useful to break the StructureMap.config file into smaller pieces. + + + + + Default constructor + + Path to the xml file that contains the instance configuration + XPath expression to the parent node that contains the InstanceMemento nodes. + If empty, it defaults to the top node + The name of the nodes that are InstanceMemento nodes. Useful to store + different types of instances in the same file + + + + An implementation of InstanceMemento that stores properties as Xml attributes + Limited functionality + + + + + Implementation of InstanceMemento that stores information in a node-normalized + Xml format. + + + + + specify what type you'd like the service returned as + + + + + + + Specify the open generic type that should have a single generic parameter + + + + + + + Used as the argument in the Container.Configure() method to describe + configuration directives and specify the sources of configuration for + a Container + + + + + Creates and adds a Registry object of type T. + + The Registry Type + + + + Imports all the configuration from a Registry object + + + + + + Imports configuration from an Xml file. The fileName + must point to an Xml file with valid StructureMap + configuration + + + + + + Imports configuration directly from an XmlNode. This + method was intended for scenarios like Xml being embedded + into an assembly. The node must be a 'StructureMap' node + + + + + + If true, directs StructureMap to look for configuration in the App.config. + The default value is false. + + + + + Expression Builder to define an Instance + + + + + + Register a previously built Instance. This provides a "catch all" + method to attach custom Instance objects. Synonym for Instance() + + + + + + Inject this object directly. Synonym to Object() + + + + + + + Gives you full access to all the different ways to specify an "Instance" + + + + + An Expression Builder to define Instances of a PluginType. + This is mostly used for configuring open generic types + + + + + Shortcut to register a Concrete Type as an instance. This method supports + method chaining to allow you to add constructor and setter arguments for + the concrete type + + + + + + + Shortcut to simply use the Instance with the given name + + + + + + + An Expression Builder that is used throughout the Registry DSL to + add and define Instances + + + + + + Register a previously built Instance. This provides a "catch all" + method to attach custom Instance objects. Synonym for IsThis() + + + + + + Inject this object directly. Synonym to IsThis() + + + + + + + Build the Instance with the constructor function and setter arguments. Starts + the definition of a SmartInstance + + + + + + + Build the Instance with the constructor function and setter arguments. Starts + the definition of a SmartInstance + + + + + + + Build the Instance with the constructor function and setter arguments. Use this + method for open generic types, and favor the generic version of OfConcreteType + for all other types + + + + + + + Build the Instance with the constructor function and setter arguments. Use this + method for open generic types, and favor the generic version of OfConcreteType + for all other types + + + + + + + Create an Instance that builds an object by calling a Lambda or + an anonymous delegate with no arguments + + + + + + + Create an Instance that builds an object by calling a Lambda or + an anonymous delegate with the IContext representing + the current object graph. + + + + + + + Use the Instance of this PluginType with the specified name. This is + generally only used while configuring child dependencies within a deep + object graph + + + + + + + Use the default Instance of this PluginType. This is + generally only used while configuring child dependencies within a deep + object graph + + + + + + Creates an Instance that stores this object of type T, + and returns a cloned copy of the template. + + + + + + + Caches template as a serialized byte stream. Uses deserialization + to create copies when the Instance is built. + + + + + + + Creates an Instance that will load an ASCX user control from the url + + + + + + + Creates an Instance according to conditional rules + + + + + + + Used as an expression builder to specify setter injection policies + + + + + Directs StructureMap to treat all public setters of type T as + mandatory properties + + + + + + Directs StructureMap to tread all public setters with + a PropertyType that matches the predicate as a + mandatory setter + + + + + + Directs StructureMap to treat all public setters that match the + rule as mandatory properties + + + + + + Directs StructureMap to treat all public setters with a property + type in the specified namespace as mandatory properties + + + + + + Directs StructureMap to treat all public setters with a property + type in the specified namespace as mandatory properties + + + + + + Directs StructureMap to treat all public setters where to property name + matches the specified rule as a mandatory property + + + + + + Base class for creating an object instance from an InstanceMemento. SubClasses are + emitted for each concrete Plugin with constructor parameters. + + + + + Allows built-in registration conventions to be configurable through the assembly scanning DSL + + + Intended for StructureMap internal use only. + Custom registration convention instances can be directly configured + before being passed to IAssemblyScanner.With(IRegistrationConvention). + + + + + Simply query to see if there are any implementations registered + + + + + + Ejects any instances of this instance from the current container + and permanently removes the instance from the container configuration + + + + + + Eject all instances of this PluginType from the current container, + but leaves the lifecycle behavior + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Models the state of a Container or ObjectFactory. Can be used to query for the + existence of types registered with StructureMap + + + + + Can StructureMap fulfill a request to ObjectFactory.GetInstance(pluginType) from the + current configuration. This does not include concrete classes that could be auto-configured + upon demand + + + + + + + Can StructureMap fulfill a request to ObjectFactory.GetInstance<T>() from the + current configuration. This does not include concrete classes that could be auto-configured + upon demand + + + + + + + Queryable access to all of the InstanceRef for a given PluginType + + + + + + + Queryable access to all of the InstanceRef for a given PluginType + + + + + + Does the current container have existing configuration for the "pluginType" + + + + + + + Does the current container have existing configuration for the type T + + + + + + Find the concrete type for the default Instance of T. + In other words, when I call Container.GetInstance(Type), + what do I get? May be indeterminate + + + + + + + Find the concrete type for the default Instance of pluginType. + In other words, when I call Container.GetInstance(Type), + what do I get? May be indeterminate + + + + + + Retrieves the configuration for the given type + + + + + + + Retrieves the configuration for the given type + + + + + + + Eject all objects, configuration, and Plugin Types matching this filter + + + + + + Eject all objects and configuration for any Plugin Type that matches this filter + + + + + + Eject all objects and Instance configuration for this PluginType + + + + + + Get each and every configured instance that could possibly + be cast to T + + + + + + + Access to all the Plugin Type registrations + + + + + Makes sure that every request for this object returns a unique object + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + The actual concrete type of this Instance. Not every type of IInstance + can determine the ConcreteType + + + + + Ejects and removes all objects and the configuration for the named instance from the + container + + + + + + + Ejects and removes all objects and configuration for the instances that match the filter + + + + + + + Determines if the pluggedType can be upcast to the pluginType + + + + + + + + Determines if the PluggedType is a valid Plugin into the + PluginType + + + + + + + + Imports configuration from an Xml file. The fileName + must point to an Xml file with valid StructureMap + configuration + + + + + + Imports configuration directly from an XmlNode. This + method was intended for scenarios like Xml being embedded + into an assembly. The node must be a 'StructureMap' node + + + + + + Creates and adds a Registry object of type T. + + The Registry Type + + + + Imports all the configuration from a Registry object + + + + + + If true, makes the existence of the StructureMap.config mandatory. + The default is false. + + + + + If true, the StructureMap.config file will be ignored even if it exists. + The default is false. + + + + + If true, directs StructureMap to look for configuration in the App.config. + The default value is false. + + + + + Designate the Default Profile. This will be applied as soon as the + Container is initialized. + + + + + Retrieves the configuration for the given type + + + + + + + Retrieves the configuration for the given type + + + + + + + Eject all objects, configuration, and Plugin Types matching this filter + + + + + + Eject all objects and configuration for any Plugin Type that matches this filter + + + + + + Eject all objects and Instance configuration for this PluginType + + + + + + Get each and every configured instance that could possibly + be cast to T + + + + + + + The requested PluginType of the Instance being create + + + + + The Name of the Instance being created + + + + + The actual ConcreteType being created. This will not always + be available + + + + + Models the current place in an object graph during the construction of + an instance. Provides contextual information that can be used + to alter the desired construction of child objects + + + + + The requested PluginType of the Instance being create + + + + + The Name of the Instance being created + + + + + The actual ConcreteType being created. This will not always + be available + + + + + Provides metadata about the object graph being constructed. More or less a stack trace of the GetInstance() pipeline + that can be used for "contextual" object construction + + + + + The top level of the object graph. Describes the original requested instance + + + + + The current BuildFrame + + + + + The immediate parent BuildFrame + + + + + Defines the value of a primitive argument to a constructur argument + + + + + Sets the value of the constructor argument + + + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings + + The key in appSettings for the value to use. + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings when it exists. Otherwise uses the provided default value. + + The key in appSettings for the value to use. + The value to use if an entry for does not exist in the appSettings section. + + + + + Instance that builds objects with by calling constructor functions and using setter properties + + The concrete type constructed by SmartInstance + + + + Sets the name of this Instance + + + + + + + Sets the name of this Instance + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register an InstanceInterceptor with this Instance + + + + + + + Define a primitive constructor argument + + + + + + + Set simple setter properties + + + + + + + Define a primitive setter property by specifying the property name with + an expression + + + + + + + Define a primitive setter property by specifying the property name + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type. Do not + use this method if there is more than one constructor arguments of the same type + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type. Do not + use this method if there is more than one constructor arguments of the same type + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type and constructor name. + Use this method if there is more than one constructor arguments of the same type + + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type and constructor name. + Use this method if there is more than one constructor arguments of the same type + + + + + + + + Inline definition of a setter dependency. The property name is specified with an Expression + + + + + + + + Inline definition of a setter dependency. The property name is specified with an Expression + + + + + + + + Inline definition of a setter dependency. Only use this method if there + is only a single property of the SETTERTYPE + + + + + + + Inline definition of a setter dependency. Only use this method if there + is only a single property of the SETTERTYPE + + + + + + + Inline definition of a dependency on an Array of the CHILD type. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + Inline definition of a dependency on an Array of the CHILD type and the specified setter property or constructor argument name. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + + Inline definition of a dependency on an Array of the CHILD type. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + Inline definition of a dependency on an Array of the CHILD type and the specified setter property or constructor argument name. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + + Expression Builder to help define multiple Instances for an Array dependency + + + + + + Nested Closure that allows you to add an unlimited number of child Instances + + + + + + + Specify an array of Instance objects directly for an Array dependency + + + + + + + Expression Builder that helps to define child dependencies inline + + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings + + The key in appSettings for the value to use. + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings when it exists. Otherwise uses the provided default value. + + The key in appSettings for the value to use. + The value to use if an entry for does not exist in the appSettings section. + + + + + Nested Closure to define a child dependency inline + + + + + + + Shortcut to set an inline dependency to an Instance + + + + + + + Shortcut to set an inline dependency to a designated object + + + + + + + Shortcut to set an inline dependency to a designated object + + + + + + + Set an Inline dependency to the Default Instance of the Property type + Used mostly to force an optional Setter property to be filled by + StructureMap + + + + + + Shortcut method to define a child dependency inline + + + + + + + Shortcut method to define a child dependency inline and configure + the child dependency + + + + + + + Provides virtual methods that can be used by subclasses to parse an expression tree. + + + This class actually already exists in the System.Core assembly...as an internal class. + I can only speculate as to why it is internal, but it is obviously much too dangerous + for anyone outside of Microsoft to be using... + + + + diff --git a/TestApps/LOCTester/bin/Release/EntityFramework.dll b/TestApps/LOCTester/bin/Release/EntityFramework.dll new file mode 100644 index 000000000..8caef36ac Binary files /dev/null and b/TestApps/LOCTester/bin/Release/EntityFramework.dll differ diff --git a/TestApps/LOCTester/bin/Release/EntityFramework.xml b/TestApps/LOCTester/bin/Release/EntityFramework.xml new file mode 100644 index 000000000..4057d68a4 --- /dev/null +++ b/TestApps/LOCTester/bin/Release/EntityFramework.xml @@ -0,0 +1,18061 @@ + + + + EntityFramework + + + + + Specifies the database column that a property is mapped to. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The name of the column the property is mapped to. + + + + The name of the column the property is mapped to. + + + + + The zero-based order of the column the property is mapped to. + + + + + The database provider specific data type of the column the property is mapped to. + + + + + Denotes that the class is a complex type. + Complex types are non-scalar properties of entity types that enable scalar properties to be organized within entities. + Complex types do not have keys and cannot be managed by the Entity Framework apart from the parent object. + + + + + Specifies how the database generates values for a property. + + + + + Initializes a new instance of the class. + + The pattern used to generate values for the property in the database. + + + + The pattern used to generate values for the property in the database. + + + + + The pattern used to generate values for a property in the database. + + + + + The database does not generate values. + + + + + The database generates a value when a row is inserted. + + + + + The database generates a value when a row is inserted or updated. + + + + + Denotes a property used as a foreign key in a relationship. + The annotation may be placed on the foreign key property and specify the associated navigation property name, + or placed on a navigation property and specify the associated foreign key name. + + + + + Initializes a new instance of the class. + + + If placed on a foreign key property, the name of the associated navigation property. + If placed on a navigation property, the name of the associated foreign key(s). + If a navigation property has multiple foreign keys, a comma separated list should be supplied. + + + + + If placed on a foreign key property, the name of the associated navigation property. + If placed on a navigation property, the name of the associated foreign key(s). + + + + + Specifies the inverse of a navigation property that represents the other end of the same relationship. + + + + + Initializes a new instance of the class. + + The navigation property representing the other end of the same relationship. + + + + The navigation property representing the other end of the same relationship. + + + + + Specifies the maximum length of array/string data allowed in a property. + + + + + Initializes a new instance of the class. + + + The maximum allowable length of array/string data. + Value must be greater than zero. + + + + + Initializes a new instance of the class. + The maximum allowable length supported by the database will be used. + + + + + Determines whether a specified object is valid. (Overrides ) + + + This method returns true if the is null. + It is assumed the is used if the value may not be null. + + The object to validate. + true if the value is null or less than or equal to the specified maximum length, otherwise false + Length is zero or less than negative one. + + + + Applies formatting to a specified error message. (Overrides ) + + The name to include in the formatted string. + A localized string to describe the maximum acceptable length. + + + + Checks that Length has a legal value. Throws InvalidOperationException if not. + + + + + Gets the maximum allowable length of the array/string data. + + + + + Specifies the minimum length of array/string data allowed in a property. + + + + + Initializes a new instance of the class. + + + The minimum allowable length of array/string data. + Value must be greater than or equal to zero. + + + + + Determines whether a specified object is valid. (Overrides ) + + + This method returns true if the is null. + It is assumed the is used if the value may not be null. + + The object to validate. + true if the value is null or greater than or equal to the specified minimum length, otherwise false + Length is less than zero. + + + + Applies formatting to a specified error message. (Overrides ) + + The name to include in the formatted string. + A localized string to describe the minimum acceptable length. + + + + Checks that Length has a legal value. Throws InvalidOperationException if not. + + + + + Gets the minimum allowable length of the array/string data. + + + + + Denotes that a property or class should be excluded from database mapping. + + + + + Specifies the database table that a class is mapped to. + + + + + Initializes a new instance of the class. + + The name of the table the class is mapped to. + + + + The name of the table the class is mapped to. + + + + + The schema of the table the class is mapped to. + + + + + The base for all all Entity Data Model (EDM) types that represent a type from the EDM type system. + + + + + Represents an item in an Entity Data Model (EDM) . + + + + + The base for all all Entity Data Model (EDM) item types that with a Name property that represents a qualified (can be dotted) name. + + + + + The base for all all Entity Data Model (EDM) item types that with a property. + + + + + The base for all all Entity Data Model (EDM) types that support annotation using . + + + + + EdmDataModelItem is the base for all types in the Entity Data Model (EDM) metadata construction and modification API. + + + + + DataModelItem is the base for all types in the EDM metadata reflection, construction and modification API. + + + + + Gets an value indicating which Entity Data Model (EDM) concept is represented by this item. + + + + + IAnnotatedDataModelItem is implemented by model-specific base types for all types with an property. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets or sets the currently assigned annotations. + + + + + Returns all EdmItem children directly contained by this EdmItem. + + + + + INamedDataModelItem is implemented by model-specific base types for all types with a property. + + + + + Gets or sets the currently assigned name. + + + + + Gets or sets the currently assigned name. + + + + + Gets a value indicating whether this type is abstract. + + + + + Gets the optional base type of this type. + + + + + EdmStructuralMember is the base for all types that represent members of structural items in the Entity Data Model (EDM) metadata construction and modification API. + + + + + Represents information about a database connection. + + + + + Creates a new instance of DbConnectionInfo representing a connection that is specified in the application configuration file. + + The name of the connection string in the application configuration. + + + + Creates a new instance of DbConnectionInfo based on a connection string. + + The connection string to use for the connection. + The name of the provider to use for the connection. Use 'System.Data.SqlClient' for SQL Server. + + + + Gets the connection information represented by this instance. + + Configuration to use if connection comes from the configuration file. + + + + Instances of this class are used to create DbConnection objects for + SQL Server LocalDb based on a given database name or connection string. + + + An instance of this class can be set on the class or in the + app.config/web.config for the application to cause all DbContexts created with no + connection information or just a database name to use SQL Server LocalDb by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Implementations of this interface are used to create DbConnection objects for + a type of database server based on a given database name. + An Instance is set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use a certain type of database server by default. + Two implementations of this interface are provided: + is used to create connections to Microsoft SQL Server, including EXPRESS editions. + is used to create connections to Microsoft SQL + Server Compact Editions. + Other implementations for other database servers can be added as needed. + Note that implementations should be thread safe or immutable since they may + be accessed by multiple threads at the same time. + + + + + Creates a connection based on the given database name or connection string. + + The database name or connection string. + An initialized DbConnection. + + + + Creates a new instance of the connection factory for the given version of LocalDb. + For SQL Server 2012 LocalDb use "v11.0". + + The LocalDb version to use. + + + + Creates a new instance of the connection factory for the given version of LocalDb. + For SQL Server 2012 LocalDb use "v11.0". + + + The LocalDb version to use. + + The connection string to use for options to the database other than the 'Initial Catalog', + 'Data Source', and 'AttachDbFilename'. + The 'Initial Catalog' and 'AttachDbFilename' will be prepended to this string based on the + database name when CreateConnection is called. + The 'Data Source' will be set based on the LocalDbVersion argument. + + + + + Creates a connection for SQL Server LocalDb based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + The connection string to use for options to the database other than the 'Initial Catalog', + 'Data Source', and 'AttachDbFilename'. + The 'Initial Catalog' and 'AttachDbFilename' will be prepended to this string based on the + database name when CreateConnection is called. + The 'Data Source' will be set based on the LocalDbVersion argument. + The default is 'Integrated Security=True; MultipleActiveResultSets=True;'. + + + + + Encapsulates a cloned and store . Note that these + objects are disposable and should be used in a using block to ensure both the cloned context and the + cloned connection are disposed. + + + + + For mocking. + + + + + Creates a clone of the given . The underlying of + the context is also cloned and the given connection string is used for the connection string of + the cloned connection. + + + + + Finds the assemblies that were used for loading o-space types in the source context + and loads those assemblies in the cloned context. + + + + + Disposes both the underlying ObjectContext and its store connection. + + + + + The cloned context. + + + + + This is always the store connection of the underlying ObjectContext. + + + + + Represents setting the database initializer for a specific context type + + + + + Represents a parameter to be passed to a method + + + + + Represents a series of parameters to pass to a method + + + + + Adds a new parameter to the collection + Used for unit testing + + + + + Represents the configuration for a series of contexts + + + + + Adds a new context to the collection + Used for unit testing + + + + + Represents the configuration for a specific context type + + + + + Represents setting the default connection factory + + + + + Represents all Entity Framework related configuration + + + + + Handles creating databases either using the core provider or the Migrations pipeline. + + + + + Creates a database using the core provider (i.e. ObjectContext.CreateDatabase) or + by using Code First Migrations to create an empty database + and the perform an automatic migration to the current model. + Migrations is used if Code First is being used and the EF provider is for SQL Server + or SQL Compact. The core is used for non-Code First models and for other providers even + when using Code First. + + + + + A DbContext instance represents a combination of the Unit Of Work and Repository patterns such that + it can be used to query from a database and group together changes that will then be written + back to the store as a unit. + DbContext is conceptually similar to ObjectContext. + + + DbContext is usually used with a derived type that contains properties for + the root entities of the model. These sets are automatically initialized when the + instance of the derived class is created. This behavior can be modified by applying the + attribute to either the entire derived context + class, or to individual properties on the class. + + The Entity Data Model backing the context can be specified in several ways. When using the Code First + approach, the properties on the derived context are used to build a model + by convention. The protected OnModelCreating method can be overridden to tweak this model. More + control over the model used for the Model First approach can be obtained by creating a + explicitly from a and passing this model to one of the DbContext constructors. + + When using the Database First or Model First approach the Entity Data Model can be created using the + Entity Designer (or manually through creation of an EDMX file) and then this model can be specified using + entity connection string or an object. + + The connection to the database (including the name of the database) can be specified in several ways. + If the parameterless DbContext constructor is called from a derived context, then the name of the derived context + is used to find a connection string in the app.config or web.config file. If no connection string is found, then + the name is passed to the DefaultConnectionFactory registered on the class. The connection + factory then uses the context name as the database name in a default connection string. (This default connection + string points to .\SQLEXPRESS on the local machine unless a different DefaultConnectionFactory is registered.) + + Instead of using the derived context name, the connection/database name can also be specified explicitly by + passing the name to one of the DbContext constructors that takes a string. The name can also be passed in + the form "name=myname", in which case the name must be found in the config file or an exception will be thrown. + + Note that the connection found in the app.config or web.config file can be a normal database connection + string (not a special Entity Framework connection string) in which case the DbContext will use Code First. + However, if the connection found in the config file is a special Entity Framework connection string, then the + DbContext will use Database/Model First and the model specified in the connection string will be used. + + An existing or explicitly created DbConnection can also be used instead of the database/connection name. + + A can be applied to a class derived from DbContext to set the + version of conventions used by the context when it creates a model. If no attribute is applied then the + latest version of conventions will be used. + + + + + Interface implemented by objects that can provide an instance. + The class implements this interface to provide access to the underlying + ObjectContext. + + + + + Gets the object context. + + The object context. + + + + Constructs a new context instance using conventions to create the name of the database to + which a connection will be made. The by-convention name is the full name (namespace + class name) + of the derived context class. + See the class remarks for how this is used to create a connection. + + + + + Constructs a new context instance using conventions to create the name of the database to + which a connection will be made, and initializes it from the given model. + The by-convention name is the full name (namespace + class name) of the derived context class. + See the class remarks for how this is used to create a connection. + + The model that will back this context. + + + + Constructs a new context instance using the given string as the name or connection string for the + database to which a connection will be made. + See the class remarks for how this is used to create a connection. + + Either the database name or a connection string. + + + + Constructs a new context instance using the given string as the name or connection string for the + database to which a connection will be made, and initializes it from the given model. + See the class remarks for how this is used to create a connection. + + Either the database name or a connection string. + The model that will back this context. + + + + Constructs a new context instance using the existing connection to connect to a database. + The connection will not be disposed when the context is disposed. + + An existing connection to use for the new context. + If set to true the connection is disposed when + the context is disposed, otherwise the caller must dispose the connection. + + + + Constructs a new context instance using the existing connection to connect to a database, + and initializes it from the given model. + The connection will not be disposed when the context is disposed. + An existing connection to use for the new context. + The model that will back this context. + If set to true the connection is disposed when + the context is disposed, otherwise the caller must dispose the connection. + + + + + Constructs a new context instance around an existing ObjectContext. + An existing ObjectContext to wrap with the new context. + If set to true the ObjectContext is disposed when + the DbContext is disposed, otherwise the caller must dispose the connection. + + + + + Initializes the internal context, discovers and initializes sets, and initializes from a model if one is provided. + + + + + Discovers DbSets and initializes them. + + + + + This method is called when the model for a derived context has been initialized, but + before the model has been locked down and used to initialize the context. The default + implementation of this method does nothing, but it can be overridden in a derived class + such that the model can be further configured before it is locked down. + + + Typically, this method is called only once when the first instance of a derived context + is created. The model for that context is then cached and is for all further instances of + the context in the app domain. This caching can be disabled by setting the ModelCaching + property on the given ModelBuidler, but note that this can seriously degrade performance. + More control over caching is provided through use of the DbModelBuilder and DbContextFactory + classes directly. + + The builder that defines the model for the context being created. + + + + Internal method used to make the call to the real OnModelCreating method. + + The model builder. + + + + Returns a DbSet instance for access to entities of the given type in the context, + the ObjectStateManager, and the underlying store. + + + See the DbSet class for more details. + + The type entity for which a set should be returned. + A set for the given entity type. + + + + Returns a non-generic DbSet instance for access to entities of the given type in the context, + the ObjectStateManager, and the underlying store. + + The type of entity for which a set should be returned. + A set for the given entity type. + + See the DbSet class for more details. + + + + + Saves all changes made in this context to the underlying database. + + The number of objects written to the underlying database. + Thrown if the context has been disposed. + + + + Validates tracked entities and returns a Collection of containing validation results. + + + Collection of validation results for invalid entities. The collection is never null and must not contain null + values or results for valid entities. + + + 1. This method calls DetectChanges() to determine states of the tracked entities unless + DbContextConfiguration.AutoDetectChangesEnabled is set to false. + 2. By default only Added on Modified entities are validated. The user is able to change this behavior + by overriding ShouldValidateEntity method. + + + + + Extension point allowing the user to override the default behavior of validating only + added and modified entities. + + DbEntityEntry instance that is supposed to be validated. + true to proceed with validation. false otherwise. + + + + Extension point allowing the user to customize validation of an entity or filter out validation results. + Called by . + + DbEntityEntry instance to be validated. + User defined dictionary containing additional info for custom validation. + It will be passed to + and will be exposed as . + This parameter is optional and can be null. + Entity validation result. Possibly null when overridden. + + + + Internal method that calls the protected ValidateEntity method. + + DbEntityEntry instance to be validated. + User defined dictionary containing additional info for custom validation. + It will be passed to + and will be exposed as . + This parameter is optional and can be null. + Entity validation result. Possibly null when ValidateEntity is overridden. + + + + Gets a object for the given entity providing access to + information about the entity and the ability to perform actions on the entity. + + The type of the entity. + The entity. + An entry for the entity. + + + + Gets a object for the given entity providing access to + information about the entity and the ability to perform actions on the entity. + + The entity. + An entry for the entity. + + + + Calls the protected Dispose method. + + + + + Disposes the context. The underlying is also disposed if it was created + is by this context or ownership was passed to this context when this context was created. + The connection to the database ( object) is also disposed if it was created + is by this context or ownership was passed to this context when this context was created. + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Creates a Database instance for this context that allows for creation/deletion/existence checks + for the underlying database. + + + + + Returns the Entity Framework ObjectContext that is underlying this context. + + Thrown if the context has been disposed. + + + + Provides access to features of the context that deal with change tracking of entities. + + An object used to access features that deal with change tracking. + + + + Provides access to configuration options for the context. + + An object used to access configuration options. + + + + Provides access to the underlying InternalContext for other parts of the internal design. + + + + + A simple representation of an app.config or web.config file. + + + + + Initializes a new instance of AppConfig based on supplied configuration + + Configuration to load settings from + + + + Initializes a new instance of AppConfig based on supplied connection strings + The default configuration for database initializers and default connection factory will be used + + Connection strings to be used + + + + Initializes a new instance of AppConfig based on the for the AppDomain + + + Use AppConfig.DefaultInstance instead of this constructor + + + + + Appies any database intializers specified in the configuration + + + + + Appies any database intializers specified in the configuration + + + Value indicating if initializers should be re-applied if they have already been applied in this AppDomain + + + + + Gets the specified connection string from the configuration + + Name of the connection string to get + The connection string, or null if there is no connection string with the specified name + + + + Gets the default connection factory based on the configuration + + + + + Gets a singleton instance of configuration based on the for the AppDomain + + + + + Acts as a proxy for that for the most part just passes calls + through to the real object but uses virtual methods/properties such that uses of the object + can be mocked. + + + + + Encapsulates information read from the application config file that specifies a database initializer + and allows that initializer to be dynamically applied. + + + + + Initializes a new instance of the class. + + The key from the entry in the config file. + The value from the enrty in the config file. + + + + Uses the context type and initializer type specified in the config to create an initializer instance + and set it with the DbDbatabase.SetInitializer method. + + + + + Reads all initializers from the application config file and sets them using the Database class. + + + + + Calculates the model hash values used the EdmMetadata table from EF 4.1/4.2. + + + + + Calculates an SHA256 hash of the EDMX from the given code first model. This is the hash stored in + the database in the EdmMetadata table in EF 4.1/4.2. The hash is always calculated using a v2 schema + as was generated by EF 4.1/4.2 and with the entity included in the model. + + + + + Acts as a proxy for that for the most part just passes calls + through to the real object but uses virtual methods/properties such that uses of the object + can be mocked. + + + + + An implementation of that will use Code First Migrations + to update the database to the latest version. + + + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + Initializes a new instance of the MigrateDatabaseToLatestVersion class. + + + + + Initializes a new instance of the MigrateDatabaseToLatestVersion class that will + use a specific connection string from the configuration file to connect to + the database to perform the migration. + + The name of the connection string to use for migration. + + + + + + + Helper class that is used to configure a column. + + + + + Creates a new column definition to store Binary data. + + Value indicating whether or not the column allows null values. + The maximum allowable length of the array data. + Value indicating whether or not all data should be padded to the maximum length. + Value indicating whether or not the maximum length supported by the database provider should be used. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + Value indicating whether or not this column should be configured as a timestamp. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Boolean data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Byte data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store DateTime data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Decimal data. + + Value indicating whether or not the column allows null values. + The numeric precision of the column. + The numeric scale of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + Value indicating whether or not the database will generate values for this column during insert. + The newly constructed column definition. + + + + Creates a new column definition to store Double data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store GUID data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Single data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Short data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Integer data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Long data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store String data. + + Value indicating whether or not the column allows null values. + The maximum allowable length of the string data. + Value indicating whether or not all data should be padded to the maximum length. + Value indicating whether or not the maximum length supported by the database provider should be used. + Value indicating whether or not the column supports Unicode content. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Time data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store DateTimeOffset data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Helper class that is used to further configure a table being created from a CreateTable call on . + + + + + Initializes a new instance of the TableBuilder class. + + The table creation operation to be further configured. + The migration the table is created in. + + + + Specifies a primary key for the table. + + + A lambda expression representing the property to be used as the primary key. + C#: t => t.Id + VB.Net: Function(t) t.Id + + If the primary key is made up of multiple properties then specify an anonymous type including the properties. + C#: t => new { t.Id1, t.Id2 } + VB.Net: Function(t) New With { t.Id1, t.Id2 } + + + The name of the primary key. + If null is supplied, a default name will be generated. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Specifies an index to be created on the table. + + + A lambda expression representing the property to be indexed. + C#: t => t.PropertyOne + VB.Net: Function(t) t.PropertyOne + + If multiple properties are to be indexed then specify an anonymous type including the properties. + C#: t => new { t.PropertyOne, t.PropertyTwo } + VB.Net: Function(t) New With { t.PropertyOne, t.PropertyTwo } + + A value indicating whether or not this is a unique index. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Specifies a foreign key constraint to be created on the table. + + Name of the table that the foreign key constraint targets. + + A lambda expression representing the properties of the foreign key. + C#: t => t.PropertyOne + VB.Net: Function(t) t.PropertyOne + + If multiple properties make up the foreign key then specify an anonymous type including the properties. + C#: t => new { t.PropertyOne, t.PropertyTwo } + VB.Net: Function(t) New With { t.PropertyOne, t.PropertyTwo } + + A value indicating whether or not cascade delete should be configured on the foreign key constraint. + + + The name of this foreign key constraint. + If no name is supplied, a default name will be calculated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Base class for code-based migrations. + + + + + Operations to be performed during the upgrade process. + + + + + Operations to be performed during the downgrade process. + + + + + Adds an operation to create a new table. + + + The columns in this create table operation. + You do not need to specify this type, it will be inferred from the columnsAction parameter you supply. + + The name of the table. Schema name is optional, if no schema is specified then dbo is assumed. + + An action that specifies the columns to be included in the table. + i.e. t => new { Id = t.Int(identity: true), Name = t.String() } + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + An object that allows further configuration of the table creation operation. + + + + Adds an operation to create a new foreign key constraint. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key column. + + The table that contains the column this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The column this foreign key references. + If no value is supplied the primary key of the principal table will be referenced. + + + A value indicating if cascade delete should be configured for the foreign key relationship. + If no value is supplied, cascade delete will be off. + + + The name of the foreign key constraint in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new foreign key constraint. + + + The table that contains the foreign key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key columns. + + The table that contains the columns this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The columns this foreign key references. + If no value is supplied the primary key of the principal table will be referenced. + + + A value indicating if cascade delete should be configured for the foreign key relationship. + If no value is supplied, cascade delete will be off. + + + The name of the foreign key constraint in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on its name. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the foreign key constraint in the database. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on the column it targets. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key column. + + The table that contains the column this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + The columns this foreign key references. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on the columns it targets. + + + The table that contains the foreign key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key columns. + + The table that contains the columns this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + The columns this foreign key references. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a table. + + + The name of the table to be dropped. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to move a table to a new schema. + + + The name of the table to be moved. + Schema name is optional, if no schema is specified then dbo is assumed. + + The schema the table is to be moved to. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to rename a table. To change the schema of a table use MoveTable + + + The name of the table to be renamed. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The new name for the table. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to rename a column. + + + The name of the table that contains the column to be renamed. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be renamed. + The new name for the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to add a column to an existing table. + + + The name of the table to add the column to. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The name of the column to be added. + + + An action that specifies the column to be added. + i.e. c => c.Int(nullable: false, defaultValue: 3) + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing column. + + + The name of the table to drop the column from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to alter the definition of an existing column. + + + The name of the table the column exists in. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be changed. + + An action that specifies the new definition for the column. + i.e. c => c.String(nullable: false, defaultValue: "none") + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new primary key. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The primary key column. + + The name of the primary key in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new primary key based on multiple columns. + + + The table that contains the primary key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The primary key columns. + + The name of the primary key in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing primary key that does not have the default name. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the primary key to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing primary key that was created with the default name. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create an index on a single column. + + + The name of the table to create the index on. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to create the index on. + + A value indicating if this is a unique index. + If no value is supplied a non-unique index will be created. + + + The name to use for the index in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create an index on multiple columns. + + + The name of the table to create the index on. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the columns to create the index on. + + A value indicating if this is a unique index. + If no value is supplied a non-unique index will be created. + + + The name to use for the index in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an index based on its name. + + + The name of the table to drop the index from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the index to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an index based on the columns it targets. + + + The name of the table to drop the index from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column(s) the index targets. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to execute a SQL command. + + The SQL to be executed. + + A value indicating if the SQL should be executed outside of the + transaction being used for the migration process. + If no value is supplied the SQL will be executed within the transaction. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Configuration relating to the use of migrations for a given model. + You will typically create a configuration class that derives + from rather than + using this class. + + + + + Initializes a new instance of the DbMigrationsConfiguration class. + + + + + Adds a new SQL generator to be used for a given database provider. + + Name of the database provider to set the SQL generator for. + The SQL generator to be used. + + + + Gets the SQL generator that is set to be used with a given database provider. + + Name of the database provider to get the SQL generator for. + The SQL generator that is set for the database provider. + + + + Gets or sets a value indicating if automatic migrations can be used when migration the database. + + + + + Gets or sets a value indicating if data loss is acceptable during automatic migration. + If set to false an exception will be thrown if data loss may occur as part of an automatic migration. + + + + + Gets or sets the derived DbContext representing the model to be migrated. + + + + + Gets or sets the namespace used for code-based migrations. + + + + + Gets or sets the sub-directory that code-based migrations are stored in. + + + + + Gets or sets the code generator to be used when scaffolding migrations. + + + + + Gets or sets the assembly containing code-based migrations. + + + + + Gets or sets a value to override the connection of the database to be migrated. + + + + + Gets or sets the timeout value used for the individual commands within a + migration. A null value indicates that the default value of the underlying + provider will be used. + + + + + Configuration relating to the use of migrations for a given model. + + The context representing the model that this configuration applies to. + + + + Initializes a new instance of the DbMigrationsConfiguration class. + + + + + Runs after upgrading to the latest migration to allow seed data to be updated. + + Context to be used for updating seed data. + + + + DbMigrator is used to apply existing migrations to a database. + DbMigrator can be used to upgrade and downgrade to any given migration. + To scaffold migrations based on changes to your model use + + + + + Base class for decorators that wrap the core + + + + + Initializes a new instance of the MigratorBase class. + + The migrator that this decorator is wrapping. + + + + Gets a list of the pending migrations that have not been applied to the database. + + List of migration Ids + + + + Updates the target database to the latest migration. + + + + + Updates the target database to a given migration. + + The migration to upgrade/downgrade to. + + + + Gets a list of the migrations that are defined in the assembly. + + List of migration Ids + + + + Gets a list of the migrations that have been applied to the database. + + List of migration Ids + + + + Gets the configuration being used for the migrations process. + + + + + Migration Id representing the state of the database before any migrations are applied. + + + + + Initializes a new instance of the DbMigrator class. + + Configuration to be used for the migration process. + + + + Gets all migrations that are defined in the configured migrations assembly. + + + + + Gets all migrations that have been applied to the target database. + + + + + Gets all migrations that are defined in the assembly but haven't been applied to the target database. + + + + + Updates the target database to a given migration. + + The migration to upgrade/downgrade to. + + + + Gets the configuration that is being used for the migration process. + + + + + A set of extension methods for + + + + + Adds or updates entities by key when SaveChanges is called. Equivalent to an "upsert" operation + from database terminology. + This method can useful when seeding data using Migrations. + + The entities to add or update. + + When the parameter is a custom or fake IDbSet implementation, this method will + attempt to locate and invoke a public, instance method with the same signature as this extension method. + + + + + Adds or updates entities by a custom identification expression when SaveChanges is called. + Equivalent to an "upsert" operation from database terminology. + This method can useful when seeding data using Migrations. + + + An expression specifying the properties that should be used when determining + whether an Add or Update operation should be performed. + + The entities to add or update. + + When the parameter is a custom or fake IDbSet implementation, this method will + attempt to locate and invoke a public, instance method with the same signature as this extension method. + + + + + Generates C# code for a code-based migration. + + + + + Base class for providers that generate code for code-based migrations. + + + + + Generates the code that should be added to the users project. + + Unique identifier of the migration. + Operations to be performed by the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Gets the namespaces that must be output as "using" or "Imports" directives to handle + the code generated by the given operations. + + The operations for which code is going to be generated. + An ordered list of namespace names. + + + + Gets the default namespaces that must be output as "using" or "Imports" directives for + any code generated. + + A value indicating if this class is being generated for a code-behind file. + An ordered list of namespace names. + + + + + + + Generates the primary code file that the user can view and edit. + + Operations to be performed by the migration. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates the code behind file with migration metadata. + + Unique identifier of the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates a property to return the source or target model in the code behind file. + + Name of the property. + Value to be returned. + Text writer to add the generated code to. + + + + Generates a namespace, using statements and class definition. + + Namespace that code should be generated in. + Name of the class that should be generated. + Text writer to add the generated code to. + Base class for the generated class. + A value indicating if this class is being generated for a code-behind file. + Namespaces for which using directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used. + + + + Generates the closing code for a class that was started with WriteClassStart. + + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify a set of column names using a lambda expression. + + The columns to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify the definition for a . + + The column definition to generate code for. + Text writer to add the generated code to. + A value indicating whether to include the column name in the definition. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column of unknown data type. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Removes any invalid characters from the name of an database artifact. + + The name to be scrubbed. + The scrubbed name. + + + + Gets the type name to use for a column of the given data type. + + The data type to translate. + The type name to use in the generated migration. + + + + Quotes an identifier using appropriate escaping to allow it to be stored in a string. + + The identifier to be quoted. + The quoted identifier. + + + + Scaffolds code-based migrations to apply pending model changes to the database. + + + + + Initializes a new instance of the MigrationScaffolder class. + + Configuration to be used for scaffolding. + + + + Scaffolds a code based migration to apply any pending model changes to the database. + + The name to use for the scaffolded migration. + The scaffolded migration. + + + + Scaffolds a code based migration to apply any pending model changes to the database. + + The name to use for the scaffolded migration. + Whether or not to include model changes. + The scaffolded migration. + + + + Scaffolds the initial code-based migration corresponding to a previously run database initializer. + + The scaffolded migration. + + + + Gets or sets the namespace used in the migration's generated code. + + By default, this is the same as MigrationsNamespace on the migrations + configuration object passed into the constructor. For VB.NET projects, this + will need to be updated to take into account the project's root namespace. + + + + + Represents a code-based migration that has been scaffolded and is ready to be written to a file. + + + + + Gets or sets the unique identifier for this migration. + Typically used for the file name of the generated code. + + + + + Gets or sets the scaffolded migration code that the user can edit. + + + + + Gets or sets the scaffolded migration code that should be stored in a code behind file. + + + + + Gets or sets the programming language used for this migration. + Typically used for the file extension of the generated code. + + + + + Gets or sets the subdirectory in the user's project that this migration should be saved in. + + + + + Gets a dictionary of string resources to add to the migration resource file. + + + + + Represents an exception that occurred while running an operation in another AppDomain in the . + + + + + Initializes a new instance of the ToolingException class. + + Error that explains the reason for the exception. + The type of the exception that was thrown. + The stack trace of the exception that was thrown. + + + + + + + + + + Gets the type of the exception that was thrown. + + + + + Gets the stack trace of the exception that was thrown. + + + + + Helper class that is used by design time tools to run migrations related + commands that need to interact with an application that is being edited + in Visual Studio. + + Because the application is being edited the assemblies need to + be loaded in a separate AppDomain to ensure the latest version + is always loaded. + + The App/Web.config file from the startup project is also copied + to ensure that any configuration is applied. + + + + + Initializes a new instance of the ToolingFacade class. + + + The name of the assembly that contains the migrations configuration to be used. + + + The namespace qualified name of migrations configuration to be used. + + + The working directory containing the compiled assemblies. + + + The path of the config file from the startup project. + + + The path of the application data directory from the startup project. + Typically the App_Data directory for web applications or the working directory for executables. + + + The connection to the database to be migrated. + If null is supplied, the default connection for the context will be used. + + + + + Releases all unmanaged resources used by the facade. + + + + + Gets the fully qualified name of all types deriving from . + + All context types found. + + + + Gets the fully qualified name of a type deriving from . + + The name of the context type. If null, the single context type found in the assembly will be returned. + The context type found. + + + + Gets a list of all migrations that have been applied to the database. + + Ids of applied migrations. + + + + Gets a list of all migrations that have not been applied to the database. + + Ids of pending migrations. + + + + Updates the database to the specified migration. + + + The Id of the migration to migrate to. + If null is supplied, the database will be updated to the latest migration. + + Value indicating if data loss during automatic migration is acceptable. + + + + Generates a SQL script to migrate between two migrations. + + + The migration to update from. + If null is supplied, a script to update the current database will be produced. + + + The migration to update to. + If null is supplied, a script to update to the latest migration will be produced. + + Value indicating if data loss during automatic migration is acceptable. + The generated SQL script. + + + + Scaffolds a code-based migration to apply any pending model changes. + + The name for the generated migration. + The programming language of the generated migration. + The root namespace of the project the migration will be added to. + Whether or not to include model changes. + The scaffolded migration. + + + + Scaffolds the initial code-based migration corresponding to a previously run database initializer. + + The programming language of the generated migration. + The root namespace of the project the migration will be added to. + The scaffolded migration. + + + + + + + Releases all resources used by the facade. + + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + + Gets or sets an action to be run to log information. + + + + + Gets or sets an action to be run to log warnings. + + + + + Gets or sets an action to be run to log verbose information. + + + + + Base class for loggers that can be used for the migrations process. + + + + + Logs an informational message. + + The message to be logged. + + + + Logs a warning that the user should be made aware of. + + The message to be logged. + + + + Logs some additional information that should only be presented to the user if they request verbose output. + + The message to be logged. + + + + Generates VB.Net code for a code-based migration. + + + + + + + + Generates the primary code file that the user can view and edit. + + Operations to be performed by the migration. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates the code behind file with migration metadata. + + Unique identifier of the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates a property to return the source or target model in the code behind file. + + Name of the property. + Value to be returned. + Text writer to add the generated code to. + + + + Generates a namespace, using statements and class definition. + + Namespace that code should be generated in. + Name of the class that should be generated. + Text writer to add the generated code to. + Base class for the generated class. + A value indicating if this class is being generated for a code-behind file. + Namespaces for which Imports directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used. + + + + Generates the closing code for a class that was started with WriteClassStart. + + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify a set of column names using a lambda expression. + + The columns to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify the definition for a . + + The column definition to generate code for. + Text writer to add the generated code to. + A value indicating whether to include the column name in the definition. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column of unknown data type. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Removes any invalid characters from the name of an database artifact. + + The name to be scrubbed. + The scrubbed name. + + + + Gets the type name to use for a column of the given data type. + + The data type to translate. + The type name to use in the generated migration. + + + + Quotes an identifier using appropriate escaping to allow it to be stored in a string. + + The identifier to be quoted. + The quoted identifier. + + + + This class is used by Code First Migrations to read and write migration history + from the database. It is not intended to be used by other code and is only public + so that it can be accessed by EF when running under partial trust. It may be + changed or removed in the future. + + + + + Gets or sets the Id of the migration this row represents. + + + + + Gets or sets the date and time that this migrations history entry was created. + + + + + Gets or sets the state of the model after this migration was applied. + + + + + Gets or sets the version of Entity Framework that created this entry. + + + + + This is a version of the HistoryContext that still includes CreatedOn in its model. + It is used when figuring out whether or not the CreatedOn column exists and so should + be dropped. + + + + + Represents an error that occurs when an automatic migration would result in data loss. + + + + + Represents errors that occur inside the Code First Migrations pipeline. + + + + + Initializes a new instance of the MigrationsException class. + + + + + Initializes a new instance of the MigrationsException class. + + The message that describes the error. + + + + Initializes a new instance of the MigrationsException class. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the MigrationsException class with serialized data. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + + + Initializes a new instance of the AutomaticDataLossException class. + + The message that describes the error. + + + + Represents an error that occurs when there are pending model changes after applying the last migration and automatic migration is disabled. + + + + + Initializes a new instance of the AutomaticMigrationsDisabledException class. + + The message that describes the error. + + + + Provides additional metadata about a code-based migration. + + + + + Gets the unique identifier for the migration. + + + + + Gets the state of the model before this migration is run. + + + + + Gets the state of the model after this migration is run. + + + + + Decorator to provide logging during migrations operations.. + + + + + Initializes a new instance of the MigratorLoggingDecorator class. + + The migrator that this decorator is wrapping. + The logger to write messages to. + + + + Decorator to produce a SQL script instead of applying changes to the database. + Using this decorator to wrap will prevent + from applying any changes to the target database. + + + + + Initializes a new instance of the MigratorScriptingDecorator class. + + The migrator that this decorator is wrapping. + + + + + Represents a column being added to a table. + + + + + Represents an operation to modify a database schema. + + + + + Initializes a new instance of the MigrationOperation class. + + + + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets additional arguments that may be processed by providers. + + + + + Gets an operation that will revert this operation. + + + + + Gets a value indicating if this operation may result in data loss. + + + + + Initializes a new instance of the AddColumnOperation class. + + The name of the table the column should be added to. + Details of the column being added. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column should be added to. + + + + + Gets the details of the column being added. + + + + + Gets an operation that represents dropping the added column. + + + + + + + + Represents a foreign key constraint being added to a table. + + + + + Base class for changes that affect foreign key constraints. + + + + + Initializes a new instance of the ForeignKeyOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the name of the table that the foreign key constraint targets. + + + + + Gets or sets the name of the table that the foreign key columns exist in. + + + + + The names of the foreign key column(s). + + + + + Gets a value indicating if a specific name has been supplied for this foreign key constraint. + + + + + Gets or sets the name of this foreign key constraint. + If no name is supplied, a default name will be calculated. + + + + + Initializes a new instance of the AddForeignKeyOperation class. + The PrincipalTable, PrincipalColumns, DependentTable and DependentColumns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to create an index on the foreign key column(s). + + An operation to add the index. + + + + The names of the column(s) that the foreign key constraint should target. + + + + + Gets or sets a value indicating if cascade delete should be configured on the foreign key constraint. + + + + + Gets an operation to drop the foreign key constraint. + + + + + + + + Represents adding a primary key to a table. + + + + + Common base class to represent operations affecting primary keys. + + + + + Initializes a new instance of the PrimaryKeyOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the name of the table that contains the primary key. + + + + + Gets the column(s) that make up the primary key. + + + + + Gets a value indicating if a specific name has been supplied for this primary key. + + + + + Gets or sets the name of this primary key. + If no name is supplied, a default name will be calculated. + + + + + + + + Initializes a new instance of the AddPrimaryKeyOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to drop the primary key. + + + + + Represents altering an existing column. + + + + + Initializes a new instance of the AlterColumnOperation class. + + The name of the table that the column belongs to. + Details of what the column should be altered to. + Value indicating if this change will result in data loss. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the AlterColumnOperation class. + + The name of the table that the column belongs to. + Details of what the column should be altered to. + Value indicating if this change will result in data loss. + An operation to revert this alteration of the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table that the column belongs to. + + + + + Gets the new definition for the column. + + + + + Gets an operation that represents reverting the alteration. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents information about a column. + + + + + Initializes a new instance of the class. + + The data type for this column. + + + + Initializes a new instance of the class. + + The data type for this column. + + Additional details about the data type. + This includes details such as maximum length, nullability etc. + + + + + Determines if this column is a narrower data type than another column. + Used to determine if altering the supplied column definition to this definition will result in data loss. + + The column to compare to. + Details of the database provider being used. + True if this column is of a narrower data type. + + + + Gets the data type for this column. + + + + + Gets the CLR type corresponding to the database type of this column. + + + + + Gets the default value for the CLR type corresponding to the database type of this column. + + + + + Gets additional details about the data type of this column. + This includes details such as maximum length, nullability etc. + + + + + Gets or sets the name of the column. + + + + + Gets or sets a provider specific data type to use for this column. + + + + + Gets or sets a value indicating if this column can store null values. + + + + + Gets or sets a value indicating if values for this column will be generated by the database using the identity pattern. + + + + + Gets or sets the maximum length for this column. + Only valid for array data types. + + + + + Gets or sets the precision for this column. + Only valid for decimal data types. + + + + + Gets or sets the scale for this column. + Only valid for decimal data types. + + + + + Gets or sets a constant value to use as the default value for this column. + + + + + Gets or sets a SQL expression used as the default value for this column. + + + + + Gets or sets a value indicating if this column is fixed length. + Only valid for array data types. + + + + + Gets or sets a value indicating if this column supports Unicode characters. + Only valid for textual data types. + + + + + Gets or sets a value indicating if this column should be configured as a timestamp. + + + + + Represents creating a database index. + + + + + Common base class for operations affecting indexes. + + + + + Initializes a new instance of the IndexOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the table the index belongs to. + + + + + Gets or sets the columns that are indexed. + + + + + Gets a value indicating if a specific name has been supplied for this index. + + + + + Gets or sets the name of this index. + If no name is supplied, a default name will be calculated. + + + + + Initializes a new instance of the CreateIndexOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets a value indicating if this is a unique index. + + + + + Gets an operation to drop this index. + + + + + + + + Represents creating a table. + + + + + Initializes a new instance of the CreateTableOperation class. + + Name of the table to be created. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be created. + + + + + Gets the columns to be included in the new table. + + + + + Gets or sets the primary key for the new table. + + + + + Gets an operation to drop the table. + + + + + + + + Represents deleting a new record from the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Common base class for operations that affect the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Initializes a new instance of the HistoryOperation class. + + Name of the migrations history table. + Name of the migration being affected. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the migrations history table. + + + + + Gets the name of the migration being affected. + + + + + + + + Initializes a new instance of the DeleteHistoryOperation class. + + Name of the migrations history table. + Id of the migration record to be deleted. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Represents a column being dropped from a table. + + + + + Initializes a new instance of the DropColumnOperation class. + + The name of the table the column should be dropped from. + The name of the column to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropColumnOperation class. + + The name of the table the column should be dropped from. + The name of the column to be dropped. + The operation that represents reverting the drop operation. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column should be dropped from. + + + + + Gets the name of the column to be dropped. + + + + + Gets an operation that represents reverting dropping the column. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents a foreign key constraint being dropped from a table. + + + + + Initializes a new instance of the DropForeignKeyOperation class. + The PrincipalTable, DependentTable and DependentColumns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropForeignKeyOperation class. + + The operation that represents reverting dropping the foreign key constraint. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to drop the associated index on the foreign key column(s). + + An operation to drop the index. + + + + Gets an operation that represents reverting dropping the foreign key constraint. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents dropping an existing index. + + + + + Initializes a new instance of the DropIndexOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropIndexOperation class. + + The operation that represents reverting dropping the index. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation that represents reverting dropping the index. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents dropping a primary key from a table. + + + + + Initializes a new instance of the DropPrimaryKeyOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to add the primary key. + + + + + Represents dropping an existing table. + + + + + Initializes a new instance of the DropTableOperation class. + + The name of the table to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropTableOperation class. + + The name of the table to be dropped. + An operation that represents reverting dropping the table. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be dropped. + + + + + Gets an operation that represents reverting dropping the table. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents inserting a new record into the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Initializes a new instance of the InsertHistoryOperation class. + + Name of the migrations history table. + Id of the migration record to be inserted. + Value to be stored in the model column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the value to store in the history table representing the target model of the migration. + + + + + Gets the value to store in the history table indicating the version of Entity Framework used to produce this migration. + + + + + + + + Represents moving a table from one schema to another. + + + + + Initializes a new instance of the MoveTableOperation class. + + Name of the table to be moved. + Name of the schema to move the table to. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be moved. + + + + + Gets the name of the schema to move the table to. + + + + + Gets an operation that moves the table back to its original schema. + + + + + + + + Represents renaming an existing column. + + + + + Initializes a new instance of the RenameColumnOperation class. + + Name of the table the column belongs to. + Name of the column to be renamed. + New name for the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column belongs to. + + + + + Gets the name of the column to be renamed. + + + + + Gets the new name for the column. + + + + + Gets an operation that reverts the rename. + + + + + + + + Represents renaming an existing table. + + + + + Initializes a new instance of the RenameTableOperation class. + + Name of the table to be renamed. + New name for the table. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be renamed. + + + + + Gets the new name for the table. + + + + + Gets an operation that reverts the rename. + + + + + + + + Represents a provider specific SQL statement to be executed directly against the target database. + + + + + Initializes a new instance of the SqlOperation class. + + The SQL to be executed. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the SQL to be executed. + + + + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + + + + Common base class for providers that convert provider agnostic migration + operations into database provider specific SQL commands. + + + + + Converts a set of migration operations into database provider specific SQL. + + The operations to be converted. + Token representing the version of the database being targeted. + A list of SQL statements to be executed to perform the migration operations. + + + + Represents a migration operation that has been translated into a SQL statement. + + + + + Gets or sets the SQL to be executed to perform this migration operation. + + + + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + Provider to convert provider agnostic migration operations into SQL commands + that can be run against Microsoft SQL Server Compact Edition. + + + + + Provider to convert provider agnostic migration operations into SQL commands + that can be run against a Microsoft SQL Server database. + + + + + Converts a set of migration operations into Microsoft SQL Server specific SQL. + + The operations to be converted. + Token representing the version of SQL Server being targeted (i.e. "2005", "2008"). + A list of SQL statements to be executed to perform the migration operations. + + + + Creates an empty connection for the current provider. + Allows derived providers to use connection other than . + + + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL to mark a table as a system table. + Generated SQL should be added using the Statement method. + + The table to mark as a system table. + + + + Generates SQL to create a database schema. + Generated SQL should be added using the Statement method. + + The name of the schema to create. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL to specify a constant byte[] default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant bool default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant DateTime default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant DateTimeOffset default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant Guid default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant string default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant TimeSpan default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify the data type of a column. + This method just generates the actual type, not the SQL to create the column. + + The definition of the column. + SQL representing the data type. + + + + Generates a quoted name. The supplied name may or may not contain the schema. + + The name to be quoted. + The quoted name. + + + + Quotes an identifier for SQL Server. + + The identifier to be quoted. + The quoted identifier. + + + + Adds a new Statement to be executed against the database. + + The statement to be executed. + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + Gets a new that can be used to build SQL. + + This is just a helper method to create a writer. Writing to the writer will + not cause SQL to be registered for execution. You must pass the generated + SQL to the Statement method. + + An empty text writer to use for SQL generation. + + + + Adds a new Statement to be executed against the database. + + The writer containing the SQL to be executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Utility class to prep the user's config file to run in an AppDomain + + + + + Updates a config file by adding binding redirects for EntityFramework.dll. + This ensures that the user's code can be ran in an AppDomain and the exact + same version of the assembly will be used for both domains. + + That path of the user's config file. Can also be null or a path to an non-existent file. + The path of the updated config file. It is the caller's responsibility to delete this. + + + + The same as but works in partial trust. + + + + + Specifies the default tab string. This field is constant. + + + + + Initializes a new instance of the IndentedTextWriter class using the specified text writer and default tab string. + + The to use for output. + + + + Initializes a new instance of the IndentedTextWriter class using the specified text writer and tab string. + + The to use for output. + The tab string to use for indentation. + + + + Closes the document being written to. + + + + + Flushes the stream. + + + + + Outputs the tab string once for each level of indentation according to the property. + + + + + Writes the specified string to the text stream. + + The string to write. + + + + Writes the text representation of a Boolean value to the text stream. + + The Boolean value to write. + + + + Writes a character to the text stream. + + The character to write. + + + + Writes a character array to the text stream. + + The character array to write. + + + + Writes a subarray of characters to the text stream. + + The character array to write data from. + Starting index in the buffer. + The number of characters to write. + + + + Writes the text representation of a Double to the text stream. + + The double to write. + + + + Writes the text representation of a Single to the text stream. + + The single to write. + + + + Writes the text representation of an integer to the text stream. + + The integer to write. + + + + Writes the text representation of an 8-byte integer to the text stream. + + The 8-byte integer to write. + + + + Writes the text representation of an object to the text stream. + + The object to write. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string. + The object to write into the formatted string. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string to use. + The first object to write into the formatted string. + The second object to write into the formatted string. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string to use. + The argument array to output. + + + + Writes the specified string to a line without tabs. + + The string to write. + + + + Writes the specified string, followed by a line terminator, to the text stream. + + The string to write. + + + + Writes a line terminator. + + + + + Writes the text representation of a Boolean, followed by a line terminator, to the text stream. + + The Boolean to write. + + + + Writes a character, followed by a line terminator, to the text stream. + + The character to write. + + + + Writes a character array, followed by a line terminator, to the text stream. + + The character array to write. + + + + Writes a subarray of characters, followed by a line terminator, to the text stream. + + The character array to write data from. + Starting index in the buffer. + The number of characters to write. + + + + Writes the text representation of a Double, followed by a line terminator, to the text stream. + + The double to write. + + + + Writes the text representation of a Single, followed by a line terminator, to the text stream. + + The single to write. + + + + Writes the text representation of an integer, followed by a line terminator, to the text stream. + + The integer to write. + + + + Writes the text representation of an 8-byte integer, followed by a line terminator, to the text stream. + + The 8-byte integer to write. + + + + Writes the text representation of an object, followed by a line terminator, to the text stream. + + The object to write. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string. + The object to write into the formatted string. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string to use. + The first object to write into the formatted string. + The second object to write into the formatted string. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string to use. + The argument array to output. + + + + Writes the text representation of a UInt32, followed by a line terminator, to the text stream. + + A UInt32 to output. + + + + Gets the encoding for the text writer to use. + + + An that indicates the encoding for the text writer to use. + + + + + Gets or sets the new line character to use. + + + The new line character to use. + + + + + Gets or sets the number of spaces to indent. + + + The number of spaces to indent. + + + + + Gets the to use. + + + The to use. + + + + + Used for generating values that are always in sequential + order for the calling thread. + + + + + Returns the value of unless this value would be the same as the + last value returned by this thread calling this method, in which case the thread pushes the value + a little bit into the future. The comparison is in terms of the form used to store migration ID + in the database--i.e. to the 1/10 second. + + + There should never be any pushing to the future involved for normal use of migrations, but when + this method is called in rapid succession while testing or otherwise calling the DbMigrator APIs + there may be occasional sleeping. + + + + + Same as UtcNow method bur returns the time in the timestamp format used in migration IDs. + + + + + Convention to apply column ordering specified via + or the API. This convention throws if a duplicate configured column order + is detected. + + + + + Convention to apply column ordering specified via + or the API. + + + + + Identifies conventions that can be removed from a instance. + + /// + Note that implementations of this interface must be immutable. + + + + + Strongly-typed and parameterized string resources. + + + + + A string like "Applying automatic migration: {0}." + + + + + A string like "Reverting automatic migration: {0}." + + + + + A string like "Applying code-based migration: {0}." + + + + + A string like "Reverting code-based migration: {0}." + + + + + A string like "Applying code-based migrations: [{1}]." + + + + + A string like "Reverting migrations: [{1}]." + + + + + A string like "Target database is already at version {0}." + + + + + A string like "Target database is: {0}." + + + + + A string like "'{1}' (DataSource: {0}, Provider: {2}, Origin: {3})" + + + + + A string like "The specified target migration '{0}' does not exist. Ensure that target migration refers to an existing migration id." + + + + + A string like "The Foreign Key on table '{0}' with columns '{1}' could not be created because the principal key columns could not be determined. Use the AddForeignKey fluent API to fully specify the Foreign Key." + + + + + A string like "'{0}' is not a valid target migration. When targeting a previously applied automatic migration, use the full migration id including timestamp." + + + + + A string like "'{0}' is not a valid migration. Code-based migrations must be used for both source and target when scripting the upgrade between them." + + + + + A string like "The target context '{0}' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory." + + + + + A string like "The specified migration name '{0}' is ambiguous. Specify the full migration id including timestamp instead." + + + + + A string like "The migrations configuration type '{0}' was not be found in the assembly '{1}'." + + + + + A string like "More than one migrations configuration type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the one to use." + + + + + A string like "No migrations configuration type was found in the assembly '{0}'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)." + + + + + A string like "More than one migrations configuration type was found in the assembly '{0}'. Specify the name of the one to use." + + + + + A string like "The type '{0}' is not a migrations configuration type." + + + + + A string like "The migrations configuration type '{0}' must have a public default constructor." + + + + + A string like "The migrations configuration type '{0}' must not be abstract." + + + + + A string like "The migrations configuration type '{0}' must not be generic." + + + + + A string like "In VB.NET projects, the migrations namespace '{0}' must be under the root namespace '{1}'. Update the migrations project's root namespace to allow classes under the migrations namespace to be added." + + + + + + A string like "No MigrationSqlGenerator found for provider '{0}'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators." + + + + + A string like "Could not load assembly '{0}'. (If you are using Code First Migrations inside Visual Studio this can happen if the startUp project for your solution does not reference the project that contains your migrations. You can either change the startUp project for your solution or use the -StartUpProjectName parameter.)" + + + + + A string like "No context type was found in the assembly '{0}'." + + + + + A string like "More than one context type was found in the assembly '{0}'." + + + + + A string like "To enable migrations for {0}, use Enable-Migrations -ContextTypeName {0}." + + + + + A string like "The context type '{0}' was not found in the assembly '{1}'." + + + + + A string like "More than one context type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the context." + + + + + A string like "The argument '{0}' cannot be null, empty or contain only white space." + + + + + A string like "The argument property '{0}' cannot be null." + + + + + A string like "The precondition '{0}' failed. {1}" + + + + + A string like "The type '{0}' has already been configured as a complex type. It cannot be reconfigured as an entity type." + + + + + A string like "The type '{0}' has already been configured as an entity type. It cannot be reconfigured as a complex type." + + + + + A string like "The key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + A string like "The foreign key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + A string like "The property '{0}' is not a declared property on type '{1}'. Verify that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property." + + + + + A string like "The navigation property '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property." + + + + + A string like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'." + + + + + A string like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. Use dotted paths for nested properties: C#: 't => t.MyProperty.MyProperty' VB.Net: 'Function(t) t.MyProperty.MyProperty'." + + + + + A string like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + A string like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + + A string like "Conflicting configuration settings were specified for property '{0}' on type '{1}': {2}" + + + + + A string like "Conflicting configuration settings were specified for column '{0}' on table '{1}': {2}" + + + + + A string like "{0} = {1} conflicts with {2} = {3}" + + + + + A string like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from ComplexObject." + + + + + A string like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject." + + + + + A string like "The navigation property '{0}' declared on type '{1}' cannot be the inverse of itself." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting foreign keys." + + + + + A string like "Values of incompatible types ('{1}' and '{2}') were assigned to the '{0}' discriminator column. Values of the same type must be specified. To explicitly specify the type of the discriminator column use the HasColumnType method." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting mapping information." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting cascade delete operations using 'WillCascadeOnDelete'." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting multiplicities." + + + + + A string like "The MaxLengthAttribute on property '{0}' on type '{1} is not valid. The Length value must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "The StringLengthAttribute on property '{0}' on type '{1}' is not valid. The maximum length must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "Unable to determine composite primary key ordering for type '{0}'. Use the ColumnAttribute or the HasKey method to specify an order for composite primary keys." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. Name must not be empty." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The foreign key name '{2}' was not found on the dependent type '{3}'. The Name value should be a comma separated list of foreign key property names." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The navigation property '{2}' was not found on the dependent type '{1}'. The Name value should be a valid navigation property name." + + + + + A string like "Unable to determine a composite foreign key ordering for foreign key on type {0}. When using the ForeignKey data annotation on composite foreign key properties ensure order is specified by using the Column data annotation or the fluent API." + + + + + A string like "The InversePropertyAttribute on property '{2}' on type '{3}' is not valid. The property '{0}' is not a valid navigation property on the related type '{1}'. Ensure that the property exists and is a valid reference or collection navigation property." + + + + + A string like "A relationship cannot be established from property '{0}' on type '{1}' to property '{0}' on type '{1}'. Check the values in the InversePropertyAttribute to ensure relationship definitions are unique and reference from one navigation property to its corresponding inverse navigation property." + + + + + A string like "\t{0}: {1}: {2}" + + + + + A string like "A key is registered for the derived type '{0}'. Keys can only be registered for the root type '{1}'." + + + + + A string like "The {0} value '{1}' already exists in the user-defined dictionary." + + + + + A string like "The type '{0}' has already been mapped to table '{1}'. Specify all mapping aspects of a table in a single Map call." + + + + + A string like "Map was called more than once for type '{0}' and at least one of the calls didn't specify the target table name." + + + + + A string like "The derived type '{0}' has already been mapped using the chaining syntax. A derived type can only be mapped once using the chaining syntax." + + + + + A string like "An "is not null" condition cannot be specified on property '{0}' on type '{1}' because this property is not included in the model. Check that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation." + + + + + A string like "Values of type '{0}' cannot be used as type discriminator values. Supported types include byte, signed byte, bool, int16, int32, int64, and string." + + + + + A string like "Unable to add the convention '{0}'. Could not find an existing convention of type '{1}' in the current convention set." + + + + + A string like "Not all properties for type '{0}' have been mapped. Either map those properties or explicitly excluded them from the model." + + + + + A string like "Unable to determine the provider name for connection of type '{0}'." + + + + + A string like "The qualified table name '{0}' contains an invalid schema name. Schema names must have a non-zero length." + + + + + A string like "The qualified table name '{0}' contains an invalid table name. Table names must have a non-zero length." + + + + + A string like "Properties for type '{0}' can only be mapped once. Ensure the MapInheritedProperties method is only used during one call to the Map method." + + + + + A string like "Properties for type '{0}' can only be mapped once. Ensure the Properties method is used and that repeated calls specify each non-key property only once." + + + + + A string like "Properties for type '{0}' can only be mapped once. The non-key property '{1}' is mapped more than once. Ensure the Properties method specifies each non-key property only once." + + + + + A string like "The property '{1}' on type '{0}' cannot be mapped because it has been explicitly excluded from the model or it is of a type not supported by the DbModelBuilderVersion being used." + + + + + A string like "The entity types '{0}' and '{1}' cannot share table '{2}' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them." + + + + + A string like "You cannot use Ignore method on the property '{0}' on type '{1}' because this type inherits from the type '{2}' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type." + + + + + A string like "The property '{0}' cannot be used as a key property on the entity '{1}' because the property type is not a valid key type. Only scalar types, string and byte[] are supported key types." + + + + + A string like "The specified table '{0}' was not found in the model. Ensure that the table name has been correctly specified." + + + + + A string like "The specified association foreign key columns '{0}' are invalid. The number of columns specified must match the number of primary key columns." + + + + + A string like "Unable to determine the principal end of an association between the types '{0}' and '{1}'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." + + + + + A string like "The abstract type '{0}' has no mapped descendents and so cannot be mapped. Either remove '{0}' from the model or add one or more types deriving from '{0}' to the model. " + + + + + A string like "The type '{0}' cannot be mapped as defined because it maps inherited properties from types that use entity splitting or another form of inheritance. Either choose a different inheritance mapping strategy so as to not map inherited properties, or change all types in the hierarchy to map inherited properties and to not use splitting. " + + + + + A string like "The table '{0}' was configured but is not used in any mappings. Verify the mapping configuration for '{0}' is correct." + + + + + A string like "The configured column orders for the table '{0}' contains duplicates. Ensure the specified column order values are distinct." + + + + + A string like "The enum or spatial property '{1}' on type '{0}' cannot be mapped. Use DbModelBuilderVersion 'V5_0' or later to map enum or spatial properties." + + + + + A string like "Multiple potential primary key properties named '{0}' but differing only by case were found on entity type '{1}'. Configure the primary key explicitly using the HasKey fluent API or the KeyAttribute data annotation." + + + + + A string like "Cannot get value for property '{0}' from entity of type '{1}' because the property has no get accessor." + + + + + A string like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor." + + + + + + A string like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor and is in the '{2}' state." + + + + + A string like "Member '{0}' cannot be called for property '{1}' on entity of type '{2}' because the property is not part of the Entity Data Model." + + + + + + A string like "Cannot call the {0} method for an entity of type '{1}' on a DbSet for entities of type '{2}'. Only entities of type '{2}' or derived from type '{2}' can be added, attached, or removed." + + + + + A string like "Cannot call the Create method for the type '{0}' on a DbSet for entities of type '{1}'. Only entities of type '{1}' or derived from type '{1}' can be created." + + + + + + + A string like "The property '{0}' on type '{1}' is a collection navigation property. The Collection method should be used instead of the Reference method." + + + + + A string like "The property '{0}' on type '{1}' is a reference navigation property. The Reference method should be used instead of the Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a navigation property. The Reference and Collection methods can only be used with navigation properties. Use the Property or ComplexProperty method." + + + + + A string like "The property '{0}' on type '{1}' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a complex property. The ComplexProperty method can only be used with complex properties. Use the Property, Reference or Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a primitive property, complex property, collection navigation property, or reference navigation property." + + + + + A string like ""The property '{0}' from the property path '{1}' is not a complex property on type '{2}'. Property paths must be composed of complex properties for all except the final property."" + + + + + A string like ""The property path '{0}' cannot be used for navigation properties. Property paths can only be used to access primitive or complex properties."" + + + + + A string like "The navigation property '{0}' on entity type '{1}' cannot be used for entities of type '{2}' because it refers to entities of type '{3}'." + + + + + A string like "The generic type argument '{0}' cannot be used with the Member method when accessing the collection navigation property '{1}' on entity type '{2}'. The generic type argument '{3}' must be used instead." + + + + + A string like "The property '{0}' on entity type '{1}' cannot be used for objects of type '{2}' because it is a property for objects of type '{3}'." + + + + + A string like "The expression passed to method {0} must represent a property defined on the type '{1}'." + + + + + A string like "{0} cannot be used for entities in the {1} state." + + + + + A string like "Cannot set non-nullable property '{0}' of type '{1}' to null on object of type '{2}'." + + + + + A string like "The property '{0}' in the entity of type '{1}' is null. Store values cannot be obtained for an entity with a null complex property." + + + + + A string like "Cannot assign value of type '{0}' to property '{1}' of type '{2}' in property values for type '{3}'." + + + + + A string like "The '{0}' property does not exist or is not mapped for the type '{1}'." + + + + + A string like "Cannot copy values from DbPropertyValues for type '{0}' into DbPropertyValues for type '{1}'." + + + + + A string like "Cannot copy from property values for object of type '{0}' into property values for object of type '{1}'." + + + + + A string like "The value of the complex property '{0}' on entity of type '{1}' is null. Complex properties cannot be set to null and values cannot be set for null complex properties." + + + + + A string like "The value of the nested property values property '{0}' on the values for entity of type '{1}' is null. Nested property values cannot be set to null and values cannot be set for null complex properties." + + + + + A string like "Cannot set the value of the nested property '{0}' because value of the complex property '{1}' to which it belongs is null." + + + + + A string like "Cannot set the original value of the nested property '{0}' because the original value of the complex property '{1}' to which it belongs is null." + + + + + A string like "The model backing the '{0}' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)." + + + + + A string like "Database '{0}' cannot be created because it already exists." + + + + + + + A string like "Failed to set database initializer of type '{0}' for DbContext type '{1}' specified in the application configuration. See inner exception for details." + + + + + A string like "Configuration for DbContext type '{0}' is specified multiple times in the application configuration. Each context can only be configured once." + + + + + A string like "Failed to set Database.DefaultConnectionFactory to an instance of the '{0}' type as specified in the application configuration. See inner exception for details." + + + + + A string like "The type '{0}' could not be found. The type name must be an assembly-qualified name." + + + + + A string like "The connection string '{0}' in the application's configuration file does not contain the required providerName attribute."" + + + + + A string like "The entity found was of type {0} when an entity of type {1} was requested." + + + + + A string like "The type '{0}' is mapped as a complex type. The Set method, DbSet objects, and DbEntityEntry objects can only be used with entity types, not complex types." + + + + + A string like "The type '{0}' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute." + + + + + A string like "The entity type {0} is not part of the model for the current context." + + + + + A string like "No connection string named '{0}' could be found in the application config file." + + + + + A string like "The collection navigation property '{0}' on the entity of type '{1}' cannot be set because the entity type does not define a navigation property with a set accessor." + + + + + A string like "Multiple object sets per type are not supported. The object sets '{0}' and '{1}' can both contain instances of type '{2}'." + + + + + A string like "The context type '{0}' must have a public constructor taking an EntityConnection." + + + + + A string like "An unexpected exception was thrown during validation of '{0}' when invoking {1}.IsValid. See the inner exception for details." + + + + + A string like "An unexpected exception was thrown during validation of '{0}' when invoking {1}.Validate. See the inner exception for details." + + + + + A string like "The database name '{0}' is not supported because it is an MDF file name. A full connection string must be provided to attach an MDF file." + + + + + A string like "The context factory type '{0}' must have a public default constructor." + + + + + A string like "The '{0}' property of EdmPrimitiveType is fixed and cannot be set." + + + + + A string like "The namespace '{0}' is a system namespace and cannot be used by other schemas. Choose another namespace name." + + + + + A string like "Role '{0}' in AssociationSets '{1}' and '{2}' refers to the same EntitySet '{3}' in EntityContainer '{4}'. Make sure that if two or more AssociationSets refer to the same AssociationType, the ends do not refer to the same EntitySet." + + + + + A string like "The referenced EntitySet '{0}' for End '{1}' could not be found in the containing EntityContainer." + + + + + A string like "Type '{0}' is derived from type '{1}' that is the type for EntitySet '{2}'. Type '{0}' defines new concurrency requirements that are not allowed for subtypes of base EntitySet types." + + + + + A string like "EntitySet '{0}' is based on type '{1}' that has no keys defined." + + + + + A string like "The end name '{0}' is already defined." + + + + + A string like "The key specified in EntityType '{0}' is not valid. Property '{1}' is referenced more than once in the Key element." + + + + + A string like "Property '{0}' has a CollectionKind specified but is not a collection property." + + + + + A string like "Property '{0}' has a CollectionKind specified. CollectionKind is only supported in version 1.1 EDM models." + + + + + A string like "ComplexType '{0}' is marked as abstract. Abstract ComplexTypes are only supported in version 1.1 EDM models." + + + + + A string like "ComplexType '{0}' has a BaseType specified. ComplexType inheritance is only supported in version 1.1 EDM models." + + + + + A string like "Key part '{0}' for type '{1}' is not valid. All parts of the key must be non-nullable." + + + + + A string like "The property '{0}' in EntityType '{1}' is not valid. All properties that are part of the EntityKey must be of PrimitiveType." + + + + + A string like "Key usage is not valid. The {0} class cannot define keys because one of its base classes ('{1}') defines keys." + + + + + A string like "EntityType '{0}' has no key defined. Define the key for this EntityType." + + + + + A string like "NavigationProperty is not valid. Role '{0}' or Role '{1}' is not defined in Relationship '{2}'." + + + + + A string like "End '{0}' on relationship '{1}' cannot have an operation specified because its multiplicity is '*'. Operations cannot be specified on ends with multiplicity '*'." + + + + + A string like "Each Name and PluralName in a relationship must be unique. '{0}' is already defined." + + + + + A string like "In relationship '{0}', the Principal and Dependent Role of the referential constraint refer to the same Role in the relationship type." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Valid values for multiplicity for the Principal Role are '0..1' or '1'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because all the properties in the Dependent Role are nullable, multiplicity of the Principal Role must be '0..1'." + + + + + A string like "Multiplicity conflicts with the referential constraint in Role '{0}' in relationship '{1}'. Because at least one of the properties in the Dependent Role is non-nullable, multiplicity of the Principal Role must be '1'." + + + + + A string like "Multiplicity conflicts with the referential constraint in Role '{0}' in relationship '{1}'. Because all of the properties in the Dependent Role are non-nullable, multiplicity of the Principal Role must be '1'." + + + + + A string like "Properties referred by the Dependent Role '{0}' must be a subset of the key of the EntityType '{1}' referred to by the Dependent Role in the referential constraint for relationship '{2}'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because the Dependent Role refers to the key properties, the upper bound of the multiplicity of the Dependent Role must be '1'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because the Dependent Role properties are not the key properties, the upper bound of the multiplicity of the Dependent Role must be '*'." + + + + + A string like "The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property '{0}' on entity '{1}' does not match the type of property '{2}' on entity '{3}' in the referential constraint '{4}'." + + + + + A string like "There is no property with name '{0}' defined in the type referred to by Role '{1}'." + + + + + A string like "A nullable ComplexType is not supported. Property '{0}' must not allow nulls." + + + + + A string like "A property cannot be of type '{0}'. The property type must be a ComplexType or a PrimitiveType." + + + + + A string like "Each member name in an EntityContainer must be unique. A member with name '{0}' is already defined." + + + + + A string like "Each type name in a schema must be unique. Type name '{0}' is already defined." + + + + + A string like "Name '{0}' cannot be used in type '{1}'. Member names cannot be the same as their enclosing type." + + + + + A string like "Each property name in a type must be unique. Property name '{0}' is already defined." + + + + + A string like "A cycle was detected in the type hierarchy of '{0}'." + + + + + A string like "A property cannot be of type '{0}'. The property type must be a ComplexType, a PrimitiveType, or a CollectionType." + + + + + A string like "A property cannot be of type {0}. The property type must be a ComplexType, a PrimitiveType or an EnumType." + + + + + A string like "The specified name must not be longer than 480 characters: '{0}'." + + + + + A string like "The specified name is not allowed: '{0}'." + + + + + A string like "The field {0} must be a string or array type with a maximum length of '{1}'." + + + + + A string like "The field {0} must be a string or array type with a minimum length of '{1}'." + + + + + A string like "No connection string named '{0}' could be found in the application config file." + + + + + A string like "AutomaticMigration" + + + + + A string like "BootstrapMigration" + + + + + A string like "InitialCreate" + + + + + A string like "Automatic migration was not applied because it would result in data loss." + + + + + A string like "[Inserting migration history record]" + + + + + A string like "[Deleting migration history record]" + + + + + A string like "[Updating EdmMetadata model hash]" + + + + + A string like "Running Seed method." + + + + + A string like "No pending code-based migrations." + + + + + A string like "Explicit" + + + + + A string like "Upgrading history table." + + + + + A string like "Cannot scaffold the next migration because the target database was created with a version of Code First earlier than EF 4.3 and does not contain the migrations history table. To start using migrations against this database, ensure the current model is compatible with the target database and execute the migrations Update process. (In Visual Studio you can use the Update-Database command from Package Manager Console to execute the migrations Update process)." + + + + + A string like "Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration." + + + + + A string like "Scripting the downgrade between two specified migrations is not supported." + + + + + A string like "Direct column renaming is not supported by SQL Server Compact. To rename a column in SQL Server Compact, you will need to recreate it." + + + + + A string like "One or more validation errors were detected during model generation:" + + + + + A string like "A circular ComplexType hierarchy was detected. Self-referencing ComplexTypes are not supported." + + + + + A string like "Connection to the database failed. The connection string is configured with an invalid LocalDB server name. This may have been set in 'global.asax' by a pre-release version of MVC4. The default connection factory is now set in web.config so the line in 'global.asax' starting with 'Database.DefaultConnectionFactory = ' should be removed. See http://go.microsoft.com/fwlink/?LinkId=243166 for details." + + + + + A string like "An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct." + + + + + A string like "Setting IsModified to false for a modified property is not supported." + + + + + A string like "An error occurred while saving entities that do not expose foreign key properties for their relationships. The EntityEntries property will return null because a single entity cannot be identified as the source of the exception. Handling of exceptions while saving can be made easier by exposing foreign key properties in your entity types. See the InnerException for details." + + + + + A string like "The set of property value names is read-only." + + + + + A string like "A property of a complex type must be set to an instance of the generic or non-generic DbPropertyValues class for that type." + + + + + A string like "Model compatibility cannot be checked because the DbContext instance was not created using Code First patterns. DbContext instances created from an ObjectContext or using an EDMX file cannot be checked for compatibility." + + + + + A string like "Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions." + + + + + A string like "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations." + + + + + A string like "The context cannot be used while the model is being created." + + + + + A string like "The DbContext class cannot be used with models that have multiple entity sets per type (MEST)." + + + + + A string like "The operation cannot be completed because the DbContext has been disposed." + + + + + A string like "The provider factory returned a null connection." + + + + + A string like "The DbConnectionFactory instance returned a null connection." + + + + + A string like "The number of primary key values passed must match number of primary key values defined on the entity." + + + + + A string like "The type of one of the primary key values did not match the type defined in the entity. See inner exception for details." + + + + + A string like "Multiple entities were found in the Added state that match the given primary key values." + + + + + A string like "Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList()." + + + + + A string like "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties." + + + + + A string like "Cannot initialize a DbContext from an entity connection string or an EntityConnection instance together with a DbCompiledModel. If an entity connection string or EntityConnection instance is used, then the model will be created from the metadata in the connection. If a DbCompiledModel is used, then the connection supplied should be a standard database connection (for example, a SqlConnection instance) rather than an entity connection." + + + + + A string like "Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used." + + + + + A string like "Validation failed for one or more entities. See 'EntityValidationErrors' property for more details." + + + + + A string like "An exception occurred while initializing the database. See the InnerException for details." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing ObjectContext is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing DbCompiledModel is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Code generated using the T4 templates for Database First and Model First development may not work correctly if used in Code First mode. To continue using Database First or Model First ensure that the Entity Framework connection string is specified in the config file of executing application. To use these classes, that were generated from Database First or Model First, with Code First add any additional configuration using attributes or the DbModelBuilder API and then remove the code that throws this exception." + + + + + A string like "The generic 'Set' method cannot be called with a proxy type. Either use the actual entity type or call the non-generic 'Set' method." + + + + + A string like "NavigationProperty is not valid. The FromRole and ToRole are the same." + + + + + A string like "OnDelete can be specified on only one End of an EdmAssociation." + + + + + A string like "The number of properties in the Dependent and Principal Roles in a relationship constraint must be identical." + + + + + A string like "The name is missing or not valid." + + + + + A string like "AssociationEnd must not be null." + + + + + A string like "DependentEnd must not be null." + + + + + A string like "DependentProperties must not be empty." + + + + + A string like "Association must not be null." + + + + + A string like "ResultEnd must not be null." + + + + + A string like "EntityType must not be null." + + + + + A string like "ElementType must not be null." + + + + + A string like "ElementType must not be null." + + + + + A string like "SourceSet must not be null." + + + + + A string like "TargetSet must not be null." + + + + + A string like "The type is not a valid EdmTypeReference." + + + + + A string like "Serializer can only serialize an EdmModel that has one EdmNamespace and one EdmEntityContainer." + + + + + A string like "MaxLengthAttribute must have a Length value that is greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "MinLengthAttribute must have a Length value that is zero or greater." + + + + + A string like "The connection can not be overridden because this context was created from an existing ObjectContext." + + + + + A string like "Can not override the connection for this context with a standard DbConnection because the original connection was an EntityConnection." + + + + + A string like "Can not override the connection for this context with an EntityConnection because the original connection was a standard DbConnection." + + + + + Strongly-typed and parameterized exception factory. + + + + + Migrations.Infrastructure.AutomaticDataLossException with message like "Automatic migration was not applied because it would result in data loss." + + + + + Migrations.Infrastructure.MigrationsException with message like "Cannot scaffold the next migration because the target database was created with a version of Code First earlier than EF 4.3 and does not contain the migrations history table. To start using migrations against this database, ensure the current model is compatible with the target database and execute the migrations Update process. (In Visual Studio you can use the Update-Database command from Package Manager Console to execute the migrations Update process)." + + + + + Migrations.Infrastructure.MigrationsException with message like "The specified target migration '{0}' does not exist. Ensure that target migration refers to an existing migration id." + + + + + Migrations.Infrastructure.MigrationsException with message like "The Foreign Key on table '{0}' with columns '{1}' could not be created because the principal key columns could not be determined. Use the AddForeignKey fluent API to fully specify the Foreign Key." + + + + + Migrations.Infrastructure.MigrationsException with message like "'{0}' is not a valid target migration. When targeting a previously applied automatic migration, use the full migration id including timestamp." + + + + + Migrations.Infrastructure.MigrationsException with message like "'{0}' is not a valid migration. Code-based migrations must be used for both source and target when scripting the upgrade between them." + + + + + Migrations.Infrastructure.MigrationsException with message like "The target context '{0}' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory." + + + + + Migrations.Infrastructure.MigrationsException with message like "The specified migration name '{0}' is ambiguous. Specify the full migration id including timestamp instead." + + + + + Migrations.Infrastructure.AutomaticMigrationsDisabledException with message like "Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration." + + + + + Migrations.Infrastructure.MigrationsException with message like "Scripting the downgrade between two specified migrations is not supported." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' was not be found in the assembly '{1}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one migrations configuration type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the one to use." + + + + + Migrations.Infrastructure.MigrationsException with message like "No migrations configuration type was found in the assembly '{0}'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one migrations configuration type was found in the assembly '{0}'. Specify the name of the one to use." + + + + + Migrations.Infrastructure.MigrationsException with message like "The type '{0}' is not a migrations configuration type." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must have a public default constructor." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must not be abstract." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must not be generic." + + + + + Migrations.Infrastructure.MigrationsException with message like "Direct column renaming is not supported by SQL Server Compact. To rename a column in SQL Server Compact, you will need to recreate it." + + + + + Migrations.Infrastructure.MigrationsException with message like "In VB.NET projects, the migrations namespace '{0}' must be under the root namespace '{1}'. Update the migrations project's root namespace to allow classes under the migrations namespace to be added." + + + + + + Migrations.Infrastructure.MigrationsException with message like "No MigrationSqlGenerator found for provider '{0}'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators." + + + + + Migrations.Infrastructure.MigrationsException with message like "No context type was found in the assembly '{0}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "The context type '{0}' was not found in the assembly '{1}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one context type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the context." + + + + + ArgumentException with message like "The argument '{0}' cannot be null, empty or contain only white space." + + + + + ArgumentException with message like "The argument property '{0}' cannot be null." + + + + + ArgumentException with message like "The precondition '{0}' failed. {1}" + + + + + InvalidOperationException with message like "The type '{0}' has already been configured as a complex type. It cannot be reconfigured as an entity type." + + + + + InvalidOperationException with message like "The type '{0}' has already been configured as an entity type. It cannot be reconfigured as a complex type." + + + + + InvalidOperationException with message like "The key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + InvalidOperationException with message like "The foreign key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + InvalidOperationException with message like "The property '{0}' is not a declared property on type '{1}'. Verify that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property." + + + + + InvalidOperationException with message like "The navigation property '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property." + + + + + InvalidOperationException with message like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'." + + + + + InvalidOperationException with message like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. Use dotted paths for nested properties: C#: 't => t.MyProperty.MyProperty' VB.Net: 'Function(t) t.MyProperty.MyProperty'." + + + + + InvalidOperationException with message like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + InvalidOperationException with message like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + + InvalidOperationException with message like "Conflicting configuration settings were specified for property '{0}' on type '{1}': {2}" + + + + + InvalidOperationException with message like "Conflicting configuration settings were specified for column '{0}' on table '{1}': {2}" + + + + + InvalidOperationException with message like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from ComplexObject." + + + + + InvalidOperationException with message like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' cannot be the inverse of itself." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting foreign keys." + + + + + MappingException with message like "Values of incompatible types ('{1}' and '{2}') were assigned to the '{0}' discriminator column. Values of the same type must be specified. To explicitly specify the type of the discriminator column use the HasColumnType method." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting mapping information." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting cascade delete operations using 'WillCascadeOnDelete'." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting multiplicities." + + + + + InvalidOperationException with message like "The MaxLengthAttribute on property '{0}' on type '{1} is not valid. The Length value must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "The StringLengthAttribute on property '{0}' on type '{1}' is not valid. The maximum length must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "Unable to determine composite primary key ordering for type '{0}'. Use the ColumnAttribute or the HasKey method to specify an order for composite primary keys." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. Name must not be empty." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The foreign key name '{2}' was not found on the dependent type '{3}'. The Name value should be a comma separated list of foreign key property names." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The navigation property '{2}' was not found on the dependent type '{1}'. The Name value should be a valid navigation property name." + + + + + InvalidOperationException with message like "Unable to determine a composite foreign key ordering for foreign key on type {0}. When using the ForeignKey data annotation on composite foreign key properties ensure order is specified by using the Column data annotation or the fluent API." + + + + + InvalidOperationException with message like "The InversePropertyAttribute on property '{2}' on type '{3}' is not valid. The property '{0}' is not a valid navigation property on the related type '{1}'. Ensure that the property exists and is a valid reference or collection navigation property." + + + + + InvalidOperationException with message like "A relationship cannot be established from property '{0}' on type '{1}' to property '{0}' on type '{1}'. Check the values in the InversePropertyAttribute to ensure relationship definitions are unique and reference from one navigation property to its corresponding inverse navigation property." + + + + + InvalidOperationException with message like "A key is registered for the derived type '{0}'. Keys can only be registered for the root type '{1}'." + + + + + InvalidOperationException with message like "The type '{0}' has already been mapped to table '{1}'. Specify all mapping aspects of a table in a single Map call." + + + + + InvalidOperationException with message like "Map was called more than once for type '{0}' and at least one of the calls didn't specify the target table name." + + + + + InvalidOperationException with message like "The derived type '{0}' has already been mapped using the chaining syntax. A derived type can only be mapped once using the chaining syntax." + + + + + InvalidOperationException with message like "An "is not null" condition cannot be specified on property '{0}' on type '{1}' because this property is not included in the model. Check that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation." + + + + + ArgumentException with message like "Values of type '{0}' cannot be used as type discriminator values. Supported types include byte, signed byte, bool, int16, int32, int64, and string." + + + + + InvalidOperationException with message like "Unable to add the convention '{0}'. Could not find an existing convention of type '{1}' in the current convention set." + + + + + InvalidOperationException with message like "Not all properties for type '{0}' have been mapped. Either map those properties or explicitly excluded them from the model." + + + + + NotSupportedException with message like "Unable to determine the provider name for connection of type '{0}'." + + + + + ArgumentException with message like "The qualified table name '{0}' contains an invalid schema name. Schema names must have a non-zero length." + + + + + ArgumentException with message like "The qualified table name '{0}' contains an invalid table name. Table names must have a non-zero length." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. Ensure the MapInheritedProperties method is only used during one call to the Map method." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. Ensure the Properties method is used and that repeated calls specify each non-key property only once." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. The non-key property '{1}' is mapped more than once. Ensure the Properties method specifies each non-key property only once." + + + + + InvalidOperationException with message like "The property '{1}' on type '{0}' cannot be mapped because it has been explicitly excluded from the model or it is of a type not supported by the DbModelBuilderVersion being used." + + + + + InvalidOperationException with message like "The entity types '{0}' and '{1}' cannot share table '{2}' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them." + + + + + InvalidOperationException with message like "You cannot use Ignore method on the property '{0}' on type '{1}' because this type inherits from the type '{2}' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type." + + + + + InvalidOperationException with message like "The property '{0}' cannot be used as a key property on the entity '{1}' because the property type is not a valid key type. Only scalar types, string and byte[] are supported key types." + + + + + InvalidOperationException with message like "The specified table '{0}' was not found in the model. Ensure that the table name has been correctly specified." + + + + + InvalidOperationException with message like "The specified association foreign key columns '{0}' are invalid. The number of columns specified must match the number of primary key columns." + + + + + InvalidOperationException with message like "A circular ComplexType hierarchy was detected. Self-referencing ComplexTypes are not supported." + + + + + InvalidOperationException with message like "Unable to determine the principal end of an association between the types '{0}' and '{1}'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." + + + + + InvalidOperationException with message like "The abstract type '{0}' has no mapped descendents and so cannot be mapped. Either remove '{0}' from the model or add one or more types deriving from '{0}' to the model. " + + + + + NotSupportedException with message like "The type '{0}' cannot be mapped as defined because it maps inherited properties from types that use entity splitting or another form of inheritance. Either choose a different inheritance mapping strategy so as to not map inherited properties, or change all types in the hierarchy to map inherited properties and to not use splitting. " + + + + + InvalidOperationException with message like "The table '{0}' was configured but is not used in any mappings. Verify the mapping configuration for '{0}' is correct." + + + + + InvalidOperationException with message like "The configured column orders for the table '{0}' contains duplicates. Ensure the specified column order values are distinct." + + + + + NotSupportedException with message like "The enum or spatial property '{1}' on type '{0}' cannot be mapped. Use DbModelBuilderVersion 'V5_0' or later to map enum or spatial properties." + + + + + InvalidOperationException with message like "Multiple potential primary key properties named '{0}' but differing only by case were found on entity type '{1}'. Configure the primary key explicitly using the HasKey fluent API or the KeyAttribute data annotation." + + + + + InvalidOperationException with message like "Cannot get value for property '{0}' from entity of type '{1}' because the property has no get accessor." + + + + + InvalidOperationException with message like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor." + + + + + + NotSupportedException with message like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor and is in the '{2}' state." + + + + + InvalidOperationException with message like "Member '{0}' cannot be called for property '{1}' on entity of type '{2}' because the property is not part of the Entity Data Model." + + + + + + ArgumentException with message like "Cannot call the {0} method for an entity of type '{1}' on a DbSet for entities of type '{2}'. Only entities of type '{2}' or derived from type '{2}' can be added, attached, or removed." + + + + + ArgumentException with message like "Cannot call the Create method for the type '{0}' on a DbSet for entities of type '{1}'. Only entities of type '{1}' or derived from type '{1}' can be created." + + + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is a collection navigation property. The Collection method should be used instead of the Reference method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is a reference navigation property. The Reference method should be used instead of the Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a navigation property. The Reference and Collection methods can only be used with navigation properties. Use the Property or ComplexProperty method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a complex property. The ComplexProperty method can only be used with complex properties. Use the Property, Reference or Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a primitive property, complex property, collection navigation property, or reference navigation property." + + + + + ArgumentException with message like ""The property '{0}' from the property path '{1}' is not a complex property on type '{2}'. Property paths must be composed of complex properties for all except the final property."" + + + + + NotSupportedException with message like "Setting IsModified to false for a modified property is not supported." + + + + + ArgumentException with message like ""The property path '{0}' cannot be used for navigation properties. Property paths can only be used to access primitive or complex properties."" + + + + + ArgumentException with message like "The navigation property '{0}' on entity type '{1}' cannot be used for entities of type '{2}' because it refers to entities of type '{3}'." + + + + + ArgumentException with message like "The generic type argument '{0}' cannot be used with the Member method when accessing the collection navigation property '{1}' on entity type '{2}'. The generic type argument '{3}' must be used instead." + + + + + ArgumentException with message like "The property '{0}' on entity type '{1}' cannot be used for objects of type '{2}' because it is a property for objects of type '{3}'." + + + + + ArgumentException with message like "The expression passed to method {0} must represent a property defined on the type '{1}'." + + + + + InvalidOperationException with message like "{0} cannot be used for entities in the {1} state." + + + + + InvalidOperationException with message like "Cannot set non-nullable property '{0}' of type '{1}' to null on object of type '{2}'." + + + + + InvalidOperationException with message like "The property '{0}' in the entity of type '{1}' is null. Store values cannot be obtained for an entity with a null complex property." + + + + + InvalidOperationException with message like "Cannot assign value of type '{0}' to property '{1}' of type '{2}' in property values for type '{3}'." + + + + + NotSupportedException with message like "The set of property value names is read-only." + + + + + ArgumentException with message like "The '{0}' property does not exist or is not mapped for the type '{1}'." + + + + + ArgumentException with message like "Cannot copy values from DbPropertyValues for type '{0}' into DbPropertyValues for type '{1}'." + + + + + ArgumentException with message like "Cannot copy from property values for object of type '{0}' into property values for object of type '{1}'." + + + + + ArgumentException with message like "A property of a complex type must be set to an instance of the generic or non-generic DbPropertyValues class for that type." + + + + + InvalidOperationException with message like "The value of the complex property '{0}' on entity of type '{1}' is null. Complex properties cannot be set to null and values cannot be set for null complex properties." + + + + + InvalidOperationException with message like "The value of the nested property values property '{0}' on the values for entity of type '{1}' is null. Nested property values cannot be set to null and values cannot be set for null complex properties." + + + + + InvalidOperationException with message like "Cannot set the value of the nested property '{0}' because value of the complex property '{1}' to which it belongs is null." + + + + + InvalidOperationException with message like "Cannot set the original value of the nested property '{0}' because the original value of the complex property '{1}' to which it belongs is null." + + + + + InvalidOperationException with message like "The model backing the '{0}' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)." + + + + + InvalidOperationException with message like "Database '{0}' cannot be created because it already exists." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the DbContext instance was not created using Code First patterns. DbContext instances created from an ObjectContext or using an EDMX file cannot be checked for compatibility." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations." + + + + + + + InvalidOperationException with message like "Failed to set database initializer of type '{0}' for DbContext type '{1}' specified in the application configuration. See inner exception for details." + + + + + InvalidOperationException with message like "Configuration for DbContext type '{0}' is specified multiple times in the application configuration. Each context can only be configured once." + + + + + InvalidOperationException with message like "Failed to set Database.DefaultConnectionFactory to an instance of the '{0}' type as specified in the application configuration. See inner exception for details." + + + + + InvalidOperationException with message like "The type '{0}' could not be found. The type name must be an assembly-qualified name." + + + + + InvalidOperationException with message like "The context cannot be used while the model is being created." + + + + + InvalidOperationException with message like "The DbContext class cannot be used with models that have multiple entity sets per type (MEST)." + + + + + InvalidOperationException with message like "The operation cannot be completed because the DbContext has been disposed." + + + + + InvalidOperationException with message like "The provider factory returned a null connection." + + + + + InvalidOperationException with message like "The connection string '{0}' in the application's configuration file does not contain the required providerName attribute."" + + + + + InvalidOperationException with message like "The DbConnectionFactory instance returned a null connection." + + + + + ArgumentException with message like "The number of primary key values passed must match number of primary key values defined on the entity." + + + + + ArgumentException with message like "The type of one of the primary key values did not match the type defined in the entity. See inner exception for details." + + + + + InvalidOperationException with message like "The entity found was of type {0} when an entity of type {1} was requested." + + + + + InvalidOperationException with message like "Multiple entities were found in the Added state that match the given primary key values." + + + + + InvalidOperationException with message like "The type '{0}' is mapped as a complex type. The Set method, DbSet objects, and DbEntityEntry objects can only be used with entity types, not complex types." + + + + + InvalidOperationException with message like "The type '{0}' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute." + + + + + InvalidOperationException with message like "The entity type {0} is not part of the model for the current context." + + + + + NotSupportedException with message like "Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList()." + + + + + ArgumentException with message like "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties." + + + + + InvalidOperationException with message like "No connection string named '{0}' could be found in the application config file." + + + + + InvalidOperationException with message like "Cannot initialize a DbContext from an entity connection string or an EntityConnection instance together with a DbCompiledModel. If an entity connection string or EntityConnection instance is used, then the model will be created from the metadata in the connection. If a DbCompiledModel is used, then the connection supplied should be a standard database connection (for example, a SqlConnection instance) rather than an entity connection." + + + + + NotSupportedException with message like "The collection navigation property '{0}' on the entity of type '{1}' cannot be set because the entity type does not define a navigation property with a set accessor." + + + + + NotSupportedException with message like "Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used." + + + + + InvalidOperationException with message like "Multiple object sets per type are not supported. The object sets '{0}' and '{1}' can both contain instances of type '{2}'." + + + + + InvalidOperationException with message like "The context type '{0}' must have a public constructor taking an EntityConnection." + + + + + NotSupportedException with message like "The database name '{0}' is not supported because it is an MDF file name. A full connection string must be provided to attach an MDF file." + + + + + DataException with message like "An exception occurred while initializing the database. See the InnerException for details." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing ObjectContext is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing DbCompiledModel is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + InvalidOperationException with message like "The context factory type '{0}' must have a public default constructor." + + + + + InvalidOperationException with message like "The generic 'Set' method cannot be called with a proxy type. Either use the actual entity type or call the non-generic 'Set' method." + + + + + InvalidOperationException with message like "MaxLengthAttribute must have a Length value that is greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "MinLengthAttribute must have a Length value that is zero or greater." + + + + + InvalidOperationException with message like "No connection string named '{0}' could be found in the application config file." + + + + + InvalidOperationException with message like "The connection can not be overridden because this context was created from an existing ObjectContext." + + + + + InvalidOperationException with message like "Can not override the connection for this context with a standard DbConnection because the original connection was an EntityConnection." + + + + + InvalidOperationException with message like "Can not override the connection for this context with an EntityConnection because the original connection was a standard DbConnection." + + + + + The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument. + + + + + The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method. + + + + + The exception that is thrown when the author has yet to implement the logic at this point in the program. This can act as an exception based TODO tag. + + + + + The exception that is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or write to a stream that does not support the invoked functionality. + + + + + AutoGenerated resource class. Usage: + + string s = EntityRes.GetString(EntityRes.MyIdenfitier); + + + + + Allows the construction and modification of a user-specified annotation (name-value pair) on a instance. + + + + + Gets or sets an optional namespace that can be used to distinguish the annotation from others with the same value. + + + + + Gets or sets the name of the annotation. + + + + + Gets or sets the value of the annotation. + + + + + + + + + DataModelEventArgs is the base argument type for all events raised by consumers of Entity Data Model (EDM) models. + + + + + Gets a value indicating the that caused the event to be raised. + + + + + Gets an optional value indicating which property of the source item caused the event to be raised. + + + + + Gets a value that identifies the specific error that is being raised. + + + + + Gets an optional descriptive message the describes the error that is being raised. + + + + + DbAliasedMetadataItem provides the base type for all Database Metadata types that can have an optional that should be used instead of the item's when referring to the item in the database. + + + + + NamedDbItem is the base for all types in the Database Metadata construction and modification API with a property. + + + + + The base for all all Database Metadata types that support annotation using . + + + + + DbDataModelItem is the base for all types in the Database Metadata construction and modification API. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets or sets the currently assigned name. + + + + + Gets an optional alternative identifier that should be used when referring to this item in the database. + + + + + When implemented in derived types, allows the construction and modification of a column in a Database Metadata table or row. + + + + + Gets or sets a string indicating the database-specific type of the column. + + + + + Gets or sets a value indicating whether the column is nullable. + + + + + Gets or sets an optional instance that applies additional constraints to the referenced database-specific type of the column. + + + + + Allows the construction and modification of a database in a Database Metadata model. + + + + + Gets or sets an optional value that indicates the database model version. + + + + + Gets or sets the collection of instances that specifies the schemas within the database. + + + + + Allows the construction and modification of a foreign key constraint sourced by a instance. + + + + + Gets or sets the to take when a delete operation is attempted. + + + + + Indicates which Database Metadata concept is represented by a given item. + + + + + Database Kind + + + + + Schema Kind + + + + + Foreign Key Constraint Kind + + + + + Function Kind + + + + + Function Parameter Kind + + + + + Function Return or Parameter Type Kind + + + + + Row Column Kind + + + + + Table Kind + + + + + Table Column Kind + + + + + Primitive Facets Kind + + + + + Specifies the action to take on a given operation. + + + + + Default behavior + + + + + Restrict the operation + + + + + Cascade the operation + + + + + Allows the construction and modification of additional constraints that can be applied to a specific use of a primitive type in a Database Metadata item. + + + + + Returns true if any facet value property currently has a non-null value; otherwise returns false . + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have a fixed or variable length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have its intrinsic maximum length, rather than a specific value. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to be Unicode or non-Unicode. + + + + + Gets or sets an optional value indicating the current constraint on the type's maximum length. + + + + + Gets or sets an optional value indicating the current constraint on the type's precision. + + + + + Gets or sets an optional value indicating the current constraint on the type's scale. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating whether the spatial type is to be type checked strictly. + + + + + Allows the construction and modification of a database schema in a database model. + + + + + Gets or sets the collection of instances that specifies the tables declared within the schema. + + + + + DbSchemaMetadataItem is the base for all types that can be contained in a schema. + + + + + Allows the construction and modification of a column in a table. + + + + + Gets or sets a value indicating whether the column is part of the table's primary key. + + + + + Gets or sets a value indicating if and how the value of the column is automatically generated. + + + + + Gets or sets an optional value indicating the collation specific to this table column. + + + + + Gets or sets an optional value that specifies the default value for the column. + + + + + Allows the construction and modification a table in a database schema. + + + + + Gets or sets the collection of instances that specifies the columns present within the table. + + + + + Gets or sets the collection of instances from the collection of the table that are part of the primary key. + + + + + Gets or sets the collection of instances that defines the foreign key constraints sourced from the table. + + + + + Represents a specific use of a type in a Database Metadata item. + + + + + Gets or sets an optional instance that applies additional constraints to a referenced primitive type. + + + Accessing this property forces the creation of a DbPrimitiveTypeFacets value if no value has previously been set. Use to determine whether or not this property currently has a value. + + + + + Gets or sets a value indicating whether the represented type is a collection type. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered nullable. + + + + + Gets a value indicating whether the type has been configured as a row type by the addition of one or more RowColumns. + + + + + Represents the mapping of an EDM association end ( ) as a collection of property mappings ( ). + + + + + DbMappingMetadataItem is the base for all types in the EDM-to-Database Mapping construction and modification API that support annotation using . + + + + + DbMappingModelItem is the base for all types in the EDM-to-Database Mapping construction and modification API. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets an value representing the association end that is being mapped. + + + + + Gets the collection of s that specifies how the association end key properties are mapped to the table. + + + + + Gets an value representing the association set that is being mapped. + + + + + Gets a value representing the table to which the entity type's properties are being mapped. + + + + + Gets the collection of s that specifies the constant or null values that columns in must have for this type mapping to apply. + + + + + Allows the construction and modification of a condition for a column in a database table. + + + + + Gets or sets a value representing the table column which must contain for this condition to hold. + + + + + Gets or sets the value that must contain for this condition to hold. + + + + + Gets or sets an value representing the model that is being mapped. + + + + + Gets or sets a value representing the database that is the target of the mapping. + + + + + Gets or sets the collection of s that specifies how the model's entity containers are mapped to the database. + + + + + Represents the mapping of an entity property to a column in a database table. + + + + + Gets or sets the collection of instances that defines the mapped property, beginning from a property declared by the mapped entity type and optionally proceeding through properties of complex property result types. + + + + + Gets or sets a value representing the table column to which the entity property is being mapped. + + + + + Allows the construction and modification of the mapping of an EDM entity container ( ) to a database ( ). + + + + + Gets or sets an value representing the entity container that is being mapped. + + + + + Gets or sets the collection of s that specifies how the container's entity sets are mapped to the database. + + + + + Gets the collection of s that specifies how the container's association sets are mapped to the database. + + + + + Allows the construction and modification of the mapping of an EDM entity set ( ) to a database ( ). + + + + + Gets or sets an value representing the entity set that is being mapped. + + + + + Gets or sets the collection of s that specifies how the set's entity types are mapped to the database. + + + + + Allows the construction and modification of a complete or partial mapping of an EDM entity type ( ) or type hierarchy to a specific database table ( ). + + + + + Gets or sets an value representing the entity type or hierarchy that is being mapped. + + + + + Gets or sets a value indicating whether this type mapping applies to and all its direct or indirect subtypes ( true ), or only to ( false ). + + + + + Gets a value representing the table to which the entity type's properties are being mapped. + + + + + Gets the collection of s that specifies how the type's properties are mapped to the table. + + + + + Gets the collection of s that specifies the constant or null values that columns in must have for this type mapping fragment to apply. + + + + + Indicates which EDM-to-Database Mapping concept is represented by a given item. + + + + + Database Mapping Kind + + + + + Entity Container Mapping Kind + + + + + Entity Set Mapping Kind + + + + + Association Set Mapping Kind + + + + + Entity Type Mapping Kind + + + + + Query View Mapping Kind + + + + + Entity Type Mapping Fragment Kind + + + + + Edm Property Mapping Kind + + + + + Association End Mapping Kind + + + + + Column Condition Kind + + + + + Property Condition Kind + + + + + Allows the construction and modification of a constraint applied to an Entity Data Model (EDM) association. + + + + + Gets or sets the that represents the 'dependent' end of the constraint; properties from this association end's entity type contribute to the collection. + + + + + Gets or sets the collection of instances from the of the constraint. The values of these properties are constrained against the primary key values of the remaining, 'principal' association end's entity type. + + + + + Allows the construction and modification of one end of an Entity Data Model (EDM) association. + + + + + Gets or sets the entity type referenced by this association end. + + + + + Gets or sets the of this association end, which indicates the multiplicity of the end and whether or not it is required. + + + + + Gets or sets the to take when a delete operation is attempted. + + + + + Indicates the multiplicity of an and whether or not it is required. + + + + + Allows the construction and modification of an association set in an Entity Data Model (EDM) ). + + + + + Represents an item in an Entity Data Model (EDM) . + + + + + Gets or sets the that specifies the association type for the set. + + + + + Gets or sets the that specifies the entity set corresponding to the association end for this association set. + + + + + Gets or sets the that specifies the entity set corresponding to the association end for this association set. + + + + + + The base for all all Entity Data Model (EDM) types that represent a structured type from the EDM type system. + + + + + Gets or sets the that defines the source end of the association. + + + + + Gets or sets the that defines the target end of the association. + + + + + Gets or sets the optional constraint that indicates whether the relationship is an independent association (no constraint present) or a foreign key relationship ( specified). + + + + + Collection semantics for properties. + + + + + The property does not have a collection type or does not specify explicit collection semantics. + + + + + The property is an unordered collection that may contain duplicates. + + + + + The property is an ordered collection that may contain duplicates. + + + + + Allows the construction and modification of a complex type in an Entity Data Model (EDM) . + + + + + Gets or sets the optional that indicates the base complex type of the complex type. + + + + + Gets or sets a value indicating whether the complex type is abstract. + + + + + Gets or sets the collection of instances that describe the (scalar or complex) properties of the complex type. + + + + + Concurrency mode for properties. + + + + + Default concurrency mode: the property is never validated at write time + + + + + Fixed concurrency mode: the property is always validated at write time + + + + + Allows the construction and modification of an entity container in an Entity Data Model (EDM) . + + + + + Gets all s declared within the namspace. Includes s and s. + + + + + Gets or sets the collection of s that specifies the association sets within the container. + + + + + Gets or sets the collection of s that specifies the entity sets within the container. + + + + + Allows the construction and modification of an entity set in an Entity Data Model (EDM) . + + + + + Gets or sets the that specifies the entity type for the set. + + + + + Allows the construction and modification of an entity type in an Entity Data Model (EDM) . + + + + + Gets or sets the optional that indicates the base entity type of the entity type. + + + + + Gets or sets a value indicating whether the entity type is abstract. + + + + + Gets or sets the collection of s that specifies the properties declared by the entity type. + + + + + Gets or sets the collection of s that indicates which properties from the collection are part of the entity key. + + + + + Gets or sets the optional collection of s that specifies the navigation properties declared by the entity type. + + + + + Indicates which Entity Data Model (EDM) concept is represented by a given item. + + + + + Association End Kind + + + + + Association Set Kind + + + + + Association Type Kind + + + + + Collection Type Kind + + + + + Complex Type Kind + + + + + Entity Container Kind + + + + + Entity Set Kind + + + + + Entity Type Kind + + + + + Function Group Kind + + + + + Function Overload Kind + + + + + Function Import Kind + + + + + Function Parameter Kind + + + + + Navigation Property Kind + + + + + EdmProperty Type Kind + + + + + Association Constraint Type Kind + + + + + Ref Type Kind + + + + + Row Column Kind + + + + + Row Type Kind + + + + + Type Reference Kind + + + + + Model Kind + + + + + Namespace Kind + + + + + Primitive Facets Kind + + + + + Primitive Type Kind + + + + + Enum Type Kind + + + + + Enum Type Member Kind + + + + + EdmModel is the top-level container for namespaces and entity containers belonging to the same logical Entity Data Model (EDM) model. + + + + + Gets or sets an optional value that indicates the entity model version. + + + + + Gets or sets the containers declared within the model. + + + + + Gets or sets the namespaces declared within the model. + + + + + Allows the construction and modification of a namespace in an . + + + + + Gets all s declared within the namspace. Includes s, s, s. + + + + + Gets or sets the s declared within the namespace. + + + + + Gets or sets the s declared within the namespace. + + + + + Gets or sets the s declared within the namespace. + + + + + Allows the construction and modification of an Entity Data Model (EDM) navigation property. + + + + + Gets or sets the that specifies the association over which navigation takes place. + + + + + Gets or sets the that specifies which association end is the 'destination' end of the navigation and produces the navigation property result. + + + + + Specifies the action to take on a given operation. + + + + + Default behavior + + + + + Restrict the operation + + + + + Cascade the operation + + + + + Represents one of the fixed set of Entity Data Model (EDM) primitive types. + + + + + The base for all all Entity Data Model (EDM) types that represent a scalar type from the EDM type system. + + + + + Retrieves the EdmPrimitiveType instance with the corresponding to the specified value, if any. + + The name of the primitive type instance to retrieve + The EdmPrimitiveType with the specified name, if successful; otherwise null . + true if the given name corresponds to an EDM primitive type name; otherwise false . + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets an value that indicates which Entity Data Model (EDM) primitive type this type represents. + + + + + Allows the construction and modification of additional constraints that can be applied to a specific use of a primitive type in an Entity Data Model (EDM) item. See . + + + + + Returns true if any facet value property currently has a non-null value; otherwise returns false . + + + + + Gets or sets an optional value indicating the current constraint on the type's maximum length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have its intrinsic maximum length, rather than a specific value. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have a fixed or variable length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to be Unicode or non-Unicode. + + + + + Gets or sets an optional value indicating the current constraint on the type's precision. + + + + + Gets or sets an optional value indicating the current constraint on the type's scale. + + + + + Gets or sets an optional value indicating that the current spatial type's SRID is unconstrained. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating whether the spatial type is to be type checked strictly. + + + + + Primitive Types as defined by the Entity Data Model (EDM). + + + + + Binary Type Kind + + + + + Boolean Type Kind + + + + + Byte Type Kind + + + + + DateTime Type Kind + + + + + Decimal Type Kind + + + + + Double Type Kind + + + + + Guid Type Kind + + + + + Single Type Kind + + + + + SByte Type Kind + + + + + Int16 Type Kind + + + + + Int32 Type Kind + + + + + Int64 Type Kind + + + + + String Type Kind + + + + + Time Type Kind + + + + + DateTimeOffset Type Kind + + + + + Geometry Type Kind + + + + + Geography Type Kind + + + + + Geometric point type kind + + + + + Geometric linestring type kind + + + + + Geometric polygon type kind + + + + + Geometric multi-point type kind + + + + + Geometric multi-linestring type kind + + + + + Geometric multi-polygon type kind + + + + + Geometric collection type kind + + + + + Geographic point type kind + + + + + Geographic linestring type kind + + + + + Geographic polygon type kind + + + + + Geographic multi-point type kind + + + + + Geographic multi-linestring type kind + + + + + Geographic multi-polygon type kind + + + + + Geographic collection type kind + + + + + Allows the construction and modification of a primitive- or complex-valued property of an Entity Data Model (EDM) entity or complex type. + + + + + Gets or sets an value that indicates which collection semantics - if any - apply to the property. + + + + + Gets or sets a value that indicates whether the property is used for concurrency validation. + + + + + Gets or sets on optional value that indicates an initial default value for the property. + + + + + Gets or sets an that specifies the result type of the property. + + + + + Enumerates all s declared or inherited by an . + + + + + Allows the construction and modification of a specific use of a type in an Entity Data Model (EDM) item. See for examples. + + + + + Gets or sets a value indicating the collection rank of the type reference. A collection rank greater than zero indicates that the type reference represents a collection of its referenced . + + + + + Gets or sets a value indicating the referenced by this type reference. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered nullable. + + + + + Gets or sets an optional instance that applies additional constraints to a referenced primitive type. + + + Accessing this property forces the creation of an EdmPrimitiveTypeFacets value if no value has previously been set. Use to determine whether or not this property currently has a value. + + + + + Gets a value indicating whether the property of this type reference has been assigned an value with at least one facet value specified. + + + + + Indicates whether this type reference represents a collection of its referenced (when is greater than zero) or not. + + + + + Indicates whether the property of this type reference currently refers to an , is not a collection type, and does not have primitive facet values specified. + + + + + Gets the currently referred to by this type reference, or null if the type reference is a collection type or does not refer to a complex type. + + + + + Indicates whether the property of this type reference currently refers to an and is not a collection type. + + + + + Gets the currently referred to by this type reference, or null if the type reference is a collection type or does not refer to a primitive type. + + + + + Contains constant values that apply to the EDM model, regardless of source (for CSDL specific constants see ). + + + + + Parsing code taken from System.dll's System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(string) method to avoid LinkDemand needed to call this method + + + + + + + + + + + Constants for CSDL XML. + + + + + Constants for C-S MSL XML. + + + + + Constants for SSDL XML. + + + + + The acceptable range for this enum is 0000 - 0999; the range 10,000-15,000 is reserved for tools. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Precision out of range + + + + + Scale out of range + + + + + + + + + + + + + One of the required facets is missing + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The facet isn't allow by the property type. + + + + + This facet value is constant and is specified in the schema + + + + + + + + + + + + + Multiplicity value was malformed + + + + + The value for the Action attribute is invalid or not allowed in the current context + + + + + An error occurred processing the On<Operation> elements + + + + + Ends were given for the Property element of a EntityContainer that is not a RelationshipSet + + + + + The extent name used in the EntittyContainerType End does not match the name of any of the EntityContainerProperties in the containing EntityContainer + + + + + An end element was not given, and cannot be inferred because too many EntityContainerEntitySet elements that are good possibilities. + + + + + An end element was not given, and cannot be inferred because there is no EntityContainerEntitySets that are the correct type to be used as an EntitySet. + + + + + Not a valid parameter direction for the parameter in a function + + + + + Unable to infer an optional schema part, to resolve this; be more explicit + + + + + Invalid facet attribute(s) specified in provider manifest + + + + + Invalid role value in the relationship constraint + + + + + Invalid Property in relationship constraint + + + + + Type mismatch between ToProperty and FromProperty in the relationship constraint + + + + + Invalid multiplicity in FromRole in the relationship constraint + + + + + The number of properties in the FromProperty and ToProperty in the relationship constraint must be identical + + + + + No Properties defined in either FromProperty or ToProperty in the relationship constraint + + + + + Missing constraint in relationship type in ssdl + + + + + Same role referred in the ToRole and FromRole of a referential constraint + + + + + Invalid value for attribute ParameterTypeSemantics + + + + + Invalid type used for a Relationship End Type + + + + + Invalid PrimitiveTypeKind + + + + + Invalid TypeConversion DestinationType + + + + + Expected a integer value between 0 - 255 + + + + + Invalid Type specified in function + + + + + Precision must not be greater than 28 + + + + + Properties that are part of entity key must be of scalar type + + + + + Binary type properties which are part of entity key are currently not supported + + + + + The primitive type kind does not have a preferred mapping + + + + + More than one PreferredMapping for a PrimitiveTypeKind + + + + + End with * multiplicity cannot have operations specified + + + + + EntitySet type has no keys + + + + + InvalidNumberOfParametersForAggregateFunction + + + + + InvalidParameterTypeForAggregateFunction + + + + + Composable functions must declare a return type. + + + + + Non-composable functions must not declare a return type. + + + + + Non-composable functions do not permit the aggregate; niladic; or built-in attributes. + + + + + Composable functions can not include command text attribute. + + + + + Functions should not declare both a store name and command text (only one or the other can be used). + + + + + SystemNamespace + + + + + Empty DefiningQuery text + + + + + Schema, Table and DefiningQuery are all specified, and are mutually exclusive + + + + + ConcurrencyMode value was malformed + + + + + Concurrency can't change for any sub types of an EntitySet type. + + + + + Function import return type must be either empty, a collection of entities, or a singleton scalar. + + + + + Function import specifies a non-existent entity set. + + + + + Function import specifies entity type return but no entity set. + + + + + Function import specifies entity type that does not derive from element type of entity set. + + + + + Function import specifies a binding to an entity set but does not return entities. + + + + + InternalError + + + + + Same Entity Set Taking part in the same role of the relationship set in two different relationship sets + + + + + Entity key refers to the same property twice + + + + + Function declares a ReturnType attribute and element + + + + + Nullable Complex Type not supported in Edm V1 + + + + + Only Complex Collections supported in Edm V1.1 + + + + + No Key defined on Entity Type + + + + + Invalid namespace specified in using element + + + + + Need not specify system namespace in using + + + + + Cannot use a reserved/system namespace as alias + + + + + Invalid qualification specified for type + + + + + Invalid Entity Container Name in extends attribute + + + + + Invalid CollectionKind value in property CollectionKind attribute + + + + + Must specify namespace or alias of the schema in which this type is defined + + + + + Entity Container cannot extend itself + + + + + Failed to retrieve provider manifest + + + + + Mismatched Provider Manifest token values in SSDL artifacts + + + + + Missing Provider Manifest token value in SSDL artifact(s) + + + + + Empty CommandText element + + + + + Inconsistent Provider values in SSDL artifacts + + + + + Inconsistent Provider Manifest token values in SSDL artifacts + + + + + Duplicated Function overloads + + + + + InvalidProvider + + + + + FunctionWithNonEdmTypeNotSupported + + + + + ComplexTypeAsReturnTypeAndDefinedEntitySet + + + + + ComplexTypeAsReturnTypeAndDefinedEntitySet + + + + unused 179, + unused 180, + unused 181, + + In model functions facet attribute is allowed only on ScalarTypes + + + + + Captures several conditions where facets are placed on element where it should not exist. + + + + + Return type has not been declared + + + + + Invalid value in the EnumTypeOption + + + + + The structural annotation cannot use codegen namespaces + + + + + Function and type cannot have the same fully qualified name + + + + + Cannot load different version of schema in the same ItemCollection + + + + + Expected bool value + + + + + End without Multiplicity specified + + + + + In SSDL, if composable function returns a collection of rows (TVF), all row properties must be of scalar types. + + + + + The name of NamedEdmItem must not be empty or white space only + + + + + EdmTypeReference is empty + + Unused 199; + + + + Serializes an that conforms to the restrictions of a single CSDL schema file to an XML writer. The model to be serialized must contain a single and a single . + + + + + Serialize the to the XmlWriter. + + The EdmModel to serialize, mut have only one and one + The XmlWriter to serialize to + + + + Serialize the to the XmlWriter + + The DbModel to serialize + The XmlWriter to serialize to + + + + Serialize the to the + + The DbDatabaseMetadata to serialize + Provider information on the Schema element + ProviderManifestToken information on the Schema element + The XmlWriter to serialize to + + + + + author/email + + + + + author/name + + + + + author/uri + + + + + published + + + + + rights + + + + + summary + + + + + title + + + + + contributor/email + + + + + contributor/name + + + + + contributor/uri + + + + + category/@label + + + + + Plaintext + + + + + HTML + + + + + XHTML + + + + + updated + + + + + link/@href + + + + + link/@rel + + + + + link/@type + + + + + link/@hreflang + + + + + link/@title + + + + + link/@length + + + + + category/@term + + + + + category/@scheme + + + + + Return role name pair + + + + + + + + The context for DataModel Validation + + + + + Returns true if the given two ends are similar - the relationship type that this ends belongs to is the same and the entity set refered by the ends are same and they are from the same role + + + + + + + + Return true if the Referential Constraint on the association is ready for further validation, otherwise return false. + + + + + + + Resolves the given property names to the property in the item Also checks whether the properties form the key for the given type and whether all the properties are nullable or not + + + + + + + + + + + Return true if the namespaceName is a Edm System Namespace + + + + + + + Return true if the entityType is a subtype of any entity type in the dictionary keys, and return the corresponding entry EntitySet value. Otherwise return false. + + + + + + + + + Return true if any of the properties in the EdmEntityType defines ConcurrencyMode. Otherwise return false. + + + + + + + Add member name to the Hash set, raise an error if the name exists already. + + + + + + + + + If the string is null, empty, or only whitespace, return false, otherwise return true + + + + + + + Determine if a cycle exists in the type hierarchy: use two pointers to walk the chain, if one catches up with the other, we have a cycle. + + true if a cycle exists in the type hierarchy, false otherwise + + + + RuleSet for DataModel Validation + + + + + Get the related rules given certain DataModelItem + + The to validate + A collection of + + + + Data Model Validator + + + + + Validate the and all of its properties given certain version. + + The root of the model to be validated + True to validate the syntax, otherwise false + + + + The RuleSet for EdmModel + + + + + Get based on version + + a double value of version + + + + + The context for EdmModel Validation + + + + + Visitor for EdmModel Validation + + + + + Edm Model Validator + + + + + validate the from the root with the context + + The root to validate from + The validation context + + + + An implementation of IDatabaseInitializer that will recreate and optionally re-seed the + database only if the database does not exist. + To seed the database, create a derived class and override the Seed method. + + The type of the context. + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + An instances of this class is obtained from an object and can be used + to manage the actual database backing a DbContext or connection. + This includes creating, deleting, and checking for the existence of a database. + Note that deletion and checking for existence of a database can be performed using just a + connection (i.e. without a full context) by using the static methods of this class. + + + + + Creates a Database backed by the given context. This object can be used to create a database, + check for database existence, and delete a database. + + The context that defines the database connection and model. + + + + Gets or sets the database initialization strategy. The database initialization strategy is called when instance + is initialized from a . The strategy can optionally check for database existence, create a new database, and + seed the database with data. + The default strategy is an instance of . + + The type of the context. + The strategy. + The database creation strategy. + + + + Internal version of SetInitializer that allows the strategy to be locked such that it cannot be replaced + by another call to SetInitializer. This allows strategies set in the app.config to win over strategies set + in code. + + The type of the context. + The strategy. + if set to true then the strategy is locked. + + + + Runs the the registered on this context. + + If "force" is set to true, then the initializer is run regardless of whether or not it + has been run before. This can be useful if a database is deleted while an app is running + and needs to be reinitialized. + + If "force" is set to false, then the initializer is only run if it has not already been + run for this context, model, and connection in this app domain. This method is typically + used when it is necessary to ensure that the database has been created and seeded + before starting some operation where doing so lazily will cause issues, such as when the + operation is part of a transaction. + + if set to true the initializer is run even if it has already been run. + + + + Checks whether or not the database is compatible with the the current Code First model. + + + Model compatibility currently uses the following rules. + + If the context was created using either the Model First or Database First approach then the + model is assumed to be compatible with the database and this method returns true. + + For Code First the model is considered compatible if the model is stored in the database + in the Migrations history table and that model has no differences from the current model as + determined by Migrations model differ. + + If the model is not stored in the database but an EF 4.1/4.2 model hash is found instead, + then this is used to check for compatibility. + + + If set to true then an exception will be thrown if no model metadata is found in + the database. If set to false then this method will return true if metadata + is not found. + + True if the model hash in the context and the database match; false otherwise. + + + + + Creates a new database on the database server for the model defined in the backing context. + Note that calling this method before the database initialization strategy has run will disable + executing that strategy. + + + + + Creates a new database on the database server for the model defined in the backing context, but only + if a database with the same name does not already exist on the server. + + True if the database did not exist and was created; false otherwise. + + + + Checks whether or not the database exists on the server. + + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + Calling this method from outside of an initializer will mark the database as having + not been initialized. This means that if an attempt is made to use the database again + after it has been deleted, then any initializer set will run again and, usually, will + try to create the database again automatically. + + True if the database did exist and was deleted; false otherwise. + + + + Checks whether or not the database exists on the server. + The connection to the database is created using the given database name or connection string + in the same way as is described in the documentation for the class. + + The database name or a connection string to the database. + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + The connection to the database is created using the given database name or connection string + in the same way as is described in the documentation for the class. + + The database name or a connection string to the database. + True if the database did exist and was deleted; false otherwise. + + + + Checks whether or not the database exists on the server. + + An existing connection to the database. + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + + An existing connection to the database. + True if the database did exist and was deleted; false otherwise. + + + + Resets the DefaultConnectionFactory to its initial value. + Currently, this method is only used by test code. + + + + + Performs the operation defined by the given delegate using the given lazy connection, ensuring + that the lazy connection is disposed after use. + + Information used to create a DbConnection. + The operation to perform. + The return value of the operation. + + + + Performs the operation defined by the given delegate against a connection. The connection + is either the connection accessed from the context backing this object, or is obtained from + the connection information passed to one of the static methods. + + The connection to use. + The operation to perform. + The return value of the operation. + + + + Returns an empty ObjectContext that can be used to perform delete/exists operations. + + The connection for which to create an ObjectContext + The empty context. + + + + Creates a raw SQL query that will return elements of the given generic type. + The type can be any type that has properties that match the names of the columns returned + from the query, or can be a simple primitive type. The type does not have to be an + entity type. The results of this query are never tracked by the context even if the + type of object returned is an entity type. Use the + method to return entities that are tracked by the context. + + The type of object returned by the query. + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Creates a raw SQL query that will return elements of the given type. + The type can be any type that has properties that match the names of the columns returned + from the query, or can be a simple primitive type. The type does not have to be an + entity type. The results of this query are never tracked by the context even if the + type of object returned is an entity type. Use the + method to return entities that are tracked by the context. + + The type of object returned by the query. + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Executes the given DDL/DML command against the database. + + The command string. + The parameters to apply to the command string. + The result returned by the database after executing the command. + + + + Returns the connection being used by this context. This may cause the + connection to be created if it does not already exist. + + Thrown if the context has been disposed. + + + + Returns the as a delegate that can be called with + an instance of the that owns this Database object, or returns null if + there is no initializer set for this context type. + + The initializer delegate or null. + + + + The connection factory to use when creating a from just + a database name or a connection string. + + + This is used when just a database name or connection string is given to or when + the no database name or connection is given to DbContext in which case the name of + the context class is passed to this factory in order to generate a DbConnection. + By default, the instance to use is read from the applications .config + file from the "EntityFramework DefaultConnectionFactory" entry in appSettings. If no entry is found in + the config file then is used. Setting this property in code + always overrides whatever value is found in the config file. + + + + + Checks wether or not the DefaultConnectionFactory has been set to something other than its default value. + + + + + + + Common code for generic and non-generic string Include. + + + + + + Returns a new query where the entities returned will not be cached in the + or . This method works by calling the AsNoTracking method of the + underlying query object. If the underlying query object does not have a AsNoTracking method, + then calling this method will have no affect. + + The element type. + The source query. + A new query with NoTracking applied, or the source query if NoTracking is not supported. + + + + Returns a new query where the entities returned will not be cached in the + or . This method works by calling the AsNoTracking method of the + underlying query object. If the underlying query object does not have a AsNoTracking method, + then calling this method will have no affect. + + The source query. + A new query with NoTracking applied, or the source query if NoTracking is not supported. + + + + Common code for generic and non-generic AsNoTracking. + + + + + Enumerates the query such that for server queries such as those of , , + , and others the results of the query will be loaded into the associated , + or other cache on the client. + This is equivalent to calling ToList and then throwing away the list without the overhead of actually creating the list. + + The source query. + + + + Returns an implementation that stays in sync with the given . + + The element type. + The collection that the binding list will stay in sync with. + The binding list. + + + + DbModelBuilder is used to map CLR classes to a database schema. + This code centric approach to building an Entity Data Model (EDM) model is known as 'Code First'. + + + DbModelBuilder is typically used to configure a model by overriding . + You can also use DbModelBuilder independently of DbContext to build a model and then construct a + or . + The recommended approach, however, is to use OnModelCreating in as + the workflow is more intuitive and takes care of common tasks, such as caching the created model. + + Types that form your model are registered with DbModelBuilder and optional configuration can be + performed by applying data annotations to your classes and/or using the fluent style DbModelBuilder + API. + + When the Build method is called a set of conventions are run to discover the initial model. + These conventions will automatically discover aspects of the model, such as primary keys, and + will also process any data annotations that were specified on your classes. Finally + any configuration that was performed using the DbModelBuilder API is applied. + + Configuration done via the DbModelBuilder API takes precedence over data annotations which + in turn take precedence over the default conventions. + + + + + Initializes a new instance of the class. + + The process of discovering the initial model will use the set of conventions included + in the most recent version of the Entity Framework installed on your machine. + + + Upgrading to newer versions of the Entity Framework may cause breaking changes + in your application because new conventions may cause the initial model to be + configured differently. There is an alternate constructor that allows a specific + version of conventions to be specified. + + + + + Initializes a new instance of the class that will use + a specific set of conventions to discover the initial model. + + The version of conventions to be used. + + + + Excludes a type from the model. This is used to remove types from the model that were added + by convention during initial model discovery. + + The type to be excluded. + The same DbModelBuilder instance so that multiple calls can be chained. + + + + Excludes a type(s) from the model. This is used to remove types from the model that were added + by convention during initial model discovery. + + The types to be excluded from the model. + The same DbModelBuilder instance so that multiple calls can be chained. + + + + Registers an entity type as part of the model and returns an object that can be used to + configure the entity. This method can be called multiple times for the same entity to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified entity type. + + + + Registers a type as an entity in the model and returns an object that can be used to + configure the entity. This method can be called multiple times for the same type to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified entity type. + + + + Registers a type as a complex type in the model and returns an object that can be used to + configure the complex type. This method can be called multiple times for the same type to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified complex type. + + + + Creates a based on the configuration performed using this builder. + The connection is used to determine the database provider being used as this + affects the database layer of the generated model. + + Connection to use to determine provider information. + The model that was built. + + + + Creates a based on the configuration performed using this builder. + Provider information must be specified because this affects the database layer of the generated model. + For SqlClient the invariant name is 'System.Data.SqlClient' and the manifest token is the version year (i.e. '2005', '2008' etc.) + + The database provider that the model will be used with. + The model that was built. + + + + Provides access to the settings of this DbModelBuilder that deal with conventions. + + + + + Gets the for this DbModelBuilder. + The registrar allows derived entity and complex type configurations to be registered with this builder. + + + + + A value from this enumeration can be provided directly to the + class or can be used in the applied to + a class derived from . The value used defines which version of + the DbContext and DbModelBuilder conventions should be used when building a model from + code--also know as "Code First". + + + Using DbModelBuilderVersion.Latest ensures that all the latest functionality is available + when upgrading to a new release of the Entity Framework. However, it may result in an + application behaving differently with the new release than it did with a previous release. + This can be avoided by using a specific version of the conventions, but if a version + other than the latest is set then not all the latest functionality will be available. + + + + + Indicates that the latest version of the and + conventions should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 4.1 + through 4.3 should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 5.0 + when targeting .NET 4 should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 5.0 + when targeting .NET 4.5 should be used. + + + + + This attribute can be applied to a class derived from to set which + version of the DbContext and conventions should be used when building + a model from code--also know as "Code First". See the + enumeration for details about DbModelBuilder versions. + + + If the attribute is missing from DbContextthen DbContext will always use the latest + version of the conventions. This is equivalent to using DbModelBuilderVersion.Latest. + + + + + Initializes a new instance of the class. + + The conventions version to use. + + + + Gets the conventions version. + + The conventions version. + + + + A non-generic version of which can be used when the type of entity + is not known at build time. + + + + + Represents a non-generic LINQ to Entities query against a DbContext. + + + + + An internal interface implemented by and that allows access to + the internal query without using reflection. + + + + + The underlying internal set. + + + + + Internal constructor prevents external classes deriving from DbQuery. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + Instead populate a DbSet with data, for example by using the Load extension method, and + then bind to local data. For WPF bind to DbSet.Local. For Windows Forms bind to + DbSet.Local.ToBindingList(). + + + Never returns; always throws. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Returns the equivalent generic object. + + The type of element for which the query was created. + The generic set object. + + + + Returns a representation of the underlying query. + + + The query string. + + + + + Returns false. + + false. + + + + The IQueryable element type. + + + + + The IQueryable LINQ Expression. + + + + + The IQueryable provider. + + + + + Gets the underlying internal query object. + + The internal query. + + + + The internal query object that is backing this DbQuery + + + + + An internal interface implemented by and that allows access to + the internal set without using reflection. + + + + + The underlying internal set. + + + + + Internal constructor prevents external classes deriving from DbSet. + + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Returns the equivalent generic object. + + The type of entity for which the set was created. + The generic set object. + + + + Creates a raw SQL query that will return entities in this set. By default, the + entities returned are tracked by the context; this can be changed by calling + AsNoTracking on the returned. + Note that the entities returned are always of the type for this set and never of + a derived type. If the table or tables queried may contain data for other entity + types, then the SQL query must be written appropriately to ensure that only entities of + the correct type are returned. + + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + The internal IQueryable that is backing this DbQuery + + + + + Gets the underlying internal set. + + The internal set. + + + + A DbSet represents the collection of all entities in the context, or that can be queried from the + database, of a given type. DbSet objects are created from a DbContext using the DbContext.Set method. + + + Note that DbSet does not support MEST (Multiple Entity Sets per Type) meaning that there is always a + one-to-one correlation between a type and a set. + + The type that defines the set. + + + + Represents a LINQ to Entities query against a DbContext. + + The type of entity to query for. + + + + Creates a new query that will be backed by the given internal query object. + + The backing query. + + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Throws an exception indicating that binding directly to a store query is not supported. + Instead populate a DbSet with data, for example by using the Load extension method, and + then bind to local data. For WPF bind to DbSet.Local. For Windows Forms bind to + DbSet.Local.ToBindingList(). + + + Never returns; always throws. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Returns a representation of the underlying query. + + + The query string. + + + + + Returns a new instance of the non-generic class for this query. + + A non-generic version. + + + + Returns false. + + false. + + + + The IQueryable element type. + + + + + The IQueryable LINQ Expression. + + + + + The IQueryable provider. + + + + + The internal query object that is backing this DbQuery + + + + + The internal query object that is backing this DbQuery + + + + + An IDbSet represents the collection of all entities in the context, or that can be queried from the + database, of a given type. DbSet is a concrete implementation of IDbSet. + + The type that defines the set. + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + Creates a new set that will be backed by the given . + + The internal set. + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Returns the equivalent non-generic object. + + The non-generic set object. + + + + Creates a raw SQL query that will return entities in this set. By default, the + entities returned are tracked by the context; this can be changed by calling + AsNoTracking on the returned. + Note that the entities returned are always of the type for this set and never of + a derived type. If the table or tables queried may contain data for other entity + types, then the SQL query must be written appropriately to ensure that only entities of + the correct type are returned. + + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + The internal IQueryable that is backing this DbQuery + + + + + An implementation of IDatabaseInitializer that will always recreate and optionally re-seed the + database the first time that a context is used in the app domain. + To seed the database, create a derived class and override the Seed method. + + The type of the context. + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + An implementation of IDatabaseInitializer that will DELETE, recreate, and optionally re-seed the + database only if the model has changed since the database was created. + + + Whether or not the model has changed is determined by the + method. + To seed the database create a derived class and override the Seed method. + + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + Returned by the ChangeTracker method of to provide access to features of + the context that are related to change tracking of entities. + + + + + Initializes a new instance of the class. + + The internal context. + + + + Gets objects for all the entities tracked by this context. + + The entries. + + + + Gets objects for all the entities of the given type + tracked by this context. + + The type of the entity. + The entries. + + + + Detects changes made to the properties and relationships of POCO entities. Note that some types of + entity (such as change tracking proxies and entities that derive from ) + report changes automatically and a call to DetectChanges is not normally needed for these types of entities. + Also note that normally DetectChanges is called automatically by many of the methods of + and its related classes such that it is rare that this method will need to be called explicitly. + However, it may be desirable, usually for performance reasons, to turn off this automatic calling of + DetectChanges using the AutoDetectChangesEnabled flag from . + + + + + A non-generic version of the class. + + + + + This is an abstract base class use to represent a scalar or complex property, or a navigation property + of an entity. Scalar and complex properties use the derived class , + reference navigation properties use the derived class , and collection + navigation properties use the derived class . + + + + + Creates a from information in the given . + This method will create an instance of the appropriate subclass depending on the metadata contained + in the InternalMemberEntry instance. + + The internal member entry. + The new entry. + + + + Validates this property. + + + Collection of objects. Never null. If the entity is valid the collection will be empty. + + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the name of the property. + + The property name. + + + + Gets or sets the current value of this property. + + The current value. + + + + The to which this member belongs. + + An entry for the entity that owns this member. + + + + Gets the backing this object. + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal collection entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the collection of entities from the database. + Note that entities that already exist in the context are not overwritten with values from the database. + + + + + Returns the query that would be used to load this collection from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database, such + as counting the number of entities in the collection in the database without actually loading them. + + A query for the collection. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the collection element. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the collection of entities has been loaded from the database. + + true if the collection is loaded; otherwise, false. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Gets the backing this object as an . + + The internal member entry. + + + + Instances of this class are returned from the Collection method of + and allow operations such as loading to + be performed on the an entity's collection navigation properties. + + The type of the entity to which this property belongs. + The type of the element in the collection of entities. + + + + This is an abstract base class use to represent a scalar or complex property, or a navigation property + of an entity. Scalar and complex properties use the derived class , + reference navigation properties use the derived class , and collection + navigation properties use the derived class . + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + This method will create an instance of the appropriate subclass depending on the metadata contained + in the InternalMemberEntry instance. + + The internal member entry. + The new entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Validates this property. + + + Collection of objects. Never null. If the entity is valid the collection will be empty. + + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets the underlying . + + The internal member entry. + + + + The to which this member belongs. + + An entry for the entity that owns this member. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal collection entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the collection of entities from the database. + Note that entities that already exist in the context are not overwritten with values from the database. + + + + + Returns the query that would be used to load this collection from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database, such + as counting the number of entities in the collection in the database without actually loading them. + + A query for the collection. + + + + Returns a new instance of the non-generic class for + the navigation property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the collection of entities has been loaded from the database. + + true if the collection is loaded; otherwise, false. + + + + Gets the underlying as an . + + The internal member entry. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + An immutable representation of an Entity Data Model (EDM) model that can be used to create an + or can be passed to the constructor of a . + For increased performance, instances of this type should be cached and re-used to construct contexts. + + + + + For mocking. + + + + + Creates a model for the given EDM metadata model. + + The EDM metadata model. + + + + Creates an instance of ObjectContext or class derived from ObjectContext. Note that an instance + of DbContext can be created instead by using the appropriate DbContext constructor. + If a derived ObjectContext is used, then it must have a public constructor with a single + EntityConnection parameter. + The connection passed is used by the ObjectContext created, but is not owned by the context. The caller + must dispose of the connection once the context has been disposed. + + The type of context to create. + An existing connection to a database for use by the context. + + + + + Gets a cached delegate (or creates a new one) used to call the constructor for the given derived ObjectContext type. + + + + + A snapshot of the that was used to create this compiled model. + + + + + The provider info (provider name and manifest token) that was used to create this model. + + + + + A non-generic version of the class. + + + + + A non-generic version of the class. + + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the original value of this property. + + The original value. + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets or sets a value indicating whether the value of this property has been modified since + it was loaded from the database. + + + true if this instance is modified; otherwise, false. + + + + + The to which this property belongs. + + An entry for the entity that owns this property. + + + + The of the property for which this is a nested property. + This method will only return a non-null entry for properties of complex objects; it will + return null for properties of the entity itself. + + An entry for the parent complex property, or null if this is an entity property. + + + + Gets the backing this object. + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The name of the nested property. + An object representing the nested property. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the complex property. + The equivalent generic object. + + + + Instances of this class are returned from the ComplexProperty method of + and allow access to the state of a complex property. + + The type of the entity to which this property belongs. + The type of the property. + + + + Instances of this class are returned from the Property method of + and allow access to the state of the scalar + or complex property. + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the original value of this property. + + The original value. + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets or sets a value indicating whether the value of this property has been modified since + it was loaded from the database. + + + true if this instance is modified; otherwise, false. + + + + + The to which this property belongs. + + An entry for the entity that owns this property. + + + + The of the property for which this is a nested property. + This method will only return a non-null entry for properties of complex objects; it will + return null for properties of the entity itself. + + An entry for the parent complex property, or null if this is an entity property. + + + + Gets the underlying as an . + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The type of the nested property. + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The type of the nested property. + An expression representing the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The type of the nested property. + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The type of the nested property. + An expression representing the nested property. + An object representing the nested property. + + + + Describes the origin of the database connection string associated with a . + + + + + The connection string was created by convention. + + + + + The connection string was read from external configuration. + + + + + The connection string was explicitly specified at runtime. + + + + + The connection string was overriden by connection information supplied to DbContextInfo. + + + + + Returned by the Configuration method of to provide access to configuration + options for the context. + + + + + Initializes a new instance of the class. + + The internal context. + + + + Gets or sets a value indicating whether lazy loading of relationships exposed as + navigation properties is enabled. Lazy loading is enabled by default. + + true if lazy loading is enabled; otherwise, false. + + + + Gets or sets a value indicating whether or not the framework will create instances of + dynamically generated proxy classes whenever it creates an instance of an entity type. + Note that even if proxy creation is enabled with this flag, proxy instances will only + be created for entity types that meet the requirements for being proxied. + Proxy creation is enabled by default. + + true if proxy creation is enabled; otherwise, false. + + + + + Gets or sets a value indicating whether tracked entities should be validated automatically when + is invoked. + The default value is true. + + + + + Provides runtime information about a given type. + + + + + Creates a new instance representing a given type. + + The type deriving from . + + + + Creates a new instance representing a given targeting a specific database. + + The type deriving from . + Connection information for the database to be used. + + + + Creates a new instance representing a given type. An external list of + connection strings can be supplied and will be used during connection string resolution in place + of any connection strings specified in external configuration files. + + + It is preferable to use the constructor that accepts the entire config document instead of using this + constructor. Providing the entire config document allows DefaultConnectionFactroy entries in the config + to be found in addition to explicitly specified connection strings. + + The type deriving from . + A collection of connection strings. + + + + Creates a new instance representing a given type. An external config + object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + + The type deriving from . + An object representing the config file. + + + + Creates a new instance representing a given , targeting a specific database. + An external config object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + + The type deriving from . + An object representing the config file. + Connection information for the database to be used. + + + + Creates a new instance representing a given type. A + can be supplied in order to override the default determined provider used when constructing + the underlying EDM model. + + The type deriving from . + A specifying the underlying ADO.NET provider to target. + + + + Creates a new instance representing a given type. An external config + object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + A can be supplied in order to override the default determined + provider used when constructing the underlying EDM model. This can be useful to prevent EF from + connecting to discover a manifest token. + + The type deriving from . + An object representing the config file. + A specifying the underlying ADO.NET provider to target. + + + + Called internally when a context info is needed for an existing context, which may not be constructable. + + The context instance to get info from. + + + + If instances of the underlying type can be created, returns + a new instance; otherwise returns null. + + A instance. + + + + The concrete type. + + + + + Whether or not instances of the underlying type can be created. + + + + + The connection string used by the underlying type. + + + + + The connection string name used by the underlying type. + + + + + The ADO.NET provider name of the connection used by the underlying type. + + + + + The origin of the connection string used by the underlying type. + + + + + An action to be run on the DbModelBuilder after OnModelCreating has been run on the context. + + + + + A non-generic version of the class. + + + + + Initializes a new instance of the class. + + The internal entry. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + Note that changing the values in the returned dictionary will not update the values in the database. + If the entity is not found in the database then null is returned. + + The store values. + + + + Reloads the entity from the database overwriting any property values with values from the database. + The entity will be in the Unchanged state after calling this method. + + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The name of the property. + An object representing the property. + + + + Gets an object that represents a complex property of this entity. + + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The name of the member. + An object representing the member. + + + + Returns a new instance of the generic class for the given + generic type for the tracked entity represented by this object. + Note that the type of the tracked entity must be compatible with the generic type or + an exception will be thrown. + + The type of the entity. + A generic version. + + + + Validates this instance and returns validation result. + + + Entity validation result. Possibly null if + method is overridden. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the entity. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + + The original values. + + + + Gets InternalEntityEntry object for this DbEntityEntry instance. + + + + + Instances of this class provide access to information about and control of entities that + are being tracked by the . Use the Entity or Entities methods of + the context to obtain objects of this type. + + The type of the entity. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + Note that changing the values in the returned dictionary will not update the values in the database. + If the entity is not found in the database then null is returned. + + The store values. + + + + Reloads the entity from the database overwriting any property values with values from the database. + The entity will be in the Unchanged state after calling this method. + + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The type of the property. + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The type of the property. + An expression representing the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The type of elements in the collection. + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The type of elements in the collection. + An expression representing the navigation property. + An object representing the navigation property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The name of the property. + An object representing the property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The type of the property. + The name of the property. + An object representing the property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The type of the property. + An expression representing the property. + An object representing the property. + + + + Gets an object that represents a complex property of this entity. + + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a complex property of this entity. + + The type of the complex property. + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a complex property of this entity. + + The type of the complex property. + An expression representing the complex property. + An object representing the complex property. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The name of the member. + An object representing the member. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The type of the member. + The name of the member. + An object representing the member. + + + + Returns a new instance of the non-generic class for + the tracked entity represented by this object. + + A non-generic version. + + + + Validates this instance and returns validation result. + + + Entity validation result. Possibly null if + method is overridden. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the entity. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + + The original values. + + + + Represents an Entity Data Model (EDM) created by the . + The Compile method can be used to go from this EDM representation to a + which is a compiled snapshot of the model suitable for caching and creation of + or instances. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + Creates a for this mode which is a compiled snapshot + suitable for caching and creation of instances. + + The compiled model. + + + + A snapshot of the that was used to create this compiled model. + + + + + A collection of all the properties for an underlying entity or complex object. + + + An instance of this class can be converted to an instance of the generic class + using the Cast method. + Complex properties in the underlying entity or complex object are represented in + the property values as nested instances of this class. + + + + + Initializes a new instance of the class. + + The internal dictionary. + + + + Creates an object of the underlying type for this dictionary and hydrates it with property + values from this dictionary. + + The properties of this dictionary copied into a new object. + + + + Sets the values of this dictionary by reading values out of the given object. + The given object can be of any type. Any property on the object with a name that + matches a property name in the dictionary and can be read will be read. Other + properties will be ignored. This allows, for example, copying of properties from + simple Data Transfer Objects (DTOs). + + The object to read values from. + + + + Creates a new dictionary containing copies of all the properties in this dictionary. + Changes made to the new dictionary will not be reflected in this dictionary and vice versa. + + A clone of this dictionary. + + + + Sets the values of this dictionary by reading values from another dictionary. + The other dictionary must be based on the same type as this dictionary, or a type derived + from the type for this dictionary. + + The dictionary to read values from. + + + + Gets the value of the property just like using the indexed property getter but + typed to the type of the generic parameter. This is useful especially with + nested dictionaries to avoid writing expressions with lots of casts. + + The type of the property. + Name of the property. + The value of the property. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + Gets or sets the value of the property with the specified property name. + The value may be a nested instance of this class. + + The property name. + The value of the property. + + + + Gets the internal dictionary. + + The internal dictionary. + + + + A non-generic version of the class. + + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal reference entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the entity from the database. + Note that if the entity already exists in the context, then it will not overwritten with values from the database. + + + + + Returns the query that would be used to load this entity from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database. + + A query for the entity. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the entity has been loaded from the database. + + true if the entity is loaded; otherwise, false. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Gets the backing this object as an . + + The internal member entry. + + + + Instances of this class are returned from the Reference method of + and allow operations such as loading to + be performed on the an entity's reference navigation properties. + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal reference entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the entity from the database. + Note that if the entity already exists in the context, then it will not overwritten with values from the database. + + + + + Returns the query that would be used to load this entity from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database. + + A query for the entity. + + + + Returns a new instance of the non-generic class for + the navigation property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the entity has been loaded from the database. + + true if the entity is loaded; otherwise, false. + + + + Gets the underlying as an . + + The internal member entry. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Represents a SQL query for entities that is created from a + and is executed using the connection from that context. + Instances of this class are obtained from the instance for the + entity type. The query is not executed when this object is created; it is executed + each time it is enumerated, for example by using foreach. + SQL queries for non-entities are created using the . + See for a generic version of this class. + + + + + Initializes a new instance of the class. + + The internal query. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a new query where the results of the query will not be tracked by the associated + . + + A new query with no-tracking applied. + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Gets the internal query. + + The internal query. + + + + Returns false. + + false. + + + + Represents a SQL query for entities that is created from a + and is executed using the connection from that context. + Instances of this class are obtained from the instance for the + entity type. The query is not executed when this object is created; it is executed + each time it is enumerated, for example by using foreach. + SQL queries for non-entities are created using the . + See for a non-generic version of this class. + + + + + Executes the query and returns an enumerator for the elements. + + An + + object that can be used to iterate through the elements. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a new query where the results of the query will not be tracked by the associated + . + + A new query with no-tracking applied. + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Gets the internal query. + + The internal query. + + + + Returns false. + + false. + + + + Exception thrown by when it was expected that SaveChanges for an entity would + result in a database update but in fact no rows in the database were affected. This usually indicates + that the database has been concurrently updated such that a concurrency token that was expected to match + did not actually match. + Note that state entries referenced by this exception are not serialized due to security and accesses to + the state entries after serialization will return null. + + + + + + Initializes a new instance of the class. + + The internal context. + The inner exception. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Subscribes the SerializeObjectState event. + + + + + Gets objects that represents the entities that could not + be saved to the database. + + The entries representing the entities that could not be saved. + + + + Holds exception state that will be serialized when the exception is serialized. + + + + + Completes the deserialization. + + The deserialized object. + + + + Gets or sets a value indicating whether the exception involved independent associations. + + + + + Initializes a new instance of the class. + + The context. + The inner exception. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Represents an entity used to store metadata about an EDM in the database. + + + + + Attempts to get the model hash calculated by Code First for the given context. + This method will return null if the context is not being used in Code First mode. + + The context. + The hash string. + + + + Gets or sets the ID of the metadata entity, which is currently always 1. + + The id. + + + + Gets or sets the model hash which is used to check whether the model has + changed since the database was created from it. + + The model hash. + + + + Contains methods used to access the Entity Data Model created by Code First in the EDMX form. + These methods are typically used for debugging when there is a need to look at the model that + Code First creates internally. + + + + + Uses Code First with the given context and writes the resulting Entity Data Model to the given + writer in EDMX form. This method can only be used with context instances that use Code First + and create the model internally. The method cannot be used for contexts created using Database + First or Model First, for contexts created using a pre-existing , or + for contexts created using a pre-existing . + + The context. + The writer. + + + + Writes the Entity Data Model represented by the given to the + given writer in EDMX form. + + An object representing the EDM. + The writer. + + + + A factory for creating derived instances. Implement this + interface to enable design-time services for context types that do not have a + public default constructor. + + At design-time, derived instances can be created in order to enable specific + design-time experiences such as model rendering, DDL generation etc. To enable design-time instantiation + for derived types that do not have a public, default constructor, implement + this interface. Design-time services will auto-discover implementations of this interface that are in the + same assembly as the derived type. + + + + + + Creates a new instance of a derived type. + + An instance of TContext + + + + This convention causes DbModelBuilder to include metadata about the model + when it builds the model. When creates a model by convention it will + add this convention to the list of those used by the DbModelBuilder. This will then result in + model metadata being written to the database if the DbContext is used to create the database. + This can then be used as a quick check to see if the model has changed since the last time it was + used against the database. + This convention can be removed from the conventions by overriding + the OnModelCreating method on a derived DbContext class. + + + + + Adds metadata to the given model configuration. + + The model configuration. + + + + This convention uses the name of the derived + class as the container for the conceptual model built by + Code First. + + + + + Initializes a new instance of the class. + + The model container name. + + + + Applies the convention to the given model. + + The model. + + + + This convention uses the namespace of the derived + class as the namespace of the conceptual model built by + Code First. + + + + + Initializes a new instance of the class. + + The model namespace. + + + + Applies the convention to the given model. + + The model. + + + + Instances of this class are used internally to create constant expressions for + that are inserted into the expression tree to replace references to + and . + + The type of the element. + + + + Private constructor called by the Create factory method. + + The query. + + + + Factory method called by CreateDelegate to create an instance of this class. + + The query, which must be a generic object of the expected type. + A new instance. + + + + The public property expected in the LINQ expression tree. + + The query. + + + + Instances of this class are used to create DbConnection objects for + SQL Server Compact Edition based on a given database name or connection string. + + + It is necessary to provide the provider invariant name of the SQL Server Compact + Edition to use when creating an instance of this class. This is because different + versions of SQL Server Compact Editions use different invariant names. + An instance of this class can be set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use SQL Server Compact Edition by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Creates a new connection factory with empty (default) DatabaseDirectory and BaseConnectionString + properties. + + The provider invariant name that specifies the version of SQL Server Compact Edition that should be used. + + + + Creates a new connection factory with the given DatabaseDirectory and BaseConnectionString properties. + + + The provider invariant name that specifies the version of SQL Server Compact Edition that should be used. + + + The path to prepend to the database name that will form the file name used by SQL Server Compact Edition + when it creates or reads the database file. An empty string means that SQL Server Compact Edition will use + its default for the database file location. + + + The connection string to use for options to the database other than the 'Data Source'. The Data Source will + be prepended to this string based on the database name when CreateConnection is called. + + + + + Creates a connection for SQL Server Compact Edition based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + The path to prepend to the database name that will form the file name used by + SQL Server Compact Edition when it creates or reads the database file. + The default value is "|DataDirectory|", which means the file will be placed + in the designated data directory. + + + + + The connection string to use for options to the database other than the 'Data Source'. + The Data Source will be prepended to this string based on the database name when + CreateConnection is called. + The default is the empty string, which means no other options will be used. + + + + + The provider invariant name that specifies the version of SQL Server Compact Edition + that should be used. + + + + + Instances of this class are used to create DbConnection objects for + SQL Server based on a given database name or connection string. By default, the connection is + made to '.\SQLEXPRESS'. This can be changed by changing the base connection + string when constructing a factory instance. + + + An instance of this class can be set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use SQL Server by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Creates a new connection factory with a default BaseConnectionString property of + 'Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True'. + + + + + Creates a new connection factory with the given BaseConnectionString property. + + + The connection string to use for options to the database other than the 'Initial Catalog'. The 'Initial Catalog' will + be prepended to this string based on the database name when CreateConnection is called. + + + + + Creates a connection for SQL Server based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + Remove hard dependency on DbProviderFactories. + + + + + The connection string to use for options to the database other than the 'Initial Catalog'. + The 'Initial Catalog' will be prepended to this string based on the database name when + CreateConnection is called. + The default is 'Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True'. + + + + + This attribute can be applied to either an entire derived class or to + individual or properties on that class. When applied + any discovered or properties will still be included + in the model but will not be automatically initialized. + + + + + Thrown when a context is generated from the templates in Database First or Model + First mode and is then used in Code First mode. + + + Code generated using the T4 templates provided for Database First and Model First use may not work + correctly if used in Code First mode. To use these classes with Code First please add any additional + configuration using attributes or the DbModelBuilder API and then remove the code that throws this + exception. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The object that holds the serialized object data. + The contextual information about the source or destination. + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Implements ICachedMetadataWorkspace for a Code First model. + + + + + Represents an object that holds a cached copy of a MetadataWorkspace and optionally the + assemblies containing entity types to use with that workspace. + + + + + Gets the MetadataWorkspace, potentially lazily creating it if it does not already exist. + If the workspace is not compatible with the provider manifest obtained from the given + connection then an exception is thrown. + + The connection to use to create or check SSDL provider info. + The workspace. + + + + The list of assemblies that contain entity types for this workspace, which may be empty, but + will never be null. + + + + + The default container name for code first is the container name that is set from the DbModelBuilder + + + + + The provider info used to construct the workspace. + + + + + Builds and stores the workspace based on the given code first configuration. + + The code first EDM model. + + + + Gets the . + If the workspace is not compatible with the provider manifest obtained from the given + connection then an exception is thrown. + + The connection to use to create or check SSDL provider info. + The workspace. + + + + The default container name for code first is the container name that is set from the DbModelBuilder + + + + + The list of assemblies that contain entity types for this workspace, which may be empty, but + will never be null. + + + + + The provider info used to construct the workspace. + + + + + The methods here are called from multiple places with an ObjectContext that may have + been created in a variety of ways and ensure that the same code is run regardless of + how the context was created. + + + + + Used a delegate to do the actual creation once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + Note however that a context obtained from only a connection will have no model and so + will result in an empty database. + + + + + Used a delegate to do the actual existence check once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + + + + + Used a delegate to do the actual check/delete once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given set of entity types and DbSet initializer delegate. + + + + + The entity types part of the pair. + + + + + The DbSet properties initializer part of the pair. + + + + + Static helper methods only. + + + + + Checks whether the given value is null and throws ArgumentNullException if it is. + This method should only be used in places where Code Contracts are compiled out in the + release build but we still need public surface null-checking, such as where a public + abstract class is implemented by an internal concrete class. + + + + + Checks whether the given string is null, empty, or just whitespace, and throws appropriately + if the check fails. + This method should only be used in places where Code Contracts are compiled out in the + release build but we still need public surface checking, such as where a public + abstract class is implemented by an internal concrete class. + + + + + Given two key values that may or may not be byte arrays, this method determines + whether or not they are equal. For non-binary key values, this is equivalent + to Object.Equals. For binary keys, it is by comparison of every byte in the + arrays. + + + + + Provides a standard helper method for quoting identifiers + + Identifier to be quoted. Does not validate that this identifier is valid. + Quoted string + + + + Checks the given string which might be a database name or a connection string and determines + whether it should be treated as a name or connection string. Currently, the test is simply + whether or not the string contains an '=' character--if it does, then it should be treated + as a connection string. + + The name or connection string. + true if the string should be treated as a connection string; false if it should be treated as a name. + + + + Determines whether the given string should be treated as a database name directly (it contains no '='), + is in the form name=foo, or is some other connection string. If it is a direct name or has name=, then + the name is extracted and the method returns true. + + The name or connection string. + The name. + True if a name is found; false otherwise. + + + + Determines whether the given string is a full EF connection string with provider, provider connection string, + and metadata parts, or is is instead some other form of connection string. + + The name or connection string. + true if the given string is an EF connection string; otherwise, false. + + + + + Parses a property selector expression used for the expression-based versions of the Property, Collection, Reference, + etc methods on and + classes. + + The type of the entity. + The type of the property. + The property. + Name of the method. + Name of the param. + The property name. + + + + Called recursively to parse an expression tree representing a property path such + as can be passed to Include or the Reference/Collection/Property methods of . + This involves parsing simple property accesses like o => o.Products as well as calls to Select like + o => o.Products.Select(p => p.OrderLines). + + The expression to parse. + The expression parsed into an include path, or null if the expression did not match. + True if matching succeeded; false if the expression could not be parsed. + + + + Gets a cached dictionary mapping property names to property types for all the properties + in the given type. + + + + + Gets a dictionary of compiled property setter delegates for the underlying types. + The dictionary is cached for the type in the app domain. + + + + + Used by the property setter delegates to throw for attempts to set null onto + non-nullable properties or otherwise go ahead and set the property. + + + + + Gets a dictionary of compiled property getter delegates for the underlying types. + The dictionary is cached for the type in the app domain. + + + + + Creates a new with the NoTracking merge option applied. + The query object passed in is not changed. + + The query. + A new query with NoTracking applied. + + + + Converts to + + + Name of the property being validated with ValidationAttributes. Null for type-level validation. + + + ValidationResults instances to be converted to instances. + + + An created based on the + . + + + class contains a property with names of properties the error applies to. + On the other hand each applies at most to a single property. As a result for + each name in ValidationResult.MemberNames one will be created (with some + exceptions for special cases like null or empty .MemberNames or null names in the .MemberNames). + + + + + Calculates a "path" to a property. For primitive properties on an entity type it is just the + name of the property. Otherwise it is a dot separated list of names of the property and all + its ancestor properties starting from the entity. + + Property for which to calculate the path. + Dot separated path to the property. + + + + Gets names of the property and its ancestor properties as enumerable walking "bottom-up". + + Property for which to get the segments. + Names of the property and its ancestor properties. + + + + Gets an type for the given element type. + + Type of the element. + The collection type. + + + + Creates a database name given a type derived from DbContext. This handles nested and + generic classes. No attempt is made to ensure that the name is not too long since this + is provider specific. If a too long name is generated then the provider will throw and + the user must correct by specifying their own name in the DbContext constructor. + + Type of the context. + The database name to use. + + + + A local (in-memory) view of the entities in a DbSet. + This view contains Added entities and does not contain Deleted entities. The view extends + from and hooks up events between the collection and the + state manager to keep the view in sync. + + The type of the entity. + + + + Initializes a new instance of the class for entities + of the given generic type in the given internal context. + + The internal context. + + + + Called by the base class when the collection changes. + This method looks at the change made to the collection and reflects those changes in the + state manager. + + The instance containing the event data. + + + + Handles events from the state manager for entities entering, leaving, or being marked as deleted. + The local view is kept in sync with these changes. + + The sender. + The instance containing the event data. + + + + Clears the items by calling remove on each item such that we get Remove events that + can be tracked back to the state manager, rather than a single Reset event that we + cannot deal with. + + + + + Adds a contains check to the base implementation of InsertItem since we can't support + duplicate entities in the set. + + The index at which to insert. + The item to insert. + + + + Returns a cached binding list implementation backed by this ObservableCollection. + + The binding list. + + + + Service used to search for instance properties on a DbContext class that can + be assigned a DbSet instance. Also, if the the property has a public setter, + then a delegate is compiled to set the property to a new instance of DbSet. + All of this information is cached per app domain. + + + + + Creates a set discovery service for the given derived context. + + + + + Processes the given context type to determine the DbSet or IDbSet + properties and collect root entity types from those properties. Also, delegates are + created to initialize any of these properties that have public setters. + If the type has been processed previously in the app domain, then all this information + is returned from a cache. + + A dictionary of potential entity type to the list of the names of the properties that used the type. + + + + Calls the public setter on any property found to initialize it to a new instance of DbSet. + + + + + Registers the entities and their entity set name hints with the given . + + The model builder. + + + + Returns false if SuppressDbSetInitializationAttribute is found on the property or the class, otherwise + returns true. + + + + + Determines whether or not an instance of DbSet/ObjectSet can be assigned to a property of the given type. + + The type to check. + The entity type of the DbSet/ObjectSet that can be assigned, or null if no set type can be assigned. + + + + + A EagerInternalConnection object wraps an already existing DbConnection object. + + + + + InternalConnection objects manage DbConnections. + Two concrete base classes of this abstract interface exist: + and . + + + + + IInternalConnection objects manage DbConnections. + Two concrete implementations of this interface exist--LazyInternalConnection and EagerInternalConnection. + + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Returns the underlying DbConnection. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if the connection contains model info; otherwise, false. + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strins. + + + + + Gets or sets the provider to be used when creating the underlying connection. + + + + + Gets the name of the underlying connection string. + + + + + Gets the original connection string. + + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Called after the connection is initialized for the first time. + + + + + Adds a tracking cookie to the connection string for SqlConnections. Returns the + possibly modified store connection string. + + + + + Returns the underlying DbConnection. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if the connection contains model info; otherwise, false. + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strins. + + + + + Gets or sets the provider to be used when creating the underlying connection. + + + + + Gets the name of the underlying connection string. + + + + + Gets the original connection string. + + + + + Gets or sets the underlying object. No initialization is done when the + connection is obtained, and it can also be set to null. + + The underlying connection. + + + + Creates a new EagerInternalConnection that wraps an existing DbConnection. + + An existing connection. + If set to true then the underlying connection should be disposed when this object is disposed. + + + + Dispose the existing connection is the original caller has specified that it should be disposed + by the framework. + + + + + Returns the origin of the underlying connection string. + + + + + An is an where the + instance that it wraps is set immediately at construction time rather than being created lazily. In this case + the internal context may or may not own the instance but will only dispose it + if it does own it. + + + + + An underlies every instance of and wraps an + instance. + The also acts to expose necessary information to other parts of the design in a + controlled manner without adding a lot of internal methods and properties to the + class itself. + Two concrete classes derive from this abstract class - and + . + + + + + Initializes the object with its owner. + + The owner . + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Creates a new temporary based on the same metadata and connection as the real + and sets it as the context to use DisposeTempObjectContext is called. + This allows this internal context and its DbContext to be used for transient operations + such as initializing and seeding the database, after which it can be thrown away. + This isolates the real from any changes made and and saves performed. + + + + + If a temporary ObjectContext was set with UseTempObjectContext, then this method disposes that context + and returns this internal context and its DbContext to using the real ObjectContext. + + + + + Called by methods of to create a database either using the Migrations pipeline + if possible and the core provider otherwise. + + The context to use for core provider calls. + + + + Internal implementation of . + + True if the model hash in the context and the database match; false otherwise. + + + + Checks whether the given model (an EDMX document) matches the current model. + + + + + Queries the database for a model hash and returns it if found or returns null if the table + or the row doesn't exist in the database. + + The model hash, or null if not found. + + + + Queries the database for a model stored in the MigrationHistory table and returns it as an EDMX, or returns + null if the database does not contain a model. + + + + + Saves the model hash from the context to the database. + + + + + Performs the initialization action that may result in a and + handle the exception to provide more meaning to the user. + + The action. + + + + Registers for the ObjectStateManagerChanged event on the underlying ObjectStateManager. + This is a virtual method on this class so that it can be mocked. + + The event handler. + + + + Checks whether or not the given object is in the context in any state other than Deleted. + This is a virtual method on this class so that it can be mocked. + + The entity. + true if the entity is in the context and not deleted; otherwise false. + + + + Saves all changes made in this context to the underlying database. + + The number of objects written to the underlying database. + + + + Initializes this instance, which means both the context is initialized and the underlying + database is initialized. + + + + + Initializes the underlying ObjectContext but does not cause the database to be initialized. + + + + + Marks the database as having not been initialized. This is called when the app calls Database.Delete so + that the database if the app attempts to then use the database again it will be re-initialized automatically. + + + + + Runs the unless it has already been run or there + is no initializer for this context type in which case this method does nothing. + + + + + Marks the database as having been initialized without actually running the . + + + + + Runs the if one has been set for this context type. + Calling this method will always cause the initializer to run even if the database is marked + as initialized. + + + + + Disposes the context. Override the DisposeContext method to perform + additional work when disposing. + + + + + Performs additional work to dispose a context. + + + + + Calls DetectChanges on the underlying if AutoDetectChangesEnabled is + true or if force is set to true. + + if set to true then DetectChanges is called regardless of the value of AutoDetectChangesEnabled. + + + + Returns the DbSet instance for the given entity type. + This property is virtual and returns to that it can be mocked. + + The entity type for which a set should be returned. + A set for the given entity type. + + + + Returns the non-generic instance for the given entity type. + This property is virtual and returns to that it can be mocked. + + The entity type for which a set should be returned. + A set for the given entity type. + + + + Creates an internal set using an app domain cached delegate. + + Type of the entity. + The set. + + + + Returns the entity set and the base type for that entity set for the given type. + This method does o-space loading if required and throws if the type is not in the model. + + The entity type to lookup. + The entity set and base type pair. + + + + Returns the entity set and the base type for that entity set for the given type if that + type is mapped in the model, otherwise returns null. + This method does o-space loading if required. + + The entity type to lookup. + The entity set and base type pair, or null if not found. + + + + Checks whether or not the given entity type is mapped in the model. + + The entity type to lookup. + True if the type is mapped as an entity; false otherwise. + + + + Gets the local entities of the type specified from the state manager. That is, all + Added, Modified, and Unchanged entities of the given type. + + The type of entity to get. + The entities. + + + + Executes the given SQL query against the database backing this context. The results are not materialized as + entities or tracked. + + The type of the element. + The SQL. + The parameters. + The query results. + + + + Executes the given SQL query against the database backing this context. The results are not materialized as + entities or tracked. + + Type of the element. + The SQL. + The parameters. + The query results. + + + + Calls the generic ExecuteSqlQuery but with a non-generic return type so that it + has the correct signature to be used with CreateDelegate above. + + + + + Executes the given SQL command against the database backing this context. + + The SQL. + The parameters. + The return value from the database. + + + + Gets the underlying for the given entity, or returns null if the entity isn't tracked by this context. + This method is virtual so that it can be mocked. + + The entity. + The state entry or null. + + + + Gets the underlying objects for all entities tracked by + this context. + This method is virtual so that it can be mocked. + + State entries for all tracked entities. + + + + Gets the underlying objects for all entities of the given + type tracked by this context. + This method is virtual so that it can be mocked. + + The type of the entity. + State entries for all tracked entities of the given type. + + + + Helper method that gets the underlying objects for all entities that + match the given predicate. + + + + + Wraps the given in either a or + a depending on the actual exception type and the state + entries involved. + + The update exception. + A new exception wrapping the given exception. + + + + Uses the underlying context to create an entity such that if the context is configured + to create proxies and the entity is suitable then a proxy instance will be returned. + This method is virtual so that it can be mocked. + + The type of the entity. + The new entity instance. + + + + Uses the underlying context to create an entity such that if the context is configured + to create proxies and the entity is suitable then a proxy instance will be returned. + This method is virtual so that it can be mocked. + + The type of entity to create. + The new entity instance. + + + + This method is used by CreateDelegate to transform the CreateObject method with return type TEntity + into a method with return type object which matches the required type of the delegate. + + + + + Replaces the connection that will be used by this context. + The connection can only be changed before the context is initialized. + + The new connection. + + + + Throws if the context has been disposed. + + + + + Checks whether or not the internal cache of types to entity sets has been initialized, + and initializes it if necessary. + + + + + Forces all DbSets to be initialized, which in turn causes o-space loading to happen + for any entity type for which we have a DbSet. This includes all DbSets that were + discovered on the user's DbContext type. + + + + + Performs o-space loading for the type and returns false if the type is not in the model. + + + + + Performs o-space loading for the type and throws if the type is not in the model. + + Type of the entity. + + + + Returns true if the given entity type does not have EdmEntityTypeAttribute but is in + an assembly that has EdmSchemaAttribute. This indicates mixing of POCO and EOCO in the + same assembly, which is something that we don't support. + + + + + Determines whether or not the given clrType is mapped to a complex type. Assumes o-space loading has happened. + + + + + Updates the cache of types to entity sets either for the first time or after potentially + doing some o-space loading. + + + + + The public context instance that owns this internal context. + + + + + Returns the underlying . + + + + + Gets the temp object context, or null if none has been set. + + The temp object context. + + + + The compiled model created from the Code First pipeline, or null if Code First was + not used to create this context. + Causes the Code First pipeline to be run to create the model if it has not already been + created. + + + + + Set to true when a database initializer is performing some actions, such as creating or deleting + a database, or seeding the database. + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + Gets or sets a value indicating whether lazy loading is enabled. + + + + + Gets or sets a value indicating whether proxy creation is enabled. + + + + + Gets or sets a value indicating whether DetectChanges is called automatically in the API. + + + + + Gets or sets a value indicating whether to validate entities when is called. + + + + + True if the context has been disposed. + + + + + The connection underlying this context. Accessing this property does not cause the context + to be initialized, only its connection. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries, + database intializers and connection strings. + + + + + Gets or sets the provider details to be used when building the EDM model. + + + + + Gets the name of the underlying connection string. + + + + + Gets the provider name bsing used either using a cached value or getting it from + the DbConnection in use. + + + + + Gets or sets a custom OnModelCreating action. + + + + + Gets the DatabaseOperations instance to use to perform Create/Delete/Exists operations + against the database. + Note that this virtual property can be mocked to help with unit testing. + + + + + Gets instance used to create validators and validation contexts. + This property is virtual to allow mocking. + + + + + For mocking. + + + + + Constructs an for an already existing . + + The owner . + The existing . + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Does nothing, since the already exists. + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Disposes the context. The underlying is also disposed if it is owned. + + + + + + + + Returns the underlying . + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + The connection underlying this context. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets a value indicating whether lazy loading is enabled. This is just a wrapper + over the same flag in the underlying . + + + + + Gets or sets a value indicating whether proxy creation is enabled. This is just a wrapper + over the same flag in the underlying ObjectContext. + + + + + An implementation of that represents a clone of another + dictionary. That is, all the property values have been been copied into this dictionary. + + + + + The internal class used to implement . + This internal class allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal context with which the entity of complex object is associated. + The type of the entity or complex object. + If set to true this is a dictionary for an entity, otherwise it is a dictionary for a complex object. + + + + Implemented by subclasses to get the dictionary item for a given property name. + Checking that the name is valid should happen before this method is called such + that subclasses do not need to perform the check. + + Name of the property. + An item for the given name. + + + + Creates an object of the underlying type for this dictionary and hydrates it with property + values from this dictionary. + + The properties of this dictionary copied into a new object. + + + + Creates an instance of the underlying type for this dictionary, which may either be an entity type (in which + case CreateObject on the context is used) or a non-entity type (in which case the empty constructor is used.) + In either case, app domain cached compiled delegates are used to do the creation. + + + + + Sets the values of this dictionary by reading values out of the given object. + The given object must be of the type that this dictionary is based on. + + The object to read values from. + + + + Creates a new dictionary containing copies of all the properties in this dictionary. + Changes made to the new dictionary will not be reflected in this dictionary and vice versa. + + A clone of this dictionary. + + + + Sets the values of this dictionary by reading values from another dictionary. + The other dictionary must be based on the same type as this dictionary, or a type derived + from the type for this dictionary. + + The dictionary to read values from. + + + + Gets the dictionary item for the property with the given name. + This method checks that the given name is valid. + + The property name. + The item. + + + + Sets the value of the property only if it is different from the current value and is not + an invalid attempt to set a complex property. + + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + Gets or sets the value of the property with the specified property name. + The value may be a nested instance of this class. + + The property name. + The value of the property. + + + + Gets the entity type of complex type that this dictionary is based on. + + The type of the object underlying this dictionary. + + + + Gets the internal context with which the underlying entity or complex type is associated. + + The internal context. + + + + Gets a value indicating whether the object for this dictionary is an entity or a complex object. + + true if this this is a dictionary for an entity; false if it is a dictionary for a complex object. + + + + Initializes a new instance of the class by copying + values from the given dictionary. + + The dictionary to clone. + If non-null, then the values for the new dictionary are taken from this record rather than from the original dictionary. + + + + Gets the dictionary item for a given property name. + + Name of the property. + An item for the given name. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + An implementation of for an item in a . + + + + + Represents an item in an representing a property name/value. + + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + true If this instance represents a complex property; otherwise, false. + + + + Gets the type of the underlying property. + + The property type. + + + + Initializes a new instance of the class. + + The name. + The value. + The type. + If set to true this item represents a complex property. + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + + true If this instance represents a complex property; otherwise, false. + + + + + Gets the type of the underlying property. + + The property type. + + + + An implementation of that is based on an existing + instance. + + + + + Initializes a new instance of the class. + + The internal context. + The type. + The data record. + If set to true this is a dictionary for an entity, otherwise it is a dictionary for a complex object. + + + + Gets the dictionary item for a given property name. + + Name of the property. + An item for the given name. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + An implementation of for an item in a . + + + + + Initializes a new instance of the class. + + The data record. + The ordinal. + The value. + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + + true If this instance represents a complex property; otherwise, false. + + + + + Gets the type of the underlying property. + + The property type. + + + + This is version of an internal interface that already exists in System.Data.Entity that + is implemented by . Using this interface allows state + entries to be mocked for unit testing. The plan is to remove this version of the + interface and use the one in System.Data.Entity once we roll into the framework. + Note that some members may need to be added to the interface in the framework when + we combine the two. + + + + + The internal class used to implement and + . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Base class for and + containing common code for collection and reference navigation property entries. + + + + + Base class for all internal entries that represent different kinds of properties. + + + + + Initializes a new instance of the class. + + The internal entity entry. + The member metadata. + + + + Validates this property. + + A sequence of validation errors for this property. Empty if no errors. Never null. + + + + Creates a new non-generic backed by this internal entry. + The actual subtype of the DbMemberEntry created depends on the metadata of this internal entry. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The actual subtype of the DbMemberEntry created depends on the metadata of this internal entry. + + The type of the entity. + The type of the property. + The new entry. + + + + Gets the property name. + The property is virtual to allow mocking. + + The property name. + + + + Gets or sets the current value of the navigation property. + + The current value. + + + + Gets the internal entity entry property belongs to. + This property is virtual to allow mocking. + + The internal entity entry. + + + + Gets the entry metadata. + + The entry metadata. + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Calls Load on the underlying . + + + + + Uses CreateSourceQuery on the underlying to create a query for this + navigation property. + + + + + Gets the navigation property value from the object. + + The entity. + The navigation property value. + + + + Validates that the owning entity entry is associated with an underlying and + is not just wrapping a non-attached entity. + If the entity is not detached, then the RelatedEnd for this navigation property is obtained. + + + + + Calls IsLoaded on the underlying . + + + + + Gets the related end, which will be null if the entity is not being tracked. + + The related end. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + This property is virtual so that it can be mocked. + + The current value. + + + + Gets a delegate that can be used to get the value of the property directly from the entity. + Returns null if the property does not have an accessible getter. + + The getter delegate, or null. + + + + Gets a delegate that can be used to set the value of the property directly on the entity. + Returns null if the property does not have an accessible setter. + + The setter delegate, or null. + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Gets the navigation property value from the object. + Since for a collection the related end is an , it means + that the internal representation of the navigation property is just the related end. + + The entity. + The navigation property value. + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Creates a new generic backed by this internal entry. + The actual subtype of the DbCollectionEntry created depends on the metadata of this internal entry. + + The type of the entity. + The type of the element. + The new entry. + + + + Creates a object for the given entity type + and collection element type. + + The type of the entity. + The type of the property. + Type of the element. + The set. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + + The current value. + + + + The internal class used to implement + and . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal context. + The state entry. + + + + Initializes a new instance of the class for an + entity which may or may not be attached to the context. + + The internal context. + The entity. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + + The store values. + + + + Appends a query for the properties in the entity to the given string builder that is being used to + build the eSQL query. This method may be called recursively to query for all the sub-properties of + a complex property. + + The query builder. + The qualifier with which to prefix each property name. + The dictionary that acts as a template for the properties to query. + + + + Validates that a dictionary can be obtained for the state of the entity represented by this entry. + + The method name being used to request a dictionary. + The state that is invalid for the request being processed. + + + + Calls Refresh with StoreWins on the underlying state entry. + + + + + Gets an internal object representing a reference navigation property. + This method is virtual to allow mocking. + + The navigation property. + The type of entity requested, which may be 'object' or null if any type can be accepted. + The entry. + + + + Gets an internal object representing a collection navigation property. + This method is virtual to allow mocking. + + The navigation property. + The type of entity requested, which may be 'object' or null f any type can be accepted. + The entry. + + + + Gets an internal object representing a navigation, scalar, or complex property. + This method is virtual to allow mocking. + + Name of the property. + The type of entity requested, which may be 'object' if any type can be accepted. + The entry. + + + + Gets an internal object representing a scalar or complex property. + This method is virtual to allow mocking. + + The property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Gets an internal object representing a scalar or complex property. + The property may be a nested property on the given . + + The parent property entry, or null if this is a property directly on the entity. + Name of the property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Gets an internal object representing a scalar or complex property. + The property may be a nested property on the given . + + The parent property entry, or null if this is a property directly on the entity. + Name of the property. + The property split out into its parts. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Checks that the given property name is a navigation property and is either a reference property or + collection property according to the value of requireCollection. + + + + + Gets metadata for the given property if that property is a navigation property or returns null + if it is not a navigation property. + + Name of the property. + Navigation property metadata or null. + + + + Gets the type of entity or entities at the target end of the given navigation property. + + The navigation property. + The CLR type of the entity or entities at the other end. + + + + Gets the related end for the navigation property with the given name. + + The navigation property. + + + + + Uses EDM metadata to validate that the property name exists in the model and represents a scalar or + complex property or exists in the CLR type. + This method is public and virtual so that it can be mocked. + + The property name. + The type on which the property is declared. + The type of object requested, which may be 'object' if any type can be accepted. + Metadata for the property. + + + + Splits the given property name into parts delimited by dots. + + Name of the property. + The parts of the name. + + + + Validates that this entry is associated with an underlying and + is not just wrapping a non-attached entity. + + + + + Validates entity represented by this entity entry. + This method is virtual to allow mocking. + + User defined dictionary containing additional info for custom validation. This parameter is optional and can be null. + containing validation result. Never null. + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the tracked entity. + This property is virtual to allow mocking. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + This property is virtual to allow mocking. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + This property is virtual to allow mocking. + + The original values. + + + + Checks whether or not this entry is associated with an underlying or + is just wrapping a non-attached entity. + + + + + Gets the type of the entity being tracked. + + The type of the entity. + + + + Gets the c-space entity type for this entity from the EDM. + + + + + Gets the underlying object state entry. + + + + + Gets the internal context. + + The internal context. + + + + A concrete implementation of used for properties of entities. + + + + + The internal class used to implement and + . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal entry. + The property info. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. If this is a property of an entity, then this method returns + true if the property is modified. If this is a property of a complex object, then + this method returns true if the top-level complex property on the entity is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + If this is a property of an entity, then this method marks it as modified. + If this is a property of a complex object, then this method marks the top-level + complex property as modified. + + + + + Throws if the user attempts to set a complex property to null. + + The value. + + + + Sets the given value directly onto the underlying entity object. + + The value. + True if the property had a setter that we could attempt to call; false if no setter was available. + + + + Sets the property value, potentially by setting individual nested values for a complex + property. + + The value. + + + + Gets an internal object representing a scalar or complex property of this property, + which must be a mapped complex property. + This method is virtual to allow mocking. + + The property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Validates that the owning entity entry is associated with an underlying and + is not just wrapping a non-attached entity. + + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent entity or complex property. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent entity or complex property. + That is, the original values that contains the value for this property. + + The parent original values. + + + + A delegate that reads the value of this property. + May be null if there is no way to set the value due to missing accessors on the type. + + + + + A delegate that sets the value of this property. + May be null if there is no way to set the value due to missing accessors on the type. + + + + + Gets or sets the original value. + Note that complex properties are returned as objects, not property values. + + + + + Gets or sets the current value. + Note that complex properties are returned as objects, not property values. + Also, for complex properties, the object returned is the actual complex object from the entity + and setting the complex object causes the actual object passed to be set onto the entity. + + The current value. + + + + Gets or sets a value indicating whether this property is modified. + + + + + Gets the property metadata. + + The property metadata. + + + + Initializes a new instance of the class. + + The internal entry. + The property info. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. Since this is a property of an entity this method returns + true if the property is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + Since this is a property of an entity this method marks it as modified. + + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent entity. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent entity. + That is, the original values that contains the value for this property. + + The parent original values. + + + + A concrete implementation of used for properties of complex objects. + + + + + Initializes a new instance of the class. + + The parent property entry. + The property metadata. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. Since this is a property of a complex object + this method returns true if the top-level complex property on the entity is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + Since this is a property of a complex object this method marks the top-level + complex property as modified. + + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent complex property. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent complex property. + That is, the original values that contains the value for this property. + + The parent original values. + + + + The internal class used to implement , + and . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Gets the navigation property value from the object. + For reference navigation properties, this means getting the value from the + object. + + The entity. + The navigation property value. + + + + Sets the navigation property value onto the object. + For reference navigation properties, this means setting the value onto the + object. + + The entity. + The value. + + + + Sets the given value on the given which must be an + . + This method is setup in such a way that it can easily be used by CreateDelegate without any + dynamic code generation needed. + + The type of the related entity. + The entity reference. + The value. + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + + The current value. + + + + Contains metadata about a member of an entity type or complex type. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry if the new entry is nested, otherwise null. + The new entry. + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets the name of the property. + + The name. + + + + Gets the type of the entity or complex object that on which the member is declared. + + The type that the member is declared on. + + + + Gets the type of element for the property, which for non-collection properties + is the same as the MemberType and which for collection properties is the type + of element contained in the collection. + + The type of the element. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + The types of member entries supported. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + if set to true this is a collection nav prop. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry which will always be null for navigation entries. + The new entry. + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + Contains metadata for a property of a complex object or entity. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + if set to true the property is mapped in the EDM. + if set to true the property is a complex property. + + + + Validates that the given name is a property of the declaring type (either on the CLR type or in the EDM) + and that it is a complex or scalar property rather than a nav property and then returns metadata about + the property. + + The internal context. + The type that the property is declared on. + The type of property requested, which may be 'object' if any type can be accepted. + Name of the property. + Metadata about the property, or null if the property does not exist or is a navigation property. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry if the new entry is nested, otherwise null. + The new entry. + + + + Gets a value indicating whether this is a complex property. + That is, not whether or not this is a property on a complex object, but rather if the + property itself is a complex property. + + + true if this instance is complex; otherwise, false. + + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets a value indicating whether this instance is mapped in the EDM. + + true if this instance is mapped; otherwise, false. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + An implementation of that wraps an existing set but makes + it read-only. + + + + + + Initializes a new instance of the class wrapped around + another existing set. + + The existing set. + + + + This is a temporary adapter class that wraps an and + presents it as an . This class will be removed once + we roll into the System.Data.Entity assembly. See + for more details. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given EntitySet and BaseType. + + + + + The EntitySet part of the pair. + + + + + The BaseType part of the pair. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given database initializer delegate and a flag + indicating whether or not it is locked. + + + + + The initializer delegate. + + + + + A flag indicating whether or not the initializer is locked and should not be changed. + + + + + Represents a raw SQL query against the context for any type where the results are never + associated with an entity set and are never tracked. + + + + + Represents a raw SQL query against the context that may be for entities in an entity set + or for some other non-entity element type. + + + + + Initializes a new instance of the class. + + The SQL. + The parameters. + + + + If the query is would track entities, then this method returns a new query that will + not track entities. + + A no-tracking query. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Gets the SQL query string, + + The SQL query. + + + + Gets the parameters. + + The parameters. + + + + Returns false. + + false. + + + + Initializes a new instance of the class. + + The internal context. + Type of the element. + The SQL. + The parameters. + + + + Returns this query since it can never be a tracking query. + + This instance. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Generic wrapper around to allow results to be + returned as generic + + The type of the element. + + + + Executes the query and returns an enumerator for the elements. + + An + + object that can be used to iterate through the elements. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Returns false. + + false. + + + + Represents a raw SQL query against the context for entities in an entity set. + + + + + Initializes a new instance of the class. + + The set. + The SQL. + if set to true then the entities will not be tracked. + The parameters. + + + + If the query is would track entities, then this method returns a new query that will + not track entities. + + A no-tracking query. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Gets a value indicating whether this instance is set to track entities or not. + + + true if this instance is no-tracking; otherwise, false. + + + + + A LazyInternalConnection object manages information that can be used to create a DbConnection object and + is responsible for creating that object and disposing it. + + + + + Creates a new LazyInternalConnection using convention to calculate the connection. + The DbConnection object will be created lazily on demand and will be disposed when the LazyInternalConnection is disposed. + + Either the database name or a connection string. + + + + Creates a new LazyInternalConnection targeting a specific database. + The DbConnection object will be created lazily on demand and will be disposed when the LazyInternalConnection is disposed. + + The connection to target. + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Disposes the underlying DbConnection. + Note that dispose actually puts the LazyInternalConnection back to its initial state such that + it can be used again. + + + + + + Searches the app.config/web.config file for a connection that matches the given name. + The connection might be a store connection or an EF connection. + + The connection name. + + True if a connection from the app.config file was found and used. + + + + Attempts to locate a connection entry in the configuration based on the supplied context name. + + The name to search for. + The configuration to search in. + Connection string if found, otherwise null. + + + + Initializes the connection based on a connection string. + + The settings to initialize from. + + + + Returns the underlying DbConnection, creating it first if it does not already exist. + + + + + Returns the origin of the underlying connection string. + + + + + Gets the name of the underlying connection string. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if connection contain model info; otherwise, false. + + + + Gets a value indicating if the lazy connection has been initialized. + + + + + A is a concrete type that will lazily create the + underlying when needed. The created is owned by the + internal context and will be disposed when the internal context is disposed. + + + + + Constructs a for the given owner that will be initialized + on first use. + + The owner . + Responsible for creating a connection lazily when the context is used for the first time. + The model, or null if it will be created by convention + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Saves all changes made in this context to the underlying database, but only if the + context has been initialized. If the context has not been initialized, then this + method does nothing because there is nothing to do; in particular, it does not + cause the context to be initialized. + + The number of objects written to the underlying database. + + + + Disposes the context. The underlying is also disposed. + The connection to the database ( object) is also disposed if it was created by + the context, otherwise it is not disposed. + + + + + + + + Initializes the underlying . + + + + + Creates an immutable, cacheable representation of the model defined by this builder. + This model can be used to create an or can be passed to a + constructor to create a for this model. + + + + + + Creates and configures the instance that will be used to build the + . + + The builder. + + + + Marks the database as having not been initialized. This is called when the app calls Database.Delete so + that the database if the app attempts to then use the database again it will be re-initialized automatically. + + + + + Marks the database as having been initialized without actually running the . + + + + + Runs the unless it has already been run or there + is no initializer for this context type in which case this method does nothing. + + + + + Performs some action (which may do nothing) in such a way that it is guaranteed only to be run + once for the model and connection in this app domain, unless it fails by throwing an exception, + in which case it will be re-tried next time the context is initialized. + + The action. + + + + Returns the underlying . + + + + + The compiled model created from the Code First pipeline, or null if Code First was + not used to create this context. + Causes the Code First pipeline to be run to create the model if it has not already been + created. + + + + + The actually being used, which may be the + temp context for initialization or the real context. + + + + + The connection underlying this context. Accessing this property does not cause the context + to be initialized, only its connection. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strings. + + + + + Gets the name of the underlying connection string. + + + + + Gets or sets the provider details to be used when building the EDM model. + + + + + + + + Gets or sets a custom OnModelCreating action. + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + Gets or sets a value indicating whether lazy loading is enabled. + If the exists, then this property acts as a wrapper over the flag stored there. + If the has not been created yet, then we store the value given so we can later + use it when we create the . This allows the flag to be changed, for example in + a DbContext constructor, without it causing the to be created. + + + + + Gets or sets a value indicating whether proxy creation is enabled. + If the ObjectContext exists, then this property acts as a wrapper over the flag stored there. + If the ObjectContext has not been created yet, then we store the value given so we can later + use it when we create the ObjectContext. This allows the flag to be changed, for example in + a DbContext constructor, without it causing the ObjectContext to be created. + + + + + A wrapping query provider that performs expression transformation and then delegates + to the provider. The objects returned are always instances + of . This provider is associated with generic objects. + + + + + Creates a provider that wraps the given provider. + + The provider to wrap. + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a . + + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a where T is determined + from the element type of the ObjectQuery. + + + + + By default, calls the same method on the wrapped provider. + + + + + By default, calls the same method on the wrapped provider. + + + + + Creates an appropriate generic IQueryable using Reflection and the underlying ElementType of + the given ObjectQuery. + + + + + Performs expression replacement and then delegates to the wrapped provider to create an + . + + + + + Wraps the given as a where T is determined + from the element type of the ObjectQuery. + + + + + Gets the internal context. + + The internal context. + + + + A LINQ expression visitor that finds uses with equivalent + instances. + + + + + Replaces calls to DbContext.Set() with an expression for the equivalent . + + The node to replace. + A new node, which may have had the replacement made. + + + + Replaces a or property with a constant expression + for the underlying . + + The node to replace. + A new node, which may have had the replacement made. + + + + Processes the fields in each constant expression and replaces instances with + the underlying ObjectQuery instance. This handles cases where the query has a closure + containing values. + + + + + Gets a value from the given member, or returns null + if the member doesn't contain a DbContext instance. + + The expression for the object for the member, which may be null for a static member. + The member. + The context or null. + + + + Gets the instance from the given instance or static member, returning null + if the member does not contain a DbContext instance. + + The member. + The value of the object to get the instance from, or null if the member is static. + The context instance or null. + + + + Takes a or and creates an expression + for the underlying . + + + + + Takes a or and extracts the underlying . + + + + + A non-generic interface implemented by that allows operations on + any query object without knowing the type to which it applies. + + + + + An interface implemented by . + + The type of the element. + + + + A non-generic interface implemented by that allows operations on + any set object without knowing the type to which it applies. + + + + + An interface implemented by . + + + + + An instance of this internal class is created whenever an instance of the public + class is needed. This allows the public surface to be non-generic, while the runtime type created + still implements . + + The type of the element. + + + + Creates a new query that will be backed by the given internal query object. + + The backing query. + + + + See comments in . + + + + + See comments in . + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the underlying internal query object. + + The internal query. + + + + An instance of this internal class is created whenever an instance of the public + class is needed. This allows the public surface to be non-generic, while the runtime type created + still implements . + + The type of the entity. + + + + Creates a new set that will be backed by the given internal set. + + The internal set. + + + + Creates an instance of this class. This method is used with CreateDelegate to cache a delegate + that can create a generic instance without calling MakeGenericType every time. + + + The internal set to wrap, or null if a new internal set should be created. + The set. + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the underlying internal query object. + + The internal query. + + + + Gets the underlying internal set. + + The internal set. + + + + See comments in . + + + + + An InternalQuery underlies every instance of DbSet and DbQuery. It acts to lazily initialize a InternalContext as well + as an ObjectQuery and EntitySet the first time that it is used. The InternalQuery also acts to expose necessary + information to other parts of the design in a controlled manner without adding a lot of internal methods and + properties to the DbSet and DbQuery classes themselves. + + The type of entity to query for. + + + + Creates a new query that will be backed by the given InternalContext. + + The backing context. + + + + Creates a new internal query based on the information in an existing query together with + a new underlying ObjectQuery. + + + + + Resets the query to its uninitialized state so that it will be re-lazy initialized the next + time it is used. This allows the ObjectContext backing a DbContext to be switched out. + + + + + Updates the underlying ObjectQuery with the given include path. + + The include path. + A new query containing the defined include path. + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Performs lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that the query can be used. + + + + + Returns a representation of the underlying query, equivalent + to ToTraceString on ObjectQuery. + + + The query string. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + The underlying InternalContext. + + + + + The underlying ObjectQuery. + + + + + The underlying ObjectQuery. + + + + + The LINQ query expression. + + + + + The LINQ query provider for the underlying . + + + + + The IQueryable element type. + + + + + Creates a new query that will be backed by the given InternalContext. + + The backing context. + + + + Resets the set to its uninitialized state so that it will be re-lazy initialized the next + time it is used. This allows the ObjectContext backing a DbContext to be switched out. + + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Finds an entity in the state manager with the given primary key values, or returns null + if no such entity can be found. This includes looking for Added entities with the given + key values. + + + + + Finds an entity in the store with the given primary key values, or returns null + if no such entity can be found. This code is adapted from TryGetObjectByKey to + include type checking in the query. + + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + This method is virtual so that it can be mocked. + + The entity to attach. + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + This method is virtual so that it can be mocked. + + The entity to add. + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + This method is virtual so that it can be mocked. + + The entity to remove. + + + + This method checks whether an entity is already in the context. If it is, then the state + is changed to the new state given. If it isn't, then the action delegate is executed to + either Add or Attach the entity. + + A delegate to Add or Attach the entity. + The new state to give the entity if it is already in the context. + The entity. + Name of the method. + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Performs lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that the query can be used. + This method is virtual so that it can be mocked. + + + + + Attempts to perform lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that o-space loading has happened and the query can be used. This method doesn't throw if the type + for the set is not mapped. + + + + + Creates an underlying for this set. + + if set to true then the query is set to be no-tracking. + The query. + + + + Returns a representation of the underlying query, equivalent + to ToTraceString on ObjectQuery. + + + The query string. + + + + + Updates the underlying ObjectQuery with the given include path. + + The include path. + A new query containing the defined include path. + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Executes the given SQL query against the database materializing entities into the entity set that + backs this set. + + The SQL quey. + if true then the entities are not tracked, otherwise they are. + The parameters. + The query results. + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the ObservableCollection representing the local view for the set based on this query. + + + + + The underlying ObjectQuery. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet name. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet name, quoted for ESQL. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet. Accessing this property will trigger lazy initialization of the query. + + + + + The base type for the underlying entity set. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying InternalContext. Accessing this property will trigger lazy initialization of the query. + + + + + The LINQ query expression. + + + + + The LINQ query provider for the underlying . + + + + + A wrapping query provider that performs expression transformation and then delegates + to the provider. The objects returned + are always instances of when the generic CreateQuery method is + used and are instances of when the non-generic CreateQuery method + is used. This provider is associated with non-generic objects. + + + + + Creates a provider that wraps the given provider. + + The provider to wrap. + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a . + + + + + Delegates to the wrapped provider except returns instances of . + + + + + Creates an appropriate generic IQueryable using Reflection and the underlying ElementType of + the given ObjectQuery. + + + + + Extends to create a sortable binding list that stays in + sync with an underlying . That is, when items are added + or removed from the binding list, they are added or removed from the ObservableCollecion, and + vice-versa. + + The list element type. + + + + An extended BindingList implementation that implements sorting. + This class was adapted from the LINQ to SQL class of the same name. + + The element type. + + + + Initializes a new instance of the class with the + the given underlying list. Note that sorting is dependent on having an actual + rather than some other ICollection implementation. + + The list. + + + + Applies sorting to the list. + + The property to sort by. + The sort direction. + + + + Stops sorting. + + + + + Gets a value indicating whether this list is sorted. + + + true if this instance is sorted; otherwise, false. + + + + + Gets the sort direction. + + The sort direction. + + + + Gets the sort property being used to sort. + + The sort property. + + + + Returns true indicating that this list supports sorting. + + true. + + + + Implements comparing for the implementation. + + + + + Initializes a new instance of the class + for sorting the list. + + The property to sort by. + The sort direction. + + + + Compares two instances of items in the list. + + The left item to compare. + The right item to compare. + + + + + Determines whether this instance can sort for the specified type. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Determines whether this instance can sort for the specified type using IComparable. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Determines whether this instance can sort for the specified type using ToString. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Initializes a new instance of a binding list backed by the given + + The obervable collection. + + + + Creates a new item to be added to the binding list. + + The new item. + + + + Cancels adding of a new item that was started with AddNew. + + Index of the item. + + + + Removes all items from the binding list and underlying ObservableCollection. + + + + + Ends the process of adding a new item that was started with AddNew. + + Index of the item. + + + + Inserts the item into the binding list at the given index. + + The index. + The item. + + + + Removes the item at the specified index. + + The index. + + + + Sets the item into the list at the given position. + + The index to insert at. + The item. + + + + Event handler to update the binding list when the underlying observable collection changes. + + The sender. + Data indicating how the collection has changed. + + + + Adds the item to the underlying observable collection. + + The item. + + + + Removes the item from the underlying from observable collection. + + The item. + + + + Adapted from to allow the initializer to take an input object and + to do one-time initialization that only has side-effects and doesn't return a value. + + The type of the input. + + + + Initializes a new instance of the class. + + The action. + + + + Performs the action unless it has already been successfully performed before. + + The input to the action; ignored if the action has already succeeded. + + + + Adapted from to allow the initializer to take an input object and + to retry initialization if it has previously failed. + + + This class can only be used to initialize reference types that will not be null when + initialized. + + The type of the input. + The type of the result. + + + + Initializes a new instance of the class. + + The value factory. + + + + Gets the value, possibly by running the initializer if it has not been run before or + if all previous times it ran resulted in exceptions. + + The input to the initializer; ignored if initialization has already succeeded. + The initialized object. + + + + Validates a property of a given EDM complex type. + + + This is a composite validator for a complex property of an entity. + + + + + Validates a property of a given EDM property type. + + + This is a composite validator for a property of an entity or a complex type. + + + + + Simple validators for the corresponding property. + + + + + Name of the property the validator was created for. + + + + + Creates an instance of for a given EDM property. + + The EDM property name. + Validators used to validate the given property. + + + + Validates a property. + + Validation context. Never null. + Property to validate. Never null. + Validation errors as . Empty if no errors. Never null. + + + + + Simple validators for the corresponding property. + + + + + Gets the name of the property the validator was created for. + + + + + The complex type validator. + + + + + Creates an instance of for a given complex property. + + The complex property name. + Validators used to validate the given property. + Complex type validator. + + + + Validates a complex property. + + Validation context. Never null. + Property to validate. Never null. + Validation errors as . Empty if no errors. Never null. + + + + + Validator used to validate a property of a given EDM ComplexType. + + + This is a composite validator. + + + + + Validator used to validate an entity of a given EDM Type. + + + This is a composite validator for an EDM Type. + + + + + Creates an instance for a given EDM type. + + Property validators. + Type level validators. + + + + Validates an instance. + + Entity validation context. Must not be null. + The entry for the complex property. Null if validating an entity. + instance. Never null. + + Protected so it doesn't appear on EntityValidator. + + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Returns a validator for a child property. + + Name of the child property for which to return a validator. + + Validator for a child property. Possibly null if there are no validators for requested property. + + + + + Creates an instance for a given EDM complex type. + + Property validators. + Type level validators. + + + + Validates an instance. + + Entity validation context. Must not be null. + The entry for the complex property. Null if validating an entity. + instance. Never null. + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Contains information needed to validate an entity or its properties. + + + + + The entity being validated or the entity that owns the property being validated. + + + + + Initializes a new instance of EntityValidationContext class. + + + The entity being validated or the entity that owns the property being validated. + + + External contexts needed for validation. + + + + + External context needed for validation. + + + + + Gets the entity being validated or the entity that owns the property being validated. + + + + + Validator used to validate an entity of a given EDM EntityType. + + + This is a top level, composite validator. This is also an entry point to getting an entity + validated as validation of an entity is always started by calling Validate method on this type. + + + + + Creates an instance for a given EDM entity type. + + Property validators. + Entity type level validators. + + + + Validates an entity. + + Entity validation context. Must not be null. + instance. Never null. + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Builds validators based on s specified on entity CLR types and properties + as well as based on presence of implementation on entity and complex + type CLR types. It's not sealed and not static for mocking purposes. + + + + + Builds an for the given . + + The entity entry to build the validator for. + Whether the currently processed type is the target type or one of the ancestor types. + + + for the given . Possibly null + if no validation has been specified for this entity type. + + + + + Builds the validator for a given and the corresponding + . + + The CLR type that corresponds to the EDM complex type. + The EDM complex type that type level validation is built for. + A for the given complex type. May be null if no validation specified. + + + + Extracted method from BuildEntityValidator and BuildComplexTypeValidator + + + + + Build validators for the and the corresponding + or . + + Properties to build validators for. + Non-navigation EDM properties. + Navigation EDM properties. + A list of validators. Possibly empty, never null. + + + + Builds a for the given and the corresponding + . If the property is a complex type, type level validators will be built here as + well. + + The CLR property to build the validator for. + The EDM property to build the validator for. + + for the given . Possibly null + if no validation has been specified for this property. + + + + + Builds a for the given transient . + + The CLR property to build the validator for. + + for the given . Possibly null + if no validation has been specified for this property. + + + + + Builds s for given that derive from + . + + Attributes used to build validators. + + A list of s built from . + Possibly empty, never null. + + + + + Returns all non-static non-indexed CLR properties from the . + + The CLR to get the properties from. + + A collection of CLR properties. Possibly empty, never null. + + + + + Builds validators based on the facets of : + * If .Nullable facet set to false adds a validator equivalent to the RequiredAttribute + * If the .MaxLength facet is specified adds a validator equivalent to the MaxLengthAttribute. + However the validator isn't added if .IsMaxLength has been set to true. + + The CLR property to build the facet validators for. + The property for which facet validators will be created + A collection of validators. + + + + Abstracts simple validators used to validate entities and properties. + + + + + Validates an entity or a property. + + Validation context. Never null. + Property to validate. Can be null for type level validation. + Validation error as. Empty if no errors. Never null. + + + + + Contract for IValidator.Validate method. + + Validation context. + Property. + Nothing - always throws. + + + + Validates entities or complex types implementing IValidatableObject interface. + + + + + Display attribute used to specify the display name for an entity or complex property. + + + + + Validates an entity or a complex type implementing IValidatableObject interface. + This method is virtual to allow mocking. + + Validation context. Never null. + + Property to validate. Null if this is the entity that will be validated. Never null if this + is the complex type that will be validated. + + Validation error as . Empty if no errors. Never null. + + + Note that is used to figure out what needs to be validated. If it not null the complex + type will be validated otherwise the entity will be validated. + Also if this is an IValidatableObject complex type but the instance (.CurrentValue) is null we won't validate + anything and will not return any errors. The reason for this is that Validation is supposed to validate using + information the user provided and not some additional implicit rules. (ObjectContext will throw for operations + that involve null complex properties). + + + + + Validates a property, complex property or an entity using validation attributes the property + or the complex/entity type is decorated with. + + + Note that this class is used for validating primitive properties using attributes declared on the property + (property level validation) and complex properties and entities using attributes declared on the type + (type level validation). + + + + + Display attribute used to specify the display name for a property or entity. + + + + + Validation attribute used to validate a property or an entity. + + + + + Creates an instance of class. + + + Validation attribute used to validate a property or an entity. + + + + + Validates a property or an entity. + + Validation context. Never null. + Property to validate. Null for entity validation. Not null for property validation. + + + Validation errors as . Empty if no errors, never null. + + + + + Used to cache and retrieve generated validators and to create context for validating entities or properties. + + + + + Collection of validators keyed by the entity CLR type. Note that if there's no validation for a given type + it will be associated with a null validator. + + + + + Initializes a new instance of class. + + + + + Returns a validator to validate . + + Entity the validator is requested for. + + to validate . Possibly null if no validation + has been specified for the entity. + + + + + Returns a validator to validate . + + Navigation property the validator is requested for. + + Validator to validate . Possibly null if no validation + has been specified for the requested property. + + + + + Gets a validator for the . + + Entity validator. + Property to get a validator for. + + Validator to validate . Possibly null if there is no validation for the + . + + + For complex properties this method walks up the type hierarchy to get to the entity level and then goes down + and gets a validator for the child property that is an ancestor of the property to validate. If a validator + returned for an ancestor is null it means that there is no validation defined beneath and the method just + propagates (and eventually returns) null. + + + + + Creates for . + + Entity entry for which a validation context needs to be created. + User defined dictionary containing additional info for custom validation. This parameter is optional and can be null. + An instance of class. + + + + + A wrapper around EntityKey that allows key/values pairs that have null values to + be used. This allows Added entities with null key values to be searched for in + the ObjectStateManager. + + + + The key name/key value pairs, where some key values may be null + + + + Creates a new WrappedEntityKey instance. + + The entity set that the key belongs to. + The fully qualified name of the given entity set. + The key values, which may be null or contain null values. + The name of the parameter passed for keyValue by the user, which is used when throwing exceptions. + + + + True if any of the key values are null, which means that the EntityKey will also be null. + + + + + An actual EntityKey, or null if any of the key values are null. + + + + + The key name/key value pairs of the key, in which some of the key values may be null. + + + + + Allows configuration to be performed for an complex type in a model. + + A ComplexTypeConfiguration can be obtained via the ComplexType method on + or a custom type derived from ComplexTypeConfiguration + can be registered via the Configurations property on . + + The complex type to be configured. + + + + Allows configuration to be performed for a type in a model. + + The type to be configured. + + + + Configures a property that is defined on this type. + + The type of the property being configured. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + The type of the property being configured. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Excludes a property from the model so that it will not be mapped to the database. + + The type of the property to be ignored. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + + + + Initializes a new instance of ComplexTypeConfiguration + + + + + Allows derived configuration classes for entities and complex types to be registered with a . + + + Derived configuration classes are created by deriving from + or and using a type to be included in the model as the generic + parameter. + + Configuration can be performed without creating derived configuration classes via the Entity and ComplexType + methods on . + + + + + Adds an to the . + Only one can be added for each type in a model. + + The entity type being configured. + The entity type configuration to be added. + The same ConfigurationRegistrar instance so that multiple calls can be chained. + + + + Adds an to the . + Only one can be added for each type in a model. + + The complex type being configured. + The complex type configuration to be added + The same ConfigurationRegistrar instance so that multiple calls can be chained. + + + + Allows the conventions used by a instance to be customized. + Currently removal of one or more default conventions is the only supported operation. + The default conventions can be found in the System.Data.Entity.ModelConfiguration.Conventions namespace. + + + + + Disables a convention for the . + The default conventions that are available for removal can be found in the System.Data.Entity.ModelConfiguration.Conventions namespace. + + The type of the convention to be disabled. + + + + Configures the table and column mapping for an entity type or a sub-set of properties from an entity type. + This configuration functionality is available via the Code First Fluent API, see . + + The entity type to be mapped. + + + + Configures the properties that will be included in this mapping fragment. + If this method is not called then all properties that have not yet been + included in a mapping fragment will be configured. + + An anonymous type including the properties to be mapped. + + A lambda expression to an anonymous type that contains the properties to be mapped. + C#: t => new { t.Id, t.Property1, t.Property2 } + VB.Net: Function(t) New With { p.Id, t.Property1, t.Property2 } + + + + + Re-maps all properties inherited from base types. + + When configuring a derived type to be mapped to a separate table this will cause all properties to + be included in the table rather than just the non-inherited properties. This is known as + Table per Concrete Type (TPC) mapping. + + + + + Configures the table name to be mapped to. + + Name of the table. + + + + Configures the table name and schema to be mapped to. + + Name of the table. + Schema of the table. + + + + Configures the discriminator column used to differentiate between types in an inheritance hierarchy. + + The name of the discriminator column. + A configuration object to further configure the discriminator column and values. + + + + Configures the discriminator condition used to differentiate between types in an inheritance hierarchy. + + The type of the property being used to discriminate between types. + + A lambda expression representing the property being used to discriminate between types. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object to further configure the discriminator condition. + + + + Moves a foreign key constraint from oldTable to newTable and updates column references + + + + + Move any FK constraints that are now completely in newTable and used to refer to oldColumn + + + + + Configures a condition used to discriminate between types in an inheritance hierarchy based on the values assigned to a property. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the condition to require a value in the property. + + Rows that do not have a value assigned to column that this property is stored in are + assumed to be of the base type of this entity type. + + + + + Populate the table mapping structure + + + + + Sets nullability for association set mappings' foreign keys for 1:* and 1:0..1 associations + when no base types share the the association set mapping's table + + + + + Makes sure only the required property mappings are present + + + + + Determines if the table and entity type need mapping, and if not, removes the existing entity type mapping + + + + + Configures a database column used to store a string values. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the column to allow the maximum length supported by the database provider. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + + Configures the column to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be variable length. + Columns are variable length by default. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be optional. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be required. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column. + + Name of the database provider specific data type. + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column. + + The order that this column should appear in the database table. + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to support Unicode string content. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the column supports Unicode string content. + + + Value indicating if the column supports Unicode string content or not. + Specifying 'null' will remove the Unicode facet from the column. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures a discriminator column used to differentiate between types in an inheritance hierarchy. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + Type of the discriminator value. + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + Type of the discriminator value. + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Initializes configurations in the ModelConfiguration so that configuration data + is in a single place + + + + + Configures a many relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be many:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:required with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:required without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:optional with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:optional without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures an optional relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be optional:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:required with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:required without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + + A lambda expression representing the navigation property on the other end of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + A configuration object that can be used to further configure the relationship. + + + + Configures an required relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be required:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:optional with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:optional without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required with a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required without a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required with a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required without a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + A configuration object that can be used to further configure the relationship. + + + + Base class for configuring a property on an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + True if the NavigationProperty's declaring type is the principal end, false if it is not, null if it is not known + + + + + Base class for performing configuration of a relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures a relationship that can support cascade on delete functionality. + + + + + Configures cascade delete to be on for the relationship. + + + + + Configures whether or not cascade delete is on for the relationship. + + Value indicating if cascade delete is on or not. + + + + Configures a relationship that can support foreign key properties that are exposed in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + The dependent entity type. + + + + Configures a relationship that can only support foreign key properties that are not exposed in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the relationship to use foreign key property(s) that are not exposed in the object model. + The column(s) and table can be customized by specifying a configuration action. + If an empty configuration action is specified then column name(s) will be generated by convention. + If foreign key properties are exposed in the object model then use the HasForeignKey method. + Not all relationships support exposing foreign key properties in the object model. + + Action that configures the foreign key column(s) and table. + + A configuration object that can be used to further configure the relationship. + + + + + Configures the relationship to use foreign key property(s) that are exposed in the object model. + If the foreign key property(s) are not exposed in the object model then use the Map method. + + The type of the key. + + A lambda expression representing the property to be used as the foreign key. + If the foreign key is made up of multiple properties then specify an anonymous type including the properties. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the principal entity type. + + A configuration object that can be used to further configure the relationship. + + + + Configures the table and column mapping of a relationship that does not expose foreign key properties in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the name of the column(s) for the foreign key. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table name that the foreign key column(s) reside in. + The table that is specified must already be mapped for the entity type. + + If you want the foreign key(s) to reside in their own table then use the Map method + on to perform + entity splitting to create the table with just the primary key property. Foreign keys can + then be added to the table via this method. + + Name of the table. + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table name and schema that the foreign key column(s) reside in. + The table that is specified must already be mapped for the entity type. + + If you want the foreign key(s) to reside in their own table then use the Map method + on to perform + entity splitting to create the table with just the primary key property. Foreign keys can + then be added to the table via this method. + + Name of the table. + Schema of the table. + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table and column mapping of a many:many relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the join table name for the relationship. + + Name of the table. + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the join table name and schema for the relationship. + + Name of the table. + Schema of the table. + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the column(s) for the left foreign key. + The left foreign key represents the navigation property specified in the HasMany call. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the column(s) for the right foreign key. + The right foreign key represents the navigation property specified in the WithMany call. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures a many:many relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the foreign key column(s) and table used to store the relationship. + + Action that configures the foreign key column(s) and table. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Used to configure a property with length facets for an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Used to configure a primitive property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to allow the maximum length supported by the database provider. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property and a default length will be used for the database column. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + Properties are variable length by default. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to allow the maximum length supported by the database provider. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + properties are variable length by default. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + properties are optional by default. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be a row version in the database. + The actual data type will vary depending on the database provider being used. + Setting the property to be a row version will automatically configure it to be an + optimistic concurrency token. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + properties are required by default. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the precision of the property. + If the database provider does not support precision for the data type of the column then the value is ignored. + + Precision of the property. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + properties are required by default. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the precision and scale of the property. + + The precision of the property. + The scale of the property. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to allow the maximum length supported by the database provider. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property and a default length will be used for the database column.. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + properties are variable length by default. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + properties are optional by default. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to support Unicode string content. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property supports Unicode string content. + + + Value indicating if the property supports Unicode string content or not. + Specifying 'null' will remove the Unicode facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Indicates what parts of a configuration are overridable. + + + + + Nothing in the configuration is overridable. + + + + + The configuration values related to C-Space are overridable. + + + + + The configuration values only related to S-Space are overridable. + + + + + True if this configuration can be replaced in the model configuration, false otherwise + This is only set to true for configurations that are registered automatically via the DbContext + + + + + Base class for conventions that process CLR attributes found in the model. + + The type of member to look for. + The type of the configuration to look for. + The type of the attribute to look for. + + + + Convention to process instances of found on properties in the model + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on foreign key properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on navigation properties in the model. + + + + + Convention to process instances of found on primitive properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to detect navigation properties to be inverses of each other when only one pair + of navigation properties exists between the related types. + + + + + Convention to configure a type as a complex type if it has no primary key, no mapped base type and no navigation properties. + + + + + Convention to convert any data types that were explicitly specified, via data annotations or API, + to be lower case. The default SqlClient provider is case sensitive and requires data types to be lower case. This convention + allows the and API to be case insensitive. + + + + + Convention to add a cascade delete to the join table from both tables involved in a many to many relationship. + + + + + Convention to ensure an invalid/unsupported mapping is not created when mapping inherited properties + + + + + Convention to set the table name to be a pluralized version of the entity type name. + + + + + Convention to set precision to 18 and scale to 2 for decimal properties. + + + + + Convention to move primary key properties to appear first. + + + + + Convention to distinguish between optional and required relationships based on CLR nullability of the foreign key property. + + + + + Convention to process instances of found on navigation properties in the model. + + + + + Convention to detect primary key properties. + Recognized naming patterns in order of precedence are: + 1. 'Id' + 2. [type name]Id + Primary key detection is case insensitive. + + + + + Convention to discover foreign key properties whose names are a combination + of the dependent navigation property name and the principal type primary key property name(s). + + + + + Convention to enable cascade delete for any required relationships. + + + + + Convention to configure the primary key(s) of the dependent entity type as foreign key(s) in a one:one relationship. + + + + + Convention to set the entity set name to be a pluralized version of the entity type name. + + + + + Convention to discover foreign key properties whose names match the principal type primary key property name(s). + + + + + Convention to set a default maximum length of 128 for properties whose type supports length facets. + + + + + Convention to set a default maximum length of 4000 for properties whose type supports length facets when SqlCe is the provider. + + + + + Convention to configure integer primary keys to be identity. + + + + + Checks for the PK property being an FK in a different table. A PK which is also an FK but + in the same table is used for table splitting and can still be an identity column because + the update pipeline is only inserting into one column of one table. + + + + + Convention to discover foreign key properties whose names are a combination + of the principal type name and the principal type primary key property name(s). + + + + + This class provide service for both the singularization and pluralization, it takes the word pairs + in the ctor following the rules that the first one is singular and the second one is plural. + + + + + Factory method for PluralizationService. Only support english pluralization. + Please set the PluralizationService on the System.Data.Entity.Design.EntityModelSchemaGenerator + to extend the service to other locales. + + CultureInfo + PluralizationService + + + + captalize the return word if the parameter is capitalized + if word is "Table", then return "Tables" + + + + + + + + separate one combine word in to two parts, prefix word and the last word(suffix word) + + + + + + + + return true when the word is "[\s]*" or leading or tailing with spaces + or contains non alphabetical characters + + + + + + + This method allow you to add word to internal PluralizationService of English. + If the singluar or the plural value was already added by this method, then an ArgumentException will be thrown. + + + + + + + Attempt to determine the principal and dependent ends of this association. + + The following table illustrates the solution space. + + Source | Target || Prin | Dep | + -------|--------||-------|-------| + 1 | 1 || - | - | + 1 | 0..1 || Sr | Ta | + 1 | * || Sr | Ta | + 0..1 | 1 || Ta | Sr | + 0..1 | 0..1 || - | - | + 0..1 | * || Sr | Ta | + * | 1 || Ta | Sr | + * | 0..1 || Ta | Sr | + * | * || - | - | + + + + + Allows configuration to be performed for an entity type in a model. + + An EntityTypeConfiguration can be obtained via the Entity method on + or a custom type derived from EntityTypeConfiguration + can be registered via the Configurations property on . + + + + + Initializes a new instance of EntityTypeConfiguration + + + + + Configures the primary key property(s) for this entity type. + + The type of the key. + + A lambda expression representing the property to be used as the primary key. + C#: t => t.Id + VB.Net: Function(t) t.Id + + If the primary key is made up of multiple properties then specify an anonymous type including the properties. + C#: t => new { t.Id1, t.Id2 } + VB.Net: Function(t) New With { t.Id1, t.Id2 } + + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures the entity set name to be used for this entity type. + The entity set name can only be configured for the base type in each set. + + The name of the entity set. + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures the table name that this entity type is mapped to. + + The name of the table. + + + + Configures the table name that this entity type is mapped to. + + The name of the table. + The database schema of the table. + + + + Allows advanced configuration related to how this entity type is mapped to the database schema. + By default, any configuration will also apply to any type derived from this entity type. + + Derived types can be configured via the overload of Map that configures a derived type or + by using an EntityTypeConfiguration for the derived type. + + The properties of an entity can be split between multiple tables using multiple Map calls. + + Calls to Map are additive, subsequent calls will not override configuration already preformed via Map. + + An action that performs configuration against an . + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Allows advanced configuration related to how a derived entity type is mapped to the database schema. + Calls to Map are additive, subsequent calls will not override configuration already preformed via Map. + + The derived entity type to be configured. + An action that performs configuration against an . + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures an optional relationship from this entity type. + Instances of the entity type will be able to be saved to the database without this relationship being specified. + The foreign key in the database will be nullable. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures a required relationship from this entity type. + Instances of the entity type will not be able to be saved to the database unless this relationship is specified. + The foreign key in the database will be non-nullable. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures a many relationship from this entity type. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Handles mapping from a CLR property to an EDM assocation and nav. prop. + + + + + Exception thrown by during model creation when an invalid model is generated. + + + + + Initializes a new instance of ModelValidationException + + + + + Initializes a new instance of ModelValidationException + + The exception message. + + + + Initializes a new instance of ModelValidationException + + The exception message. + The inner exception. + + + + Code Contracts hook methods - Called when contracts fail. Here we detect the most common preconditions + so we can throw the correct exceptions. It also means that we can write preconditions using the + simplest Contract.Requires() form. + + + + + Returns true if a variable of this type can be assigned a null value + + + + True if a reference type or a nullable value type, + false otherwise + + + + + Exception thrown from when validating entities fails. + + + + + Initializes a new instance of DbEntityValidationException + + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + Validation results. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + The inner exception. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + Validation results. + The inner exception. + + + + Subscribes the SerializeObjectState event. + + + + + Validation results. + + + + + Holds exception state that will be serialized when the exception is serialized. + + + + + Validation results. + + + + + Completes the deserialization. + + The deserialized object. + + + + Validation results. + + + + + Represents validation results for single entity. + + + + + Entity entry the results applies to. Never null. + + + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Creates an instance of class. + + + Entity entry the results applies to. Never null. + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Creates an instance of class. + + + Entity entry the results applies to. Never null. + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Gets an instance of the results applies to. + + + + + Gets validation errors. Never null. + + + + + Gets an indicator if the entity is valid. + + + + + Exception thrown from when an exception is thrown from the validation + code. + + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + The inner exception. + + + + Initializes a new instance of DbUnexpectedValidationException with the specified serialization info and + context. + + The serialization info. + The streaming context. + + + + Validation error. Can be either entity or property level validation error. + + + + + Name of the invalid property. Can be null (e.g. for entity level validations) + + + + + Validation error message. + + + + + Creates an instance of . + + Name of the invalid property. Can be null. + Validation error message. Can be null. + + + + Gets name of the invalid property. + + + + + Gets validation error message. + + + + diff --git a/TestApps/LOCTester/bin/Release/LOC.Core.dll b/TestApps/LOCTester/bin/Release/LOC.Core.dll new file mode 100644 index 000000000..e4c321427 Binary files /dev/null and b/TestApps/LOCTester/bin/Release/LOC.Core.dll differ diff --git a/TestApps/LOCTester/bin/Release/LOC.Core.pdb b/TestApps/LOCTester/bin/Release/LOC.Core.pdb new file mode 100644 index 000000000..ec97895a6 Binary files /dev/null and b/TestApps/LOCTester/bin/Release/LOC.Core.pdb differ diff --git a/TestApps/LOCTester/bin/Release/LOCTester.exe b/TestApps/LOCTester/bin/Release/LOCTester.exe new file mode 100644 index 000000000..6c6821d9b Binary files /dev/null and b/TestApps/LOCTester/bin/Release/LOCTester.exe differ diff --git a/TestApps/LOCTester/bin/Release/LOCTester.exe.config b/TestApps/LOCTester/bin/Release/LOCTester.exe.config new file mode 100644 index 000000000..2bd078d0c --- /dev/null +++ b/TestApps/LOCTester/bin/Release/LOCTester.exe.config @@ -0,0 +1,18 @@ + + + + +
+ + + + + + \ No newline at end of file diff --git a/TestApps/LOCTester/bin/Release/LOCTester.pdb b/TestApps/LOCTester/bin/Release/LOCTester.pdb new file mode 100644 index 000000000..fb1cf793b Binary files /dev/null and b/TestApps/LOCTester/bin/Release/LOCTester.pdb differ diff --git a/TestApps/LOCTester/bin/Release/LOCTester.vshost.exe b/TestApps/LOCTester/bin/Release/LOCTester.vshost.exe new file mode 100644 index 000000000..bb84a51ac Binary files /dev/null and b/TestApps/LOCTester/bin/Release/LOCTester.vshost.exe differ diff --git a/TestApps/LOCTester/bin/Release/LOCTester.vshost.exe.config b/TestApps/LOCTester/bin/Release/LOCTester.vshost.exe.config new file mode 100644 index 000000000..2bd078d0c --- /dev/null +++ b/TestApps/LOCTester/bin/Release/LOCTester.vshost.exe.config @@ -0,0 +1,18 @@ + + + + +
+ + + + + + \ No newline at end of file diff --git a/TestApps/LOCTester/bin/Release/LOCTester.vshost.exe.manifest b/TestApps/LOCTester/bin/Release/LOCTester.vshost.exe.manifest new file mode 100644 index 000000000..061c9ca95 --- /dev/null +++ b/TestApps/LOCTester/bin/Release/LOCTester.vshost.exe.manifest @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/TestApps/LOCTester/bin/Release/Newtonsoft.Json.dll b/TestApps/LOCTester/bin/Release/Newtonsoft.Json.dll new file mode 100644 index 000000000..dc9283f4c Binary files /dev/null and b/TestApps/LOCTester/bin/Release/Newtonsoft.Json.dll differ diff --git a/TestApps/LOCTester/bin/Release/Newtonsoft.Json.xml b/TestApps/LOCTester/bin/Release/Newtonsoft.Json.xml new file mode 100644 index 000000000..ee891563c --- /dev/null +++ b/TestApps/LOCTester/bin/Release/Newtonsoft.Json.xml @@ -0,0 +1,7343 @@ + + + + Newtonsoft.Json + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class with the specified . + + + + + Reads the next JSON token from the stream. + + true if the next token was read successfully; false if there are no more tokens to read. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Skips the children of the current token. + + + + + Sets the current token. + + The new token. + + + + Sets the current token and value. + + The new token. + The value. + + + + Sets the state based on current token type. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Releases unmanaged and - optionally - managed resources + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Changes the to Closed. + + + + + Gets the current reader state. + + The current reader state. + + + + Gets or sets a value indicating whether the underlying stream or + should be closed when the reader is closed. + + + true to close the underlying stream or when + the reader is closed; otherwise false. The default is true. + + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + Get or set how time zones are handling when reading JSON. + + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Gets the type of the current JSON token. + + + + + Gets the text value of the current JSON token. + + + + + Gets The Common Language Runtime (CLR) type for the current JSON token. + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Gets the path of the current JSON token. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Specifies the state of the reader. + + + + + The Read method has not been called. + + + + + The end of the file has been reached successfully. + + + + + Reader is at a property. + + + + + Reader is at the start of an object. + + + + + Reader is in an object. + + + + + Reader is at the start of an array. + + + + + Reader is in an array. + + + + + The Close method has been called. + + + + + Reader has just read a value. + + + + + Reader is at the start of a constructor. + + + + + Reader in a constructor. + + + + + An error occurred that prevents the read operation from continuing. + + + + + The end of the file has been reached successfully. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The reader. + + + + Initializes a new instance of the class. + + The stream. + if set to true the root object will be read as a JSON array. + The used when reading values from BSON. + + + + Initializes a new instance of the class. + + The reader. + if set to true the root object will be read as a JSON array. + The used when reading values from BSON. + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + + A . This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Changes the to Closed. + + + + + Gets or sets a value indicating whether binary data reading should compatible with incorrect Json.NET 3.5 written binary. + + + true if binary data reading will be compatible with incorrect Json.NET 3.5 written binary; otherwise, false. + + + + + Gets or sets a value indicating whether the root object will be read as a JSON array. + + + true if the root object will be read as a JSON array; otherwise, false. + + + + + Gets or sets the used when reading values from BSON. + + The used when reading values from BSON. + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Creates an instance of the JsonWriter class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the end of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the end of an array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end constructor. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes the end of the current Json object or array. + + + + + Writes the current token. + + The to read the token from. + + + + Writes the specified end token. + + The end token to write. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON without changing the writer's state. + + The raw JSON to write. + + + + Writes raw JSON where a value is expected and updates the writer's state. + + The raw JSON to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + An error will raised if the value cannot be written as a single JSON token. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Gets or sets a value indicating whether the underlying stream or + should be closed when the writer is closed. + + + true to close the underlying stream or when + the writer is closed; otherwise false. The default is true. + + + + + Gets the top. + + The top. + + + + Gets the state of the writer. + + + + + Gets the path of the writer. + + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling when writing JSON. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The writer. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Writes the end. + + The token. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes raw JSON where a value is expected and updates the writer's state. + + The raw JSON to write. + + + + Writes the beginning of a Json array. + + + + + Writes the beginning of a Json object. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Closes this stream and the underlying stream. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value that represents a BSON object id. + + + + + + Writes a BSON regex. + + The regex pattern. + The regex options. + + + + Gets or sets the used when writing values to BSON. + When set to no conversion will occur. + + The used when writing values to BSON. + + + + Represents a BSON Oid (object id). + + + + + Initializes a new instance of the class. + + The Oid value. + + + + Gets or sets the value of the Oid. + + The value of the Oid. + + + + Converts a binary value to and from a base 64 string value. + + + + + Converts an object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets the of the JSON produced by the JsonConverter. + + The of the JSON produced by the JsonConverter. + + + + Gets a value indicating whether this can read JSON. + + true if this can read JSON; otherwise, false. + + + + Gets a value indicating whether this can write JSON. + + true if this can write JSON; otherwise, false. + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Create a custom object + + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Creates an object which will then be populated by the serializer. + + Type of the object. + + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets a value indicating whether this can write JSON. + + + true if this can write JSON; otherwise, false. + + + + + Provides a base class for converting a to and from JSON. + + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an Entity Framework EntityKey to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an ExpandoObject to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets a value indicating whether this can write JSON. + + + true if this can write JSON; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON and BSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON and BSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an to and from its name string value. + + + Converts an to and from its name string value. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + A cached representation of the Enum string representation to respect per Enum field name. + + The type of the Enum. + A map of enum field name to either the field name, or the configured enum member name (). + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets or sets a value indicating whether the written enum text should be camel case. + + true if the written enum text will be camel case; otherwise, false. + + + + Specifies how constructors are used when initializing objects during deserialization by the . + + + + + First attempt to use the public default constructor, then fall back to single paramatized constructor, then the non-public default constructor. + + + + + Json.NET will use a non-public default constructor before falling back to a paramatized constructor. + + + + + Converts a to and from a string (e.g. "1.2.3.4"). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing property value of the JSON that is being converted. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Specifies how dates are formatted when writing JSON text. + + + + + Dates are written in the ISO 8601 format, e.g. "2012-03-21T05:40Z". + + + + + Dates are written in the Microsoft JSON format, e.g. "\/Date(1198908717056)\/". + + + + + Specifies how to treat the time value when converting between string and . + + + + + Treat as local time. If the object represents a Coordinated Universal Time (UTC), it is converted to the local time. + + + + + Treat as a UTC. If the object represents a local time, it is converted to a UTC. + + + + + Treat as a local time if a is being converted to a string. + If a string is being converted to , convert to a local time if a time zone is specified. + + + + + Time zone information should be preserved when converting. + + + + + Specifies formatting options for the . + + + + + No special formatting is applied. This is the default. + + + + + Causes child objects to be indented according to the and settings. + + + + + Instructs the to use the specified constructor when deserializing that object. + + + + + Represents a raw JSON string. + + + + + Represents a value in JSON (string, integer, date, etc). + + + + + Represents an abstract JSON token. + + + + + Represents a collection of objects. + + The type of token + + + + Gets the with the specified key. + + + + + + Provides an interface to enable a class to return line and position information. + + + + + Gets a value indicating whether the class can return line information. + + + true if LineNumber and LinePosition can be provided; otherwise, false. + + + + + Gets the current line number. + + The current line number or 0 if no line information is available (for example, HasLineInfo returns false). + + + + Gets the current line position. + + The current line position or 0 if no line information is available (for example, HasLineInfo returns false). + + + + Compares the values of two tokens, including the values of all descendant tokens. + + The first to compare. + The second to compare. + true if the tokens are equal; otherwise false. + + + + Adds the specified content immediately after this token. + + A content object that contains simple content or a collection of content objects to be added after this token. + + + + Adds the specified content immediately before this token. + + A content object that contains simple content or a collection of content objects to be added before this token. + + + + Returns a collection of the ancestor tokens of this token. + + A collection of the ancestor tokens of this token. + + + + Returns a collection of the sibling tokens after this token, in document order. + + A collection of the sibling tokens after this tokens, in document order. + + + + Returns a collection of the sibling tokens before this token, in document order. + + A collection of the sibling tokens before this token, in document order. + + + + Gets the with the specified key converted to the specified type. + + The type to convert the token to. + The token key. + The converted token value. + + + + Returns a collection of the child tokens of this token, in document order. + + An of containing the child tokens of this , in document order. + + + + Returns a collection of the child tokens of this token, in document order, filtered by the specified type. + + The type to filter the child tokens on. + A containing the child tokens of this , in document order. + + + + Returns a collection of the child values of this token, in document order. + + The type to convert the values to. + A containing the child values of this , in document order. + + + + Removes this token from its parent. + + + + + Replaces this token with the specified token. + + The value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Returns the indented JSON for this token. + + + The indented JSON for this token. + + + + + Returns the JSON for this token using the given formatting and converters. + + Indicates how the output is formatted. + A collection of which will be used when writing the token. + The JSON for this token using the given formatting and converters. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Creates an for this token. + + An that can be used to read this token and its descendants. + + + + Creates a from an object. + + The object that will be used to create . + A with the value of the specified object + + + + Creates a from an object using the specified . + + The object that will be used to create . + The that will be used when reading the object. + A with the value of the specified object + + + + Creates the specified .NET type from the . + + The new object created from the JSON value. + + + + Creates the specified .NET type from the using the specified . + + The that will be used when creating the object. + The new object created from the JSON value. + + + + Creates a from a . + + An positioned at the token to read into this . + + An that contains the token and its descendant tokens + that were read from the reader. The runtime type of the token is determined + by the token type of the first token encountered in the reader. + + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from a . + + An positioned at the token to read into this . + + An that contains the token and its descendant tokens + that were read from the reader. The runtime type of the token is determined + by the token type of the first token encountered in the reader. + + + + + Selects the token that matches the object path. + + + The object path from the current to the + to be returned. This must be a string of property names or array indexes separated + by periods, such as Tables[0].DefaultView[0].Price in C# or + Tables(0).DefaultView(0).Price in Visual Basic. + + The that matches the object path or a null reference if no matching token is found. + + + + Selects the token that matches the object path. + + + The object path from the current to the + to be returned. This must be a string of property names or array indexes separated + by periods, such as Tables[0].DefaultView[0].Price in C# or + Tables(0).DefaultView(0).Price in Visual Basic. + + A flag to indicate whether an error should be thrown if no token is found. + The that matches the object path. + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Creates a new instance of the . All child tokens are recursively cloned. + + A new instance of the . + + + + Gets a comparer that can compare two tokens for value equality. + + A that can compare two nodes for value equality. + + + + Gets or sets the parent. + + The parent. + + + + Gets the root of this . + + The root of this . + + + + Gets the node type for this . + + The type. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Gets the next sibling token of this node. + + The that contains the next sibling token. + + + + Gets the previous sibling token of this node. + + The that contains the previous sibling token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Get the first child token of this token. + + A containing the first child token of the . + + + + Get the last child token of this token. + + A containing the last child token of the . + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Creates a comment with the given value. + + The value. + A comment with the given value. + + + + Creates a string with the given value. + + The value. + A string with the given value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Indicates whether the current object is equal to another object of the same type. + + + true if the current object is equal to the parameter; otherwise, false. + + An object to compare with this object. + + + + Determines whether the specified is equal to the current . + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + + The parameter is null. + + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format. + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format provider. + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format. + The format provider. + + A that represents this instance. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. + + An object to compare with this instance. + + A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: + Value + Meaning + Less than zero + This instance is less than . + Zero + This instance is equal to . + Greater than zero + This instance is greater than . + + + is not the same type as this instance. + + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Gets the node type for this . + + The type. + + + + Gets or sets the underlying token value. + + The underlying token value. + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class. + + The raw json. + + + + Creates an instance of with the content of the reader's current token. + + The reader. + An instance of with the content of the reader's current token. + + + + Indicating whether a property is required. + + + + + The property is not required. The default state. + + + + + The property must be defined in JSON but can be a null value. + + + + + The property must be defined in JSON and cannot be a null value. + + + + + Contract details for a used by the . + + + + + Contract details for a used by the . + + + + + Gets the underlying type for the contract. + + The underlying type for the contract. + + + + Gets or sets the type created during deserialization. + + The type created during deserialization. + + + + Gets or sets whether this type contract is serialized as a reference. + + Whether this type contract is serialized as a reference. + + + + Gets or sets the default for this contract. + + The converter. + + + + Gets or sets the method called immediately after deserialization of the object. + + The method called immediately after deserialization of the object. + + + + Gets or sets the method called during deserialization of the object. + + The method called during deserialization of the object. + + + + Gets or sets the method called after serialization of the object graph. + + The method called after serialization of the object graph. + + + + Gets or sets the method called before serialization of the object. + + The method called before serialization of the object. + + + + Gets or sets the default creator method used to create the object. + + The default creator method used to create the object. + + + + Gets or sets a value indicating whether the default creator is non public. + + true if the default object creator is non-public; otherwise, false. + + + + Gets or sets the method called when an error is thrown during the serialization of the object. + + The method called when an error is thrown during the serialization of the object. + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets the object's properties. + + The object's properties. + + + + Gets or sets the property name resolver. + + The property name resolver. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the ISerializable object constructor. + + The ISerializable object constructor. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Get and set values for a using dynamic methods. + + + + + Provides methods to get and set values. + + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + Initializes a new instance of the class. + + The member info. + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + Provides data for the Error event. + + + + + Initializes a new instance of the class. + + The current object. + The error context. + + + + Gets the current object the error event is being raised against. + + The current object the error event is being raised against. + + + + Gets the error context. + + The error context. + + + + Represents a view of a . + + + + + Initializes a new instance of the class. + + The name. + Type of the property. + + + + When overridden in a derived class, returns whether resetting an object changes its value. + + + true if resetting the component changes its value; otherwise, false. + + The component to test for reset capability. + + + + + When overridden in a derived class, gets the current value of the property on a component. + + + The value of a property for a given component. + + The component with the property for which to retrieve the value. + + + + + When overridden in a derived class, resets the value for this property of the component to the default value. + + The component with the property value that is to be reset to the default value. + + + + + When overridden in a derived class, sets the value of the component to a different value. + + The component with the property value that is to be set. + The new value. + + + + + When overridden in a derived class, determines a value indicating whether the value of this property needs to be persisted. + + + true if the property should be persisted; otherwise, false. + + The component with the property to be examined for persistence. + + + + + When overridden in a derived class, gets the type of the component this property is bound to. + + + A that represents the type of component this property is bound to. When the or methods are invoked, the object specified might be an instance of this type. + + + + + When overridden in a derived class, gets a value indicating whether this property is read-only. + + + true if the property is read-only; otherwise, false. + + + + + When overridden in a derived class, gets the type of the property. + + + A that represents the type of the property. + + + + + Gets the hash code for the name of the member. + + + + The hash code for the name of the member. + + + + + Used to resolve references when serializing and deserializing JSON by the . + + + + + Resolves a reference to its object. + + The serialization context. + The reference to resolve. + The object that + + + + Gets the reference for the sepecified object. + + The serialization context. + The object to get a reference for. + The reference to the object. + + + + Determines whether the specified object is referenced. + + The serialization context. + The object to test for a reference. + + true if the specified object is referenced; otherwise, false. + + + + + Adds a reference to the specified object. + + The serialization context. + The reference. + The object to reference. + + + + Specifies reference handling options for the . + + + + + Do not preserve references when serializing types. + + + + + Preserve references when serializing into a JSON object structure. + + + + + Preserve references when serializing into a JSON array structure. + + + + + Preserve references when serializing. + + + + + Instructs the how to serialize the collection. + + + + + Instructs the how to serialize the object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets the id. + + The id. + + + + Gets or sets the title. + + The title. + + + + Gets or sets the description. + + The description. + + + + Gets or sets a value that indicates whether to preserve object reference data. + + + true to keep object reference; otherwise, false. The default is false. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a flag indicating whether the array can contain null items + + A flag indicating whether the array can contain null items. + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets a value indicating whether null items are allowed in the collection. + + true if null items are allowed in the collection; otherwise, false. + + + + Specifies default value handling options for the . + + + + + Include members where the member value is the same as the member's default value when serializing objects. + Included members are written to JSON. Has no effect when deserializing. + + + + + Ignore members where the member value is the same as the member's default value when serializing objects + so that is is not written to JSON, and ignores setting members when the JSON value equals the member's default value. + + + + + Members with a default value but no JSON will be set to their default value when deserializing. + + + + + Ignore members where the member value is the same as the member's default value when serializing objects + and sets members to their default value when deserializing. + + + + + Instructs the to use the specified when serializing the member or class. + + + + + Initializes a new instance of the class. + + Type of the converter. + + + + Gets the type of the converter. + + The type of the converter. + + + + Instructs the how to serialize the object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified member serialization. + + The member serialization. + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets the member serialization. + + The member serialization. + + + + Specifies the settings on a object. + + + + + Initializes a new instance of the class. + + + + + Gets or sets how reference loops (e.g. a class referencing itself) is handled. + + Reference loop handling. + + + + Gets or sets how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + Missing member handling. + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets or sets how null values are handled during serialization and deserialization. + + Null value handling. + + + + Gets or sets how null default are handled during serialization and deserialization. + + The default value handling. + + + + Gets or sets a collection that will be used during serialization. + + The converters. + + + + Gets or sets how object references are preserved by the serializer. + + The preserve references handling. + + + + Gets or sets how type name writing and reading is handled by the serializer. + + The type name handling. + + + + Gets or sets how a type name assembly is written and resolved by the serializer. + + The type name assembly format. + + + + Gets or sets how constructors are used during deserialization. + + The constructor handling. + + + + Gets or sets the contract resolver used by the serializer when + serializing .NET objects to JSON and vice versa. + + The contract resolver. + + + + Gets or sets the used by the serializer when resolving references. + + The reference resolver. + + + + Gets or sets the used by the serializer when resolving type names. + + The binder. + + + + Gets or sets the error handler called during serialization and deserialization. + + The error handler called during serialization and deserialization. + + + + Gets or sets the used by the serializer when invoking serialization callback methods. + + The context. + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling during serialization and deserialization. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Represents a reader that provides validation. + + + + + Initializes a new instance of the class that + validates the content returned from the given . + + The to read from while validating. + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. + + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Sets an event handler for receiving schema validation errors. + + + + + Gets the text value of the current Json token. + + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Gets the path of the current JSON token. + + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + + Gets the type of the current Json token. + + + + + + Gets the Common Language Runtime (CLR) type for the current Json token. + + + + + + Gets or sets the schema. + + The schema. + + + + Gets the used to construct this . + + The specified in the constructor. + + + + Compares tokens to determine whether they are equal. + + + + + Determines whether the specified objects are equal. + + The first object of type to compare. + The second object of type to compare. + + true if the specified objects are equal; otherwise, false. + + + + + Returns a hash code for the specified object. + + The for which a hash code is to be returned. + A hash code for the specified object. + The type of is a reference type and is null. + + + + Specifies the member serialization options for the . + + + + + All public members are serialized by default. Members can be excluded using or . + This is the default member serialization mode. + + + + + Only members must be marked with or are serialized. + This member serialization mode can also be set by marking the class with . + + + + + All public and private fields are serialized. Members can be excluded using or . + This member serialization mode can also be set by marking the class with . + + + + + Specifies how object creation is handled by the . + + + + + Reuse existing objects, create new objects when needed. + + + + + Only reuse existing objects. + + + + + Always create new objects. + + + + + Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Gets or sets the date time styles used when converting a date to and from JSON. + + The date time styles used when converting a date to and from JSON. + + + + Gets or sets the date time format used when converting a date to and from JSON. + + The date time format used when converting a date to and from JSON. + + + + Gets or sets the culture used when converting a date to and from JSON. + + The culture used when converting a date to and from JSON. + + + + Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing property value of the JSON that is being converted. + The calling serializer. + The object value. + + + + Converts XML to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The calling serializer. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Checks if the attributeName is a namespace attribute. + + Attribute name to test. + The attribute name prefix if it has one, otherwise an empty string. + True if attribute name is for a namespace attribute, otherwise false. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Gets or sets the name of the root element to insert when deserializing to XML if the JSON structure has produces multiple root elements. + + The name of the deserialize root element. + + + + Gets or sets a flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + true if the array attibute is written to the XML; otherwise, false. + + + + Gets or sets a value indicating whether to write the root JSON object. + + true if the JSON root object is omitted; otherwise, false. + + + + Represents a reader that provides fast, non-cached, forward-only access to JSON text data. + + + + + Initializes a new instance of the class with the specified . + + The TextReader containing the XML data to read. + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Changes the state to closed. + + + + + Gets a value indicating whether the class can return line information. + + + true if LineNumber and LinePosition can be provided; otherwise, false. + + + + + Gets the current line number. + + + The current line number or 0 if no line information is available (for example, HasLineInfo returns false). + + + + + Gets the current line position. + + + The current line position or 0 if no line information is available (for example, HasLineInfo returns false). + + + + + Instructs the to always serialize the member with the specified name. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified name. + + Name of the property. + + + + Gets or sets the null value handling used when serializing this property. + + The null value handling. + + + + Gets or sets the default value handling used when serializing this property. + + The default value handling. + + + + Gets or sets the reference loop handling used when serializing this property. + + The reference loop handling. + + + + Gets or sets the object creation handling used when deserializing this property. + + The object creation handling. + + + + Gets or sets the type name handling used when serializing this property. + + The type name handling. + + + + Gets or sets whether this property's value is serialized as a reference. + + Whether this property's value is serialized as a reference. + + + + Gets or sets the order of serialization and deserialization of a member. + + The numeric order of serialization or deserialization. + + + + Gets or sets the name of the property. + + The name of the property. + + + + Gets or sets a value indicating whether this property is required. + + + A value indicating whether this property is required. + + + + + Instructs the not to serialize the public field or public read/write property value. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Creates an instance of the JsonWriter class using the specified . + + The TextWriter to write to. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the specified end token. + + The end token to write. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + + + + + Gets or sets which character to use to quote attribute values. + + + + + Gets or sets which character to use for indenting when is set to Formatting.Indented. + + + + + Gets or sets a value indicating whether object names will be surrounded with quotes. + + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Gets the line number indicating where the error occurred. + + The line number indicating where the error occurred. + + + + Gets the line position indicating where the error occurred. + + The line position indicating where the error occurred. + + + + Gets the path to the JSON where the error occurred. + + The path to the JSON where the error occurred. + + + + Represents a collection of . + + + + + Provides methods for converting between common language runtime types and JSON types. + + + + + Represents JavaScript's boolean value true as a string. This field is read-only. + + + + + Represents JavaScript's boolean value false as a string. This field is read-only. + + + + + Represents JavaScript's null as a string. This field is read-only. + + + + + Represents JavaScript's undefined as a string. This field is read-only. + + + + + Represents JavaScript's positive infinity as a string. This field is read-only. + + + + + Represents JavaScript's negative infinity as a string. This field is read-only. + + + + + Represents JavaScript's NaN as a string. This field is read-only. + + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation using the specified. + + The value to convert. + The format the date will be converted to. + The time zone handling when the date is converted to a string. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation using the specified. + + The value to convert. + The format the date will be converted to. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + The string delimiter character. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Serializes the specified object to a JSON string. + + The object to serialize. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string. + + The object to serialize. + Indicates how the output is formatted. + + A JSON string representation of the object. + + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A JSON string representation of the object. + + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Deserializes the JSON to a .NET object. + + The JSON to deserialize. + The deserialized object from the Json string. + + + + Deserializes the JSON to a .NET object. + + The JSON to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The of object being deserialized. + The deserialized object from the Json string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + The deserialized object from the Json string. + + + + Deserializes the JSON to the given anonymous type. + + + The anonymous type to deserialize to. This can't be specified + traditionally and must be infered from the anonymous type passed + as a parameter. + + The JSON to deserialize. + The anonymous type object. + The deserialized anonymous type from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The object to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize to. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize to. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + + + Populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + + + Asynchronously populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous populate operation. + + + + + Serializes the XML node to a JSON string. + + The node to serialize. + A JSON string of the XmlNode. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + A JSON string of the XmlNode. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + Omits writing the root object. + A JSON string of the XmlNode. + + + + Deserializes the XmlNode from a JSON string. + + The JSON string. + The deserialized XmlNode + + + + Deserializes the XmlNode from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + The deserialized XmlNode + + + + Deserializes the XmlNode from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + + A flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + The deserialized XmlNode + + + + Serializes the to a JSON string. + + The node to convert to JSON. + A JSON string of the XNode. + + + + Serializes the to a JSON string. + + The node to convert to JSON. + Indicates how the output is formatted. + A JSON string of the XNode. + + + + Serializes the to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + Omits writing the root object. + A JSON string of the XNode. + + + + Deserializes the from a JSON string. + + The JSON string. + The deserialized XNode + + + + Deserializes the from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + The deserialized XNode + + + + Deserializes the from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + + A flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + The deserialized XNode + + + + The exception thrown when an error occurs during Json serialization or deserialization. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Serializes and deserializes objects into and from the JSON format. + The enables you to control how objects are encoded into JSON. + + + + + Initializes a new instance of the class. + + + + + Creates a new instance using the specified . + + The settings to be applied to the . + A new instance using the specified . + + + + Populates the JSON values onto the target object. + + The that contains the JSON structure to reader values from. + The target object to populate values onto. + + + + Populates the JSON values onto the target object. + + The that contains the JSON structure to reader values from. + The target object to populate values onto. + + + + Deserializes the Json structure contained by the specified . + + The that contains the JSON structure to deserialize. + The being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The type of the object to deserialize. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Occurs when the errors during serialization and deserialization. + + + + + Gets or sets the used by the serializer when resolving references. + + + + + Gets or sets the used by the serializer when resolving type names. + + + + + Gets or sets how type name writing and reading is handled by the serializer. + + + + + Gets or sets how a type name assembly is written and resolved by the serializer. + + The type name assembly format. + + + + Gets or sets how object references are preserved by the serializer. + + + + + Get or set how reference loops (e.g. a class referencing itself) is handled. + + + + + Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + + + + Get or set how null values are handled during serialization and deserialization. + + + + + Get or set how null default are handled during serialization and deserialization. + + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets or sets how constructors are used during deserialization. + + The constructor handling. + + + + Gets a collection that will be used during serialization. + + Collection that will be used during serialization. + + + + Gets or sets the contract resolver used by the serializer when + serializing .NET objects to JSON and vice versa. + + + + + Gets or sets the used by the serializer when invoking serialization callback methods. + + The context. + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling during serialization and deserialization. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Contains the LINQ to JSON extension methods. + + + + + Returns a collection of tokens that contains the ancestors of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the ancestors of every node in the source collection. + + + + Returns a collection of tokens that contains the descendants of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the descendants of every node in the source collection. + + + + Returns a collection of child properties of every object in the source collection. + + An of that contains the source collection. + An of that contains the properties of every object in the source collection. + + + + Returns a collection of child values of every object in the source collection with the given key. + + An of that contains the source collection. + The token key. + An of that contains the values of every node in the source collection with the given key. + + + + Returns a collection of child values of every object in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child values of every object in the source collection with the given key. + + The type to convert the values to. + An of that contains the source collection. + The token key. + An that contains the converted values of every node in the source collection with the given key. + + + + Returns a collection of converted child values of every object in the source collection. + + The type to convert the values to. + An of that contains the source collection. + An that contains the converted values of every node in the source collection. + + + + Converts the value. + + The type to convert the value to. + A cast as a of . + A converted value. + + + + Converts the value. + + The source collection type. + The type to convert the value to. + A cast as a of . + A converted value. + + + + Returns a collection of child tokens of every array in the source collection. + + The source collection type. + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child tokens of every array in the source collection. + + An of that contains the source collection. + The type to convert the values to. + The source collection type. + An that contains the converted values of every node in the source collection. + + + + Returns the input typed as . + + An of that contains the source collection. + The input typed as . + + + + Returns the input typed as . + + The source collection type. + An of that contains the source collection. + The input typed as . + + + + Represents a JSON constructor. + + + + + Represents a token that can contain other tokens. + + + + + Raises the event. + + The instance containing the event data. + + + + Raises the event. + + The instance containing the event data. + + + + Raises the event. + + The instance containing the event data. + + + + Returns a collection of the child tokens of this token, in document order. + + + An of containing the child tokens of this , in document order. + + + + + Returns a collection of the child values of this token, in document order. + + The type to convert the values to. + + A containing the child values of this , in document order. + + + + + Returns a collection of the descendant tokens for this token in document order. + + An containing the descendant tokens of the . + + + + Adds the specified content as children of this . + + The content to be added. + + + + Adds the specified content as the first children of this . + + The content to be added. + + + + Creates an that can be used to add tokens to the . + + An that is ready to have content written to it. + + + + Replaces the children nodes of this token with the specified content. + + The content. + + + + Removes the child nodes from this token. + + + + + Occurs when the list changes or an item in the list changes. + + + + + Occurs before an item is added to the collection. + + + + + Occurs when the items list of the collection has changed, or the collection is reset. + + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Get the first child token of this token. + + + A containing the first child token of the . + + + + + Get the last child token of this token. + + + A containing the last child token of the . + + + + + Gets the count of child JSON tokens. + + The count of child JSON tokens + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name. + + The constructor name. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets or sets the name of this constructor. + + The constructor name. + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a collection of objects. + + The type of token + + + + An empty collection of objects. + + + + + Initializes a new instance of the struct. + + The enumerable. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + + + + Determines whether the specified is equal to this instance. + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the with the specified key. + + + + + + Represents a JSON object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Gets an of this object's properties. + + An of this object's properties. + + + + Gets a the specified name. + + The property name. + A with the specified name or null. + + + + Gets an of this object's property values. + + An of this object's property values. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Creates a from an object. + + The object that will be used to create . + The that will be used to read the object. + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Adds the specified property name. + + Name of the property. + The value. + + + + Removes the property with the specified name. + + Name of the property. + true if item was successfully removed; otherwise, false. + + + + Tries the get value. + + Name of the property. + The value. + true if a value was successfully retrieved; otherwise, false. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Raises the event with the provided arguments. + + Name of the property. + + + + Raises the event with the provided arguments. + + Name of the property. + + + + Returns the properties for this instance of a component. + + + A that represents the properties for this component instance. + + + + + Returns the properties for this instance of a component using the attribute array as a filter. + + An array of type that is used as a filter. + + A that represents the filtered properties for this component instance. + + + + + Returns a collection of custom attributes for this instance of a component. + + + An containing the attributes for this object. + + + + + Returns the class name of this instance of a component. + + + The class name of the object, or null if the class does not have a name. + + + + + Returns the name of this instance of a component. + + + The name of the object, or null if the object does not have a name. + + + + + Returns a type converter for this instance of a component. + + + A that is the converter for this object, or null if there is no for this object. + + + + + Returns the default event for this instance of a component. + + + An that represents the default event for this object, or null if this object does not have events. + + + + + Returns the default property for this instance of a component. + + + A that represents the default property for this object, or null if this object does not have properties. + + + + + Returns an editor of the specified type for this instance of a component. + + A that represents the editor for this object. + + An of the specified type that is the editor for this object, or null if the editor cannot be found. + + + + + Returns the events for this instance of a component using the specified attribute array as a filter. + + An array of type that is used as a filter. + + An that represents the filtered events for this component instance. + + + + + Returns the events for this instance of a component. + + + An that represents the events for this component instance. + + + + + Returns an object that contains the property described by the specified property descriptor. + + A that represents the property whose owner is to be found. + + An that represents the owner of the specified property. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Occurs when a property value changes. + + + + + Occurs when a property value is changing. + + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets or sets the with the specified property name. + + + + + + Represents a JSON array. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Creates a from an object. + + The object that will be used to create . + The that will be used to read the object. + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Determines the index of a specific item in the . + + The object to locate in the . + + The index of if found in the list; otherwise, -1. + + + + + Inserts an item to the at the specified index. + + The zero-based index at which should be inserted. + The object to insert into the . + + is not a valid index in the . + The is read-only. + + + + Removes the item at the specified index. + + The zero-based index of the item to remove. + + is not a valid index in the . + The is read-only. + + + + Adds an item to the . + + The object to add to the . + The is read-only. + + + + Removes all items from the . + + The is read-only. + + + + Determines whether the contains a specific value. + + The object to locate in the . + + true if is found in the ; otherwise, false. + + + + + Removes the first occurrence of a specific object from the . + + The object to remove from the . + + true if was successfully removed from the ; otherwise, false. This method also returns false if is not found in the original . + + The is read-only. + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets or sets the at the specified index. + + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class. + + The token to read from. + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Initializes a new instance of the class writing to the given . + + The container being written to. + + + + Initializes a new instance of the class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end. + + The token. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Gets the token being writen. + + The token being writen. + + + + Represents a JSON property. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class. + + The property name. + The property content. + + + + Initializes a new instance of the class. + + The property name. + The property content. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets the property name. + + The property name. + + + + Gets or sets the property value. + + The property value. + + + + Gets the node type for this . + + The type. + + + + Specifies the type of token. + + + + + No token type has been set. + + + + + A JSON object. + + + + + A JSON array. + + + + + A JSON constructor. + + + + + A JSON object property. + + + + + A comment. + + + + + An integer value. + + + + + A float value. + + + + + A string value. + + + + + A boolean value. + + + + + A null value. + + + + + An undefined value. + + + + + A date value. + + + + + A raw JSON value. + + + + + A collection of bytes value. + + + + + A Guid value. + + + + + A Uri value. + + + + + A TimeSpan value. + + + + + Contains the JSON schema extension methods. + + + + + Determines whether the is valid. + + The source to test. + The schema to test with. + + true if the specified is valid; otherwise, false. + + + + + Determines whether the is valid. + + The source to test. + The schema to test with. + When this method returns, contains any error messages generated while validating. + + true if the specified is valid; otherwise, false. + + + + + Validates the specified . + + The source to test. + The schema to test with. + + + + Validates the specified . + + The source to test. + The schema to test with. + The validation event handler. + + + + Returns detailed information about the schema exception. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Gets the line number indicating where the error occurred. + + The line number indicating where the error occurred. + + + + Gets the line position indicating where the error occurred. + + The line position indicating where the error occurred. + + + + Gets the path to the JSON where the error occurred. + + The path to the JSON where the error occurred. + + + + Resolves from an id. + + + + + Initializes a new instance of the class. + + + + + Gets a for the specified id. + + The id. + A for the specified id. + + + + Gets or sets the loaded schemas. + + The loaded schemas. + + + + Specifies undefined schema Id handling options for the . + + + + + Do not infer a schema Id. + + + + + Use the .NET type name as the schema Id. + + + + + Use the assembly qualified .NET type name as the schema Id. + + + + + Returns detailed information related to the . + + + + + Gets the associated with the validation error. + + The JsonSchemaException associated with the validation error. + + + + Gets the path of the JSON location where the validation error occurred. + + The path of the JSON location where the validation error occurred. + + + + Gets the text description corresponding to the validation error. + + The text description. + + + + Represents the callback method that will handle JSON schema validation events and the . + + + + + Resolves member mappings for a type, camel casing property names. + + + + + Used by to resolves a for a given . + + + + + Used by to resolves a for a given . + + + + + Resolves the contract for a given type. + + The type to resolve a contract for. + The contract for a given type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + If set to true the will use a cached shared with other resolvers of the same type. + Sharing the cache will significantly performance because expensive reflection will only happen once but could cause unexpected + behavior if different instances of the resolver are suppose to produce different results. When set to false it is highly + recommended to reuse instances with the . + + + + + Resolves the contract for a given type. + + The type to resolve a contract for. + The contract for a given type. + + + + Gets the serializable members for the type. + + The type to get serializable members for. + The serializable members for the type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates the constructor parameters. + + The constructor to create properties for. + The type's member properties. + Properties for the given . + + + + Creates a for the given . + + The matching member property. + The constructor parameter. + A created for the given . + + + + Resolves the default for the contract. + + Type of the object. + + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Determines which contract type is created for the given type. + + Type of the object. + A for the given type. + + + + Creates properties for the given . + + The type to create properties for. + /// The member serialization mode for the type. + Properties for the given . + + + + Creates the used by the serializer to get and set values from a member. + + The member. + The used by the serializer to get and set values from a member. + + + + Creates a for the given . + + The member's parent . + The member to create a for. + A created for the given . + + + + Resolves the name of the property. + + Name of the property. + Name of the property. + + + + Gets a value indicating whether members are being get and set using dynamic code generation. + This value is determined by the runtime permissions available. + + + true if using dynamic code generation; otherwise, false. + + + + + Gets or sets the default members search flags. + + The default members search flags. + + + + Gets or sets a value indicating whether compiler generated members should be serialized. + + + true if serialized compiler generated members; otherwise, false. + + + + + Gets or sets a value indicating whether to ignore the interface when serializing and deserializing types. + + + true if the interface will be ignored when serializing and deserializing types; otherwise, false. + + + + + Gets or sets a value indicating whether to ignore the attribute when serializing and deserializing types. + + + true if the attribute will be ignored when serializing and deserializing types; otherwise, false. + + + + + Initializes a new instance of the class. + + + + + Resolves the name of the property. + + Name of the property. + The property name camel cased. + + + + The default serialization binder used when resolving and loading classes from type names. + + + + + When overridden in a derived class, controls the binding of a serialized object to a type. + + Specifies the name of the serialized object. + Specifies the name of the serialized object. + + The type of the object the formatter creates a new instance of. + + + + + When overridden in a derived class, controls the binding of a serialized object to a type. + + The type of the object the formatter creates a new instance of. + Specifies the name of the serialized object. + Specifies the name of the serialized object. + + + + Provides information surrounding an error. + + + + + Gets or sets the error. + + The error. + + + + Gets the original object that caused the error. + + The original object that caused the error. + + + + Gets the member that caused the error. + + The member that caused the error. + + + + Gets the path of the JSON location where the error occurred. + + The path of the JSON location where the error occurred. + + + + Gets or sets a value indicating whether this is handled. + + true if handled; otherwise, false. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets the of the collection items. + + The of the collection items. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the property name resolver. + + The property name resolver. + + + + Gets the of the dictionary keys. + + The of the dictionary keys. + + + + Gets the of the dictionary values. + + The of the dictionary values. + + + + Maps a JSON property to a .NET member or constructor parameter. + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Gets or sets the name of the property. + + The name of the property. + + + + Gets or sets the type that declared this property. + + The type that declared this property. + + + + Gets or sets the order of serialization and deserialization of a member. + + The numeric order of serialization or deserialization. + + + + Gets or sets the name of the underlying member or parameter. + + The name of the underlying member or parameter. + + + + Gets the that will get and set the during serialization. + + The that will get and set the during serialization. + + + + Gets or sets the type of the property. + + The type of the property. + + + + Gets or sets the for the property. + If set this converter takes presidence over the contract converter for the property type. + + The converter. + + + + Gets the member converter. + + The member converter. + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + + Gets a value indicating whether this is readable. + + true if readable; otherwise, false. + + + + Gets a value indicating whether this is writable. + + true if writable; otherwise, false. + + + + Gets the default value. + + The default value. + + + + Gets a value indicating whether this is required. + + A value indicating whether this is required. + + + + Gets a value indicating whether this property preserves object references. + + + true if this instance is reference; otherwise, false. + + + + + Gets the property null value handling. + + The null value handling. + + + + Gets the property default value handling. + + The default value handling. + + + + Gets the property reference loop handling. + + The reference loop handling. + + + + Gets the property object creation handling. + + The object creation handling. + + + + Gets or sets the type name handling. + + The type name handling. + + + + Gets or sets a predicate used to determine whether the property should be serialize. + + A predicate used to determine whether the property should be serialize. + + + + Gets or sets a predicate used to determine whether the property should be serialized. + + A predicate used to determine whether the property should be serialized. + + + + Gets or sets an action used to set whether the property has been deserialized. + + An action used to set whether the property has been deserialized. + + + + A collection of objects. + + + + + Initializes a new instance of the class. + + The type. + + + + When implemented in a derived class, extracts the key from the specified element. + + The element from which to extract the key. + The key for the specified element. + + + + Adds a object. + + The property to add to the collection. + + + + Gets the closest matching object. + First attempts to get an exact case match of propertyName and then + a case insensitive match. + + Name of the property. + A matching property if found. + + + + Gets a property by property name. + + The name of the property to get. + Type property name string comparison. + A matching property if found. + + + + Specifies missing member handling options for the . + + + + + Ignore a missing member and do not attempt to deserialize it. + + + + + Throw a when a missing member is encountered during deserialization. + + + + + Specifies null value handling options for the . + + + + + Include null values when serializing and deserializing objects. + + + + + Ignore null values when serializing and deserializing objects. + + + + + Specifies reference loop handling options for the . + + + + + Throw a when a loop is encountered. + + + + + Ignore loop references and do not serialize. + + + + + Serialize loop references. + + + + + An in-memory representation of a JSON Schema. + + + + + Initializes a new instance of the class. + + + + + Reads a from the specified . + + The containing the JSON Schema to read. + The object representing the JSON Schema. + + + + Reads a from the specified . + + The containing the JSON Schema to read. + The to use when resolving schema references. + The object representing the JSON Schema. + + + + Load a from a string that contains schema JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Parses the specified json. + + The json. + The resolver. + A populated from the string that contains JSON. + + + + Writes this schema to a . + + A into which this method will write. + + + + Writes this schema to a using the specified . + + A into which this method will write. + The resolver used. + + + + Returns a that represents the current . + + + A that represents the current . + + + + + Gets or sets the id. + + + + + Gets or sets the title. + + + + + Gets or sets whether the object is required. + + + + + Gets or sets whether the object is read only. + + + + + Gets or sets whether the object is visible to users. + + + + + Gets or sets whether the object is transient. + + + + + Gets or sets the description of the object. + + + + + Gets or sets the types of values allowed by the object. + + The type. + + + + Gets or sets the pattern. + + The pattern. + + + + Gets or sets the minimum length. + + The minimum length. + + + + Gets or sets the maximum length. + + The maximum length. + + + + Gets or sets a number that the value should be divisble by. + + A number that the value should be divisble by. + + + + Gets or sets the minimum. + + The minimum. + + + + Gets or sets the maximum. + + The maximum. + + + + Gets or sets a flag indicating whether the value can not equal the number defined by the "minimum" attribute. + + A flag indicating whether the value can not equal the number defined by the "minimum" attribute. + + + + Gets or sets a flag indicating whether the value can not equal the number defined by the "maximum" attribute. + + A flag indicating whether the value can not equal the number defined by the "maximum" attribute. + + + + Gets or sets the minimum number of items. + + The minimum number of items. + + + + Gets or sets the maximum number of items. + + The maximum number of items. + + + + Gets or sets the of items. + + The of items. + + + + Gets or sets the of properties. + + The of properties. + + + + Gets or sets the of additional properties. + + The of additional properties. + + + + Gets or sets the pattern properties. + + The pattern properties. + + + + Gets or sets a value indicating whether additional properties are allowed. + + + true if additional properties are allowed; otherwise, false. + + + + + Gets or sets the required property if this property is present. + + The required property if this property is present. + + + + Gets or sets the identity. + + The identity. + + + + Gets or sets the a collection of valid enum values allowed. + + A collection of valid enum values allowed. + + + + Gets or sets a collection of options. + + A collection of options. + + + + Gets or sets disallowed types. + + The disallow types. + + + + Gets or sets the default value. + + The default value. + + + + Gets or sets the extend . + + The extended . + + + + Gets or sets the format. + + The format. + + + + Generates a from a specified . + + + + + Generate a from the specified type. + + The type to generate a from. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + The used to resolve schema references. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + Specify whether the generated root will be nullable. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + The used to resolve schema references. + Specify whether the generated root will be nullable. + A generated from the specified type. + + + + Gets or sets how undefined schemas are handled by the serializer. + + + + + Gets or sets the contract resolver. + + The contract resolver. + + + + The value types allowed by the . + + + + + No type specified. + + + + + String type. + + + + + Float type. + + + + + Integer type. + + + + + Boolean type. + + + + + Object type. + + + + + Array type. + + + + + Null type. + + + + + Any type. + + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the object member serialization. + + The member object serialization. + + + + Gets the object's properties. + + The object's properties. + + + + Gets the constructor parameters required for any non-default constructor + + + + + Gets or sets the override constructor used to create the object. + This is set when a constructor is marked up using the + JsonConstructor attribute. + + The override constructor. + + + + Gets or sets the parametrized constructor used to create the object. + + The parametrized constructor. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Get and set values for a using reflection. + + + + + Initializes a new instance of the class. + + The member info. + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + When applied to a method, specifies that the method is called when an error occurs serializing an object. + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic that returns a result + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic, but uses one of the arguments for + the result. + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic, but uses one of the arguments for + the result. + + + + + Returns a Restrictions object which includes our current restrictions merged + with a restriction limiting our type + + + + + Represents a method that constructs an object. + + + + + Specifies type name handling options for the . + + + + + Do not include the .NET type name when serializing types. + + + + + Include the .NET type name when serializing into a JSON object structure. + + + + + Include the .NET type name when serializing into a JSON array structure. + + + + + Always include the .NET type name when serializing. + + + + + Include the .NET type name when the type of the object being serialized is not the same as its declared type. + + + + + Converts the value to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert the value to. + The converted type. + + + + Converts the value to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert the value to. + The converted value if the conversion was successful or the default value of T if it failed. + + true if initialValue was converted successfully; otherwise, false. + + + + + Converts the value to the specified type. If the value is unable to be converted, the + value is checked whether it assignable to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert or cast the value to. + + The converted type. If conversion was unsuccessful, the initial value + is returned if assignable to the target type. + + + + + Gets a dictionary of the names and values of an Enum type. + + + + + + Gets a dictionary of the names and values of an Enum type. + + The enum type to get names and values for. + + + + + Specifies the type of Json token. + + + + + This is returned by the if a method has not been called. + + + + + An object start token. + + + + + An array start token. + + + + + A constructor start token. + + + + + An object property name. + + + + + A comment. + + + + + Raw JSON. + + + + + An integer. + + + + + A float. + + + + + A string. + + + + + A boolean. + + + + + A null token. + + + + + An undefined token. + + + + + An object end token. + + + + + An array end token. + + + + + A constructor end token. + + + + + A Date. + + + + + Byte data. + + + + + Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Adds the elements of the specified collection to the specified generic IList. + + The list to add to. + The collection of elements to add. + + + + Returns the index of the first occurrence in a sequence by using a specified IEqualityComparer. + + The type of the elements of source. + A sequence in which to locate a value. + The object to locate in the sequence + An equality comparer to compare values. + The zero-based index of the first occurrence of value within the entire sequence, if found; otherwise, –1. + + + + Gets the type of the typed collection's items. + + The type. + The type of the typed collection's items. + + + + Gets the member's underlying type. + + The member. + The underlying type of the member. + + + + Determines whether the member is an indexed property. + + The member. + + true if the member is an indexed property; otherwise, false. + + + + + Determines whether the property is an indexed property. + + The property. + + true if the property is an indexed property; otherwise, false. + + + + + Gets the member's value on the object. + + The member. + The target object. + The member's value on the object. + + + + Sets the member's value on the target object. + + The member. + The target. + The value. + + + + Determines whether the specified MemberInfo can be read. + + The MemberInfo to determine whether can be read. + /// if set to true then allow the member to be gotten non-publicly. + + true if the specified MemberInfo can be read; otherwise, false. + + + + + Determines whether the specified MemberInfo can be set. + + The MemberInfo to determine whether can be set. + if set to true then allow the member to be set non-publicly. + if set to true then allow the member to be set if read-only. + + true if the specified MemberInfo can be set; otherwise, false. + + + + + Determines whether the string is all white space. Empty string will return false. + + The string to test whether it is all white space. + + true if the string is all white space; otherwise, false. + + + + + Nulls an empty string. + + The string. + Null if the string was null, otherwise the string unchanged. + + + + Specifies the state of the . + + + + + An exception has been thrown, which has left the in an invalid state. + You may call the method to put the in the Closed state. + Any other method calls results in an being thrown. + + + + + The method has been called. + + + + + An object is being written. + + + + + A array is being written. + + + + + A constructor is being written. + + + + + A property is being written. + + + + + A write method has not been called. + + + + diff --git a/TestApps/LOCTester/bin/Release/StructureMap.dll b/TestApps/LOCTester/bin/Release/StructureMap.dll new file mode 100644 index 000000000..28a17b021 Binary files /dev/null and b/TestApps/LOCTester/bin/Release/StructureMap.dll differ diff --git a/TestApps/LOCTester/bin/Release/StructureMap.pdb b/TestApps/LOCTester/bin/Release/StructureMap.pdb new file mode 100644 index 000000000..6c4dd1f78 Binary files /dev/null and b/TestApps/LOCTester/bin/Release/StructureMap.pdb differ diff --git a/TestApps/LOCTester/bin/Release/StructureMap.xml b/TestApps/LOCTester/bin/Release/StructureMap.xml new file mode 100644 index 000000000..6376709c4 --- /dev/null +++ b/TestApps/LOCTester/bin/Release/StructureMap.xml @@ -0,0 +1,3931 @@ + + + + StructureMap + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Get the object of type T that is valid for this build session. + + + + + + + Get the object of type T that is valid for this build session by name. + + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Register a default object for the given PluginType that will + be used throughout the rest of the current object request + + + + + + + Same as GetInstance, but can gracefully return null if + the Type does not already exist + + + + + + + Same as GetInstance(name), but can gracefully return null if + the Type and name does not already exist + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Gets all objects in the current object graph that can be cast + to T that have already been created + + + + + + + Creates/Resolves every configured instance of PlutinType T + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Gets a reference to the BuildStack for this build session + + + + + The concrete type of the immediate parent object in the object graph + + + + + Gets the root "frame" of the object request + + + + + The requested instance name of the object graph + + + + + Expression Builder that has grammars for defining policies at the + PluginType level. This expression is used for registering + open generic types + + + + + Convenience method that sets the default concrete type of the PluginType. The "concreteType" + can only accept types that do not have any primitive constructor arguments. + StructureMap has to know how to construct all of the constructor argument types. + + + + + + + Use this configured Instance as is + + + + + + Shorter way to call TheDefaultIsConcreteType + + + + + + + Shortcut to add a value by type + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Configure this type as the supplied value + + + + + + Sets the object creation of the instances of the PluginType. For example: PerRequest, + Singleton, ThreadLocal, HttpContext, or Hybrid + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Registers an IBuildInterceptor for this Plugin Type that executes before + any object of this PluginType is created. IBuildInterceptor's can be + used to create a custom scope + + + + + + + Convenience method to mark a PluginFamily as a Singleton + + + + + + Convenience method to mark a PluginFamily as a Hybrid lifecycle + + + + + + Convenience method to mark a PluginFamily as HttpContext scoped + + + + + + + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. You can also chain other declarations after + this method to add constructor and setter arguments + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type by a specified name. You can also chain other declarations after + this method to add constructor and setter arguments + + + + + + + + Specify the value of this explicit argument + + + + + + + Pass in additional arguments by type T + + + + + + + + Pass in additional arguments by type + + + + + + + + Pass in additional arguments by name + + + + + + + Gets the default instance of type T using the explicitly configured arguments from the "args" + + + + + + + Gets a named instance of type T using the explicitly configured arguments from teh "args" + + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + Gets all configured instances of type T using explicitly configured arguments + + + + + + + Returns the System.Reflection.ConstructorInfo for the PluggedType. Uses either + the "greediest" constructor with the most arguments or the constructor function + marked with the [DefaultConstructor] + + + + + + The InstanceKey of the default instance of the PluginFamily + + + + + The CLR Type that defines the "Plugin" interface for the PluginFamily + + + + + Add an Assembly to the scanning operation + + + + + + Add an Assembly by name to the scanning operation + + + + + + Add the currently executing Assembly to the scanning operation + + + + + Add the Assembly that contains type T to the scanning operation + + + + + + Add the Assembly that contains type to the scanning operation + + + + + + Sweep the designated path and add any Assembly's found in this folder to the + scanning operation + + + + + + Sweep the designated path and add any Assembly's found in this folder to the + scanning operation. The assemblyFilter can be used to filter or limit the + Assembly's that are picked up. + + + + + + + Sweep the application base directory of current app domain and add any Assembly's + found to the scanning operation. + + + + + Sweep the application base directory of current app domain and add any Assembly's + found to the scanning operation. The assemblyFilter can be used to filter or limit the + Assembly's that are picked up. + + + + + Adds an ITypeScanner object to the scanning operation + + + + + + Creates and adds a new ITypeScanner of type T to this scanning operation + + + + + + Directs the scanning operation to automatically detect and include any Registry + classes found in the Assembly's being scanned + + + + + Add all concrete types of the Plugin Type as Instances of Plugin Type + + + + + + Add all concrete types of the Plugin Type as Instances of Plugin Type + + + + + + Makes this scanning operation ignore all [PluginFamily] and [Pluggable] attributes + + + + + Exclude types that match the Predicate from being scanned + + + + + + Exclude all types in this nameSpace or its children from the scanning operation + + + + + + Exclude all types in this nameSpace or its children from the scanning operation + + + + + + Only include types matching the Predicate in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Only include types from this nameSpace or its children in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Only include types from this nameSpace or its children in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Exclude this specific type from the scanning operation + + + + + + Adds a registration convention to be applied to all the types in this + logical "scan" operation + + + + + + Adds a registration convention to be applied to all the types in this + logical "scan" operation + + + + + Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete + class named "Something" that implements "ISomething" will be automatically + added to PluginType "ISomething" + + + + + Scans for PluginType's and Concrete Types that close the given open generic type + + + + + + + + + Automatically registers all concrete types without primitive arguments + against its first interface, if any + + + + + Directs the scanning to automatically register any type that is the single + implementation of an interface against that interface. + The filters apply + + + + + Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete + class named "Something" that implements "ISomething" will be automatically + added to PluginType "ISomething" + + + + + Scans for PluginType's and Concrete Types that close the given open generic type + + + + + + + + + Automatically registers all concrete types without primitive arguments + against its first interface, if any + + + + + Directs the scanning to automatically register any type that is the single + implementation of an interface against that interface. + The filters apply + + + + + A TypeInterceptor that is only applied if the MatchesType() + method is true for a given Type + + + + + An InstanceInterceptor can be registered on a per-Instance basis + to act on, or even replace, the object that is created before + it is passed back to the caller. This is primarily a hook + for runtime AOP scenarios. + + + + + Does this TypeInterceptor apply to the given type? + + + + + + + Specify how objects matching the Type predicate + will be intercepted + + + + + + Specify how objects matching the Type predicate + will be intercepted + + + + + + Used for auto-mocking container. When the factory is missing, we can generate a mock for it + + + + + An Instance class that builds objects by calling a constructor function on a concrete type + and filling setter properties. ConfiguredInstance should only be used for open generic types. + Favor SmartInstance{T} for all other usages. + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE + + + + + + + Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE + + + + + + + Inline definition of a constructor or a setter property dependency + + + + + + + Starts the definition of a child instance specifying the argument name + in the case of a constructor function that consumes more than one argument + of type T + + + + + + + + Inline definition of a constructor dependency + + + + + + + + Inline definition of a setter dependency + + + + + + + + Start the definition of a primitive argument to a constructor argument + + + + + + + Configure a primitive constructor argument + + + + + + + Configures an array of Instance's for the array dependency + + + + + + + Part of the Fluent Interface, represents a nonprimitive argument to a + constructure function + + + + + Use a previously configured and named instance for the child + + + + + + + Start the definition of a child instance by defining the concrete type + + + + + + + Start the definition of a child instance by defining the concrete type + + + + + + + Registers a configured instance to use as the argument to the parent's + constructor + + + + + + + Directs StructureMap to fill this dependency with the Default Instance of the + constructor or property type + + + + + + Base class for many of the Instance subclasses to support + method chaining in the Registry DSL for common options + + + + + + Set the name of this Instance + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + + Register an InstanceInterceptor with this Instance + + + + + + + Used to override the constructor of a class to be used by StructureMap to create + a Pluggable object + + + + + Examines a System.Type object and determines the ConstructorInfo to use in creating + instances of the Type + + + + + + + Used to implicitly mark a class as a Plugin candidate for StructureMap + + + + + Determines whether a Type object is marked as Pluggable + + + + + + + The ConcreteKey alias of the Type + + + + + Declares a class, abstract class, or interface to be the target of a PluginFamily in the container + + + + + Determines if a Type object is marked as a PluginFamily + + + + + + + If set, determines the shared "scope" of the instance -- PerRequest, Singleton, ThreadLocal, + HttpContext, etc. + + + + + InstanceKey of the default instance. Used to implicitly define the default without + declaring the instance in StructureMap.config + + + + + Declares the target to be built by StructureMap as a Singleton. One object instance will + be created for each named instance + + + + + Marks a Property in a Pluggable class as filled by setter injection + + + + + Marks a method with no parameters as a method that validates an instance. StructureMap + uses this method to validate the configuration file. If the method does not throw an + exception, the object is assumed to be valid. + + + + + Returns an array of any MethodInfo's on a Type that are marked as ValidationMethod + + CLR Type to search for validation methods + + + + + Constants for the names of Xml nodes and attributes in the StructureMap.config + file + + + + + The name of the default configuration file. The value is always StructurMap.config + + + + + Returns the absolute path to the StructureMap.config file + + + + + + Expression Builder that has grammars for defining policies at the + PluginType level + + + + + Add multiple Instance's to this PluginType + + + + + + + Conditional binding of instances + + + + + + + Access to all of the uncommon Instance types + + + + + + + Access to all of the uncommon Instance types + + + + + + + Convenience method that sets the default concrete type of the PluginType. Type T + can only accept types that do not have any primitive constructor arguments. + StructureMap has to know how to construct all of the constructor argument types. + + + + + + + + Shorthand to say TheDefault.Is.ConstructedBy(func) + + + + + + + Shorthand to say TheDefault.Is.ConstructedBy(func) + + + + + + + Shorthand to say TheDefault.IsThis(@object) + + + + + + + Sets the object creation of the instances of the PluginType. For example: PerRequest, + Singleton, ThreadLocal, HttpContext, or Hybrid + + + + + + + Convenience method to mark a PluginFamily as a Singleton + + + + + + Convenience method to mark a PluginFamily as a Transient + + + + + + Convenience method to mark a PluginFamily as a Hybrid lifecycle + + + + + + Convenience method to mark a PluginFamily as HttpContext scoped + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Adds an Interceptor to only this PluginType + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Registers an ILifecycle for this Plugin Type that executes before + any object of this PluginType is created. ILifecycle's can be + used to create a custom scope + + + + + + + Largely deprecated and unnecessary with the ability to add Xml configuration files + + + + + + + Forces StructureMap to always use a unique instance to + stop the "BuildSession" caching + + + + + + Adds the object to to the PLUGINTYPE + + + + + + + Add an Instance to this type created by a Lambda + + + + + + + Define the Default Instance for this PluginType + + + + + Expression class to help define a runtime Profile + + + + + Starts the definition of the default instance for the containing Profile. This is + still valid, but Type() is recommended + + + + + + + Designate or define the Instance for a type within + this Profile + + + + + + + Use statement to define the Profile defaults for a Generic type + + + + + + + Expression Builder inside of a Profile creation for + open generic types + + + + + Use this concreteType for the Instance of this Profile for the PluginType + + + + + + + Use this concreteType for the Instance of this Profile for the PluginType + + + + + + + Use this Instance for the Profile Instance of this Plugin Type + + + + + + + Use the named Instance as the Profile Instance for this PluginType + + + + + + + Use the named Instance as the Profile Instance for this PluginType + + + + + + + For this type and profile, build the object with this Lambda + + + + + + + Expression Builder within defining a Profile + + + + + + Use a named, preconfigured instance as the default instance for this profile + + + + + + + Use a named, preconfigured instance as the default instance for this profile + + + + + + + Define the default instance of the PluginType for the containing Profile + + + + + + + For this Profile, use an Instance with this Func + + + + + + + For this Profile, use an Instance with this Func + + + + + + + For this Profile, use this object + + + + + + + Access to the uncommon types of Instance + + + + + + For this Profile, use the Concrete Type + + + + + + + For this profile, use this concrete type + + + + + + + A Registry class provides methods and grammars for configuring a Container or ObjectFactory. + Using a Registry subclass is the recommended way of configuring a StructureMap Container. + + + public class MyRegistry : Registry + { + public MyRegistry() + { + ForRequestedType(typeof(IService)).TheDefaultIsConcreteType(typeof(Service)); + } + } + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Imports the configuration from another registry into this registry. + + + + + + Imports the configuration from another registry into this registry. + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + This method is a shortcut for specifying the default constructor and + setter arguments for a ConcreteType. ForConcreteType is shorthand for: + ForRequestedType[T]().Use[T].************** + when the PluginType and ConcreteType are the same Type + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Convenience method. Equivalent of ForRequestedType[PluginType]().AsSingletons() + + + + + + + Uses the configuration expressions of this Registry to create a PluginGraph + object that could be used to initialize a Container. This method is + mostly for internal usage, but might be helpful for diagnostics + + + + + + Adds an additional, non-Default Instance to the PluginType T. + + + + + + + Adds an additional, non-Default Instance to the designated pluginType + This method is mostly meant for open generic types + + + + + + + Expression Builder to define the defaults for a named Profile. Each call + to CreateProfile is additive. + + + + + + + An alternative way to use CreateProfile that uses ProfileExpression + as a Nested Closure. This usage will result in cleaner code for + multiple declarations + + + + + + + Registers a new TypeInterceptor object with the Container + + + + + + Allows you to define a TypeInterceptor inline with Lambdas or anonymous delegates + + + + + IfTypeMatches( ... ).InterceptWith( o => new ObjectWrapper(o) ); + + + + + Designates a policy for scanning assemblies to auto + register types + + + + + + Directs StructureMap to always inject dependencies into any and all public Setter properties + of the type PLUGINTYPE. + + + + + + + Creates automatic "policies" for which public setters are considered mandatory + properties by StructureMap that will be "setter injected" as part of the + construction process. + + + + + + Use to programmatically select the constructor function of a concrete + class. Applies globally to all Containers in a single AppDomain. + + + + + + + All requests For the "TO" types will be filled by fetching the "FROM" + type and casting it to "TO" + GetInstance(typeof(TO)) basically becomes (TO)GetInstance(typeof(FROM)) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( @object ) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( instance ) + + + + + + + + Shorthand for ForRequestedType(pluginType) + + + + + + + + Advanced Usage Only! Skips the Registry and goes right to the inner + Semantic Model of StructureMap. Use with care + + + + + + Adds the concreteType as an Instance of the pluginType. Mostly useful + for conventions + + + + + + + Adds the concreteType as an Instance of the pluginType with a name. Mostly + useful for conventions + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType. + Mostly useful for conventions + + + + + + Imports the configuration from another registry into this registry. + + + + + + Imports the configuration from another registry into this registry. + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + This method is a shortcut for specifying the default constructor and + setter arguments for a ConcreteType. ForConcreteType is shorthand for: + For[T]().Use[T].************** + when the PluginType and ConcreteType are the same Type + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Convenience method. Equivalent of ForRequestedType[PluginType]().Singletons() + + + + + + + Uses the configuration expressions of this Registry to create a PluginGraph + object that could be used to initialize a Container. This method is + mostly for internal usage, but might be helpful for diagnostics + + + + + + Adds an additional, non-Default Instance to the PluginType T. + + + + + + + Adds an additional, non-Default Instance to the designated pluginType + This method is mostly meant for open generic types + + + + + + + Expression Builder to define the defaults for a named Profile. Each call + to CreateProfile is additive. + + + + + + + An alternative way to use CreateProfile that uses ProfileExpression + as a Nested Closure. This usage will result in cleaner code for + multiple declarations + + + + + + + Registers a new TypeInterceptor object with the Container + + + + + + Allows you to define a TypeInterceptor inline with Lambdas or anonymous delegates + + + + + IfTypeMatches( ... ).InterceptWith( o => new ObjectWrapper(o) ); + + + + + Designates a policy for scanning assemblies to auto + register types + + + + + + Directs StructureMap to always inject dependencies into any and all public Setter properties + of the type PLUGINTYPE. + + + + + + + Creates automatic "policies" for which public setters are considered mandatory + properties by StructureMap that will be "setter injected" as part of the + construction process. + + + + + + Use to programmatically select the constructor function of a concrete + class. Applies globally to all Containers in a single AppDomain. + + + + + + + All requests For the "TO" types will be filled by fetching the "FROM" + type and casting it to "TO" + GetInstance(typeof(TO)) basically becomes (TO)GetInstance(typeof(FROM)) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( @object ) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( instance ) + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + + Advanced Usage Only! Skips the Registry and goes right to the inner + Semantic Model of StructureMap. Use with care + + + + + + Define the constructor and setter arguments for the default T + + + + + + Thrown by IProperty classes when an invalid value is applied to + a property of an InstanceGraph + + + + + Main exception for StructureMap. Use the ErrorCode to aid in troubleshooting + StructureMap problems + + + + + Represents a concrete class that can be built by StructureMap as an instance of the parent + PluginFamily’s PluginType. The properties of a Plugin are the CLR Type of the concrete class, + and the human-friendly concrete key that StructureMap will use to identify the Type. + + + + + The ConcreteKey that identifies the Plugin within a PluginFamily + + + + + The concrete CLR Type represented by the Plugin + + + + + Property's that will be filled by setter injection + + + + + Conceptually speaking, a PluginFamily object represents a point of abstraction or variability in + the system. A PluginFamily defines a CLR Type that StructureMap can build, and all of the possible + Plugin’s implementing the CLR Type. + + + + + The CLR Type that defines the "Plugin" interface for the PluginFamily + + + + + The InstanceKey of the default instance of the PluginFamily + + + + + Custom collection class for PluginFamily's + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Models the runtime configuration of a StructureMap Container + + + + + Closes the PluginGraph for adding or removing members. Runs all the AssemblyScanner's + and attempts to attach concrete types to the proper plugin types. Calculates the Profile defaults. + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Adds an AssemblyScanner to the PluginGraph. Used for Testing. + + + + + + Add configuration to a PluginGraph with the Registry DSL + + + + + + Designates whether a PluginGraph has been "Sealed." + + + + + Represents a PropertyInfo of a Plugin.PluggedType that is filled by Setter Injection + + + + + Custom collection class for SetterProperty objects + + + + + Designates a CLR type that is loaded by name. + + + + + Interface for a "Factory" pattern class that creates object instances of the PluginType + + + + + The main "container" object that implements the Service Locator pattern + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates or finds the named instance of T + + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Gets all configured instances of type T using explicitly configured arguments from the "args" + + + + + + + + Gets the default instance of type T using the explicitly configured arguments from the "args" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + Gets the named instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + + Starts a "Nested" Container for atomic, isolated access + + + + + + Starts a new "Nested" Container for atomic, isolated service location. Opens + + + + + + + Provides queryable access to the configured PluginType's and Instances of this Container + + + + + The name of the container. By default this is set to + a random Guid. This is a convience property to + assist with debugging. Feel free to set to anything, + as this is not used in any logic. + + + + + Default implementation of IInstanceFactory + + + + + Constructor to use when troubleshooting possible configuration issues. + + + + + + Constructor to create an Container + + PluginGraph containing the instance and type definitions + for the Container + + + + Creates or finds the named instance of T + + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + Gets all configured instances of type T using explicitly configured arguments from the "args" + + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + + Starts a "Nested" Container for atomic, isolated access + + + + + + Starts a new "Nested" Container for atomic, isolated service location. Opens + + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Sets the default instance for the PluginType + + + + + + + Provides queryable access to the configured PluginType's and Instances of this Container + + + + + The name of the container. By default this is set to + a random Guid. This is a convience property to + assist with debugging. Feel free to set to anything, + as this is not used in any logic. + + + + + GoF Memento representing an Object Instance + + + + + Retrieves the named property value as a string + + + + + + + Template method for implementation specific retrieval of the named property + + + + + + + Returns the named child InstanceMemento + + + + + + + Template method for implementation specific retrieval of the named property + + + + + + + This method is made public for testing. It is not necessary for normal usage. + + + + + + Used to create a templated InstanceMemento + + + + + + + The named type of the object instance represented by the InstanceMemento. Translates to a concrete + type + + + + + The named key of the object instance represented by the InstanceMemento + + + + + Gets the referred template name + + + + + + Template pattern property specifying whether the InstanceMemento is simply a reference + to another named instance. Useful for child objects. + + + + + Template pattern property specifying the instance key that the InstanceMemento refers to + + + + + Is the InstanceMemento a reference to the default instance of the plugin type? + + + + + A TypeInterceptor that always applies to all Instances of a given Plugin Type + + + + + Abstract class that is the supertype of all storage and retrieval mechanisms of + InstanceMemento instances + + + + + Retrieves the named InstanceMemento + + The instanceKey of the requested InstanceMemento + + + + + Retrieves an array of all InstanceMemento's stored by this MementoSource + + + + + + Template pattern method. Determines if the MementoSource contains a definition for the + requested instanceKey. + + + + + + + Template pattern method. Retrieves an InstanceMemento for the instanceKey + + + + + + + The type of MementoSource + + + + + String description of the MementoSource. Used in the StructureMap-Client UI. + + + + + An in-memory implementation of InstanceMemento. + + + + + Creates an instance of MemoryInstanceMemento that represents a reference to another + instance. + + The referenced instance key to another instance + + + + + Creates a MemoryInstanceMemento that represents a reference to the default instance + of a plugin type. + + + + + + Constructs a MemoryInstanceMemento without properties + + The concrete key of the plugin type + The identifying instance key + + + + Constructs a MemoryInstanceMemento with properties + + The concrete key of the plugin type + The identifying instance key + NameValueCollection of instance properties + + + + Sets the value of the named property + + + + + + + Deletes a named property from the DefaultInstanceMemento + + + + + + Links a child InstanceMemento as a named property + + + + + + + Links an array of InstanceMemento's to a named array property + + + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + The main static Facade for the StructureMap container + + + + + Restarts ObjectFactory and blows away all Singleton's and cached instances. Use with caution. + + + + + Remove and dispose all objects scoped by HttpContext. Call this method at the *end* of an Http request to clean up resources + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the named instance of T + + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Provides queryable access to the configured PluginType's and Instances of the inner Container + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + Reads configuration XML documents and builds the structures necessary to initialize + the Container/IInstanceFactory/InstanceBuilder/ObjectInstanceActivator objects + + + + + Reads the configuration information and returns the PluginGraph definition of + plugin families and plugin's + + + + + + Generic implementation of an XmlMementoSource + + + + + Base class for all MementoSource classes that store InstanceMemento's as + node-normalized Xml + + + + + Implementation of MementoSource that stores and retrieves an XmlInstanceMemento per file in a named directory. + DirectoryXmlMementoSource is meant to simplify complicated object graph configurations by isolating each instance to a separate + editable file. + + + + + Stores an Xml InstanceMemento per file in a directory + + A ";" delimited list of directories to look for mementos. DirectoryXmlMementoSource + will use the FIRST directory it finds + The file extension of the InstanceMemento files without a dot. Typically "xml" + NodeNormalized or AttributeNormalized + + + + Implementation of MementoSource that stores and retrieves an XmlInstanceMemento per Embedded Resource file + in a named namespace. EmbeddedFolderXmlMementoSource is meant to simplify complicated object graph configurations + by isolating each instance to a separate + editable file. + + NodeNormalized or AttributeNormalized + The name of the Assembly with the embedded resources + The root namespace of all of the mementos. + The file extension of the memento files - "xml" + + + + An in-memory MementoSource + + + + + Retrieves Xml InstanceMemento's from an xml file stored as an embedded resource in an assembly. + + Designates the nodes that are memento nodes + NodeNormalized or AttributeNormalized + The name of the Assembly the file is embedded into + The path to the embedded resource within the file + + + + Default Constructor + + MementoSource that contains the Memento Templates + MementoSource that contains instances consisting of Template valuee + + + + Stores Attribute-normalized InstanceMemento's in an external file + + + + + Implementation of XmlMementoSource that reads InstanceMemento's from an external file. + Useful to break the StructureMap.config file into smaller pieces. + + + + + Default constructor + + Path to the xml file that contains the instance configuration + XPath expression to the parent node that contains the InstanceMemento nodes. + If empty, it defaults to the top node + The name of the nodes that are InstanceMemento nodes. Useful to store + different types of instances in the same file + + + + An implementation of InstanceMemento that stores properties as Xml attributes + Limited functionality + + + + + Implementation of InstanceMemento that stores information in a node-normalized + Xml format. + + + + + specify what type you'd like the service returned as + + + + + + + Specify the open generic type that should have a single generic parameter + + + + + + + Used as the argument in the Container.Configure() method to describe + configuration directives and specify the sources of configuration for + a Container + + + + + Creates and adds a Registry object of type T. + + The Registry Type + + + + Imports all the configuration from a Registry object + + + + + + Imports configuration from an Xml file. The fileName + must point to an Xml file with valid StructureMap + configuration + + + + + + Imports configuration directly from an XmlNode. This + method was intended for scenarios like Xml being embedded + into an assembly. The node must be a 'StructureMap' node + + + + + + If true, directs StructureMap to look for configuration in the App.config. + The default value is false. + + + + + Expression Builder to define an Instance + + + + + + Register a previously built Instance. This provides a "catch all" + method to attach custom Instance objects. Synonym for Instance() + + + + + + Inject this object directly. Synonym to Object() + + + + + + + Gives you full access to all the different ways to specify an "Instance" + + + + + An Expression Builder to define Instances of a PluginType. + This is mostly used for configuring open generic types + + + + + Shortcut to register a Concrete Type as an instance. This method supports + method chaining to allow you to add constructor and setter arguments for + the concrete type + + + + + + + Shortcut to simply use the Instance with the given name + + + + + + + An Expression Builder that is used throughout the Registry DSL to + add and define Instances + + + + + + Register a previously built Instance. This provides a "catch all" + method to attach custom Instance objects. Synonym for IsThis() + + + + + + Inject this object directly. Synonym to IsThis() + + + + + + + Build the Instance with the constructor function and setter arguments. Starts + the definition of a SmartInstance + + + + + + + Build the Instance with the constructor function and setter arguments. Starts + the definition of a SmartInstance + + + + + + + Build the Instance with the constructor function and setter arguments. Use this + method for open generic types, and favor the generic version of OfConcreteType + for all other types + + + + + + + Build the Instance with the constructor function and setter arguments. Use this + method for open generic types, and favor the generic version of OfConcreteType + for all other types + + + + + + + Create an Instance that builds an object by calling a Lambda or + an anonymous delegate with no arguments + + + + + + + Create an Instance that builds an object by calling a Lambda or + an anonymous delegate with the IContext representing + the current object graph. + + + + + + + Use the Instance of this PluginType with the specified name. This is + generally only used while configuring child dependencies within a deep + object graph + + + + + + + Use the default Instance of this PluginType. This is + generally only used while configuring child dependencies within a deep + object graph + + + + + + Creates an Instance that stores this object of type T, + and returns a cloned copy of the template. + + + + + + + Caches template as a serialized byte stream. Uses deserialization + to create copies when the Instance is built. + + + + + + + Creates an Instance that will load an ASCX user control from the url + + + + + + + Creates an Instance according to conditional rules + + + + + + + Used as an expression builder to specify setter injection policies + + + + + Directs StructureMap to treat all public setters of type T as + mandatory properties + + + + + + Directs StructureMap to tread all public setters with + a PropertyType that matches the predicate as a + mandatory setter + + + + + + Directs StructureMap to treat all public setters that match the + rule as mandatory properties + + + + + + Directs StructureMap to treat all public setters with a property + type in the specified namespace as mandatory properties + + + + + + Directs StructureMap to treat all public setters with a property + type in the specified namespace as mandatory properties + + + + + + Directs StructureMap to treat all public setters where to property name + matches the specified rule as a mandatory property + + + + + + Base class for creating an object instance from an InstanceMemento. SubClasses are + emitted for each concrete Plugin with constructor parameters. + + + + + Allows built-in registration conventions to be configurable through the assembly scanning DSL + + + Intended for StructureMap internal use only. + Custom registration convention instances can be directly configured + before being passed to IAssemblyScanner.With(IRegistrationConvention). + + + + + Simply query to see if there are any implementations registered + + + + + + Ejects any instances of this instance from the current container + and permanently removes the instance from the container configuration + + + + + + Eject all instances of this PluginType from the current container, + but leaves the lifecycle behavior + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Models the state of a Container or ObjectFactory. Can be used to query for the + existence of types registered with StructureMap + + + + + Can StructureMap fulfill a request to ObjectFactory.GetInstance(pluginType) from the + current configuration. This does not include concrete classes that could be auto-configured + upon demand + + + + + + + Can StructureMap fulfill a request to ObjectFactory.GetInstance<T>() from the + current configuration. This does not include concrete classes that could be auto-configured + upon demand + + + + + + + Queryable access to all of the InstanceRef for a given PluginType + + + + + + + Queryable access to all of the InstanceRef for a given PluginType + + + + + + Does the current container have existing configuration for the "pluginType" + + + + + + + Does the current container have existing configuration for the type T + + + + + + Find the concrete type for the default Instance of T. + In other words, when I call Container.GetInstance(Type), + what do I get? May be indeterminate + + + + + + + Find the concrete type for the default Instance of pluginType. + In other words, when I call Container.GetInstance(Type), + what do I get? May be indeterminate + + + + + + Retrieves the configuration for the given type + + + + + + + Retrieves the configuration for the given type + + + + + + + Eject all objects, configuration, and Plugin Types matching this filter + + + + + + Eject all objects and configuration for any Plugin Type that matches this filter + + + + + + Eject all objects and Instance configuration for this PluginType + + + + + + Get each and every configured instance that could possibly + be cast to T + + + + + + + Access to all the Plugin Type registrations + + + + + Makes sure that every request for this object returns a unique object + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + The actual concrete type of this Instance. Not every type of IInstance + can determine the ConcreteType + + + + + Ejects and removes all objects and the configuration for the named instance from the + container + + + + + + + Ejects and removes all objects and configuration for the instances that match the filter + + + + + + + Determines if the pluggedType can be upcast to the pluginType + + + + + + + + Determines if the PluggedType is a valid Plugin into the + PluginType + + + + + + + + Imports configuration from an Xml file. The fileName + must point to an Xml file with valid StructureMap + configuration + + + + + + Imports configuration directly from an XmlNode. This + method was intended for scenarios like Xml being embedded + into an assembly. The node must be a 'StructureMap' node + + + + + + Creates and adds a Registry object of type T. + + The Registry Type + + + + Imports all the configuration from a Registry object + + + + + + If true, makes the existence of the StructureMap.config mandatory. + The default is false. + + + + + If true, the StructureMap.config file will be ignored even if it exists. + The default is false. + + + + + If true, directs StructureMap to look for configuration in the App.config. + The default value is false. + + + + + Designate the Default Profile. This will be applied as soon as the + Container is initialized. + + + + + Retrieves the configuration for the given type + + + + + + + Retrieves the configuration for the given type + + + + + + + Eject all objects, configuration, and Plugin Types matching this filter + + + + + + Eject all objects and configuration for any Plugin Type that matches this filter + + + + + + Eject all objects and Instance configuration for this PluginType + + + + + + Get each and every configured instance that could possibly + be cast to T + + + + + + + The requested PluginType of the Instance being create + + + + + The Name of the Instance being created + + + + + The actual ConcreteType being created. This will not always + be available + + + + + Models the current place in an object graph during the construction of + an instance. Provides contextual information that can be used + to alter the desired construction of child objects + + + + + The requested PluginType of the Instance being create + + + + + The Name of the Instance being created + + + + + The actual ConcreteType being created. This will not always + be available + + + + + Provides metadata about the object graph being constructed. More or less a stack trace of the GetInstance() pipeline + that can be used for "contextual" object construction + + + + + The top level of the object graph. Describes the original requested instance + + + + + The current BuildFrame + + + + + The immediate parent BuildFrame + + + + + Defines the value of a primitive argument to a constructur argument + + + + + Sets the value of the constructor argument + + + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings + + The key in appSettings for the value to use. + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings when it exists. Otherwise uses the provided default value. + + The key in appSettings for the value to use. + The value to use if an entry for does not exist in the appSettings section. + + + + + Instance that builds objects with by calling constructor functions and using setter properties + + The concrete type constructed by SmartInstance + + + + Sets the name of this Instance + + + + + + + Sets the name of this Instance + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register an InstanceInterceptor with this Instance + + + + + + + Define a primitive constructor argument + + + + + + + Set simple setter properties + + + + + + + Define a primitive setter property by specifying the property name with + an expression + + + + + + + Define a primitive setter property by specifying the property name + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type. Do not + use this method if there is more than one constructor arguments of the same type + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type. Do not + use this method if there is more than one constructor arguments of the same type + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type and constructor name. + Use this method if there is more than one constructor arguments of the same type + + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type and constructor name. + Use this method if there is more than one constructor arguments of the same type + + + + + + + + Inline definition of a setter dependency. The property name is specified with an Expression + + + + + + + + Inline definition of a setter dependency. The property name is specified with an Expression + + + + + + + + Inline definition of a setter dependency. Only use this method if there + is only a single property of the SETTERTYPE + + + + + + + Inline definition of a setter dependency. Only use this method if there + is only a single property of the SETTERTYPE + + + + + + + Inline definition of a dependency on an Array of the CHILD type. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + Inline definition of a dependency on an Array of the CHILD type and the specified setter property or constructor argument name. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + + Inline definition of a dependency on an Array of the CHILD type. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + Inline definition of a dependency on an Array of the CHILD type and the specified setter property or constructor argument name. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + + Expression Builder to help define multiple Instances for an Array dependency + + + + + + Nested Closure that allows you to add an unlimited number of child Instances + + + + + + + Specify an array of Instance objects directly for an Array dependency + + + + + + + Expression Builder that helps to define child dependencies inline + + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings + + The key in appSettings for the value to use. + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings when it exists. Otherwise uses the provided default value. + + The key in appSettings for the value to use. + The value to use if an entry for does not exist in the appSettings section. + + + + + Nested Closure to define a child dependency inline + + + + + + + Shortcut to set an inline dependency to an Instance + + + + + + + Shortcut to set an inline dependency to a designated object + + + + + + + Shortcut to set an inline dependency to a designated object + + + + + + + Set an Inline dependency to the Default Instance of the Property type + Used mostly to force an optional Setter property to be filled by + StructureMap + + + + + + Shortcut method to define a child dependency inline + + + + + + + Shortcut method to define a child dependency inline and configure + the child dependency + + + + + + + Provides virtual methods that can be used by subclasses to parse an expression tree. + + + This class actually already exists in the System.Core assembly...as an internal class. + I can only speculate as to why it is internal, but it is obviously much too dangerous + for anyone outside of Microsoft to be using... + + + + diff --git a/TestApps/LOCTester/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache b/TestApps/LOCTester/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache new file mode 100644 index 000000000..dca452f56 Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/TestApps/LOCTester/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/TestApps/LOCTester/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 000000000..269f657fd Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/TestApps/LOCTester/obj/x86/Debug/LOCTester.Form1.resources b/TestApps/LOCTester/obj/x86/Debug/LOCTester.Form1.resources new file mode 100644 index 000000000..6c05a9776 Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Debug/LOCTester.Form1.resources differ diff --git a/TestApps/LOCTester/obj/x86/Debug/LOCTester.Properties.Resources.resources b/TestApps/LOCTester/obj/x86/Debug/LOCTester.Properties.Resources.resources new file mode 100644 index 000000000..6c05a9776 Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Debug/LOCTester.Properties.Resources.resources differ diff --git a/TestApps/LOCTester/obj/x86/Debug/LOCTester.csproj.FileListAbsolute.txt b/TestApps/LOCTester/obj/x86/Debug/LOCTester.csproj.FileListAbsolute.txt new file mode 100644 index 000000000..7477059a9 --- /dev/null +++ b/TestApps/LOCTester/obj/x86/Debug/LOCTester.csproj.FileListAbsolute.txt @@ -0,0 +1,18 @@ +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Debug\LOCTester.exe.config +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Debug\LOCTester.exe +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Debug\LOCTester.pdb +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Debug\LOC.Core.dll +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Debug\EntityFramework.dll +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Debug\StructureMap.dll +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Debug\Newtonsoft.Json.dll +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Debug\LOC.Core.pdb +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Debug\EntityFramework.xml +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Debug\StructureMap.pdb +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Debug\StructureMap.xml +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Debug\Newtonsoft.Json.xml +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\obj\x86\Debug\LOCTester.csprojResolveAssemblyReference.cache +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\obj\x86\Debug\LOCTester.Form1.resources +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\obj\x86\Debug\LOCTester.Properties.Resources.resources +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\obj\x86\Debug\LOCTester.csproj.GenerateResource.Cache +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\obj\x86\Debug\LOCTester.exe +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\obj\x86\Debug\LOCTester.pdb diff --git a/TestApps/LOCTester/obj/x86/Debug/LOCTester.csproj.GenerateResource.Cache b/TestApps/LOCTester/obj/x86/Debug/LOCTester.csproj.GenerateResource.Cache new file mode 100644 index 000000000..6ff9dfcba Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Debug/LOCTester.csproj.GenerateResource.Cache differ diff --git a/TestApps/LOCTester/obj/x86/Debug/LOCTester.csprojResolveAssemblyReference.cache b/TestApps/LOCTester/obj/x86/Debug/LOCTester.csprojResolveAssemblyReference.cache new file mode 100644 index 000000000..f4f990854 Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Debug/LOCTester.csprojResolveAssemblyReference.cache differ diff --git a/TestApps/LOCTester/obj/x86/Debug/LOCTester.exe b/TestApps/LOCTester/obj/x86/Debug/LOCTester.exe new file mode 100644 index 000000000..51c3bdca0 Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Debug/LOCTester.exe differ diff --git a/TestApps/LOCTester/obj/x86/Debug/LOCTester.pdb b/TestApps/LOCTester/obj/x86/Debug/LOCTester.pdb new file mode 100644 index 000000000..92a434b17 Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Debug/LOCTester.pdb differ diff --git a/TestApps/LOCTester/obj/x86/Debug/TempPE/Properties.Resources.Designer.cs.dll b/TestApps/LOCTester/obj/x86/Debug/TempPE/Properties.Resources.Designer.cs.dll new file mode 100644 index 000000000..a9e434e6f Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Debug/TempPE/Properties.Resources.Designer.cs.dll differ diff --git a/TestApps/LOCTester/obj/x86/Release/DesignTimeResolveAssemblyReferences.cache b/TestApps/LOCTester/obj/x86/Release/DesignTimeResolveAssemblyReferences.cache new file mode 100644 index 000000000..e1050e051 Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Release/DesignTimeResolveAssemblyReferences.cache differ diff --git a/TestApps/LOCTester/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache b/TestApps/LOCTester/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 000000000..3e15b1e4f Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/TestApps/LOCTester/obj/x86/Release/LOCTester.Form1.resources b/TestApps/LOCTester/obj/x86/Release/LOCTester.Form1.resources new file mode 100644 index 000000000..6c05a9776 Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Release/LOCTester.Form1.resources differ diff --git a/TestApps/LOCTester/obj/x86/Release/LOCTester.Properties.Resources.resources b/TestApps/LOCTester/obj/x86/Release/LOCTester.Properties.Resources.resources new file mode 100644 index 000000000..6c05a9776 Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Release/LOCTester.Properties.Resources.resources differ diff --git a/TestApps/LOCTester/obj/x86/Release/LOCTester.csproj.FileListAbsolute.txt b/TestApps/LOCTester/obj/x86/Release/LOCTester.csproj.FileListAbsolute.txt new file mode 100644 index 000000000..243daa647 --- /dev/null +++ b/TestApps/LOCTester/obj/x86/Release/LOCTester.csproj.FileListAbsolute.txt @@ -0,0 +1,18 @@ +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\obj\x86\Release\LOCTester.Form1.resources +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\obj\x86\Release\LOCTester.Properties.Resources.resources +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Release\LOCTester.exe.config +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Release\LOCTester.exe +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Release\LOCTester.pdb +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Release\LOC.Core.dll +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Release\EntityFramework.dll +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Release\StructureMap.dll +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Release\Newtonsoft.Json.dll +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Release\LOC.Core.pdb +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Release\EntityFramework.xml +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Release\StructureMap.pdb +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Release\StructureMap.xml +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\bin\Release\Newtonsoft.Json.xml +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\obj\x86\Release\LOCTester.exe +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\obj\x86\Release\LOCTester.pdb +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\obj\x86\Release\LOCTester.csprojResolveAssemblyReference.cache +C:\Work\Nautilus\Minecraft\TestApps\LOCTester\obj\x86\Release\LOCTester.csproj.GenerateResource.Cache diff --git a/TestApps/LOCTester/obj/x86/Release/LOCTester.csproj.GenerateResource.Cache b/TestApps/LOCTester/obj/x86/Release/LOCTester.csproj.GenerateResource.Cache new file mode 100644 index 000000000..7ed536e78 Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Release/LOCTester.csproj.GenerateResource.Cache differ diff --git a/TestApps/LOCTester/obj/x86/Release/LOCTester.csprojResolveAssemblyReference.cache b/TestApps/LOCTester/obj/x86/Release/LOCTester.csprojResolveAssemblyReference.cache new file mode 100644 index 000000000..2757f7935 Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Release/LOCTester.csprojResolveAssemblyReference.cache differ diff --git a/TestApps/LOCTester/obj/x86/Release/LOCTester.exe b/TestApps/LOCTester/obj/x86/Release/LOCTester.exe new file mode 100644 index 000000000..6c6821d9b Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Release/LOCTester.exe differ diff --git a/TestApps/LOCTester/obj/x86/Release/LOCTester.pdb b/TestApps/LOCTester/obj/x86/Release/LOCTester.pdb new file mode 100644 index 000000000..fb1cf793b Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Release/LOCTester.pdb differ diff --git a/TestApps/LOCTester/obj/x86/Release/TempPE/Properties.Resources.Designer.cs.dll b/TestApps/LOCTester/obj/x86/Release/TempPE/Properties.Resources.Designer.cs.dll new file mode 100644 index 000000000..111c03b5c Binary files /dev/null and b/TestApps/LOCTester/obj/x86/Release/TempPE/Properties.Resources.Designer.cs.dll differ diff --git a/TexturePack/mk64.zip b/TexturePack/mk64.zip new file mode 100644 index 000000000..e73db2aa7 Binary files /dev/null and b/TexturePack/mk64.zip differ diff --git a/Webserver/ServerHandler/ServerHandler.1.2.dotCover b/Webserver/ServerHandler/ServerHandler.1.2.dotCover new file mode 100644 index 000000000..6f8c06edc --- /dev/null +++ b/Webserver/ServerHandler/ServerHandler.1.2.dotCover @@ -0,0 +1,11 @@ + + + C:\Work\LOC\Webserver\ServerHandler + + + + + + + + \ No newline at end of file diff --git a/Webserver/ServerHandler/ServerHandler.5.1.ReSharper.user b/Webserver/ServerHandler/ServerHandler.5.1.ReSharper.user new file mode 100644 index 000000000..1ea032aa0 --- /dev/null +++ b/Webserver/ServerHandler/ServerHandler.5.1.ReSharper.user @@ -0,0 +1,169 @@ + + + + + + False + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Never + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Webserver/ServerHandler/ServerHandler.sln b/Webserver/ServerHandler/ServerHandler.sln new file mode 100644 index 000000000..e17e98ca0 --- /dev/null +++ b/Webserver/ServerHandler/ServerHandler.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerHandler", "ServerHandler\ServerHandler.csproj", "{7674049F-5C67-4CD0-AD1F-8F23C718E37B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7674049F-5C67-4CD0-AD1F-8F23C718E37B}.Debug|x86.ActiveCfg = Debug|x86 + {7674049F-5C67-4CD0-AD1F-8F23C718E37B}.Debug|x86.Build.0 = Debug|x86 + {7674049F-5C67-4CD0-AD1F-8F23C718E37B}.Release|x86.ActiveCfg = Release|x86 + {7674049F-5C67-4CD0-AD1F-8F23C718E37B}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Webserver/ServerHandler/ServerHandler.sln.DotSettings.user b/Webserver/ServerHandler/ServerHandler.sln.DotSettings.user new file mode 100644 index 000000000..24050a119 --- /dev/null +++ b/Webserver/ServerHandler/ServerHandler.sln.DotSettings.user @@ -0,0 +1,2 @@ + + True \ No newline at end of file diff --git a/Webserver/ServerHandler/ServerHandler.suo b/Webserver/ServerHandler/ServerHandler.suo new file mode 100644 index 000000000..f64c6cf90 Binary files /dev/null and b/Webserver/ServerHandler/ServerHandler.suo differ diff --git a/Webserver/ServerHandler/ServerHandler/Form1.Designer.cs b/Webserver/ServerHandler/ServerHandler/Form1.Designer.cs new file mode 100644 index 000000000..cd7d9756a --- /dev/null +++ b/Webserver/ServerHandler/ServerHandler/Form1.Designer.cs @@ -0,0 +1,175 @@ +namespace ServerHandler +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.button5 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(100, 12); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(135, 26); + this.button1.TabIndex = 0; + this.button1.Text = "Start"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(100, 55); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(135, 26); + this.button2.TabIndex = 1; + this.button2.Text = "Start"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button3 + // + this.button3.Location = new System.Drawing.Point(100, 97); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(135, 26); + this.button3.TabIndex = 2; + this.button3.Text = "Start"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button4 + // + this.button4.Location = new System.Drawing.Point(100, 138); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(135, 26); + this.button4.TabIndex = 3; + this.button4.Text = "Start"; + this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(37, 19); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(29, 13); + this.label1.TabIndex = 4; + this.label1.Text = "HG1"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(37, 62); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(29, 13); + this.label2.TabIndex = 5; + this.label2.Text = "HG2"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(37, 104); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(29, 13); + this.label3.TabIndex = 6; + this.label3.Text = "HG3"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(37, 145); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(29, 13); + this.label4.TabIndex = 7; + this.label4.Text = "HG4"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(37, 184); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(29, 13); + this.label5.TabIndex = 9; + this.label5.Text = "HG5"; + // + // button5 + // + this.button5.Location = new System.Drawing.Point(100, 177); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(135, 26); + this.button5.TabIndex = 8; + this.button5.Text = "Start"; + this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.button5_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(244, 216); + this.Controls.Add(this.label5); + this.Controls.Add(this.button5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.Closing += OnFormClosing; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Button button5; + } +} + diff --git a/Webserver/ServerHandler/ServerHandler/Form1.cs b/Webserver/ServerHandler/ServerHandler/Form1.cs new file mode 100644 index 000000000..31a143d17 --- /dev/null +++ b/Webserver/ServerHandler/ServerHandler/Form1.cs @@ -0,0 +1,72 @@ +namespace ServerHandler +{ + using System; + using System.Windows.Forms; + + public partial class Form1 : Form + { + private readonly Server _hg1; + private readonly Server _hg2; + private readonly Server _hg3; + private readonly Server _hg4; + private readonly Server _hg5; + + public Form1() + { + InitializeComponent(); + + _hg1 = new Server("hg1"); + _hg2 = new Server("hg2"); + _hg3 = new Server("hg3"); + _hg4 = new Server("hg4"); + _hg5 = new Server("hg5"); + } + + private void OnFormClosing(object sender, EventArgs e) + { + _hg1.Stop(); + _hg2.Stop(); + _hg3.Stop(); + _hg4.Stop(); + } + + private void button1_Click(object sender, EventArgs e) + { + ToggleServerAndButton(_hg1, (Button)sender); + } + + private void button2_Click(object sender, EventArgs e) + { + ToggleServerAndButton(_hg2, (Button)sender); + } + + private void button3_Click(object sender, EventArgs e) + { + ToggleServerAndButton(_hg3, (Button)sender); + } + + private void button4_Click(object sender, EventArgs e) + { + ToggleServerAndButton(_hg4, (Button)sender); + } + + private void button5_Click(object sender, EventArgs e) + { + ToggleServerAndButton(_hg5, (Button) sender); + } + + private void ToggleServerAndButton(Server server, Button button) + { + server.ToggleRunning(); + + if (server.ShouldBeRunning()) + { + button.Text = "Stop"; + } + else + { + button.Text = "Start"; + } + } + } +} diff --git a/Webserver/ServerHandler/ServerHandler/Form1.resx b/Webserver/ServerHandler/ServerHandler/Form1.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/Webserver/ServerHandler/ServerHandler/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Webserver/ServerHandler/ServerHandler/Program.cs b/Webserver/ServerHandler/ServerHandler/Program.cs new file mode 100644 index 000000000..04bcfffe3 --- /dev/null +++ b/Webserver/ServerHandler/ServerHandler/Program.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +namespace ServerHandler +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Webserver/ServerHandler/ServerHandler/Properties/AssemblyInfo.cs b/Webserver/ServerHandler/ServerHandler/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..c5af84309 --- /dev/null +++ b/Webserver/ServerHandler/ServerHandler/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ServerHandler")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Windows User")] +[assembly: AssemblyProduct("ServerHandler")] +[assembly: AssemblyCopyright("Copyright © Windows User 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6c5498e0-d3d9-4c0a-8a68-0c1de5bda313")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Webserver/ServerHandler/ServerHandler/Properties/Resources.Designer.cs b/Webserver/ServerHandler/ServerHandler/Properties/Resources.Designer.cs new file mode 100644 index 000000000..271284c8a --- /dev/null +++ b/Webserver/ServerHandler/ServerHandler/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.269 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ServerHandler.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ServerHandler.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Webserver/ServerHandler/ServerHandler/Properties/Resources.resx b/Webserver/ServerHandler/ServerHandler/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Webserver/ServerHandler/ServerHandler/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Webserver/ServerHandler/ServerHandler/Properties/Settings.Designer.cs b/Webserver/ServerHandler/ServerHandler/Properties/Settings.Designer.cs new file mode 100644 index 000000000..693ed01ca --- /dev/null +++ b/Webserver/ServerHandler/ServerHandler/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.269 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ServerHandler.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Webserver/ServerHandler/ServerHandler/Properties/Settings.settings b/Webserver/ServerHandler/ServerHandler/Properties/Settings.settings new file mode 100644 index 000000000..39645652a --- /dev/null +++ b/Webserver/ServerHandler/ServerHandler/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Webserver/ServerHandler/ServerHandler/Server.cs b/Webserver/ServerHandler/ServerHandler/Server.cs new file mode 100644 index 000000000..710fed810 --- /dev/null +++ b/Webserver/ServerHandler/ServerHandler/Server.cs @@ -0,0 +1,117 @@ +namespace ServerHandler +{ + using System; + using System.Diagnostics; + using System.IO; + using System.Reflection; + using System.Threading; + using System.Windows.Forms; + + public class Server + { + private bool _shouldBeRunning; + private Thread _watcherThread; + private Process _serverProcess; + private String _path; + + public Server(String path) + { + _path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\" + path; + + _watcherThread = new Thread(Watch); + _watcherThread.Start(); + } + + public bool ShouldBeRunning() + { + return _shouldBeRunning; + } + + public void ToggleRunning() + { + _shouldBeRunning = !_shouldBeRunning; + + if (_serverProcess == null) + { + try + { + String memParams = "-Djava.ext.dirs=lib -Xincgc -Xmx2048M "; + String args = memParams + "-jar " + "\"" + _path + @"\craftbukkit-0.0.1-snapshot.jar"; + var processInfo = new ProcessStartInfo("java.exe", args); + processInfo.WorkingDirectory = _path; + processInfo.Verb = "runas"; + processInfo.UseShellExecute = false; + + _serverProcess = new Process(); + _serverProcess.StartInfo = processInfo; + } + catch (Exception ex) + { + MessageBox.Show("Error creating process " + ex.Message + "\n" + ex.StackTrace); + } + } + + if (!_shouldBeRunning) + { + if (!_serverProcess.HasExited) + { + _serverProcess.Kill(); + } + } + } + + public void PrepFiles() + { + var worldDirectory = new DirectoryInfo(_path + @"\world"); + var worldEndDirectory = new DirectoryInfo(_path + @"\world_the_end"); + + try + { + if (worldDirectory.Exists) + worldDirectory.Delete(true); + + if (worldEndDirectory.Exists) + worldEndDirectory.Delete(true); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message + "\n" + ex.StackTrace); + } + + var commonDirectory = new DirectoryInfo(Directory.GetParent(Assembly.GetExecutingAssembly().Location) + @"\Common"); + + var files = commonDirectory.GetFiles(); + + // Copy the files and overwrite destination files if they already exist. + foreach (var file in files) + { + file.CopyTo(_path + @"\" + file.Name, true); + } + } + + public void Start() + { + _serverProcess.Start(); + _serverProcess.WaitForExit(); + } + + public void Stop() + { + _watcherThread.Abort(); + } + + public void Watch() + { + while (true) + { + if (_shouldBeRunning) + { + PrepFiles(); + Start(); + } + + Thread.Sleep(2000); + } + } + } +} diff --git a/Webserver/ServerHandler/ServerHandler/ServerHandler.csproj b/Webserver/ServerHandler/ServerHandler/ServerHandler.csproj new file mode 100644 index 000000000..e55df82b5 --- /dev/null +++ b/Webserver/ServerHandler/ServerHandler/ServerHandler.csproj @@ -0,0 +1,92 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {7674049F-5C67-4CD0-AD1F-8F23C718E37B} + WinExe + Properties + ServerHandler + ServerHandler + v4.0 + Client + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + app.manifest + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + \ No newline at end of file diff --git a/Webserver/ServerHandler/ServerHandler/app.manifest b/Webserver/ServerHandler/ServerHandler/app.manifest new file mode 100644 index 000000000..423791a64 --- /dev/null +++ b/Webserver/ServerHandler/ServerHandler/app.manifest @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Website/DBTesting/bin/Debug/DBTesting.dll b/Website/DBTesting/bin/Debug/DBTesting.dll new file mode 100644 index 000000000..89268e3f1 Binary files /dev/null and b/Website/DBTesting/bin/Debug/DBTesting.dll differ diff --git a/Website/DBTesting/bin/Debug/DBTesting.pdb b/Website/DBTesting/bin/Debug/DBTesting.pdb new file mode 100644 index 000000000..ba4b3c0f9 Binary files /dev/null and b/Website/DBTesting/bin/Debug/DBTesting.pdb differ diff --git a/Website/DBTesting/bin/Release/DBTesting.dll b/Website/DBTesting/bin/Release/DBTesting.dll new file mode 100644 index 000000000..686401cf4 Binary files /dev/null and b/Website/DBTesting/bin/Release/DBTesting.dll differ diff --git a/Website/DBTesting/bin/Release/DBTesting.pdb b/Website/DBTesting/bin/Release/DBTesting.pdb new file mode 100644 index 000000000..af08c7044 Binary files /dev/null and b/Website/DBTesting/bin/Release/DBTesting.pdb differ diff --git a/Website/DBTesting/obj/Debug/DBTesting.csproj.FileListAbsolute.txt b/Website/DBTesting/obj/Debug/DBTesting.csproj.FileListAbsolute.txt new file mode 100644 index 000000000..27fb77b7f --- /dev/null +++ b/Website/DBTesting/obj/Debug/DBTesting.csproj.FileListAbsolute.txt @@ -0,0 +1,4 @@ +C:\Work\Nautilus\Minecraft\Website\DBTesting\bin\Debug\DBTesting.dll +C:\Work\Nautilus\Minecraft\Website\DBTesting\bin\Debug\DBTesting.pdb +C:\Work\Nautilus\Minecraft\Website\DBTesting\obj\Debug\DBTesting.dll +C:\Work\Nautilus\Minecraft\Website\DBTesting\obj\Debug\DBTesting.pdb diff --git a/Website/DBTesting/obj/Debug/DBTesting.dll b/Website/DBTesting/obj/Debug/DBTesting.dll new file mode 100644 index 000000000..89268e3f1 Binary files /dev/null and b/Website/DBTesting/obj/Debug/DBTesting.dll differ diff --git a/Website/DBTesting/obj/Debug/DBTesting.pdb b/Website/DBTesting/obj/Debug/DBTesting.pdb new file mode 100644 index 000000000..ba4b3c0f9 Binary files /dev/null and b/Website/DBTesting/obj/Debug/DBTesting.pdb differ diff --git a/Website/DBTesting/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Website/DBTesting/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 000000000..6e06d85e0 Binary files /dev/null and b/Website/DBTesting/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Website/DBTesting/obj/Release/DBTesting.csproj.FileListAbsolute.txt b/Website/DBTesting/obj/Release/DBTesting.csproj.FileListAbsolute.txt new file mode 100644 index 000000000..c6e4973c0 --- /dev/null +++ b/Website/DBTesting/obj/Release/DBTesting.csproj.FileListAbsolute.txt @@ -0,0 +1,4 @@ +C:\Work\Nautilus\Minecraft\Website\DBTesting\bin\Release\DBTesting.dll +C:\Work\Nautilus\Minecraft\Website\DBTesting\bin\Release\DBTesting.pdb +C:\Work\Nautilus\Minecraft\Website\DBTesting\obj\Release\DBTesting.dll +C:\Work\Nautilus\Minecraft\Website\DBTesting\obj\Release\DBTesting.pdb diff --git a/Website/DBTesting/obj/Release/DBTesting.dll b/Website/DBTesting/obj/Release/DBTesting.dll new file mode 100644 index 000000000..686401cf4 Binary files /dev/null and b/Website/DBTesting/obj/Release/DBTesting.dll differ diff --git a/Website/DBTesting/obj/Release/DBTesting.pdb b/Website/DBTesting/obj/Release/DBTesting.pdb new file mode 100644 index 000000000..af08c7044 Binary files /dev/null and b/Website/DBTesting/obj/Release/DBTesting.pdb differ diff --git a/Website/DBTesting/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache b/Website/DBTesting/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 000000000..e73a8274f Binary files /dev/null and b/Website/DBTesting/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Website/LOC.Core/App.config b/Website/LOC.Core/App.config new file mode 100644 index 000000000..e4a04a17d --- /dev/null +++ b/Website/LOC.Core/App.config @@ -0,0 +1,14 @@ + + + + +
+ + + + + + + + + \ No newline at end of file diff --git a/Website/LOC.Core/Data/ContentType.cs b/Website/LOC.Core/Data/ContentType.cs new file mode 100644 index 000000000..3140501c7 --- /dev/null +++ b/Website/LOC.Core/Data/ContentType.cs @@ -0,0 +1,7 @@ +namespace LOC.Core.Data +{ + public static class ContentType + { + public static string Json = "application/json"; + } +} \ No newline at end of file diff --git a/Website/LOC.Core/Data/ContextExtensions.cs b/Website/LOC.Core/Data/ContextExtensions.cs new file mode 100644 index 000000000..b2fbda269 --- /dev/null +++ b/Website/LOC.Core/Data/ContextExtensions.cs @@ -0,0 +1,183 @@ +namespace LOC.Core.Data +{ + using System; + using System.Collections.Generic; + using System.Data.Entity; + using System.Data.Entity.Infrastructure; + using System.Data.Metadata.Edm; + using System.Data.Objects; + using System.Linq; + using System.Linq.Expressions; + using System.Text; + using System.Text.RegularExpressions; + + public static class ContextExtensions + { + private const string INDITIFY_OBJECT = "SELECT * FROM sys.indexes where name='{0}'"; + + public static object[] KeyValuesFor(this DbContext context, TEntity entity) where TEntity : class + { + var entry = context.Entry(entity); + return context.KeysFor(entity.GetType()).Select(x => entry.Property(x).CurrentValue).ToArray(); + } + + public static IQueryable LoadNavigationProperties(this IQueryable query, DbContext context) + where TEntity : class + { + var entityType = GetEntityType(context, typeof(TEntity)); + if (entityType == null) + { + throw new ArgumentException(string.Format("The type '{0}' is not mapped as an entity type.", entityType.Name)); + } + + return entityType.NavigationProperties.Aggregate( + query, + (current, navigationProperty) => current.Include(navigationProperty.Name)); + } + + public static void LoadNavigationProperties(this TEntity entity, DbContext context) where TEntity : class + { + if (entity == null) + { + return; + } + + var objectContext = ((IObjectContextAdapter)context).ObjectContext; + var items = objectContext.MetadataWorkspace.GetItems(DataSpace.OSpace); + var item = items == null + ? null + : items.FirstOrDefault(x => x.Name.Equals(ObjectContext.GetObjectType(entity.GetType()).Name)); + var navigationPropertyNames = item == null ? new List() : item.NavigationProperties.Select(x => x.Name); + foreach (var prop in navigationPropertyNames) + { + objectContext.LoadProperty(entity, prop); + } + } + + public static void CreateIndex(this DbContext context, Expression> expression, bool isUnique) where T : class + { + var database = context.Database; + if (database == null) + { + throw new ArgumentNullException("context", @"Database is null"); + } + + var realtableName = GetTableName(context); + var tablename = typeof(T).Name; + var columnName = GetColumnExpressionName(expression.Body); + var indexColumnName = GetColumnName(expression.Body); + var indexName = string.Format("IX_{0}_{1}", tablename, columnName); + var createIndexSql = string.Format( + isUnique ? "CREATE UNIQUE INDEX {0} ON {1} ({2})" : "CREATE INDEX {0} ON {1} ({2})", + indexName, + realtableName, + indexColumnName); + //TODO Check index? + var checkIndex = string.Format(INDITIFY_OBJECT, indexName); + var result = database.SqlQuery(checkIndex).Count(); + if (result <= 0) + { + //TODO Create index + database.ExecuteSqlCommand(createIndexSql); + } + } + + private static string GetColumnExpressionName(Expression expression) + { + var memberExps = expression as NewExpression; + + if (memberExps != null) + { + var sb = new StringBuilder(); + + foreach (var memberExp in memberExps.Arguments) + { + var member = memberExp as MemberExpression; + if (memberExp == null + || member == null) + { + throw new ArgumentException(@"Cannot get name from expression", "expression"); + } + + sb.Append(member.Member.Name); + sb.Append("_"); + } + return sb.ToString().Substring(0, sb.ToString().Length - 1); + } + return string.Empty; + } + + private static string GetColumnName(Expression expression) + { + var memberExps = expression as NewExpression; + + if (memberExps != null) + { + var sb = new StringBuilder(); + + foreach (var memberExp in memberExps.Arguments) + { + var member = memberExp as MemberExpression; + if (memberExp == null + || member == null) + { + throw new ArgumentException(@"Cannot get name from expression", "expression"); + } + + sb.Append(member.Member.Name); + sb.Append(","); + } + return sb.ToString().Substring(0, sb.ToString().Length - 1); + } + return string.Empty; + } + + private static EntityType GetEntityType(IObjectContextAdapter context, Type entityType) + { + entityType = ObjectContext.GetObjectType(entityType); + + var workspace = context.ObjectContext.MetadataWorkspace; + var itemCollection = (ObjectItemCollection)workspace.GetItemCollection(DataSpace.OSpace); + + EntityType type; + if (workspace == null) + { + type = null; + } + else + { + var types = workspace.GetItems(DataSpace.OSpace); + type = types == null ? null : types.SingleOrDefault(t => itemCollection.GetClrType(t) == entityType); + } + return type; + } + + private static string GetTableName(IObjectContextAdapter context) where T : class + { + var objectContext = context.ObjectContext; + return GetTableName(objectContext); + } + + private static string GetTableName(ObjectContext context) where T : class + { + var sql = context.CreateObjectSet().ToTraceString(); + var regex = new Regex("FROM (?.*) AS"); + var match = regex.Match(sql); + var table = match.Groups["table"].Value; + return table; + } + + private static IEnumerable KeysFor(this IObjectContextAdapter context, Type entityType) + { + var type = GetEntityType(context, entityType); + + if (type == null) + { + throw new ArgumentException( + string.Format("The type '{0}' is not mapped as an entity type.", entityType.Name), "entityType"); + } + + return type.KeyMembers.Select(k => k.Name); + } + } +} diff --git a/Website/LOC.Core/Data/IRepository.cs b/Website/LOC.Core/Data/IRepository.cs new file mode 100644 index 000000000..afc70bebb --- /dev/null +++ b/Website/LOC.Core/Data/IRepository.cs @@ -0,0 +1,25 @@ +namespace LOC.Core.Data +{ + using System; + using System.Data.Entity; + using System.Linq; + using System.Linq.Expressions; + + public interface IRepository : IDisposable + { + TEntity Add(TEntity entity) where TEntity : class; + bool Any(Expression> predicate) where TEntity : class; + bool Any() where TEntity : class; + + void CommitChanges(); + void Delete(TEntity entity) where TEntity : class; + void Edit(TEntity entity) where TEntity : class; + void Attach(TEntity entity) where TEntity : class; + + IQueryable GetAll() where TEntity : class; + + TEntity GetByKeyValues(params object[] keyValues) where TEntity : class; + IQueryable Where(Expression> predicate) where TEntity : class; + DbContext Context { get; } + } +} diff --git a/Website/LOC.Core/Data/IRepositoryFactory.cs b/Website/LOC.Core/Data/IRepositoryFactory.cs new file mode 100644 index 000000000..9c5f3df72 --- /dev/null +++ b/Website/LOC.Core/Data/IRepositoryFactory.cs @@ -0,0 +1,11 @@ +namespace LOC.Core.Data +{ + using System.Data.Entity; + using StructureMap; + + [PluginFamily(IsSingleton = true, Scope = InstanceScope.Singleton)] + public interface IRepositoryFactory + { + IRepository CreateRepository() where TContext : DbContext, new(); + } +} diff --git a/Website/LOC.Core/Data/IRestCallJsonWrapper.cs b/Website/LOC.Core/Data/IRestCallJsonWrapper.cs new file mode 100644 index 000000000..79a4a0934 --- /dev/null +++ b/Website/LOC.Core/Data/IRestCallJsonWrapper.cs @@ -0,0 +1,10 @@ +namespace LOC.Core.Data +{ + using System; + + public interface IRestCallJsonWrapper + { + T MakeCall(object data, Uri uri, RestCallType restCallType, double timeoutInSeconds = 100); + void MakeCall(object data, Uri uri, RestCallType restCallType, double timeoutInSeconds = 100); + } +} diff --git a/Website/LOC.Core/Data/Repository.cs b/Website/LOC.Core/Data/Repository.cs new file mode 100644 index 000000000..f9746a6c9 --- /dev/null +++ b/Website/LOC.Core/Data/Repository.cs @@ -0,0 +1,126 @@ +namespace LOC.Core.Data +{ + using System; + using System.Data; + using System.Data.Entity; + using System.Data.Entity.Infrastructure; + using System.Data.Entity.Validation; + using System.Linq; + using System.Linq.Expressions; + + public class Repository : IRepository + where TContext : DbContext + { + public Repository(TContext context) + { + Context = context; + } + + public DbContext Context { get; private set; } + + public virtual TEntity Add(TEntity entity) where TEntity : class + { + return Context.Set().Add(entity); + } + + public bool Any(Expression> predicate) where TEntity : class + { + return Context.Set().AsQueryable().Any(predicate); + } + + public bool Any() where TEntity : class + { + return Context.Set().Any(); + } + + public void AddOrEdit(TEntity entity) where TEntity : class + { + var tracked = Context.Set().Find(Context.KeyValuesFor(entity)); + if (tracked != null) + { + Context.Entry(tracked).CurrentValues.SetValues(entity); + } + else + { + Context.Set().Add(entity); + } + } + + public void CommitChanges() + { + const string PREFIX = "CommitChanges() failed because: "; + try + { + Context.SaveChanges(); + } + catch (DbEntityValidationException ex) + { + var l = (from err in ex.EntityValidationErrors from ve in err.ValidationErrors select ve.ErrorMessage).ToList(); + throw new ApplicationException(PREFIX + String.Join("; ", l), ex); // contains the human-readable validation exception + } + catch (DbUpdateException e) + { + if (e.InnerException != null && e.InnerException.InnerException != null && !String.IsNullOrEmpty(e.InnerException.InnerException.Message)) + { + throw new ApplicationException(PREFIX + String.Join("; ", e.InnerException.InnerException.Message), e); // contains the reason + } + throw; + } + } + + public virtual void Delete(TEntity entity) where TEntity : class + { + Context.Set().Attach(entity); + Context.Set().Remove(entity); + } + + public virtual void Edit(TEntity entity) where TEntity : class + { + Context.Entry(entity).State = EntityState.Modified; + } + + public virtual void Attach(TEntity entity) where TEntity : class + { + Context.Set().Attach(entity); + } + + public virtual TEntity GetByKeyValues(params object[] keyValues) where TEntity : class + { + var entity = Context.Set().Find(keyValues); + entity.LoadNavigationProperties(Context); + return entity; + } + + public IQueryable Where(Expression> predicate) where TEntity : class + { + var query = Context.Set().AsQueryable().Where(predicate); + return query; + } + + public IQueryable GetAll() where TEntity : class + { + var query = Context.Set().AsQueryable(); + return query; + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposing) + { + var context = Context; + Context = null; + if (context != null) + { + context.Dispose(); + } + } + } + } +} + diff --git a/Website/LOC.Core/Data/RepositoryFactory.cs b/Website/LOC.Core/Data/RepositoryFactory.cs new file mode 100644 index 000000000..06dc85485 --- /dev/null +++ b/Website/LOC.Core/Data/RepositoryFactory.cs @@ -0,0 +1,12 @@ +namespace LOC.Core.Data +{ + using System.Data.Entity; + + public class RepositoryFactory : IRepositoryFactory + { + public IRepository CreateRepository() where TContext : DbContext, new() + { + return new Repository(new TContext()); + } + } +} diff --git a/Website/LOC.Core/Data/RestCallJsonWrapper.cs b/Website/LOC.Core/Data/RestCallJsonWrapper.cs new file mode 100644 index 000000000..7f0f25ecb --- /dev/null +++ b/Website/LOC.Core/Data/RestCallJsonWrapper.cs @@ -0,0 +1,64 @@ +namespace LOC.Core.Data +{ + using System; + using System.IO; + using System.Net; + using System.Web; + using Newtonsoft.Json; + + public class RestCallJsonWrapper : IRestCallJsonWrapper + { + public T MakeCall(object data, Uri uri, RestCallType restCallType, double timeoutInSeconds) + { + var response = InitiateRequest(uri, restCallType, data, timeoutInSeconds); + T result; + using (var streamReader = new StreamReader(response.GetResponseStream())) + { + var responseText = streamReader.ReadToEnd(); + result = JsonConvert.DeserializeObject(responseText); + } + + return result; + } + + public void MakeCall(object data, Uri uri, RestCallType restCallType, double timeoutInSeconds) + { + var response = InitiateRequest(uri, restCallType, data); + if (response.StatusCode + != HttpStatusCode.OK) + { + // TODO: need handling code here + throw new HttpException((int)response.StatusCode, "Received a not OK response from the server."); + } + } + + private static HttpWebResponse InitiateRequest(Uri uri, RestCallType restCallType, object data, double timeoutInSeconds = 100) + { + var request = (HttpWebRequest)WebRequest.Create(uri); + request.Timeout = (int)TimeSpan.FromSeconds(timeoutInSeconds).TotalMilliseconds; + request.ContentType = "application/json"; + switch (restCallType) + { + case RestCallType.Get: + request.Method = "GET"; + break; + case RestCallType.Post: + request.Method = "POST"; + break; + default: + throw new HttpException("REST call type not defined."); + } + + if (data != null) + { + using (var streamWriter = new StreamWriter(request.GetRequestStream())) + { + var json = JsonConvert.SerializeObject(data); + streamWriter.Write(json); + } + } + + return (HttpWebResponse)request.GetResponse(); + } + } +} diff --git a/Website/LOC.Core/Data/RestCallType.cs b/Website/LOC.Core/Data/RestCallType.cs new file mode 100644 index 000000000..72431b75d --- /dev/null +++ b/Website/LOC.Core/Data/RestCallType.cs @@ -0,0 +1,8 @@ +namespace LOC.Core.Data +{ + public enum RestCallType + { + Get, + Post + } +} \ No newline at end of file diff --git a/Website/LOC.Core/DependencyResolution/IResolver.cs b/Website/LOC.Core/DependencyResolution/IResolver.cs new file mode 100644 index 000000000..53501ef7e --- /dev/null +++ b/Website/LOC.Core/DependencyResolution/IResolver.cs @@ -0,0 +1,12 @@ +namespace LOC.Core.DependencyResolution +{ + using System; + using System.Collections.Generic; + + public interface IResolver + { + object GetService(Type serviceType); + IEnumerable GetServices(Type serviceType); + T GetService(); + } +} diff --git a/Website/LOC.Core/DependencyResolution/IoC.cs b/Website/LOC.Core/DependencyResolution/IoC.cs new file mode 100644 index 000000000..0185961c2 --- /dev/null +++ b/Website/LOC.Core/DependencyResolution/IoC.cs @@ -0,0 +1,20 @@ +namespace LOC.Core.DependencyResolution +{ + using StructureMap; + + public static class IoC + { + public static IContainer Initialize() + { + ObjectFactory.Initialize( + x => x.Scan( + scan => + { + scan.TheCallingAssembly(); + scan.AssembliesFromApplicationBaseDirectory(); + scan.WithDefaultConventions(); + })); + return ObjectFactory.Container; + } + } +} diff --git a/Website/LOC.Core/DependencyResolution/Resolver.cs b/Website/LOC.Core/DependencyResolution/Resolver.cs new file mode 100644 index 000000000..530e53f8a --- /dev/null +++ b/Website/LOC.Core/DependencyResolution/Resolver.cs @@ -0,0 +1,72 @@ +namespace LOC.Core.DependencyResolution +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using StructureMap; + + public class Resolver : IResolver + { + private readonly IContainer _container; + + static Resolver() + { + try + { + ObjectFactory.Initialize( + x => + { + x.Scan( + scan => + { + scan.TheCallingAssembly(); + scan.WithDefaultConventions(); + scan.AssembliesFromApplicationBaseDirectory( + a => + a.FullName.StartsWith("LOC")); + }); + x.For().Use(r => Current); + }); + Current = new Resolver(ObjectFactory.Container); + } + catch (Exception e) + { + var path = Path.Combine(Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory), "Log.txt"); + var contents = new List { DateTime.Now.ToString(), e.Message, e.StackTrace }; + File.AppendAllLines(path, contents); + + throw; + } + } + + private Resolver(IContainer container) + { + _container = container; + } + + public static IResolver Current { get; private set; } + + public T GetService() + { + return (T)GetService(typeof(T)); + } + + public object GetService(Type serviceType) + { + if (serviceType == null) + { + return null; + } + + return serviceType.IsAbstract || serviceType.IsInterface + ? _container.TryGetInstance(serviceType) + : _container.GetInstance(serviceType); + } + + public IEnumerable GetServices(Type serviceType) + { + return _container.GetAllInstances(serviceType).Cast(); + } + } +} diff --git a/Website/LOC.Core/DependencyResolution/SmDependencyResolver.cs b/Website/LOC.Core/DependencyResolution/SmDependencyResolver.cs new file mode 100644 index 000000000..26d5466c1 --- /dev/null +++ b/Website/LOC.Core/DependencyResolution/SmDependencyResolver.cs @@ -0,0 +1,42 @@ +namespace LOC.Core.DependencyResolution +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Web.Mvc; + using StructureMap; + + public class SmDependencyResolver : IDependencyResolver + { + private readonly IContainer _container; + + public SmDependencyResolver(IContainer container) + { + _container = container; + } + + public object GetService(Type serviceType) + { + if (serviceType == null) + { + return null; + } + + try + { + return serviceType.IsAbstract || serviceType.IsInterface + ? _container.TryGetInstance(serviceType) + : _container.GetInstance(serviceType); + } + catch + { + return null; + } + } + + public IEnumerable GetServices(Type serviceType) + { + return _container.GetAllInstances(serviceType).Cast(); + } + } +} diff --git a/Website/LOC.Core/JsonModelBinder.cs b/Website/LOC.Core/JsonModelBinder.cs new file mode 100644 index 000000000..d696ccce5 --- /dev/null +++ b/Website/LOC.Core/JsonModelBinder.cs @@ -0,0 +1,28 @@ +namespace LOC.Core +{ + using System.IO; + using System.Web.Mvc; + using Newtonsoft.Json; + + public class JsonModelBinder : DefaultModelBinder + { + public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) + { + if (!IsJsonRequest(controllerContext)) + return base.BindModel(controllerContext, bindingContext); + var request = controllerContext.HttpContext.Request; + var stream = request.InputStream; + if (stream.Length == 0) + return null; + stream.Position = 0; + var jsonStringData = new StreamReader(stream).ReadToEnd(); + return JsonConvert.DeserializeObject(jsonStringData, bindingContext.ModelType); + } + + private static bool IsJsonRequest(ControllerContext controllerContext) + { + var contentType = controllerContext.HttpContext.Request.ContentType; + return contentType.Contains("application/json"); + } + } +} diff --git a/Website/LOC.Core/LOC.Core.csproj b/Website/LOC.Core/LOC.Core.csproj new file mode 100644 index 000000000..61e9e435c --- /dev/null +++ b/Website/LOC.Core/LOC.Core.csproj @@ -0,0 +1,165 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {A994B28E-8AAA-4A53-BDFE-0E72F1B0F4AD} + Library + Properties + LOC.Core + LOC.Core + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\packages\EntityFramework.5.0.0\lib\net40\EntityFramework.dll + + + ..\Libraries\LinqKit.dll + + + ..\packages\Newtonsoft.Json.4.5.2\lib\net40\Newtonsoft.Json.dll + + + False + ..\packages\structuremap.2.6.4.1\lib\net40\StructureMap.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Website/LOC.Core/LOC.Core.csproj.user b/Website/LOC.Core/LOC.Core.csproj.user new file mode 100644 index 000000000..55f44b95f --- /dev/null +++ b/Website/LOC.Core/LOC.Core.csproj.user @@ -0,0 +1,6 @@ + + + + ShowAllFiles + + \ No newline at end of file diff --git a/Website/LOC.Core/LogEntry.cs b/Website/LOC.Core/LogEntry.cs new file mode 100644 index 000000000..71aff695b --- /dev/null +++ b/Website/LOC.Core/LogEntry.cs @@ -0,0 +1,15 @@ +namespace LOC.Core +{ + using System; + + public class LogEntry + { + public int LogEntryId { get; set; } + + public DateTime Date { get; set; } + + public string Category { get; set; } + + public string Message { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Account/Account.cs b/Website/LOC.Core/Model/Account/Account.cs new file mode 100644 index 000000000..74c9080f7 --- /dev/null +++ b/Website/LOC.Core/Model/Account/Account.cs @@ -0,0 +1,63 @@ +namespace LOC.Core.Model.Account +{ + using System; + using System.Collections.Generic; + using System.ComponentModel.DataAnnotations; + using Sales; + using Server; + using Server.GameServer.CaptureThePig.Stats; + using Server.GameServer.Dominate.Stats; + using Server.PvpServer; + using Server.PvpServer.Clan; + + public class Account + { + public int AccountId { get; set; } + + [StringLength(40)] + public string Name { get; set; } + public Rank Rank { get; set; } + public bool RankPerm { get; set; } + public DateTime RankExpire { get; set; } + + public int LoginCount { get; set; } + public long LastLogin { get; set; } + public long TotalPlayingTime { get; set; } + + public List Punishments { get; set; } + + public bool FilterChat { get; set; } + + public int Gems { get; set; } + public bool Donated { get; set; } + + public DateTime LastVote { get; set; } + public int VoteModifier { get; set; } + + public int EconomyBalance { get; set; } + + public List IgnoredPlayers { get; set; } + + public virtual Clan Clan { get; set; } + public virtual ClanRole ClanRole { get; set; } + + public virtual List Pets { get; set; } + public int PetNameTagCount { get; set; } + public virtual List FishCatches { get; set; } + + public virtual List Transactions { get; set; } + public virtual List PvpTransactions { get; set; } + + public virtual List CustomBuilds { get; set; } + + public virtual List IpAddresses { get; set; } + public virtual List MacAddresses { get; set; } + + public virtual List Logins { get; set; } + + public List DominateStats { get; set; } + public List CaptureThePigStats { get; set; } + + public List AccountTransactions { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Account/Login.cs b/Website/LOC.Core/Model/Account/Login.cs new file mode 100644 index 000000000..aa3bc9137 --- /dev/null +++ b/Website/LOC.Core/Model/Account/Login.cs @@ -0,0 +1,17 @@ +namespace LOC.Core.Model.Account +{ + public class Login + { + public int LoginId { get; set; } + + public long Time { get; set; } + + public LoginAddress IpAddress { get; set; } + + public MacAddress MacAddress { get; set; } + + public Account Account { get; set; } + + public int ServerId { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Account/LoginAddress.cs b/Website/LOC.Core/Model/Account/LoginAddress.cs new file mode 100644 index 000000000..3b53c856b --- /dev/null +++ b/Website/LOC.Core/Model/Account/LoginAddress.cs @@ -0,0 +1,12 @@ +namespace LOC.Core.Model.Account +{ + using Newtonsoft.Json; + + public class LoginAddress + { + [JsonIgnore] + public int LoginAddressId { get; set; } + + public string Address { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Account/MacAddress.cs b/Website/LOC.Core/Model/Account/MacAddress.cs new file mode 100644 index 000000000..9df70b4b1 --- /dev/null +++ b/Website/LOC.Core/Model/Account/MacAddress.cs @@ -0,0 +1,15 @@ +namespace LOC.Core.Model.Account +{ + using System.Collections.Generic; + using Newtonsoft.Json; + + public class MacAddress + { + [JsonIgnore] + public int MacAddressId { get; set; } + + public string Address { get; set; } + + public virtual List Accounts { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Account/OwnedPet.cs b/Website/LOC.Core/Model/Account/OwnedPet.cs new file mode 100644 index 000000000..f8fe645b2 --- /dev/null +++ b/Website/LOC.Core/Model/Account/OwnedPet.cs @@ -0,0 +1,11 @@ +namespace LOC.Core.Model.Account +{ + public class OwnedPet + { + public int OwnedPetId { get; set; } + + public string PetName { get; set; } + + public string PetType { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Account/Punishment.cs b/Website/LOC.Core/Model/Account/Punishment.cs new file mode 100644 index 000000000..b1514df58 --- /dev/null +++ b/Website/LOC.Core/Model/Account/Punishment.cs @@ -0,0 +1,35 @@ +namespace LOC.Core.Model.Account +{ + using System; + + public class Punishment + { + public int PunishmentId { get; set; } + + public int UserId { get; set; } + + public String Admin { get; set; } + + public bool Active { get; set; } + + public string Category { get; set; } + + public string Reason { get; set; } + + public long Time { get; set; } + + public int Severity { get; set; } + + public double Duration { get; set; } + + public string Sentence { get; set; } + + public bool Removed { get; set; } + + public string RemoveAdmin { get; set; } + + public string RemoveReason { get; set; } + + public long RemoveTime { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Account/Rank.cs b/Website/LOC.Core/Model/Account/Rank.cs new file mode 100644 index 000000000..4f72d5234 --- /dev/null +++ b/Website/LOC.Core/Model/Account/Rank.cs @@ -0,0 +1,9 @@ +namespace LOC.Core.Model.Account +{ + public class Rank + { + public int RankId { get; set; } + + public string Name { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Account/RemovedPunishment.cs b/Website/LOC.Core/Model/Account/RemovedPunishment.cs new file mode 100644 index 000000000..31d747b63 --- /dev/null +++ b/Website/LOC.Core/Model/Account/RemovedPunishment.cs @@ -0,0 +1,17 @@ +namespace LOC.Core.Model.Account +{ + public class RemovedPunishment + { + public int RemovedPunishmentId { get; set; } + + public int PunishmentId { get; set; } + + public int AdminId { get; set; } + + public string PunishmentType { get; set; } + + public string Reason { get; set; } + + public long DateTime { get; set; } + } +} diff --git a/Website/LOC.Core/Model/PvpServer/Economy.cs b/Website/LOC.Core/Model/PvpServer/Economy.cs new file mode 100644 index 000000000..96e4dd6d8 --- /dev/null +++ b/Website/LOC.Core/Model/PvpServer/Economy.cs @@ -0,0 +1,9 @@ +namespace LOC.Core.Model.PvpServer +{ + public class Economy + { + public string ClientName { get; set; } + + public int Balance { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Sales/AccountTransaction.cs b/Website/LOC.Core/Model/Sales/AccountTransaction.cs new file mode 100644 index 000000000..88683e320 --- /dev/null +++ b/Website/LOC.Core/Model/Sales/AccountTransaction.cs @@ -0,0 +1,13 @@ +namespace LOC.Core.Model.Sales +{ + public class AccountTransaction + { + public int AccountTransactionId { get; set; } + + public Account.Account Account { get; set; } + + public string SalesPackageName { get; set; } + + public int Gems { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Sales/GameSalesPackage.cs b/Website/LOC.Core/Model/Sales/GameSalesPackage.cs new file mode 100644 index 000000000..a65cdbee8 --- /dev/null +++ b/Website/LOC.Core/Model/Sales/GameSalesPackage.cs @@ -0,0 +1,13 @@ +namespace LOC.Core.Model.Sales +{ + public class GameSalesPackage + { + public int GameSalesPackageId { get; set; } + + public int Gems { get; set; } + + public int Economy { get; set; } + + public bool Free { get; set; } + } +} \ No newline at end of file diff --git a/Website/LOC.Core/Model/Sales/GameTransaction.cs b/Website/LOC.Core/Model/Sales/GameTransaction.cs new file mode 100644 index 000000000..3536426b3 --- /dev/null +++ b/Website/LOC.Core/Model/Sales/GameTransaction.cs @@ -0,0 +1,15 @@ +namespace LOC.Core.Model.Sales +{ + public class GameTransaction + { + public int GameTransactionId { get; set; } + + public Account.Account Account { get; set; } + + public int GameSalesPackageId { get; set; } + + public int Gems { get; set; } + + public int Economy { get; set; } + } +} \ No newline at end of file diff --git a/Website/LOC.Core/Model/Sales/SalesPackage.cs b/Website/LOC.Core/Model/Sales/SalesPackage.cs new file mode 100644 index 000000000..677b9af21 --- /dev/null +++ b/Website/LOC.Core/Model/Sales/SalesPackage.cs @@ -0,0 +1,29 @@ +namespace LOC.Core.Model.Sales +{ + using Account; + + public class SalesPackage + { + public int SalesPackageId { get; set; } + + public string Name { get; set; } + + public string Description { get; set; } + + public bool Test { get; set; } + + public double Price { get; set; } + + public int Gems { get; set; } + + public Rank Rank { get; set; } + + public bool RankPerm { get; set; } + + public long Length { get; set; } + + public string Image { get; set; } + + public string PaypalButtonId { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Sales/Transaction.cs b/Website/LOC.Core/Model/Sales/Transaction.cs new file mode 100644 index 000000000..ebd3ee4a0 --- /dev/null +++ b/Website/LOC.Core/Model/Sales/Transaction.cs @@ -0,0 +1,19 @@ +namespace LOC.Core.Model.Sales +{ + using System; + + public class Transaction + { + public int TransactionId { get; set; } + + public Account.Account Account { get; set; } + + public SalesPackage SalesPackage { get; set; } + + public decimal Fee { get; set; } + + public decimal Profit { get; set; } + + public DateTime Time { get; set; } + } +} \ No newline at end of file diff --git a/Website/LOC.Core/Model/Server/FilteredWord.cs b/Website/LOC.Core/Model/Server/FilteredWord.cs new file mode 100644 index 000000000..60a467567 --- /dev/null +++ b/Website/LOC.Core/Model/Server/FilteredWord.cs @@ -0,0 +1,9 @@ +namespace LOC.Core.Model.Server +{ + public class FilteredWord + { + public int FilteredWordId { get; set; } + + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/Website/LOC.Core/Model/Server/GameServer/CaptureThePig/Stats/CaptureThePigGameStatsToken.cs b/Website/LOC.Core/Model/Server/GameServer/CaptureThePig/Stats/CaptureThePigGameStatsToken.cs new file mode 100644 index 000000000..71da30252 --- /dev/null +++ b/Website/LOC.Core/Model/Server/GameServer/CaptureThePig/Stats/CaptureThePigGameStatsToken.cs @@ -0,0 +1,11 @@ +namespace LOC.Core.Model.Server.GameServer.CaptureThePig.Stats +{ + using System.Collections.Generic; + + public class CaptureThePigGameStatsToken + { + public long Length { get; set; } + + public List PlayerStats { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/GameServer/CaptureThePig/Stats/CaptureThePigPlayerStats.cs b/Website/LOC.Core/Model/Server/GameServer/CaptureThePig/Stats/CaptureThePigPlayerStats.cs new file mode 100644 index 000000000..ca6f0ea71 --- /dev/null +++ b/Website/LOC.Core/Model/Server/GameServer/CaptureThePig/Stats/CaptureThePigPlayerStats.cs @@ -0,0 +1,25 @@ +namespace LOC.Core.Model.Server.GameServer.CaptureThePig.Stats +{ + public class CaptureThePigPlayerStats + { + public int CaptureThePigPlayerStatsId { get; set; } + + public int AccountId { get; set; } + + public string Type { get; set; } + + public long Start { get; set; } + + public int Wins { get; set; } + + public int Losses { get; set; } + + public int Kills { get; set; } + + public int Deaths { get; set; } + + public int Assists { get; set; } + + public int Captures { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/GameServer/CaptureThePig/Stats/CaptureThePigPlayerStatsToken.cs b/Website/LOC.Core/Model/Server/GameServer/CaptureThePig/Stats/CaptureThePigPlayerStatsToken.cs new file mode 100644 index 000000000..8c9435237 --- /dev/null +++ b/Website/LOC.Core/Model/Server/GameServer/CaptureThePig/Stats/CaptureThePigPlayerStatsToken.cs @@ -0,0 +1,13 @@ +namespace LOC.Core.Model.Server.GameServer.CaptureThePig.Stats +{ + public class CaptureThePigPlayerStatsToken + { + public string Name { get; set; } + + public bool Won { get; set; } + + public long TimePlayed { get; set; } + + public CaptureThePigPlayerStats PlayerStats { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/GameServer/Dominate/Stats/DominateGameStatsToken.cs b/Website/LOC.Core/Model/Server/GameServer/Dominate/Stats/DominateGameStatsToken.cs new file mode 100644 index 000000000..134788e9e --- /dev/null +++ b/Website/LOC.Core/Model/Server/GameServer/Dominate/Stats/DominateGameStatsToken.cs @@ -0,0 +1,12 @@ +namespace LOC.Core.Model.GameServer.Stats +{ + using System.Collections.Generic; + using Model.Server.GameServer.Dominate.Stats; + + public class DominateGameStatsToken + { + public List PlayerStats { get; set; } + + public long Duration { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/GameServer/Dominate/Stats/DominatePlayerStats.cs b/Website/LOC.Core/Model/Server/GameServer/Dominate/Stats/DominatePlayerStats.cs new file mode 100644 index 000000000..db2ee7fd1 --- /dev/null +++ b/Website/LOC.Core/Model/Server/GameServer/Dominate/Stats/DominatePlayerStats.cs @@ -0,0 +1,23 @@ +namespace LOC.Core.Model.Server.GameServer.Dominate.Stats +{ + public class DominatePlayerStats + { + public int DominatePlayerStatsId { get; set; } + + public string Type { get; set; } + + public long Start { get; set; } + + public int Points { get; set; } + + public int Kills { get; set; } + + public int Deaths { get; set; } + + public int Assists { get; set; } + + public int Wins { get; set; } + + public int Losses { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/GameServer/Dominate/Stats/DominatePlayerStatsToken.cs b/Website/LOC.Core/Model/Server/GameServer/Dominate/Stats/DominatePlayerStatsToken.cs new file mode 100644 index 000000000..a63bade8a --- /dev/null +++ b/Website/LOC.Core/Model/Server/GameServer/Dominate/Stats/DominatePlayerStatsToken.cs @@ -0,0 +1,13 @@ +namespace LOC.Core.Model.Server.GameServer.Dominate.Stats +{ + public class DominatePlayerStatsToken + { + public string Name { get; set; } + + public bool Won { get; set; } + + public long TimePlayed { get; set; } + + public DominatePlayerStats PlayerStats { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/GameServer/MineKart/KartArmor.cs b/Website/LOC.Core/Model/Server/GameServer/MineKart/KartArmor.cs new file mode 100644 index 000000000..e1cb30e58 --- /dev/null +++ b/Website/LOC.Core/Model/Server/GameServer/MineKart/KartArmor.cs @@ -0,0 +1,17 @@ +namespace LOC.Core.Model.Server.GameServer.MineKart +{ + using Sales; + + public class KartArmor + { + public int KartArmorId { get; set; } + + public string Material { get; set; } + + public string Name { get; set; } + + public string Data { get; set; } + + public GameSalesPackage SalesPackage { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/GameServer/MineKart/MineKart.cs b/Website/LOC.Core/Model/Server/GameServer/MineKart/MineKart.cs new file mode 100644 index 000000000..f9e26dce0 --- /dev/null +++ b/Website/LOC.Core/Model/Server/GameServer/MineKart/MineKart.cs @@ -0,0 +1,17 @@ +namespace LOC.Core.Model.Server.GameServer.MineKart +{ + using Sales; + + public class MineKart + { + public int MineKartId { get; set; } + + public string Name { get; set; } + + public string Material { get; set; } + + public string Data { get; set; } + + public GameSalesPackage SalesPackage { get; set; } + } +} \ No newline at end of file diff --git a/Website/LOC.Core/Model/Server/GameServer/MineKart/MineKartStats.cs b/Website/LOC.Core/Model/Server/GameServer/MineKart/MineKartStats.cs new file mode 100644 index 000000000..9ba669ab8 --- /dev/null +++ b/Website/LOC.Core/Model/Server/GameServer/MineKart/MineKartStats.cs @@ -0,0 +1,15 @@ +namespace LOC.Core.Model.Server.GameServer.MineKart +{ + public class MineKartStats + { + public int MineKartStatsId { get; set; } + + public int MineKartId { get; set; } + + public string TrackName { get; set; } + + public long Time { get; set; } + + public short Place { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/Pet.cs b/Website/LOC.Core/Model/Server/Pet.cs new file mode 100644 index 000000000..582514ac0 --- /dev/null +++ b/Website/LOC.Core/Model/Server/Pet.cs @@ -0,0 +1,15 @@ +namespace LOC.Core.Model.Server +{ + using Sales; + + public class Pet + { + public int PetId { get; set; } + + public string Name { get; set; } + + public string PetType { get; set; } + + public GameSalesPackage SalesPackage { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/PetExtra.cs b/Website/LOC.Core/Model/Server/PetExtra.cs new file mode 100644 index 000000000..c9934afb4 --- /dev/null +++ b/Website/LOC.Core/Model/Server/PetExtra.cs @@ -0,0 +1,15 @@ +namespace LOC.Core.Model.Server +{ + using Sales; + + public class PetExtra + { + public int PetExtraId { get; set; } + + public string Name { get; set; } + + public string Material { get; set; } + + public GameSalesPackage SalesPackage { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/PvpServer/BenefitItem.cs b/Website/LOC.Core/Model/Server/PvpServer/BenefitItem.cs new file mode 100644 index 000000000..6a623dfeb --- /dev/null +++ b/Website/LOC.Core/Model/Server/PvpServer/BenefitItem.cs @@ -0,0 +1,15 @@ +namespace LOC.Core.Model.Server.PvpServer +{ + using Sales; + + public class BenefitItem + { + public int BenefitItemId { get; set; } + + public string Name { get; set; } + + public string Material { get; set; } + + public GameSalesPackage SalesPackage { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/PvpServer/Clan/Alliance.cs b/Website/LOC.Core/Model/Server/PvpServer/Clan/Alliance.cs new file mode 100644 index 000000000..eb799d934 --- /dev/null +++ b/Website/LOC.Core/Model/Server/PvpServer/Clan/Alliance.cs @@ -0,0 +1,11 @@ +namespace LOC.Core.Model.Server.PvpServer.Clan +{ + public class Alliance + { + public int AllianceId { get; set; } + + public Clan Clan { get; set; } + + public bool Trusted { get; set; } + } +} \ No newline at end of file diff --git a/Website/LOC.Core/Model/Server/PvpServer/Clan/Clan.cs b/Website/LOC.Core/Model/Server/PvpServer/Clan/Clan.cs new file mode 100644 index 000000000..6c46baba2 --- /dev/null +++ b/Website/LOC.Core/Model/Server/PvpServer/Clan/Clan.cs @@ -0,0 +1,26 @@ +namespace LOC.Core.Model.Server.PvpServer.Clan +{ + using Account; + using System.Collections.Generic; + + public class Clan + { + public int ClanId { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public int Power { get; set; } + public string Home { get; set; } + public bool Admin { get; set; } + public long DateCreated { get; set; } + public long LastTimeOnline { get; set; } + + public string Generator { get; set; } + public int GeneratorStock { get; set; } + public long GeneratorTime { get; set; } + + public List Alliances { get; set; } + public List Wars { get; set; } + public List Territories { get; set; } + public List Members { get; set; } + } +} \ No newline at end of file diff --git a/Website/LOC.Core/Model/Server/PvpServer/Clan/ClanRole.cs b/Website/LOC.Core/Model/Server/PvpServer/Clan/ClanRole.cs new file mode 100644 index 000000000..715d734db --- /dev/null +++ b/Website/LOC.Core/Model/Server/PvpServer/Clan/ClanRole.cs @@ -0,0 +1,8 @@ +namespace LOC.Core.Model.Server.PvpServer.Clan +{ + public class ClanRole + { + public int ClanRoleId { get; set; } + public string Name { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/PvpServer/Clan/Territory.cs b/Website/LOC.Core/Model/Server/PvpServer/Clan/Territory.cs new file mode 100644 index 000000000..c5aae68c7 --- /dev/null +++ b/Website/LOC.Core/Model/Server/PvpServer/Clan/Territory.cs @@ -0,0 +1,15 @@ +namespace LOC.Core.Model.Server.PvpServer.Clan +{ + public class Territory + { + public int TerritoryId { get; set; } + + public virtual Clan Clan { get; set; } + + public string ServerName { get; set; } + + public string Chunk { get; set; } + + public bool Safe { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/PvpServer/Clan/War.cs b/Website/LOC.Core/Model/Server/PvpServer/Clan/War.cs new file mode 100644 index 000000000..93fe524a9 --- /dev/null +++ b/Website/LOC.Core/Model/Server/PvpServer/Clan/War.cs @@ -0,0 +1,15 @@ +namespace LOC.Core.Model.Server.PvpServer.Clan +{ + public class War + { + public int WarId { get; set; } + + public Clan Clan { get; set; } + + public int Dominance { get; set; } + + public bool Ended { get; set; } + + public long Cooldown { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/PvpServer/CustomBuild.cs b/Website/LOC.Core/Model/Server/PvpServer/CustomBuild.cs new file mode 100644 index 000000000..ee5024990 --- /dev/null +++ b/Website/LOC.Core/Model/Server/PvpServer/CustomBuild.cs @@ -0,0 +1,59 @@ +namespace LOC.Core.Model.Server.PvpServer +{ + public class CustomBuild + { + public int CustomBuildId { get; set; } + + public Account.Account Account { get; set; } + + public string Name { get; set; } + + public bool Active { get; set; } + + public int CustomBuildNumber { get; set; } + + public int SkillTokensBalance { get; set; } + + public int ItemTokensBalance { get; set; } + + public int PvpClassId { get; set; } + + public int SwordSkillId { get; set; } + + public int AxeSkillId { get; set; } + + public int BowSkillId { get; set; } + + public int ClassPassiveASkillId { get; set; } + public int ClassPassiveBSkillId { get; set; } + + public int GlobalPassiveSkillId { get; set; } + + public string Slot1Material { get; set; } + public int Slot1Amount { get; set; } + + public string Slot2Material { get; set; } + public int Slot2Amount { get; set; } + + public string Slot3Material { get; set; } + public int Slot3Amount { get; set; } + + public string Slot4Material { get; set; } + public int Slot4Amount { get; set; } + + public string Slot5Material { get; set; } + public int Slot5Amount { get; set; } + + public string Slot6Material { get; set; } + public int Slot6Amount { get; set; } + + public string Slot7Material { get; set; } + public int Slot7Amount { get; set; } + + public string Slot8Material { get; set; } + public int Slot8Amount { get; set; } + + public string Slot9Material { get; set; } + public int Slot9Amount { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/PvpServer/FieldBlock.cs b/Website/LOC.Core/Model/Server/PvpServer/FieldBlock.cs new file mode 100644 index 000000000..5dc7e5f4b --- /dev/null +++ b/Website/LOC.Core/Model/Server/PvpServer/FieldBlock.cs @@ -0,0 +1,25 @@ +namespace LOC.Core.Model.Server.PvpServer +{ + public class FieldBlock + { + public int FieldBlockId { get; set; } + + public string Server { get; set; } + + public string Location { get; set; } + + public int BlockId { get; set; } + + public byte BlockData { get; set; } + + public int EmptyId { get; set; } + + public byte EmptyData { get; set; } + + public int StockMax { get; set; } + + public double StockRegenTime { get; set; } + + public string Loot { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/PvpServer/FieldMonster.cs b/Website/LOC.Core/Model/Server/PvpServer/FieldMonster.cs new file mode 100644 index 000000000..4c9ff4200 --- /dev/null +++ b/Website/LOC.Core/Model/Server/PvpServer/FieldMonster.cs @@ -0,0 +1,23 @@ +namespace LOC.Core.Model.Server.PvpServer +{ + public class FieldMonster + { + public int FieldMonsterId { get; set; } + + public string Server { get; set; } + + public string Name { get; set; } + + public string Type { get; set; } + + public int MobMax { get; set; } + + public double MobRate { get; set; } + + public string Centre { get; set; } + + public int Radius { get; set; } + + public int Height { get; set; } + } +} \ No newline at end of file diff --git a/Website/LOC.Core/Model/Server/PvpServer/FieldOre.cs b/Website/LOC.Core/Model/Server/PvpServer/FieldOre.cs new file mode 100644 index 000000000..87547f6d6 --- /dev/null +++ b/Website/LOC.Core/Model/Server/PvpServer/FieldOre.cs @@ -0,0 +1,11 @@ +namespace LOC.Core.Model.Server.PvpServer +{ + public class FieldOre + { + public int FieldOreId { get; set; } + + public string Server { get; set; } + + public string Location { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/PvpServer/FishCatch.cs b/Website/LOC.Core/Model/Server/PvpServer/FishCatch.cs new file mode 100644 index 000000000..fb3de4faa --- /dev/null +++ b/Website/LOC.Core/Model/Server/PvpServer/FishCatch.cs @@ -0,0 +1,15 @@ +namespace LOC.Core.Model.Server.PvpServer +{ + public class FishCatch + { + public int FishCatchId { get; set; } + + public string Owner { get; set; } + + public decimal Size { get; set; } + + public string Name { get; set; } + + public virtual Account.Account Catcher { get; set; } + } +} \ No newline at end of file diff --git a/Website/LOC.Core/Model/Server/PvpServer/Item.cs b/Website/LOC.Core/Model/Server/PvpServer/Item.cs new file mode 100644 index 000000000..d0de15710 --- /dev/null +++ b/Website/LOC.Core/Model/Server/PvpServer/Item.cs @@ -0,0 +1,15 @@ +namespace LOC.Core.Model.PvpServer +{ + using Sales; + + public class Item + { + public int ItemId { get; set; } + + public string Name { get; set; } + + public string Material { get; set; } + + public GameSalesPackage SalesPackage { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/PvpServer/PvpClass.cs b/Website/LOC.Core/Model/Server/PvpServer/PvpClass.cs new file mode 100644 index 000000000..de42855b5 --- /dev/null +++ b/Website/LOC.Core/Model/Server/PvpServer/PvpClass.cs @@ -0,0 +1,13 @@ +namespace LOC.Core.Model.PvpServer +{ + using Sales; + + public class PvpClass + { + public int PvpClassId { get; set; } + + public string Name { get; set; } + + public GameSalesPackage SalesPackage { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/PvpServer/Skill.cs b/Website/LOC.Core/Model/Server/PvpServer/Skill.cs new file mode 100644 index 000000000..216199a3b --- /dev/null +++ b/Website/LOC.Core/Model/Server/PvpServer/Skill.cs @@ -0,0 +1,17 @@ +namespace LOC.Core.Model.PvpServer +{ + using System.Collections.Generic; + using Sales; + using Server.PvpServer; + + public class Skill + { + public int SkillId { get; set; } + + public string Name { get; set; } + + public int Level { get; set; } + + public GameSalesPackage SalesPackage { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/PvpServer/Weapon.cs b/Website/LOC.Core/Model/Server/PvpServer/Weapon.cs new file mode 100644 index 000000000..41d6112e2 --- /dev/null +++ b/Website/LOC.Core/Model/Server/PvpServer/Weapon.cs @@ -0,0 +1,13 @@ +namespace LOC.Core.Model.PvpServer +{ + using Sales; + + public class Weapon + { + public int WeaponId { get; set; } + + public string Name { get; set; } + + public GameSalesPackage SalesPackage { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/Server.cs b/Website/LOC.Core/Model/Server/Server.cs new file mode 100644 index 000000000..19291c09e --- /dev/null +++ b/Website/LOC.Core/Model/Server/Server.cs @@ -0,0 +1,17 @@ +namespace LOC.Core.Model.GameServer +{ + using System.Collections.Generic; + + public class Server + { + public int ServerId { get; set; } + + public string Name { get; set; } + + public string ConnectionAddress { get; set; } + + public int PlayerLimit { get; set; } + + public List History { get; set; } + } +} \ No newline at end of file diff --git a/Website/LOC.Core/Model/Server/ServerHistory.cs b/Website/LOC.Core/Model/Server/ServerHistory.cs new file mode 100644 index 000000000..de24121c9 --- /dev/null +++ b/Website/LOC.Core/Model/Server/ServerHistory.cs @@ -0,0 +1,19 @@ +namespace LOC.Core.Model.GameServer +{ + using Core.GameServer; + + public class ServerHistory + { + public int ServerHistoryId { get; set; } + + public int ServerId { get; set; } + + public ServerStatus Status { get; set; } + + public long Time { get; set; } + + public double TicksPerSecond { get; set; } + + public long MemoryUsage { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/ServerStatus.cs b/Website/LOC.Core/Model/Server/ServerStatus.cs new file mode 100644 index 000000000..669f970a7 --- /dev/null +++ b/Website/LOC.Core/Model/Server/ServerStatus.cs @@ -0,0 +1,9 @@ +namespace LOC.Core.GameServer +{ + public class ServerStatus + { + public int ServerStatusId { get; set; } + + public string Name { get; set; } + } +} diff --git a/Website/LOC.Core/Model/Server/ServerUpdate.cs b/Website/LOC.Core/Model/Server/ServerUpdate.cs new file mode 100644 index 000000000..946936053 --- /dev/null +++ b/Website/LOC.Core/Model/Server/ServerUpdate.cs @@ -0,0 +1,15 @@ +namespace LOC.Core.Model.GameServer +{ + using System.Collections.Generic; + using Tokens.Client; + + public class ServerUpdate + { + public ServerUpdate() + { + ClientTokens = new List(); + } + + public List ClientTokens { get; set; } + } +} diff --git a/Website/LOC.Core/Properties/AssemblyInfo.cs b/Website/LOC.Core/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..7763c9eef --- /dev/null +++ b/Website/LOC.Core/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("LOC.Core.Data")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Windows User")] +[assembly: AssemblyProduct("LOC.Core.Data")] +[assembly: AssemblyCopyright("Copyright © Windows User 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("784dcbf3-4395-418c-9987-d2905e0f3fdf")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Website/LOC.Core/PunishmentType.cs b/Website/LOC.Core/PunishmentType.cs new file mode 100644 index 000000000..3ead76d12 --- /dev/null +++ b/Website/LOC.Core/PunishmentType.cs @@ -0,0 +1,10 @@ +namespace LOC.Core +{ + public enum PunishmentType + { + Mute, + Kick, + Ban, + DisabledQueue + } +} diff --git a/Website/LOC.Core/TimeUtil.cs b/Website/LOC.Core/TimeUtil.cs new file mode 100644 index 000000000..d4a074004 --- /dev/null +++ b/Website/LOC.Core/TimeUtil.cs @@ -0,0 +1,14 @@ +namespace LOC.Core +{ + using System; + + public static class TimeUtil + { + public static double GetCurrentMilliseconds() + { + var staticDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + var timeSpan = DateTime.UtcNow - staticDate; + return timeSpan.TotalMilliseconds; + } + } +} diff --git a/Website/LOC.Core/Tokens/Clan/AllianceToken.cs b/Website/LOC.Core/Tokens/Clan/AllianceToken.cs new file mode 100644 index 000000000..a76bd5955 --- /dev/null +++ b/Website/LOC.Core/Tokens/Clan/AllianceToken.cs @@ -0,0 +1,24 @@ +namespace LOC.Core.Tokens.Clan +{ + using Model.Server.PvpServer.Clan; + + public class AllianceToken + { + public AllianceToken() + { + + } + + public AllianceToken(Alliance alliance) + { + ClanId = alliance.Clan.ClanId; + ClanName = alliance.Clan.Name; + Trusted = alliance.Trusted; + } + + public int ClanId { get; set; } + public string ClanName { get; set; } + + public bool Trusted { get; set; } + } +} \ No newline at end of file diff --git a/Website/LOC.Core/Tokens/Clan/ClanGeneratorToken.cs b/Website/LOC.Core/Tokens/Clan/ClanGeneratorToken.cs new file mode 100644 index 000000000..56761605c --- /dev/null +++ b/Website/LOC.Core/Tokens/Clan/ClanGeneratorToken.cs @@ -0,0 +1,20 @@ +namespace LOC.Core.Tokens.Clan +{ + public class ClanGeneratorToken + { + public ClanGeneratorToken() { } + + public ClanGeneratorToken(string name, string generator, int generatorStock, long generatorTime) + { + Name = name; + Location = generator; + Stock = generatorStock; + Time = generatorTime; + } + + public string Name { get; set; } + public string Location { get; set; } + public int Stock { get; set; } + public long Time { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Clan/ClanMemberToken.cs b/Website/LOC.Core/Tokens/Clan/ClanMemberToken.cs new file mode 100644 index 000000000..a725e9777 --- /dev/null +++ b/Website/LOC.Core/Tokens/Clan/ClanMemberToken.cs @@ -0,0 +1,26 @@ +namespace LOC.Core.Tokens.Clan +{ + using Model.Account; + using Model.Server.PvpServer.Clan; + + public class ClanMemberToken + { + public ClanMemberToken() + { + + } + + public ClanMemberToken(Account account) + { + AccountId = account.AccountId; + Name = account.Name; + ClanRole = account.ClanRole; + } + + public int AccountId { get; set; } + + public string Name { get; set; } + + public ClanRole ClanRole { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Clan/ClanTerritoryToken.cs b/Website/LOC.Core/Tokens/Clan/ClanTerritoryToken.cs new file mode 100644 index 000000000..3a86d7e45 --- /dev/null +++ b/Website/LOC.Core/Tokens/Clan/ClanTerritoryToken.cs @@ -0,0 +1,27 @@ +namespace LOC.Core.Tokens.Clan +{ + using Model.Server.PvpServer.Clan; + + public class ClanTerritoryToken + { + public ClanTerritoryToken() + { + + } + + public ClanTerritoryToken(Territory territory) + { + ClanId = territory.Clan.ClanId; + ClanName = territory.Clan.Name; + ServerName = territory.ServerName; + Chunk = territory.Chunk; + Safe = territory.Safe; + } + + public int ClanId { get; set; } + public string ClanName { get; set; } + public string ServerName { get; set; } + public string Chunk { get; set; } + public bool Safe { get; set; } + } +} \ No newline at end of file diff --git a/Website/LOC.Core/Tokens/Clan/ClanToken.cs b/Website/LOC.Core/Tokens/Clan/ClanToken.cs new file mode 100644 index 000000000..241e520d3 --- /dev/null +++ b/Website/LOC.Core/Tokens/Clan/ClanToken.cs @@ -0,0 +1,66 @@ +namespace LOC.Core.Tokens.Clan +{ + using System.Collections.Generic; + using Model.Server.PvpServer.Clan; + + public class ClanToken + { + public ClanToken() + { + + } + + public ClanToken(Clan clan) + { + ClanId = clan.ClanId; + Name = clan.Name; + Description = clan.Description; + Power = clan.Power; + Home = clan.Home; + Admin = clan.Admin; + DateCreated = clan.DateCreated; + LastTimeOnline = clan.LastTimeOnline; + + Generator = new ClanGeneratorToken(Name, clan.Generator, clan.GeneratorStock, clan.GeneratorTime); + + Members = new List(); + foreach (var member in clan.Members) + { + Members.Add(new ClanMemberToken(member)); + } + + Alliances = new List(); + foreach (var alliance in clan.Alliances) + { + Alliances.Add(new AllianceToken(alliance)); + } + + Wars = new List(); + foreach (var war in clan.Wars) + { + Wars.Add(new WarToken(war)); + } + + Territories = new List(); + foreach (var territory in clan.Territories) + { + Territories.Add(new ClanTerritoryToken(territory)); + } + } + + public int ClanId { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public int Power { get; set; } + public string Home { get; set; } + public bool Admin { get; set; } + public long DateCreated { get; set; } + public long LastTimeOnline { get; set; } + + public ClanGeneratorToken Generator { get; set; } + public List Members { get; set; } + public List Territories { get; set; } + public List Alliances; + public List Wars; + } +} diff --git a/Website/LOC.Core/Tokens/Clan/ClanWarRechargeToken.cs b/Website/LOC.Core/Tokens/Clan/ClanWarRechargeToken.cs new file mode 100644 index 000000000..7a399a8f8 --- /dev/null +++ b/Website/LOC.Core/Tokens/Clan/ClanWarRechargeToken.cs @@ -0,0 +1,9 @@ +namespace LOC.Core.Tokens.Clan +{ + public class ClanWarRechargeToken + { + public int ClanId { get; set; } + public string ClanName { get; set; } + public long Recharge { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Clan/WarToken.cs b/Website/LOC.Core/Tokens/Clan/WarToken.cs new file mode 100644 index 000000000..4f947b8c7 --- /dev/null +++ b/Website/LOC.Core/Tokens/Clan/WarToken.cs @@ -0,0 +1,28 @@ +namespace LOC.Core.Tokens.Clan +{ + using Model.Server.PvpServer.Clan; + + public class WarToken + { + public WarToken() + { + + } + + public WarToken(War war) + { + ClanId = war.Clan.ClanId; + ClanName = war.Clan.Name; + Dominance = war.Dominance; + Ended = war.Ended; + Cooldown = war.Cooldown; + } + + public int ClanId { get; set; } + public string ClanName { get; set; } + + public int Dominance { get; set; } + public bool Ended { get; set; } + public long Cooldown { get; set; } + } +} \ No newline at end of file diff --git a/Website/LOC.Core/Tokens/Client/AccountToken.cs b/Website/LOC.Core/Tokens/Client/AccountToken.cs new file mode 100644 index 000000000..7d0518e6e --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/AccountToken.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using LOC.Core.Model.Account; + +namespace LOC.Core.Tokens.Client +{ + using System.Collections.ObjectModel; + + public class AccountToken + { + public AccountToken() + { + + } + + public AccountToken(Account account) + { + LastLogin = account.LastLogin; + + IpAddresses = new Collection(); + MacAddresses = new Collection(); + IpAliases = new Collection(); + MacAliases = new Collection(); + + account.IpAddresses = new List(); + account.MacAddresses = new List(); + } + + public long TotalPlayingTime { get; set; } + public long LastLogin { get; set; } + public int LoginCount { get; set; } + + public Collection IpAddresses { get; set; } + public Collection MacAddresses { get; set; } + public Collection IpAliases { get; set; } + public Collection MacAliases { get; set; } + } +} \ No newline at end of file diff --git a/Website/LOC.Core/Tokens/Client/ClientClanToken.cs b/Website/LOC.Core/Tokens/Client/ClientClanToken.cs new file mode 100644 index 000000000..8dfd4ee47 --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/ClientClanToken.cs @@ -0,0 +1,8 @@ +namespace LOC.Core.Tokens.Client +{ + public class ClientClanToken + { + public string Name { get; set; } + public string Role { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Client/ClientIgnoreToken.cs b/Website/LOC.Core/Tokens/Client/ClientIgnoreToken.cs new file mode 100644 index 000000000..b9d5f7034 --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/ClientIgnoreToken.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace LOC.Core.Tokens.Client +{ + public class ClientIgnoreToken + { + public string Name { get; set; } + public string IgnoredPlayer { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Client/ClientToken.cs b/Website/LOC.Core/Tokens/Client/ClientToken.cs new file mode 100644 index 000000000..de3ba31ab --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/ClientToken.cs @@ -0,0 +1,120 @@ +using System.Collections.ObjectModel; + +namespace LOC.Core.Tokens.Client +{ + using System; + using System.Collections.Generic; + using Model.Account; + using Model.Sales; + using Model.Server.PvpServer; + + public class ClientToken + { + public ClientToken() + { + } + + public ClientToken(Account account) + { + AccountId = account.AccountId; + + FilterChat = account.FilterChat; + Name = account.Name; + Rank = account.Rank.Name; + + EconomyBalance = account.EconomyBalance; + + FishTokens = new List(); + + if (account.FishCatches != null) + { + foreach (var fishCatch in account.FishCatches) + { + FishTokens.Add(new FishToken(fishCatch)); + } + } + + AccountToken = new AccountToken(account); + DonorToken = new DonorToken + { + Gems = account.Gems, + Donated = account.Donated, + SalesPackages = new List(), + UnknownSalesPackages = new List(), + CustomBuilds = new List(), + Pets = new List(), + PetNameTagCount = account.PetNameTagCount + }; + + if (account.Clan != null) + { + ClanToken = new ClientClanToken + { + Name = account.Clan.Name, + Role = account.ClanRole.Name + }; + } + + if (account.IgnoredPlayers == null) + account.IgnoredPlayers = new List(); + + IgnoredPlayers = account.IgnoredPlayers; + + if (account.PvpTransactions == null) + account.PvpTransactions = new List(); + + foreach (var transaction in account.PvpTransactions) + { + DonorToken.SalesPackages.Add(transaction.GameSalesPackageId); + } + + if (account.AccountTransactions == null) + account.AccountTransactions = new List(); + + foreach (var transaction in account.AccountTransactions) + { + DonorToken.UnknownSalesPackages.Add(transaction.SalesPackageName); + } + + if (account.CustomBuilds == null) + account.CustomBuilds = new List(); + + foreach (var customBuild in account.CustomBuilds) + { + DonorToken.CustomBuilds.Add(new CustomBuildToken(customBuild)); + } + + if (account.Pets == null) + account.Pets = new List(); + + foreach (var pet in account.Pets) + { + DonorToken.Pets.Add(new PetToken { PetType = pet.PetType, PetName = pet.PetName }); + } + + if (account.Punishments == null) + account.Punishments = new List(); + + Punishments = account.Punishments; + } + + public int AccountId { get; set; } + + public bool FilterChat { get; set; } + + public string Name { get; set; } + public string Rank { get; set; } + + public int EconomyBalance { get; set; } + + public List Punishments { get; set; } + + public List FishTokens; + + public List IgnoredPlayers { get; set; } + + public AccountToken AccountToken; + public DonorToken DonorToken; + public ClientClanToken ClanToken; + } +} diff --git a/Website/LOC.Core/Tokens/Client/CustomBuildToken.cs b/Website/LOC.Core/Tokens/Client/CustomBuildToken.cs new file mode 100644 index 000000000..2f92343ab --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/CustomBuildToken.cs @@ -0,0 +1,130 @@ +namespace LOC.Core.Tokens.Client +{ + using System.Collections.Generic; + using Model.Server.PvpServer; + + public class CustomBuildToken + { + public CustomBuildToken() { } + + public CustomBuildToken(CustomBuild customBuild) + { + CustomBuildId = customBuild.CustomBuildId; + Name = customBuild.Name; + Active = customBuild.Active; + CustomBuildNumber = customBuild.CustomBuildNumber; + SkillTokensBalance = customBuild.SkillTokensBalance; + ItemTokensBalance = customBuild.ItemTokensBalance; + PvpClassId = customBuild.PvpClassId; + + SwordSkillId = customBuild.SwordSkillId; + AxeSkillId = customBuild.AxeSkillId; + BowSkillId = customBuild.BowSkillId; + + ClassPassiveASkillId = customBuild.ClassPassiveASkillId; + ClassPassiveBSkillId = customBuild.ClassPassiveBSkillId; + + GlobalPassiveSkillId = customBuild.GlobalPassiveSkillId; + + Slots = new List(); + + Slots.Add(new SlotToken { Material = customBuild.Slot1Material, Amount = customBuild.Slot1Amount}); + Slots.Add(new SlotToken { Material = customBuild.Slot2Material, Amount = customBuild.Slot2Amount }); + Slots.Add(new SlotToken { Material = customBuild.Slot3Material, Amount = customBuild.Slot3Amount }); + Slots.Add(new SlotToken { Material = customBuild.Slot4Material, Amount = customBuild.Slot4Amount }); + Slots.Add(new SlotToken { Material = customBuild.Slot5Material, Amount = customBuild.Slot5Amount }); + Slots.Add(new SlotToken { Material = customBuild.Slot6Material, Amount = customBuild.Slot6Amount }); + Slots.Add(new SlotToken { Material = customBuild.Slot7Material, Amount = customBuild.Slot7Amount }); + Slots.Add(new SlotToken { Material = customBuild.Slot8Material, Amount = customBuild.Slot8Amount }); + Slots.Add(new SlotToken { Material = customBuild.Slot9Material, Amount = customBuild.Slot9Amount }); + } + + public int CustomBuildId { get; set; } + + public string PlayerName { get; set; } + + public string Name { get; set; } + + public bool Active { get; set; } + + public int CustomBuildNumber { get; set; } + + public int SkillTokensBalance { get; set; } + + public int ItemTokensBalance { get; set; } + + public int PvpClassId { get; set; } + + public int SwordSkillId { get; set; } + + public int AxeSkillId { get; set; } + + public int BowSkillId { get; set; } + + public int ClassPassiveASkillId { get; set; } + public int ClassPassiveBSkillId { get; set; } + + public int GlobalPassiveSkillId { get; set; } + + public List Slots { get; set; } + + public CustomBuild GetCustomBuild() + { + var customBuild = new CustomBuild(); + + UpdateCustomBuild(customBuild); + + return customBuild; + } + + public void UpdateCustomBuild(CustomBuild customBuild) + { + customBuild.Name = Name; + customBuild.Active = Active; + customBuild.CustomBuildNumber = CustomBuildNumber; + customBuild.PvpClassId = PvpClassId; + customBuild.SkillTokensBalance = SkillTokensBalance; + customBuild.ItemTokensBalance = ItemTokensBalance; + + customBuild.SwordSkillId = SwordSkillId; + customBuild.AxeSkillId = AxeSkillId; + customBuild.BowSkillId = BowSkillId; + + customBuild.ClassPassiveASkillId = ClassPassiveASkillId; + customBuild.ClassPassiveBSkillId = ClassPassiveBSkillId; + + customBuild.GlobalPassiveSkillId = GlobalPassiveSkillId; + + if (Slots != null && Slots.Count > 0) + { + var slots = Slots.ToArray(); + customBuild.Slot1Material = slots[0].Material; + customBuild.Slot1Amount = slots[0].Amount; + + customBuild.Slot2Material = slots[1].Material; + customBuild.Slot2Amount = slots[1].Amount; + + customBuild.Slot3Material = slots[2].Material; + customBuild.Slot3Amount = slots[2].Amount; + + customBuild.Slot4Material = slots[3].Material; + customBuild.Slot4Amount = slots[3].Amount; + + customBuild.Slot5Material = slots[4].Material; + customBuild.Slot5Amount = slots[4].Amount; + + customBuild.Slot6Material = slots[5].Material; + customBuild.Slot6Amount = slots[5].Amount; + + customBuild.Slot7Material = slots[6].Material; + customBuild.Slot7Amount = slots[6].Amount; + + customBuild.Slot8Material = slots[7].Material; + customBuild.Slot8Amount = slots[7].Amount; + + customBuild.Slot9Material = slots[8].Material; + customBuild.Slot9Amount = slots[8].Amount; + } + } + } +} diff --git a/Website/LOC.Core/Tokens/Client/DamageToken.cs b/Website/LOC.Core/Tokens/Client/DamageToken.cs new file mode 100644 index 000000000..2f794108d --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/DamageToken.cs @@ -0,0 +1,11 @@ +namespace LOC.Core.Tokens.Client +{ + public class DamageToken + { + public string Player { get; set; } + + public string Source { get; set; } + + public double Damage { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Client/DeathStatToken.cs b/Website/LOC.Core/Tokens/Client/DeathStatToken.cs new file mode 100644 index 000000000..bb5e522ba --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/DeathStatToken.cs @@ -0,0 +1,11 @@ +namespace LOC.Core.Tokens.Client +{ + using System.Collections.Generic; + + public class DeathStatToken + { + public PlayerSetupToken Killer { get; set; } + public PlayerSetupToken Victim { get; set; } + public List Assistants { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Client/DonationBenefitToken.cs b/Website/LOC.Core/Tokens/Client/DonationBenefitToken.cs new file mode 100644 index 000000000..4a7e5799c --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/DonationBenefitToken.cs @@ -0,0 +1,8 @@ +namespace LOC.Core.Tokens.Client +{ + public class DonationBenefitToken + { + public string AccountName { get; set; } + public int BenefitSalesPackageId { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Client/DonorToken.cs b/Website/LOC.Core/Tokens/Client/DonorToken.cs new file mode 100644 index 000000000..3f58af7f7 --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/DonorToken.cs @@ -0,0 +1,15 @@ +namespace LOC.Core.Tokens.Client +{ + using System.Collections.Generic; + + public class DonorToken + { + public int Gems { get; set; } + public bool Donated { get; set; } + public List SalesPackages { get; set; } + public List UnknownSalesPackages { get; set; } + public List CustomBuilds { get; set; } + public List Pets { get; set; } + public int PetNameTagCount { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Client/FishToken.cs b/Website/LOC.Core/Tokens/Client/FishToken.cs new file mode 100644 index 000000000..c85699220 --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/FishToken.cs @@ -0,0 +1,22 @@ +namespace LOC.Core.Tokens.Client +{ + using Model.Server.PvpServer; + + public class FishToken + { + public FishToken() { } + + public FishToken(FishCatch fishCatch) + { + Size = fishCatch.Size; + Name = fishCatch.Name; + Catcher = fishCatch.Catcher.Name; + } + + public decimal Size { get; set; } + + public string Name { get; set; } + + public string Catcher { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Client/LoginRequestToken.cs b/Website/LOC.Core/Tokens/Client/LoginRequestToken.cs new file mode 100644 index 000000000..6a0b6960b --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/LoginRequestToken.cs @@ -0,0 +1,15 @@ +using LOC.Core.Model.GameServer; + +namespace LOC.Core.Tokens.Client +{ + public class LoginRequestToken + { + public string MacAddress { get; set; } + + public string IpAddress { get; set; } + + public string Name { get; set; } + + public Server Server { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Client/LoginToken.cs b/Website/LOC.Core/Tokens/Client/LoginToken.cs new file mode 100644 index 000000000..81850a0b7 --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/LoginToken.cs @@ -0,0 +1,15 @@ +using LOC.Core.Model.GameServer; + +namespace LOC.Core.Tokens.Client +{ + public class LoginToken + { + public string MacAddress { get; set; } + + public string IpAddress { get; set; } + + public string Name { get; set; } + + public Server Server { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Client/PetChangeToken.cs b/Website/LOC.Core/Tokens/Client/PetChangeToken.cs new file mode 100644 index 000000000..66dd7ffe6 --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/PetChangeToken.cs @@ -0,0 +1,11 @@ +namespace LOC.Core.Tokens.Client +{ + public class PetChangeToken + { + public string Name; + + public string PetName; + + public string PetType; + } +} diff --git a/Website/LOC.Core/Tokens/Client/PetToken.cs b/Website/LOC.Core/Tokens/Client/PetToken.cs new file mode 100644 index 000000000..fd42a2fdf --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/PetToken.cs @@ -0,0 +1,8 @@ +namespace LOC.Core.Tokens.Client +{ + public class PetToken + { + public string PetName { get; set; } + public string PetType { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Client/PlayerSetupToken.cs b/Website/LOC.Core/Tokens/Client/PlayerSetupToken.cs new file mode 100644 index 000000000..d6d41b6c9 --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/PlayerSetupToken.cs @@ -0,0 +1,28 @@ +namespace LOC.Core.Tokens.Client +{ + using System.Collections.Generic; + + public class PlayerSetupToken + { + public string Name { get; set; } + + public int PvpClassId { get; set; } + + public int SwordSkillId { get; set; } + + public int AxeSkillId { get; set; } + + public int BowSkillId { get; set; } + + public int ClassPassiveASkillId { get; set; } + public int ClassPassiveBSkillId { get; set; } + + public int GlobalPassiveASkillId { get; set; } + public int GlobalPassiveBSkillId { get; set; } + public int GlobalPassiveCSkillId { get; set; } + + public List Slots { get; set; } + + public List DamageSources { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Client/PlayerUpdateToken.cs b/Website/LOC.Core/Tokens/Client/PlayerUpdateToken.cs new file mode 100644 index 000000000..02e25886f --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/PlayerUpdateToken.cs @@ -0,0 +1,11 @@ +namespace LOC.Core.Tokens.Client +{ + public class PlayerUpdateToken + { + public string Name { get; set; } + + public int Gems { get; set; } + + public bool FilterChat { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Client/PunishToken.cs b/Website/LOC.Core/Tokens/Client/PunishToken.cs new file mode 100644 index 000000000..cda0eba0f --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/PunishToken.cs @@ -0,0 +1,36 @@ +namespace LOC.Core.Tokens.Client +{ + using Model.Account; + + public class PunishToken + { + public PunishToken() { } + + public PunishToken(Punishment punishment) + { + Admin = punishment.Admin; + Category = punishment.Category; + Sentence = punishment.Sentence; + Reason = punishment.Reason; + Severity = punishment.Severity; + Duration = punishment.Duration; + Time = punishment.Time; + } + + public string Target { get; set; } + + public string Admin { get; set; } + + public long Time { get; set; } + + public string Sentence { get; set; } + + public string Category { get; set; } + + public string Reason { get; set; } + + public double Duration { get; set; } + + public int Severity { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Client/RankUpdateToken.cs b/Website/LOC.Core/Tokens/Client/RankUpdateToken.cs new file mode 100644 index 000000000..088542d34 --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/RankUpdateToken.cs @@ -0,0 +1,11 @@ +namespace LOC.Core.Tokens.Client +{ + public class RankUpdateToken + { + public string Name { get; set; } + + public string Rank { get; set; } + + public bool Perm { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Client/RemovePunishmentToken.cs b/Website/LOC.Core/Tokens/Client/RemovePunishmentToken.cs new file mode 100644 index 000000000..09bb0ca9e --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/RemovePunishmentToken.cs @@ -0,0 +1,13 @@ +namespace LOC.Core.Tokens.Client +{ + public class RemovePunishmentToken + { + public string Target { get; set; } + + public int PunishmentId { get; set; } + + public string Reason { get; set; } + + public string Admin { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/Client/SlotToken.cs b/Website/LOC.Core/Tokens/Client/SlotToken.cs new file mode 100644 index 000000000..c5d668ca2 --- /dev/null +++ b/Website/LOC.Core/Tokens/Client/SlotToken.cs @@ -0,0 +1,8 @@ +namespace LOC.Core.Tokens.Client +{ + public class SlotToken + { + public string Material { get; set; } + public int Amount { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/PurchaseToken.cs b/Website/LOC.Core/Tokens/PurchaseToken.cs new file mode 100644 index 000000000..2b52bb4f4 --- /dev/null +++ b/Website/LOC.Core/Tokens/PurchaseToken.cs @@ -0,0 +1,11 @@ +namespace LOC.Core.Tokens +{ + public class PurchaseToken + { + public string AccountName { get; set; } + + public bool UsingCredits { get; set; } + + public int SalesPackageId { get; set; } + } +} diff --git a/Website/LOC.Core/Tokens/UnknownPurchaseToken.cs b/Website/LOC.Core/Tokens/UnknownPurchaseToken.cs new file mode 100644 index 000000000..a8cee6445 --- /dev/null +++ b/Website/LOC.Core/Tokens/UnknownPurchaseToken.cs @@ -0,0 +1,11 @@ +namespace LOC.Core.Tokens +{ + public class UnknownPurchaseToken + { + public string AccountName { get; set; } + + public string SalesPackageName { get; set; } + + public int Cost { get; set; } + } +} diff --git a/Website/LOC.Core/bin/Debug/EntityFramework.dll b/Website/LOC.Core/bin/Debug/EntityFramework.dll new file mode 100644 index 000000000..8caef36ac Binary files /dev/null and b/Website/LOC.Core/bin/Debug/EntityFramework.dll differ diff --git a/Website/LOC.Core/bin/Debug/EntityFramework.xml b/Website/LOC.Core/bin/Debug/EntityFramework.xml new file mode 100644 index 000000000..4057d68a4 --- /dev/null +++ b/Website/LOC.Core/bin/Debug/EntityFramework.xml @@ -0,0 +1,18061 @@ + + + + EntityFramework + + + + + Specifies the database column that a property is mapped to. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The name of the column the property is mapped to. + + + + The name of the column the property is mapped to. + + + + + The zero-based order of the column the property is mapped to. + + + + + The database provider specific data type of the column the property is mapped to. + + + + + Denotes that the class is a complex type. + Complex types are non-scalar properties of entity types that enable scalar properties to be organized within entities. + Complex types do not have keys and cannot be managed by the Entity Framework apart from the parent object. + + + + + Specifies how the database generates values for a property. + + + + + Initializes a new instance of the class. + + The pattern used to generate values for the property in the database. + + + + The pattern used to generate values for the property in the database. + + + + + The pattern used to generate values for a property in the database. + + + + + The database does not generate values. + + + + + The database generates a value when a row is inserted. + + + + + The database generates a value when a row is inserted or updated. + + + + + Denotes a property used as a foreign key in a relationship. + The annotation may be placed on the foreign key property and specify the associated navigation property name, + or placed on a navigation property and specify the associated foreign key name. + + + + + Initializes a new instance of the class. + + + If placed on a foreign key property, the name of the associated navigation property. + If placed on a navigation property, the name of the associated foreign key(s). + If a navigation property has multiple foreign keys, a comma separated list should be supplied. + + + + + If placed on a foreign key property, the name of the associated navigation property. + If placed on a navigation property, the name of the associated foreign key(s). + + + + + Specifies the inverse of a navigation property that represents the other end of the same relationship. + + + + + Initializes a new instance of the class. + + The navigation property representing the other end of the same relationship. + + + + The navigation property representing the other end of the same relationship. + + + + + Specifies the maximum length of array/string data allowed in a property. + + + + + Initializes a new instance of the class. + + + The maximum allowable length of array/string data. + Value must be greater than zero. + + + + + Initializes a new instance of the class. + The maximum allowable length supported by the database will be used. + + + + + Determines whether a specified object is valid. (Overrides ) + + + This method returns true if the is null. + It is assumed the is used if the value may not be null. + + The object to validate. + true if the value is null or less than or equal to the specified maximum length, otherwise false + Length is zero or less than negative one. + + + + Applies formatting to a specified error message. (Overrides ) + + The name to include in the formatted string. + A localized string to describe the maximum acceptable length. + + + + Checks that Length has a legal value. Throws InvalidOperationException if not. + + + + + Gets the maximum allowable length of the array/string data. + + + + + Specifies the minimum length of array/string data allowed in a property. + + + + + Initializes a new instance of the class. + + + The minimum allowable length of array/string data. + Value must be greater than or equal to zero. + + + + + Determines whether a specified object is valid. (Overrides ) + + + This method returns true if the is null. + It is assumed the is used if the value may not be null. + + The object to validate. + true if the value is null or greater than or equal to the specified minimum length, otherwise false + Length is less than zero. + + + + Applies formatting to a specified error message. (Overrides ) + + The name to include in the formatted string. + A localized string to describe the minimum acceptable length. + + + + Checks that Length has a legal value. Throws InvalidOperationException if not. + + + + + Gets the minimum allowable length of the array/string data. + + + + + Denotes that a property or class should be excluded from database mapping. + + + + + Specifies the database table that a class is mapped to. + + + + + Initializes a new instance of the class. + + The name of the table the class is mapped to. + + + + The name of the table the class is mapped to. + + + + + The schema of the table the class is mapped to. + + + + + The base for all all Entity Data Model (EDM) types that represent a type from the EDM type system. + + + + + Represents an item in an Entity Data Model (EDM) . + + + + + The base for all all Entity Data Model (EDM) item types that with a Name property that represents a qualified (can be dotted) name. + + + + + The base for all all Entity Data Model (EDM) item types that with a property. + + + + + The base for all all Entity Data Model (EDM) types that support annotation using . + + + + + EdmDataModelItem is the base for all types in the Entity Data Model (EDM) metadata construction and modification API. + + + + + DataModelItem is the base for all types in the EDM metadata reflection, construction and modification API. + + + + + Gets an value indicating which Entity Data Model (EDM) concept is represented by this item. + + + + + IAnnotatedDataModelItem is implemented by model-specific base types for all types with an property. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets or sets the currently assigned annotations. + + + + + Returns all EdmItem children directly contained by this EdmItem. + + + + + INamedDataModelItem is implemented by model-specific base types for all types with a property. + + + + + Gets or sets the currently assigned name. + + + + + Gets or sets the currently assigned name. + + + + + Gets a value indicating whether this type is abstract. + + + + + Gets the optional base type of this type. + + + + + EdmStructuralMember is the base for all types that represent members of structural items in the Entity Data Model (EDM) metadata construction and modification API. + + + + + Represents information about a database connection. + + + + + Creates a new instance of DbConnectionInfo representing a connection that is specified in the application configuration file. + + The name of the connection string in the application configuration. + + + + Creates a new instance of DbConnectionInfo based on a connection string. + + The connection string to use for the connection. + The name of the provider to use for the connection. Use 'System.Data.SqlClient' for SQL Server. + + + + Gets the connection information represented by this instance. + + Configuration to use if connection comes from the configuration file. + + + + Instances of this class are used to create DbConnection objects for + SQL Server LocalDb based on a given database name or connection string. + + + An instance of this class can be set on the class or in the + app.config/web.config for the application to cause all DbContexts created with no + connection information or just a database name to use SQL Server LocalDb by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Implementations of this interface are used to create DbConnection objects for + a type of database server based on a given database name. + An Instance is set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use a certain type of database server by default. + Two implementations of this interface are provided: + is used to create connections to Microsoft SQL Server, including EXPRESS editions. + is used to create connections to Microsoft SQL + Server Compact Editions. + Other implementations for other database servers can be added as needed. + Note that implementations should be thread safe or immutable since they may + be accessed by multiple threads at the same time. + + + + + Creates a connection based on the given database name or connection string. + + The database name or connection string. + An initialized DbConnection. + + + + Creates a new instance of the connection factory for the given version of LocalDb. + For SQL Server 2012 LocalDb use "v11.0". + + The LocalDb version to use. + + + + Creates a new instance of the connection factory for the given version of LocalDb. + For SQL Server 2012 LocalDb use "v11.0". + + + The LocalDb version to use. + + The connection string to use for options to the database other than the 'Initial Catalog', + 'Data Source', and 'AttachDbFilename'. + The 'Initial Catalog' and 'AttachDbFilename' will be prepended to this string based on the + database name when CreateConnection is called. + The 'Data Source' will be set based on the LocalDbVersion argument. + + + + + Creates a connection for SQL Server LocalDb based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + The connection string to use for options to the database other than the 'Initial Catalog', + 'Data Source', and 'AttachDbFilename'. + The 'Initial Catalog' and 'AttachDbFilename' will be prepended to this string based on the + database name when CreateConnection is called. + The 'Data Source' will be set based on the LocalDbVersion argument. + The default is 'Integrated Security=True; MultipleActiveResultSets=True;'. + + + + + Encapsulates a cloned and store . Note that these + objects are disposable and should be used in a using block to ensure both the cloned context and the + cloned connection are disposed. + + + + + For mocking. + + + + + Creates a clone of the given . The underlying of + the context is also cloned and the given connection string is used for the connection string of + the cloned connection. + + + + + Finds the assemblies that were used for loading o-space types in the source context + and loads those assemblies in the cloned context. + + + + + Disposes both the underlying ObjectContext and its store connection. + + + + + The cloned context. + + + + + This is always the store connection of the underlying ObjectContext. + + + + + Represents setting the database initializer for a specific context type + + + + + Represents a parameter to be passed to a method + + + + + Represents a series of parameters to pass to a method + + + + + Adds a new parameter to the collection + Used for unit testing + + + + + Represents the configuration for a series of contexts + + + + + Adds a new context to the collection + Used for unit testing + + + + + Represents the configuration for a specific context type + + + + + Represents setting the default connection factory + + + + + Represents all Entity Framework related configuration + + + + + Handles creating databases either using the core provider or the Migrations pipeline. + + + + + Creates a database using the core provider (i.e. ObjectContext.CreateDatabase) or + by using Code First Migrations to create an empty database + and the perform an automatic migration to the current model. + Migrations is used if Code First is being used and the EF provider is for SQL Server + or SQL Compact. The core is used for non-Code First models and for other providers even + when using Code First. + + + + + A DbContext instance represents a combination of the Unit Of Work and Repository patterns such that + it can be used to query from a database and group together changes that will then be written + back to the store as a unit. + DbContext is conceptually similar to ObjectContext. + + + DbContext is usually used with a derived type that contains properties for + the root entities of the model. These sets are automatically initialized when the + instance of the derived class is created. This behavior can be modified by applying the + attribute to either the entire derived context + class, or to individual properties on the class. + + The Entity Data Model backing the context can be specified in several ways. When using the Code First + approach, the properties on the derived context are used to build a model + by convention. The protected OnModelCreating method can be overridden to tweak this model. More + control over the model used for the Model First approach can be obtained by creating a + explicitly from a and passing this model to one of the DbContext constructors. + + When using the Database First or Model First approach the Entity Data Model can be created using the + Entity Designer (or manually through creation of an EDMX file) and then this model can be specified using + entity connection string or an object. + + The connection to the database (including the name of the database) can be specified in several ways. + If the parameterless DbContext constructor is called from a derived context, then the name of the derived context + is used to find a connection string in the app.config or web.config file. If no connection string is found, then + the name is passed to the DefaultConnectionFactory registered on the class. The connection + factory then uses the context name as the database name in a default connection string. (This default connection + string points to .\SQLEXPRESS on the local machine unless a different DefaultConnectionFactory is registered.) + + Instead of using the derived context name, the connection/database name can also be specified explicitly by + passing the name to one of the DbContext constructors that takes a string. The name can also be passed in + the form "name=myname", in which case the name must be found in the config file or an exception will be thrown. + + Note that the connection found in the app.config or web.config file can be a normal database connection + string (not a special Entity Framework connection string) in which case the DbContext will use Code First. + However, if the connection found in the config file is a special Entity Framework connection string, then the + DbContext will use Database/Model First and the model specified in the connection string will be used. + + An existing or explicitly created DbConnection can also be used instead of the database/connection name. + + A can be applied to a class derived from DbContext to set the + version of conventions used by the context when it creates a model. If no attribute is applied then the + latest version of conventions will be used. + + + + + Interface implemented by objects that can provide an instance. + The class implements this interface to provide access to the underlying + ObjectContext. + + + + + Gets the object context. + + The object context. + + + + Constructs a new context instance using conventions to create the name of the database to + which a connection will be made. The by-convention name is the full name (namespace + class name) + of the derived context class. + See the class remarks for how this is used to create a connection. + + + + + Constructs a new context instance using conventions to create the name of the database to + which a connection will be made, and initializes it from the given model. + The by-convention name is the full name (namespace + class name) of the derived context class. + See the class remarks for how this is used to create a connection. + + The model that will back this context. + + + + Constructs a new context instance using the given string as the name or connection string for the + database to which a connection will be made. + See the class remarks for how this is used to create a connection. + + Either the database name or a connection string. + + + + Constructs a new context instance using the given string as the name or connection string for the + database to which a connection will be made, and initializes it from the given model. + See the class remarks for how this is used to create a connection. + + Either the database name or a connection string. + The model that will back this context. + + + + Constructs a new context instance using the existing connection to connect to a database. + The connection will not be disposed when the context is disposed. + + An existing connection to use for the new context. + If set to true the connection is disposed when + the context is disposed, otherwise the caller must dispose the connection. + + + + Constructs a new context instance using the existing connection to connect to a database, + and initializes it from the given model. + The connection will not be disposed when the context is disposed. + An existing connection to use for the new context. + The model that will back this context. + If set to true the connection is disposed when + the context is disposed, otherwise the caller must dispose the connection. + + + + + Constructs a new context instance around an existing ObjectContext. + An existing ObjectContext to wrap with the new context. + If set to true the ObjectContext is disposed when + the DbContext is disposed, otherwise the caller must dispose the connection. + + + + + Initializes the internal context, discovers and initializes sets, and initializes from a model if one is provided. + + + + + Discovers DbSets and initializes them. + + + + + This method is called when the model for a derived context has been initialized, but + before the model has been locked down and used to initialize the context. The default + implementation of this method does nothing, but it can be overridden in a derived class + such that the model can be further configured before it is locked down. + + + Typically, this method is called only once when the first instance of a derived context + is created. The model for that context is then cached and is for all further instances of + the context in the app domain. This caching can be disabled by setting the ModelCaching + property on the given ModelBuidler, but note that this can seriously degrade performance. + More control over caching is provided through use of the DbModelBuilder and DbContextFactory + classes directly. + + The builder that defines the model for the context being created. + + + + Internal method used to make the call to the real OnModelCreating method. + + The model builder. + + + + Returns a DbSet instance for access to entities of the given type in the context, + the ObjectStateManager, and the underlying store. + + + See the DbSet class for more details. + + The type entity for which a set should be returned. + A set for the given entity type. + + + + Returns a non-generic DbSet instance for access to entities of the given type in the context, + the ObjectStateManager, and the underlying store. + + The type of entity for which a set should be returned. + A set for the given entity type. + + See the DbSet class for more details. + + + + + Saves all changes made in this context to the underlying database. + + The number of objects written to the underlying database. + Thrown if the context has been disposed. + + + + Validates tracked entities and returns a Collection of containing validation results. + + + Collection of validation results for invalid entities. The collection is never null and must not contain null + values or results for valid entities. + + + 1. This method calls DetectChanges() to determine states of the tracked entities unless + DbContextConfiguration.AutoDetectChangesEnabled is set to false. + 2. By default only Added on Modified entities are validated. The user is able to change this behavior + by overriding ShouldValidateEntity method. + + + + + Extension point allowing the user to override the default behavior of validating only + added and modified entities. + + DbEntityEntry instance that is supposed to be validated. + true to proceed with validation. false otherwise. + + + + Extension point allowing the user to customize validation of an entity or filter out validation results. + Called by . + + DbEntityEntry instance to be validated. + User defined dictionary containing additional info for custom validation. + It will be passed to + and will be exposed as . + This parameter is optional and can be null. + Entity validation result. Possibly null when overridden. + + + + Internal method that calls the protected ValidateEntity method. + + DbEntityEntry instance to be validated. + User defined dictionary containing additional info for custom validation. + It will be passed to + and will be exposed as . + This parameter is optional and can be null. + Entity validation result. Possibly null when ValidateEntity is overridden. + + + + Gets a object for the given entity providing access to + information about the entity and the ability to perform actions on the entity. + + The type of the entity. + The entity. + An entry for the entity. + + + + Gets a object for the given entity providing access to + information about the entity and the ability to perform actions on the entity. + + The entity. + An entry for the entity. + + + + Calls the protected Dispose method. + + + + + Disposes the context. The underlying is also disposed if it was created + is by this context or ownership was passed to this context when this context was created. + The connection to the database ( object) is also disposed if it was created + is by this context or ownership was passed to this context when this context was created. + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Creates a Database instance for this context that allows for creation/deletion/existence checks + for the underlying database. + + + + + Returns the Entity Framework ObjectContext that is underlying this context. + + Thrown if the context has been disposed. + + + + Provides access to features of the context that deal with change tracking of entities. + + An object used to access features that deal with change tracking. + + + + Provides access to configuration options for the context. + + An object used to access configuration options. + + + + Provides access to the underlying InternalContext for other parts of the internal design. + + + + + A simple representation of an app.config or web.config file. + + + + + Initializes a new instance of AppConfig based on supplied configuration + + Configuration to load settings from + + + + Initializes a new instance of AppConfig based on supplied connection strings + The default configuration for database initializers and default connection factory will be used + + Connection strings to be used + + + + Initializes a new instance of AppConfig based on the for the AppDomain + + + Use AppConfig.DefaultInstance instead of this constructor + + + + + Appies any database intializers specified in the configuration + + + + + Appies any database intializers specified in the configuration + + + Value indicating if initializers should be re-applied if they have already been applied in this AppDomain + + + + + Gets the specified connection string from the configuration + + Name of the connection string to get + The connection string, or null if there is no connection string with the specified name + + + + Gets the default connection factory based on the configuration + + + + + Gets a singleton instance of configuration based on the for the AppDomain + + + + + Acts as a proxy for that for the most part just passes calls + through to the real object but uses virtual methods/properties such that uses of the object + can be mocked. + + + + + Encapsulates information read from the application config file that specifies a database initializer + and allows that initializer to be dynamically applied. + + + + + Initializes a new instance of the class. + + The key from the entry in the config file. + The value from the enrty in the config file. + + + + Uses the context type and initializer type specified in the config to create an initializer instance + and set it with the DbDbatabase.SetInitializer method. + + + + + Reads all initializers from the application config file and sets them using the Database class. + + + + + Calculates the model hash values used the EdmMetadata table from EF 4.1/4.2. + + + + + Calculates an SHA256 hash of the EDMX from the given code first model. This is the hash stored in + the database in the EdmMetadata table in EF 4.1/4.2. The hash is always calculated using a v2 schema + as was generated by EF 4.1/4.2 and with the entity included in the model. + + + + + Acts as a proxy for that for the most part just passes calls + through to the real object but uses virtual methods/properties such that uses of the object + can be mocked. + + + + + An implementation of that will use Code First Migrations + to update the database to the latest version. + + + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + Initializes a new instance of the MigrateDatabaseToLatestVersion class. + + + + + Initializes a new instance of the MigrateDatabaseToLatestVersion class that will + use a specific connection string from the configuration file to connect to + the database to perform the migration. + + The name of the connection string to use for migration. + + + + + + + Helper class that is used to configure a column. + + + + + Creates a new column definition to store Binary data. + + Value indicating whether or not the column allows null values. + The maximum allowable length of the array data. + Value indicating whether or not all data should be padded to the maximum length. + Value indicating whether or not the maximum length supported by the database provider should be used. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + Value indicating whether or not this column should be configured as a timestamp. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Boolean data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Byte data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store DateTime data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Decimal data. + + Value indicating whether or not the column allows null values. + The numeric precision of the column. + The numeric scale of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + Value indicating whether or not the database will generate values for this column during insert. + The newly constructed column definition. + + + + Creates a new column definition to store Double data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store GUID data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Single data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Short data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Integer data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Long data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store String data. + + Value indicating whether or not the column allows null values. + The maximum allowable length of the string data. + Value indicating whether or not all data should be padded to the maximum length. + Value indicating whether or not the maximum length supported by the database provider should be used. + Value indicating whether or not the column supports Unicode content. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Time data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store DateTimeOffset data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Helper class that is used to further configure a table being created from a CreateTable call on . + + + + + Initializes a new instance of the TableBuilder class. + + The table creation operation to be further configured. + The migration the table is created in. + + + + Specifies a primary key for the table. + + + A lambda expression representing the property to be used as the primary key. + C#: t => t.Id + VB.Net: Function(t) t.Id + + If the primary key is made up of multiple properties then specify an anonymous type including the properties. + C#: t => new { t.Id1, t.Id2 } + VB.Net: Function(t) New With { t.Id1, t.Id2 } + + + The name of the primary key. + If null is supplied, a default name will be generated. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Specifies an index to be created on the table. + + + A lambda expression representing the property to be indexed. + C#: t => t.PropertyOne + VB.Net: Function(t) t.PropertyOne + + If multiple properties are to be indexed then specify an anonymous type including the properties. + C#: t => new { t.PropertyOne, t.PropertyTwo } + VB.Net: Function(t) New With { t.PropertyOne, t.PropertyTwo } + + A value indicating whether or not this is a unique index. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Specifies a foreign key constraint to be created on the table. + + Name of the table that the foreign key constraint targets. + + A lambda expression representing the properties of the foreign key. + C#: t => t.PropertyOne + VB.Net: Function(t) t.PropertyOne + + If multiple properties make up the foreign key then specify an anonymous type including the properties. + C#: t => new { t.PropertyOne, t.PropertyTwo } + VB.Net: Function(t) New With { t.PropertyOne, t.PropertyTwo } + + A value indicating whether or not cascade delete should be configured on the foreign key constraint. + + + The name of this foreign key constraint. + If no name is supplied, a default name will be calculated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Base class for code-based migrations. + + + + + Operations to be performed during the upgrade process. + + + + + Operations to be performed during the downgrade process. + + + + + Adds an operation to create a new table. + + + The columns in this create table operation. + You do not need to specify this type, it will be inferred from the columnsAction parameter you supply. + + The name of the table. Schema name is optional, if no schema is specified then dbo is assumed. + + An action that specifies the columns to be included in the table. + i.e. t => new { Id = t.Int(identity: true), Name = t.String() } + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + An object that allows further configuration of the table creation operation. + + + + Adds an operation to create a new foreign key constraint. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key column. + + The table that contains the column this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The column this foreign key references. + If no value is supplied the primary key of the principal table will be referenced. + + + A value indicating if cascade delete should be configured for the foreign key relationship. + If no value is supplied, cascade delete will be off. + + + The name of the foreign key constraint in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new foreign key constraint. + + + The table that contains the foreign key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key columns. + + The table that contains the columns this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The columns this foreign key references. + If no value is supplied the primary key of the principal table will be referenced. + + + A value indicating if cascade delete should be configured for the foreign key relationship. + If no value is supplied, cascade delete will be off. + + + The name of the foreign key constraint in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on its name. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the foreign key constraint in the database. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on the column it targets. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key column. + + The table that contains the column this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + The columns this foreign key references. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on the columns it targets. + + + The table that contains the foreign key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key columns. + + The table that contains the columns this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + The columns this foreign key references. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a table. + + + The name of the table to be dropped. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to move a table to a new schema. + + + The name of the table to be moved. + Schema name is optional, if no schema is specified then dbo is assumed. + + The schema the table is to be moved to. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to rename a table. To change the schema of a table use MoveTable + + + The name of the table to be renamed. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The new name for the table. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to rename a column. + + + The name of the table that contains the column to be renamed. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be renamed. + The new name for the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to add a column to an existing table. + + + The name of the table to add the column to. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The name of the column to be added. + + + An action that specifies the column to be added. + i.e. c => c.Int(nullable: false, defaultValue: 3) + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing column. + + + The name of the table to drop the column from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to alter the definition of an existing column. + + + The name of the table the column exists in. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be changed. + + An action that specifies the new definition for the column. + i.e. c => c.String(nullable: false, defaultValue: "none") + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new primary key. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The primary key column. + + The name of the primary key in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new primary key based on multiple columns. + + + The table that contains the primary key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The primary key columns. + + The name of the primary key in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing primary key that does not have the default name. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the primary key to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing primary key that was created with the default name. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create an index on a single column. + + + The name of the table to create the index on. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to create the index on. + + A value indicating if this is a unique index. + If no value is supplied a non-unique index will be created. + + + The name to use for the index in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create an index on multiple columns. + + + The name of the table to create the index on. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the columns to create the index on. + + A value indicating if this is a unique index. + If no value is supplied a non-unique index will be created. + + + The name to use for the index in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an index based on its name. + + + The name of the table to drop the index from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the index to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an index based on the columns it targets. + + + The name of the table to drop the index from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column(s) the index targets. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to execute a SQL command. + + The SQL to be executed. + + A value indicating if the SQL should be executed outside of the + transaction being used for the migration process. + If no value is supplied the SQL will be executed within the transaction. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Configuration relating to the use of migrations for a given model. + You will typically create a configuration class that derives + from rather than + using this class. + + + + + Initializes a new instance of the DbMigrationsConfiguration class. + + + + + Adds a new SQL generator to be used for a given database provider. + + Name of the database provider to set the SQL generator for. + The SQL generator to be used. + + + + Gets the SQL generator that is set to be used with a given database provider. + + Name of the database provider to get the SQL generator for. + The SQL generator that is set for the database provider. + + + + Gets or sets a value indicating if automatic migrations can be used when migration the database. + + + + + Gets or sets a value indicating if data loss is acceptable during automatic migration. + If set to false an exception will be thrown if data loss may occur as part of an automatic migration. + + + + + Gets or sets the derived DbContext representing the model to be migrated. + + + + + Gets or sets the namespace used for code-based migrations. + + + + + Gets or sets the sub-directory that code-based migrations are stored in. + + + + + Gets or sets the code generator to be used when scaffolding migrations. + + + + + Gets or sets the assembly containing code-based migrations. + + + + + Gets or sets a value to override the connection of the database to be migrated. + + + + + Gets or sets the timeout value used for the individual commands within a + migration. A null value indicates that the default value of the underlying + provider will be used. + + + + + Configuration relating to the use of migrations for a given model. + + The context representing the model that this configuration applies to. + + + + Initializes a new instance of the DbMigrationsConfiguration class. + + + + + Runs after upgrading to the latest migration to allow seed data to be updated. + + Context to be used for updating seed data. + + + + DbMigrator is used to apply existing migrations to a database. + DbMigrator can be used to upgrade and downgrade to any given migration. + To scaffold migrations based on changes to your model use + + + + + Base class for decorators that wrap the core + + + + + Initializes a new instance of the MigratorBase class. + + The migrator that this decorator is wrapping. + + + + Gets a list of the pending migrations that have not been applied to the database. + + List of migration Ids + + + + Updates the target database to the latest migration. + + + + + Updates the target database to a given migration. + + The migration to upgrade/downgrade to. + + + + Gets a list of the migrations that are defined in the assembly. + + List of migration Ids + + + + Gets a list of the migrations that have been applied to the database. + + List of migration Ids + + + + Gets the configuration being used for the migrations process. + + + + + Migration Id representing the state of the database before any migrations are applied. + + + + + Initializes a new instance of the DbMigrator class. + + Configuration to be used for the migration process. + + + + Gets all migrations that are defined in the configured migrations assembly. + + + + + Gets all migrations that have been applied to the target database. + + + + + Gets all migrations that are defined in the assembly but haven't been applied to the target database. + + + + + Updates the target database to a given migration. + + The migration to upgrade/downgrade to. + + + + Gets the configuration that is being used for the migration process. + + + + + A set of extension methods for + + + + + Adds or updates entities by key when SaveChanges is called. Equivalent to an "upsert" operation + from database terminology. + This method can useful when seeding data using Migrations. + + The entities to add or update. + + When the parameter is a custom or fake IDbSet implementation, this method will + attempt to locate and invoke a public, instance method with the same signature as this extension method. + + + + + Adds or updates entities by a custom identification expression when SaveChanges is called. + Equivalent to an "upsert" operation from database terminology. + This method can useful when seeding data using Migrations. + + + An expression specifying the properties that should be used when determining + whether an Add or Update operation should be performed. + + The entities to add or update. + + When the parameter is a custom or fake IDbSet implementation, this method will + attempt to locate and invoke a public, instance method with the same signature as this extension method. + + + + + Generates C# code for a code-based migration. + + + + + Base class for providers that generate code for code-based migrations. + + + + + Generates the code that should be added to the users project. + + Unique identifier of the migration. + Operations to be performed by the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Gets the namespaces that must be output as "using" or "Imports" directives to handle + the code generated by the given operations. + + The operations for which code is going to be generated. + An ordered list of namespace names. + + + + Gets the default namespaces that must be output as "using" or "Imports" directives for + any code generated. + + A value indicating if this class is being generated for a code-behind file. + An ordered list of namespace names. + + + + + + + Generates the primary code file that the user can view and edit. + + Operations to be performed by the migration. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates the code behind file with migration metadata. + + Unique identifier of the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates a property to return the source or target model in the code behind file. + + Name of the property. + Value to be returned. + Text writer to add the generated code to. + + + + Generates a namespace, using statements and class definition. + + Namespace that code should be generated in. + Name of the class that should be generated. + Text writer to add the generated code to. + Base class for the generated class. + A value indicating if this class is being generated for a code-behind file. + Namespaces for which using directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used. + + + + Generates the closing code for a class that was started with WriteClassStart. + + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify a set of column names using a lambda expression. + + The columns to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify the definition for a . + + The column definition to generate code for. + Text writer to add the generated code to. + A value indicating whether to include the column name in the definition. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column of unknown data type. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Removes any invalid characters from the name of an database artifact. + + The name to be scrubbed. + The scrubbed name. + + + + Gets the type name to use for a column of the given data type. + + The data type to translate. + The type name to use in the generated migration. + + + + Quotes an identifier using appropriate escaping to allow it to be stored in a string. + + The identifier to be quoted. + The quoted identifier. + + + + Scaffolds code-based migrations to apply pending model changes to the database. + + + + + Initializes a new instance of the MigrationScaffolder class. + + Configuration to be used for scaffolding. + + + + Scaffolds a code based migration to apply any pending model changes to the database. + + The name to use for the scaffolded migration. + The scaffolded migration. + + + + Scaffolds a code based migration to apply any pending model changes to the database. + + The name to use for the scaffolded migration. + Whether or not to include model changes. + The scaffolded migration. + + + + Scaffolds the initial code-based migration corresponding to a previously run database initializer. + + The scaffolded migration. + + + + Gets or sets the namespace used in the migration's generated code. + + By default, this is the same as MigrationsNamespace on the migrations + configuration object passed into the constructor. For VB.NET projects, this + will need to be updated to take into account the project's root namespace. + + + + + Represents a code-based migration that has been scaffolded and is ready to be written to a file. + + + + + Gets or sets the unique identifier for this migration. + Typically used for the file name of the generated code. + + + + + Gets or sets the scaffolded migration code that the user can edit. + + + + + Gets or sets the scaffolded migration code that should be stored in a code behind file. + + + + + Gets or sets the programming language used for this migration. + Typically used for the file extension of the generated code. + + + + + Gets or sets the subdirectory in the user's project that this migration should be saved in. + + + + + Gets a dictionary of string resources to add to the migration resource file. + + + + + Represents an exception that occurred while running an operation in another AppDomain in the . + + + + + Initializes a new instance of the ToolingException class. + + Error that explains the reason for the exception. + The type of the exception that was thrown. + The stack trace of the exception that was thrown. + + + + + + + + + + Gets the type of the exception that was thrown. + + + + + Gets the stack trace of the exception that was thrown. + + + + + Helper class that is used by design time tools to run migrations related + commands that need to interact with an application that is being edited + in Visual Studio. + + Because the application is being edited the assemblies need to + be loaded in a separate AppDomain to ensure the latest version + is always loaded. + + The App/Web.config file from the startup project is also copied + to ensure that any configuration is applied. + + + + + Initializes a new instance of the ToolingFacade class. + + + The name of the assembly that contains the migrations configuration to be used. + + + The namespace qualified name of migrations configuration to be used. + + + The working directory containing the compiled assemblies. + + + The path of the config file from the startup project. + + + The path of the application data directory from the startup project. + Typically the App_Data directory for web applications or the working directory for executables. + + + The connection to the database to be migrated. + If null is supplied, the default connection for the context will be used. + + + + + Releases all unmanaged resources used by the facade. + + + + + Gets the fully qualified name of all types deriving from . + + All context types found. + + + + Gets the fully qualified name of a type deriving from . + + The name of the context type. If null, the single context type found in the assembly will be returned. + The context type found. + + + + Gets a list of all migrations that have been applied to the database. + + Ids of applied migrations. + + + + Gets a list of all migrations that have not been applied to the database. + + Ids of pending migrations. + + + + Updates the database to the specified migration. + + + The Id of the migration to migrate to. + If null is supplied, the database will be updated to the latest migration. + + Value indicating if data loss during automatic migration is acceptable. + + + + Generates a SQL script to migrate between two migrations. + + + The migration to update from. + If null is supplied, a script to update the current database will be produced. + + + The migration to update to. + If null is supplied, a script to update to the latest migration will be produced. + + Value indicating if data loss during automatic migration is acceptable. + The generated SQL script. + + + + Scaffolds a code-based migration to apply any pending model changes. + + The name for the generated migration. + The programming language of the generated migration. + The root namespace of the project the migration will be added to. + Whether or not to include model changes. + The scaffolded migration. + + + + Scaffolds the initial code-based migration corresponding to a previously run database initializer. + + The programming language of the generated migration. + The root namespace of the project the migration will be added to. + The scaffolded migration. + + + + + + + Releases all resources used by the facade. + + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + + Gets or sets an action to be run to log information. + + + + + Gets or sets an action to be run to log warnings. + + + + + Gets or sets an action to be run to log verbose information. + + + + + Base class for loggers that can be used for the migrations process. + + + + + Logs an informational message. + + The message to be logged. + + + + Logs a warning that the user should be made aware of. + + The message to be logged. + + + + Logs some additional information that should only be presented to the user if they request verbose output. + + The message to be logged. + + + + Generates VB.Net code for a code-based migration. + + + + + + + + Generates the primary code file that the user can view and edit. + + Operations to be performed by the migration. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates the code behind file with migration metadata. + + Unique identifier of the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates a property to return the source or target model in the code behind file. + + Name of the property. + Value to be returned. + Text writer to add the generated code to. + + + + Generates a namespace, using statements and class definition. + + Namespace that code should be generated in. + Name of the class that should be generated. + Text writer to add the generated code to. + Base class for the generated class. + A value indicating if this class is being generated for a code-behind file. + Namespaces for which Imports directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used. + + + + Generates the closing code for a class that was started with WriteClassStart. + + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify a set of column names using a lambda expression. + + The columns to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify the definition for a . + + The column definition to generate code for. + Text writer to add the generated code to. + A value indicating whether to include the column name in the definition. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column of unknown data type. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Removes any invalid characters from the name of an database artifact. + + The name to be scrubbed. + The scrubbed name. + + + + Gets the type name to use for a column of the given data type. + + The data type to translate. + The type name to use in the generated migration. + + + + Quotes an identifier using appropriate escaping to allow it to be stored in a string. + + The identifier to be quoted. + The quoted identifier. + + + + This class is used by Code First Migrations to read and write migration history + from the database. It is not intended to be used by other code and is only public + so that it can be accessed by EF when running under partial trust. It may be + changed or removed in the future. + + + + + Gets or sets the Id of the migration this row represents. + + + + + Gets or sets the date and time that this migrations history entry was created. + + + + + Gets or sets the state of the model after this migration was applied. + + + + + Gets or sets the version of Entity Framework that created this entry. + + + + + This is a version of the HistoryContext that still includes CreatedOn in its model. + It is used when figuring out whether or not the CreatedOn column exists and so should + be dropped. + + + + + Represents an error that occurs when an automatic migration would result in data loss. + + + + + Represents errors that occur inside the Code First Migrations pipeline. + + + + + Initializes a new instance of the MigrationsException class. + + + + + Initializes a new instance of the MigrationsException class. + + The message that describes the error. + + + + Initializes a new instance of the MigrationsException class. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the MigrationsException class with serialized data. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + + + Initializes a new instance of the AutomaticDataLossException class. + + The message that describes the error. + + + + Represents an error that occurs when there are pending model changes after applying the last migration and automatic migration is disabled. + + + + + Initializes a new instance of the AutomaticMigrationsDisabledException class. + + The message that describes the error. + + + + Provides additional metadata about a code-based migration. + + + + + Gets the unique identifier for the migration. + + + + + Gets the state of the model before this migration is run. + + + + + Gets the state of the model after this migration is run. + + + + + Decorator to provide logging during migrations operations.. + + + + + Initializes a new instance of the MigratorLoggingDecorator class. + + The migrator that this decorator is wrapping. + The logger to write messages to. + + + + Decorator to produce a SQL script instead of applying changes to the database. + Using this decorator to wrap will prevent + from applying any changes to the target database. + + + + + Initializes a new instance of the MigratorScriptingDecorator class. + + The migrator that this decorator is wrapping. + + + + + Represents a column being added to a table. + + + + + Represents an operation to modify a database schema. + + + + + Initializes a new instance of the MigrationOperation class. + + + + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets additional arguments that may be processed by providers. + + + + + Gets an operation that will revert this operation. + + + + + Gets a value indicating if this operation may result in data loss. + + + + + Initializes a new instance of the AddColumnOperation class. + + The name of the table the column should be added to. + Details of the column being added. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column should be added to. + + + + + Gets the details of the column being added. + + + + + Gets an operation that represents dropping the added column. + + + + + + + + Represents a foreign key constraint being added to a table. + + + + + Base class for changes that affect foreign key constraints. + + + + + Initializes a new instance of the ForeignKeyOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the name of the table that the foreign key constraint targets. + + + + + Gets or sets the name of the table that the foreign key columns exist in. + + + + + The names of the foreign key column(s). + + + + + Gets a value indicating if a specific name has been supplied for this foreign key constraint. + + + + + Gets or sets the name of this foreign key constraint. + If no name is supplied, a default name will be calculated. + + + + + Initializes a new instance of the AddForeignKeyOperation class. + The PrincipalTable, PrincipalColumns, DependentTable and DependentColumns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to create an index on the foreign key column(s). + + An operation to add the index. + + + + The names of the column(s) that the foreign key constraint should target. + + + + + Gets or sets a value indicating if cascade delete should be configured on the foreign key constraint. + + + + + Gets an operation to drop the foreign key constraint. + + + + + + + + Represents adding a primary key to a table. + + + + + Common base class to represent operations affecting primary keys. + + + + + Initializes a new instance of the PrimaryKeyOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the name of the table that contains the primary key. + + + + + Gets the column(s) that make up the primary key. + + + + + Gets a value indicating if a specific name has been supplied for this primary key. + + + + + Gets or sets the name of this primary key. + If no name is supplied, a default name will be calculated. + + + + + + + + Initializes a new instance of the AddPrimaryKeyOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to drop the primary key. + + + + + Represents altering an existing column. + + + + + Initializes a new instance of the AlterColumnOperation class. + + The name of the table that the column belongs to. + Details of what the column should be altered to. + Value indicating if this change will result in data loss. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the AlterColumnOperation class. + + The name of the table that the column belongs to. + Details of what the column should be altered to. + Value indicating if this change will result in data loss. + An operation to revert this alteration of the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table that the column belongs to. + + + + + Gets the new definition for the column. + + + + + Gets an operation that represents reverting the alteration. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents information about a column. + + + + + Initializes a new instance of the class. + + The data type for this column. + + + + Initializes a new instance of the class. + + The data type for this column. + + Additional details about the data type. + This includes details such as maximum length, nullability etc. + + + + + Determines if this column is a narrower data type than another column. + Used to determine if altering the supplied column definition to this definition will result in data loss. + + The column to compare to. + Details of the database provider being used. + True if this column is of a narrower data type. + + + + Gets the data type for this column. + + + + + Gets the CLR type corresponding to the database type of this column. + + + + + Gets the default value for the CLR type corresponding to the database type of this column. + + + + + Gets additional details about the data type of this column. + This includes details such as maximum length, nullability etc. + + + + + Gets or sets the name of the column. + + + + + Gets or sets a provider specific data type to use for this column. + + + + + Gets or sets a value indicating if this column can store null values. + + + + + Gets or sets a value indicating if values for this column will be generated by the database using the identity pattern. + + + + + Gets or sets the maximum length for this column. + Only valid for array data types. + + + + + Gets or sets the precision for this column. + Only valid for decimal data types. + + + + + Gets or sets the scale for this column. + Only valid for decimal data types. + + + + + Gets or sets a constant value to use as the default value for this column. + + + + + Gets or sets a SQL expression used as the default value for this column. + + + + + Gets or sets a value indicating if this column is fixed length. + Only valid for array data types. + + + + + Gets or sets a value indicating if this column supports Unicode characters. + Only valid for textual data types. + + + + + Gets or sets a value indicating if this column should be configured as a timestamp. + + + + + Represents creating a database index. + + + + + Common base class for operations affecting indexes. + + + + + Initializes a new instance of the IndexOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the table the index belongs to. + + + + + Gets or sets the columns that are indexed. + + + + + Gets a value indicating if a specific name has been supplied for this index. + + + + + Gets or sets the name of this index. + If no name is supplied, a default name will be calculated. + + + + + Initializes a new instance of the CreateIndexOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets a value indicating if this is a unique index. + + + + + Gets an operation to drop this index. + + + + + + + + Represents creating a table. + + + + + Initializes a new instance of the CreateTableOperation class. + + Name of the table to be created. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be created. + + + + + Gets the columns to be included in the new table. + + + + + Gets or sets the primary key for the new table. + + + + + Gets an operation to drop the table. + + + + + + + + Represents deleting a new record from the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Common base class for operations that affect the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Initializes a new instance of the HistoryOperation class. + + Name of the migrations history table. + Name of the migration being affected. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the migrations history table. + + + + + Gets the name of the migration being affected. + + + + + + + + Initializes a new instance of the DeleteHistoryOperation class. + + Name of the migrations history table. + Id of the migration record to be deleted. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Represents a column being dropped from a table. + + + + + Initializes a new instance of the DropColumnOperation class. + + The name of the table the column should be dropped from. + The name of the column to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropColumnOperation class. + + The name of the table the column should be dropped from. + The name of the column to be dropped. + The operation that represents reverting the drop operation. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column should be dropped from. + + + + + Gets the name of the column to be dropped. + + + + + Gets an operation that represents reverting dropping the column. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents a foreign key constraint being dropped from a table. + + + + + Initializes a new instance of the DropForeignKeyOperation class. + The PrincipalTable, DependentTable and DependentColumns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropForeignKeyOperation class. + + The operation that represents reverting dropping the foreign key constraint. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to drop the associated index on the foreign key column(s). + + An operation to drop the index. + + + + Gets an operation that represents reverting dropping the foreign key constraint. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents dropping an existing index. + + + + + Initializes a new instance of the DropIndexOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropIndexOperation class. + + The operation that represents reverting dropping the index. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation that represents reverting dropping the index. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents dropping a primary key from a table. + + + + + Initializes a new instance of the DropPrimaryKeyOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to add the primary key. + + + + + Represents dropping an existing table. + + + + + Initializes a new instance of the DropTableOperation class. + + The name of the table to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropTableOperation class. + + The name of the table to be dropped. + An operation that represents reverting dropping the table. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be dropped. + + + + + Gets an operation that represents reverting dropping the table. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents inserting a new record into the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Initializes a new instance of the InsertHistoryOperation class. + + Name of the migrations history table. + Id of the migration record to be inserted. + Value to be stored in the model column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the value to store in the history table representing the target model of the migration. + + + + + Gets the value to store in the history table indicating the version of Entity Framework used to produce this migration. + + + + + + + + Represents moving a table from one schema to another. + + + + + Initializes a new instance of the MoveTableOperation class. + + Name of the table to be moved. + Name of the schema to move the table to. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be moved. + + + + + Gets the name of the schema to move the table to. + + + + + Gets an operation that moves the table back to its original schema. + + + + + + + + Represents renaming an existing column. + + + + + Initializes a new instance of the RenameColumnOperation class. + + Name of the table the column belongs to. + Name of the column to be renamed. + New name for the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column belongs to. + + + + + Gets the name of the column to be renamed. + + + + + Gets the new name for the column. + + + + + Gets an operation that reverts the rename. + + + + + + + + Represents renaming an existing table. + + + + + Initializes a new instance of the RenameTableOperation class. + + Name of the table to be renamed. + New name for the table. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be renamed. + + + + + Gets the new name for the table. + + + + + Gets an operation that reverts the rename. + + + + + + + + Represents a provider specific SQL statement to be executed directly against the target database. + + + + + Initializes a new instance of the SqlOperation class. + + The SQL to be executed. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the SQL to be executed. + + + + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + + + + Common base class for providers that convert provider agnostic migration + operations into database provider specific SQL commands. + + + + + Converts a set of migration operations into database provider specific SQL. + + The operations to be converted. + Token representing the version of the database being targeted. + A list of SQL statements to be executed to perform the migration operations. + + + + Represents a migration operation that has been translated into a SQL statement. + + + + + Gets or sets the SQL to be executed to perform this migration operation. + + + + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + Provider to convert provider agnostic migration operations into SQL commands + that can be run against Microsoft SQL Server Compact Edition. + + + + + Provider to convert provider agnostic migration operations into SQL commands + that can be run against a Microsoft SQL Server database. + + + + + Converts a set of migration operations into Microsoft SQL Server specific SQL. + + The operations to be converted. + Token representing the version of SQL Server being targeted (i.e. "2005", "2008"). + A list of SQL statements to be executed to perform the migration operations. + + + + Creates an empty connection for the current provider. + Allows derived providers to use connection other than . + + + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL to mark a table as a system table. + Generated SQL should be added using the Statement method. + + The table to mark as a system table. + + + + Generates SQL to create a database schema. + Generated SQL should be added using the Statement method. + + The name of the schema to create. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL to specify a constant byte[] default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant bool default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant DateTime default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant DateTimeOffset default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant Guid default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant string default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant TimeSpan default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify the data type of a column. + This method just generates the actual type, not the SQL to create the column. + + The definition of the column. + SQL representing the data type. + + + + Generates a quoted name. The supplied name may or may not contain the schema. + + The name to be quoted. + The quoted name. + + + + Quotes an identifier for SQL Server. + + The identifier to be quoted. + The quoted identifier. + + + + Adds a new Statement to be executed against the database. + + The statement to be executed. + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + Gets a new that can be used to build SQL. + + This is just a helper method to create a writer. Writing to the writer will + not cause SQL to be registered for execution. You must pass the generated + SQL to the Statement method. + + An empty text writer to use for SQL generation. + + + + Adds a new Statement to be executed against the database. + + The writer containing the SQL to be executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Utility class to prep the user's config file to run in an AppDomain + + + + + Updates a config file by adding binding redirects for EntityFramework.dll. + This ensures that the user's code can be ran in an AppDomain and the exact + same version of the assembly will be used for both domains. + + That path of the user's config file. Can also be null or a path to an non-existent file. + The path of the updated config file. It is the caller's responsibility to delete this. + + + + The same as but works in partial trust. + + + + + Specifies the default tab string. This field is constant. + + + + + Initializes a new instance of the IndentedTextWriter class using the specified text writer and default tab string. + + The to use for output. + + + + Initializes a new instance of the IndentedTextWriter class using the specified text writer and tab string. + + The to use for output. + The tab string to use for indentation. + + + + Closes the document being written to. + + + + + Flushes the stream. + + + + + Outputs the tab string once for each level of indentation according to the property. + + + + + Writes the specified string to the text stream. + + The string to write. + + + + Writes the text representation of a Boolean value to the text stream. + + The Boolean value to write. + + + + Writes a character to the text stream. + + The character to write. + + + + Writes a character array to the text stream. + + The character array to write. + + + + Writes a subarray of characters to the text stream. + + The character array to write data from. + Starting index in the buffer. + The number of characters to write. + + + + Writes the text representation of a Double to the text stream. + + The double to write. + + + + Writes the text representation of a Single to the text stream. + + The single to write. + + + + Writes the text representation of an integer to the text stream. + + The integer to write. + + + + Writes the text representation of an 8-byte integer to the text stream. + + The 8-byte integer to write. + + + + Writes the text representation of an object to the text stream. + + The object to write. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string. + The object to write into the formatted string. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string to use. + The first object to write into the formatted string. + The second object to write into the formatted string. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string to use. + The argument array to output. + + + + Writes the specified string to a line without tabs. + + The string to write. + + + + Writes the specified string, followed by a line terminator, to the text stream. + + The string to write. + + + + Writes a line terminator. + + + + + Writes the text representation of a Boolean, followed by a line terminator, to the text stream. + + The Boolean to write. + + + + Writes a character, followed by a line terminator, to the text stream. + + The character to write. + + + + Writes a character array, followed by a line terminator, to the text stream. + + The character array to write. + + + + Writes a subarray of characters, followed by a line terminator, to the text stream. + + The character array to write data from. + Starting index in the buffer. + The number of characters to write. + + + + Writes the text representation of a Double, followed by a line terminator, to the text stream. + + The double to write. + + + + Writes the text representation of a Single, followed by a line terminator, to the text stream. + + The single to write. + + + + Writes the text representation of an integer, followed by a line terminator, to the text stream. + + The integer to write. + + + + Writes the text representation of an 8-byte integer, followed by a line terminator, to the text stream. + + The 8-byte integer to write. + + + + Writes the text representation of an object, followed by a line terminator, to the text stream. + + The object to write. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string. + The object to write into the formatted string. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string to use. + The first object to write into the formatted string. + The second object to write into the formatted string. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string to use. + The argument array to output. + + + + Writes the text representation of a UInt32, followed by a line terminator, to the text stream. + + A UInt32 to output. + + + + Gets the encoding for the text writer to use. + + + An that indicates the encoding for the text writer to use. + + + + + Gets or sets the new line character to use. + + + The new line character to use. + + + + + Gets or sets the number of spaces to indent. + + + The number of spaces to indent. + + + + + Gets the to use. + + + The to use. + + + + + Used for generating values that are always in sequential + order for the calling thread. + + + + + Returns the value of unless this value would be the same as the + last value returned by this thread calling this method, in which case the thread pushes the value + a little bit into the future. The comparison is in terms of the form used to store migration ID + in the database--i.e. to the 1/10 second. + + + There should never be any pushing to the future involved for normal use of migrations, but when + this method is called in rapid succession while testing or otherwise calling the DbMigrator APIs + there may be occasional sleeping. + + + + + Same as UtcNow method bur returns the time in the timestamp format used in migration IDs. + + + + + Convention to apply column ordering specified via + or the API. This convention throws if a duplicate configured column order + is detected. + + + + + Convention to apply column ordering specified via + or the API. + + + + + Identifies conventions that can be removed from a instance. + + /// + Note that implementations of this interface must be immutable. + + + + + Strongly-typed and parameterized string resources. + + + + + A string like "Applying automatic migration: {0}." + + + + + A string like "Reverting automatic migration: {0}." + + + + + A string like "Applying code-based migration: {0}." + + + + + A string like "Reverting code-based migration: {0}." + + + + + A string like "Applying code-based migrations: [{1}]." + + + + + A string like "Reverting migrations: [{1}]." + + + + + A string like "Target database is already at version {0}." + + + + + A string like "Target database is: {0}." + + + + + A string like "'{1}' (DataSource: {0}, Provider: {2}, Origin: {3})" + + + + + A string like "The specified target migration '{0}' does not exist. Ensure that target migration refers to an existing migration id." + + + + + A string like "The Foreign Key on table '{0}' with columns '{1}' could not be created because the principal key columns could not be determined. Use the AddForeignKey fluent API to fully specify the Foreign Key." + + + + + A string like "'{0}' is not a valid target migration. When targeting a previously applied automatic migration, use the full migration id including timestamp." + + + + + A string like "'{0}' is not a valid migration. Code-based migrations must be used for both source and target when scripting the upgrade between them." + + + + + A string like "The target context '{0}' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory." + + + + + A string like "The specified migration name '{0}' is ambiguous. Specify the full migration id including timestamp instead." + + + + + A string like "The migrations configuration type '{0}' was not be found in the assembly '{1}'." + + + + + A string like "More than one migrations configuration type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the one to use." + + + + + A string like "No migrations configuration type was found in the assembly '{0}'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)." + + + + + A string like "More than one migrations configuration type was found in the assembly '{0}'. Specify the name of the one to use." + + + + + A string like "The type '{0}' is not a migrations configuration type." + + + + + A string like "The migrations configuration type '{0}' must have a public default constructor." + + + + + A string like "The migrations configuration type '{0}' must not be abstract." + + + + + A string like "The migrations configuration type '{0}' must not be generic." + + + + + A string like "In VB.NET projects, the migrations namespace '{0}' must be under the root namespace '{1}'. Update the migrations project's root namespace to allow classes under the migrations namespace to be added." + + + + + + A string like "No MigrationSqlGenerator found for provider '{0}'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators." + + + + + A string like "Could not load assembly '{0}'. (If you are using Code First Migrations inside Visual Studio this can happen if the startUp project for your solution does not reference the project that contains your migrations. You can either change the startUp project for your solution or use the -StartUpProjectName parameter.)" + + + + + A string like "No context type was found in the assembly '{0}'." + + + + + A string like "More than one context type was found in the assembly '{0}'." + + + + + A string like "To enable migrations for {0}, use Enable-Migrations -ContextTypeName {0}." + + + + + A string like "The context type '{0}' was not found in the assembly '{1}'." + + + + + A string like "More than one context type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the context." + + + + + A string like "The argument '{0}' cannot be null, empty or contain only white space." + + + + + A string like "The argument property '{0}' cannot be null." + + + + + A string like "The precondition '{0}' failed. {1}" + + + + + A string like "The type '{0}' has already been configured as a complex type. It cannot be reconfigured as an entity type." + + + + + A string like "The type '{0}' has already been configured as an entity type. It cannot be reconfigured as a complex type." + + + + + A string like "The key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + A string like "The foreign key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + A string like "The property '{0}' is not a declared property on type '{1}'. Verify that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property." + + + + + A string like "The navigation property '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property." + + + + + A string like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'." + + + + + A string like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. Use dotted paths for nested properties: C#: 't => t.MyProperty.MyProperty' VB.Net: 'Function(t) t.MyProperty.MyProperty'." + + + + + A string like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + A string like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + + A string like "Conflicting configuration settings were specified for property '{0}' on type '{1}': {2}" + + + + + A string like "Conflicting configuration settings were specified for column '{0}' on table '{1}': {2}" + + + + + A string like "{0} = {1} conflicts with {2} = {3}" + + + + + A string like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from ComplexObject." + + + + + A string like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject." + + + + + A string like "The navigation property '{0}' declared on type '{1}' cannot be the inverse of itself." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting foreign keys." + + + + + A string like "Values of incompatible types ('{1}' and '{2}') were assigned to the '{0}' discriminator column. Values of the same type must be specified. To explicitly specify the type of the discriminator column use the HasColumnType method." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting mapping information." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting cascade delete operations using 'WillCascadeOnDelete'." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting multiplicities." + + + + + A string like "The MaxLengthAttribute on property '{0}' on type '{1} is not valid. The Length value must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "The StringLengthAttribute on property '{0}' on type '{1}' is not valid. The maximum length must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "Unable to determine composite primary key ordering for type '{0}'. Use the ColumnAttribute or the HasKey method to specify an order for composite primary keys." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. Name must not be empty." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The foreign key name '{2}' was not found on the dependent type '{3}'. The Name value should be a comma separated list of foreign key property names." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The navigation property '{2}' was not found on the dependent type '{1}'. The Name value should be a valid navigation property name." + + + + + A string like "Unable to determine a composite foreign key ordering for foreign key on type {0}. When using the ForeignKey data annotation on composite foreign key properties ensure order is specified by using the Column data annotation or the fluent API." + + + + + A string like "The InversePropertyAttribute on property '{2}' on type '{3}' is not valid. The property '{0}' is not a valid navigation property on the related type '{1}'. Ensure that the property exists and is a valid reference or collection navigation property." + + + + + A string like "A relationship cannot be established from property '{0}' on type '{1}' to property '{0}' on type '{1}'. Check the values in the InversePropertyAttribute to ensure relationship definitions are unique and reference from one navigation property to its corresponding inverse navigation property." + + + + + A string like "\t{0}: {1}: {2}" + + + + + A string like "A key is registered for the derived type '{0}'. Keys can only be registered for the root type '{1}'." + + + + + A string like "The {0} value '{1}' already exists in the user-defined dictionary." + + + + + A string like "The type '{0}' has already been mapped to table '{1}'. Specify all mapping aspects of a table in a single Map call." + + + + + A string like "Map was called more than once for type '{0}' and at least one of the calls didn't specify the target table name." + + + + + A string like "The derived type '{0}' has already been mapped using the chaining syntax. A derived type can only be mapped once using the chaining syntax." + + + + + A string like "An "is not null" condition cannot be specified on property '{0}' on type '{1}' because this property is not included in the model. Check that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation." + + + + + A string like "Values of type '{0}' cannot be used as type discriminator values. Supported types include byte, signed byte, bool, int16, int32, int64, and string." + + + + + A string like "Unable to add the convention '{0}'. Could not find an existing convention of type '{1}' in the current convention set." + + + + + A string like "Not all properties for type '{0}' have been mapped. Either map those properties or explicitly excluded them from the model." + + + + + A string like "Unable to determine the provider name for connection of type '{0}'." + + + + + A string like "The qualified table name '{0}' contains an invalid schema name. Schema names must have a non-zero length." + + + + + A string like "The qualified table name '{0}' contains an invalid table name. Table names must have a non-zero length." + + + + + A string like "Properties for type '{0}' can only be mapped once. Ensure the MapInheritedProperties method is only used during one call to the Map method." + + + + + A string like "Properties for type '{0}' can only be mapped once. Ensure the Properties method is used and that repeated calls specify each non-key property only once." + + + + + A string like "Properties for type '{0}' can only be mapped once. The non-key property '{1}' is mapped more than once. Ensure the Properties method specifies each non-key property only once." + + + + + A string like "The property '{1}' on type '{0}' cannot be mapped because it has been explicitly excluded from the model or it is of a type not supported by the DbModelBuilderVersion being used." + + + + + A string like "The entity types '{0}' and '{1}' cannot share table '{2}' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them." + + + + + A string like "You cannot use Ignore method on the property '{0}' on type '{1}' because this type inherits from the type '{2}' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type." + + + + + A string like "The property '{0}' cannot be used as a key property on the entity '{1}' because the property type is not a valid key type. Only scalar types, string and byte[] are supported key types." + + + + + A string like "The specified table '{0}' was not found in the model. Ensure that the table name has been correctly specified." + + + + + A string like "The specified association foreign key columns '{0}' are invalid. The number of columns specified must match the number of primary key columns." + + + + + A string like "Unable to determine the principal end of an association between the types '{0}' and '{1}'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." + + + + + A string like "The abstract type '{0}' has no mapped descendents and so cannot be mapped. Either remove '{0}' from the model or add one or more types deriving from '{0}' to the model. " + + + + + A string like "The type '{0}' cannot be mapped as defined because it maps inherited properties from types that use entity splitting or another form of inheritance. Either choose a different inheritance mapping strategy so as to not map inherited properties, or change all types in the hierarchy to map inherited properties and to not use splitting. " + + + + + A string like "The table '{0}' was configured but is not used in any mappings. Verify the mapping configuration for '{0}' is correct." + + + + + A string like "The configured column orders for the table '{0}' contains duplicates. Ensure the specified column order values are distinct." + + + + + A string like "The enum or spatial property '{1}' on type '{0}' cannot be mapped. Use DbModelBuilderVersion 'V5_0' or later to map enum or spatial properties." + + + + + A string like "Multiple potential primary key properties named '{0}' but differing only by case were found on entity type '{1}'. Configure the primary key explicitly using the HasKey fluent API or the KeyAttribute data annotation." + + + + + A string like "Cannot get value for property '{0}' from entity of type '{1}' because the property has no get accessor." + + + + + A string like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor." + + + + + + A string like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor and is in the '{2}' state." + + + + + A string like "Member '{0}' cannot be called for property '{1}' on entity of type '{2}' because the property is not part of the Entity Data Model." + + + + + + A string like "Cannot call the {0} method for an entity of type '{1}' on a DbSet for entities of type '{2}'. Only entities of type '{2}' or derived from type '{2}' can be added, attached, or removed." + + + + + A string like "Cannot call the Create method for the type '{0}' on a DbSet for entities of type '{1}'. Only entities of type '{1}' or derived from type '{1}' can be created." + + + + + + + A string like "The property '{0}' on type '{1}' is a collection navigation property. The Collection method should be used instead of the Reference method." + + + + + A string like "The property '{0}' on type '{1}' is a reference navigation property. The Reference method should be used instead of the Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a navigation property. The Reference and Collection methods can only be used with navigation properties. Use the Property or ComplexProperty method." + + + + + A string like "The property '{0}' on type '{1}' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a complex property. The ComplexProperty method can only be used with complex properties. Use the Property, Reference or Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a primitive property, complex property, collection navigation property, or reference navigation property." + + + + + A string like ""The property '{0}' from the property path '{1}' is not a complex property on type '{2}'. Property paths must be composed of complex properties for all except the final property."" + + + + + A string like ""The property path '{0}' cannot be used for navigation properties. Property paths can only be used to access primitive or complex properties."" + + + + + A string like "The navigation property '{0}' on entity type '{1}' cannot be used for entities of type '{2}' because it refers to entities of type '{3}'." + + + + + A string like "The generic type argument '{0}' cannot be used with the Member method when accessing the collection navigation property '{1}' on entity type '{2}'. The generic type argument '{3}' must be used instead." + + + + + A string like "The property '{0}' on entity type '{1}' cannot be used for objects of type '{2}' because it is a property for objects of type '{3}'." + + + + + A string like "The expression passed to method {0} must represent a property defined on the type '{1}'." + + + + + A string like "{0} cannot be used for entities in the {1} state." + + + + + A string like "Cannot set non-nullable property '{0}' of type '{1}' to null on object of type '{2}'." + + + + + A string like "The property '{0}' in the entity of type '{1}' is null. Store values cannot be obtained for an entity with a null complex property." + + + + + A string like "Cannot assign value of type '{0}' to property '{1}' of type '{2}' in property values for type '{3}'." + + + + + A string like "The '{0}' property does not exist or is not mapped for the type '{1}'." + + + + + A string like "Cannot copy values from DbPropertyValues for type '{0}' into DbPropertyValues for type '{1}'." + + + + + A string like "Cannot copy from property values for object of type '{0}' into property values for object of type '{1}'." + + + + + A string like "The value of the complex property '{0}' on entity of type '{1}' is null. Complex properties cannot be set to null and values cannot be set for null complex properties." + + + + + A string like "The value of the nested property values property '{0}' on the values for entity of type '{1}' is null. Nested property values cannot be set to null and values cannot be set for null complex properties." + + + + + A string like "Cannot set the value of the nested property '{0}' because value of the complex property '{1}' to which it belongs is null." + + + + + A string like "Cannot set the original value of the nested property '{0}' because the original value of the complex property '{1}' to which it belongs is null." + + + + + A string like "The model backing the '{0}' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)." + + + + + A string like "Database '{0}' cannot be created because it already exists." + + + + + + + A string like "Failed to set database initializer of type '{0}' for DbContext type '{1}' specified in the application configuration. See inner exception for details." + + + + + A string like "Configuration for DbContext type '{0}' is specified multiple times in the application configuration. Each context can only be configured once." + + + + + A string like "Failed to set Database.DefaultConnectionFactory to an instance of the '{0}' type as specified in the application configuration. See inner exception for details." + + + + + A string like "The type '{0}' could not be found. The type name must be an assembly-qualified name." + + + + + A string like "The connection string '{0}' in the application's configuration file does not contain the required providerName attribute."" + + + + + A string like "The entity found was of type {0} when an entity of type {1} was requested." + + + + + A string like "The type '{0}' is mapped as a complex type. The Set method, DbSet objects, and DbEntityEntry objects can only be used with entity types, not complex types." + + + + + A string like "The type '{0}' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute." + + + + + A string like "The entity type {0} is not part of the model for the current context." + + + + + A string like "No connection string named '{0}' could be found in the application config file." + + + + + A string like "The collection navigation property '{0}' on the entity of type '{1}' cannot be set because the entity type does not define a navigation property with a set accessor." + + + + + A string like "Multiple object sets per type are not supported. The object sets '{0}' and '{1}' can both contain instances of type '{2}'." + + + + + A string like "The context type '{0}' must have a public constructor taking an EntityConnection." + + + + + A string like "An unexpected exception was thrown during validation of '{0}' when invoking {1}.IsValid. See the inner exception for details." + + + + + A string like "An unexpected exception was thrown during validation of '{0}' when invoking {1}.Validate. See the inner exception for details." + + + + + A string like "The database name '{0}' is not supported because it is an MDF file name. A full connection string must be provided to attach an MDF file." + + + + + A string like "The context factory type '{0}' must have a public default constructor." + + + + + A string like "The '{0}' property of EdmPrimitiveType is fixed and cannot be set." + + + + + A string like "The namespace '{0}' is a system namespace and cannot be used by other schemas. Choose another namespace name." + + + + + A string like "Role '{0}' in AssociationSets '{1}' and '{2}' refers to the same EntitySet '{3}' in EntityContainer '{4}'. Make sure that if two or more AssociationSets refer to the same AssociationType, the ends do not refer to the same EntitySet." + + + + + A string like "The referenced EntitySet '{0}' for End '{1}' could not be found in the containing EntityContainer." + + + + + A string like "Type '{0}' is derived from type '{1}' that is the type for EntitySet '{2}'. Type '{0}' defines new concurrency requirements that are not allowed for subtypes of base EntitySet types." + + + + + A string like "EntitySet '{0}' is based on type '{1}' that has no keys defined." + + + + + A string like "The end name '{0}' is already defined." + + + + + A string like "The key specified in EntityType '{0}' is not valid. Property '{1}' is referenced more than once in the Key element." + + + + + A string like "Property '{0}' has a CollectionKind specified but is not a collection property." + + + + + A string like "Property '{0}' has a CollectionKind specified. CollectionKind is only supported in version 1.1 EDM models." + + + + + A string like "ComplexType '{0}' is marked as abstract. Abstract ComplexTypes are only supported in version 1.1 EDM models." + + + + + A string like "ComplexType '{0}' has a BaseType specified. ComplexType inheritance is only supported in version 1.1 EDM models." + + + + + A string like "Key part '{0}' for type '{1}' is not valid. All parts of the key must be non-nullable." + + + + + A string like "The property '{0}' in EntityType '{1}' is not valid. All properties that are part of the EntityKey must be of PrimitiveType." + + + + + A string like "Key usage is not valid. The {0} class cannot define keys because one of its base classes ('{1}') defines keys." + + + + + A string like "EntityType '{0}' has no key defined. Define the key for this EntityType." + + + + + A string like "NavigationProperty is not valid. Role '{0}' or Role '{1}' is not defined in Relationship '{2}'." + + + + + A string like "End '{0}' on relationship '{1}' cannot have an operation specified because its multiplicity is '*'. Operations cannot be specified on ends with multiplicity '*'." + + + + + A string like "Each Name and PluralName in a relationship must be unique. '{0}' is already defined." + + + + + A string like "In relationship '{0}', the Principal and Dependent Role of the referential constraint refer to the same Role in the relationship type." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Valid values for multiplicity for the Principal Role are '0..1' or '1'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because all the properties in the Dependent Role are nullable, multiplicity of the Principal Role must be '0..1'." + + + + + A string like "Multiplicity conflicts with the referential constraint in Role '{0}' in relationship '{1}'. Because at least one of the properties in the Dependent Role is non-nullable, multiplicity of the Principal Role must be '1'." + + + + + A string like "Multiplicity conflicts with the referential constraint in Role '{0}' in relationship '{1}'. Because all of the properties in the Dependent Role are non-nullable, multiplicity of the Principal Role must be '1'." + + + + + A string like "Properties referred by the Dependent Role '{0}' must be a subset of the key of the EntityType '{1}' referred to by the Dependent Role in the referential constraint for relationship '{2}'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because the Dependent Role refers to the key properties, the upper bound of the multiplicity of the Dependent Role must be '1'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because the Dependent Role properties are not the key properties, the upper bound of the multiplicity of the Dependent Role must be '*'." + + + + + A string like "The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property '{0}' on entity '{1}' does not match the type of property '{2}' on entity '{3}' in the referential constraint '{4}'." + + + + + A string like "There is no property with name '{0}' defined in the type referred to by Role '{1}'." + + + + + A string like "A nullable ComplexType is not supported. Property '{0}' must not allow nulls." + + + + + A string like "A property cannot be of type '{0}'. The property type must be a ComplexType or a PrimitiveType." + + + + + A string like "Each member name in an EntityContainer must be unique. A member with name '{0}' is already defined." + + + + + A string like "Each type name in a schema must be unique. Type name '{0}' is already defined." + + + + + A string like "Name '{0}' cannot be used in type '{1}'. Member names cannot be the same as their enclosing type." + + + + + A string like "Each property name in a type must be unique. Property name '{0}' is already defined." + + + + + A string like "A cycle was detected in the type hierarchy of '{0}'." + + + + + A string like "A property cannot be of type '{0}'. The property type must be a ComplexType, a PrimitiveType, or a CollectionType." + + + + + A string like "A property cannot be of type {0}. The property type must be a ComplexType, a PrimitiveType or an EnumType." + + + + + A string like "The specified name must not be longer than 480 characters: '{0}'." + + + + + A string like "The specified name is not allowed: '{0}'." + + + + + A string like "The field {0} must be a string or array type with a maximum length of '{1}'." + + + + + A string like "The field {0} must be a string or array type with a minimum length of '{1}'." + + + + + A string like "No connection string named '{0}' could be found in the application config file." + + + + + A string like "AutomaticMigration" + + + + + A string like "BootstrapMigration" + + + + + A string like "InitialCreate" + + + + + A string like "Automatic migration was not applied because it would result in data loss." + + + + + A string like "[Inserting migration history record]" + + + + + A string like "[Deleting migration history record]" + + + + + A string like "[Updating EdmMetadata model hash]" + + + + + A string like "Running Seed method." + + + + + A string like "No pending code-based migrations." + + + + + A string like "Explicit" + + + + + A string like "Upgrading history table." + + + + + A string like "Cannot scaffold the next migration because the target database was created with a version of Code First earlier than EF 4.3 and does not contain the migrations history table. To start using migrations against this database, ensure the current model is compatible with the target database and execute the migrations Update process. (In Visual Studio you can use the Update-Database command from Package Manager Console to execute the migrations Update process)." + + + + + A string like "Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration." + + + + + A string like "Scripting the downgrade between two specified migrations is not supported." + + + + + A string like "Direct column renaming is not supported by SQL Server Compact. To rename a column in SQL Server Compact, you will need to recreate it." + + + + + A string like "One or more validation errors were detected during model generation:" + + + + + A string like "A circular ComplexType hierarchy was detected. Self-referencing ComplexTypes are not supported." + + + + + A string like "Connection to the database failed. The connection string is configured with an invalid LocalDB server name. This may have been set in 'global.asax' by a pre-release version of MVC4. The default connection factory is now set in web.config so the line in 'global.asax' starting with 'Database.DefaultConnectionFactory = ' should be removed. See http://go.microsoft.com/fwlink/?LinkId=243166 for details." + + + + + A string like "An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct." + + + + + A string like "Setting IsModified to false for a modified property is not supported." + + + + + A string like "An error occurred while saving entities that do not expose foreign key properties for their relationships. The EntityEntries property will return null because a single entity cannot be identified as the source of the exception. Handling of exceptions while saving can be made easier by exposing foreign key properties in your entity types. See the InnerException for details." + + + + + A string like "The set of property value names is read-only." + + + + + A string like "A property of a complex type must be set to an instance of the generic or non-generic DbPropertyValues class for that type." + + + + + A string like "Model compatibility cannot be checked because the DbContext instance was not created using Code First patterns. DbContext instances created from an ObjectContext or using an EDMX file cannot be checked for compatibility." + + + + + A string like "Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions." + + + + + A string like "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations." + + + + + A string like "The context cannot be used while the model is being created." + + + + + A string like "The DbContext class cannot be used with models that have multiple entity sets per type (MEST)." + + + + + A string like "The operation cannot be completed because the DbContext has been disposed." + + + + + A string like "The provider factory returned a null connection." + + + + + A string like "The DbConnectionFactory instance returned a null connection." + + + + + A string like "The number of primary key values passed must match number of primary key values defined on the entity." + + + + + A string like "The type of one of the primary key values did not match the type defined in the entity. See inner exception for details." + + + + + A string like "Multiple entities were found in the Added state that match the given primary key values." + + + + + A string like "Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList()." + + + + + A string like "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties." + + + + + A string like "Cannot initialize a DbContext from an entity connection string or an EntityConnection instance together with a DbCompiledModel. If an entity connection string or EntityConnection instance is used, then the model will be created from the metadata in the connection. If a DbCompiledModel is used, then the connection supplied should be a standard database connection (for example, a SqlConnection instance) rather than an entity connection." + + + + + A string like "Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used." + + + + + A string like "Validation failed for one or more entities. See 'EntityValidationErrors' property for more details." + + + + + A string like "An exception occurred while initializing the database. See the InnerException for details." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing ObjectContext is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing DbCompiledModel is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Code generated using the T4 templates for Database First and Model First development may not work correctly if used in Code First mode. To continue using Database First or Model First ensure that the Entity Framework connection string is specified in the config file of executing application. To use these classes, that were generated from Database First or Model First, with Code First add any additional configuration using attributes or the DbModelBuilder API and then remove the code that throws this exception." + + + + + A string like "The generic 'Set' method cannot be called with a proxy type. Either use the actual entity type or call the non-generic 'Set' method." + + + + + A string like "NavigationProperty is not valid. The FromRole and ToRole are the same." + + + + + A string like "OnDelete can be specified on only one End of an EdmAssociation." + + + + + A string like "The number of properties in the Dependent and Principal Roles in a relationship constraint must be identical." + + + + + A string like "The name is missing or not valid." + + + + + A string like "AssociationEnd must not be null." + + + + + A string like "DependentEnd must not be null." + + + + + A string like "DependentProperties must not be empty." + + + + + A string like "Association must not be null." + + + + + A string like "ResultEnd must not be null." + + + + + A string like "EntityType must not be null." + + + + + A string like "ElementType must not be null." + + + + + A string like "ElementType must not be null." + + + + + A string like "SourceSet must not be null." + + + + + A string like "TargetSet must not be null." + + + + + A string like "The type is not a valid EdmTypeReference." + + + + + A string like "Serializer can only serialize an EdmModel that has one EdmNamespace and one EdmEntityContainer." + + + + + A string like "MaxLengthAttribute must have a Length value that is greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "MinLengthAttribute must have a Length value that is zero or greater." + + + + + A string like "The connection can not be overridden because this context was created from an existing ObjectContext." + + + + + A string like "Can not override the connection for this context with a standard DbConnection because the original connection was an EntityConnection." + + + + + A string like "Can not override the connection for this context with an EntityConnection because the original connection was a standard DbConnection." + + + + + Strongly-typed and parameterized exception factory. + + + + + Migrations.Infrastructure.AutomaticDataLossException with message like "Automatic migration was not applied because it would result in data loss." + + + + + Migrations.Infrastructure.MigrationsException with message like "Cannot scaffold the next migration because the target database was created with a version of Code First earlier than EF 4.3 and does not contain the migrations history table. To start using migrations against this database, ensure the current model is compatible with the target database and execute the migrations Update process. (In Visual Studio you can use the Update-Database command from Package Manager Console to execute the migrations Update process)." + + + + + Migrations.Infrastructure.MigrationsException with message like "The specified target migration '{0}' does not exist. Ensure that target migration refers to an existing migration id." + + + + + Migrations.Infrastructure.MigrationsException with message like "The Foreign Key on table '{0}' with columns '{1}' could not be created because the principal key columns could not be determined. Use the AddForeignKey fluent API to fully specify the Foreign Key." + + + + + Migrations.Infrastructure.MigrationsException with message like "'{0}' is not a valid target migration. When targeting a previously applied automatic migration, use the full migration id including timestamp." + + + + + Migrations.Infrastructure.MigrationsException with message like "'{0}' is not a valid migration. Code-based migrations must be used for both source and target when scripting the upgrade between them." + + + + + Migrations.Infrastructure.MigrationsException with message like "The target context '{0}' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory." + + + + + Migrations.Infrastructure.MigrationsException with message like "The specified migration name '{0}' is ambiguous. Specify the full migration id including timestamp instead." + + + + + Migrations.Infrastructure.AutomaticMigrationsDisabledException with message like "Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration." + + + + + Migrations.Infrastructure.MigrationsException with message like "Scripting the downgrade between two specified migrations is not supported." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' was not be found in the assembly '{1}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one migrations configuration type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the one to use." + + + + + Migrations.Infrastructure.MigrationsException with message like "No migrations configuration type was found in the assembly '{0}'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one migrations configuration type was found in the assembly '{0}'. Specify the name of the one to use." + + + + + Migrations.Infrastructure.MigrationsException with message like "The type '{0}' is not a migrations configuration type." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must have a public default constructor." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must not be abstract." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must not be generic." + + + + + Migrations.Infrastructure.MigrationsException with message like "Direct column renaming is not supported by SQL Server Compact. To rename a column in SQL Server Compact, you will need to recreate it." + + + + + Migrations.Infrastructure.MigrationsException with message like "In VB.NET projects, the migrations namespace '{0}' must be under the root namespace '{1}'. Update the migrations project's root namespace to allow classes under the migrations namespace to be added." + + + + + + Migrations.Infrastructure.MigrationsException with message like "No MigrationSqlGenerator found for provider '{0}'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators." + + + + + Migrations.Infrastructure.MigrationsException with message like "No context type was found in the assembly '{0}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "The context type '{0}' was not found in the assembly '{1}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one context type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the context." + + + + + ArgumentException with message like "The argument '{0}' cannot be null, empty or contain only white space." + + + + + ArgumentException with message like "The argument property '{0}' cannot be null." + + + + + ArgumentException with message like "The precondition '{0}' failed. {1}" + + + + + InvalidOperationException with message like "The type '{0}' has already been configured as a complex type. It cannot be reconfigured as an entity type." + + + + + InvalidOperationException with message like "The type '{0}' has already been configured as an entity type. It cannot be reconfigured as a complex type." + + + + + InvalidOperationException with message like "The key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + InvalidOperationException with message like "The foreign key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + InvalidOperationException with message like "The property '{0}' is not a declared property on type '{1}'. Verify that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property." + + + + + InvalidOperationException with message like "The navigation property '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property." + + + + + InvalidOperationException with message like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'." + + + + + InvalidOperationException with message like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. Use dotted paths for nested properties: C#: 't => t.MyProperty.MyProperty' VB.Net: 'Function(t) t.MyProperty.MyProperty'." + + + + + InvalidOperationException with message like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + InvalidOperationException with message like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + + InvalidOperationException with message like "Conflicting configuration settings were specified for property '{0}' on type '{1}': {2}" + + + + + InvalidOperationException with message like "Conflicting configuration settings were specified for column '{0}' on table '{1}': {2}" + + + + + InvalidOperationException with message like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from ComplexObject." + + + + + InvalidOperationException with message like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' cannot be the inverse of itself." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting foreign keys." + + + + + MappingException with message like "Values of incompatible types ('{1}' and '{2}') were assigned to the '{0}' discriminator column. Values of the same type must be specified. To explicitly specify the type of the discriminator column use the HasColumnType method." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting mapping information." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting cascade delete operations using 'WillCascadeOnDelete'." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting multiplicities." + + + + + InvalidOperationException with message like "The MaxLengthAttribute on property '{0}' on type '{1} is not valid. The Length value must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "The StringLengthAttribute on property '{0}' on type '{1}' is not valid. The maximum length must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "Unable to determine composite primary key ordering for type '{0}'. Use the ColumnAttribute or the HasKey method to specify an order for composite primary keys." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. Name must not be empty." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The foreign key name '{2}' was not found on the dependent type '{3}'. The Name value should be a comma separated list of foreign key property names." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The navigation property '{2}' was not found on the dependent type '{1}'. The Name value should be a valid navigation property name." + + + + + InvalidOperationException with message like "Unable to determine a composite foreign key ordering for foreign key on type {0}. When using the ForeignKey data annotation on composite foreign key properties ensure order is specified by using the Column data annotation or the fluent API." + + + + + InvalidOperationException with message like "The InversePropertyAttribute on property '{2}' on type '{3}' is not valid. The property '{0}' is not a valid navigation property on the related type '{1}'. Ensure that the property exists and is a valid reference or collection navigation property." + + + + + InvalidOperationException with message like "A relationship cannot be established from property '{0}' on type '{1}' to property '{0}' on type '{1}'. Check the values in the InversePropertyAttribute to ensure relationship definitions are unique and reference from one navigation property to its corresponding inverse navigation property." + + + + + InvalidOperationException with message like "A key is registered for the derived type '{0}'. Keys can only be registered for the root type '{1}'." + + + + + InvalidOperationException with message like "The type '{0}' has already been mapped to table '{1}'. Specify all mapping aspects of a table in a single Map call." + + + + + InvalidOperationException with message like "Map was called more than once for type '{0}' and at least one of the calls didn't specify the target table name." + + + + + InvalidOperationException with message like "The derived type '{0}' has already been mapped using the chaining syntax. A derived type can only be mapped once using the chaining syntax." + + + + + InvalidOperationException with message like "An "is not null" condition cannot be specified on property '{0}' on type '{1}' because this property is not included in the model. Check that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation." + + + + + ArgumentException with message like "Values of type '{0}' cannot be used as type discriminator values. Supported types include byte, signed byte, bool, int16, int32, int64, and string." + + + + + InvalidOperationException with message like "Unable to add the convention '{0}'. Could not find an existing convention of type '{1}' in the current convention set." + + + + + InvalidOperationException with message like "Not all properties for type '{0}' have been mapped. Either map those properties or explicitly excluded them from the model." + + + + + NotSupportedException with message like "Unable to determine the provider name for connection of type '{0}'." + + + + + ArgumentException with message like "The qualified table name '{0}' contains an invalid schema name. Schema names must have a non-zero length." + + + + + ArgumentException with message like "The qualified table name '{0}' contains an invalid table name. Table names must have a non-zero length." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. Ensure the MapInheritedProperties method is only used during one call to the Map method." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. Ensure the Properties method is used and that repeated calls specify each non-key property only once." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. The non-key property '{1}' is mapped more than once. Ensure the Properties method specifies each non-key property only once." + + + + + InvalidOperationException with message like "The property '{1}' on type '{0}' cannot be mapped because it has been explicitly excluded from the model or it is of a type not supported by the DbModelBuilderVersion being used." + + + + + InvalidOperationException with message like "The entity types '{0}' and '{1}' cannot share table '{2}' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them." + + + + + InvalidOperationException with message like "You cannot use Ignore method on the property '{0}' on type '{1}' because this type inherits from the type '{2}' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type." + + + + + InvalidOperationException with message like "The property '{0}' cannot be used as a key property on the entity '{1}' because the property type is not a valid key type. Only scalar types, string and byte[] are supported key types." + + + + + InvalidOperationException with message like "The specified table '{0}' was not found in the model. Ensure that the table name has been correctly specified." + + + + + InvalidOperationException with message like "The specified association foreign key columns '{0}' are invalid. The number of columns specified must match the number of primary key columns." + + + + + InvalidOperationException with message like "A circular ComplexType hierarchy was detected. Self-referencing ComplexTypes are not supported." + + + + + InvalidOperationException with message like "Unable to determine the principal end of an association between the types '{0}' and '{1}'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." + + + + + InvalidOperationException with message like "The abstract type '{0}' has no mapped descendents and so cannot be mapped. Either remove '{0}' from the model or add one or more types deriving from '{0}' to the model. " + + + + + NotSupportedException with message like "The type '{0}' cannot be mapped as defined because it maps inherited properties from types that use entity splitting or another form of inheritance. Either choose a different inheritance mapping strategy so as to not map inherited properties, or change all types in the hierarchy to map inherited properties and to not use splitting. " + + + + + InvalidOperationException with message like "The table '{0}' was configured but is not used in any mappings. Verify the mapping configuration for '{0}' is correct." + + + + + InvalidOperationException with message like "The configured column orders for the table '{0}' contains duplicates. Ensure the specified column order values are distinct." + + + + + NotSupportedException with message like "The enum or spatial property '{1}' on type '{0}' cannot be mapped. Use DbModelBuilderVersion 'V5_0' or later to map enum or spatial properties." + + + + + InvalidOperationException with message like "Multiple potential primary key properties named '{0}' but differing only by case were found on entity type '{1}'. Configure the primary key explicitly using the HasKey fluent API or the KeyAttribute data annotation." + + + + + InvalidOperationException with message like "Cannot get value for property '{0}' from entity of type '{1}' because the property has no get accessor." + + + + + InvalidOperationException with message like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor." + + + + + + NotSupportedException with message like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor and is in the '{2}' state." + + + + + InvalidOperationException with message like "Member '{0}' cannot be called for property '{1}' on entity of type '{2}' because the property is not part of the Entity Data Model." + + + + + + ArgumentException with message like "Cannot call the {0} method for an entity of type '{1}' on a DbSet for entities of type '{2}'. Only entities of type '{2}' or derived from type '{2}' can be added, attached, or removed." + + + + + ArgumentException with message like "Cannot call the Create method for the type '{0}' on a DbSet for entities of type '{1}'. Only entities of type '{1}' or derived from type '{1}' can be created." + + + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is a collection navigation property. The Collection method should be used instead of the Reference method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is a reference navigation property. The Reference method should be used instead of the Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a navigation property. The Reference and Collection methods can only be used with navigation properties. Use the Property or ComplexProperty method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a complex property. The ComplexProperty method can only be used with complex properties. Use the Property, Reference or Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a primitive property, complex property, collection navigation property, or reference navigation property." + + + + + ArgumentException with message like ""The property '{0}' from the property path '{1}' is not a complex property on type '{2}'. Property paths must be composed of complex properties for all except the final property."" + + + + + NotSupportedException with message like "Setting IsModified to false for a modified property is not supported." + + + + + ArgumentException with message like ""The property path '{0}' cannot be used for navigation properties. Property paths can only be used to access primitive or complex properties."" + + + + + ArgumentException with message like "The navigation property '{0}' on entity type '{1}' cannot be used for entities of type '{2}' because it refers to entities of type '{3}'." + + + + + ArgumentException with message like "The generic type argument '{0}' cannot be used with the Member method when accessing the collection navigation property '{1}' on entity type '{2}'. The generic type argument '{3}' must be used instead." + + + + + ArgumentException with message like "The property '{0}' on entity type '{1}' cannot be used for objects of type '{2}' because it is a property for objects of type '{3}'." + + + + + ArgumentException with message like "The expression passed to method {0} must represent a property defined on the type '{1}'." + + + + + InvalidOperationException with message like "{0} cannot be used for entities in the {1} state." + + + + + InvalidOperationException with message like "Cannot set non-nullable property '{0}' of type '{1}' to null on object of type '{2}'." + + + + + InvalidOperationException with message like "The property '{0}' in the entity of type '{1}' is null. Store values cannot be obtained for an entity with a null complex property." + + + + + InvalidOperationException with message like "Cannot assign value of type '{0}' to property '{1}' of type '{2}' in property values for type '{3}'." + + + + + NotSupportedException with message like "The set of property value names is read-only." + + + + + ArgumentException with message like "The '{0}' property does not exist or is not mapped for the type '{1}'." + + + + + ArgumentException with message like "Cannot copy values from DbPropertyValues for type '{0}' into DbPropertyValues for type '{1}'." + + + + + ArgumentException with message like "Cannot copy from property values for object of type '{0}' into property values for object of type '{1}'." + + + + + ArgumentException with message like "A property of a complex type must be set to an instance of the generic or non-generic DbPropertyValues class for that type." + + + + + InvalidOperationException with message like "The value of the complex property '{0}' on entity of type '{1}' is null. Complex properties cannot be set to null and values cannot be set for null complex properties." + + + + + InvalidOperationException with message like "The value of the nested property values property '{0}' on the values for entity of type '{1}' is null. Nested property values cannot be set to null and values cannot be set for null complex properties." + + + + + InvalidOperationException with message like "Cannot set the value of the nested property '{0}' because value of the complex property '{1}' to which it belongs is null." + + + + + InvalidOperationException with message like "Cannot set the original value of the nested property '{0}' because the original value of the complex property '{1}' to which it belongs is null." + + + + + InvalidOperationException with message like "The model backing the '{0}' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)." + + + + + InvalidOperationException with message like "Database '{0}' cannot be created because it already exists." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the DbContext instance was not created using Code First patterns. DbContext instances created from an ObjectContext or using an EDMX file cannot be checked for compatibility." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations." + + + + + + + InvalidOperationException with message like "Failed to set database initializer of type '{0}' for DbContext type '{1}' specified in the application configuration. See inner exception for details." + + + + + InvalidOperationException with message like "Configuration for DbContext type '{0}' is specified multiple times in the application configuration. Each context can only be configured once." + + + + + InvalidOperationException with message like "Failed to set Database.DefaultConnectionFactory to an instance of the '{0}' type as specified in the application configuration. See inner exception for details." + + + + + InvalidOperationException with message like "The type '{0}' could not be found. The type name must be an assembly-qualified name." + + + + + InvalidOperationException with message like "The context cannot be used while the model is being created." + + + + + InvalidOperationException with message like "The DbContext class cannot be used with models that have multiple entity sets per type (MEST)." + + + + + InvalidOperationException with message like "The operation cannot be completed because the DbContext has been disposed." + + + + + InvalidOperationException with message like "The provider factory returned a null connection." + + + + + InvalidOperationException with message like "The connection string '{0}' in the application's configuration file does not contain the required providerName attribute."" + + + + + InvalidOperationException with message like "The DbConnectionFactory instance returned a null connection." + + + + + ArgumentException with message like "The number of primary key values passed must match number of primary key values defined on the entity." + + + + + ArgumentException with message like "The type of one of the primary key values did not match the type defined in the entity. See inner exception for details." + + + + + InvalidOperationException with message like "The entity found was of type {0} when an entity of type {1} was requested." + + + + + InvalidOperationException with message like "Multiple entities were found in the Added state that match the given primary key values." + + + + + InvalidOperationException with message like "The type '{0}' is mapped as a complex type. The Set method, DbSet objects, and DbEntityEntry objects can only be used with entity types, not complex types." + + + + + InvalidOperationException with message like "The type '{0}' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute." + + + + + InvalidOperationException with message like "The entity type {0} is not part of the model for the current context." + + + + + NotSupportedException with message like "Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList()." + + + + + ArgumentException with message like "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties." + + + + + InvalidOperationException with message like "No connection string named '{0}' could be found in the application config file." + + + + + InvalidOperationException with message like "Cannot initialize a DbContext from an entity connection string or an EntityConnection instance together with a DbCompiledModel. If an entity connection string or EntityConnection instance is used, then the model will be created from the metadata in the connection. If a DbCompiledModel is used, then the connection supplied should be a standard database connection (for example, a SqlConnection instance) rather than an entity connection." + + + + + NotSupportedException with message like "The collection navigation property '{0}' on the entity of type '{1}' cannot be set because the entity type does not define a navigation property with a set accessor." + + + + + NotSupportedException with message like "Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used." + + + + + InvalidOperationException with message like "Multiple object sets per type are not supported. The object sets '{0}' and '{1}' can both contain instances of type '{2}'." + + + + + InvalidOperationException with message like "The context type '{0}' must have a public constructor taking an EntityConnection." + + + + + NotSupportedException with message like "The database name '{0}' is not supported because it is an MDF file name. A full connection string must be provided to attach an MDF file." + + + + + DataException with message like "An exception occurred while initializing the database. See the InnerException for details." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing ObjectContext is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing DbCompiledModel is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + InvalidOperationException with message like "The context factory type '{0}' must have a public default constructor." + + + + + InvalidOperationException with message like "The generic 'Set' method cannot be called with a proxy type. Either use the actual entity type or call the non-generic 'Set' method." + + + + + InvalidOperationException with message like "MaxLengthAttribute must have a Length value that is greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "MinLengthAttribute must have a Length value that is zero or greater." + + + + + InvalidOperationException with message like "No connection string named '{0}' could be found in the application config file." + + + + + InvalidOperationException with message like "The connection can not be overridden because this context was created from an existing ObjectContext." + + + + + InvalidOperationException with message like "Can not override the connection for this context with a standard DbConnection because the original connection was an EntityConnection." + + + + + InvalidOperationException with message like "Can not override the connection for this context with an EntityConnection because the original connection was a standard DbConnection." + + + + + The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument. + + + + + The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method. + + + + + The exception that is thrown when the author has yet to implement the logic at this point in the program. This can act as an exception based TODO tag. + + + + + The exception that is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or write to a stream that does not support the invoked functionality. + + + + + AutoGenerated resource class. Usage: + + string s = EntityRes.GetString(EntityRes.MyIdenfitier); + + + + + Allows the construction and modification of a user-specified annotation (name-value pair) on a instance. + + + + + Gets or sets an optional namespace that can be used to distinguish the annotation from others with the same value. + + + + + Gets or sets the name of the annotation. + + + + + Gets or sets the value of the annotation. + + + + + + + + + DataModelEventArgs is the base argument type for all events raised by consumers of Entity Data Model (EDM) models. + + + + + Gets a value indicating the that caused the event to be raised. + + + + + Gets an optional value indicating which property of the source item caused the event to be raised. + + + + + Gets a value that identifies the specific error that is being raised. + + + + + Gets an optional descriptive message the describes the error that is being raised. + + + + + DbAliasedMetadataItem provides the base type for all Database Metadata types that can have an optional that should be used instead of the item's when referring to the item in the database. + + + + + NamedDbItem is the base for all types in the Database Metadata construction and modification API with a property. + + + + + The base for all all Database Metadata types that support annotation using . + + + + + DbDataModelItem is the base for all types in the Database Metadata construction and modification API. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets or sets the currently assigned name. + + + + + Gets an optional alternative identifier that should be used when referring to this item in the database. + + + + + When implemented in derived types, allows the construction and modification of a column in a Database Metadata table or row. + + + + + Gets or sets a string indicating the database-specific type of the column. + + + + + Gets or sets a value indicating whether the column is nullable. + + + + + Gets or sets an optional instance that applies additional constraints to the referenced database-specific type of the column. + + + + + Allows the construction and modification of a database in a Database Metadata model. + + + + + Gets or sets an optional value that indicates the database model version. + + + + + Gets or sets the collection of instances that specifies the schemas within the database. + + + + + Allows the construction and modification of a foreign key constraint sourced by a instance. + + + + + Gets or sets the to take when a delete operation is attempted. + + + + + Indicates which Database Metadata concept is represented by a given item. + + + + + Database Kind + + + + + Schema Kind + + + + + Foreign Key Constraint Kind + + + + + Function Kind + + + + + Function Parameter Kind + + + + + Function Return or Parameter Type Kind + + + + + Row Column Kind + + + + + Table Kind + + + + + Table Column Kind + + + + + Primitive Facets Kind + + + + + Specifies the action to take on a given operation. + + + + + Default behavior + + + + + Restrict the operation + + + + + Cascade the operation + + + + + Allows the construction and modification of additional constraints that can be applied to a specific use of a primitive type in a Database Metadata item. + + + + + Returns true if any facet value property currently has a non-null value; otherwise returns false . + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have a fixed or variable length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have its intrinsic maximum length, rather than a specific value. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to be Unicode or non-Unicode. + + + + + Gets or sets an optional value indicating the current constraint on the type's maximum length. + + + + + Gets or sets an optional value indicating the current constraint on the type's precision. + + + + + Gets or sets an optional value indicating the current constraint on the type's scale. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating whether the spatial type is to be type checked strictly. + + + + + Allows the construction and modification of a database schema in a database model. + + + + + Gets or sets the collection of instances that specifies the tables declared within the schema. + + + + + DbSchemaMetadataItem is the base for all types that can be contained in a schema. + + + + + Allows the construction and modification of a column in a table. + + + + + Gets or sets a value indicating whether the column is part of the table's primary key. + + + + + Gets or sets a value indicating if and how the value of the column is automatically generated. + + + + + Gets or sets an optional value indicating the collation specific to this table column. + + + + + Gets or sets an optional value that specifies the default value for the column. + + + + + Allows the construction and modification a table in a database schema. + + + + + Gets or sets the collection of instances that specifies the columns present within the table. + + + + + Gets or sets the collection of instances from the collection of the table that are part of the primary key. + + + + + Gets or sets the collection of instances that defines the foreign key constraints sourced from the table. + + + + + Represents a specific use of a type in a Database Metadata item. + + + + + Gets or sets an optional instance that applies additional constraints to a referenced primitive type. + + + Accessing this property forces the creation of a DbPrimitiveTypeFacets value if no value has previously been set. Use to determine whether or not this property currently has a value. + + + + + Gets or sets a value indicating whether the represented type is a collection type. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered nullable. + + + + + Gets a value indicating whether the type has been configured as a row type by the addition of one or more RowColumns. + + + + + Represents the mapping of an EDM association end ( ) as a collection of property mappings ( ). + + + + + DbMappingMetadataItem is the base for all types in the EDM-to-Database Mapping construction and modification API that support annotation using . + + + + + DbMappingModelItem is the base for all types in the EDM-to-Database Mapping construction and modification API. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets an value representing the association end that is being mapped. + + + + + Gets the collection of s that specifies how the association end key properties are mapped to the table. + + + + + Gets an value representing the association set that is being mapped. + + + + + Gets a value representing the table to which the entity type's properties are being mapped. + + + + + Gets the collection of s that specifies the constant or null values that columns in must have for this type mapping to apply. + + + + + Allows the construction and modification of a condition for a column in a database table. + + + + + Gets or sets a value representing the table column which must contain for this condition to hold. + + + + + Gets or sets the value that must contain for this condition to hold. + + + + + Gets or sets an value representing the model that is being mapped. + + + + + Gets or sets a value representing the database that is the target of the mapping. + + + + + Gets or sets the collection of s that specifies how the model's entity containers are mapped to the database. + + + + + Represents the mapping of an entity property to a column in a database table. + + + + + Gets or sets the collection of instances that defines the mapped property, beginning from a property declared by the mapped entity type and optionally proceeding through properties of complex property result types. + + + + + Gets or sets a value representing the table column to which the entity property is being mapped. + + + + + Allows the construction and modification of the mapping of an EDM entity container ( ) to a database ( ). + + + + + Gets or sets an value representing the entity container that is being mapped. + + + + + Gets or sets the collection of s that specifies how the container's entity sets are mapped to the database. + + + + + Gets the collection of s that specifies how the container's association sets are mapped to the database. + + + + + Allows the construction and modification of the mapping of an EDM entity set ( ) to a database ( ). + + + + + Gets or sets an value representing the entity set that is being mapped. + + + + + Gets or sets the collection of s that specifies how the set's entity types are mapped to the database. + + + + + Allows the construction and modification of a complete or partial mapping of an EDM entity type ( ) or type hierarchy to a specific database table ( ). + + + + + Gets or sets an value representing the entity type or hierarchy that is being mapped. + + + + + Gets or sets a value indicating whether this type mapping applies to and all its direct or indirect subtypes ( true ), or only to ( false ). + + + + + Gets a value representing the table to which the entity type's properties are being mapped. + + + + + Gets the collection of s that specifies how the type's properties are mapped to the table. + + + + + Gets the collection of s that specifies the constant or null values that columns in must have for this type mapping fragment to apply. + + + + + Indicates which EDM-to-Database Mapping concept is represented by a given item. + + + + + Database Mapping Kind + + + + + Entity Container Mapping Kind + + + + + Entity Set Mapping Kind + + + + + Association Set Mapping Kind + + + + + Entity Type Mapping Kind + + + + + Query View Mapping Kind + + + + + Entity Type Mapping Fragment Kind + + + + + Edm Property Mapping Kind + + + + + Association End Mapping Kind + + + + + Column Condition Kind + + + + + Property Condition Kind + + + + + Allows the construction and modification of a constraint applied to an Entity Data Model (EDM) association. + + + + + Gets or sets the that represents the 'dependent' end of the constraint; properties from this association end's entity type contribute to the collection. + + + + + Gets or sets the collection of instances from the of the constraint. The values of these properties are constrained against the primary key values of the remaining, 'principal' association end's entity type. + + + + + Allows the construction and modification of one end of an Entity Data Model (EDM) association. + + + + + Gets or sets the entity type referenced by this association end. + + + + + Gets or sets the of this association end, which indicates the multiplicity of the end and whether or not it is required. + + + + + Gets or sets the to take when a delete operation is attempted. + + + + + Indicates the multiplicity of an and whether or not it is required. + + + + + Allows the construction and modification of an association set in an Entity Data Model (EDM) ). + + + + + Represents an item in an Entity Data Model (EDM) . + + + + + Gets or sets the that specifies the association type for the set. + + + + + Gets or sets the that specifies the entity set corresponding to the association end for this association set. + + + + + Gets or sets the that specifies the entity set corresponding to the association end for this association set. + + + + + + The base for all all Entity Data Model (EDM) types that represent a structured type from the EDM type system. + + + + + Gets or sets the that defines the source end of the association. + + + + + Gets or sets the that defines the target end of the association. + + + + + Gets or sets the optional constraint that indicates whether the relationship is an independent association (no constraint present) or a foreign key relationship ( specified). + + + + + Collection semantics for properties. + + + + + The property does not have a collection type or does not specify explicit collection semantics. + + + + + The property is an unordered collection that may contain duplicates. + + + + + The property is an ordered collection that may contain duplicates. + + + + + Allows the construction and modification of a complex type in an Entity Data Model (EDM) . + + + + + Gets or sets the optional that indicates the base complex type of the complex type. + + + + + Gets or sets a value indicating whether the complex type is abstract. + + + + + Gets or sets the collection of instances that describe the (scalar or complex) properties of the complex type. + + + + + Concurrency mode for properties. + + + + + Default concurrency mode: the property is never validated at write time + + + + + Fixed concurrency mode: the property is always validated at write time + + + + + Allows the construction and modification of an entity container in an Entity Data Model (EDM) . + + + + + Gets all s declared within the namspace. Includes s and s. + + + + + Gets or sets the collection of s that specifies the association sets within the container. + + + + + Gets or sets the collection of s that specifies the entity sets within the container. + + + + + Allows the construction and modification of an entity set in an Entity Data Model (EDM) . + + + + + Gets or sets the that specifies the entity type for the set. + + + + + Allows the construction and modification of an entity type in an Entity Data Model (EDM) . + + + + + Gets or sets the optional that indicates the base entity type of the entity type. + + + + + Gets or sets a value indicating whether the entity type is abstract. + + + + + Gets or sets the collection of s that specifies the properties declared by the entity type. + + + + + Gets or sets the collection of s that indicates which properties from the collection are part of the entity key. + + + + + Gets or sets the optional collection of s that specifies the navigation properties declared by the entity type. + + + + + Indicates which Entity Data Model (EDM) concept is represented by a given item. + + + + + Association End Kind + + + + + Association Set Kind + + + + + Association Type Kind + + + + + Collection Type Kind + + + + + Complex Type Kind + + + + + Entity Container Kind + + + + + Entity Set Kind + + + + + Entity Type Kind + + + + + Function Group Kind + + + + + Function Overload Kind + + + + + Function Import Kind + + + + + Function Parameter Kind + + + + + Navigation Property Kind + + + + + EdmProperty Type Kind + + + + + Association Constraint Type Kind + + + + + Ref Type Kind + + + + + Row Column Kind + + + + + Row Type Kind + + + + + Type Reference Kind + + + + + Model Kind + + + + + Namespace Kind + + + + + Primitive Facets Kind + + + + + Primitive Type Kind + + + + + Enum Type Kind + + + + + Enum Type Member Kind + + + + + EdmModel is the top-level container for namespaces and entity containers belonging to the same logical Entity Data Model (EDM) model. + + + + + Gets or sets an optional value that indicates the entity model version. + + + + + Gets or sets the containers declared within the model. + + + + + Gets or sets the namespaces declared within the model. + + + + + Allows the construction and modification of a namespace in an . + + + + + Gets all s declared within the namspace. Includes s, s, s. + + + + + Gets or sets the s declared within the namespace. + + + + + Gets or sets the s declared within the namespace. + + + + + Gets or sets the s declared within the namespace. + + + + + Allows the construction and modification of an Entity Data Model (EDM) navigation property. + + + + + Gets or sets the that specifies the association over which navigation takes place. + + + + + Gets or sets the that specifies which association end is the 'destination' end of the navigation and produces the navigation property result. + + + + + Specifies the action to take on a given operation. + + + + + Default behavior + + + + + Restrict the operation + + + + + Cascade the operation + + + + + Represents one of the fixed set of Entity Data Model (EDM) primitive types. + + + + + The base for all all Entity Data Model (EDM) types that represent a scalar type from the EDM type system. + + + + + Retrieves the EdmPrimitiveType instance with the corresponding to the specified value, if any. + + The name of the primitive type instance to retrieve + The EdmPrimitiveType with the specified name, if successful; otherwise null . + true if the given name corresponds to an EDM primitive type name; otherwise false . + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets an value that indicates which Entity Data Model (EDM) primitive type this type represents. + + + + + Allows the construction and modification of additional constraints that can be applied to a specific use of a primitive type in an Entity Data Model (EDM) item. See . + + + + + Returns true if any facet value property currently has a non-null value; otherwise returns false . + + + + + Gets or sets an optional value indicating the current constraint on the type's maximum length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have its intrinsic maximum length, rather than a specific value. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have a fixed or variable length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to be Unicode or non-Unicode. + + + + + Gets or sets an optional value indicating the current constraint on the type's precision. + + + + + Gets or sets an optional value indicating the current constraint on the type's scale. + + + + + Gets or sets an optional value indicating that the current spatial type's SRID is unconstrained. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating whether the spatial type is to be type checked strictly. + + + + + Primitive Types as defined by the Entity Data Model (EDM). + + + + + Binary Type Kind + + + + + Boolean Type Kind + + + + + Byte Type Kind + + + + + DateTime Type Kind + + + + + Decimal Type Kind + + + + + Double Type Kind + + + + + Guid Type Kind + + + + + Single Type Kind + + + + + SByte Type Kind + + + + + Int16 Type Kind + + + + + Int32 Type Kind + + + + + Int64 Type Kind + + + + + String Type Kind + + + + + Time Type Kind + + + + + DateTimeOffset Type Kind + + + + + Geometry Type Kind + + + + + Geography Type Kind + + + + + Geometric point type kind + + + + + Geometric linestring type kind + + + + + Geometric polygon type kind + + + + + Geometric multi-point type kind + + + + + Geometric multi-linestring type kind + + + + + Geometric multi-polygon type kind + + + + + Geometric collection type kind + + + + + Geographic point type kind + + + + + Geographic linestring type kind + + + + + Geographic polygon type kind + + + + + Geographic multi-point type kind + + + + + Geographic multi-linestring type kind + + + + + Geographic multi-polygon type kind + + + + + Geographic collection type kind + + + + + Allows the construction and modification of a primitive- or complex-valued property of an Entity Data Model (EDM) entity or complex type. + + + + + Gets or sets an value that indicates which collection semantics - if any - apply to the property. + + + + + Gets or sets a value that indicates whether the property is used for concurrency validation. + + + + + Gets or sets on optional value that indicates an initial default value for the property. + + + + + Gets or sets an that specifies the result type of the property. + + + + + Enumerates all s declared or inherited by an . + + + + + Allows the construction and modification of a specific use of a type in an Entity Data Model (EDM) item. See for examples. + + + + + Gets or sets a value indicating the collection rank of the type reference. A collection rank greater than zero indicates that the type reference represents a collection of its referenced . + + + + + Gets or sets a value indicating the referenced by this type reference. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered nullable. + + + + + Gets or sets an optional instance that applies additional constraints to a referenced primitive type. + + + Accessing this property forces the creation of an EdmPrimitiveTypeFacets value if no value has previously been set. Use to determine whether or not this property currently has a value. + + + + + Gets a value indicating whether the property of this type reference has been assigned an value with at least one facet value specified. + + + + + Indicates whether this type reference represents a collection of its referenced (when is greater than zero) or not. + + + + + Indicates whether the property of this type reference currently refers to an , is not a collection type, and does not have primitive facet values specified. + + + + + Gets the currently referred to by this type reference, or null if the type reference is a collection type or does not refer to a complex type. + + + + + Indicates whether the property of this type reference currently refers to an and is not a collection type. + + + + + Gets the currently referred to by this type reference, or null if the type reference is a collection type or does not refer to a primitive type. + + + + + Contains constant values that apply to the EDM model, regardless of source (for CSDL specific constants see ). + + + + + Parsing code taken from System.dll's System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(string) method to avoid LinkDemand needed to call this method + + + + + + + + + + + Constants for CSDL XML. + + + + + Constants for C-S MSL XML. + + + + + Constants for SSDL XML. + + + + + The acceptable range for this enum is 0000 - 0999; the range 10,000-15,000 is reserved for tools. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Precision out of range + + + + + Scale out of range + + + + + + + + + + + + + One of the required facets is missing + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The facet isn't allow by the property type. + + + + + This facet value is constant and is specified in the schema + + + + + + + + + + + + + Multiplicity value was malformed + + + + + The value for the Action attribute is invalid or not allowed in the current context + + + + + An error occurred processing the On<Operation> elements + + + + + Ends were given for the Property element of a EntityContainer that is not a RelationshipSet + + + + + The extent name used in the EntittyContainerType End does not match the name of any of the EntityContainerProperties in the containing EntityContainer + + + + + An end element was not given, and cannot be inferred because too many EntityContainerEntitySet elements that are good possibilities. + + + + + An end element was not given, and cannot be inferred because there is no EntityContainerEntitySets that are the correct type to be used as an EntitySet. + + + + + Not a valid parameter direction for the parameter in a function + + + + + Unable to infer an optional schema part, to resolve this; be more explicit + + + + + Invalid facet attribute(s) specified in provider manifest + + + + + Invalid role value in the relationship constraint + + + + + Invalid Property in relationship constraint + + + + + Type mismatch between ToProperty and FromProperty in the relationship constraint + + + + + Invalid multiplicity in FromRole in the relationship constraint + + + + + The number of properties in the FromProperty and ToProperty in the relationship constraint must be identical + + + + + No Properties defined in either FromProperty or ToProperty in the relationship constraint + + + + + Missing constraint in relationship type in ssdl + + + + + Same role referred in the ToRole and FromRole of a referential constraint + + + + + Invalid value for attribute ParameterTypeSemantics + + + + + Invalid type used for a Relationship End Type + + + + + Invalid PrimitiveTypeKind + + + + + Invalid TypeConversion DestinationType + + + + + Expected a integer value between 0 - 255 + + + + + Invalid Type specified in function + + + + + Precision must not be greater than 28 + + + + + Properties that are part of entity key must be of scalar type + + + + + Binary type properties which are part of entity key are currently not supported + + + + + The primitive type kind does not have a preferred mapping + + + + + More than one PreferredMapping for a PrimitiveTypeKind + + + + + End with * multiplicity cannot have operations specified + + + + + EntitySet type has no keys + + + + + InvalidNumberOfParametersForAggregateFunction + + + + + InvalidParameterTypeForAggregateFunction + + + + + Composable functions must declare a return type. + + + + + Non-composable functions must not declare a return type. + + + + + Non-composable functions do not permit the aggregate; niladic; or built-in attributes. + + + + + Composable functions can not include command text attribute. + + + + + Functions should not declare both a store name and command text (only one or the other can be used). + + + + + SystemNamespace + + + + + Empty DefiningQuery text + + + + + Schema, Table and DefiningQuery are all specified, and are mutually exclusive + + + + + ConcurrencyMode value was malformed + + + + + Concurrency can't change for any sub types of an EntitySet type. + + + + + Function import return type must be either empty, a collection of entities, or a singleton scalar. + + + + + Function import specifies a non-existent entity set. + + + + + Function import specifies entity type return but no entity set. + + + + + Function import specifies entity type that does not derive from element type of entity set. + + + + + Function import specifies a binding to an entity set but does not return entities. + + + + + InternalError + + + + + Same Entity Set Taking part in the same role of the relationship set in two different relationship sets + + + + + Entity key refers to the same property twice + + + + + Function declares a ReturnType attribute and element + + + + + Nullable Complex Type not supported in Edm V1 + + + + + Only Complex Collections supported in Edm V1.1 + + + + + No Key defined on Entity Type + + + + + Invalid namespace specified in using element + + + + + Need not specify system namespace in using + + + + + Cannot use a reserved/system namespace as alias + + + + + Invalid qualification specified for type + + + + + Invalid Entity Container Name in extends attribute + + + + + Invalid CollectionKind value in property CollectionKind attribute + + + + + Must specify namespace or alias of the schema in which this type is defined + + + + + Entity Container cannot extend itself + + + + + Failed to retrieve provider manifest + + + + + Mismatched Provider Manifest token values in SSDL artifacts + + + + + Missing Provider Manifest token value in SSDL artifact(s) + + + + + Empty CommandText element + + + + + Inconsistent Provider values in SSDL artifacts + + + + + Inconsistent Provider Manifest token values in SSDL artifacts + + + + + Duplicated Function overloads + + + + + InvalidProvider + + + + + FunctionWithNonEdmTypeNotSupported + + + + + ComplexTypeAsReturnTypeAndDefinedEntitySet + + + + + ComplexTypeAsReturnTypeAndDefinedEntitySet + + + + unused 179, + unused 180, + unused 181, + + In model functions facet attribute is allowed only on ScalarTypes + + + + + Captures several conditions where facets are placed on element where it should not exist. + + + + + Return type has not been declared + + + + + Invalid value in the EnumTypeOption + + + + + The structural annotation cannot use codegen namespaces + + + + + Function and type cannot have the same fully qualified name + + + + + Cannot load different version of schema in the same ItemCollection + + + + + Expected bool value + + + + + End without Multiplicity specified + + + + + In SSDL, if composable function returns a collection of rows (TVF), all row properties must be of scalar types. + + + + + The name of NamedEdmItem must not be empty or white space only + + + + + EdmTypeReference is empty + + Unused 199; + + + + Serializes an that conforms to the restrictions of a single CSDL schema file to an XML writer. The model to be serialized must contain a single and a single . + + + + + Serialize the to the XmlWriter. + + The EdmModel to serialize, mut have only one and one + The XmlWriter to serialize to + + + + Serialize the to the XmlWriter + + The DbModel to serialize + The XmlWriter to serialize to + + + + Serialize the to the + + The DbDatabaseMetadata to serialize + Provider information on the Schema element + ProviderManifestToken information on the Schema element + The XmlWriter to serialize to + + + + + author/email + + + + + author/name + + + + + author/uri + + + + + published + + + + + rights + + + + + summary + + + + + title + + + + + contributor/email + + + + + contributor/name + + + + + contributor/uri + + + + + category/@label + + + + + Plaintext + + + + + HTML + + + + + XHTML + + + + + updated + + + + + link/@href + + + + + link/@rel + + + + + link/@type + + + + + link/@hreflang + + + + + link/@title + + + + + link/@length + + + + + category/@term + + + + + category/@scheme + + + + + Return role name pair + + + + + + + + The context for DataModel Validation + + + + + Returns true if the given two ends are similar - the relationship type that this ends belongs to is the same and the entity set refered by the ends are same and they are from the same role + + + + + + + + Return true if the Referential Constraint on the association is ready for further validation, otherwise return false. + + + + + + + Resolves the given property names to the property in the item Also checks whether the properties form the key for the given type and whether all the properties are nullable or not + + + + + + + + + + + Return true if the namespaceName is a Edm System Namespace + + + + + + + Return true if the entityType is a subtype of any entity type in the dictionary keys, and return the corresponding entry EntitySet value. Otherwise return false. + + + + + + + + + Return true if any of the properties in the EdmEntityType defines ConcurrencyMode. Otherwise return false. + + + + + + + Add member name to the Hash set, raise an error if the name exists already. + + + + + + + + + If the string is null, empty, or only whitespace, return false, otherwise return true + + + + + + + Determine if a cycle exists in the type hierarchy: use two pointers to walk the chain, if one catches up with the other, we have a cycle. + + true if a cycle exists in the type hierarchy, false otherwise + + + + RuleSet for DataModel Validation + + + + + Get the related rules given certain DataModelItem + + The to validate + A collection of + + + + Data Model Validator + + + + + Validate the and all of its properties given certain version. + + The root of the model to be validated + True to validate the syntax, otherwise false + + + + The RuleSet for EdmModel + + + + + Get based on version + + a double value of version + + + + + The context for EdmModel Validation + + + + + Visitor for EdmModel Validation + + + + + Edm Model Validator + + + + + validate the from the root with the context + + The root to validate from + The validation context + + + + An implementation of IDatabaseInitializer that will recreate and optionally re-seed the + database only if the database does not exist. + To seed the database, create a derived class and override the Seed method. + + The type of the context. + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + An instances of this class is obtained from an object and can be used + to manage the actual database backing a DbContext or connection. + This includes creating, deleting, and checking for the existence of a database. + Note that deletion and checking for existence of a database can be performed using just a + connection (i.e. without a full context) by using the static methods of this class. + + + + + Creates a Database backed by the given context. This object can be used to create a database, + check for database existence, and delete a database. + + The context that defines the database connection and model. + + + + Gets or sets the database initialization strategy. The database initialization strategy is called when instance + is initialized from a . The strategy can optionally check for database existence, create a new database, and + seed the database with data. + The default strategy is an instance of . + + The type of the context. + The strategy. + The database creation strategy. + + + + Internal version of SetInitializer that allows the strategy to be locked such that it cannot be replaced + by another call to SetInitializer. This allows strategies set in the app.config to win over strategies set + in code. + + The type of the context. + The strategy. + if set to true then the strategy is locked. + + + + Runs the the registered on this context. + + If "force" is set to true, then the initializer is run regardless of whether or not it + has been run before. This can be useful if a database is deleted while an app is running + and needs to be reinitialized. + + If "force" is set to false, then the initializer is only run if it has not already been + run for this context, model, and connection in this app domain. This method is typically + used when it is necessary to ensure that the database has been created and seeded + before starting some operation where doing so lazily will cause issues, such as when the + operation is part of a transaction. + + if set to true the initializer is run even if it has already been run. + + + + Checks whether or not the database is compatible with the the current Code First model. + + + Model compatibility currently uses the following rules. + + If the context was created using either the Model First or Database First approach then the + model is assumed to be compatible with the database and this method returns true. + + For Code First the model is considered compatible if the model is stored in the database + in the Migrations history table and that model has no differences from the current model as + determined by Migrations model differ. + + If the model is not stored in the database but an EF 4.1/4.2 model hash is found instead, + then this is used to check for compatibility. + + + If set to true then an exception will be thrown if no model metadata is found in + the database. If set to false then this method will return true if metadata + is not found. + + True if the model hash in the context and the database match; false otherwise. + + + + + Creates a new database on the database server for the model defined in the backing context. + Note that calling this method before the database initialization strategy has run will disable + executing that strategy. + + + + + Creates a new database on the database server for the model defined in the backing context, but only + if a database with the same name does not already exist on the server. + + True if the database did not exist and was created; false otherwise. + + + + Checks whether or not the database exists on the server. + + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + Calling this method from outside of an initializer will mark the database as having + not been initialized. This means that if an attempt is made to use the database again + after it has been deleted, then any initializer set will run again and, usually, will + try to create the database again automatically. + + True if the database did exist and was deleted; false otherwise. + + + + Checks whether or not the database exists on the server. + The connection to the database is created using the given database name or connection string + in the same way as is described in the documentation for the class. + + The database name or a connection string to the database. + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + The connection to the database is created using the given database name or connection string + in the same way as is described in the documentation for the class. + + The database name or a connection string to the database. + True if the database did exist and was deleted; false otherwise. + + + + Checks whether or not the database exists on the server. + + An existing connection to the database. + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + + An existing connection to the database. + True if the database did exist and was deleted; false otherwise. + + + + Resets the DefaultConnectionFactory to its initial value. + Currently, this method is only used by test code. + + + + + Performs the operation defined by the given delegate using the given lazy connection, ensuring + that the lazy connection is disposed after use. + + Information used to create a DbConnection. + The operation to perform. + The return value of the operation. + + + + Performs the operation defined by the given delegate against a connection. The connection + is either the connection accessed from the context backing this object, or is obtained from + the connection information passed to one of the static methods. + + The connection to use. + The operation to perform. + The return value of the operation. + + + + Returns an empty ObjectContext that can be used to perform delete/exists operations. + + The connection for which to create an ObjectContext + The empty context. + + + + Creates a raw SQL query that will return elements of the given generic type. + The type can be any type that has properties that match the names of the columns returned + from the query, or can be a simple primitive type. The type does not have to be an + entity type. The results of this query are never tracked by the context even if the + type of object returned is an entity type. Use the + method to return entities that are tracked by the context. + + The type of object returned by the query. + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Creates a raw SQL query that will return elements of the given type. + The type can be any type that has properties that match the names of the columns returned + from the query, or can be a simple primitive type. The type does not have to be an + entity type. The results of this query are never tracked by the context even if the + type of object returned is an entity type. Use the + method to return entities that are tracked by the context. + + The type of object returned by the query. + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Executes the given DDL/DML command against the database. + + The command string. + The parameters to apply to the command string. + The result returned by the database after executing the command. + + + + Returns the connection being used by this context. This may cause the + connection to be created if it does not already exist. + + Thrown if the context has been disposed. + + + + Returns the as a delegate that can be called with + an instance of the that owns this Database object, or returns null if + there is no initializer set for this context type. + + The initializer delegate or null. + + + + The connection factory to use when creating a from just + a database name or a connection string. + + + This is used when just a database name or connection string is given to or when + the no database name or connection is given to DbContext in which case the name of + the context class is passed to this factory in order to generate a DbConnection. + By default, the instance to use is read from the applications .config + file from the "EntityFramework DefaultConnectionFactory" entry in appSettings. If no entry is found in + the config file then is used. Setting this property in code + always overrides whatever value is found in the config file. + + + + + Checks wether or not the DefaultConnectionFactory has been set to something other than its default value. + + + + + + + Common code for generic and non-generic string Include. + + + + + + Returns a new query where the entities returned will not be cached in the + or . This method works by calling the AsNoTracking method of the + underlying query object. If the underlying query object does not have a AsNoTracking method, + then calling this method will have no affect. + + The element type. + The source query. + A new query with NoTracking applied, or the source query if NoTracking is not supported. + + + + Returns a new query where the entities returned will not be cached in the + or . This method works by calling the AsNoTracking method of the + underlying query object. If the underlying query object does not have a AsNoTracking method, + then calling this method will have no affect. + + The source query. + A new query with NoTracking applied, or the source query if NoTracking is not supported. + + + + Common code for generic and non-generic AsNoTracking. + + + + + Enumerates the query such that for server queries such as those of , , + , and others the results of the query will be loaded into the associated , + or other cache on the client. + This is equivalent to calling ToList and then throwing away the list without the overhead of actually creating the list. + + The source query. + + + + Returns an implementation that stays in sync with the given . + + The element type. + The collection that the binding list will stay in sync with. + The binding list. + + + + DbModelBuilder is used to map CLR classes to a database schema. + This code centric approach to building an Entity Data Model (EDM) model is known as 'Code First'. + + + DbModelBuilder is typically used to configure a model by overriding . + You can also use DbModelBuilder independently of DbContext to build a model and then construct a + or . + The recommended approach, however, is to use OnModelCreating in as + the workflow is more intuitive and takes care of common tasks, such as caching the created model. + + Types that form your model are registered with DbModelBuilder and optional configuration can be + performed by applying data annotations to your classes and/or using the fluent style DbModelBuilder + API. + + When the Build method is called a set of conventions are run to discover the initial model. + These conventions will automatically discover aspects of the model, such as primary keys, and + will also process any data annotations that were specified on your classes. Finally + any configuration that was performed using the DbModelBuilder API is applied. + + Configuration done via the DbModelBuilder API takes precedence over data annotations which + in turn take precedence over the default conventions. + + + + + Initializes a new instance of the class. + + The process of discovering the initial model will use the set of conventions included + in the most recent version of the Entity Framework installed on your machine. + + + Upgrading to newer versions of the Entity Framework may cause breaking changes + in your application because new conventions may cause the initial model to be + configured differently. There is an alternate constructor that allows a specific + version of conventions to be specified. + + + + + Initializes a new instance of the class that will use + a specific set of conventions to discover the initial model. + + The version of conventions to be used. + + + + Excludes a type from the model. This is used to remove types from the model that were added + by convention during initial model discovery. + + The type to be excluded. + The same DbModelBuilder instance so that multiple calls can be chained. + + + + Excludes a type(s) from the model. This is used to remove types from the model that were added + by convention during initial model discovery. + + The types to be excluded from the model. + The same DbModelBuilder instance so that multiple calls can be chained. + + + + Registers an entity type as part of the model and returns an object that can be used to + configure the entity. This method can be called multiple times for the same entity to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified entity type. + + + + Registers a type as an entity in the model and returns an object that can be used to + configure the entity. This method can be called multiple times for the same type to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified entity type. + + + + Registers a type as a complex type in the model and returns an object that can be used to + configure the complex type. This method can be called multiple times for the same type to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified complex type. + + + + Creates a based on the configuration performed using this builder. + The connection is used to determine the database provider being used as this + affects the database layer of the generated model. + + Connection to use to determine provider information. + The model that was built. + + + + Creates a based on the configuration performed using this builder. + Provider information must be specified because this affects the database layer of the generated model. + For SqlClient the invariant name is 'System.Data.SqlClient' and the manifest token is the version year (i.e. '2005', '2008' etc.) + + The database provider that the model will be used with. + The model that was built. + + + + Provides access to the settings of this DbModelBuilder that deal with conventions. + + + + + Gets the for this DbModelBuilder. + The registrar allows derived entity and complex type configurations to be registered with this builder. + + + + + A value from this enumeration can be provided directly to the + class or can be used in the applied to + a class derived from . The value used defines which version of + the DbContext and DbModelBuilder conventions should be used when building a model from + code--also know as "Code First". + + + Using DbModelBuilderVersion.Latest ensures that all the latest functionality is available + when upgrading to a new release of the Entity Framework. However, it may result in an + application behaving differently with the new release than it did with a previous release. + This can be avoided by using a specific version of the conventions, but if a version + other than the latest is set then not all the latest functionality will be available. + + + + + Indicates that the latest version of the and + conventions should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 4.1 + through 4.3 should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 5.0 + when targeting .NET 4 should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 5.0 + when targeting .NET 4.5 should be used. + + + + + This attribute can be applied to a class derived from to set which + version of the DbContext and conventions should be used when building + a model from code--also know as "Code First". See the + enumeration for details about DbModelBuilder versions. + + + If the attribute is missing from DbContextthen DbContext will always use the latest + version of the conventions. This is equivalent to using DbModelBuilderVersion.Latest. + + + + + Initializes a new instance of the class. + + The conventions version to use. + + + + Gets the conventions version. + + The conventions version. + + + + A non-generic version of which can be used when the type of entity + is not known at build time. + + + + + Represents a non-generic LINQ to Entities query against a DbContext. + + + + + An internal interface implemented by and that allows access to + the internal query without using reflection. + + + + + The underlying internal set. + + + + + Internal constructor prevents external classes deriving from DbQuery. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + Instead populate a DbSet with data, for example by using the Load extension method, and + then bind to local data. For WPF bind to DbSet.Local. For Windows Forms bind to + DbSet.Local.ToBindingList(). + + + Never returns; always throws. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Returns the equivalent generic object. + + The type of element for which the query was created. + The generic set object. + + + + Returns a representation of the underlying query. + + + The query string. + + + + + Returns false. + + false. + + + + The IQueryable element type. + + + + + The IQueryable LINQ Expression. + + + + + The IQueryable provider. + + + + + Gets the underlying internal query object. + + The internal query. + + + + The internal query object that is backing this DbQuery + + + + + An internal interface implemented by and that allows access to + the internal set without using reflection. + + + + + The underlying internal set. + + + + + Internal constructor prevents external classes deriving from DbSet. + + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Returns the equivalent generic object. + + The type of entity for which the set was created. + The generic set object. + + + + Creates a raw SQL query that will return entities in this set. By default, the + entities returned are tracked by the context; this can be changed by calling + AsNoTracking on the returned. + Note that the entities returned are always of the type for this set and never of + a derived type. If the table or tables queried may contain data for other entity + types, then the SQL query must be written appropriately to ensure that only entities of + the correct type are returned. + + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + The internal IQueryable that is backing this DbQuery + + + + + Gets the underlying internal set. + + The internal set. + + + + A DbSet represents the collection of all entities in the context, or that can be queried from the + database, of a given type. DbSet objects are created from a DbContext using the DbContext.Set method. + + + Note that DbSet does not support MEST (Multiple Entity Sets per Type) meaning that there is always a + one-to-one correlation between a type and a set. + + The type that defines the set. + + + + Represents a LINQ to Entities query against a DbContext. + + The type of entity to query for. + + + + Creates a new query that will be backed by the given internal query object. + + The backing query. + + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Throws an exception indicating that binding directly to a store query is not supported. + Instead populate a DbSet with data, for example by using the Load extension method, and + then bind to local data. For WPF bind to DbSet.Local. For Windows Forms bind to + DbSet.Local.ToBindingList(). + + + Never returns; always throws. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Returns a representation of the underlying query. + + + The query string. + + + + + Returns a new instance of the non-generic class for this query. + + A non-generic version. + + + + Returns false. + + false. + + + + The IQueryable element type. + + + + + The IQueryable LINQ Expression. + + + + + The IQueryable provider. + + + + + The internal query object that is backing this DbQuery + + + + + The internal query object that is backing this DbQuery + + + + + An IDbSet represents the collection of all entities in the context, or that can be queried from the + database, of a given type. DbSet is a concrete implementation of IDbSet. + + The type that defines the set. + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + Creates a new set that will be backed by the given . + + The internal set. + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Returns the equivalent non-generic object. + + The non-generic set object. + + + + Creates a raw SQL query that will return entities in this set. By default, the + entities returned are tracked by the context; this can be changed by calling + AsNoTracking on the returned. + Note that the entities returned are always of the type for this set and never of + a derived type. If the table or tables queried may contain data for other entity + types, then the SQL query must be written appropriately to ensure that only entities of + the correct type are returned. + + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + The internal IQueryable that is backing this DbQuery + + + + + An implementation of IDatabaseInitializer that will always recreate and optionally re-seed the + database the first time that a context is used in the app domain. + To seed the database, create a derived class and override the Seed method. + + The type of the context. + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + An implementation of IDatabaseInitializer that will DELETE, recreate, and optionally re-seed the + database only if the model has changed since the database was created. + + + Whether or not the model has changed is determined by the + method. + To seed the database create a derived class and override the Seed method. + + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + Returned by the ChangeTracker method of to provide access to features of + the context that are related to change tracking of entities. + + + + + Initializes a new instance of the class. + + The internal context. + + + + Gets objects for all the entities tracked by this context. + + The entries. + + + + Gets objects for all the entities of the given type + tracked by this context. + + The type of the entity. + The entries. + + + + Detects changes made to the properties and relationships of POCO entities. Note that some types of + entity (such as change tracking proxies and entities that derive from ) + report changes automatically and a call to DetectChanges is not normally needed for these types of entities. + Also note that normally DetectChanges is called automatically by many of the methods of + and its related classes such that it is rare that this method will need to be called explicitly. + However, it may be desirable, usually for performance reasons, to turn off this automatic calling of + DetectChanges using the AutoDetectChangesEnabled flag from . + + + + + A non-generic version of the class. + + + + + This is an abstract base class use to represent a scalar or complex property, or a navigation property + of an entity. Scalar and complex properties use the derived class , + reference navigation properties use the derived class , and collection + navigation properties use the derived class . + + + + + Creates a from information in the given . + This method will create an instance of the appropriate subclass depending on the metadata contained + in the InternalMemberEntry instance. + + The internal member entry. + The new entry. + + + + Validates this property. + + + Collection of objects. Never null. If the entity is valid the collection will be empty. + + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the name of the property. + + The property name. + + + + Gets or sets the current value of this property. + + The current value. + + + + The to which this member belongs. + + An entry for the entity that owns this member. + + + + Gets the backing this object. + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal collection entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the collection of entities from the database. + Note that entities that already exist in the context are not overwritten with values from the database. + + + + + Returns the query that would be used to load this collection from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database, such + as counting the number of entities in the collection in the database without actually loading them. + + A query for the collection. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the collection element. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the collection of entities has been loaded from the database. + + true if the collection is loaded; otherwise, false. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Gets the backing this object as an . + + The internal member entry. + + + + Instances of this class are returned from the Collection method of + and allow operations such as loading to + be performed on the an entity's collection navigation properties. + + The type of the entity to which this property belongs. + The type of the element in the collection of entities. + + + + This is an abstract base class use to represent a scalar or complex property, or a navigation property + of an entity. Scalar and complex properties use the derived class , + reference navigation properties use the derived class , and collection + navigation properties use the derived class . + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + This method will create an instance of the appropriate subclass depending on the metadata contained + in the InternalMemberEntry instance. + + The internal member entry. + The new entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Validates this property. + + + Collection of objects. Never null. If the entity is valid the collection will be empty. + + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets the underlying . + + The internal member entry. + + + + The to which this member belongs. + + An entry for the entity that owns this member. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal collection entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the collection of entities from the database. + Note that entities that already exist in the context are not overwritten with values from the database. + + + + + Returns the query that would be used to load this collection from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database, such + as counting the number of entities in the collection in the database without actually loading them. + + A query for the collection. + + + + Returns a new instance of the non-generic class for + the navigation property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the collection of entities has been loaded from the database. + + true if the collection is loaded; otherwise, false. + + + + Gets the underlying as an . + + The internal member entry. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + An immutable representation of an Entity Data Model (EDM) model that can be used to create an + or can be passed to the constructor of a . + For increased performance, instances of this type should be cached and re-used to construct contexts. + + + + + For mocking. + + + + + Creates a model for the given EDM metadata model. + + The EDM metadata model. + + + + Creates an instance of ObjectContext or class derived from ObjectContext. Note that an instance + of DbContext can be created instead by using the appropriate DbContext constructor. + If a derived ObjectContext is used, then it must have a public constructor with a single + EntityConnection parameter. + The connection passed is used by the ObjectContext created, but is not owned by the context. The caller + must dispose of the connection once the context has been disposed. + + The type of context to create. + An existing connection to a database for use by the context. + + + + + Gets a cached delegate (or creates a new one) used to call the constructor for the given derived ObjectContext type. + + + + + A snapshot of the that was used to create this compiled model. + + + + + The provider info (provider name and manifest token) that was used to create this model. + + + + + A non-generic version of the class. + + + + + A non-generic version of the class. + + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the original value of this property. + + The original value. + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets or sets a value indicating whether the value of this property has been modified since + it was loaded from the database. + + + true if this instance is modified; otherwise, false. + + + + + The to which this property belongs. + + An entry for the entity that owns this property. + + + + The of the property for which this is a nested property. + This method will only return a non-null entry for properties of complex objects; it will + return null for properties of the entity itself. + + An entry for the parent complex property, or null if this is an entity property. + + + + Gets the backing this object. + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The name of the nested property. + An object representing the nested property. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the complex property. + The equivalent generic object. + + + + Instances of this class are returned from the ComplexProperty method of + and allow access to the state of a complex property. + + The type of the entity to which this property belongs. + The type of the property. + + + + Instances of this class are returned from the Property method of + and allow access to the state of the scalar + or complex property. + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the original value of this property. + + The original value. + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets or sets a value indicating whether the value of this property has been modified since + it was loaded from the database. + + + true if this instance is modified; otherwise, false. + + + + + The to which this property belongs. + + An entry for the entity that owns this property. + + + + The of the property for which this is a nested property. + This method will only return a non-null entry for properties of complex objects; it will + return null for properties of the entity itself. + + An entry for the parent complex property, or null if this is an entity property. + + + + Gets the underlying as an . + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The type of the nested property. + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The type of the nested property. + An expression representing the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The type of the nested property. + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The type of the nested property. + An expression representing the nested property. + An object representing the nested property. + + + + Describes the origin of the database connection string associated with a . + + + + + The connection string was created by convention. + + + + + The connection string was read from external configuration. + + + + + The connection string was explicitly specified at runtime. + + + + + The connection string was overriden by connection information supplied to DbContextInfo. + + + + + Returned by the Configuration method of to provide access to configuration + options for the context. + + + + + Initializes a new instance of the class. + + The internal context. + + + + Gets or sets a value indicating whether lazy loading of relationships exposed as + navigation properties is enabled. Lazy loading is enabled by default. + + true if lazy loading is enabled; otherwise, false. + + + + Gets or sets a value indicating whether or not the framework will create instances of + dynamically generated proxy classes whenever it creates an instance of an entity type. + Note that even if proxy creation is enabled with this flag, proxy instances will only + be created for entity types that meet the requirements for being proxied. + Proxy creation is enabled by default. + + true if proxy creation is enabled; otherwise, false. + + + + + Gets or sets a value indicating whether tracked entities should be validated automatically when + is invoked. + The default value is true. + + + + + Provides runtime information about a given type. + + + + + Creates a new instance representing a given type. + + The type deriving from . + + + + Creates a new instance representing a given targeting a specific database. + + The type deriving from . + Connection information for the database to be used. + + + + Creates a new instance representing a given type. An external list of + connection strings can be supplied and will be used during connection string resolution in place + of any connection strings specified in external configuration files. + + + It is preferable to use the constructor that accepts the entire config document instead of using this + constructor. Providing the entire config document allows DefaultConnectionFactroy entries in the config + to be found in addition to explicitly specified connection strings. + + The type deriving from . + A collection of connection strings. + + + + Creates a new instance representing a given type. An external config + object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + + The type deriving from . + An object representing the config file. + + + + Creates a new instance representing a given , targeting a specific database. + An external config object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + + The type deriving from . + An object representing the config file. + Connection information for the database to be used. + + + + Creates a new instance representing a given type. A + can be supplied in order to override the default determined provider used when constructing + the underlying EDM model. + + The type deriving from . + A specifying the underlying ADO.NET provider to target. + + + + Creates a new instance representing a given type. An external config + object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + A can be supplied in order to override the default determined + provider used when constructing the underlying EDM model. This can be useful to prevent EF from + connecting to discover a manifest token. + + The type deriving from . + An object representing the config file. + A specifying the underlying ADO.NET provider to target. + + + + Called internally when a context info is needed for an existing context, which may not be constructable. + + The context instance to get info from. + + + + If instances of the underlying type can be created, returns + a new instance; otherwise returns null. + + A instance. + + + + The concrete type. + + + + + Whether or not instances of the underlying type can be created. + + + + + The connection string used by the underlying type. + + + + + The connection string name used by the underlying type. + + + + + The ADO.NET provider name of the connection used by the underlying type. + + + + + The origin of the connection string used by the underlying type. + + + + + An action to be run on the DbModelBuilder after OnModelCreating has been run on the context. + + + + + A non-generic version of the class. + + + + + Initializes a new instance of the class. + + The internal entry. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + Note that changing the values in the returned dictionary will not update the values in the database. + If the entity is not found in the database then null is returned. + + The store values. + + + + Reloads the entity from the database overwriting any property values with values from the database. + The entity will be in the Unchanged state after calling this method. + + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The name of the property. + An object representing the property. + + + + Gets an object that represents a complex property of this entity. + + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The name of the member. + An object representing the member. + + + + Returns a new instance of the generic class for the given + generic type for the tracked entity represented by this object. + Note that the type of the tracked entity must be compatible with the generic type or + an exception will be thrown. + + The type of the entity. + A generic version. + + + + Validates this instance and returns validation result. + + + Entity validation result. Possibly null if + method is overridden. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the entity. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + + The original values. + + + + Gets InternalEntityEntry object for this DbEntityEntry instance. + + + + + Instances of this class provide access to information about and control of entities that + are being tracked by the . Use the Entity or Entities methods of + the context to obtain objects of this type. + + The type of the entity. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + Note that changing the values in the returned dictionary will not update the values in the database. + If the entity is not found in the database then null is returned. + + The store values. + + + + Reloads the entity from the database overwriting any property values with values from the database. + The entity will be in the Unchanged state after calling this method. + + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The type of the property. + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The type of the property. + An expression representing the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The type of elements in the collection. + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The type of elements in the collection. + An expression representing the navigation property. + An object representing the navigation property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The name of the property. + An object representing the property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The type of the property. + The name of the property. + An object representing the property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The type of the property. + An expression representing the property. + An object representing the property. + + + + Gets an object that represents a complex property of this entity. + + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a complex property of this entity. + + The type of the complex property. + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a complex property of this entity. + + The type of the complex property. + An expression representing the complex property. + An object representing the complex property. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The name of the member. + An object representing the member. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The type of the member. + The name of the member. + An object representing the member. + + + + Returns a new instance of the non-generic class for + the tracked entity represented by this object. + + A non-generic version. + + + + Validates this instance and returns validation result. + + + Entity validation result. Possibly null if + method is overridden. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the entity. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + + The original values. + + + + Represents an Entity Data Model (EDM) created by the . + The Compile method can be used to go from this EDM representation to a + which is a compiled snapshot of the model suitable for caching and creation of + or instances. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + Creates a for this mode which is a compiled snapshot + suitable for caching and creation of instances. + + The compiled model. + + + + A snapshot of the that was used to create this compiled model. + + + + + A collection of all the properties for an underlying entity or complex object. + + + An instance of this class can be converted to an instance of the generic class + using the Cast method. + Complex properties in the underlying entity or complex object are represented in + the property values as nested instances of this class. + + + + + Initializes a new instance of the class. + + The internal dictionary. + + + + Creates an object of the underlying type for this dictionary and hydrates it with property + values from this dictionary. + + The properties of this dictionary copied into a new object. + + + + Sets the values of this dictionary by reading values out of the given object. + The given object can be of any type. Any property on the object with a name that + matches a property name in the dictionary and can be read will be read. Other + properties will be ignored. This allows, for example, copying of properties from + simple Data Transfer Objects (DTOs). + + The object to read values from. + + + + Creates a new dictionary containing copies of all the properties in this dictionary. + Changes made to the new dictionary will not be reflected in this dictionary and vice versa. + + A clone of this dictionary. + + + + Sets the values of this dictionary by reading values from another dictionary. + The other dictionary must be based on the same type as this dictionary, or a type derived + from the type for this dictionary. + + The dictionary to read values from. + + + + Gets the value of the property just like using the indexed property getter but + typed to the type of the generic parameter. This is useful especially with + nested dictionaries to avoid writing expressions with lots of casts. + + The type of the property. + Name of the property. + The value of the property. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + Gets or sets the value of the property with the specified property name. + The value may be a nested instance of this class. + + The property name. + The value of the property. + + + + Gets the internal dictionary. + + The internal dictionary. + + + + A non-generic version of the class. + + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal reference entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the entity from the database. + Note that if the entity already exists in the context, then it will not overwritten with values from the database. + + + + + Returns the query that would be used to load this entity from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database. + + A query for the entity. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the entity has been loaded from the database. + + true if the entity is loaded; otherwise, false. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Gets the backing this object as an . + + The internal member entry. + + + + Instances of this class are returned from the Reference method of + and allow operations such as loading to + be performed on the an entity's reference navigation properties. + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal reference entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the entity from the database. + Note that if the entity already exists in the context, then it will not overwritten with values from the database. + + + + + Returns the query that would be used to load this entity from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database. + + A query for the entity. + + + + Returns a new instance of the non-generic class for + the navigation property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the entity has been loaded from the database. + + true if the entity is loaded; otherwise, false. + + + + Gets the underlying as an . + + The internal member entry. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Represents a SQL query for entities that is created from a + and is executed using the connection from that context. + Instances of this class are obtained from the instance for the + entity type. The query is not executed when this object is created; it is executed + each time it is enumerated, for example by using foreach. + SQL queries for non-entities are created using the . + See for a generic version of this class. + + + + + Initializes a new instance of the class. + + The internal query. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a new query where the results of the query will not be tracked by the associated + . + + A new query with no-tracking applied. + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Gets the internal query. + + The internal query. + + + + Returns false. + + false. + + + + Represents a SQL query for entities that is created from a + and is executed using the connection from that context. + Instances of this class are obtained from the instance for the + entity type. The query is not executed when this object is created; it is executed + each time it is enumerated, for example by using foreach. + SQL queries for non-entities are created using the . + See for a non-generic version of this class. + + + + + Executes the query and returns an enumerator for the elements. + + An + + object that can be used to iterate through the elements. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a new query where the results of the query will not be tracked by the associated + . + + A new query with no-tracking applied. + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Gets the internal query. + + The internal query. + + + + Returns false. + + false. + + + + Exception thrown by when it was expected that SaveChanges for an entity would + result in a database update but in fact no rows in the database were affected. This usually indicates + that the database has been concurrently updated such that a concurrency token that was expected to match + did not actually match. + Note that state entries referenced by this exception are not serialized due to security and accesses to + the state entries after serialization will return null. + + + + + + Initializes a new instance of the class. + + The internal context. + The inner exception. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Subscribes the SerializeObjectState event. + + + + + Gets objects that represents the entities that could not + be saved to the database. + + The entries representing the entities that could not be saved. + + + + Holds exception state that will be serialized when the exception is serialized. + + + + + Completes the deserialization. + + The deserialized object. + + + + Gets or sets a value indicating whether the exception involved independent associations. + + + + + Initializes a new instance of the class. + + The context. + The inner exception. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Represents an entity used to store metadata about an EDM in the database. + + + + + Attempts to get the model hash calculated by Code First for the given context. + This method will return null if the context is not being used in Code First mode. + + The context. + The hash string. + + + + Gets or sets the ID of the metadata entity, which is currently always 1. + + The id. + + + + Gets or sets the model hash which is used to check whether the model has + changed since the database was created from it. + + The model hash. + + + + Contains methods used to access the Entity Data Model created by Code First in the EDMX form. + These methods are typically used for debugging when there is a need to look at the model that + Code First creates internally. + + + + + Uses Code First with the given context and writes the resulting Entity Data Model to the given + writer in EDMX form. This method can only be used with context instances that use Code First + and create the model internally. The method cannot be used for contexts created using Database + First or Model First, for contexts created using a pre-existing , or + for contexts created using a pre-existing . + + The context. + The writer. + + + + Writes the Entity Data Model represented by the given to the + given writer in EDMX form. + + An object representing the EDM. + The writer. + + + + A factory for creating derived instances. Implement this + interface to enable design-time services for context types that do not have a + public default constructor. + + At design-time, derived instances can be created in order to enable specific + design-time experiences such as model rendering, DDL generation etc. To enable design-time instantiation + for derived types that do not have a public, default constructor, implement + this interface. Design-time services will auto-discover implementations of this interface that are in the + same assembly as the derived type. + + + + + + Creates a new instance of a derived type. + + An instance of TContext + + + + This convention causes DbModelBuilder to include metadata about the model + when it builds the model. When creates a model by convention it will + add this convention to the list of those used by the DbModelBuilder. This will then result in + model metadata being written to the database if the DbContext is used to create the database. + This can then be used as a quick check to see if the model has changed since the last time it was + used against the database. + This convention can be removed from the conventions by overriding + the OnModelCreating method on a derived DbContext class. + + + + + Adds metadata to the given model configuration. + + The model configuration. + + + + This convention uses the name of the derived + class as the container for the conceptual model built by + Code First. + + + + + Initializes a new instance of the class. + + The model container name. + + + + Applies the convention to the given model. + + The model. + + + + This convention uses the namespace of the derived + class as the namespace of the conceptual model built by + Code First. + + + + + Initializes a new instance of the class. + + The model namespace. + + + + Applies the convention to the given model. + + The model. + + + + Instances of this class are used internally to create constant expressions for + that are inserted into the expression tree to replace references to + and . + + The type of the element. + + + + Private constructor called by the Create factory method. + + The query. + + + + Factory method called by CreateDelegate to create an instance of this class. + + The query, which must be a generic object of the expected type. + A new instance. + + + + The public property expected in the LINQ expression tree. + + The query. + + + + Instances of this class are used to create DbConnection objects for + SQL Server Compact Edition based on a given database name or connection string. + + + It is necessary to provide the provider invariant name of the SQL Server Compact + Edition to use when creating an instance of this class. This is because different + versions of SQL Server Compact Editions use different invariant names. + An instance of this class can be set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use SQL Server Compact Edition by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Creates a new connection factory with empty (default) DatabaseDirectory and BaseConnectionString + properties. + + The provider invariant name that specifies the version of SQL Server Compact Edition that should be used. + + + + Creates a new connection factory with the given DatabaseDirectory and BaseConnectionString properties. + + + The provider invariant name that specifies the version of SQL Server Compact Edition that should be used. + + + The path to prepend to the database name that will form the file name used by SQL Server Compact Edition + when it creates or reads the database file. An empty string means that SQL Server Compact Edition will use + its default for the database file location. + + + The connection string to use for options to the database other than the 'Data Source'. The Data Source will + be prepended to this string based on the database name when CreateConnection is called. + + + + + Creates a connection for SQL Server Compact Edition based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + The path to prepend to the database name that will form the file name used by + SQL Server Compact Edition when it creates or reads the database file. + The default value is "|DataDirectory|", which means the file will be placed + in the designated data directory. + + + + + The connection string to use for options to the database other than the 'Data Source'. + The Data Source will be prepended to this string based on the database name when + CreateConnection is called. + The default is the empty string, which means no other options will be used. + + + + + The provider invariant name that specifies the version of SQL Server Compact Edition + that should be used. + + + + + Instances of this class are used to create DbConnection objects for + SQL Server based on a given database name or connection string. By default, the connection is + made to '.\SQLEXPRESS'. This can be changed by changing the base connection + string when constructing a factory instance. + + + An instance of this class can be set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use SQL Server by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Creates a new connection factory with a default BaseConnectionString property of + 'Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True'. + + + + + Creates a new connection factory with the given BaseConnectionString property. + + + The connection string to use for options to the database other than the 'Initial Catalog'. The 'Initial Catalog' will + be prepended to this string based on the database name when CreateConnection is called. + + + + + Creates a connection for SQL Server based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + Remove hard dependency on DbProviderFactories. + + + + + The connection string to use for options to the database other than the 'Initial Catalog'. + The 'Initial Catalog' will be prepended to this string based on the database name when + CreateConnection is called. + The default is 'Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True'. + + + + + This attribute can be applied to either an entire derived class or to + individual or properties on that class. When applied + any discovered or properties will still be included + in the model but will not be automatically initialized. + + + + + Thrown when a context is generated from the templates in Database First or Model + First mode and is then used in Code First mode. + + + Code generated using the T4 templates provided for Database First and Model First use may not work + correctly if used in Code First mode. To use these classes with Code First please add any additional + configuration using attributes or the DbModelBuilder API and then remove the code that throws this + exception. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The object that holds the serialized object data. + The contextual information about the source or destination. + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Implements ICachedMetadataWorkspace for a Code First model. + + + + + Represents an object that holds a cached copy of a MetadataWorkspace and optionally the + assemblies containing entity types to use with that workspace. + + + + + Gets the MetadataWorkspace, potentially lazily creating it if it does not already exist. + If the workspace is not compatible with the provider manifest obtained from the given + connection then an exception is thrown. + + The connection to use to create or check SSDL provider info. + The workspace. + + + + The list of assemblies that contain entity types for this workspace, which may be empty, but + will never be null. + + + + + The default container name for code first is the container name that is set from the DbModelBuilder + + + + + The provider info used to construct the workspace. + + + + + Builds and stores the workspace based on the given code first configuration. + + The code first EDM model. + + + + Gets the . + If the workspace is not compatible with the provider manifest obtained from the given + connection then an exception is thrown. + + The connection to use to create or check SSDL provider info. + The workspace. + + + + The default container name for code first is the container name that is set from the DbModelBuilder + + + + + The list of assemblies that contain entity types for this workspace, which may be empty, but + will never be null. + + + + + The provider info used to construct the workspace. + + + + + The methods here are called from multiple places with an ObjectContext that may have + been created in a variety of ways and ensure that the same code is run regardless of + how the context was created. + + + + + Used a delegate to do the actual creation once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + Note however that a context obtained from only a connection will have no model and so + will result in an empty database. + + + + + Used a delegate to do the actual existence check once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + + + + + Used a delegate to do the actual check/delete once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given set of entity types and DbSet initializer delegate. + + + + + The entity types part of the pair. + + + + + The DbSet properties initializer part of the pair. + + + + + Static helper methods only. + + + + + Checks whether the given value is null and throws ArgumentNullException if it is. + This method should only be used in places where Code Contracts are compiled out in the + release build but we still need public surface null-checking, such as where a public + abstract class is implemented by an internal concrete class. + + + + + Checks whether the given string is null, empty, or just whitespace, and throws appropriately + if the check fails. + This method should only be used in places where Code Contracts are compiled out in the + release build but we still need public surface checking, such as where a public + abstract class is implemented by an internal concrete class. + + + + + Given two key values that may or may not be byte arrays, this method determines + whether or not they are equal. For non-binary key values, this is equivalent + to Object.Equals. For binary keys, it is by comparison of every byte in the + arrays. + + + + + Provides a standard helper method for quoting identifiers + + Identifier to be quoted. Does not validate that this identifier is valid. + Quoted string + + + + Checks the given string which might be a database name or a connection string and determines + whether it should be treated as a name or connection string. Currently, the test is simply + whether or not the string contains an '=' character--if it does, then it should be treated + as a connection string. + + The name or connection string. + true if the string should be treated as a connection string; false if it should be treated as a name. + + + + Determines whether the given string should be treated as a database name directly (it contains no '='), + is in the form name=foo, or is some other connection string. If it is a direct name or has name=, then + the name is extracted and the method returns true. + + The name or connection string. + The name. + True if a name is found; false otherwise. + + + + Determines whether the given string is a full EF connection string with provider, provider connection string, + and metadata parts, or is is instead some other form of connection string. + + The name or connection string. + true if the given string is an EF connection string; otherwise, false. + + + + + Parses a property selector expression used for the expression-based versions of the Property, Collection, Reference, + etc methods on and + classes. + + The type of the entity. + The type of the property. + The property. + Name of the method. + Name of the param. + The property name. + + + + Called recursively to parse an expression tree representing a property path such + as can be passed to Include or the Reference/Collection/Property methods of . + This involves parsing simple property accesses like o => o.Products as well as calls to Select like + o => o.Products.Select(p => p.OrderLines). + + The expression to parse. + The expression parsed into an include path, or null if the expression did not match. + True if matching succeeded; false if the expression could not be parsed. + + + + Gets a cached dictionary mapping property names to property types for all the properties + in the given type. + + + + + Gets a dictionary of compiled property setter delegates for the underlying types. + The dictionary is cached for the type in the app domain. + + + + + Used by the property setter delegates to throw for attempts to set null onto + non-nullable properties or otherwise go ahead and set the property. + + + + + Gets a dictionary of compiled property getter delegates for the underlying types. + The dictionary is cached for the type in the app domain. + + + + + Creates a new with the NoTracking merge option applied. + The query object passed in is not changed. + + The query. + A new query with NoTracking applied. + + + + Converts to + + + Name of the property being validated with ValidationAttributes. Null for type-level validation. + + + ValidationResults instances to be converted to instances. + + + An created based on the + . + + + class contains a property with names of properties the error applies to. + On the other hand each applies at most to a single property. As a result for + each name in ValidationResult.MemberNames one will be created (with some + exceptions for special cases like null or empty .MemberNames or null names in the .MemberNames). + + + + + Calculates a "path" to a property. For primitive properties on an entity type it is just the + name of the property. Otherwise it is a dot separated list of names of the property and all + its ancestor properties starting from the entity. + + Property for which to calculate the path. + Dot separated path to the property. + + + + Gets names of the property and its ancestor properties as enumerable walking "bottom-up". + + Property for which to get the segments. + Names of the property and its ancestor properties. + + + + Gets an type for the given element type. + + Type of the element. + The collection type. + + + + Creates a database name given a type derived from DbContext. This handles nested and + generic classes. No attempt is made to ensure that the name is not too long since this + is provider specific. If a too long name is generated then the provider will throw and + the user must correct by specifying their own name in the DbContext constructor. + + Type of the context. + The database name to use. + + + + A local (in-memory) view of the entities in a DbSet. + This view contains Added entities and does not contain Deleted entities. The view extends + from and hooks up events between the collection and the + state manager to keep the view in sync. + + The type of the entity. + + + + Initializes a new instance of the class for entities + of the given generic type in the given internal context. + + The internal context. + + + + Called by the base class when the collection changes. + This method looks at the change made to the collection and reflects those changes in the + state manager. + + The instance containing the event data. + + + + Handles events from the state manager for entities entering, leaving, or being marked as deleted. + The local view is kept in sync with these changes. + + The sender. + The instance containing the event data. + + + + Clears the items by calling remove on each item such that we get Remove events that + can be tracked back to the state manager, rather than a single Reset event that we + cannot deal with. + + + + + Adds a contains check to the base implementation of InsertItem since we can't support + duplicate entities in the set. + + The index at which to insert. + The item to insert. + + + + Returns a cached binding list implementation backed by this ObservableCollection. + + The binding list. + + + + Service used to search for instance properties on a DbContext class that can + be assigned a DbSet instance. Also, if the the property has a public setter, + then a delegate is compiled to set the property to a new instance of DbSet. + All of this information is cached per app domain. + + + + + Creates a set discovery service for the given derived context. + + + + + Processes the given context type to determine the DbSet or IDbSet + properties and collect root entity types from those properties. Also, delegates are + created to initialize any of these properties that have public setters. + If the type has been processed previously in the app domain, then all this information + is returned from a cache. + + A dictionary of potential entity type to the list of the names of the properties that used the type. + + + + Calls the public setter on any property found to initialize it to a new instance of DbSet. + + + + + Registers the entities and their entity set name hints with the given . + + The model builder. + + + + Returns false if SuppressDbSetInitializationAttribute is found on the property or the class, otherwise + returns true. + + + + + Determines whether or not an instance of DbSet/ObjectSet can be assigned to a property of the given type. + + The type to check. + The entity type of the DbSet/ObjectSet that can be assigned, or null if no set type can be assigned. + + + + + A EagerInternalConnection object wraps an already existing DbConnection object. + + + + + InternalConnection objects manage DbConnections. + Two concrete base classes of this abstract interface exist: + and . + + + + + IInternalConnection objects manage DbConnections. + Two concrete implementations of this interface exist--LazyInternalConnection and EagerInternalConnection. + + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Returns the underlying DbConnection. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if the connection contains model info; otherwise, false. + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strins. + + + + + Gets or sets the provider to be used when creating the underlying connection. + + + + + Gets the name of the underlying connection string. + + + + + Gets the original connection string. + + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Called after the connection is initialized for the first time. + + + + + Adds a tracking cookie to the connection string for SqlConnections. Returns the + possibly modified store connection string. + + + + + Returns the underlying DbConnection. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if the connection contains model info; otherwise, false. + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strins. + + + + + Gets or sets the provider to be used when creating the underlying connection. + + + + + Gets the name of the underlying connection string. + + + + + Gets the original connection string. + + + + + Gets or sets the underlying object. No initialization is done when the + connection is obtained, and it can also be set to null. + + The underlying connection. + + + + Creates a new EagerInternalConnection that wraps an existing DbConnection. + + An existing connection. + If set to true then the underlying connection should be disposed when this object is disposed. + + + + Dispose the existing connection is the original caller has specified that it should be disposed + by the framework. + + + + + Returns the origin of the underlying connection string. + + + + + An is an where the + instance that it wraps is set immediately at construction time rather than being created lazily. In this case + the internal context may or may not own the instance but will only dispose it + if it does own it. + + + + + An underlies every instance of and wraps an + instance. + The also acts to expose necessary information to other parts of the design in a + controlled manner without adding a lot of internal methods and properties to the + class itself. + Two concrete classes derive from this abstract class - and + . + + + + + Initializes the object with its owner. + + The owner . + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Creates a new temporary based on the same metadata and connection as the real + and sets it as the context to use DisposeTempObjectContext is called. + This allows this internal context and its DbContext to be used for transient operations + such as initializing and seeding the database, after which it can be thrown away. + This isolates the real from any changes made and and saves performed. + + + + + If a temporary ObjectContext was set with UseTempObjectContext, then this method disposes that context + and returns this internal context and its DbContext to using the real ObjectContext. + + + + + Called by methods of to create a database either using the Migrations pipeline + if possible and the core provider otherwise. + + The context to use for core provider calls. + + + + Internal implementation of . + + True if the model hash in the context and the database match; false otherwise. + + + + Checks whether the given model (an EDMX document) matches the current model. + + + + + Queries the database for a model hash and returns it if found or returns null if the table + or the row doesn't exist in the database. + + The model hash, or null if not found. + + + + Queries the database for a model stored in the MigrationHistory table and returns it as an EDMX, or returns + null if the database does not contain a model. + + + + + Saves the model hash from the context to the database. + + + + + Performs the initialization action that may result in a and + handle the exception to provide more meaning to the user. + + The action. + + + + Registers for the ObjectStateManagerChanged event on the underlying ObjectStateManager. + This is a virtual method on this class so that it can be mocked. + + The event handler. + + + + Checks whether or not the given object is in the context in any state other than Deleted. + This is a virtual method on this class so that it can be mocked. + + The entity. + true if the entity is in the context and not deleted; otherwise false. + + + + Saves all changes made in this context to the underlying database. + + The number of objects written to the underlying database. + + + + Initializes this instance, which means both the context is initialized and the underlying + database is initialized. + + + + + Initializes the underlying ObjectContext but does not cause the database to be initialized. + + + + + Marks the database as having not been initialized. This is called when the app calls Database.Delete so + that the database if the app attempts to then use the database again it will be re-initialized automatically. + + + + + Runs the unless it has already been run or there + is no initializer for this context type in which case this method does nothing. + + + + + Marks the database as having been initialized without actually running the . + + + + + Runs the if one has been set for this context type. + Calling this method will always cause the initializer to run even if the database is marked + as initialized. + + + + + Disposes the context. Override the DisposeContext method to perform + additional work when disposing. + + + + + Performs additional work to dispose a context. + + + + + Calls DetectChanges on the underlying if AutoDetectChangesEnabled is + true or if force is set to true. + + if set to true then DetectChanges is called regardless of the value of AutoDetectChangesEnabled. + + + + Returns the DbSet instance for the given entity type. + This property is virtual and returns to that it can be mocked. + + The entity type for which a set should be returned. + A set for the given entity type. + + + + Returns the non-generic instance for the given entity type. + This property is virtual and returns to that it can be mocked. + + The entity type for which a set should be returned. + A set for the given entity type. + + + + Creates an internal set using an app domain cached delegate. + + Type of the entity. + The set. + + + + Returns the entity set and the base type for that entity set for the given type. + This method does o-space loading if required and throws if the type is not in the model. + + The entity type to lookup. + The entity set and base type pair. + + + + Returns the entity set and the base type for that entity set for the given type if that + type is mapped in the model, otherwise returns null. + This method does o-space loading if required. + + The entity type to lookup. + The entity set and base type pair, or null if not found. + + + + Checks whether or not the given entity type is mapped in the model. + + The entity type to lookup. + True if the type is mapped as an entity; false otherwise. + + + + Gets the local entities of the type specified from the state manager. That is, all + Added, Modified, and Unchanged entities of the given type. + + The type of entity to get. + The entities. + + + + Executes the given SQL query against the database backing this context. The results are not materialized as + entities or tracked. + + The type of the element. + The SQL. + The parameters. + The query results. + + + + Executes the given SQL query against the database backing this context. The results are not materialized as + entities or tracked. + + Type of the element. + The SQL. + The parameters. + The query results. + + + + Calls the generic ExecuteSqlQuery but with a non-generic return type so that it + has the correct signature to be used with CreateDelegate above. + + + + + Executes the given SQL command against the database backing this context. + + The SQL. + The parameters. + The return value from the database. + + + + Gets the underlying for the given entity, or returns null if the entity isn't tracked by this context. + This method is virtual so that it can be mocked. + + The entity. + The state entry or null. + + + + Gets the underlying objects for all entities tracked by + this context. + This method is virtual so that it can be mocked. + + State entries for all tracked entities. + + + + Gets the underlying objects for all entities of the given + type tracked by this context. + This method is virtual so that it can be mocked. + + The type of the entity. + State entries for all tracked entities of the given type. + + + + Helper method that gets the underlying objects for all entities that + match the given predicate. + + + + + Wraps the given in either a or + a depending on the actual exception type and the state + entries involved. + + The update exception. + A new exception wrapping the given exception. + + + + Uses the underlying context to create an entity such that if the context is configured + to create proxies and the entity is suitable then a proxy instance will be returned. + This method is virtual so that it can be mocked. + + The type of the entity. + The new entity instance. + + + + Uses the underlying context to create an entity such that if the context is configured + to create proxies and the entity is suitable then a proxy instance will be returned. + This method is virtual so that it can be mocked. + + The type of entity to create. + The new entity instance. + + + + This method is used by CreateDelegate to transform the CreateObject method with return type TEntity + into a method with return type object which matches the required type of the delegate. + + + + + Replaces the connection that will be used by this context. + The connection can only be changed before the context is initialized. + + The new connection. + + + + Throws if the context has been disposed. + + + + + Checks whether or not the internal cache of types to entity sets has been initialized, + and initializes it if necessary. + + + + + Forces all DbSets to be initialized, which in turn causes o-space loading to happen + for any entity type for which we have a DbSet. This includes all DbSets that were + discovered on the user's DbContext type. + + + + + Performs o-space loading for the type and returns false if the type is not in the model. + + + + + Performs o-space loading for the type and throws if the type is not in the model. + + Type of the entity. + + + + Returns true if the given entity type does not have EdmEntityTypeAttribute but is in + an assembly that has EdmSchemaAttribute. This indicates mixing of POCO and EOCO in the + same assembly, which is something that we don't support. + + + + + Determines whether or not the given clrType is mapped to a complex type. Assumes o-space loading has happened. + + + + + Updates the cache of types to entity sets either for the first time or after potentially + doing some o-space loading. + + + + + The public context instance that owns this internal context. + + + + + Returns the underlying . + + + + + Gets the temp object context, or null if none has been set. + + The temp object context. + + + + The compiled model created from the Code First pipeline, or null if Code First was + not used to create this context. + Causes the Code First pipeline to be run to create the model if it has not already been + created. + + + + + Set to true when a database initializer is performing some actions, such as creating or deleting + a database, or seeding the database. + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + Gets or sets a value indicating whether lazy loading is enabled. + + + + + Gets or sets a value indicating whether proxy creation is enabled. + + + + + Gets or sets a value indicating whether DetectChanges is called automatically in the API. + + + + + Gets or sets a value indicating whether to validate entities when is called. + + + + + True if the context has been disposed. + + + + + The connection underlying this context. Accessing this property does not cause the context + to be initialized, only its connection. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries, + database intializers and connection strings. + + + + + Gets or sets the provider details to be used when building the EDM model. + + + + + Gets the name of the underlying connection string. + + + + + Gets the provider name bsing used either using a cached value or getting it from + the DbConnection in use. + + + + + Gets or sets a custom OnModelCreating action. + + + + + Gets the DatabaseOperations instance to use to perform Create/Delete/Exists operations + against the database. + Note that this virtual property can be mocked to help with unit testing. + + + + + Gets instance used to create validators and validation contexts. + This property is virtual to allow mocking. + + + + + For mocking. + + + + + Constructs an for an already existing . + + The owner . + The existing . + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Does nothing, since the already exists. + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Disposes the context. The underlying is also disposed if it is owned. + + + + + + + + Returns the underlying . + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + The connection underlying this context. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets a value indicating whether lazy loading is enabled. This is just a wrapper + over the same flag in the underlying . + + + + + Gets or sets a value indicating whether proxy creation is enabled. This is just a wrapper + over the same flag in the underlying ObjectContext. + + + + + An implementation of that represents a clone of another + dictionary. That is, all the property values have been been copied into this dictionary. + + + + + The internal class used to implement . + This internal class allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal context with which the entity of complex object is associated. + The type of the entity or complex object. + If set to true this is a dictionary for an entity, otherwise it is a dictionary for a complex object. + + + + Implemented by subclasses to get the dictionary item for a given property name. + Checking that the name is valid should happen before this method is called such + that subclasses do not need to perform the check. + + Name of the property. + An item for the given name. + + + + Creates an object of the underlying type for this dictionary and hydrates it with property + values from this dictionary. + + The properties of this dictionary copied into a new object. + + + + Creates an instance of the underlying type for this dictionary, which may either be an entity type (in which + case CreateObject on the context is used) or a non-entity type (in which case the empty constructor is used.) + In either case, app domain cached compiled delegates are used to do the creation. + + + + + Sets the values of this dictionary by reading values out of the given object. + The given object must be of the type that this dictionary is based on. + + The object to read values from. + + + + Creates a new dictionary containing copies of all the properties in this dictionary. + Changes made to the new dictionary will not be reflected in this dictionary and vice versa. + + A clone of this dictionary. + + + + Sets the values of this dictionary by reading values from another dictionary. + The other dictionary must be based on the same type as this dictionary, or a type derived + from the type for this dictionary. + + The dictionary to read values from. + + + + Gets the dictionary item for the property with the given name. + This method checks that the given name is valid. + + The property name. + The item. + + + + Sets the value of the property only if it is different from the current value and is not + an invalid attempt to set a complex property. + + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + Gets or sets the value of the property with the specified property name. + The value may be a nested instance of this class. + + The property name. + The value of the property. + + + + Gets the entity type of complex type that this dictionary is based on. + + The type of the object underlying this dictionary. + + + + Gets the internal context with which the underlying entity or complex type is associated. + + The internal context. + + + + Gets a value indicating whether the object for this dictionary is an entity or a complex object. + + true if this this is a dictionary for an entity; false if it is a dictionary for a complex object. + + + + Initializes a new instance of the class by copying + values from the given dictionary. + + The dictionary to clone. + If non-null, then the values for the new dictionary are taken from this record rather than from the original dictionary. + + + + Gets the dictionary item for a given property name. + + Name of the property. + An item for the given name. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + An implementation of for an item in a . + + + + + Represents an item in an representing a property name/value. + + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + true If this instance represents a complex property; otherwise, false. + + + + Gets the type of the underlying property. + + The property type. + + + + Initializes a new instance of the class. + + The name. + The value. + The type. + If set to true this item represents a complex property. + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + + true If this instance represents a complex property; otherwise, false. + + + + + Gets the type of the underlying property. + + The property type. + + + + An implementation of that is based on an existing + instance. + + + + + Initializes a new instance of the class. + + The internal context. + The type. + The data record. + If set to true this is a dictionary for an entity, otherwise it is a dictionary for a complex object. + + + + Gets the dictionary item for a given property name. + + Name of the property. + An item for the given name. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + An implementation of for an item in a . + + + + + Initializes a new instance of the class. + + The data record. + The ordinal. + The value. + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + + true If this instance represents a complex property; otherwise, false. + + + + + Gets the type of the underlying property. + + The property type. + + + + This is version of an internal interface that already exists in System.Data.Entity that + is implemented by . Using this interface allows state + entries to be mocked for unit testing. The plan is to remove this version of the + interface and use the one in System.Data.Entity once we roll into the framework. + Note that some members may need to be added to the interface in the framework when + we combine the two. + + + + + The internal class used to implement and + . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Base class for and + containing common code for collection and reference navigation property entries. + + + + + Base class for all internal entries that represent different kinds of properties. + + + + + Initializes a new instance of the class. + + The internal entity entry. + The member metadata. + + + + Validates this property. + + A sequence of validation errors for this property. Empty if no errors. Never null. + + + + Creates a new non-generic backed by this internal entry. + The actual subtype of the DbMemberEntry created depends on the metadata of this internal entry. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The actual subtype of the DbMemberEntry created depends on the metadata of this internal entry. + + The type of the entity. + The type of the property. + The new entry. + + + + Gets the property name. + The property is virtual to allow mocking. + + The property name. + + + + Gets or sets the current value of the navigation property. + + The current value. + + + + Gets the internal entity entry property belongs to. + This property is virtual to allow mocking. + + The internal entity entry. + + + + Gets the entry metadata. + + The entry metadata. + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Calls Load on the underlying . + + + + + Uses CreateSourceQuery on the underlying to create a query for this + navigation property. + + + + + Gets the navigation property value from the object. + + The entity. + The navigation property value. + + + + Validates that the owning entity entry is associated with an underlying and + is not just wrapping a non-attached entity. + If the entity is not detached, then the RelatedEnd for this navigation property is obtained. + + + + + Calls IsLoaded on the underlying . + + + + + Gets the related end, which will be null if the entity is not being tracked. + + The related end. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + This property is virtual so that it can be mocked. + + The current value. + + + + Gets a delegate that can be used to get the value of the property directly from the entity. + Returns null if the property does not have an accessible getter. + + The getter delegate, or null. + + + + Gets a delegate that can be used to set the value of the property directly on the entity. + Returns null if the property does not have an accessible setter. + + The setter delegate, or null. + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Gets the navigation property value from the object. + Since for a collection the related end is an , it means + that the internal representation of the navigation property is just the related end. + + The entity. + The navigation property value. + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Creates a new generic backed by this internal entry. + The actual subtype of the DbCollectionEntry created depends on the metadata of this internal entry. + + The type of the entity. + The type of the element. + The new entry. + + + + Creates a object for the given entity type + and collection element type. + + The type of the entity. + The type of the property. + Type of the element. + The set. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + + The current value. + + + + The internal class used to implement + and . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal context. + The state entry. + + + + Initializes a new instance of the class for an + entity which may or may not be attached to the context. + + The internal context. + The entity. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + + The store values. + + + + Appends a query for the properties in the entity to the given string builder that is being used to + build the eSQL query. This method may be called recursively to query for all the sub-properties of + a complex property. + + The query builder. + The qualifier with which to prefix each property name. + The dictionary that acts as a template for the properties to query. + + + + Validates that a dictionary can be obtained for the state of the entity represented by this entry. + + The method name being used to request a dictionary. + The state that is invalid for the request being processed. + + + + Calls Refresh with StoreWins on the underlying state entry. + + + + + Gets an internal object representing a reference navigation property. + This method is virtual to allow mocking. + + The navigation property. + The type of entity requested, which may be 'object' or null if any type can be accepted. + The entry. + + + + Gets an internal object representing a collection navigation property. + This method is virtual to allow mocking. + + The navigation property. + The type of entity requested, which may be 'object' or null f any type can be accepted. + The entry. + + + + Gets an internal object representing a navigation, scalar, or complex property. + This method is virtual to allow mocking. + + Name of the property. + The type of entity requested, which may be 'object' if any type can be accepted. + The entry. + + + + Gets an internal object representing a scalar or complex property. + This method is virtual to allow mocking. + + The property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Gets an internal object representing a scalar or complex property. + The property may be a nested property on the given . + + The parent property entry, or null if this is a property directly on the entity. + Name of the property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Gets an internal object representing a scalar or complex property. + The property may be a nested property on the given . + + The parent property entry, or null if this is a property directly on the entity. + Name of the property. + The property split out into its parts. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Checks that the given property name is a navigation property and is either a reference property or + collection property according to the value of requireCollection. + + + + + Gets metadata for the given property if that property is a navigation property or returns null + if it is not a navigation property. + + Name of the property. + Navigation property metadata or null. + + + + Gets the type of entity or entities at the target end of the given navigation property. + + The navigation property. + The CLR type of the entity or entities at the other end. + + + + Gets the related end for the navigation property with the given name. + + The navigation property. + + + + + Uses EDM metadata to validate that the property name exists in the model and represents a scalar or + complex property or exists in the CLR type. + This method is public and virtual so that it can be mocked. + + The property name. + The type on which the property is declared. + The type of object requested, which may be 'object' if any type can be accepted. + Metadata for the property. + + + + Splits the given property name into parts delimited by dots. + + Name of the property. + The parts of the name. + + + + Validates that this entry is associated with an underlying and + is not just wrapping a non-attached entity. + + + + + Validates entity represented by this entity entry. + This method is virtual to allow mocking. + + User defined dictionary containing additional info for custom validation. This parameter is optional and can be null. + containing validation result. Never null. + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the tracked entity. + This property is virtual to allow mocking. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + This property is virtual to allow mocking. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + This property is virtual to allow mocking. + + The original values. + + + + Checks whether or not this entry is associated with an underlying or + is just wrapping a non-attached entity. + + + + + Gets the type of the entity being tracked. + + The type of the entity. + + + + Gets the c-space entity type for this entity from the EDM. + + + + + Gets the underlying object state entry. + + + + + Gets the internal context. + + The internal context. + + + + A concrete implementation of used for properties of entities. + + + + + The internal class used to implement and + . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal entry. + The property info. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. If this is a property of an entity, then this method returns + true if the property is modified. If this is a property of a complex object, then + this method returns true if the top-level complex property on the entity is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + If this is a property of an entity, then this method marks it as modified. + If this is a property of a complex object, then this method marks the top-level + complex property as modified. + + + + + Throws if the user attempts to set a complex property to null. + + The value. + + + + Sets the given value directly onto the underlying entity object. + + The value. + True if the property had a setter that we could attempt to call; false if no setter was available. + + + + Sets the property value, potentially by setting individual nested values for a complex + property. + + The value. + + + + Gets an internal object representing a scalar or complex property of this property, + which must be a mapped complex property. + This method is virtual to allow mocking. + + The property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Validates that the owning entity entry is associated with an underlying and + is not just wrapping a non-attached entity. + + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent entity or complex property. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent entity or complex property. + That is, the original values that contains the value for this property. + + The parent original values. + + + + A delegate that reads the value of this property. + May be null if there is no way to set the value due to missing accessors on the type. + + + + + A delegate that sets the value of this property. + May be null if there is no way to set the value due to missing accessors on the type. + + + + + Gets or sets the original value. + Note that complex properties are returned as objects, not property values. + + + + + Gets or sets the current value. + Note that complex properties are returned as objects, not property values. + Also, for complex properties, the object returned is the actual complex object from the entity + and setting the complex object causes the actual object passed to be set onto the entity. + + The current value. + + + + Gets or sets a value indicating whether this property is modified. + + + + + Gets the property metadata. + + The property metadata. + + + + Initializes a new instance of the class. + + The internal entry. + The property info. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. Since this is a property of an entity this method returns + true if the property is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + Since this is a property of an entity this method marks it as modified. + + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent entity. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent entity. + That is, the original values that contains the value for this property. + + The parent original values. + + + + A concrete implementation of used for properties of complex objects. + + + + + Initializes a new instance of the class. + + The parent property entry. + The property metadata. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. Since this is a property of a complex object + this method returns true if the top-level complex property on the entity is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + Since this is a property of a complex object this method marks the top-level + complex property as modified. + + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent complex property. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent complex property. + That is, the original values that contains the value for this property. + + The parent original values. + + + + The internal class used to implement , + and . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Gets the navigation property value from the object. + For reference navigation properties, this means getting the value from the + object. + + The entity. + The navigation property value. + + + + Sets the navigation property value onto the object. + For reference navigation properties, this means setting the value onto the + object. + + The entity. + The value. + + + + Sets the given value on the given which must be an + . + This method is setup in such a way that it can easily be used by CreateDelegate without any + dynamic code generation needed. + + The type of the related entity. + The entity reference. + The value. + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + + The current value. + + + + Contains metadata about a member of an entity type or complex type. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry if the new entry is nested, otherwise null. + The new entry. + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets the name of the property. + + The name. + + + + Gets the type of the entity or complex object that on which the member is declared. + + The type that the member is declared on. + + + + Gets the type of element for the property, which for non-collection properties + is the same as the MemberType and which for collection properties is the type + of element contained in the collection. + + The type of the element. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + The types of member entries supported. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + if set to true this is a collection nav prop. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry which will always be null for navigation entries. + The new entry. + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + Contains metadata for a property of a complex object or entity. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + if set to true the property is mapped in the EDM. + if set to true the property is a complex property. + + + + Validates that the given name is a property of the declaring type (either on the CLR type or in the EDM) + and that it is a complex or scalar property rather than a nav property and then returns metadata about + the property. + + The internal context. + The type that the property is declared on. + The type of property requested, which may be 'object' if any type can be accepted. + Name of the property. + Metadata about the property, or null if the property does not exist or is a navigation property. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry if the new entry is nested, otherwise null. + The new entry. + + + + Gets a value indicating whether this is a complex property. + That is, not whether or not this is a property on a complex object, but rather if the + property itself is a complex property. + + + true if this instance is complex; otherwise, false. + + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets a value indicating whether this instance is mapped in the EDM. + + true if this instance is mapped; otherwise, false. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + An implementation of that wraps an existing set but makes + it read-only. + + + + + + Initializes a new instance of the class wrapped around + another existing set. + + The existing set. + + + + This is a temporary adapter class that wraps an and + presents it as an . This class will be removed once + we roll into the System.Data.Entity assembly. See + for more details. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given EntitySet and BaseType. + + + + + The EntitySet part of the pair. + + + + + The BaseType part of the pair. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given database initializer delegate and a flag + indicating whether or not it is locked. + + + + + The initializer delegate. + + + + + A flag indicating whether or not the initializer is locked and should not be changed. + + + + + Represents a raw SQL query against the context for any type where the results are never + associated with an entity set and are never tracked. + + + + + Represents a raw SQL query against the context that may be for entities in an entity set + or for some other non-entity element type. + + + + + Initializes a new instance of the class. + + The SQL. + The parameters. + + + + If the query is would track entities, then this method returns a new query that will + not track entities. + + A no-tracking query. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Gets the SQL query string, + + The SQL query. + + + + Gets the parameters. + + The parameters. + + + + Returns false. + + false. + + + + Initializes a new instance of the class. + + The internal context. + Type of the element. + The SQL. + The parameters. + + + + Returns this query since it can never be a tracking query. + + This instance. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Generic wrapper around to allow results to be + returned as generic + + The type of the element. + + + + Executes the query and returns an enumerator for the elements. + + An + + object that can be used to iterate through the elements. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Returns false. + + false. + + + + Represents a raw SQL query against the context for entities in an entity set. + + + + + Initializes a new instance of the class. + + The set. + The SQL. + if set to true then the entities will not be tracked. + The parameters. + + + + If the query is would track entities, then this method returns a new query that will + not track entities. + + A no-tracking query. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Gets a value indicating whether this instance is set to track entities or not. + + + true if this instance is no-tracking; otherwise, false. + + + + + A LazyInternalConnection object manages information that can be used to create a DbConnection object and + is responsible for creating that object and disposing it. + + + + + Creates a new LazyInternalConnection using convention to calculate the connection. + The DbConnection object will be created lazily on demand and will be disposed when the LazyInternalConnection is disposed. + + Either the database name or a connection string. + + + + Creates a new LazyInternalConnection targeting a specific database. + The DbConnection object will be created lazily on demand and will be disposed when the LazyInternalConnection is disposed. + + The connection to target. + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Disposes the underlying DbConnection. + Note that dispose actually puts the LazyInternalConnection back to its initial state such that + it can be used again. + + + + + + Searches the app.config/web.config file for a connection that matches the given name. + The connection might be a store connection or an EF connection. + + The connection name. + + True if a connection from the app.config file was found and used. + + + + Attempts to locate a connection entry in the configuration based on the supplied context name. + + The name to search for. + The configuration to search in. + Connection string if found, otherwise null. + + + + Initializes the connection based on a connection string. + + The settings to initialize from. + + + + Returns the underlying DbConnection, creating it first if it does not already exist. + + + + + Returns the origin of the underlying connection string. + + + + + Gets the name of the underlying connection string. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if connection contain model info; otherwise, false. + + + + Gets a value indicating if the lazy connection has been initialized. + + + + + A is a concrete type that will lazily create the + underlying when needed. The created is owned by the + internal context and will be disposed when the internal context is disposed. + + + + + Constructs a for the given owner that will be initialized + on first use. + + The owner . + Responsible for creating a connection lazily when the context is used for the first time. + The model, or null if it will be created by convention + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Saves all changes made in this context to the underlying database, but only if the + context has been initialized. If the context has not been initialized, then this + method does nothing because there is nothing to do; in particular, it does not + cause the context to be initialized. + + The number of objects written to the underlying database. + + + + Disposes the context. The underlying is also disposed. + The connection to the database ( object) is also disposed if it was created by + the context, otherwise it is not disposed. + + + + + + + + Initializes the underlying . + + + + + Creates an immutable, cacheable representation of the model defined by this builder. + This model can be used to create an or can be passed to a + constructor to create a for this model. + + + + + + Creates and configures the instance that will be used to build the + . + + The builder. + + + + Marks the database as having not been initialized. This is called when the app calls Database.Delete so + that the database if the app attempts to then use the database again it will be re-initialized automatically. + + + + + Marks the database as having been initialized without actually running the . + + + + + Runs the unless it has already been run or there + is no initializer for this context type in which case this method does nothing. + + + + + Performs some action (which may do nothing) in such a way that it is guaranteed only to be run + once for the model and connection in this app domain, unless it fails by throwing an exception, + in which case it will be re-tried next time the context is initialized. + + The action. + + + + Returns the underlying . + + + + + The compiled model created from the Code First pipeline, or null if Code First was + not used to create this context. + Causes the Code First pipeline to be run to create the model if it has not already been + created. + + + + + The actually being used, which may be the + temp context for initialization or the real context. + + + + + The connection underlying this context. Accessing this property does not cause the context + to be initialized, only its connection. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strings. + + + + + Gets the name of the underlying connection string. + + + + + Gets or sets the provider details to be used when building the EDM model. + + + + + + + + Gets or sets a custom OnModelCreating action. + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + Gets or sets a value indicating whether lazy loading is enabled. + If the exists, then this property acts as a wrapper over the flag stored there. + If the has not been created yet, then we store the value given so we can later + use it when we create the . This allows the flag to be changed, for example in + a DbContext constructor, without it causing the to be created. + + + + + Gets or sets a value indicating whether proxy creation is enabled. + If the ObjectContext exists, then this property acts as a wrapper over the flag stored there. + If the ObjectContext has not been created yet, then we store the value given so we can later + use it when we create the ObjectContext. This allows the flag to be changed, for example in + a DbContext constructor, without it causing the ObjectContext to be created. + + + + + A wrapping query provider that performs expression transformation and then delegates + to the provider. The objects returned are always instances + of . This provider is associated with generic objects. + + + + + Creates a provider that wraps the given provider. + + The provider to wrap. + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a . + + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a where T is determined + from the element type of the ObjectQuery. + + + + + By default, calls the same method on the wrapped provider. + + + + + By default, calls the same method on the wrapped provider. + + + + + Creates an appropriate generic IQueryable using Reflection and the underlying ElementType of + the given ObjectQuery. + + + + + Performs expression replacement and then delegates to the wrapped provider to create an + . + + + + + Wraps the given as a where T is determined + from the element type of the ObjectQuery. + + + + + Gets the internal context. + + The internal context. + + + + A LINQ expression visitor that finds uses with equivalent + instances. + + + + + Replaces calls to DbContext.Set() with an expression for the equivalent . + + The node to replace. + A new node, which may have had the replacement made. + + + + Replaces a or property with a constant expression + for the underlying . + + The node to replace. + A new node, which may have had the replacement made. + + + + Processes the fields in each constant expression and replaces instances with + the underlying ObjectQuery instance. This handles cases where the query has a closure + containing values. + + + + + Gets a value from the given member, or returns null + if the member doesn't contain a DbContext instance. + + The expression for the object for the member, which may be null for a static member. + The member. + The context or null. + + + + Gets the instance from the given instance or static member, returning null + if the member does not contain a DbContext instance. + + The member. + The value of the object to get the instance from, or null if the member is static. + The context instance or null. + + + + Takes a or and creates an expression + for the underlying . + + + + + Takes a or and extracts the underlying . + + + + + A non-generic interface implemented by that allows operations on + any query object without knowing the type to which it applies. + + + + + An interface implemented by . + + The type of the element. + + + + A non-generic interface implemented by that allows operations on + any set object without knowing the type to which it applies. + + + + + An interface implemented by . + + + + + An instance of this internal class is created whenever an instance of the public + class is needed. This allows the public surface to be non-generic, while the runtime type created + still implements . + + The type of the element. + + + + Creates a new query that will be backed by the given internal query object. + + The backing query. + + + + See comments in . + + + + + See comments in . + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the underlying internal query object. + + The internal query. + + + + An instance of this internal class is created whenever an instance of the public + class is needed. This allows the public surface to be non-generic, while the runtime type created + still implements . + + The type of the entity. + + + + Creates a new set that will be backed by the given internal set. + + The internal set. + + + + Creates an instance of this class. This method is used with CreateDelegate to cache a delegate + that can create a generic instance without calling MakeGenericType every time. + + + The internal set to wrap, or null if a new internal set should be created. + The set. + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the underlying internal query object. + + The internal query. + + + + Gets the underlying internal set. + + The internal set. + + + + See comments in . + + + + + An InternalQuery underlies every instance of DbSet and DbQuery. It acts to lazily initialize a InternalContext as well + as an ObjectQuery and EntitySet the first time that it is used. The InternalQuery also acts to expose necessary + information to other parts of the design in a controlled manner without adding a lot of internal methods and + properties to the DbSet and DbQuery classes themselves. + + The type of entity to query for. + + + + Creates a new query that will be backed by the given InternalContext. + + The backing context. + + + + Creates a new internal query based on the information in an existing query together with + a new underlying ObjectQuery. + + + + + Resets the query to its uninitialized state so that it will be re-lazy initialized the next + time it is used. This allows the ObjectContext backing a DbContext to be switched out. + + + + + Updates the underlying ObjectQuery with the given include path. + + The include path. + A new query containing the defined include path. + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Performs lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that the query can be used. + + + + + Returns a representation of the underlying query, equivalent + to ToTraceString on ObjectQuery. + + + The query string. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + The underlying InternalContext. + + + + + The underlying ObjectQuery. + + + + + The underlying ObjectQuery. + + + + + The LINQ query expression. + + + + + The LINQ query provider for the underlying . + + + + + The IQueryable element type. + + + + + Creates a new query that will be backed by the given InternalContext. + + The backing context. + + + + Resets the set to its uninitialized state so that it will be re-lazy initialized the next + time it is used. This allows the ObjectContext backing a DbContext to be switched out. + + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Finds an entity in the state manager with the given primary key values, or returns null + if no such entity can be found. This includes looking for Added entities with the given + key values. + + + + + Finds an entity in the store with the given primary key values, or returns null + if no such entity can be found. This code is adapted from TryGetObjectByKey to + include type checking in the query. + + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + This method is virtual so that it can be mocked. + + The entity to attach. + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + This method is virtual so that it can be mocked. + + The entity to add. + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + This method is virtual so that it can be mocked. + + The entity to remove. + + + + This method checks whether an entity is already in the context. If it is, then the state + is changed to the new state given. If it isn't, then the action delegate is executed to + either Add or Attach the entity. + + A delegate to Add or Attach the entity. + The new state to give the entity if it is already in the context. + The entity. + Name of the method. + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Performs lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that the query can be used. + This method is virtual so that it can be mocked. + + + + + Attempts to perform lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that o-space loading has happened and the query can be used. This method doesn't throw if the type + for the set is not mapped. + + + + + Creates an underlying for this set. + + if set to true then the query is set to be no-tracking. + The query. + + + + Returns a representation of the underlying query, equivalent + to ToTraceString on ObjectQuery. + + + The query string. + + + + + Updates the underlying ObjectQuery with the given include path. + + The include path. + A new query containing the defined include path. + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Executes the given SQL query against the database materializing entities into the entity set that + backs this set. + + The SQL quey. + if true then the entities are not tracked, otherwise they are. + The parameters. + The query results. + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the ObservableCollection representing the local view for the set based on this query. + + + + + The underlying ObjectQuery. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet name. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet name, quoted for ESQL. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet. Accessing this property will trigger lazy initialization of the query. + + + + + The base type for the underlying entity set. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying InternalContext. Accessing this property will trigger lazy initialization of the query. + + + + + The LINQ query expression. + + + + + The LINQ query provider for the underlying . + + + + + A wrapping query provider that performs expression transformation and then delegates + to the provider. The objects returned + are always instances of when the generic CreateQuery method is + used and are instances of when the non-generic CreateQuery method + is used. This provider is associated with non-generic objects. + + + + + Creates a provider that wraps the given provider. + + The provider to wrap. + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a . + + + + + Delegates to the wrapped provider except returns instances of . + + + + + Creates an appropriate generic IQueryable using Reflection and the underlying ElementType of + the given ObjectQuery. + + + + + Extends to create a sortable binding list that stays in + sync with an underlying . That is, when items are added + or removed from the binding list, they are added or removed from the ObservableCollecion, and + vice-versa. + + The list element type. + + + + An extended BindingList implementation that implements sorting. + This class was adapted from the LINQ to SQL class of the same name. + + The element type. + + + + Initializes a new instance of the class with the + the given underlying list. Note that sorting is dependent on having an actual + rather than some other ICollection implementation. + + The list. + + + + Applies sorting to the list. + + The property to sort by. + The sort direction. + + + + Stops sorting. + + + + + Gets a value indicating whether this list is sorted. + + + true if this instance is sorted; otherwise, false. + + + + + Gets the sort direction. + + The sort direction. + + + + Gets the sort property being used to sort. + + The sort property. + + + + Returns true indicating that this list supports sorting. + + true. + + + + Implements comparing for the implementation. + + + + + Initializes a new instance of the class + for sorting the list. + + The property to sort by. + The sort direction. + + + + Compares two instances of items in the list. + + The left item to compare. + The right item to compare. + + + + + Determines whether this instance can sort for the specified type. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Determines whether this instance can sort for the specified type using IComparable. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Determines whether this instance can sort for the specified type using ToString. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Initializes a new instance of a binding list backed by the given + + The obervable collection. + + + + Creates a new item to be added to the binding list. + + The new item. + + + + Cancels adding of a new item that was started with AddNew. + + Index of the item. + + + + Removes all items from the binding list and underlying ObservableCollection. + + + + + Ends the process of adding a new item that was started with AddNew. + + Index of the item. + + + + Inserts the item into the binding list at the given index. + + The index. + The item. + + + + Removes the item at the specified index. + + The index. + + + + Sets the item into the list at the given position. + + The index to insert at. + The item. + + + + Event handler to update the binding list when the underlying observable collection changes. + + The sender. + Data indicating how the collection has changed. + + + + Adds the item to the underlying observable collection. + + The item. + + + + Removes the item from the underlying from observable collection. + + The item. + + + + Adapted from to allow the initializer to take an input object and + to do one-time initialization that only has side-effects and doesn't return a value. + + The type of the input. + + + + Initializes a new instance of the class. + + The action. + + + + Performs the action unless it has already been successfully performed before. + + The input to the action; ignored if the action has already succeeded. + + + + Adapted from to allow the initializer to take an input object and + to retry initialization if it has previously failed. + + + This class can only be used to initialize reference types that will not be null when + initialized. + + The type of the input. + The type of the result. + + + + Initializes a new instance of the class. + + The value factory. + + + + Gets the value, possibly by running the initializer if it has not been run before or + if all previous times it ran resulted in exceptions. + + The input to the initializer; ignored if initialization has already succeeded. + The initialized object. + + + + Validates a property of a given EDM complex type. + + + This is a composite validator for a complex property of an entity. + + + + + Validates a property of a given EDM property type. + + + This is a composite validator for a property of an entity or a complex type. + + + + + Simple validators for the corresponding property. + + + + + Name of the property the validator was created for. + + + + + Creates an instance of for a given EDM property. + + The EDM property name. + Validators used to validate the given property. + + + + Validates a property. + + Validation context. Never null. + Property to validate. Never null. + Validation errors as . Empty if no errors. Never null. + + + + + Simple validators for the corresponding property. + + + + + Gets the name of the property the validator was created for. + + + + + The complex type validator. + + + + + Creates an instance of for a given complex property. + + The complex property name. + Validators used to validate the given property. + Complex type validator. + + + + Validates a complex property. + + Validation context. Never null. + Property to validate. Never null. + Validation errors as . Empty if no errors. Never null. + + + + + Validator used to validate a property of a given EDM ComplexType. + + + This is a composite validator. + + + + + Validator used to validate an entity of a given EDM Type. + + + This is a composite validator for an EDM Type. + + + + + Creates an instance for a given EDM type. + + Property validators. + Type level validators. + + + + Validates an instance. + + Entity validation context. Must not be null. + The entry for the complex property. Null if validating an entity. + instance. Never null. + + Protected so it doesn't appear on EntityValidator. + + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Returns a validator for a child property. + + Name of the child property for which to return a validator. + + Validator for a child property. Possibly null if there are no validators for requested property. + + + + + Creates an instance for a given EDM complex type. + + Property validators. + Type level validators. + + + + Validates an instance. + + Entity validation context. Must not be null. + The entry for the complex property. Null if validating an entity. + instance. Never null. + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Contains information needed to validate an entity or its properties. + + + + + The entity being validated or the entity that owns the property being validated. + + + + + Initializes a new instance of EntityValidationContext class. + + + The entity being validated or the entity that owns the property being validated. + + + External contexts needed for validation. + + + + + External context needed for validation. + + + + + Gets the entity being validated or the entity that owns the property being validated. + + + + + Validator used to validate an entity of a given EDM EntityType. + + + This is a top level, composite validator. This is also an entry point to getting an entity + validated as validation of an entity is always started by calling Validate method on this type. + + + + + Creates an instance for a given EDM entity type. + + Property validators. + Entity type level validators. + + + + Validates an entity. + + Entity validation context. Must not be null. + instance. Never null. + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Builds validators based on s specified on entity CLR types and properties + as well as based on presence of implementation on entity and complex + type CLR types. It's not sealed and not static for mocking purposes. + + + + + Builds an for the given . + + The entity entry to build the validator for. + Whether the currently processed type is the target type or one of the ancestor types. + + + for the given . Possibly null + if no validation has been specified for this entity type. + + + + + Builds the validator for a given and the corresponding + . + + The CLR type that corresponds to the EDM complex type. + The EDM complex type that type level validation is built for. + A for the given complex type. May be null if no validation specified. + + + + Extracted method from BuildEntityValidator and BuildComplexTypeValidator + + + + + Build validators for the and the corresponding + or . + + Properties to build validators for. + Non-navigation EDM properties. + Navigation EDM properties. + A list of validators. Possibly empty, never null. + + + + Builds a for the given and the corresponding + . If the property is a complex type, type level validators will be built here as + well. + + The CLR property to build the validator for. + The EDM property to build the validator for. + + for the given . Possibly null + if no validation has been specified for this property. + + + + + Builds a for the given transient . + + The CLR property to build the validator for. + + for the given . Possibly null + if no validation has been specified for this property. + + + + + Builds s for given that derive from + . + + Attributes used to build validators. + + A list of s built from . + Possibly empty, never null. + + + + + Returns all non-static non-indexed CLR properties from the . + + The CLR to get the properties from. + + A collection of CLR properties. Possibly empty, never null. + + + + + Builds validators based on the facets of : + * If .Nullable facet set to false adds a validator equivalent to the RequiredAttribute + * If the .MaxLength facet is specified adds a validator equivalent to the MaxLengthAttribute. + However the validator isn't added if .IsMaxLength has been set to true. + + The CLR property to build the facet validators for. + The property for which facet validators will be created + A collection of validators. + + + + Abstracts simple validators used to validate entities and properties. + + + + + Validates an entity or a property. + + Validation context. Never null. + Property to validate. Can be null for type level validation. + Validation error as. Empty if no errors. Never null. + + + + + Contract for IValidator.Validate method. + + Validation context. + Property. + Nothing - always throws. + + + + Validates entities or complex types implementing IValidatableObject interface. + + + + + Display attribute used to specify the display name for an entity or complex property. + + + + + Validates an entity or a complex type implementing IValidatableObject interface. + This method is virtual to allow mocking. + + Validation context. Never null. + + Property to validate. Null if this is the entity that will be validated. Never null if this + is the complex type that will be validated. + + Validation error as . Empty if no errors. Never null. + + + Note that is used to figure out what needs to be validated. If it not null the complex + type will be validated otherwise the entity will be validated. + Also if this is an IValidatableObject complex type but the instance (.CurrentValue) is null we won't validate + anything and will not return any errors. The reason for this is that Validation is supposed to validate using + information the user provided and not some additional implicit rules. (ObjectContext will throw for operations + that involve null complex properties). + + + + + Validates a property, complex property or an entity using validation attributes the property + or the complex/entity type is decorated with. + + + Note that this class is used for validating primitive properties using attributes declared on the property + (property level validation) and complex properties and entities using attributes declared on the type + (type level validation). + + + + + Display attribute used to specify the display name for a property or entity. + + + + + Validation attribute used to validate a property or an entity. + + + + + Creates an instance of class. + + + Validation attribute used to validate a property or an entity. + + + + + Validates a property or an entity. + + Validation context. Never null. + Property to validate. Null for entity validation. Not null for property validation. + + + Validation errors as . Empty if no errors, never null. + + + + + Used to cache and retrieve generated validators and to create context for validating entities or properties. + + + + + Collection of validators keyed by the entity CLR type. Note that if there's no validation for a given type + it will be associated with a null validator. + + + + + Initializes a new instance of class. + + + + + Returns a validator to validate . + + Entity the validator is requested for. + + to validate . Possibly null if no validation + has been specified for the entity. + + + + + Returns a validator to validate . + + Navigation property the validator is requested for. + + Validator to validate . Possibly null if no validation + has been specified for the requested property. + + + + + Gets a validator for the . + + Entity validator. + Property to get a validator for. + + Validator to validate . Possibly null if there is no validation for the + . + + + For complex properties this method walks up the type hierarchy to get to the entity level and then goes down + and gets a validator for the child property that is an ancestor of the property to validate. If a validator + returned for an ancestor is null it means that there is no validation defined beneath and the method just + propagates (and eventually returns) null. + + + + + Creates for . + + Entity entry for which a validation context needs to be created. + User defined dictionary containing additional info for custom validation. This parameter is optional and can be null. + An instance of class. + + + + + A wrapper around EntityKey that allows key/values pairs that have null values to + be used. This allows Added entities with null key values to be searched for in + the ObjectStateManager. + + + + The key name/key value pairs, where some key values may be null + + + + Creates a new WrappedEntityKey instance. + + The entity set that the key belongs to. + The fully qualified name of the given entity set. + The key values, which may be null or contain null values. + The name of the parameter passed for keyValue by the user, which is used when throwing exceptions. + + + + True if any of the key values are null, which means that the EntityKey will also be null. + + + + + An actual EntityKey, or null if any of the key values are null. + + + + + The key name/key value pairs of the key, in which some of the key values may be null. + + + + + Allows configuration to be performed for an complex type in a model. + + A ComplexTypeConfiguration can be obtained via the ComplexType method on + or a custom type derived from ComplexTypeConfiguration + can be registered via the Configurations property on . + + The complex type to be configured. + + + + Allows configuration to be performed for a type in a model. + + The type to be configured. + + + + Configures a property that is defined on this type. + + The type of the property being configured. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + The type of the property being configured. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Excludes a property from the model so that it will not be mapped to the database. + + The type of the property to be ignored. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + + + + Initializes a new instance of ComplexTypeConfiguration + + + + + Allows derived configuration classes for entities and complex types to be registered with a . + + + Derived configuration classes are created by deriving from + or and using a type to be included in the model as the generic + parameter. + + Configuration can be performed without creating derived configuration classes via the Entity and ComplexType + methods on . + + + + + Adds an to the . + Only one can be added for each type in a model. + + The entity type being configured. + The entity type configuration to be added. + The same ConfigurationRegistrar instance so that multiple calls can be chained. + + + + Adds an to the . + Only one can be added for each type in a model. + + The complex type being configured. + The complex type configuration to be added + The same ConfigurationRegistrar instance so that multiple calls can be chained. + + + + Allows the conventions used by a instance to be customized. + Currently removal of one or more default conventions is the only supported operation. + The default conventions can be found in the System.Data.Entity.ModelConfiguration.Conventions namespace. + + + + + Disables a convention for the . + The default conventions that are available for removal can be found in the System.Data.Entity.ModelConfiguration.Conventions namespace. + + The type of the convention to be disabled. + + + + Configures the table and column mapping for an entity type or a sub-set of properties from an entity type. + This configuration functionality is available via the Code First Fluent API, see . + + The entity type to be mapped. + + + + Configures the properties that will be included in this mapping fragment. + If this method is not called then all properties that have not yet been + included in a mapping fragment will be configured. + + An anonymous type including the properties to be mapped. + + A lambda expression to an anonymous type that contains the properties to be mapped. + C#: t => new { t.Id, t.Property1, t.Property2 } + VB.Net: Function(t) New With { p.Id, t.Property1, t.Property2 } + + + + + Re-maps all properties inherited from base types. + + When configuring a derived type to be mapped to a separate table this will cause all properties to + be included in the table rather than just the non-inherited properties. This is known as + Table per Concrete Type (TPC) mapping. + + + + + Configures the table name to be mapped to. + + Name of the table. + + + + Configures the table name and schema to be mapped to. + + Name of the table. + Schema of the table. + + + + Configures the discriminator column used to differentiate between types in an inheritance hierarchy. + + The name of the discriminator column. + A configuration object to further configure the discriminator column and values. + + + + Configures the discriminator condition used to differentiate between types in an inheritance hierarchy. + + The type of the property being used to discriminate between types. + + A lambda expression representing the property being used to discriminate between types. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object to further configure the discriminator condition. + + + + Moves a foreign key constraint from oldTable to newTable and updates column references + + + + + Move any FK constraints that are now completely in newTable and used to refer to oldColumn + + + + + Configures a condition used to discriminate between types in an inheritance hierarchy based on the values assigned to a property. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the condition to require a value in the property. + + Rows that do not have a value assigned to column that this property is stored in are + assumed to be of the base type of this entity type. + + + + + Populate the table mapping structure + + + + + Sets nullability for association set mappings' foreign keys for 1:* and 1:0..1 associations + when no base types share the the association set mapping's table + + + + + Makes sure only the required property mappings are present + + + + + Determines if the table and entity type need mapping, and if not, removes the existing entity type mapping + + + + + Configures a database column used to store a string values. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the column to allow the maximum length supported by the database provider. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + + Configures the column to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be variable length. + Columns are variable length by default. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be optional. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be required. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column. + + Name of the database provider specific data type. + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column. + + The order that this column should appear in the database table. + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to support Unicode string content. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the column supports Unicode string content. + + + Value indicating if the column supports Unicode string content or not. + Specifying 'null' will remove the Unicode facet from the column. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures a discriminator column used to differentiate between types in an inheritance hierarchy. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + Type of the discriminator value. + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + Type of the discriminator value. + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Initializes configurations in the ModelConfiguration so that configuration data + is in a single place + + + + + Configures a many relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be many:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:required with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:required without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:optional with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:optional without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures an optional relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be optional:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:required with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:required without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + + A lambda expression representing the navigation property on the other end of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + A configuration object that can be used to further configure the relationship. + + + + Configures an required relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be required:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:optional with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:optional without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required with a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required without a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required with a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required without a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + A configuration object that can be used to further configure the relationship. + + + + Base class for configuring a property on an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + True if the NavigationProperty's declaring type is the principal end, false if it is not, null if it is not known + + + + + Base class for performing configuration of a relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures a relationship that can support cascade on delete functionality. + + + + + Configures cascade delete to be on for the relationship. + + + + + Configures whether or not cascade delete is on for the relationship. + + Value indicating if cascade delete is on or not. + + + + Configures a relationship that can support foreign key properties that are exposed in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + The dependent entity type. + + + + Configures a relationship that can only support foreign key properties that are not exposed in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the relationship to use foreign key property(s) that are not exposed in the object model. + The column(s) and table can be customized by specifying a configuration action. + If an empty configuration action is specified then column name(s) will be generated by convention. + If foreign key properties are exposed in the object model then use the HasForeignKey method. + Not all relationships support exposing foreign key properties in the object model. + + Action that configures the foreign key column(s) and table. + + A configuration object that can be used to further configure the relationship. + + + + + Configures the relationship to use foreign key property(s) that are exposed in the object model. + If the foreign key property(s) are not exposed in the object model then use the Map method. + + The type of the key. + + A lambda expression representing the property to be used as the foreign key. + If the foreign key is made up of multiple properties then specify an anonymous type including the properties. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the principal entity type. + + A configuration object that can be used to further configure the relationship. + + + + Configures the table and column mapping of a relationship that does not expose foreign key properties in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the name of the column(s) for the foreign key. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table name that the foreign key column(s) reside in. + The table that is specified must already be mapped for the entity type. + + If you want the foreign key(s) to reside in their own table then use the Map method + on to perform + entity splitting to create the table with just the primary key property. Foreign keys can + then be added to the table via this method. + + Name of the table. + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table name and schema that the foreign key column(s) reside in. + The table that is specified must already be mapped for the entity type. + + If you want the foreign key(s) to reside in their own table then use the Map method + on to perform + entity splitting to create the table with just the primary key property. Foreign keys can + then be added to the table via this method. + + Name of the table. + Schema of the table. + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table and column mapping of a many:many relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the join table name for the relationship. + + Name of the table. + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the join table name and schema for the relationship. + + Name of the table. + Schema of the table. + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the column(s) for the left foreign key. + The left foreign key represents the navigation property specified in the HasMany call. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the column(s) for the right foreign key. + The right foreign key represents the navigation property specified in the WithMany call. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures a many:many relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the foreign key column(s) and table used to store the relationship. + + Action that configures the foreign key column(s) and table. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Used to configure a property with length facets for an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Used to configure a primitive property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to allow the maximum length supported by the database provider. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property and a default length will be used for the database column. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + Properties are variable length by default. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to allow the maximum length supported by the database provider. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + properties are variable length by default. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + properties are optional by default. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be a row version in the database. + The actual data type will vary depending on the database provider being used. + Setting the property to be a row version will automatically configure it to be an + optimistic concurrency token. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + properties are required by default. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the precision of the property. + If the database provider does not support precision for the data type of the column then the value is ignored. + + Precision of the property. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + properties are required by default. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the precision and scale of the property. + + The precision of the property. + The scale of the property. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to allow the maximum length supported by the database provider. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property and a default length will be used for the database column.. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + properties are variable length by default. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + properties are optional by default. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to support Unicode string content. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property supports Unicode string content. + + + Value indicating if the property supports Unicode string content or not. + Specifying 'null' will remove the Unicode facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Indicates what parts of a configuration are overridable. + + + + + Nothing in the configuration is overridable. + + + + + The configuration values related to C-Space are overridable. + + + + + The configuration values only related to S-Space are overridable. + + + + + True if this configuration can be replaced in the model configuration, false otherwise + This is only set to true for configurations that are registered automatically via the DbContext + + + + + Base class for conventions that process CLR attributes found in the model. + + The type of member to look for. + The type of the configuration to look for. + The type of the attribute to look for. + + + + Convention to process instances of found on properties in the model + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on foreign key properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on navigation properties in the model. + + + + + Convention to process instances of found on primitive properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to detect navigation properties to be inverses of each other when only one pair + of navigation properties exists between the related types. + + + + + Convention to configure a type as a complex type if it has no primary key, no mapped base type and no navigation properties. + + + + + Convention to convert any data types that were explicitly specified, via data annotations or API, + to be lower case. The default SqlClient provider is case sensitive and requires data types to be lower case. This convention + allows the and API to be case insensitive. + + + + + Convention to add a cascade delete to the join table from both tables involved in a many to many relationship. + + + + + Convention to ensure an invalid/unsupported mapping is not created when mapping inherited properties + + + + + Convention to set the table name to be a pluralized version of the entity type name. + + + + + Convention to set precision to 18 and scale to 2 for decimal properties. + + + + + Convention to move primary key properties to appear first. + + + + + Convention to distinguish between optional and required relationships based on CLR nullability of the foreign key property. + + + + + Convention to process instances of found on navigation properties in the model. + + + + + Convention to detect primary key properties. + Recognized naming patterns in order of precedence are: + 1. 'Id' + 2. [type name]Id + Primary key detection is case insensitive. + + + + + Convention to discover foreign key properties whose names are a combination + of the dependent navigation property name and the principal type primary key property name(s). + + + + + Convention to enable cascade delete for any required relationships. + + + + + Convention to configure the primary key(s) of the dependent entity type as foreign key(s) in a one:one relationship. + + + + + Convention to set the entity set name to be a pluralized version of the entity type name. + + + + + Convention to discover foreign key properties whose names match the principal type primary key property name(s). + + + + + Convention to set a default maximum length of 128 for properties whose type supports length facets. + + + + + Convention to set a default maximum length of 4000 for properties whose type supports length facets when SqlCe is the provider. + + + + + Convention to configure integer primary keys to be identity. + + + + + Checks for the PK property being an FK in a different table. A PK which is also an FK but + in the same table is used for table splitting and can still be an identity column because + the update pipeline is only inserting into one column of one table. + + + + + Convention to discover foreign key properties whose names are a combination + of the principal type name and the principal type primary key property name(s). + + + + + This class provide service for both the singularization and pluralization, it takes the word pairs + in the ctor following the rules that the first one is singular and the second one is plural. + + + + + Factory method for PluralizationService. Only support english pluralization. + Please set the PluralizationService on the System.Data.Entity.Design.EntityModelSchemaGenerator + to extend the service to other locales. + + CultureInfo + PluralizationService + + + + captalize the return word if the parameter is capitalized + if word is "Table", then return "Tables" + + + + + + + + separate one combine word in to two parts, prefix word and the last word(suffix word) + + + + + + + + return true when the word is "[\s]*" or leading or tailing with spaces + or contains non alphabetical characters + + + + + + + This method allow you to add word to internal PluralizationService of English. + If the singluar or the plural value was already added by this method, then an ArgumentException will be thrown. + + + + + + + Attempt to determine the principal and dependent ends of this association. + + The following table illustrates the solution space. + + Source | Target || Prin | Dep | + -------|--------||-------|-------| + 1 | 1 || - | - | + 1 | 0..1 || Sr | Ta | + 1 | * || Sr | Ta | + 0..1 | 1 || Ta | Sr | + 0..1 | 0..1 || - | - | + 0..1 | * || Sr | Ta | + * | 1 || Ta | Sr | + * | 0..1 || Ta | Sr | + * | * || - | - | + + + + + Allows configuration to be performed for an entity type in a model. + + An EntityTypeConfiguration can be obtained via the Entity method on + or a custom type derived from EntityTypeConfiguration + can be registered via the Configurations property on . + + + + + Initializes a new instance of EntityTypeConfiguration + + + + + Configures the primary key property(s) for this entity type. + + The type of the key. + + A lambda expression representing the property to be used as the primary key. + C#: t => t.Id + VB.Net: Function(t) t.Id + + If the primary key is made up of multiple properties then specify an anonymous type including the properties. + C#: t => new { t.Id1, t.Id2 } + VB.Net: Function(t) New With { t.Id1, t.Id2 } + + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures the entity set name to be used for this entity type. + The entity set name can only be configured for the base type in each set. + + The name of the entity set. + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures the table name that this entity type is mapped to. + + The name of the table. + + + + Configures the table name that this entity type is mapped to. + + The name of the table. + The database schema of the table. + + + + Allows advanced configuration related to how this entity type is mapped to the database schema. + By default, any configuration will also apply to any type derived from this entity type. + + Derived types can be configured via the overload of Map that configures a derived type or + by using an EntityTypeConfiguration for the derived type. + + The properties of an entity can be split between multiple tables using multiple Map calls. + + Calls to Map are additive, subsequent calls will not override configuration already preformed via Map. + + An action that performs configuration against an . + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Allows advanced configuration related to how a derived entity type is mapped to the database schema. + Calls to Map are additive, subsequent calls will not override configuration already preformed via Map. + + The derived entity type to be configured. + An action that performs configuration against an . + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures an optional relationship from this entity type. + Instances of the entity type will be able to be saved to the database without this relationship being specified. + The foreign key in the database will be nullable. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures a required relationship from this entity type. + Instances of the entity type will not be able to be saved to the database unless this relationship is specified. + The foreign key in the database will be non-nullable. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures a many relationship from this entity type. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Handles mapping from a CLR property to an EDM assocation and nav. prop. + + + + + Exception thrown by during model creation when an invalid model is generated. + + + + + Initializes a new instance of ModelValidationException + + + + + Initializes a new instance of ModelValidationException + + The exception message. + + + + Initializes a new instance of ModelValidationException + + The exception message. + The inner exception. + + + + Code Contracts hook methods - Called when contracts fail. Here we detect the most common preconditions + so we can throw the correct exceptions. It also means that we can write preconditions using the + simplest Contract.Requires() form. + + + + + Returns true if a variable of this type can be assigned a null value + + + + True if a reference type or a nullable value type, + false otherwise + + + + + Exception thrown from when validating entities fails. + + + + + Initializes a new instance of DbEntityValidationException + + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + Validation results. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + The inner exception. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + Validation results. + The inner exception. + + + + Subscribes the SerializeObjectState event. + + + + + Validation results. + + + + + Holds exception state that will be serialized when the exception is serialized. + + + + + Validation results. + + + + + Completes the deserialization. + + The deserialized object. + + + + Validation results. + + + + + Represents validation results for single entity. + + + + + Entity entry the results applies to. Never null. + + + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Creates an instance of class. + + + Entity entry the results applies to. Never null. + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Creates an instance of class. + + + Entity entry the results applies to. Never null. + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Gets an instance of the results applies to. + + + + + Gets validation errors. Never null. + + + + + Gets an indicator if the entity is valid. + + + + + Exception thrown from when an exception is thrown from the validation + code. + + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + The inner exception. + + + + Initializes a new instance of DbUnexpectedValidationException with the specified serialization info and + context. + + The serialization info. + The streaming context. + + + + Validation error. Can be either entity or property level validation error. + + + + + Name of the invalid property. Can be null (e.g. for entity level validations) + + + + + Validation error message. + + + + + Creates an instance of . + + Name of the invalid property. Can be null. + Validation error message. Can be null. + + + + Gets name of the invalid property. + + + + + Gets validation error message. + + + + diff --git a/Website/LOC.Core/bin/Debug/LOC.Core.dll b/Website/LOC.Core/bin/Debug/LOC.Core.dll new file mode 100644 index 000000000..84a13849c Binary files /dev/null and b/Website/LOC.Core/bin/Debug/LOC.Core.dll differ diff --git a/Website/LOC.Core/bin/Debug/LOC.Core.dll.config b/Website/LOC.Core/bin/Debug/LOC.Core.dll.config new file mode 100644 index 000000000..e4a04a17d --- /dev/null +++ b/Website/LOC.Core/bin/Debug/LOC.Core.dll.config @@ -0,0 +1,14 @@ + + + + +
+ + + + + + + + + \ No newline at end of file diff --git a/Website/LOC.Core/bin/Debug/LOC.Core.pdb b/Website/LOC.Core/bin/Debug/LOC.Core.pdb new file mode 100644 index 000000000..b5418e84e Binary files /dev/null and b/Website/LOC.Core/bin/Debug/LOC.Core.pdb differ diff --git a/Website/LOC.Core/bin/Debug/LinqKit.dll b/Website/LOC.Core/bin/Debug/LinqKit.dll new file mode 100644 index 000000000..c802265ad Binary files /dev/null and b/Website/LOC.Core/bin/Debug/LinqKit.dll differ diff --git a/Website/LOC.Core/bin/Debug/Newtonsoft.Json.dll b/Website/LOC.Core/bin/Debug/Newtonsoft.Json.dll new file mode 100644 index 000000000..dc9283f4c Binary files /dev/null and b/Website/LOC.Core/bin/Debug/Newtonsoft.Json.dll differ diff --git a/Website/LOC.Core/bin/Debug/Newtonsoft.Json.xml b/Website/LOC.Core/bin/Debug/Newtonsoft.Json.xml new file mode 100644 index 000000000..ee891563c --- /dev/null +++ b/Website/LOC.Core/bin/Debug/Newtonsoft.Json.xml @@ -0,0 +1,7343 @@ + + + + Newtonsoft.Json + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class with the specified . + + + + + Reads the next JSON token from the stream. + + true if the next token was read successfully; false if there are no more tokens to read. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Skips the children of the current token. + + + + + Sets the current token. + + The new token. + + + + Sets the current token and value. + + The new token. + The value. + + + + Sets the state based on current token type. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Releases unmanaged and - optionally - managed resources + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Changes the to Closed. + + + + + Gets the current reader state. + + The current reader state. + + + + Gets or sets a value indicating whether the underlying stream or + should be closed when the reader is closed. + + + true to close the underlying stream or when + the reader is closed; otherwise false. The default is true. + + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + Get or set how time zones are handling when reading JSON. + + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Gets the type of the current JSON token. + + + + + Gets the text value of the current JSON token. + + + + + Gets The Common Language Runtime (CLR) type for the current JSON token. + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Gets the path of the current JSON token. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Specifies the state of the reader. + + + + + The Read method has not been called. + + + + + The end of the file has been reached successfully. + + + + + Reader is at a property. + + + + + Reader is at the start of an object. + + + + + Reader is in an object. + + + + + Reader is at the start of an array. + + + + + Reader is in an array. + + + + + The Close method has been called. + + + + + Reader has just read a value. + + + + + Reader is at the start of a constructor. + + + + + Reader in a constructor. + + + + + An error occurred that prevents the read operation from continuing. + + + + + The end of the file has been reached successfully. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The reader. + + + + Initializes a new instance of the class. + + The stream. + if set to true the root object will be read as a JSON array. + The used when reading values from BSON. + + + + Initializes a new instance of the class. + + The reader. + if set to true the root object will be read as a JSON array. + The used when reading values from BSON. + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + + A . This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Changes the to Closed. + + + + + Gets or sets a value indicating whether binary data reading should compatible with incorrect Json.NET 3.5 written binary. + + + true if binary data reading will be compatible with incorrect Json.NET 3.5 written binary; otherwise, false. + + + + + Gets or sets a value indicating whether the root object will be read as a JSON array. + + + true if the root object will be read as a JSON array; otherwise, false. + + + + + Gets or sets the used when reading values from BSON. + + The used when reading values from BSON. + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Creates an instance of the JsonWriter class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the end of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the end of an array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end constructor. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes the end of the current Json object or array. + + + + + Writes the current token. + + The to read the token from. + + + + Writes the specified end token. + + The end token to write. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON without changing the writer's state. + + The raw JSON to write. + + + + Writes raw JSON where a value is expected and updates the writer's state. + + The raw JSON to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + An error will raised if the value cannot be written as a single JSON token. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Gets or sets a value indicating whether the underlying stream or + should be closed when the writer is closed. + + + true to close the underlying stream or when + the writer is closed; otherwise false. The default is true. + + + + + Gets the top. + + The top. + + + + Gets the state of the writer. + + + + + Gets the path of the writer. + + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling when writing JSON. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The writer. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Writes the end. + + The token. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes raw JSON where a value is expected and updates the writer's state. + + The raw JSON to write. + + + + Writes the beginning of a Json array. + + + + + Writes the beginning of a Json object. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Closes this stream and the underlying stream. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value that represents a BSON object id. + + + + + + Writes a BSON regex. + + The regex pattern. + The regex options. + + + + Gets or sets the used when writing values to BSON. + When set to no conversion will occur. + + The used when writing values to BSON. + + + + Represents a BSON Oid (object id). + + + + + Initializes a new instance of the class. + + The Oid value. + + + + Gets or sets the value of the Oid. + + The value of the Oid. + + + + Converts a binary value to and from a base 64 string value. + + + + + Converts an object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets the of the JSON produced by the JsonConverter. + + The of the JSON produced by the JsonConverter. + + + + Gets a value indicating whether this can read JSON. + + true if this can read JSON; otherwise, false. + + + + Gets a value indicating whether this can write JSON. + + true if this can write JSON; otherwise, false. + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Create a custom object + + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Creates an object which will then be populated by the serializer. + + Type of the object. + + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets a value indicating whether this can write JSON. + + + true if this can write JSON; otherwise, false. + + + + + Provides a base class for converting a to and from JSON. + + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an Entity Framework EntityKey to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an ExpandoObject to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets a value indicating whether this can write JSON. + + + true if this can write JSON; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON and BSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON and BSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an to and from its name string value. + + + Converts an to and from its name string value. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + A cached representation of the Enum string representation to respect per Enum field name. + + The type of the Enum. + A map of enum field name to either the field name, or the configured enum member name (). + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets or sets a value indicating whether the written enum text should be camel case. + + true if the written enum text will be camel case; otherwise, false. + + + + Specifies how constructors are used when initializing objects during deserialization by the . + + + + + First attempt to use the public default constructor, then fall back to single paramatized constructor, then the non-public default constructor. + + + + + Json.NET will use a non-public default constructor before falling back to a paramatized constructor. + + + + + Converts a to and from a string (e.g. "1.2.3.4"). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing property value of the JSON that is being converted. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Specifies how dates are formatted when writing JSON text. + + + + + Dates are written in the ISO 8601 format, e.g. "2012-03-21T05:40Z". + + + + + Dates are written in the Microsoft JSON format, e.g. "\/Date(1198908717056)\/". + + + + + Specifies how to treat the time value when converting between string and . + + + + + Treat as local time. If the object represents a Coordinated Universal Time (UTC), it is converted to the local time. + + + + + Treat as a UTC. If the object represents a local time, it is converted to a UTC. + + + + + Treat as a local time if a is being converted to a string. + If a string is being converted to , convert to a local time if a time zone is specified. + + + + + Time zone information should be preserved when converting. + + + + + Specifies formatting options for the . + + + + + No special formatting is applied. This is the default. + + + + + Causes child objects to be indented according to the and settings. + + + + + Instructs the to use the specified constructor when deserializing that object. + + + + + Represents a raw JSON string. + + + + + Represents a value in JSON (string, integer, date, etc). + + + + + Represents an abstract JSON token. + + + + + Represents a collection of objects. + + The type of token + + + + Gets the with the specified key. + + + + + + Provides an interface to enable a class to return line and position information. + + + + + Gets a value indicating whether the class can return line information. + + + true if LineNumber and LinePosition can be provided; otherwise, false. + + + + + Gets the current line number. + + The current line number or 0 if no line information is available (for example, HasLineInfo returns false). + + + + Gets the current line position. + + The current line position or 0 if no line information is available (for example, HasLineInfo returns false). + + + + Compares the values of two tokens, including the values of all descendant tokens. + + The first to compare. + The second to compare. + true if the tokens are equal; otherwise false. + + + + Adds the specified content immediately after this token. + + A content object that contains simple content or a collection of content objects to be added after this token. + + + + Adds the specified content immediately before this token. + + A content object that contains simple content or a collection of content objects to be added before this token. + + + + Returns a collection of the ancestor tokens of this token. + + A collection of the ancestor tokens of this token. + + + + Returns a collection of the sibling tokens after this token, in document order. + + A collection of the sibling tokens after this tokens, in document order. + + + + Returns a collection of the sibling tokens before this token, in document order. + + A collection of the sibling tokens before this token, in document order. + + + + Gets the with the specified key converted to the specified type. + + The type to convert the token to. + The token key. + The converted token value. + + + + Returns a collection of the child tokens of this token, in document order. + + An of containing the child tokens of this , in document order. + + + + Returns a collection of the child tokens of this token, in document order, filtered by the specified type. + + The type to filter the child tokens on. + A containing the child tokens of this , in document order. + + + + Returns a collection of the child values of this token, in document order. + + The type to convert the values to. + A containing the child values of this , in document order. + + + + Removes this token from its parent. + + + + + Replaces this token with the specified token. + + The value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Returns the indented JSON for this token. + + + The indented JSON for this token. + + + + + Returns the JSON for this token using the given formatting and converters. + + Indicates how the output is formatted. + A collection of which will be used when writing the token. + The JSON for this token using the given formatting and converters. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Creates an for this token. + + An that can be used to read this token and its descendants. + + + + Creates a from an object. + + The object that will be used to create . + A with the value of the specified object + + + + Creates a from an object using the specified . + + The object that will be used to create . + The that will be used when reading the object. + A with the value of the specified object + + + + Creates the specified .NET type from the . + + The new object created from the JSON value. + + + + Creates the specified .NET type from the using the specified . + + The that will be used when creating the object. + The new object created from the JSON value. + + + + Creates a from a . + + An positioned at the token to read into this . + + An that contains the token and its descendant tokens + that were read from the reader. The runtime type of the token is determined + by the token type of the first token encountered in the reader. + + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from a . + + An positioned at the token to read into this . + + An that contains the token and its descendant tokens + that were read from the reader. The runtime type of the token is determined + by the token type of the first token encountered in the reader. + + + + + Selects the token that matches the object path. + + + The object path from the current to the + to be returned. This must be a string of property names or array indexes separated + by periods, such as Tables[0].DefaultView[0].Price in C# or + Tables(0).DefaultView(0).Price in Visual Basic. + + The that matches the object path or a null reference if no matching token is found. + + + + Selects the token that matches the object path. + + + The object path from the current to the + to be returned. This must be a string of property names or array indexes separated + by periods, such as Tables[0].DefaultView[0].Price in C# or + Tables(0).DefaultView(0).Price in Visual Basic. + + A flag to indicate whether an error should be thrown if no token is found. + The that matches the object path. + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Creates a new instance of the . All child tokens are recursively cloned. + + A new instance of the . + + + + Gets a comparer that can compare two tokens for value equality. + + A that can compare two nodes for value equality. + + + + Gets or sets the parent. + + The parent. + + + + Gets the root of this . + + The root of this . + + + + Gets the node type for this . + + The type. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Gets the next sibling token of this node. + + The that contains the next sibling token. + + + + Gets the previous sibling token of this node. + + The that contains the previous sibling token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Get the first child token of this token. + + A containing the first child token of the . + + + + Get the last child token of this token. + + A containing the last child token of the . + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Creates a comment with the given value. + + The value. + A comment with the given value. + + + + Creates a string with the given value. + + The value. + A string with the given value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Indicates whether the current object is equal to another object of the same type. + + + true if the current object is equal to the parameter; otherwise, false. + + An object to compare with this object. + + + + Determines whether the specified is equal to the current . + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + + The parameter is null. + + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format. + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format provider. + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format. + The format provider. + + A that represents this instance. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. + + An object to compare with this instance. + + A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: + Value + Meaning + Less than zero + This instance is less than . + Zero + This instance is equal to . + Greater than zero + This instance is greater than . + + + is not the same type as this instance. + + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Gets the node type for this . + + The type. + + + + Gets or sets the underlying token value. + + The underlying token value. + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class. + + The raw json. + + + + Creates an instance of with the content of the reader's current token. + + The reader. + An instance of with the content of the reader's current token. + + + + Indicating whether a property is required. + + + + + The property is not required. The default state. + + + + + The property must be defined in JSON but can be a null value. + + + + + The property must be defined in JSON and cannot be a null value. + + + + + Contract details for a used by the . + + + + + Contract details for a used by the . + + + + + Gets the underlying type for the contract. + + The underlying type for the contract. + + + + Gets or sets the type created during deserialization. + + The type created during deserialization. + + + + Gets or sets whether this type contract is serialized as a reference. + + Whether this type contract is serialized as a reference. + + + + Gets or sets the default for this contract. + + The converter. + + + + Gets or sets the method called immediately after deserialization of the object. + + The method called immediately after deserialization of the object. + + + + Gets or sets the method called during deserialization of the object. + + The method called during deserialization of the object. + + + + Gets or sets the method called after serialization of the object graph. + + The method called after serialization of the object graph. + + + + Gets or sets the method called before serialization of the object. + + The method called before serialization of the object. + + + + Gets or sets the default creator method used to create the object. + + The default creator method used to create the object. + + + + Gets or sets a value indicating whether the default creator is non public. + + true if the default object creator is non-public; otherwise, false. + + + + Gets or sets the method called when an error is thrown during the serialization of the object. + + The method called when an error is thrown during the serialization of the object. + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets the object's properties. + + The object's properties. + + + + Gets or sets the property name resolver. + + The property name resolver. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the ISerializable object constructor. + + The ISerializable object constructor. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Get and set values for a using dynamic methods. + + + + + Provides methods to get and set values. + + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + Initializes a new instance of the class. + + The member info. + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + Provides data for the Error event. + + + + + Initializes a new instance of the class. + + The current object. + The error context. + + + + Gets the current object the error event is being raised against. + + The current object the error event is being raised against. + + + + Gets the error context. + + The error context. + + + + Represents a view of a . + + + + + Initializes a new instance of the class. + + The name. + Type of the property. + + + + When overridden in a derived class, returns whether resetting an object changes its value. + + + true if resetting the component changes its value; otherwise, false. + + The component to test for reset capability. + + + + + When overridden in a derived class, gets the current value of the property on a component. + + + The value of a property for a given component. + + The component with the property for which to retrieve the value. + + + + + When overridden in a derived class, resets the value for this property of the component to the default value. + + The component with the property value that is to be reset to the default value. + + + + + When overridden in a derived class, sets the value of the component to a different value. + + The component with the property value that is to be set. + The new value. + + + + + When overridden in a derived class, determines a value indicating whether the value of this property needs to be persisted. + + + true if the property should be persisted; otherwise, false. + + The component with the property to be examined for persistence. + + + + + When overridden in a derived class, gets the type of the component this property is bound to. + + + A that represents the type of component this property is bound to. When the or methods are invoked, the object specified might be an instance of this type. + + + + + When overridden in a derived class, gets a value indicating whether this property is read-only. + + + true if the property is read-only; otherwise, false. + + + + + When overridden in a derived class, gets the type of the property. + + + A that represents the type of the property. + + + + + Gets the hash code for the name of the member. + + + + The hash code for the name of the member. + + + + + Used to resolve references when serializing and deserializing JSON by the . + + + + + Resolves a reference to its object. + + The serialization context. + The reference to resolve. + The object that + + + + Gets the reference for the sepecified object. + + The serialization context. + The object to get a reference for. + The reference to the object. + + + + Determines whether the specified object is referenced. + + The serialization context. + The object to test for a reference. + + true if the specified object is referenced; otherwise, false. + + + + + Adds a reference to the specified object. + + The serialization context. + The reference. + The object to reference. + + + + Specifies reference handling options for the . + + + + + Do not preserve references when serializing types. + + + + + Preserve references when serializing into a JSON object structure. + + + + + Preserve references when serializing into a JSON array structure. + + + + + Preserve references when serializing. + + + + + Instructs the how to serialize the collection. + + + + + Instructs the how to serialize the object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets the id. + + The id. + + + + Gets or sets the title. + + The title. + + + + Gets or sets the description. + + The description. + + + + Gets or sets a value that indicates whether to preserve object reference data. + + + true to keep object reference; otherwise, false. The default is false. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a flag indicating whether the array can contain null items + + A flag indicating whether the array can contain null items. + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets a value indicating whether null items are allowed in the collection. + + true if null items are allowed in the collection; otherwise, false. + + + + Specifies default value handling options for the . + + + + + Include members where the member value is the same as the member's default value when serializing objects. + Included members are written to JSON. Has no effect when deserializing. + + + + + Ignore members where the member value is the same as the member's default value when serializing objects + so that is is not written to JSON, and ignores setting members when the JSON value equals the member's default value. + + + + + Members with a default value but no JSON will be set to their default value when deserializing. + + + + + Ignore members where the member value is the same as the member's default value when serializing objects + and sets members to their default value when deserializing. + + + + + Instructs the to use the specified when serializing the member or class. + + + + + Initializes a new instance of the class. + + Type of the converter. + + + + Gets the type of the converter. + + The type of the converter. + + + + Instructs the how to serialize the object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified member serialization. + + The member serialization. + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets the member serialization. + + The member serialization. + + + + Specifies the settings on a object. + + + + + Initializes a new instance of the class. + + + + + Gets or sets how reference loops (e.g. a class referencing itself) is handled. + + Reference loop handling. + + + + Gets or sets how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + Missing member handling. + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets or sets how null values are handled during serialization and deserialization. + + Null value handling. + + + + Gets or sets how null default are handled during serialization and deserialization. + + The default value handling. + + + + Gets or sets a collection that will be used during serialization. + + The converters. + + + + Gets or sets how object references are preserved by the serializer. + + The preserve references handling. + + + + Gets or sets how type name writing and reading is handled by the serializer. + + The type name handling. + + + + Gets or sets how a type name assembly is written and resolved by the serializer. + + The type name assembly format. + + + + Gets or sets how constructors are used during deserialization. + + The constructor handling. + + + + Gets or sets the contract resolver used by the serializer when + serializing .NET objects to JSON and vice versa. + + The contract resolver. + + + + Gets or sets the used by the serializer when resolving references. + + The reference resolver. + + + + Gets or sets the used by the serializer when resolving type names. + + The binder. + + + + Gets or sets the error handler called during serialization and deserialization. + + The error handler called during serialization and deserialization. + + + + Gets or sets the used by the serializer when invoking serialization callback methods. + + The context. + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling during serialization and deserialization. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Represents a reader that provides validation. + + + + + Initializes a new instance of the class that + validates the content returned from the given . + + The to read from while validating. + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. + + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Sets an event handler for receiving schema validation errors. + + + + + Gets the text value of the current Json token. + + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Gets the path of the current JSON token. + + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + + Gets the type of the current Json token. + + + + + + Gets the Common Language Runtime (CLR) type for the current Json token. + + + + + + Gets or sets the schema. + + The schema. + + + + Gets the used to construct this . + + The specified in the constructor. + + + + Compares tokens to determine whether they are equal. + + + + + Determines whether the specified objects are equal. + + The first object of type to compare. + The second object of type to compare. + + true if the specified objects are equal; otherwise, false. + + + + + Returns a hash code for the specified object. + + The for which a hash code is to be returned. + A hash code for the specified object. + The type of is a reference type and is null. + + + + Specifies the member serialization options for the . + + + + + All public members are serialized by default. Members can be excluded using or . + This is the default member serialization mode. + + + + + Only members must be marked with or are serialized. + This member serialization mode can also be set by marking the class with . + + + + + All public and private fields are serialized. Members can be excluded using or . + This member serialization mode can also be set by marking the class with . + + + + + Specifies how object creation is handled by the . + + + + + Reuse existing objects, create new objects when needed. + + + + + Only reuse existing objects. + + + + + Always create new objects. + + + + + Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Gets or sets the date time styles used when converting a date to and from JSON. + + The date time styles used when converting a date to and from JSON. + + + + Gets or sets the date time format used when converting a date to and from JSON. + + The date time format used when converting a date to and from JSON. + + + + Gets or sets the culture used when converting a date to and from JSON. + + The culture used when converting a date to and from JSON. + + + + Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing property value of the JSON that is being converted. + The calling serializer. + The object value. + + + + Converts XML to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The calling serializer. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Checks if the attributeName is a namespace attribute. + + Attribute name to test. + The attribute name prefix if it has one, otherwise an empty string. + True if attribute name is for a namespace attribute, otherwise false. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Gets or sets the name of the root element to insert when deserializing to XML if the JSON structure has produces multiple root elements. + + The name of the deserialize root element. + + + + Gets or sets a flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + true if the array attibute is written to the XML; otherwise, false. + + + + Gets or sets a value indicating whether to write the root JSON object. + + true if the JSON root object is omitted; otherwise, false. + + + + Represents a reader that provides fast, non-cached, forward-only access to JSON text data. + + + + + Initializes a new instance of the class with the specified . + + The TextReader containing the XML data to read. + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Changes the state to closed. + + + + + Gets a value indicating whether the class can return line information. + + + true if LineNumber and LinePosition can be provided; otherwise, false. + + + + + Gets the current line number. + + + The current line number or 0 if no line information is available (for example, HasLineInfo returns false). + + + + + Gets the current line position. + + + The current line position or 0 if no line information is available (for example, HasLineInfo returns false). + + + + + Instructs the to always serialize the member with the specified name. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified name. + + Name of the property. + + + + Gets or sets the null value handling used when serializing this property. + + The null value handling. + + + + Gets or sets the default value handling used when serializing this property. + + The default value handling. + + + + Gets or sets the reference loop handling used when serializing this property. + + The reference loop handling. + + + + Gets or sets the object creation handling used when deserializing this property. + + The object creation handling. + + + + Gets or sets the type name handling used when serializing this property. + + The type name handling. + + + + Gets or sets whether this property's value is serialized as a reference. + + Whether this property's value is serialized as a reference. + + + + Gets or sets the order of serialization and deserialization of a member. + + The numeric order of serialization or deserialization. + + + + Gets or sets the name of the property. + + The name of the property. + + + + Gets or sets a value indicating whether this property is required. + + + A value indicating whether this property is required. + + + + + Instructs the not to serialize the public field or public read/write property value. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Creates an instance of the JsonWriter class using the specified . + + The TextWriter to write to. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the specified end token. + + The end token to write. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + + + + + Gets or sets which character to use to quote attribute values. + + + + + Gets or sets which character to use for indenting when is set to Formatting.Indented. + + + + + Gets or sets a value indicating whether object names will be surrounded with quotes. + + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Gets the line number indicating where the error occurred. + + The line number indicating where the error occurred. + + + + Gets the line position indicating where the error occurred. + + The line position indicating where the error occurred. + + + + Gets the path to the JSON where the error occurred. + + The path to the JSON where the error occurred. + + + + Represents a collection of . + + + + + Provides methods for converting between common language runtime types and JSON types. + + + + + Represents JavaScript's boolean value true as a string. This field is read-only. + + + + + Represents JavaScript's boolean value false as a string. This field is read-only. + + + + + Represents JavaScript's null as a string. This field is read-only. + + + + + Represents JavaScript's undefined as a string. This field is read-only. + + + + + Represents JavaScript's positive infinity as a string. This field is read-only. + + + + + Represents JavaScript's negative infinity as a string. This field is read-only. + + + + + Represents JavaScript's NaN as a string. This field is read-only. + + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation using the specified. + + The value to convert. + The format the date will be converted to. + The time zone handling when the date is converted to a string. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation using the specified. + + The value to convert. + The format the date will be converted to. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + The string delimiter character. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Serializes the specified object to a JSON string. + + The object to serialize. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string. + + The object to serialize. + Indicates how the output is formatted. + + A JSON string representation of the object. + + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A JSON string representation of the object. + + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Deserializes the JSON to a .NET object. + + The JSON to deserialize. + The deserialized object from the Json string. + + + + Deserializes the JSON to a .NET object. + + The JSON to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The of object being deserialized. + The deserialized object from the Json string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + The deserialized object from the Json string. + + + + Deserializes the JSON to the given anonymous type. + + + The anonymous type to deserialize to. This can't be specified + traditionally and must be infered from the anonymous type passed + as a parameter. + + The JSON to deserialize. + The anonymous type object. + The deserialized anonymous type from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The object to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize to. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize to. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + + + Populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + + + Asynchronously populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous populate operation. + + + + + Serializes the XML node to a JSON string. + + The node to serialize. + A JSON string of the XmlNode. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + A JSON string of the XmlNode. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + Omits writing the root object. + A JSON string of the XmlNode. + + + + Deserializes the XmlNode from a JSON string. + + The JSON string. + The deserialized XmlNode + + + + Deserializes the XmlNode from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + The deserialized XmlNode + + + + Deserializes the XmlNode from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + + A flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + The deserialized XmlNode + + + + Serializes the to a JSON string. + + The node to convert to JSON. + A JSON string of the XNode. + + + + Serializes the to a JSON string. + + The node to convert to JSON. + Indicates how the output is formatted. + A JSON string of the XNode. + + + + Serializes the to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + Omits writing the root object. + A JSON string of the XNode. + + + + Deserializes the from a JSON string. + + The JSON string. + The deserialized XNode + + + + Deserializes the from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + The deserialized XNode + + + + Deserializes the from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + + A flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + The deserialized XNode + + + + The exception thrown when an error occurs during Json serialization or deserialization. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Serializes and deserializes objects into and from the JSON format. + The enables you to control how objects are encoded into JSON. + + + + + Initializes a new instance of the class. + + + + + Creates a new instance using the specified . + + The settings to be applied to the . + A new instance using the specified . + + + + Populates the JSON values onto the target object. + + The that contains the JSON structure to reader values from. + The target object to populate values onto. + + + + Populates the JSON values onto the target object. + + The that contains the JSON structure to reader values from. + The target object to populate values onto. + + + + Deserializes the Json structure contained by the specified . + + The that contains the JSON structure to deserialize. + The being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The type of the object to deserialize. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Occurs when the errors during serialization and deserialization. + + + + + Gets or sets the used by the serializer when resolving references. + + + + + Gets or sets the used by the serializer when resolving type names. + + + + + Gets or sets how type name writing and reading is handled by the serializer. + + + + + Gets or sets how a type name assembly is written and resolved by the serializer. + + The type name assembly format. + + + + Gets or sets how object references are preserved by the serializer. + + + + + Get or set how reference loops (e.g. a class referencing itself) is handled. + + + + + Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + + + + Get or set how null values are handled during serialization and deserialization. + + + + + Get or set how null default are handled during serialization and deserialization. + + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets or sets how constructors are used during deserialization. + + The constructor handling. + + + + Gets a collection that will be used during serialization. + + Collection that will be used during serialization. + + + + Gets or sets the contract resolver used by the serializer when + serializing .NET objects to JSON and vice versa. + + + + + Gets or sets the used by the serializer when invoking serialization callback methods. + + The context. + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling during serialization and deserialization. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Contains the LINQ to JSON extension methods. + + + + + Returns a collection of tokens that contains the ancestors of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the ancestors of every node in the source collection. + + + + Returns a collection of tokens that contains the descendants of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the descendants of every node in the source collection. + + + + Returns a collection of child properties of every object in the source collection. + + An of that contains the source collection. + An of that contains the properties of every object in the source collection. + + + + Returns a collection of child values of every object in the source collection with the given key. + + An of that contains the source collection. + The token key. + An of that contains the values of every node in the source collection with the given key. + + + + Returns a collection of child values of every object in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child values of every object in the source collection with the given key. + + The type to convert the values to. + An of that contains the source collection. + The token key. + An that contains the converted values of every node in the source collection with the given key. + + + + Returns a collection of converted child values of every object in the source collection. + + The type to convert the values to. + An of that contains the source collection. + An that contains the converted values of every node in the source collection. + + + + Converts the value. + + The type to convert the value to. + A cast as a of . + A converted value. + + + + Converts the value. + + The source collection type. + The type to convert the value to. + A cast as a of . + A converted value. + + + + Returns a collection of child tokens of every array in the source collection. + + The source collection type. + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child tokens of every array in the source collection. + + An of that contains the source collection. + The type to convert the values to. + The source collection type. + An that contains the converted values of every node in the source collection. + + + + Returns the input typed as . + + An of that contains the source collection. + The input typed as . + + + + Returns the input typed as . + + The source collection type. + An of that contains the source collection. + The input typed as . + + + + Represents a JSON constructor. + + + + + Represents a token that can contain other tokens. + + + + + Raises the event. + + The instance containing the event data. + + + + Raises the event. + + The instance containing the event data. + + + + Raises the event. + + The instance containing the event data. + + + + Returns a collection of the child tokens of this token, in document order. + + + An of containing the child tokens of this , in document order. + + + + + Returns a collection of the child values of this token, in document order. + + The type to convert the values to. + + A containing the child values of this , in document order. + + + + + Returns a collection of the descendant tokens for this token in document order. + + An containing the descendant tokens of the . + + + + Adds the specified content as children of this . + + The content to be added. + + + + Adds the specified content as the first children of this . + + The content to be added. + + + + Creates an that can be used to add tokens to the . + + An that is ready to have content written to it. + + + + Replaces the children nodes of this token with the specified content. + + The content. + + + + Removes the child nodes from this token. + + + + + Occurs when the list changes or an item in the list changes. + + + + + Occurs before an item is added to the collection. + + + + + Occurs when the items list of the collection has changed, or the collection is reset. + + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Get the first child token of this token. + + + A containing the first child token of the . + + + + + Get the last child token of this token. + + + A containing the last child token of the . + + + + + Gets the count of child JSON tokens. + + The count of child JSON tokens + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name. + + The constructor name. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets or sets the name of this constructor. + + The constructor name. + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a collection of objects. + + The type of token + + + + An empty collection of objects. + + + + + Initializes a new instance of the struct. + + The enumerable. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + + + + Determines whether the specified is equal to this instance. + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the with the specified key. + + + + + + Represents a JSON object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Gets an of this object's properties. + + An of this object's properties. + + + + Gets a the specified name. + + The property name. + A with the specified name or null. + + + + Gets an of this object's property values. + + An of this object's property values. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Creates a from an object. + + The object that will be used to create . + The that will be used to read the object. + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Adds the specified property name. + + Name of the property. + The value. + + + + Removes the property with the specified name. + + Name of the property. + true if item was successfully removed; otherwise, false. + + + + Tries the get value. + + Name of the property. + The value. + true if a value was successfully retrieved; otherwise, false. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Raises the event with the provided arguments. + + Name of the property. + + + + Raises the event with the provided arguments. + + Name of the property. + + + + Returns the properties for this instance of a component. + + + A that represents the properties for this component instance. + + + + + Returns the properties for this instance of a component using the attribute array as a filter. + + An array of type that is used as a filter. + + A that represents the filtered properties for this component instance. + + + + + Returns a collection of custom attributes for this instance of a component. + + + An containing the attributes for this object. + + + + + Returns the class name of this instance of a component. + + + The class name of the object, or null if the class does not have a name. + + + + + Returns the name of this instance of a component. + + + The name of the object, or null if the object does not have a name. + + + + + Returns a type converter for this instance of a component. + + + A that is the converter for this object, or null if there is no for this object. + + + + + Returns the default event for this instance of a component. + + + An that represents the default event for this object, or null if this object does not have events. + + + + + Returns the default property for this instance of a component. + + + A that represents the default property for this object, or null if this object does not have properties. + + + + + Returns an editor of the specified type for this instance of a component. + + A that represents the editor for this object. + + An of the specified type that is the editor for this object, or null if the editor cannot be found. + + + + + Returns the events for this instance of a component using the specified attribute array as a filter. + + An array of type that is used as a filter. + + An that represents the filtered events for this component instance. + + + + + Returns the events for this instance of a component. + + + An that represents the events for this component instance. + + + + + Returns an object that contains the property described by the specified property descriptor. + + A that represents the property whose owner is to be found. + + An that represents the owner of the specified property. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Occurs when a property value changes. + + + + + Occurs when a property value is changing. + + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets or sets the with the specified property name. + + + + + + Represents a JSON array. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Creates a from an object. + + The object that will be used to create . + The that will be used to read the object. + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Determines the index of a specific item in the . + + The object to locate in the . + + The index of if found in the list; otherwise, -1. + + + + + Inserts an item to the at the specified index. + + The zero-based index at which should be inserted. + The object to insert into the . + + is not a valid index in the . + The is read-only. + + + + Removes the item at the specified index. + + The zero-based index of the item to remove. + + is not a valid index in the . + The is read-only. + + + + Adds an item to the . + + The object to add to the . + The is read-only. + + + + Removes all items from the . + + The is read-only. + + + + Determines whether the contains a specific value. + + The object to locate in the . + + true if is found in the ; otherwise, false. + + + + + Removes the first occurrence of a specific object from the . + + The object to remove from the . + + true if was successfully removed from the ; otherwise, false. This method also returns false if is not found in the original . + + The is read-only. + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets or sets the at the specified index. + + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class. + + The token to read from. + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Initializes a new instance of the class writing to the given . + + The container being written to. + + + + Initializes a new instance of the class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end. + + The token. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Gets the token being writen. + + The token being writen. + + + + Represents a JSON property. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class. + + The property name. + The property content. + + + + Initializes a new instance of the class. + + The property name. + The property content. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets the property name. + + The property name. + + + + Gets or sets the property value. + + The property value. + + + + Gets the node type for this . + + The type. + + + + Specifies the type of token. + + + + + No token type has been set. + + + + + A JSON object. + + + + + A JSON array. + + + + + A JSON constructor. + + + + + A JSON object property. + + + + + A comment. + + + + + An integer value. + + + + + A float value. + + + + + A string value. + + + + + A boolean value. + + + + + A null value. + + + + + An undefined value. + + + + + A date value. + + + + + A raw JSON value. + + + + + A collection of bytes value. + + + + + A Guid value. + + + + + A Uri value. + + + + + A TimeSpan value. + + + + + Contains the JSON schema extension methods. + + + + + Determines whether the is valid. + + The source to test. + The schema to test with. + + true if the specified is valid; otherwise, false. + + + + + Determines whether the is valid. + + The source to test. + The schema to test with. + When this method returns, contains any error messages generated while validating. + + true if the specified is valid; otherwise, false. + + + + + Validates the specified . + + The source to test. + The schema to test with. + + + + Validates the specified . + + The source to test. + The schema to test with. + The validation event handler. + + + + Returns detailed information about the schema exception. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Gets the line number indicating where the error occurred. + + The line number indicating where the error occurred. + + + + Gets the line position indicating where the error occurred. + + The line position indicating where the error occurred. + + + + Gets the path to the JSON where the error occurred. + + The path to the JSON where the error occurred. + + + + Resolves from an id. + + + + + Initializes a new instance of the class. + + + + + Gets a for the specified id. + + The id. + A for the specified id. + + + + Gets or sets the loaded schemas. + + The loaded schemas. + + + + Specifies undefined schema Id handling options for the . + + + + + Do not infer a schema Id. + + + + + Use the .NET type name as the schema Id. + + + + + Use the assembly qualified .NET type name as the schema Id. + + + + + Returns detailed information related to the . + + + + + Gets the associated with the validation error. + + The JsonSchemaException associated with the validation error. + + + + Gets the path of the JSON location where the validation error occurred. + + The path of the JSON location where the validation error occurred. + + + + Gets the text description corresponding to the validation error. + + The text description. + + + + Represents the callback method that will handle JSON schema validation events and the . + + + + + Resolves member mappings for a type, camel casing property names. + + + + + Used by to resolves a for a given . + + + + + Used by to resolves a for a given . + + + + + Resolves the contract for a given type. + + The type to resolve a contract for. + The contract for a given type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + If set to true the will use a cached shared with other resolvers of the same type. + Sharing the cache will significantly performance because expensive reflection will only happen once but could cause unexpected + behavior if different instances of the resolver are suppose to produce different results. When set to false it is highly + recommended to reuse instances with the . + + + + + Resolves the contract for a given type. + + The type to resolve a contract for. + The contract for a given type. + + + + Gets the serializable members for the type. + + The type to get serializable members for. + The serializable members for the type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates the constructor parameters. + + The constructor to create properties for. + The type's member properties. + Properties for the given . + + + + Creates a for the given . + + The matching member property. + The constructor parameter. + A created for the given . + + + + Resolves the default for the contract. + + Type of the object. + + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Determines which contract type is created for the given type. + + Type of the object. + A for the given type. + + + + Creates properties for the given . + + The type to create properties for. + /// The member serialization mode for the type. + Properties for the given . + + + + Creates the used by the serializer to get and set values from a member. + + The member. + The used by the serializer to get and set values from a member. + + + + Creates a for the given . + + The member's parent . + The member to create a for. + A created for the given . + + + + Resolves the name of the property. + + Name of the property. + Name of the property. + + + + Gets a value indicating whether members are being get and set using dynamic code generation. + This value is determined by the runtime permissions available. + + + true if using dynamic code generation; otherwise, false. + + + + + Gets or sets the default members search flags. + + The default members search flags. + + + + Gets or sets a value indicating whether compiler generated members should be serialized. + + + true if serialized compiler generated members; otherwise, false. + + + + + Gets or sets a value indicating whether to ignore the interface when serializing and deserializing types. + + + true if the interface will be ignored when serializing and deserializing types; otherwise, false. + + + + + Gets or sets a value indicating whether to ignore the attribute when serializing and deserializing types. + + + true if the attribute will be ignored when serializing and deserializing types; otherwise, false. + + + + + Initializes a new instance of the class. + + + + + Resolves the name of the property. + + Name of the property. + The property name camel cased. + + + + The default serialization binder used when resolving and loading classes from type names. + + + + + When overridden in a derived class, controls the binding of a serialized object to a type. + + Specifies the name of the serialized object. + Specifies the name of the serialized object. + + The type of the object the formatter creates a new instance of. + + + + + When overridden in a derived class, controls the binding of a serialized object to a type. + + The type of the object the formatter creates a new instance of. + Specifies the name of the serialized object. + Specifies the name of the serialized object. + + + + Provides information surrounding an error. + + + + + Gets or sets the error. + + The error. + + + + Gets the original object that caused the error. + + The original object that caused the error. + + + + Gets the member that caused the error. + + The member that caused the error. + + + + Gets the path of the JSON location where the error occurred. + + The path of the JSON location where the error occurred. + + + + Gets or sets a value indicating whether this is handled. + + true if handled; otherwise, false. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets the of the collection items. + + The of the collection items. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the property name resolver. + + The property name resolver. + + + + Gets the of the dictionary keys. + + The of the dictionary keys. + + + + Gets the of the dictionary values. + + The of the dictionary values. + + + + Maps a JSON property to a .NET member or constructor parameter. + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Gets or sets the name of the property. + + The name of the property. + + + + Gets or sets the type that declared this property. + + The type that declared this property. + + + + Gets or sets the order of serialization and deserialization of a member. + + The numeric order of serialization or deserialization. + + + + Gets or sets the name of the underlying member or parameter. + + The name of the underlying member or parameter. + + + + Gets the that will get and set the during serialization. + + The that will get and set the during serialization. + + + + Gets or sets the type of the property. + + The type of the property. + + + + Gets or sets the for the property. + If set this converter takes presidence over the contract converter for the property type. + + The converter. + + + + Gets the member converter. + + The member converter. + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + + Gets a value indicating whether this is readable. + + true if readable; otherwise, false. + + + + Gets a value indicating whether this is writable. + + true if writable; otherwise, false. + + + + Gets the default value. + + The default value. + + + + Gets a value indicating whether this is required. + + A value indicating whether this is required. + + + + Gets a value indicating whether this property preserves object references. + + + true if this instance is reference; otherwise, false. + + + + + Gets the property null value handling. + + The null value handling. + + + + Gets the property default value handling. + + The default value handling. + + + + Gets the property reference loop handling. + + The reference loop handling. + + + + Gets the property object creation handling. + + The object creation handling. + + + + Gets or sets the type name handling. + + The type name handling. + + + + Gets or sets a predicate used to determine whether the property should be serialize. + + A predicate used to determine whether the property should be serialize. + + + + Gets or sets a predicate used to determine whether the property should be serialized. + + A predicate used to determine whether the property should be serialized. + + + + Gets or sets an action used to set whether the property has been deserialized. + + An action used to set whether the property has been deserialized. + + + + A collection of objects. + + + + + Initializes a new instance of the class. + + The type. + + + + When implemented in a derived class, extracts the key from the specified element. + + The element from which to extract the key. + The key for the specified element. + + + + Adds a object. + + The property to add to the collection. + + + + Gets the closest matching object. + First attempts to get an exact case match of propertyName and then + a case insensitive match. + + Name of the property. + A matching property if found. + + + + Gets a property by property name. + + The name of the property to get. + Type property name string comparison. + A matching property if found. + + + + Specifies missing member handling options for the . + + + + + Ignore a missing member and do not attempt to deserialize it. + + + + + Throw a when a missing member is encountered during deserialization. + + + + + Specifies null value handling options for the . + + + + + Include null values when serializing and deserializing objects. + + + + + Ignore null values when serializing and deserializing objects. + + + + + Specifies reference loop handling options for the . + + + + + Throw a when a loop is encountered. + + + + + Ignore loop references and do not serialize. + + + + + Serialize loop references. + + + + + An in-memory representation of a JSON Schema. + + + + + Initializes a new instance of the class. + + + + + Reads a from the specified . + + The containing the JSON Schema to read. + The object representing the JSON Schema. + + + + Reads a from the specified . + + The containing the JSON Schema to read. + The to use when resolving schema references. + The object representing the JSON Schema. + + + + Load a from a string that contains schema JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Parses the specified json. + + The json. + The resolver. + A populated from the string that contains JSON. + + + + Writes this schema to a . + + A into which this method will write. + + + + Writes this schema to a using the specified . + + A into which this method will write. + The resolver used. + + + + Returns a that represents the current . + + + A that represents the current . + + + + + Gets or sets the id. + + + + + Gets or sets the title. + + + + + Gets or sets whether the object is required. + + + + + Gets or sets whether the object is read only. + + + + + Gets or sets whether the object is visible to users. + + + + + Gets or sets whether the object is transient. + + + + + Gets or sets the description of the object. + + + + + Gets or sets the types of values allowed by the object. + + The type. + + + + Gets or sets the pattern. + + The pattern. + + + + Gets or sets the minimum length. + + The minimum length. + + + + Gets or sets the maximum length. + + The maximum length. + + + + Gets or sets a number that the value should be divisble by. + + A number that the value should be divisble by. + + + + Gets or sets the minimum. + + The minimum. + + + + Gets or sets the maximum. + + The maximum. + + + + Gets or sets a flag indicating whether the value can not equal the number defined by the "minimum" attribute. + + A flag indicating whether the value can not equal the number defined by the "minimum" attribute. + + + + Gets or sets a flag indicating whether the value can not equal the number defined by the "maximum" attribute. + + A flag indicating whether the value can not equal the number defined by the "maximum" attribute. + + + + Gets or sets the minimum number of items. + + The minimum number of items. + + + + Gets or sets the maximum number of items. + + The maximum number of items. + + + + Gets or sets the of items. + + The of items. + + + + Gets or sets the of properties. + + The of properties. + + + + Gets or sets the of additional properties. + + The of additional properties. + + + + Gets or sets the pattern properties. + + The pattern properties. + + + + Gets or sets a value indicating whether additional properties are allowed. + + + true if additional properties are allowed; otherwise, false. + + + + + Gets or sets the required property if this property is present. + + The required property if this property is present. + + + + Gets or sets the identity. + + The identity. + + + + Gets or sets the a collection of valid enum values allowed. + + A collection of valid enum values allowed. + + + + Gets or sets a collection of options. + + A collection of options. + + + + Gets or sets disallowed types. + + The disallow types. + + + + Gets or sets the default value. + + The default value. + + + + Gets or sets the extend . + + The extended . + + + + Gets or sets the format. + + The format. + + + + Generates a from a specified . + + + + + Generate a from the specified type. + + The type to generate a from. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + The used to resolve schema references. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + Specify whether the generated root will be nullable. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + The used to resolve schema references. + Specify whether the generated root will be nullable. + A generated from the specified type. + + + + Gets or sets how undefined schemas are handled by the serializer. + + + + + Gets or sets the contract resolver. + + The contract resolver. + + + + The value types allowed by the . + + + + + No type specified. + + + + + String type. + + + + + Float type. + + + + + Integer type. + + + + + Boolean type. + + + + + Object type. + + + + + Array type. + + + + + Null type. + + + + + Any type. + + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the object member serialization. + + The member object serialization. + + + + Gets the object's properties. + + The object's properties. + + + + Gets the constructor parameters required for any non-default constructor + + + + + Gets or sets the override constructor used to create the object. + This is set when a constructor is marked up using the + JsonConstructor attribute. + + The override constructor. + + + + Gets or sets the parametrized constructor used to create the object. + + The parametrized constructor. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Get and set values for a using reflection. + + + + + Initializes a new instance of the class. + + The member info. + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + When applied to a method, specifies that the method is called when an error occurs serializing an object. + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic that returns a result + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic, but uses one of the arguments for + the result. + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic, but uses one of the arguments for + the result. + + + + + Returns a Restrictions object which includes our current restrictions merged + with a restriction limiting our type + + + + + Represents a method that constructs an object. + + + + + Specifies type name handling options for the . + + + + + Do not include the .NET type name when serializing types. + + + + + Include the .NET type name when serializing into a JSON object structure. + + + + + Include the .NET type name when serializing into a JSON array structure. + + + + + Always include the .NET type name when serializing. + + + + + Include the .NET type name when the type of the object being serialized is not the same as its declared type. + + + + + Converts the value to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert the value to. + The converted type. + + + + Converts the value to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert the value to. + The converted value if the conversion was successful or the default value of T if it failed. + + true if initialValue was converted successfully; otherwise, false. + + + + + Converts the value to the specified type. If the value is unable to be converted, the + value is checked whether it assignable to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert or cast the value to. + + The converted type. If conversion was unsuccessful, the initial value + is returned if assignable to the target type. + + + + + Gets a dictionary of the names and values of an Enum type. + + + + + + Gets a dictionary of the names and values of an Enum type. + + The enum type to get names and values for. + + + + + Specifies the type of Json token. + + + + + This is returned by the if a method has not been called. + + + + + An object start token. + + + + + An array start token. + + + + + A constructor start token. + + + + + An object property name. + + + + + A comment. + + + + + Raw JSON. + + + + + An integer. + + + + + A float. + + + + + A string. + + + + + A boolean. + + + + + A null token. + + + + + An undefined token. + + + + + An object end token. + + + + + An array end token. + + + + + A constructor end token. + + + + + A Date. + + + + + Byte data. + + + + + Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Adds the elements of the specified collection to the specified generic IList. + + The list to add to. + The collection of elements to add. + + + + Returns the index of the first occurrence in a sequence by using a specified IEqualityComparer. + + The type of the elements of source. + A sequence in which to locate a value. + The object to locate in the sequence + An equality comparer to compare values. + The zero-based index of the first occurrence of value within the entire sequence, if found; otherwise, –1. + + + + Gets the type of the typed collection's items. + + The type. + The type of the typed collection's items. + + + + Gets the member's underlying type. + + The member. + The underlying type of the member. + + + + Determines whether the member is an indexed property. + + The member. + + true if the member is an indexed property; otherwise, false. + + + + + Determines whether the property is an indexed property. + + The property. + + true if the property is an indexed property; otherwise, false. + + + + + Gets the member's value on the object. + + The member. + The target object. + The member's value on the object. + + + + Sets the member's value on the target object. + + The member. + The target. + The value. + + + + Determines whether the specified MemberInfo can be read. + + The MemberInfo to determine whether can be read. + /// if set to true then allow the member to be gotten non-publicly. + + true if the specified MemberInfo can be read; otherwise, false. + + + + + Determines whether the specified MemberInfo can be set. + + The MemberInfo to determine whether can be set. + if set to true then allow the member to be set non-publicly. + if set to true then allow the member to be set if read-only. + + true if the specified MemberInfo can be set; otherwise, false. + + + + + Determines whether the string is all white space. Empty string will return false. + + The string to test whether it is all white space. + + true if the string is all white space; otherwise, false. + + + + + Nulls an empty string. + + The string. + Null if the string was null, otherwise the string unchanged. + + + + Specifies the state of the . + + + + + An exception has been thrown, which has left the in an invalid state. + You may call the method to put the in the Closed state. + Any other method calls results in an being thrown. + + + + + The method has been called. + + + + + An object is being written. + + + + + A array is being written. + + + + + A constructor is being written. + + + + + A property is being written. + + + + + A write method has not been called. + + + + diff --git a/Website/LOC.Core/bin/Debug/StructureMap.dll b/Website/LOC.Core/bin/Debug/StructureMap.dll new file mode 100644 index 000000000..28a17b021 Binary files /dev/null and b/Website/LOC.Core/bin/Debug/StructureMap.dll differ diff --git a/Website/LOC.Core/bin/Debug/StructureMap.pdb b/Website/LOC.Core/bin/Debug/StructureMap.pdb new file mode 100644 index 000000000..6c4dd1f78 Binary files /dev/null and b/Website/LOC.Core/bin/Debug/StructureMap.pdb differ diff --git a/Website/LOC.Core/bin/Debug/StructureMap.xml b/Website/LOC.Core/bin/Debug/StructureMap.xml new file mode 100644 index 000000000..6376709c4 --- /dev/null +++ b/Website/LOC.Core/bin/Debug/StructureMap.xml @@ -0,0 +1,3931 @@ + + + + StructureMap + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Get the object of type T that is valid for this build session. + + + + + + + Get the object of type T that is valid for this build session by name. + + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Register a default object for the given PluginType that will + be used throughout the rest of the current object request + + + + + + + Same as GetInstance, but can gracefully return null if + the Type does not already exist + + + + + + + Same as GetInstance(name), but can gracefully return null if + the Type and name does not already exist + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Gets all objects in the current object graph that can be cast + to T that have already been created + + + + + + + Creates/Resolves every configured instance of PlutinType T + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Gets a reference to the BuildStack for this build session + + + + + The concrete type of the immediate parent object in the object graph + + + + + Gets the root "frame" of the object request + + + + + The requested instance name of the object graph + + + + + Expression Builder that has grammars for defining policies at the + PluginType level. This expression is used for registering + open generic types + + + + + Convenience method that sets the default concrete type of the PluginType. The "concreteType" + can only accept types that do not have any primitive constructor arguments. + StructureMap has to know how to construct all of the constructor argument types. + + + + + + + Use this configured Instance as is + + + + + + Shorter way to call TheDefaultIsConcreteType + + + + + + + Shortcut to add a value by type + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Configure this type as the supplied value + + + + + + Sets the object creation of the instances of the PluginType. For example: PerRequest, + Singleton, ThreadLocal, HttpContext, or Hybrid + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Registers an IBuildInterceptor for this Plugin Type that executes before + any object of this PluginType is created. IBuildInterceptor's can be + used to create a custom scope + + + + + + + Convenience method to mark a PluginFamily as a Singleton + + + + + + Convenience method to mark a PluginFamily as a Hybrid lifecycle + + + + + + Convenience method to mark a PluginFamily as HttpContext scoped + + + + + + + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. You can also chain other declarations after + this method to add constructor and setter arguments + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type by a specified name. You can also chain other declarations after + this method to add constructor and setter arguments + + + + + + + + Specify the value of this explicit argument + + + + + + + Pass in additional arguments by type T + + + + + + + + Pass in additional arguments by type + + + + + + + + Pass in additional arguments by name + + + + + + + Gets the default instance of type T using the explicitly configured arguments from the "args" + + + + + + + Gets a named instance of type T using the explicitly configured arguments from teh "args" + + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + Gets all configured instances of type T using explicitly configured arguments + + + + + + + Returns the System.Reflection.ConstructorInfo for the PluggedType. Uses either + the "greediest" constructor with the most arguments or the constructor function + marked with the [DefaultConstructor] + + + + + + The InstanceKey of the default instance of the PluginFamily + + + + + The CLR Type that defines the "Plugin" interface for the PluginFamily + + + + + Add an Assembly to the scanning operation + + + + + + Add an Assembly by name to the scanning operation + + + + + + Add the currently executing Assembly to the scanning operation + + + + + Add the Assembly that contains type T to the scanning operation + + + + + + Add the Assembly that contains type to the scanning operation + + + + + + Sweep the designated path and add any Assembly's found in this folder to the + scanning operation + + + + + + Sweep the designated path and add any Assembly's found in this folder to the + scanning operation. The assemblyFilter can be used to filter or limit the + Assembly's that are picked up. + + + + + + + Sweep the application base directory of current app domain and add any Assembly's + found to the scanning operation. + + + + + Sweep the application base directory of current app domain and add any Assembly's + found to the scanning operation. The assemblyFilter can be used to filter or limit the + Assembly's that are picked up. + + + + + Adds an ITypeScanner object to the scanning operation + + + + + + Creates and adds a new ITypeScanner of type T to this scanning operation + + + + + + Directs the scanning operation to automatically detect and include any Registry + classes found in the Assembly's being scanned + + + + + Add all concrete types of the Plugin Type as Instances of Plugin Type + + + + + + Add all concrete types of the Plugin Type as Instances of Plugin Type + + + + + + Makes this scanning operation ignore all [PluginFamily] and [Pluggable] attributes + + + + + Exclude types that match the Predicate from being scanned + + + + + + Exclude all types in this nameSpace or its children from the scanning operation + + + + + + Exclude all types in this nameSpace or its children from the scanning operation + + + + + + Only include types matching the Predicate in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Only include types from this nameSpace or its children in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Only include types from this nameSpace or its children in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Exclude this specific type from the scanning operation + + + + + + Adds a registration convention to be applied to all the types in this + logical "scan" operation + + + + + + Adds a registration convention to be applied to all the types in this + logical "scan" operation + + + + + Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete + class named "Something" that implements "ISomething" will be automatically + added to PluginType "ISomething" + + + + + Scans for PluginType's and Concrete Types that close the given open generic type + + + + + + + + + Automatically registers all concrete types without primitive arguments + against its first interface, if any + + + + + Directs the scanning to automatically register any type that is the single + implementation of an interface against that interface. + The filters apply + + + + + Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete + class named "Something" that implements "ISomething" will be automatically + added to PluginType "ISomething" + + + + + Scans for PluginType's and Concrete Types that close the given open generic type + + + + + + + + + Automatically registers all concrete types without primitive arguments + against its first interface, if any + + + + + Directs the scanning to automatically register any type that is the single + implementation of an interface against that interface. + The filters apply + + + + + A TypeInterceptor that is only applied if the MatchesType() + method is true for a given Type + + + + + An InstanceInterceptor can be registered on a per-Instance basis + to act on, or even replace, the object that is created before + it is passed back to the caller. This is primarily a hook + for runtime AOP scenarios. + + + + + Does this TypeInterceptor apply to the given type? + + + + + + + Specify how objects matching the Type predicate + will be intercepted + + + + + + Specify how objects matching the Type predicate + will be intercepted + + + + + + Used for auto-mocking container. When the factory is missing, we can generate a mock for it + + + + + An Instance class that builds objects by calling a constructor function on a concrete type + and filling setter properties. ConfiguredInstance should only be used for open generic types. + Favor SmartInstance{T} for all other usages. + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE + + + + + + + Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE + + + + + + + Inline definition of a constructor or a setter property dependency + + + + + + + Starts the definition of a child instance specifying the argument name + in the case of a constructor function that consumes more than one argument + of type T + + + + + + + + Inline definition of a constructor dependency + + + + + + + + Inline definition of a setter dependency + + + + + + + + Start the definition of a primitive argument to a constructor argument + + + + + + + Configure a primitive constructor argument + + + + + + + Configures an array of Instance's for the array dependency + + + + + + + Part of the Fluent Interface, represents a nonprimitive argument to a + constructure function + + + + + Use a previously configured and named instance for the child + + + + + + + Start the definition of a child instance by defining the concrete type + + + + + + + Start the definition of a child instance by defining the concrete type + + + + + + + Registers a configured instance to use as the argument to the parent's + constructor + + + + + + + Directs StructureMap to fill this dependency with the Default Instance of the + constructor or property type + + + + + + Base class for many of the Instance subclasses to support + method chaining in the Registry DSL for common options + + + + + + Set the name of this Instance + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + + Register an InstanceInterceptor with this Instance + + + + + + + Used to override the constructor of a class to be used by StructureMap to create + a Pluggable object + + + + + Examines a System.Type object and determines the ConstructorInfo to use in creating + instances of the Type + + + + + + + Used to implicitly mark a class as a Plugin candidate for StructureMap + + + + + Determines whether a Type object is marked as Pluggable + + + + + + + The ConcreteKey alias of the Type + + + + + Declares a class, abstract class, or interface to be the target of a PluginFamily in the container + + + + + Determines if a Type object is marked as a PluginFamily + + + + + + + If set, determines the shared "scope" of the instance -- PerRequest, Singleton, ThreadLocal, + HttpContext, etc. + + + + + InstanceKey of the default instance. Used to implicitly define the default without + declaring the instance in StructureMap.config + + + + + Declares the target to be built by StructureMap as a Singleton. One object instance will + be created for each named instance + + + + + Marks a Property in a Pluggable class as filled by setter injection + + + + + Marks a method with no parameters as a method that validates an instance. StructureMap + uses this method to validate the configuration file. If the method does not throw an + exception, the object is assumed to be valid. + + + + + Returns an array of any MethodInfo's on a Type that are marked as ValidationMethod + + CLR Type to search for validation methods + + + + + Constants for the names of Xml nodes and attributes in the StructureMap.config + file + + + + + The name of the default configuration file. The value is always StructurMap.config + + + + + Returns the absolute path to the StructureMap.config file + + + + + + Expression Builder that has grammars for defining policies at the + PluginType level + + + + + Add multiple Instance's to this PluginType + + + + + + + Conditional binding of instances + + + + + + + Access to all of the uncommon Instance types + + + + + + + Access to all of the uncommon Instance types + + + + + + + Convenience method that sets the default concrete type of the PluginType. Type T + can only accept types that do not have any primitive constructor arguments. + StructureMap has to know how to construct all of the constructor argument types. + + + + + + + + Shorthand to say TheDefault.Is.ConstructedBy(func) + + + + + + + Shorthand to say TheDefault.Is.ConstructedBy(func) + + + + + + + Shorthand to say TheDefault.IsThis(@object) + + + + + + + Sets the object creation of the instances of the PluginType. For example: PerRequest, + Singleton, ThreadLocal, HttpContext, or Hybrid + + + + + + + Convenience method to mark a PluginFamily as a Singleton + + + + + + Convenience method to mark a PluginFamily as a Transient + + + + + + Convenience method to mark a PluginFamily as a Hybrid lifecycle + + + + + + Convenience method to mark a PluginFamily as HttpContext scoped + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Adds an Interceptor to only this PluginType + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Registers an ILifecycle for this Plugin Type that executes before + any object of this PluginType is created. ILifecycle's can be + used to create a custom scope + + + + + + + Largely deprecated and unnecessary with the ability to add Xml configuration files + + + + + + + Forces StructureMap to always use a unique instance to + stop the "BuildSession" caching + + + + + + Adds the object to to the PLUGINTYPE + + + + + + + Add an Instance to this type created by a Lambda + + + + + + + Define the Default Instance for this PluginType + + + + + Expression class to help define a runtime Profile + + + + + Starts the definition of the default instance for the containing Profile. This is + still valid, but Type() is recommended + + + + + + + Designate or define the Instance for a type within + this Profile + + + + + + + Use statement to define the Profile defaults for a Generic type + + + + + + + Expression Builder inside of a Profile creation for + open generic types + + + + + Use this concreteType for the Instance of this Profile for the PluginType + + + + + + + Use this concreteType for the Instance of this Profile for the PluginType + + + + + + + Use this Instance for the Profile Instance of this Plugin Type + + + + + + + Use the named Instance as the Profile Instance for this PluginType + + + + + + + Use the named Instance as the Profile Instance for this PluginType + + + + + + + For this type and profile, build the object with this Lambda + + + + + + + Expression Builder within defining a Profile + + + + + + Use a named, preconfigured instance as the default instance for this profile + + + + + + + Use a named, preconfigured instance as the default instance for this profile + + + + + + + Define the default instance of the PluginType for the containing Profile + + + + + + + For this Profile, use an Instance with this Func + + + + + + + For this Profile, use an Instance with this Func + + + + + + + For this Profile, use this object + + + + + + + Access to the uncommon types of Instance + + + + + + For this Profile, use the Concrete Type + + + + + + + For this profile, use this concrete type + + + + + + + A Registry class provides methods and grammars for configuring a Container or ObjectFactory. + Using a Registry subclass is the recommended way of configuring a StructureMap Container. + + + public class MyRegistry : Registry + { + public MyRegistry() + { + ForRequestedType(typeof(IService)).TheDefaultIsConcreteType(typeof(Service)); + } + } + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Imports the configuration from another registry into this registry. + + + + + + Imports the configuration from another registry into this registry. + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + This method is a shortcut for specifying the default constructor and + setter arguments for a ConcreteType. ForConcreteType is shorthand for: + ForRequestedType[T]().Use[T].************** + when the PluginType and ConcreteType are the same Type + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Convenience method. Equivalent of ForRequestedType[PluginType]().AsSingletons() + + + + + + + Uses the configuration expressions of this Registry to create a PluginGraph + object that could be used to initialize a Container. This method is + mostly for internal usage, but might be helpful for diagnostics + + + + + + Adds an additional, non-Default Instance to the PluginType T. + + + + + + + Adds an additional, non-Default Instance to the designated pluginType + This method is mostly meant for open generic types + + + + + + + Expression Builder to define the defaults for a named Profile. Each call + to CreateProfile is additive. + + + + + + + An alternative way to use CreateProfile that uses ProfileExpression + as a Nested Closure. This usage will result in cleaner code for + multiple declarations + + + + + + + Registers a new TypeInterceptor object with the Container + + + + + + Allows you to define a TypeInterceptor inline with Lambdas or anonymous delegates + + + + + IfTypeMatches( ... ).InterceptWith( o => new ObjectWrapper(o) ); + + + + + Designates a policy for scanning assemblies to auto + register types + + + + + + Directs StructureMap to always inject dependencies into any and all public Setter properties + of the type PLUGINTYPE. + + + + + + + Creates automatic "policies" for which public setters are considered mandatory + properties by StructureMap that will be "setter injected" as part of the + construction process. + + + + + + Use to programmatically select the constructor function of a concrete + class. Applies globally to all Containers in a single AppDomain. + + + + + + + All requests For the "TO" types will be filled by fetching the "FROM" + type and casting it to "TO" + GetInstance(typeof(TO)) basically becomes (TO)GetInstance(typeof(FROM)) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( @object ) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( instance ) + + + + + + + + Shorthand for ForRequestedType(pluginType) + + + + + + + + Advanced Usage Only! Skips the Registry and goes right to the inner + Semantic Model of StructureMap. Use with care + + + + + + Adds the concreteType as an Instance of the pluginType. Mostly useful + for conventions + + + + + + + Adds the concreteType as an Instance of the pluginType with a name. Mostly + useful for conventions + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType. + Mostly useful for conventions + + + + + + Imports the configuration from another registry into this registry. + + + + + + Imports the configuration from another registry into this registry. + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + This method is a shortcut for specifying the default constructor and + setter arguments for a ConcreteType. ForConcreteType is shorthand for: + For[T]().Use[T].************** + when the PluginType and ConcreteType are the same Type + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Convenience method. Equivalent of ForRequestedType[PluginType]().Singletons() + + + + + + + Uses the configuration expressions of this Registry to create a PluginGraph + object that could be used to initialize a Container. This method is + mostly for internal usage, but might be helpful for diagnostics + + + + + + Adds an additional, non-Default Instance to the PluginType T. + + + + + + + Adds an additional, non-Default Instance to the designated pluginType + This method is mostly meant for open generic types + + + + + + + Expression Builder to define the defaults for a named Profile. Each call + to CreateProfile is additive. + + + + + + + An alternative way to use CreateProfile that uses ProfileExpression + as a Nested Closure. This usage will result in cleaner code for + multiple declarations + + + + + + + Registers a new TypeInterceptor object with the Container + + + + + + Allows you to define a TypeInterceptor inline with Lambdas or anonymous delegates + + + + + IfTypeMatches( ... ).InterceptWith( o => new ObjectWrapper(o) ); + + + + + Designates a policy for scanning assemblies to auto + register types + + + + + + Directs StructureMap to always inject dependencies into any and all public Setter properties + of the type PLUGINTYPE. + + + + + + + Creates automatic "policies" for which public setters are considered mandatory + properties by StructureMap that will be "setter injected" as part of the + construction process. + + + + + + Use to programmatically select the constructor function of a concrete + class. Applies globally to all Containers in a single AppDomain. + + + + + + + All requests For the "TO" types will be filled by fetching the "FROM" + type and casting it to "TO" + GetInstance(typeof(TO)) basically becomes (TO)GetInstance(typeof(FROM)) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( @object ) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( instance ) + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + + Advanced Usage Only! Skips the Registry and goes right to the inner + Semantic Model of StructureMap. Use with care + + + + + + Define the constructor and setter arguments for the default T + + + + + + Thrown by IProperty classes when an invalid value is applied to + a property of an InstanceGraph + + + + + Main exception for StructureMap. Use the ErrorCode to aid in troubleshooting + StructureMap problems + + + + + Represents a concrete class that can be built by StructureMap as an instance of the parent + PluginFamily’s PluginType. The properties of a Plugin are the CLR Type of the concrete class, + and the human-friendly concrete key that StructureMap will use to identify the Type. + + + + + The ConcreteKey that identifies the Plugin within a PluginFamily + + + + + The concrete CLR Type represented by the Plugin + + + + + Property's that will be filled by setter injection + + + + + Conceptually speaking, a PluginFamily object represents a point of abstraction or variability in + the system. A PluginFamily defines a CLR Type that StructureMap can build, and all of the possible + Plugin’s implementing the CLR Type. + + + + + The CLR Type that defines the "Plugin" interface for the PluginFamily + + + + + The InstanceKey of the default instance of the PluginFamily + + + + + Custom collection class for PluginFamily's + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Models the runtime configuration of a StructureMap Container + + + + + Closes the PluginGraph for adding or removing members. Runs all the AssemblyScanner's + and attempts to attach concrete types to the proper plugin types. Calculates the Profile defaults. + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Adds an AssemblyScanner to the PluginGraph. Used for Testing. + + + + + + Add configuration to a PluginGraph with the Registry DSL + + + + + + Designates whether a PluginGraph has been "Sealed." + + + + + Represents a PropertyInfo of a Plugin.PluggedType that is filled by Setter Injection + + + + + Custom collection class for SetterProperty objects + + + + + Designates a CLR type that is loaded by name. + + + + + Interface for a "Factory" pattern class that creates object instances of the PluginType + + + + + The main "container" object that implements the Service Locator pattern + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates or finds the named instance of T + + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Gets all configured instances of type T using explicitly configured arguments from the "args" + + + + + + + + Gets the default instance of type T using the explicitly configured arguments from the "args" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + Gets the named instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + + Starts a "Nested" Container for atomic, isolated access + + + + + + Starts a new "Nested" Container for atomic, isolated service location. Opens + + + + + + + Provides queryable access to the configured PluginType's and Instances of this Container + + + + + The name of the container. By default this is set to + a random Guid. This is a convience property to + assist with debugging. Feel free to set to anything, + as this is not used in any logic. + + + + + Default implementation of IInstanceFactory + + + + + Constructor to use when troubleshooting possible configuration issues. + + + + + + Constructor to create an Container + + PluginGraph containing the instance and type definitions + for the Container + + + + Creates or finds the named instance of T + + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + Gets all configured instances of type T using explicitly configured arguments from the "args" + + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + + Starts a "Nested" Container for atomic, isolated access + + + + + + Starts a new "Nested" Container for atomic, isolated service location. Opens + + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Sets the default instance for the PluginType + + + + + + + Provides queryable access to the configured PluginType's and Instances of this Container + + + + + The name of the container. By default this is set to + a random Guid. This is a convience property to + assist with debugging. Feel free to set to anything, + as this is not used in any logic. + + + + + GoF Memento representing an Object Instance + + + + + Retrieves the named property value as a string + + + + + + + Template method for implementation specific retrieval of the named property + + + + + + + Returns the named child InstanceMemento + + + + + + + Template method for implementation specific retrieval of the named property + + + + + + + This method is made public for testing. It is not necessary for normal usage. + + + + + + Used to create a templated InstanceMemento + + + + + + + The named type of the object instance represented by the InstanceMemento. Translates to a concrete + type + + + + + The named key of the object instance represented by the InstanceMemento + + + + + Gets the referred template name + + + + + + Template pattern property specifying whether the InstanceMemento is simply a reference + to another named instance. Useful for child objects. + + + + + Template pattern property specifying the instance key that the InstanceMemento refers to + + + + + Is the InstanceMemento a reference to the default instance of the plugin type? + + + + + A TypeInterceptor that always applies to all Instances of a given Plugin Type + + + + + Abstract class that is the supertype of all storage and retrieval mechanisms of + InstanceMemento instances + + + + + Retrieves the named InstanceMemento + + The instanceKey of the requested InstanceMemento + + + + + Retrieves an array of all InstanceMemento's stored by this MementoSource + + + + + + Template pattern method. Determines if the MementoSource contains a definition for the + requested instanceKey. + + + + + + + Template pattern method. Retrieves an InstanceMemento for the instanceKey + + + + + + + The type of MementoSource + + + + + String description of the MementoSource. Used in the StructureMap-Client UI. + + + + + An in-memory implementation of InstanceMemento. + + + + + Creates an instance of MemoryInstanceMemento that represents a reference to another + instance. + + The referenced instance key to another instance + + + + + Creates a MemoryInstanceMemento that represents a reference to the default instance + of a plugin type. + + + + + + Constructs a MemoryInstanceMemento without properties + + The concrete key of the plugin type + The identifying instance key + + + + Constructs a MemoryInstanceMemento with properties + + The concrete key of the plugin type + The identifying instance key + NameValueCollection of instance properties + + + + Sets the value of the named property + + + + + + + Deletes a named property from the DefaultInstanceMemento + + + + + + Links a child InstanceMemento as a named property + + + + + + + Links an array of InstanceMemento's to a named array property + + + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + The main static Facade for the StructureMap container + + + + + Restarts ObjectFactory and blows away all Singleton's and cached instances. Use with caution. + + + + + Remove and dispose all objects scoped by HttpContext. Call this method at the *end* of an Http request to clean up resources + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the named instance of T + + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Provides queryable access to the configured PluginType's and Instances of the inner Container + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + Reads configuration XML documents and builds the structures necessary to initialize + the Container/IInstanceFactory/InstanceBuilder/ObjectInstanceActivator objects + + + + + Reads the configuration information and returns the PluginGraph definition of + plugin families and plugin's + + + + + + Generic implementation of an XmlMementoSource + + + + + Base class for all MementoSource classes that store InstanceMemento's as + node-normalized Xml + + + + + Implementation of MementoSource that stores and retrieves an XmlInstanceMemento per file in a named directory. + DirectoryXmlMementoSource is meant to simplify complicated object graph configurations by isolating each instance to a separate + editable file. + + + + + Stores an Xml InstanceMemento per file in a directory + + A ";" delimited list of directories to look for mementos. DirectoryXmlMementoSource + will use the FIRST directory it finds + The file extension of the InstanceMemento files without a dot. Typically "xml" + NodeNormalized or AttributeNormalized + + + + Implementation of MementoSource that stores and retrieves an XmlInstanceMemento per Embedded Resource file + in a named namespace. EmbeddedFolderXmlMementoSource is meant to simplify complicated object graph configurations + by isolating each instance to a separate + editable file. + + NodeNormalized or AttributeNormalized + The name of the Assembly with the embedded resources + The root namespace of all of the mementos. + The file extension of the memento files - "xml" + + + + An in-memory MementoSource + + + + + Retrieves Xml InstanceMemento's from an xml file stored as an embedded resource in an assembly. + + Designates the nodes that are memento nodes + NodeNormalized or AttributeNormalized + The name of the Assembly the file is embedded into + The path to the embedded resource within the file + + + + Default Constructor + + MementoSource that contains the Memento Templates + MementoSource that contains instances consisting of Template valuee + + + + Stores Attribute-normalized InstanceMemento's in an external file + + + + + Implementation of XmlMementoSource that reads InstanceMemento's from an external file. + Useful to break the StructureMap.config file into smaller pieces. + + + + + Default constructor + + Path to the xml file that contains the instance configuration + XPath expression to the parent node that contains the InstanceMemento nodes. + If empty, it defaults to the top node + The name of the nodes that are InstanceMemento nodes. Useful to store + different types of instances in the same file + + + + An implementation of InstanceMemento that stores properties as Xml attributes + Limited functionality + + + + + Implementation of InstanceMemento that stores information in a node-normalized + Xml format. + + + + + specify what type you'd like the service returned as + + + + + + + Specify the open generic type that should have a single generic parameter + + + + + + + Used as the argument in the Container.Configure() method to describe + configuration directives and specify the sources of configuration for + a Container + + + + + Creates and adds a Registry object of type T. + + The Registry Type + + + + Imports all the configuration from a Registry object + + + + + + Imports configuration from an Xml file. The fileName + must point to an Xml file with valid StructureMap + configuration + + + + + + Imports configuration directly from an XmlNode. This + method was intended for scenarios like Xml being embedded + into an assembly. The node must be a 'StructureMap' node + + + + + + If true, directs StructureMap to look for configuration in the App.config. + The default value is false. + + + + + Expression Builder to define an Instance + + + + + + Register a previously built Instance. This provides a "catch all" + method to attach custom Instance objects. Synonym for Instance() + + + + + + Inject this object directly. Synonym to Object() + + + + + + + Gives you full access to all the different ways to specify an "Instance" + + + + + An Expression Builder to define Instances of a PluginType. + This is mostly used for configuring open generic types + + + + + Shortcut to register a Concrete Type as an instance. This method supports + method chaining to allow you to add constructor and setter arguments for + the concrete type + + + + + + + Shortcut to simply use the Instance with the given name + + + + + + + An Expression Builder that is used throughout the Registry DSL to + add and define Instances + + + + + + Register a previously built Instance. This provides a "catch all" + method to attach custom Instance objects. Synonym for IsThis() + + + + + + Inject this object directly. Synonym to IsThis() + + + + + + + Build the Instance with the constructor function and setter arguments. Starts + the definition of a SmartInstance + + + + + + + Build the Instance with the constructor function and setter arguments. Starts + the definition of a SmartInstance + + + + + + + Build the Instance with the constructor function and setter arguments. Use this + method for open generic types, and favor the generic version of OfConcreteType + for all other types + + + + + + + Build the Instance with the constructor function and setter arguments. Use this + method for open generic types, and favor the generic version of OfConcreteType + for all other types + + + + + + + Create an Instance that builds an object by calling a Lambda or + an anonymous delegate with no arguments + + + + + + + Create an Instance that builds an object by calling a Lambda or + an anonymous delegate with the IContext representing + the current object graph. + + + + + + + Use the Instance of this PluginType with the specified name. This is + generally only used while configuring child dependencies within a deep + object graph + + + + + + + Use the default Instance of this PluginType. This is + generally only used while configuring child dependencies within a deep + object graph + + + + + + Creates an Instance that stores this object of type T, + and returns a cloned copy of the template. + + + + + + + Caches template as a serialized byte stream. Uses deserialization + to create copies when the Instance is built. + + + + + + + Creates an Instance that will load an ASCX user control from the url + + + + + + + Creates an Instance according to conditional rules + + + + + + + Used as an expression builder to specify setter injection policies + + + + + Directs StructureMap to treat all public setters of type T as + mandatory properties + + + + + + Directs StructureMap to tread all public setters with + a PropertyType that matches the predicate as a + mandatory setter + + + + + + Directs StructureMap to treat all public setters that match the + rule as mandatory properties + + + + + + Directs StructureMap to treat all public setters with a property + type in the specified namespace as mandatory properties + + + + + + Directs StructureMap to treat all public setters with a property + type in the specified namespace as mandatory properties + + + + + + Directs StructureMap to treat all public setters where to property name + matches the specified rule as a mandatory property + + + + + + Base class for creating an object instance from an InstanceMemento. SubClasses are + emitted for each concrete Plugin with constructor parameters. + + + + + Allows built-in registration conventions to be configurable through the assembly scanning DSL + + + Intended for StructureMap internal use only. + Custom registration convention instances can be directly configured + before being passed to IAssemblyScanner.With(IRegistrationConvention). + + + + + Simply query to see if there are any implementations registered + + + + + + Ejects any instances of this instance from the current container + and permanently removes the instance from the container configuration + + + + + + Eject all instances of this PluginType from the current container, + but leaves the lifecycle behavior + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Models the state of a Container or ObjectFactory. Can be used to query for the + existence of types registered with StructureMap + + + + + Can StructureMap fulfill a request to ObjectFactory.GetInstance(pluginType) from the + current configuration. This does not include concrete classes that could be auto-configured + upon demand + + + + + + + Can StructureMap fulfill a request to ObjectFactory.GetInstance<T>() from the + current configuration. This does not include concrete classes that could be auto-configured + upon demand + + + + + + + Queryable access to all of the InstanceRef for a given PluginType + + + + + + + Queryable access to all of the InstanceRef for a given PluginType + + + + + + Does the current container have existing configuration for the "pluginType" + + + + + + + Does the current container have existing configuration for the type T + + + + + + Find the concrete type for the default Instance of T. + In other words, when I call Container.GetInstance(Type), + what do I get? May be indeterminate + + + + + + + Find the concrete type for the default Instance of pluginType. + In other words, when I call Container.GetInstance(Type), + what do I get? May be indeterminate + + + + + + Retrieves the configuration for the given type + + + + + + + Retrieves the configuration for the given type + + + + + + + Eject all objects, configuration, and Plugin Types matching this filter + + + + + + Eject all objects and configuration for any Plugin Type that matches this filter + + + + + + Eject all objects and Instance configuration for this PluginType + + + + + + Get each and every configured instance that could possibly + be cast to T + + + + + + + Access to all the Plugin Type registrations + + + + + Makes sure that every request for this object returns a unique object + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + The actual concrete type of this Instance. Not every type of IInstance + can determine the ConcreteType + + + + + Ejects and removes all objects and the configuration for the named instance from the + container + + + + + + + Ejects and removes all objects and configuration for the instances that match the filter + + + + + + + Determines if the pluggedType can be upcast to the pluginType + + + + + + + + Determines if the PluggedType is a valid Plugin into the + PluginType + + + + + + + + Imports configuration from an Xml file. The fileName + must point to an Xml file with valid StructureMap + configuration + + + + + + Imports configuration directly from an XmlNode. This + method was intended for scenarios like Xml being embedded + into an assembly. The node must be a 'StructureMap' node + + + + + + Creates and adds a Registry object of type T. + + The Registry Type + + + + Imports all the configuration from a Registry object + + + + + + If true, makes the existence of the StructureMap.config mandatory. + The default is false. + + + + + If true, the StructureMap.config file will be ignored even if it exists. + The default is false. + + + + + If true, directs StructureMap to look for configuration in the App.config. + The default value is false. + + + + + Designate the Default Profile. This will be applied as soon as the + Container is initialized. + + + + + Retrieves the configuration for the given type + + + + + + + Retrieves the configuration for the given type + + + + + + + Eject all objects, configuration, and Plugin Types matching this filter + + + + + + Eject all objects and configuration for any Plugin Type that matches this filter + + + + + + Eject all objects and Instance configuration for this PluginType + + + + + + Get each and every configured instance that could possibly + be cast to T + + + + + + + The requested PluginType of the Instance being create + + + + + The Name of the Instance being created + + + + + The actual ConcreteType being created. This will not always + be available + + + + + Models the current place in an object graph during the construction of + an instance. Provides contextual information that can be used + to alter the desired construction of child objects + + + + + The requested PluginType of the Instance being create + + + + + The Name of the Instance being created + + + + + The actual ConcreteType being created. This will not always + be available + + + + + Provides metadata about the object graph being constructed. More or less a stack trace of the GetInstance() pipeline + that can be used for "contextual" object construction + + + + + The top level of the object graph. Describes the original requested instance + + + + + The current BuildFrame + + + + + The immediate parent BuildFrame + + + + + Defines the value of a primitive argument to a constructur argument + + + + + Sets the value of the constructor argument + + + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings + + The key in appSettings for the value to use. + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings when it exists. Otherwise uses the provided default value. + + The key in appSettings for the value to use. + The value to use if an entry for does not exist in the appSettings section. + + + + + Instance that builds objects with by calling constructor functions and using setter properties + + The concrete type constructed by SmartInstance + + + + Sets the name of this Instance + + + + + + + Sets the name of this Instance + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register an InstanceInterceptor with this Instance + + + + + + + Define a primitive constructor argument + + + + + + + Set simple setter properties + + + + + + + Define a primitive setter property by specifying the property name with + an expression + + + + + + + Define a primitive setter property by specifying the property name + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type. Do not + use this method if there is more than one constructor arguments of the same type + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type. Do not + use this method if there is more than one constructor arguments of the same type + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type and constructor name. + Use this method if there is more than one constructor arguments of the same type + + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type and constructor name. + Use this method if there is more than one constructor arguments of the same type + + + + + + + + Inline definition of a setter dependency. The property name is specified with an Expression + + + + + + + + Inline definition of a setter dependency. The property name is specified with an Expression + + + + + + + + Inline definition of a setter dependency. Only use this method if there + is only a single property of the SETTERTYPE + + + + + + + Inline definition of a setter dependency. Only use this method if there + is only a single property of the SETTERTYPE + + + + + + + Inline definition of a dependency on an Array of the CHILD type. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + Inline definition of a dependency on an Array of the CHILD type and the specified setter property or constructor argument name. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + + Inline definition of a dependency on an Array of the CHILD type. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + Inline definition of a dependency on an Array of the CHILD type and the specified setter property or constructor argument name. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + + Expression Builder to help define multiple Instances for an Array dependency + + + + + + Nested Closure that allows you to add an unlimited number of child Instances + + + + + + + Specify an array of Instance objects directly for an Array dependency + + + + + + + Expression Builder that helps to define child dependencies inline + + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings + + The key in appSettings for the value to use. + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings when it exists. Otherwise uses the provided default value. + + The key in appSettings for the value to use. + The value to use if an entry for does not exist in the appSettings section. + + + + + Nested Closure to define a child dependency inline + + + + + + + Shortcut to set an inline dependency to an Instance + + + + + + + Shortcut to set an inline dependency to a designated object + + + + + + + Shortcut to set an inline dependency to a designated object + + + + + + + Set an Inline dependency to the Default Instance of the Property type + Used mostly to force an optional Setter property to be filled by + StructureMap + + + + + + Shortcut method to define a child dependency inline + + + + + + + Shortcut method to define a child dependency inline and configure + the child dependency + + + + + + + Provides virtual methods that can be used by subclasses to parse an expression tree. + + + This class actually already exists in the System.Core assembly...as an internal class. + I can only speculate as to why it is internal, but it is obviously much too dangerous + for anyone outside of Microsoft to be using... + + + + diff --git a/Website/LOC.Core/bin/Release/EntityFramework.dll b/Website/LOC.Core/bin/Release/EntityFramework.dll new file mode 100644 index 000000000..8caef36ac Binary files /dev/null and b/Website/LOC.Core/bin/Release/EntityFramework.dll differ diff --git a/Website/LOC.Core/bin/Release/EntityFramework.xml b/Website/LOC.Core/bin/Release/EntityFramework.xml new file mode 100644 index 000000000..4057d68a4 --- /dev/null +++ b/Website/LOC.Core/bin/Release/EntityFramework.xml @@ -0,0 +1,18061 @@ + + + + EntityFramework + + + + + Specifies the database column that a property is mapped to. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The name of the column the property is mapped to. + + + + The name of the column the property is mapped to. + + + + + The zero-based order of the column the property is mapped to. + + + + + The database provider specific data type of the column the property is mapped to. + + + + + Denotes that the class is a complex type. + Complex types are non-scalar properties of entity types that enable scalar properties to be organized within entities. + Complex types do not have keys and cannot be managed by the Entity Framework apart from the parent object. + + + + + Specifies how the database generates values for a property. + + + + + Initializes a new instance of the class. + + The pattern used to generate values for the property in the database. + + + + The pattern used to generate values for the property in the database. + + + + + The pattern used to generate values for a property in the database. + + + + + The database does not generate values. + + + + + The database generates a value when a row is inserted. + + + + + The database generates a value when a row is inserted or updated. + + + + + Denotes a property used as a foreign key in a relationship. + The annotation may be placed on the foreign key property and specify the associated navigation property name, + or placed on a navigation property and specify the associated foreign key name. + + + + + Initializes a new instance of the class. + + + If placed on a foreign key property, the name of the associated navigation property. + If placed on a navigation property, the name of the associated foreign key(s). + If a navigation property has multiple foreign keys, a comma separated list should be supplied. + + + + + If placed on a foreign key property, the name of the associated navigation property. + If placed on a navigation property, the name of the associated foreign key(s). + + + + + Specifies the inverse of a navigation property that represents the other end of the same relationship. + + + + + Initializes a new instance of the class. + + The navigation property representing the other end of the same relationship. + + + + The navigation property representing the other end of the same relationship. + + + + + Specifies the maximum length of array/string data allowed in a property. + + + + + Initializes a new instance of the class. + + + The maximum allowable length of array/string data. + Value must be greater than zero. + + + + + Initializes a new instance of the class. + The maximum allowable length supported by the database will be used. + + + + + Determines whether a specified object is valid. (Overrides ) + + + This method returns true if the is null. + It is assumed the is used if the value may not be null. + + The object to validate. + true if the value is null or less than or equal to the specified maximum length, otherwise false + Length is zero or less than negative one. + + + + Applies formatting to a specified error message. (Overrides ) + + The name to include in the formatted string. + A localized string to describe the maximum acceptable length. + + + + Checks that Length has a legal value. Throws InvalidOperationException if not. + + + + + Gets the maximum allowable length of the array/string data. + + + + + Specifies the minimum length of array/string data allowed in a property. + + + + + Initializes a new instance of the class. + + + The minimum allowable length of array/string data. + Value must be greater than or equal to zero. + + + + + Determines whether a specified object is valid. (Overrides ) + + + This method returns true if the is null. + It is assumed the is used if the value may not be null. + + The object to validate. + true if the value is null or greater than or equal to the specified minimum length, otherwise false + Length is less than zero. + + + + Applies formatting to a specified error message. (Overrides ) + + The name to include in the formatted string. + A localized string to describe the minimum acceptable length. + + + + Checks that Length has a legal value. Throws InvalidOperationException if not. + + + + + Gets the minimum allowable length of the array/string data. + + + + + Denotes that a property or class should be excluded from database mapping. + + + + + Specifies the database table that a class is mapped to. + + + + + Initializes a new instance of the class. + + The name of the table the class is mapped to. + + + + The name of the table the class is mapped to. + + + + + The schema of the table the class is mapped to. + + + + + The base for all all Entity Data Model (EDM) types that represent a type from the EDM type system. + + + + + Represents an item in an Entity Data Model (EDM) . + + + + + The base for all all Entity Data Model (EDM) item types that with a Name property that represents a qualified (can be dotted) name. + + + + + The base for all all Entity Data Model (EDM) item types that with a property. + + + + + The base for all all Entity Data Model (EDM) types that support annotation using . + + + + + EdmDataModelItem is the base for all types in the Entity Data Model (EDM) metadata construction and modification API. + + + + + DataModelItem is the base for all types in the EDM metadata reflection, construction and modification API. + + + + + Gets an value indicating which Entity Data Model (EDM) concept is represented by this item. + + + + + IAnnotatedDataModelItem is implemented by model-specific base types for all types with an property. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets or sets the currently assigned annotations. + + + + + Returns all EdmItem children directly contained by this EdmItem. + + + + + INamedDataModelItem is implemented by model-specific base types for all types with a property. + + + + + Gets or sets the currently assigned name. + + + + + Gets or sets the currently assigned name. + + + + + Gets a value indicating whether this type is abstract. + + + + + Gets the optional base type of this type. + + + + + EdmStructuralMember is the base for all types that represent members of structural items in the Entity Data Model (EDM) metadata construction and modification API. + + + + + Represents information about a database connection. + + + + + Creates a new instance of DbConnectionInfo representing a connection that is specified in the application configuration file. + + The name of the connection string in the application configuration. + + + + Creates a new instance of DbConnectionInfo based on a connection string. + + The connection string to use for the connection. + The name of the provider to use for the connection. Use 'System.Data.SqlClient' for SQL Server. + + + + Gets the connection information represented by this instance. + + Configuration to use if connection comes from the configuration file. + + + + Instances of this class are used to create DbConnection objects for + SQL Server LocalDb based on a given database name or connection string. + + + An instance of this class can be set on the class or in the + app.config/web.config for the application to cause all DbContexts created with no + connection information or just a database name to use SQL Server LocalDb by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Implementations of this interface are used to create DbConnection objects for + a type of database server based on a given database name. + An Instance is set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use a certain type of database server by default. + Two implementations of this interface are provided: + is used to create connections to Microsoft SQL Server, including EXPRESS editions. + is used to create connections to Microsoft SQL + Server Compact Editions. + Other implementations for other database servers can be added as needed. + Note that implementations should be thread safe or immutable since they may + be accessed by multiple threads at the same time. + + + + + Creates a connection based on the given database name or connection string. + + The database name or connection string. + An initialized DbConnection. + + + + Creates a new instance of the connection factory for the given version of LocalDb. + For SQL Server 2012 LocalDb use "v11.0". + + The LocalDb version to use. + + + + Creates a new instance of the connection factory for the given version of LocalDb. + For SQL Server 2012 LocalDb use "v11.0". + + + The LocalDb version to use. + + The connection string to use for options to the database other than the 'Initial Catalog', + 'Data Source', and 'AttachDbFilename'. + The 'Initial Catalog' and 'AttachDbFilename' will be prepended to this string based on the + database name when CreateConnection is called. + The 'Data Source' will be set based on the LocalDbVersion argument. + + + + + Creates a connection for SQL Server LocalDb based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + The connection string to use for options to the database other than the 'Initial Catalog', + 'Data Source', and 'AttachDbFilename'. + The 'Initial Catalog' and 'AttachDbFilename' will be prepended to this string based on the + database name when CreateConnection is called. + The 'Data Source' will be set based on the LocalDbVersion argument. + The default is 'Integrated Security=True; MultipleActiveResultSets=True;'. + + + + + Encapsulates a cloned and store . Note that these + objects are disposable and should be used in a using block to ensure both the cloned context and the + cloned connection are disposed. + + + + + For mocking. + + + + + Creates a clone of the given . The underlying of + the context is also cloned and the given connection string is used for the connection string of + the cloned connection. + + + + + Finds the assemblies that were used for loading o-space types in the source context + and loads those assemblies in the cloned context. + + + + + Disposes both the underlying ObjectContext and its store connection. + + + + + The cloned context. + + + + + This is always the store connection of the underlying ObjectContext. + + + + + Represents setting the database initializer for a specific context type + + + + + Represents a parameter to be passed to a method + + + + + Represents a series of parameters to pass to a method + + + + + Adds a new parameter to the collection + Used for unit testing + + + + + Represents the configuration for a series of contexts + + + + + Adds a new context to the collection + Used for unit testing + + + + + Represents the configuration for a specific context type + + + + + Represents setting the default connection factory + + + + + Represents all Entity Framework related configuration + + + + + Handles creating databases either using the core provider or the Migrations pipeline. + + + + + Creates a database using the core provider (i.e. ObjectContext.CreateDatabase) or + by using Code First Migrations to create an empty database + and the perform an automatic migration to the current model. + Migrations is used if Code First is being used and the EF provider is for SQL Server + or SQL Compact. The core is used for non-Code First models and for other providers even + when using Code First. + + + + + A DbContext instance represents a combination of the Unit Of Work and Repository patterns such that + it can be used to query from a database and group together changes that will then be written + back to the store as a unit. + DbContext is conceptually similar to ObjectContext. + + + DbContext is usually used with a derived type that contains properties for + the root entities of the model. These sets are automatically initialized when the + instance of the derived class is created. This behavior can be modified by applying the + attribute to either the entire derived context + class, or to individual properties on the class. + + The Entity Data Model backing the context can be specified in several ways. When using the Code First + approach, the properties on the derived context are used to build a model + by convention. The protected OnModelCreating method can be overridden to tweak this model. More + control over the model used for the Model First approach can be obtained by creating a + explicitly from a and passing this model to one of the DbContext constructors. + + When using the Database First or Model First approach the Entity Data Model can be created using the + Entity Designer (or manually through creation of an EDMX file) and then this model can be specified using + entity connection string or an object. + + The connection to the database (including the name of the database) can be specified in several ways. + If the parameterless DbContext constructor is called from a derived context, then the name of the derived context + is used to find a connection string in the app.config or web.config file. If no connection string is found, then + the name is passed to the DefaultConnectionFactory registered on the class. The connection + factory then uses the context name as the database name in a default connection string. (This default connection + string points to .\SQLEXPRESS on the local machine unless a different DefaultConnectionFactory is registered.) + + Instead of using the derived context name, the connection/database name can also be specified explicitly by + passing the name to one of the DbContext constructors that takes a string. The name can also be passed in + the form "name=myname", in which case the name must be found in the config file or an exception will be thrown. + + Note that the connection found in the app.config or web.config file can be a normal database connection + string (not a special Entity Framework connection string) in which case the DbContext will use Code First. + However, if the connection found in the config file is a special Entity Framework connection string, then the + DbContext will use Database/Model First and the model specified in the connection string will be used. + + An existing or explicitly created DbConnection can also be used instead of the database/connection name. + + A can be applied to a class derived from DbContext to set the + version of conventions used by the context when it creates a model. If no attribute is applied then the + latest version of conventions will be used. + + + + + Interface implemented by objects that can provide an instance. + The class implements this interface to provide access to the underlying + ObjectContext. + + + + + Gets the object context. + + The object context. + + + + Constructs a new context instance using conventions to create the name of the database to + which a connection will be made. The by-convention name is the full name (namespace + class name) + of the derived context class. + See the class remarks for how this is used to create a connection. + + + + + Constructs a new context instance using conventions to create the name of the database to + which a connection will be made, and initializes it from the given model. + The by-convention name is the full name (namespace + class name) of the derived context class. + See the class remarks for how this is used to create a connection. + + The model that will back this context. + + + + Constructs a new context instance using the given string as the name or connection string for the + database to which a connection will be made. + See the class remarks for how this is used to create a connection. + + Either the database name or a connection string. + + + + Constructs a new context instance using the given string as the name or connection string for the + database to which a connection will be made, and initializes it from the given model. + See the class remarks for how this is used to create a connection. + + Either the database name or a connection string. + The model that will back this context. + + + + Constructs a new context instance using the existing connection to connect to a database. + The connection will not be disposed when the context is disposed. + + An existing connection to use for the new context. + If set to true the connection is disposed when + the context is disposed, otherwise the caller must dispose the connection. + + + + Constructs a new context instance using the existing connection to connect to a database, + and initializes it from the given model. + The connection will not be disposed when the context is disposed. + An existing connection to use for the new context. + The model that will back this context. + If set to true the connection is disposed when + the context is disposed, otherwise the caller must dispose the connection. + + + + + Constructs a new context instance around an existing ObjectContext. + An existing ObjectContext to wrap with the new context. + If set to true the ObjectContext is disposed when + the DbContext is disposed, otherwise the caller must dispose the connection. + + + + + Initializes the internal context, discovers and initializes sets, and initializes from a model if one is provided. + + + + + Discovers DbSets and initializes them. + + + + + This method is called when the model for a derived context has been initialized, but + before the model has been locked down and used to initialize the context. The default + implementation of this method does nothing, but it can be overridden in a derived class + such that the model can be further configured before it is locked down. + + + Typically, this method is called only once when the first instance of a derived context + is created. The model for that context is then cached and is for all further instances of + the context in the app domain. This caching can be disabled by setting the ModelCaching + property on the given ModelBuidler, but note that this can seriously degrade performance. + More control over caching is provided through use of the DbModelBuilder and DbContextFactory + classes directly. + + The builder that defines the model for the context being created. + + + + Internal method used to make the call to the real OnModelCreating method. + + The model builder. + + + + Returns a DbSet instance for access to entities of the given type in the context, + the ObjectStateManager, and the underlying store. + + + See the DbSet class for more details. + + The type entity for which a set should be returned. + A set for the given entity type. + + + + Returns a non-generic DbSet instance for access to entities of the given type in the context, + the ObjectStateManager, and the underlying store. + + The type of entity for which a set should be returned. + A set for the given entity type. + + See the DbSet class for more details. + + + + + Saves all changes made in this context to the underlying database. + + The number of objects written to the underlying database. + Thrown if the context has been disposed. + + + + Validates tracked entities and returns a Collection of containing validation results. + + + Collection of validation results for invalid entities. The collection is never null and must not contain null + values or results for valid entities. + + + 1. This method calls DetectChanges() to determine states of the tracked entities unless + DbContextConfiguration.AutoDetectChangesEnabled is set to false. + 2. By default only Added on Modified entities are validated. The user is able to change this behavior + by overriding ShouldValidateEntity method. + + + + + Extension point allowing the user to override the default behavior of validating only + added and modified entities. + + DbEntityEntry instance that is supposed to be validated. + true to proceed with validation. false otherwise. + + + + Extension point allowing the user to customize validation of an entity or filter out validation results. + Called by . + + DbEntityEntry instance to be validated. + User defined dictionary containing additional info for custom validation. + It will be passed to + and will be exposed as . + This parameter is optional and can be null. + Entity validation result. Possibly null when overridden. + + + + Internal method that calls the protected ValidateEntity method. + + DbEntityEntry instance to be validated. + User defined dictionary containing additional info for custom validation. + It will be passed to + and will be exposed as . + This parameter is optional and can be null. + Entity validation result. Possibly null when ValidateEntity is overridden. + + + + Gets a object for the given entity providing access to + information about the entity and the ability to perform actions on the entity. + + The type of the entity. + The entity. + An entry for the entity. + + + + Gets a object for the given entity providing access to + information about the entity and the ability to perform actions on the entity. + + The entity. + An entry for the entity. + + + + Calls the protected Dispose method. + + + + + Disposes the context. The underlying is also disposed if it was created + is by this context or ownership was passed to this context when this context was created. + The connection to the database ( object) is also disposed if it was created + is by this context or ownership was passed to this context when this context was created. + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Creates a Database instance for this context that allows for creation/deletion/existence checks + for the underlying database. + + + + + Returns the Entity Framework ObjectContext that is underlying this context. + + Thrown if the context has been disposed. + + + + Provides access to features of the context that deal with change tracking of entities. + + An object used to access features that deal with change tracking. + + + + Provides access to configuration options for the context. + + An object used to access configuration options. + + + + Provides access to the underlying InternalContext for other parts of the internal design. + + + + + A simple representation of an app.config or web.config file. + + + + + Initializes a new instance of AppConfig based on supplied configuration + + Configuration to load settings from + + + + Initializes a new instance of AppConfig based on supplied connection strings + The default configuration for database initializers and default connection factory will be used + + Connection strings to be used + + + + Initializes a new instance of AppConfig based on the for the AppDomain + + + Use AppConfig.DefaultInstance instead of this constructor + + + + + Appies any database intializers specified in the configuration + + + + + Appies any database intializers specified in the configuration + + + Value indicating if initializers should be re-applied if they have already been applied in this AppDomain + + + + + Gets the specified connection string from the configuration + + Name of the connection string to get + The connection string, or null if there is no connection string with the specified name + + + + Gets the default connection factory based on the configuration + + + + + Gets a singleton instance of configuration based on the for the AppDomain + + + + + Acts as a proxy for that for the most part just passes calls + through to the real object but uses virtual methods/properties such that uses of the object + can be mocked. + + + + + Encapsulates information read from the application config file that specifies a database initializer + and allows that initializer to be dynamically applied. + + + + + Initializes a new instance of the class. + + The key from the entry in the config file. + The value from the enrty in the config file. + + + + Uses the context type and initializer type specified in the config to create an initializer instance + and set it with the DbDbatabase.SetInitializer method. + + + + + Reads all initializers from the application config file and sets them using the Database class. + + + + + Calculates the model hash values used the EdmMetadata table from EF 4.1/4.2. + + + + + Calculates an SHA256 hash of the EDMX from the given code first model. This is the hash stored in + the database in the EdmMetadata table in EF 4.1/4.2. The hash is always calculated using a v2 schema + as was generated by EF 4.1/4.2 and with the entity included in the model. + + + + + Acts as a proxy for that for the most part just passes calls + through to the real object but uses virtual methods/properties such that uses of the object + can be mocked. + + + + + An implementation of that will use Code First Migrations + to update the database to the latest version. + + + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + Initializes a new instance of the MigrateDatabaseToLatestVersion class. + + + + + Initializes a new instance of the MigrateDatabaseToLatestVersion class that will + use a specific connection string from the configuration file to connect to + the database to perform the migration. + + The name of the connection string to use for migration. + + + + + + + Helper class that is used to configure a column. + + + + + Creates a new column definition to store Binary data. + + Value indicating whether or not the column allows null values. + The maximum allowable length of the array data. + Value indicating whether or not all data should be padded to the maximum length. + Value indicating whether or not the maximum length supported by the database provider should be used. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + Value indicating whether or not this column should be configured as a timestamp. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Boolean data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Byte data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store DateTime data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Decimal data. + + Value indicating whether or not the column allows null values. + The numeric precision of the column. + The numeric scale of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + Value indicating whether or not the database will generate values for this column during insert. + The newly constructed column definition. + + + + Creates a new column definition to store Double data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store GUID data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Single data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Short data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Integer data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Long data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store String data. + + Value indicating whether or not the column allows null values. + The maximum allowable length of the string data. + Value indicating whether or not all data should be padded to the maximum length. + Value indicating whether or not the maximum length supported by the database provider should be used. + Value indicating whether or not the column supports Unicode content. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Time data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store DateTimeOffset data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Helper class that is used to further configure a table being created from a CreateTable call on . + + + + + Initializes a new instance of the TableBuilder class. + + The table creation operation to be further configured. + The migration the table is created in. + + + + Specifies a primary key for the table. + + + A lambda expression representing the property to be used as the primary key. + C#: t => t.Id + VB.Net: Function(t) t.Id + + If the primary key is made up of multiple properties then specify an anonymous type including the properties. + C#: t => new { t.Id1, t.Id2 } + VB.Net: Function(t) New With { t.Id1, t.Id2 } + + + The name of the primary key. + If null is supplied, a default name will be generated. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Specifies an index to be created on the table. + + + A lambda expression representing the property to be indexed. + C#: t => t.PropertyOne + VB.Net: Function(t) t.PropertyOne + + If multiple properties are to be indexed then specify an anonymous type including the properties. + C#: t => new { t.PropertyOne, t.PropertyTwo } + VB.Net: Function(t) New With { t.PropertyOne, t.PropertyTwo } + + A value indicating whether or not this is a unique index. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Specifies a foreign key constraint to be created on the table. + + Name of the table that the foreign key constraint targets. + + A lambda expression representing the properties of the foreign key. + C#: t => t.PropertyOne + VB.Net: Function(t) t.PropertyOne + + If multiple properties make up the foreign key then specify an anonymous type including the properties. + C#: t => new { t.PropertyOne, t.PropertyTwo } + VB.Net: Function(t) New With { t.PropertyOne, t.PropertyTwo } + + A value indicating whether or not cascade delete should be configured on the foreign key constraint. + + + The name of this foreign key constraint. + If no name is supplied, a default name will be calculated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Base class for code-based migrations. + + + + + Operations to be performed during the upgrade process. + + + + + Operations to be performed during the downgrade process. + + + + + Adds an operation to create a new table. + + + The columns in this create table operation. + You do not need to specify this type, it will be inferred from the columnsAction parameter you supply. + + The name of the table. Schema name is optional, if no schema is specified then dbo is assumed. + + An action that specifies the columns to be included in the table. + i.e. t => new { Id = t.Int(identity: true), Name = t.String() } + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + An object that allows further configuration of the table creation operation. + + + + Adds an operation to create a new foreign key constraint. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key column. + + The table that contains the column this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The column this foreign key references. + If no value is supplied the primary key of the principal table will be referenced. + + + A value indicating if cascade delete should be configured for the foreign key relationship. + If no value is supplied, cascade delete will be off. + + + The name of the foreign key constraint in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new foreign key constraint. + + + The table that contains the foreign key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key columns. + + The table that contains the columns this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The columns this foreign key references. + If no value is supplied the primary key of the principal table will be referenced. + + + A value indicating if cascade delete should be configured for the foreign key relationship. + If no value is supplied, cascade delete will be off. + + + The name of the foreign key constraint in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on its name. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the foreign key constraint in the database. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on the column it targets. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key column. + + The table that contains the column this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + The columns this foreign key references. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on the columns it targets. + + + The table that contains the foreign key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key columns. + + The table that contains the columns this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + The columns this foreign key references. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a table. + + + The name of the table to be dropped. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to move a table to a new schema. + + + The name of the table to be moved. + Schema name is optional, if no schema is specified then dbo is assumed. + + The schema the table is to be moved to. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to rename a table. To change the schema of a table use MoveTable + + + The name of the table to be renamed. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The new name for the table. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to rename a column. + + + The name of the table that contains the column to be renamed. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be renamed. + The new name for the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to add a column to an existing table. + + + The name of the table to add the column to. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The name of the column to be added. + + + An action that specifies the column to be added. + i.e. c => c.Int(nullable: false, defaultValue: 3) + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing column. + + + The name of the table to drop the column from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to alter the definition of an existing column. + + + The name of the table the column exists in. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be changed. + + An action that specifies the new definition for the column. + i.e. c => c.String(nullable: false, defaultValue: "none") + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new primary key. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The primary key column. + + The name of the primary key in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new primary key based on multiple columns. + + + The table that contains the primary key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The primary key columns. + + The name of the primary key in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing primary key that does not have the default name. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the primary key to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing primary key that was created with the default name. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create an index on a single column. + + + The name of the table to create the index on. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to create the index on. + + A value indicating if this is a unique index. + If no value is supplied a non-unique index will be created. + + + The name to use for the index in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create an index on multiple columns. + + + The name of the table to create the index on. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the columns to create the index on. + + A value indicating if this is a unique index. + If no value is supplied a non-unique index will be created. + + + The name to use for the index in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an index based on its name. + + + The name of the table to drop the index from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the index to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an index based on the columns it targets. + + + The name of the table to drop the index from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column(s) the index targets. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to execute a SQL command. + + The SQL to be executed. + + A value indicating if the SQL should be executed outside of the + transaction being used for the migration process. + If no value is supplied the SQL will be executed within the transaction. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Configuration relating to the use of migrations for a given model. + You will typically create a configuration class that derives + from rather than + using this class. + + + + + Initializes a new instance of the DbMigrationsConfiguration class. + + + + + Adds a new SQL generator to be used for a given database provider. + + Name of the database provider to set the SQL generator for. + The SQL generator to be used. + + + + Gets the SQL generator that is set to be used with a given database provider. + + Name of the database provider to get the SQL generator for. + The SQL generator that is set for the database provider. + + + + Gets or sets a value indicating if automatic migrations can be used when migration the database. + + + + + Gets or sets a value indicating if data loss is acceptable during automatic migration. + If set to false an exception will be thrown if data loss may occur as part of an automatic migration. + + + + + Gets or sets the derived DbContext representing the model to be migrated. + + + + + Gets or sets the namespace used for code-based migrations. + + + + + Gets or sets the sub-directory that code-based migrations are stored in. + + + + + Gets or sets the code generator to be used when scaffolding migrations. + + + + + Gets or sets the assembly containing code-based migrations. + + + + + Gets or sets a value to override the connection of the database to be migrated. + + + + + Gets or sets the timeout value used for the individual commands within a + migration. A null value indicates that the default value of the underlying + provider will be used. + + + + + Configuration relating to the use of migrations for a given model. + + The context representing the model that this configuration applies to. + + + + Initializes a new instance of the DbMigrationsConfiguration class. + + + + + Runs after upgrading to the latest migration to allow seed data to be updated. + + Context to be used for updating seed data. + + + + DbMigrator is used to apply existing migrations to a database. + DbMigrator can be used to upgrade and downgrade to any given migration. + To scaffold migrations based on changes to your model use + + + + + Base class for decorators that wrap the core + + + + + Initializes a new instance of the MigratorBase class. + + The migrator that this decorator is wrapping. + + + + Gets a list of the pending migrations that have not been applied to the database. + + List of migration Ids + + + + Updates the target database to the latest migration. + + + + + Updates the target database to a given migration. + + The migration to upgrade/downgrade to. + + + + Gets a list of the migrations that are defined in the assembly. + + List of migration Ids + + + + Gets a list of the migrations that have been applied to the database. + + List of migration Ids + + + + Gets the configuration being used for the migrations process. + + + + + Migration Id representing the state of the database before any migrations are applied. + + + + + Initializes a new instance of the DbMigrator class. + + Configuration to be used for the migration process. + + + + Gets all migrations that are defined in the configured migrations assembly. + + + + + Gets all migrations that have been applied to the target database. + + + + + Gets all migrations that are defined in the assembly but haven't been applied to the target database. + + + + + Updates the target database to a given migration. + + The migration to upgrade/downgrade to. + + + + Gets the configuration that is being used for the migration process. + + + + + A set of extension methods for + + + + + Adds or updates entities by key when SaveChanges is called. Equivalent to an "upsert" operation + from database terminology. + This method can useful when seeding data using Migrations. + + The entities to add or update. + + When the parameter is a custom or fake IDbSet implementation, this method will + attempt to locate and invoke a public, instance method with the same signature as this extension method. + + + + + Adds or updates entities by a custom identification expression when SaveChanges is called. + Equivalent to an "upsert" operation from database terminology. + This method can useful when seeding data using Migrations. + + + An expression specifying the properties that should be used when determining + whether an Add or Update operation should be performed. + + The entities to add or update. + + When the parameter is a custom or fake IDbSet implementation, this method will + attempt to locate and invoke a public, instance method with the same signature as this extension method. + + + + + Generates C# code for a code-based migration. + + + + + Base class for providers that generate code for code-based migrations. + + + + + Generates the code that should be added to the users project. + + Unique identifier of the migration. + Operations to be performed by the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Gets the namespaces that must be output as "using" or "Imports" directives to handle + the code generated by the given operations. + + The operations for which code is going to be generated. + An ordered list of namespace names. + + + + Gets the default namespaces that must be output as "using" or "Imports" directives for + any code generated. + + A value indicating if this class is being generated for a code-behind file. + An ordered list of namespace names. + + + + + + + Generates the primary code file that the user can view and edit. + + Operations to be performed by the migration. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates the code behind file with migration metadata. + + Unique identifier of the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates a property to return the source or target model in the code behind file. + + Name of the property. + Value to be returned. + Text writer to add the generated code to. + + + + Generates a namespace, using statements and class definition. + + Namespace that code should be generated in. + Name of the class that should be generated. + Text writer to add the generated code to. + Base class for the generated class. + A value indicating if this class is being generated for a code-behind file. + Namespaces for which using directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used. + + + + Generates the closing code for a class that was started with WriteClassStart. + + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify a set of column names using a lambda expression. + + The columns to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify the definition for a . + + The column definition to generate code for. + Text writer to add the generated code to. + A value indicating whether to include the column name in the definition. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column of unknown data type. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Removes any invalid characters from the name of an database artifact. + + The name to be scrubbed. + The scrubbed name. + + + + Gets the type name to use for a column of the given data type. + + The data type to translate. + The type name to use in the generated migration. + + + + Quotes an identifier using appropriate escaping to allow it to be stored in a string. + + The identifier to be quoted. + The quoted identifier. + + + + Scaffolds code-based migrations to apply pending model changes to the database. + + + + + Initializes a new instance of the MigrationScaffolder class. + + Configuration to be used for scaffolding. + + + + Scaffolds a code based migration to apply any pending model changes to the database. + + The name to use for the scaffolded migration. + The scaffolded migration. + + + + Scaffolds a code based migration to apply any pending model changes to the database. + + The name to use for the scaffolded migration. + Whether or not to include model changes. + The scaffolded migration. + + + + Scaffolds the initial code-based migration corresponding to a previously run database initializer. + + The scaffolded migration. + + + + Gets or sets the namespace used in the migration's generated code. + + By default, this is the same as MigrationsNamespace on the migrations + configuration object passed into the constructor. For VB.NET projects, this + will need to be updated to take into account the project's root namespace. + + + + + Represents a code-based migration that has been scaffolded and is ready to be written to a file. + + + + + Gets or sets the unique identifier for this migration. + Typically used for the file name of the generated code. + + + + + Gets or sets the scaffolded migration code that the user can edit. + + + + + Gets or sets the scaffolded migration code that should be stored in a code behind file. + + + + + Gets or sets the programming language used for this migration. + Typically used for the file extension of the generated code. + + + + + Gets or sets the subdirectory in the user's project that this migration should be saved in. + + + + + Gets a dictionary of string resources to add to the migration resource file. + + + + + Represents an exception that occurred while running an operation in another AppDomain in the . + + + + + Initializes a new instance of the ToolingException class. + + Error that explains the reason for the exception. + The type of the exception that was thrown. + The stack trace of the exception that was thrown. + + + + + + + + + + Gets the type of the exception that was thrown. + + + + + Gets the stack trace of the exception that was thrown. + + + + + Helper class that is used by design time tools to run migrations related + commands that need to interact with an application that is being edited + in Visual Studio. + + Because the application is being edited the assemblies need to + be loaded in a separate AppDomain to ensure the latest version + is always loaded. + + The App/Web.config file from the startup project is also copied + to ensure that any configuration is applied. + + + + + Initializes a new instance of the ToolingFacade class. + + + The name of the assembly that contains the migrations configuration to be used. + + + The namespace qualified name of migrations configuration to be used. + + + The working directory containing the compiled assemblies. + + + The path of the config file from the startup project. + + + The path of the application data directory from the startup project. + Typically the App_Data directory for web applications or the working directory for executables. + + + The connection to the database to be migrated. + If null is supplied, the default connection for the context will be used. + + + + + Releases all unmanaged resources used by the facade. + + + + + Gets the fully qualified name of all types deriving from . + + All context types found. + + + + Gets the fully qualified name of a type deriving from . + + The name of the context type. If null, the single context type found in the assembly will be returned. + The context type found. + + + + Gets a list of all migrations that have been applied to the database. + + Ids of applied migrations. + + + + Gets a list of all migrations that have not been applied to the database. + + Ids of pending migrations. + + + + Updates the database to the specified migration. + + + The Id of the migration to migrate to. + If null is supplied, the database will be updated to the latest migration. + + Value indicating if data loss during automatic migration is acceptable. + + + + Generates a SQL script to migrate between two migrations. + + + The migration to update from. + If null is supplied, a script to update the current database will be produced. + + + The migration to update to. + If null is supplied, a script to update to the latest migration will be produced. + + Value indicating if data loss during automatic migration is acceptable. + The generated SQL script. + + + + Scaffolds a code-based migration to apply any pending model changes. + + The name for the generated migration. + The programming language of the generated migration. + The root namespace of the project the migration will be added to. + Whether or not to include model changes. + The scaffolded migration. + + + + Scaffolds the initial code-based migration corresponding to a previously run database initializer. + + The programming language of the generated migration. + The root namespace of the project the migration will be added to. + The scaffolded migration. + + + + + + + Releases all resources used by the facade. + + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + + Gets or sets an action to be run to log information. + + + + + Gets or sets an action to be run to log warnings. + + + + + Gets or sets an action to be run to log verbose information. + + + + + Base class for loggers that can be used for the migrations process. + + + + + Logs an informational message. + + The message to be logged. + + + + Logs a warning that the user should be made aware of. + + The message to be logged. + + + + Logs some additional information that should only be presented to the user if they request verbose output. + + The message to be logged. + + + + Generates VB.Net code for a code-based migration. + + + + + + + + Generates the primary code file that the user can view and edit. + + Operations to be performed by the migration. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates the code behind file with migration metadata. + + Unique identifier of the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates a property to return the source or target model in the code behind file. + + Name of the property. + Value to be returned. + Text writer to add the generated code to. + + + + Generates a namespace, using statements and class definition. + + Namespace that code should be generated in. + Name of the class that should be generated. + Text writer to add the generated code to. + Base class for the generated class. + A value indicating if this class is being generated for a code-behind file. + Namespaces for which Imports directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used. + + + + Generates the closing code for a class that was started with WriteClassStart. + + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify a set of column names using a lambda expression. + + The columns to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify the definition for a . + + The column definition to generate code for. + Text writer to add the generated code to. + A value indicating whether to include the column name in the definition. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column of unknown data type. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Removes any invalid characters from the name of an database artifact. + + The name to be scrubbed. + The scrubbed name. + + + + Gets the type name to use for a column of the given data type. + + The data type to translate. + The type name to use in the generated migration. + + + + Quotes an identifier using appropriate escaping to allow it to be stored in a string. + + The identifier to be quoted. + The quoted identifier. + + + + This class is used by Code First Migrations to read and write migration history + from the database. It is not intended to be used by other code and is only public + so that it can be accessed by EF when running under partial trust. It may be + changed or removed in the future. + + + + + Gets or sets the Id of the migration this row represents. + + + + + Gets or sets the date and time that this migrations history entry was created. + + + + + Gets or sets the state of the model after this migration was applied. + + + + + Gets or sets the version of Entity Framework that created this entry. + + + + + This is a version of the HistoryContext that still includes CreatedOn in its model. + It is used when figuring out whether or not the CreatedOn column exists and so should + be dropped. + + + + + Represents an error that occurs when an automatic migration would result in data loss. + + + + + Represents errors that occur inside the Code First Migrations pipeline. + + + + + Initializes a new instance of the MigrationsException class. + + + + + Initializes a new instance of the MigrationsException class. + + The message that describes the error. + + + + Initializes a new instance of the MigrationsException class. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the MigrationsException class with serialized data. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + + + Initializes a new instance of the AutomaticDataLossException class. + + The message that describes the error. + + + + Represents an error that occurs when there are pending model changes after applying the last migration and automatic migration is disabled. + + + + + Initializes a new instance of the AutomaticMigrationsDisabledException class. + + The message that describes the error. + + + + Provides additional metadata about a code-based migration. + + + + + Gets the unique identifier for the migration. + + + + + Gets the state of the model before this migration is run. + + + + + Gets the state of the model after this migration is run. + + + + + Decorator to provide logging during migrations operations.. + + + + + Initializes a new instance of the MigratorLoggingDecorator class. + + The migrator that this decorator is wrapping. + The logger to write messages to. + + + + Decorator to produce a SQL script instead of applying changes to the database. + Using this decorator to wrap will prevent + from applying any changes to the target database. + + + + + Initializes a new instance of the MigratorScriptingDecorator class. + + The migrator that this decorator is wrapping. + + + + + Represents a column being added to a table. + + + + + Represents an operation to modify a database schema. + + + + + Initializes a new instance of the MigrationOperation class. + + + + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets additional arguments that may be processed by providers. + + + + + Gets an operation that will revert this operation. + + + + + Gets a value indicating if this operation may result in data loss. + + + + + Initializes a new instance of the AddColumnOperation class. + + The name of the table the column should be added to. + Details of the column being added. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column should be added to. + + + + + Gets the details of the column being added. + + + + + Gets an operation that represents dropping the added column. + + + + + + + + Represents a foreign key constraint being added to a table. + + + + + Base class for changes that affect foreign key constraints. + + + + + Initializes a new instance of the ForeignKeyOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the name of the table that the foreign key constraint targets. + + + + + Gets or sets the name of the table that the foreign key columns exist in. + + + + + The names of the foreign key column(s). + + + + + Gets a value indicating if a specific name has been supplied for this foreign key constraint. + + + + + Gets or sets the name of this foreign key constraint. + If no name is supplied, a default name will be calculated. + + + + + Initializes a new instance of the AddForeignKeyOperation class. + The PrincipalTable, PrincipalColumns, DependentTable and DependentColumns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to create an index on the foreign key column(s). + + An operation to add the index. + + + + The names of the column(s) that the foreign key constraint should target. + + + + + Gets or sets a value indicating if cascade delete should be configured on the foreign key constraint. + + + + + Gets an operation to drop the foreign key constraint. + + + + + + + + Represents adding a primary key to a table. + + + + + Common base class to represent operations affecting primary keys. + + + + + Initializes a new instance of the PrimaryKeyOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the name of the table that contains the primary key. + + + + + Gets the column(s) that make up the primary key. + + + + + Gets a value indicating if a specific name has been supplied for this primary key. + + + + + Gets or sets the name of this primary key. + If no name is supplied, a default name will be calculated. + + + + + + + + Initializes a new instance of the AddPrimaryKeyOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to drop the primary key. + + + + + Represents altering an existing column. + + + + + Initializes a new instance of the AlterColumnOperation class. + + The name of the table that the column belongs to. + Details of what the column should be altered to. + Value indicating if this change will result in data loss. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the AlterColumnOperation class. + + The name of the table that the column belongs to. + Details of what the column should be altered to. + Value indicating if this change will result in data loss. + An operation to revert this alteration of the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table that the column belongs to. + + + + + Gets the new definition for the column. + + + + + Gets an operation that represents reverting the alteration. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents information about a column. + + + + + Initializes a new instance of the class. + + The data type for this column. + + + + Initializes a new instance of the class. + + The data type for this column. + + Additional details about the data type. + This includes details such as maximum length, nullability etc. + + + + + Determines if this column is a narrower data type than another column. + Used to determine if altering the supplied column definition to this definition will result in data loss. + + The column to compare to. + Details of the database provider being used. + True if this column is of a narrower data type. + + + + Gets the data type for this column. + + + + + Gets the CLR type corresponding to the database type of this column. + + + + + Gets the default value for the CLR type corresponding to the database type of this column. + + + + + Gets additional details about the data type of this column. + This includes details such as maximum length, nullability etc. + + + + + Gets or sets the name of the column. + + + + + Gets or sets a provider specific data type to use for this column. + + + + + Gets or sets a value indicating if this column can store null values. + + + + + Gets or sets a value indicating if values for this column will be generated by the database using the identity pattern. + + + + + Gets or sets the maximum length for this column. + Only valid for array data types. + + + + + Gets or sets the precision for this column. + Only valid for decimal data types. + + + + + Gets or sets the scale for this column. + Only valid for decimal data types. + + + + + Gets or sets a constant value to use as the default value for this column. + + + + + Gets or sets a SQL expression used as the default value for this column. + + + + + Gets or sets a value indicating if this column is fixed length. + Only valid for array data types. + + + + + Gets or sets a value indicating if this column supports Unicode characters. + Only valid for textual data types. + + + + + Gets or sets a value indicating if this column should be configured as a timestamp. + + + + + Represents creating a database index. + + + + + Common base class for operations affecting indexes. + + + + + Initializes a new instance of the IndexOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the table the index belongs to. + + + + + Gets or sets the columns that are indexed. + + + + + Gets a value indicating if a specific name has been supplied for this index. + + + + + Gets or sets the name of this index. + If no name is supplied, a default name will be calculated. + + + + + Initializes a new instance of the CreateIndexOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets a value indicating if this is a unique index. + + + + + Gets an operation to drop this index. + + + + + + + + Represents creating a table. + + + + + Initializes a new instance of the CreateTableOperation class. + + Name of the table to be created. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be created. + + + + + Gets the columns to be included in the new table. + + + + + Gets or sets the primary key for the new table. + + + + + Gets an operation to drop the table. + + + + + + + + Represents deleting a new record from the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Common base class for operations that affect the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Initializes a new instance of the HistoryOperation class. + + Name of the migrations history table. + Name of the migration being affected. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the migrations history table. + + + + + Gets the name of the migration being affected. + + + + + + + + Initializes a new instance of the DeleteHistoryOperation class. + + Name of the migrations history table. + Id of the migration record to be deleted. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Represents a column being dropped from a table. + + + + + Initializes a new instance of the DropColumnOperation class. + + The name of the table the column should be dropped from. + The name of the column to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropColumnOperation class. + + The name of the table the column should be dropped from. + The name of the column to be dropped. + The operation that represents reverting the drop operation. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column should be dropped from. + + + + + Gets the name of the column to be dropped. + + + + + Gets an operation that represents reverting dropping the column. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents a foreign key constraint being dropped from a table. + + + + + Initializes a new instance of the DropForeignKeyOperation class. + The PrincipalTable, DependentTable and DependentColumns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropForeignKeyOperation class. + + The operation that represents reverting dropping the foreign key constraint. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to drop the associated index on the foreign key column(s). + + An operation to drop the index. + + + + Gets an operation that represents reverting dropping the foreign key constraint. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents dropping an existing index. + + + + + Initializes a new instance of the DropIndexOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropIndexOperation class. + + The operation that represents reverting dropping the index. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation that represents reverting dropping the index. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents dropping a primary key from a table. + + + + + Initializes a new instance of the DropPrimaryKeyOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to add the primary key. + + + + + Represents dropping an existing table. + + + + + Initializes a new instance of the DropTableOperation class. + + The name of the table to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropTableOperation class. + + The name of the table to be dropped. + An operation that represents reverting dropping the table. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be dropped. + + + + + Gets an operation that represents reverting dropping the table. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents inserting a new record into the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Initializes a new instance of the InsertHistoryOperation class. + + Name of the migrations history table. + Id of the migration record to be inserted. + Value to be stored in the model column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the value to store in the history table representing the target model of the migration. + + + + + Gets the value to store in the history table indicating the version of Entity Framework used to produce this migration. + + + + + + + + Represents moving a table from one schema to another. + + + + + Initializes a new instance of the MoveTableOperation class. + + Name of the table to be moved. + Name of the schema to move the table to. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be moved. + + + + + Gets the name of the schema to move the table to. + + + + + Gets an operation that moves the table back to its original schema. + + + + + + + + Represents renaming an existing column. + + + + + Initializes a new instance of the RenameColumnOperation class. + + Name of the table the column belongs to. + Name of the column to be renamed. + New name for the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column belongs to. + + + + + Gets the name of the column to be renamed. + + + + + Gets the new name for the column. + + + + + Gets an operation that reverts the rename. + + + + + + + + Represents renaming an existing table. + + + + + Initializes a new instance of the RenameTableOperation class. + + Name of the table to be renamed. + New name for the table. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be renamed. + + + + + Gets the new name for the table. + + + + + Gets an operation that reverts the rename. + + + + + + + + Represents a provider specific SQL statement to be executed directly against the target database. + + + + + Initializes a new instance of the SqlOperation class. + + The SQL to be executed. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the SQL to be executed. + + + + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + + + + Common base class for providers that convert provider agnostic migration + operations into database provider specific SQL commands. + + + + + Converts a set of migration operations into database provider specific SQL. + + The operations to be converted. + Token representing the version of the database being targeted. + A list of SQL statements to be executed to perform the migration operations. + + + + Represents a migration operation that has been translated into a SQL statement. + + + + + Gets or sets the SQL to be executed to perform this migration operation. + + + + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + Provider to convert provider agnostic migration operations into SQL commands + that can be run against Microsoft SQL Server Compact Edition. + + + + + Provider to convert provider agnostic migration operations into SQL commands + that can be run against a Microsoft SQL Server database. + + + + + Converts a set of migration operations into Microsoft SQL Server specific SQL. + + The operations to be converted. + Token representing the version of SQL Server being targeted (i.e. "2005", "2008"). + A list of SQL statements to be executed to perform the migration operations. + + + + Creates an empty connection for the current provider. + Allows derived providers to use connection other than . + + + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL to mark a table as a system table. + Generated SQL should be added using the Statement method. + + The table to mark as a system table. + + + + Generates SQL to create a database schema. + Generated SQL should be added using the Statement method. + + The name of the schema to create. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL to specify a constant byte[] default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant bool default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant DateTime default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant DateTimeOffset default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant Guid default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant string default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant TimeSpan default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify the data type of a column. + This method just generates the actual type, not the SQL to create the column. + + The definition of the column. + SQL representing the data type. + + + + Generates a quoted name. The supplied name may or may not contain the schema. + + The name to be quoted. + The quoted name. + + + + Quotes an identifier for SQL Server. + + The identifier to be quoted. + The quoted identifier. + + + + Adds a new Statement to be executed against the database. + + The statement to be executed. + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + Gets a new that can be used to build SQL. + + This is just a helper method to create a writer. Writing to the writer will + not cause SQL to be registered for execution. You must pass the generated + SQL to the Statement method. + + An empty text writer to use for SQL generation. + + + + Adds a new Statement to be executed against the database. + + The writer containing the SQL to be executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Utility class to prep the user's config file to run in an AppDomain + + + + + Updates a config file by adding binding redirects for EntityFramework.dll. + This ensures that the user's code can be ran in an AppDomain and the exact + same version of the assembly will be used for both domains. + + That path of the user's config file. Can also be null or a path to an non-existent file. + The path of the updated config file. It is the caller's responsibility to delete this. + + + + The same as but works in partial trust. + + + + + Specifies the default tab string. This field is constant. + + + + + Initializes a new instance of the IndentedTextWriter class using the specified text writer and default tab string. + + The to use for output. + + + + Initializes a new instance of the IndentedTextWriter class using the specified text writer and tab string. + + The to use for output. + The tab string to use for indentation. + + + + Closes the document being written to. + + + + + Flushes the stream. + + + + + Outputs the tab string once for each level of indentation according to the property. + + + + + Writes the specified string to the text stream. + + The string to write. + + + + Writes the text representation of a Boolean value to the text stream. + + The Boolean value to write. + + + + Writes a character to the text stream. + + The character to write. + + + + Writes a character array to the text stream. + + The character array to write. + + + + Writes a subarray of characters to the text stream. + + The character array to write data from. + Starting index in the buffer. + The number of characters to write. + + + + Writes the text representation of a Double to the text stream. + + The double to write. + + + + Writes the text representation of a Single to the text stream. + + The single to write. + + + + Writes the text representation of an integer to the text stream. + + The integer to write. + + + + Writes the text representation of an 8-byte integer to the text stream. + + The 8-byte integer to write. + + + + Writes the text representation of an object to the text stream. + + The object to write. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string. + The object to write into the formatted string. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string to use. + The first object to write into the formatted string. + The second object to write into the formatted string. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string to use. + The argument array to output. + + + + Writes the specified string to a line without tabs. + + The string to write. + + + + Writes the specified string, followed by a line terminator, to the text stream. + + The string to write. + + + + Writes a line terminator. + + + + + Writes the text representation of a Boolean, followed by a line terminator, to the text stream. + + The Boolean to write. + + + + Writes a character, followed by a line terminator, to the text stream. + + The character to write. + + + + Writes a character array, followed by a line terminator, to the text stream. + + The character array to write. + + + + Writes a subarray of characters, followed by a line terminator, to the text stream. + + The character array to write data from. + Starting index in the buffer. + The number of characters to write. + + + + Writes the text representation of a Double, followed by a line terminator, to the text stream. + + The double to write. + + + + Writes the text representation of a Single, followed by a line terminator, to the text stream. + + The single to write. + + + + Writes the text representation of an integer, followed by a line terminator, to the text stream. + + The integer to write. + + + + Writes the text representation of an 8-byte integer, followed by a line terminator, to the text stream. + + The 8-byte integer to write. + + + + Writes the text representation of an object, followed by a line terminator, to the text stream. + + The object to write. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string. + The object to write into the formatted string. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string to use. + The first object to write into the formatted string. + The second object to write into the formatted string. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string to use. + The argument array to output. + + + + Writes the text representation of a UInt32, followed by a line terminator, to the text stream. + + A UInt32 to output. + + + + Gets the encoding for the text writer to use. + + + An that indicates the encoding for the text writer to use. + + + + + Gets or sets the new line character to use. + + + The new line character to use. + + + + + Gets or sets the number of spaces to indent. + + + The number of spaces to indent. + + + + + Gets the to use. + + + The to use. + + + + + Used for generating values that are always in sequential + order for the calling thread. + + + + + Returns the value of unless this value would be the same as the + last value returned by this thread calling this method, in which case the thread pushes the value + a little bit into the future. The comparison is in terms of the form used to store migration ID + in the database--i.e. to the 1/10 second. + + + There should never be any pushing to the future involved for normal use of migrations, but when + this method is called in rapid succession while testing or otherwise calling the DbMigrator APIs + there may be occasional sleeping. + + + + + Same as UtcNow method bur returns the time in the timestamp format used in migration IDs. + + + + + Convention to apply column ordering specified via + or the API. This convention throws if a duplicate configured column order + is detected. + + + + + Convention to apply column ordering specified via + or the API. + + + + + Identifies conventions that can be removed from a instance. + + /// + Note that implementations of this interface must be immutable. + + + + + Strongly-typed and parameterized string resources. + + + + + A string like "Applying automatic migration: {0}." + + + + + A string like "Reverting automatic migration: {0}." + + + + + A string like "Applying code-based migration: {0}." + + + + + A string like "Reverting code-based migration: {0}." + + + + + A string like "Applying code-based migrations: [{1}]." + + + + + A string like "Reverting migrations: [{1}]." + + + + + A string like "Target database is already at version {0}." + + + + + A string like "Target database is: {0}." + + + + + A string like "'{1}' (DataSource: {0}, Provider: {2}, Origin: {3})" + + + + + A string like "The specified target migration '{0}' does not exist. Ensure that target migration refers to an existing migration id." + + + + + A string like "The Foreign Key on table '{0}' with columns '{1}' could not be created because the principal key columns could not be determined. Use the AddForeignKey fluent API to fully specify the Foreign Key." + + + + + A string like "'{0}' is not a valid target migration. When targeting a previously applied automatic migration, use the full migration id including timestamp." + + + + + A string like "'{0}' is not a valid migration. Code-based migrations must be used for both source and target when scripting the upgrade between them." + + + + + A string like "The target context '{0}' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory." + + + + + A string like "The specified migration name '{0}' is ambiguous. Specify the full migration id including timestamp instead." + + + + + A string like "The migrations configuration type '{0}' was not be found in the assembly '{1}'." + + + + + A string like "More than one migrations configuration type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the one to use." + + + + + A string like "No migrations configuration type was found in the assembly '{0}'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)." + + + + + A string like "More than one migrations configuration type was found in the assembly '{0}'. Specify the name of the one to use." + + + + + A string like "The type '{0}' is not a migrations configuration type." + + + + + A string like "The migrations configuration type '{0}' must have a public default constructor." + + + + + A string like "The migrations configuration type '{0}' must not be abstract." + + + + + A string like "The migrations configuration type '{0}' must not be generic." + + + + + A string like "In VB.NET projects, the migrations namespace '{0}' must be under the root namespace '{1}'. Update the migrations project's root namespace to allow classes under the migrations namespace to be added." + + + + + + A string like "No MigrationSqlGenerator found for provider '{0}'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators." + + + + + A string like "Could not load assembly '{0}'. (If you are using Code First Migrations inside Visual Studio this can happen if the startUp project for your solution does not reference the project that contains your migrations. You can either change the startUp project for your solution or use the -StartUpProjectName parameter.)" + + + + + A string like "No context type was found in the assembly '{0}'." + + + + + A string like "More than one context type was found in the assembly '{0}'." + + + + + A string like "To enable migrations for {0}, use Enable-Migrations -ContextTypeName {0}." + + + + + A string like "The context type '{0}' was not found in the assembly '{1}'." + + + + + A string like "More than one context type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the context." + + + + + A string like "The argument '{0}' cannot be null, empty or contain only white space." + + + + + A string like "The argument property '{0}' cannot be null." + + + + + A string like "The precondition '{0}' failed. {1}" + + + + + A string like "The type '{0}' has already been configured as a complex type. It cannot be reconfigured as an entity type." + + + + + A string like "The type '{0}' has already been configured as an entity type. It cannot be reconfigured as a complex type." + + + + + A string like "The key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + A string like "The foreign key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + A string like "The property '{0}' is not a declared property on type '{1}'. Verify that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property." + + + + + A string like "The navigation property '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property." + + + + + A string like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'." + + + + + A string like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. Use dotted paths for nested properties: C#: 't => t.MyProperty.MyProperty' VB.Net: 'Function(t) t.MyProperty.MyProperty'." + + + + + A string like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + A string like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + + A string like "Conflicting configuration settings were specified for property '{0}' on type '{1}': {2}" + + + + + A string like "Conflicting configuration settings were specified for column '{0}' on table '{1}': {2}" + + + + + A string like "{0} = {1} conflicts with {2} = {3}" + + + + + A string like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from ComplexObject." + + + + + A string like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject." + + + + + A string like "The navigation property '{0}' declared on type '{1}' cannot be the inverse of itself." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting foreign keys." + + + + + A string like "Values of incompatible types ('{1}' and '{2}') were assigned to the '{0}' discriminator column. Values of the same type must be specified. To explicitly specify the type of the discriminator column use the HasColumnType method." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting mapping information." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting cascade delete operations using 'WillCascadeOnDelete'." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting multiplicities." + + + + + A string like "The MaxLengthAttribute on property '{0}' on type '{1} is not valid. The Length value must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "The StringLengthAttribute on property '{0}' on type '{1}' is not valid. The maximum length must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "Unable to determine composite primary key ordering for type '{0}'. Use the ColumnAttribute or the HasKey method to specify an order for composite primary keys." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. Name must not be empty." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The foreign key name '{2}' was not found on the dependent type '{3}'. The Name value should be a comma separated list of foreign key property names." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The navigation property '{2}' was not found on the dependent type '{1}'. The Name value should be a valid navigation property name." + + + + + A string like "Unable to determine a composite foreign key ordering for foreign key on type {0}. When using the ForeignKey data annotation on composite foreign key properties ensure order is specified by using the Column data annotation or the fluent API." + + + + + A string like "The InversePropertyAttribute on property '{2}' on type '{3}' is not valid. The property '{0}' is not a valid navigation property on the related type '{1}'. Ensure that the property exists and is a valid reference or collection navigation property." + + + + + A string like "A relationship cannot be established from property '{0}' on type '{1}' to property '{0}' on type '{1}'. Check the values in the InversePropertyAttribute to ensure relationship definitions are unique and reference from one navigation property to its corresponding inverse navigation property." + + + + + A string like "\t{0}: {1}: {2}" + + + + + A string like "A key is registered for the derived type '{0}'. Keys can only be registered for the root type '{1}'." + + + + + A string like "The {0} value '{1}' already exists in the user-defined dictionary." + + + + + A string like "The type '{0}' has already been mapped to table '{1}'. Specify all mapping aspects of a table in a single Map call." + + + + + A string like "Map was called more than once for type '{0}' and at least one of the calls didn't specify the target table name." + + + + + A string like "The derived type '{0}' has already been mapped using the chaining syntax. A derived type can only be mapped once using the chaining syntax." + + + + + A string like "An "is not null" condition cannot be specified on property '{0}' on type '{1}' because this property is not included in the model. Check that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation." + + + + + A string like "Values of type '{0}' cannot be used as type discriminator values. Supported types include byte, signed byte, bool, int16, int32, int64, and string." + + + + + A string like "Unable to add the convention '{0}'. Could not find an existing convention of type '{1}' in the current convention set." + + + + + A string like "Not all properties for type '{0}' have been mapped. Either map those properties or explicitly excluded them from the model." + + + + + A string like "Unable to determine the provider name for connection of type '{0}'." + + + + + A string like "The qualified table name '{0}' contains an invalid schema name. Schema names must have a non-zero length." + + + + + A string like "The qualified table name '{0}' contains an invalid table name. Table names must have a non-zero length." + + + + + A string like "Properties for type '{0}' can only be mapped once. Ensure the MapInheritedProperties method is only used during one call to the Map method." + + + + + A string like "Properties for type '{0}' can only be mapped once. Ensure the Properties method is used and that repeated calls specify each non-key property only once." + + + + + A string like "Properties for type '{0}' can only be mapped once. The non-key property '{1}' is mapped more than once. Ensure the Properties method specifies each non-key property only once." + + + + + A string like "The property '{1}' on type '{0}' cannot be mapped because it has been explicitly excluded from the model or it is of a type not supported by the DbModelBuilderVersion being used." + + + + + A string like "The entity types '{0}' and '{1}' cannot share table '{2}' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them." + + + + + A string like "You cannot use Ignore method on the property '{0}' on type '{1}' because this type inherits from the type '{2}' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type." + + + + + A string like "The property '{0}' cannot be used as a key property on the entity '{1}' because the property type is not a valid key type. Only scalar types, string and byte[] are supported key types." + + + + + A string like "The specified table '{0}' was not found in the model. Ensure that the table name has been correctly specified." + + + + + A string like "The specified association foreign key columns '{0}' are invalid. The number of columns specified must match the number of primary key columns." + + + + + A string like "Unable to determine the principal end of an association between the types '{0}' and '{1}'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." + + + + + A string like "The abstract type '{0}' has no mapped descendents and so cannot be mapped. Either remove '{0}' from the model or add one or more types deriving from '{0}' to the model. " + + + + + A string like "The type '{0}' cannot be mapped as defined because it maps inherited properties from types that use entity splitting or another form of inheritance. Either choose a different inheritance mapping strategy so as to not map inherited properties, or change all types in the hierarchy to map inherited properties and to not use splitting. " + + + + + A string like "The table '{0}' was configured but is not used in any mappings. Verify the mapping configuration for '{0}' is correct." + + + + + A string like "The configured column orders for the table '{0}' contains duplicates. Ensure the specified column order values are distinct." + + + + + A string like "The enum or spatial property '{1}' on type '{0}' cannot be mapped. Use DbModelBuilderVersion 'V5_0' or later to map enum or spatial properties." + + + + + A string like "Multiple potential primary key properties named '{0}' but differing only by case were found on entity type '{1}'. Configure the primary key explicitly using the HasKey fluent API or the KeyAttribute data annotation." + + + + + A string like "Cannot get value for property '{0}' from entity of type '{1}' because the property has no get accessor." + + + + + A string like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor." + + + + + + A string like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor and is in the '{2}' state." + + + + + A string like "Member '{0}' cannot be called for property '{1}' on entity of type '{2}' because the property is not part of the Entity Data Model." + + + + + + A string like "Cannot call the {0} method for an entity of type '{1}' on a DbSet for entities of type '{2}'. Only entities of type '{2}' or derived from type '{2}' can be added, attached, or removed." + + + + + A string like "Cannot call the Create method for the type '{0}' on a DbSet for entities of type '{1}'. Only entities of type '{1}' or derived from type '{1}' can be created." + + + + + + + A string like "The property '{0}' on type '{1}' is a collection navigation property. The Collection method should be used instead of the Reference method." + + + + + A string like "The property '{0}' on type '{1}' is a reference navigation property. The Reference method should be used instead of the Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a navigation property. The Reference and Collection methods can only be used with navigation properties. Use the Property or ComplexProperty method." + + + + + A string like "The property '{0}' on type '{1}' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a complex property. The ComplexProperty method can only be used with complex properties. Use the Property, Reference or Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a primitive property, complex property, collection navigation property, or reference navigation property." + + + + + A string like ""The property '{0}' from the property path '{1}' is not a complex property on type '{2}'. Property paths must be composed of complex properties for all except the final property."" + + + + + A string like ""The property path '{0}' cannot be used for navigation properties. Property paths can only be used to access primitive or complex properties."" + + + + + A string like "The navigation property '{0}' on entity type '{1}' cannot be used for entities of type '{2}' because it refers to entities of type '{3}'." + + + + + A string like "The generic type argument '{0}' cannot be used with the Member method when accessing the collection navigation property '{1}' on entity type '{2}'. The generic type argument '{3}' must be used instead." + + + + + A string like "The property '{0}' on entity type '{1}' cannot be used for objects of type '{2}' because it is a property for objects of type '{3}'." + + + + + A string like "The expression passed to method {0} must represent a property defined on the type '{1}'." + + + + + A string like "{0} cannot be used for entities in the {1} state." + + + + + A string like "Cannot set non-nullable property '{0}' of type '{1}' to null on object of type '{2}'." + + + + + A string like "The property '{0}' in the entity of type '{1}' is null. Store values cannot be obtained for an entity with a null complex property." + + + + + A string like "Cannot assign value of type '{0}' to property '{1}' of type '{2}' in property values for type '{3}'." + + + + + A string like "The '{0}' property does not exist or is not mapped for the type '{1}'." + + + + + A string like "Cannot copy values from DbPropertyValues for type '{0}' into DbPropertyValues for type '{1}'." + + + + + A string like "Cannot copy from property values for object of type '{0}' into property values for object of type '{1}'." + + + + + A string like "The value of the complex property '{0}' on entity of type '{1}' is null. Complex properties cannot be set to null and values cannot be set for null complex properties." + + + + + A string like "The value of the nested property values property '{0}' on the values for entity of type '{1}' is null. Nested property values cannot be set to null and values cannot be set for null complex properties." + + + + + A string like "Cannot set the value of the nested property '{0}' because value of the complex property '{1}' to which it belongs is null." + + + + + A string like "Cannot set the original value of the nested property '{0}' because the original value of the complex property '{1}' to which it belongs is null." + + + + + A string like "The model backing the '{0}' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)." + + + + + A string like "Database '{0}' cannot be created because it already exists." + + + + + + + A string like "Failed to set database initializer of type '{0}' for DbContext type '{1}' specified in the application configuration. See inner exception for details." + + + + + A string like "Configuration for DbContext type '{0}' is specified multiple times in the application configuration. Each context can only be configured once." + + + + + A string like "Failed to set Database.DefaultConnectionFactory to an instance of the '{0}' type as specified in the application configuration. See inner exception for details." + + + + + A string like "The type '{0}' could not be found. The type name must be an assembly-qualified name." + + + + + A string like "The connection string '{0}' in the application's configuration file does not contain the required providerName attribute."" + + + + + A string like "The entity found was of type {0} when an entity of type {1} was requested." + + + + + A string like "The type '{0}' is mapped as a complex type. The Set method, DbSet objects, and DbEntityEntry objects can only be used with entity types, not complex types." + + + + + A string like "The type '{0}' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute." + + + + + A string like "The entity type {0} is not part of the model for the current context." + + + + + A string like "No connection string named '{0}' could be found in the application config file." + + + + + A string like "The collection navigation property '{0}' on the entity of type '{1}' cannot be set because the entity type does not define a navigation property with a set accessor." + + + + + A string like "Multiple object sets per type are not supported. The object sets '{0}' and '{1}' can both contain instances of type '{2}'." + + + + + A string like "The context type '{0}' must have a public constructor taking an EntityConnection." + + + + + A string like "An unexpected exception was thrown during validation of '{0}' when invoking {1}.IsValid. See the inner exception for details." + + + + + A string like "An unexpected exception was thrown during validation of '{0}' when invoking {1}.Validate. See the inner exception for details." + + + + + A string like "The database name '{0}' is not supported because it is an MDF file name. A full connection string must be provided to attach an MDF file." + + + + + A string like "The context factory type '{0}' must have a public default constructor." + + + + + A string like "The '{0}' property of EdmPrimitiveType is fixed and cannot be set." + + + + + A string like "The namespace '{0}' is a system namespace and cannot be used by other schemas. Choose another namespace name." + + + + + A string like "Role '{0}' in AssociationSets '{1}' and '{2}' refers to the same EntitySet '{3}' in EntityContainer '{4}'. Make sure that if two or more AssociationSets refer to the same AssociationType, the ends do not refer to the same EntitySet." + + + + + A string like "The referenced EntitySet '{0}' for End '{1}' could not be found in the containing EntityContainer." + + + + + A string like "Type '{0}' is derived from type '{1}' that is the type for EntitySet '{2}'. Type '{0}' defines new concurrency requirements that are not allowed for subtypes of base EntitySet types." + + + + + A string like "EntitySet '{0}' is based on type '{1}' that has no keys defined." + + + + + A string like "The end name '{0}' is already defined." + + + + + A string like "The key specified in EntityType '{0}' is not valid. Property '{1}' is referenced more than once in the Key element." + + + + + A string like "Property '{0}' has a CollectionKind specified but is not a collection property." + + + + + A string like "Property '{0}' has a CollectionKind specified. CollectionKind is only supported in version 1.1 EDM models." + + + + + A string like "ComplexType '{0}' is marked as abstract. Abstract ComplexTypes are only supported in version 1.1 EDM models." + + + + + A string like "ComplexType '{0}' has a BaseType specified. ComplexType inheritance is only supported in version 1.1 EDM models." + + + + + A string like "Key part '{0}' for type '{1}' is not valid. All parts of the key must be non-nullable." + + + + + A string like "The property '{0}' in EntityType '{1}' is not valid. All properties that are part of the EntityKey must be of PrimitiveType." + + + + + A string like "Key usage is not valid. The {0} class cannot define keys because one of its base classes ('{1}') defines keys." + + + + + A string like "EntityType '{0}' has no key defined. Define the key for this EntityType." + + + + + A string like "NavigationProperty is not valid. Role '{0}' or Role '{1}' is not defined in Relationship '{2}'." + + + + + A string like "End '{0}' on relationship '{1}' cannot have an operation specified because its multiplicity is '*'. Operations cannot be specified on ends with multiplicity '*'." + + + + + A string like "Each Name and PluralName in a relationship must be unique. '{0}' is already defined." + + + + + A string like "In relationship '{0}', the Principal and Dependent Role of the referential constraint refer to the same Role in the relationship type." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Valid values for multiplicity for the Principal Role are '0..1' or '1'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because all the properties in the Dependent Role are nullable, multiplicity of the Principal Role must be '0..1'." + + + + + A string like "Multiplicity conflicts with the referential constraint in Role '{0}' in relationship '{1}'. Because at least one of the properties in the Dependent Role is non-nullable, multiplicity of the Principal Role must be '1'." + + + + + A string like "Multiplicity conflicts with the referential constraint in Role '{0}' in relationship '{1}'. Because all of the properties in the Dependent Role are non-nullable, multiplicity of the Principal Role must be '1'." + + + + + A string like "Properties referred by the Dependent Role '{0}' must be a subset of the key of the EntityType '{1}' referred to by the Dependent Role in the referential constraint for relationship '{2}'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because the Dependent Role refers to the key properties, the upper bound of the multiplicity of the Dependent Role must be '1'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because the Dependent Role properties are not the key properties, the upper bound of the multiplicity of the Dependent Role must be '*'." + + + + + A string like "The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property '{0}' on entity '{1}' does not match the type of property '{2}' on entity '{3}' in the referential constraint '{4}'." + + + + + A string like "There is no property with name '{0}' defined in the type referred to by Role '{1}'." + + + + + A string like "A nullable ComplexType is not supported. Property '{0}' must not allow nulls." + + + + + A string like "A property cannot be of type '{0}'. The property type must be a ComplexType or a PrimitiveType." + + + + + A string like "Each member name in an EntityContainer must be unique. A member with name '{0}' is already defined." + + + + + A string like "Each type name in a schema must be unique. Type name '{0}' is already defined." + + + + + A string like "Name '{0}' cannot be used in type '{1}'. Member names cannot be the same as their enclosing type." + + + + + A string like "Each property name in a type must be unique. Property name '{0}' is already defined." + + + + + A string like "A cycle was detected in the type hierarchy of '{0}'." + + + + + A string like "A property cannot be of type '{0}'. The property type must be a ComplexType, a PrimitiveType, or a CollectionType." + + + + + A string like "A property cannot be of type {0}. The property type must be a ComplexType, a PrimitiveType or an EnumType." + + + + + A string like "The specified name must not be longer than 480 characters: '{0}'." + + + + + A string like "The specified name is not allowed: '{0}'." + + + + + A string like "The field {0} must be a string or array type with a maximum length of '{1}'." + + + + + A string like "The field {0} must be a string or array type with a minimum length of '{1}'." + + + + + A string like "No connection string named '{0}' could be found in the application config file." + + + + + A string like "AutomaticMigration" + + + + + A string like "BootstrapMigration" + + + + + A string like "InitialCreate" + + + + + A string like "Automatic migration was not applied because it would result in data loss." + + + + + A string like "[Inserting migration history record]" + + + + + A string like "[Deleting migration history record]" + + + + + A string like "[Updating EdmMetadata model hash]" + + + + + A string like "Running Seed method." + + + + + A string like "No pending code-based migrations." + + + + + A string like "Explicit" + + + + + A string like "Upgrading history table." + + + + + A string like "Cannot scaffold the next migration because the target database was created with a version of Code First earlier than EF 4.3 and does not contain the migrations history table. To start using migrations against this database, ensure the current model is compatible with the target database and execute the migrations Update process. (In Visual Studio you can use the Update-Database command from Package Manager Console to execute the migrations Update process)." + + + + + A string like "Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration." + + + + + A string like "Scripting the downgrade between two specified migrations is not supported." + + + + + A string like "Direct column renaming is not supported by SQL Server Compact. To rename a column in SQL Server Compact, you will need to recreate it." + + + + + A string like "One or more validation errors were detected during model generation:" + + + + + A string like "A circular ComplexType hierarchy was detected. Self-referencing ComplexTypes are not supported." + + + + + A string like "Connection to the database failed. The connection string is configured with an invalid LocalDB server name. This may have been set in 'global.asax' by a pre-release version of MVC4. The default connection factory is now set in web.config so the line in 'global.asax' starting with 'Database.DefaultConnectionFactory = ' should be removed. See http://go.microsoft.com/fwlink/?LinkId=243166 for details." + + + + + A string like "An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct." + + + + + A string like "Setting IsModified to false for a modified property is not supported." + + + + + A string like "An error occurred while saving entities that do not expose foreign key properties for their relationships. The EntityEntries property will return null because a single entity cannot be identified as the source of the exception. Handling of exceptions while saving can be made easier by exposing foreign key properties in your entity types. See the InnerException for details." + + + + + A string like "The set of property value names is read-only." + + + + + A string like "A property of a complex type must be set to an instance of the generic or non-generic DbPropertyValues class for that type." + + + + + A string like "Model compatibility cannot be checked because the DbContext instance was not created using Code First patterns. DbContext instances created from an ObjectContext or using an EDMX file cannot be checked for compatibility." + + + + + A string like "Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions." + + + + + A string like "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations." + + + + + A string like "The context cannot be used while the model is being created." + + + + + A string like "The DbContext class cannot be used with models that have multiple entity sets per type (MEST)." + + + + + A string like "The operation cannot be completed because the DbContext has been disposed." + + + + + A string like "The provider factory returned a null connection." + + + + + A string like "The DbConnectionFactory instance returned a null connection." + + + + + A string like "The number of primary key values passed must match number of primary key values defined on the entity." + + + + + A string like "The type of one of the primary key values did not match the type defined in the entity. See inner exception for details." + + + + + A string like "Multiple entities were found in the Added state that match the given primary key values." + + + + + A string like "Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList()." + + + + + A string like "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties." + + + + + A string like "Cannot initialize a DbContext from an entity connection string or an EntityConnection instance together with a DbCompiledModel. If an entity connection string or EntityConnection instance is used, then the model will be created from the metadata in the connection. If a DbCompiledModel is used, then the connection supplied should be a standard database connection (for example, a SqlConnection instance) rather than an entity connection." + + + + + A string like "Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used." + + + + + A string like "Validation failed for one or more entities. See 'EntityValidationErrors' property for more details." + + + + + A string like "An exception occurred while initializing the database. See the InnerException for details." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing ObjectContext is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing DbCompiledModel is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Code generated using the T4 templates for Database First and Model First development may not work correctly if used in Code First mode. To continue using Database First or Model First ensure that the Entity Framework connection string is specified in the config file of executing application. To use these classes, that were generated from Database First or Model First, with Code First add any additional configuration using attributes or the DbModelBuilder API and then remove the code that throws this exception." + + + + + A string like "The generic 'Set' method cannot be called with a proxy type. Either use the actual entity type or call the non-generic 'Set' method." + + + + + A string like "NavigationProperty is not valid. The FromRole and ToRole are the same." + + + + + A string like "OnDelete can be specified on only one End of an EdmAssociation." + + + + + A string like "The number of properties in the Dependent and Principal Roles in a relationship constraint must be identical." + + + + + A string like "The name is missing or not valid." + + + + + A string like "AssociationEnd must not be null." + + + + + A string like "DependentEnd must not be null." + + + + + A string like "DependentProperties must not be empty." + + + + + A string like "Association must not be null." + + + + + A string like "ResultEnd must not be null." + + + + + A string like "EntityType must not be null." + + + + + A string like "ElementType must not be null." + + + + + A string like "ElementType must not be null." + + + + + A string like "SourceSet must not be null." + + + + + A string like "TargetSet must not be null." + + + + + A string like "The type is not a valid EdmTypeReference." + + + + + A string like "Serializer can only serialize an EdmModel that has one EdmNamespace and one EdmEntityContainer." + + + + + A string like "MaxLengthAttribute must have a Length value that is greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "MinLengthAttribute must have a Length value that is zero or greater." + + + + + A string like "The connection can not be overridden because this context was created from an existing ObjectContext." + + + + + A string like "Can not override the connection for this context with a standard DbConnection because the original connection was an EntityConnection." + + + + + A string like "Can not override the connection for this context with an EntityConnection because the original connection was a standard DbConnection." + + + + + Strongly-typed and parameterized exception factory. + + + + + Migrations.Infrastructure.AutomaticDataLossException with message like "Automatic migration was not applied because it would result in data loss." + + + + + Migrations.Infrastructure.MigrationsException with message like "Cannot scaffold the next migration because the target database was created with a version of Code First earlier than EF 4.3 and does not contain the migrations history table. To start using migrations against this database, ensure the current model is compatible with the target database and execute the migrations Update process. (In Visual Studio you can use the Update-Database command from Package Manager Console to execute the migrations Update process)." + + + + + Migrations.Infrastructure.MigrationsException with message like "The specified target migration '{0}' does not exist. Ensure that target migration refers to an existing migration id." + + + + + Migrations.Infrastructure.MigrationsException with message like "The Foreign Key on table '{0}' with columns '{1}' could not be created because the principal key columns could not be determined. Use the AddForeignKey fluent API to fully specify the Foreign Key." + + + + + Migrations.Infrastructure.MigrationsException with message like "'{0}' is not a valid target migration. When targeting a previously applied automatic migration, use the full migration id including timestamp." + + + + + Migrations.Infrastructure.MigrationsException with message like "'{0}' is not a valid migration. Code-based migrations must be used for both source and target when scripting the upgrade between them." + + + + + Migrations.Infrastructure.MigrationsException with message like "The target context '{0}' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory." + + + + + Migrations.Infrastructure.MigrationsException with message like "The specified migration name '{0}' is ambiguous. Specify the full migration id including timestamp instead." + + + + + Migrations.Infrastructure.AutomaticMigrationsDisabledException with message like "Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration." + + + + + Migrations.Infrastructure.MigrationsException with message like "Scripting the downgrade between two specified migrations is not supported." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' was not be found in the assembly '{1}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one migrations configuration type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the one to use." + + + + + Migrations.Infrastructure.MigrationsException with message like "No migrations configuration type was found in the assembly '{0}'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one migrations configuration type was found in the assembly '{0}'. Specify the name of the one to use." + + + + + Migrations.Infrastructure.MigrationsException with message like "The type '{0}' is not a migrations configuration type." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must have a public default constructor." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must not be abstract." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must not be generic." + + + + + Migrations.Infrastructure.MigrationsException with message like "Direct column renaming is not supported by SQL Server Compact. To rename a column in SQL Server Compact, you will need to recreate it." + + + + + Migrations.Infrastructure.MigrationsException with message like "In VB.NET projects, the migrations namespace '{0}' must be under the root namespace '{1}'. Update the migrations project's root namespace to allow classes under the migrations namespace to be added." + + + + + + Migrations.Infrastructure.MigrationsException with message like "No MigrationSqlGenerator found for provider '{0}'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators." + + + + + Migrations.Infrastructure.MigrationsException with message like "No context type was found in the assembly '{0}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "The context type '{0}' was not found in the assembly '{1}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one context type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the context." + + + + + ArgumentException with message like "The argument '{0}' cannot be null, empty or contain only white space." + + + + + ArgumentException with message like "The argument property '{0}' cannot be null." + + + + + ArgumentException with message like "The precondition '{0}' failed. {1}" + + + + + InvalidOperationException with message like "The type '{0}' has already been configured as a complex type. It cannot be reconfigured as an entity type." + + + + + InvalidOperationException with message like "The type '{0}' has already been configured as an entity type. It cannot be reconfigured as a complex type." + + + + + InvalidOperationException with message like "The key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + InvalidOperationException with message like "The foreign key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + InvalidOperationException with message like "The property '{0}' is not a declared property on type '{1}'. Verify that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property." + + + + + InvalidOperationException with message like "The navigation property '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property." + + + + + InvalidOperationException with message like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'." + + + + + InvalidOperationException with message like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. Use dotted paths for nested properties: C#: 't => t.MyProperty.MyProperty' VB.Net: 'Function(t) t.MyProperty.MyProperty'." + + + + + InvalidOperationException with message like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + InvalidOperationException with message like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + + InvalidOperationException with message like "Conflicting configuration settings were specified for property '{0}' on type '{1}': {2}" + + + + + InvalidOperationException with message like "Conflicting configuration settings were specified for column '{0}' on table '{1}': {2}" + + + + + InvalidOperationException with message like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from ComplexObject." + + + + + InvalidOperationException with message like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' cannot be the inverse of itself." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting foreign keys." + + + + + MappingException with message like "Values of incompatible types ('{1}' and '{2}') were assigned to the '{0}' discriminator column. Values of the same type must be specified. To explicitly specify the type of the discriminator column use the HasColumnType method." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting mapping information." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting cascade delete operations using 'WillCascadeOnDelete'." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting multiplicities." + + + + + InvalidOperationException with message like "The MaxLengthAttribute on property '{0}' on type '{1} is not valid. The Length value must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "The StringLengthAttribute on property '{0}' on type '{1}' is not valid. The maximum length must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "Unable to determine composite primary key ordering for type '{0}'. Use the ColumnAttribute or the HasKey method to specify an order for composite primary keys." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. Name must not be empty." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The foreign key name '{2}' was not found on the dependent type '{3}'. The Name value should be a comma separated list of foreign key property names." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The navigation property '{2}' was not found on the dependent type '{1}'. The Name value should be a valid navigation property name." + + + + + InvalidOperationException with message like "Unable to determine a composite foreign key ordering for foreign key on type {0}. When using the ForeignKey data annotation on composite foreign key properties ensure order is specified by using the Column data annotation or the fluent API." + + + + + InvalidOperationException with message like "The InversePropertyAttribute on property '{2}' on type '{3}' is not valid. The property '{0}' is not a valid navigation property on the related type '{1}'. Ensure that the property exists and is a valid reference or collection navigation property." + + + + + InvalidOperationException with message like "A relationship cannot be established from property '{0}' on type '{1}' to property '{0}' on type '{1}'. Check the values in the InversePropertyAttribute to ensure relationship definitions are unique and reference from one navigation property to its corresponding inverse navigation property." + + + + + InvalidOperationException with message like "A key is registered for the derived type '{0}'. Keys can only be registered for the root type '{1}'." + + + + + InvalidOperationException with message like "The type '{0}' has already been mapped to table '{1}'. Specify all mapping aspects of a table in a single Map call." + + + + + InvalidOperationException with message like "Map was called more than once for type '{0}' and at least one of the calls didn't specify the target table name." + + + + + InvalidOperationException with message like "The derived type '{0}' has already been mapped using the chaining syntax. A derived type can only be mapped once using the chaining syntax." + + + + + InvalidOperationException with message like "An "is not null" condition cannot be specified on property '{0}' on type '{1}' because this property is not included in the model. Check that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation." + + + + + ArgumentException with message like "Values of type '{0}' cannot be used as type discriminator values. Supported types include byte, signed byte, bool, int16, int32, int64, and string." + + + + + InvalidOperationException with message like "Unable to add the convention '{0}'. Could not find an existing convention of type '{1}' in the current convention set." + + + + + InvalidOperationException with message like "Not all properties for type '{0}' have been mapped. Either map those properties or explicitly excluded them from the model." + + + + + NotSupportedException with message like "Unable to determine the provider name for connection of type '{0}'." + + + + + ArgumentException with message like "The qualified table name '{0}' contains an invalid schema name. Schema names must have a non-zero length." + + + + + ArgumentException with message like "The qualified table name '{0}' contains an invalid table name. Table names must have a non-zero length." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. Ensure the MapInheritedProperties method is only used during one call to the Map method." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. Ensure the Properties method is used and that repeated calls specify each non-key property only once." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. The non-key property '{1}' is mapped more than once. Ensure the Properties method specifies each non-key property only once." + + + + + InvalidOperationException with message like "The property '{1}' on type '{0}' cannot be mapped because it has been explicitly excluded from the model or it is of a type not supported by the DbModelBuilderVersion being used." + + + + + InvalidOperationException with message like "The entity types '{0}' and '{1}' cannot share table '{2}' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them." + + + + + InvalidOperationException with message like "You cannot use Ignore method on the property '{0}' on type '{1}' because this type inherits from the type '{2}' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type." + + + + + InvalidOperationException with message like "The property '{0}' cannot be used as a key property on the entity '{1}' because the property type is not a valid key type. Only scalar types, string and byte[] are supported key types." + + + + + InvalidOperationException with message like "The specified table '{0}' was not found in the model. Ensure that the table name has been correctly specified." + + + + + InvalidOperationException with message like "The specified association foreign key columns '{0}' are invalid. The number of columns specified must match the number of primary key columns." + + + + + InvalidOperationException with message like "A circular ComplexType hierarchy was detected. Self-referencing ComplexTypes are not supported." + + + + + InvalidOperationException with message like "Unable to determine the principal end of an association between the types '{0}' and '{1}'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." + + + + + InvalidOperationException with message like "The abstract type '{0}' has no mapped descendents and so cannot be mapped. Either remove '{0}' from the model or add one or more types deriving from '{0}' to the model. " + + + + + NotSupportedException with message like "The type '{0}' cannot be mapped as defined because it maps inherited properties from types that use entity splitting or another form of inheritance. Either choose a different inheritance mapping strategy so as to not map inherited properties, or change all types in the hierarchy to map inherited properties and to not use splitting. " + + + + + InvalidOperationException with message like "The table '{0}' was configured but is not used in any mappings. Verify the mapping configuration for '{0}' is correct." + + + + + InvalidOperationException with message like "The configured column orders for the table '{0}' contains duplicates. Ensure the specified column order values are distinct." + + + + + NotSupportedException with message like "The enum or spatial property '{1}' on type '{0}' cannot be mapped. Use DbModelBuilderVersion 'V5_0' or later to map enum or spatial properties." + + + + + InvalidOperationException with message like "Multiple potential primary key properties named '{0}' but differing only by case were found on entity type '{1}'. Configure the primary key explicitly using the HasKey fluent API or the KeyAttribute data annotation." + + + + + InvalidOperationException with message like "Cannot get value for property '{0}' from entity of type '{1}' because the property has no get accessor." + + + + + InvalidOperationException with message like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor." + + + + + + NotSupportedException with message like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor and is in the '{2}' state." + + + + + InvalidOperationException with message like "Member '{0}' cannot be called for property '{1}' on entity of type '{2}' because the property is not part of the Entity Data Model." + + + + + + ArgumentException with message like "Cannot call the {0} method for an entity of type '{1}' on a DbSet for entities of type '{2}'. Only entities of type '{2}' or derived from type '{2}' can be added, attached, or removed." + + + + + ArgumentException with message like "Cannot call the Create method for the type '{0}' on a DbSet for entities of type '{1}'. Only entities of type '{1}' or derived from type '{1}' can be created." + + + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is a collection navigation property. The Collection method should be used instead of the Reference method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is a reference navigation property. The Reference method should be used instead of the Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a navigation property. The Reference and Collection methods can only be used with navigation properties. Use the Property or ComplexProperty method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a complex property. The ComplexProperty method can only be used with complex properties. Use the Property, Reference or Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a primitive property, complex property, collection navigation property, or reference navigation property." + + + + + ArgumentException with message like ""The property '{0}' from the property path '{1}' is not a complex property on type '{2}'. Property paths must be composed of complex properties for all except the final property."" + + + + + NotSupportedException with message like "Setting IsModified to false for a modified property is not supported." + + + + + ArgumentException with message like ""The property path '{0}' cannot be used for navigation properties. Property paths can only be used to access primitive or complex properties."" + + + + + ArgumentException with message like "The navigation property '{0}' on entity type '{1}' cannot be used for entities of type '{2}' because it refers to entities of type '{3}'." + + + + + ArgumentException with message like "The generic type argument '{0}' cannot be used with the Member method when accessing the collection navigation property '{1}' on entity type '{2}'. The generic type argument '{3}' must be used instead." + + + + + ArgumentException with message like "The property '{0}' on entity type '{1}' cannot be used for objects of type '{2}' because it is a property for objects of type '{3}'." + + + + + ArgumentException with message like "The expression passed to method {0} must represent a property defined on the type '{1}'." + + + + + InvalidOperationException with message like "{0} cannot be used for entities in the {1} state." + + + + + InvalidOperationException with message like "Cannot set non-nullable property '{0}' of type '{1}' to null on object of type '{2}'." + + + + + InvalidOperationException with message like "The property '{0}' in the entity of type '{1}' is null. Store values cannot be obtained for an entity with a null complex property." + + + + + InvalidOperationException with message like "Cannot assign value of type '{0}' to property '{1}' of type '{2}' in property values for type '{3}'." + + + + + NotSupportedException with message like "The set of property value names is read-only." + + + + + ArgumentException with message like "The '{0}' property does not exist or is not mapped for the type '{1}'." + + + + + ArgumentException with message like "Cannot copy values from DbPropertyValues for type '{0}' into DbPropertyValues for type '{1}'." + + + + + ArgumentException with message like "Cannot copy from property values for object of type '{0}' into property values for object of type '{1}'." + + + + + ArgumentException with message like "A property of a complex type must be set to an instance of the generic or non-generic DbPropertyValues class for that type." + + + + + InvalidOperationException with message like "The value of the complex property '{0}' on entity of type '{1}' is null. Complex properties cannot be set to null and values cannot be set for null complex properties." + + + + + InvalidOperationException with message like "The value of the nested property values property '{0}' on the values for entity of type '{1}' is null. Nested property values cannot be set to null and values cannot be set for null complex properties." + + + + + InvalidOperationException with message like "Cannot set the value of the nested property '{0}' because value of the complex property '{1}' to which it belongs is null." + + + + + InvalidOperationException with message like "Cannot set the original value of the nested property '{0}' because the original value of the complex property '{1}' to which it belongs is null." + + + + + InvalidOperationException with message like "The model backing the '{0}' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)." + + + + + InvalidOperationException with message like "Database '{0}' cannot be created because it already exists." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the DbContext instance was not created using Code First patterns. DbContext instances created from an ObjectContext or using an EDMX file cannot be checked for compatibility." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations." + + + + + + + InvalidOperationException with message like "Failed to set database initializer of type '{0}' for DbContext type '{1}' specified in the application configuration. See inner exception for details." + + + + + InvalidOperationException with message like "Configuration for DbContext type '{0}' is specified multiple times in the application configuration. Each context can only be configured once." + + + + + InvalidOperationException with message like "Failed to set Database.DefaultConnectionFactory to an instance of the '{0}' type as specified in the application configuration. See inner exception for details." + + + + + InvalidOperationException with message like "The type '{0}' could not be found. The type name must be an assembly-qualified name." + + + + + InvalidOperationException with message like "The context cannot be used while the model is being created." + + + + + InvalidOperationException with message like "The DbContext class cannot be used with models that have multiple entity sets per type (MEST)." + + + + + InvalidOperationException with message like "The operation cannot be completed because the DbContext has been disposed." + + + + + InvalidOperationException with message like "The provider factory returned a null connection." + + + + + InvalidOperationException with message like "The connection string '{0}' in the application's configuration file does not contain the required providerName attribute."" + + + + + InvalidOperationException with message like "The DbConnectionFactory instance returned a null connection." + + + + + ArgumentException with message like "The number of primary key values passed must match number of primary key values defined on the entity." + + + + + ArgumentException with message like "The type of one of the primary key values did not match the type defined in the entity. See inner exception for details." + + + + + InvalidOperationException with message like "The entity found was of type {0} when an entity of type {1} was requested." + + + + + InvalidOperationException with message like "Multiple entities were found in the Added state that match the given primary key values." + + + + + InvalidOperationException with message like "The type '{0}' is mapped as a complex type. The Set method, DbSet objects, and DbEntityEntry objects can only be used with entity types, not complex types." + + + + + InvalidOperationException with message like "The type '{0}' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute." + + + + + InvalidOperationException with message like "The entity type {0} is not part of the model for the current context." + + + + + NotSupportedException with message like "Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList()." + + + + + ArgumentException with message like "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties." + + + + + InvalidOperationException with message like "No connection string named '{0}' could be found in the application config file." + + + + + InvalidOperationException with message like "Cannot initialize a DbContext from an entity connection string or an EntityConnection instance together with a DbCompiledModel. If an entity connection string or EntityConnection instance is used, then the model will be created from the metadata in the connection. If a DbCompiledModel is used, then the connection supplied should be a standard database connection (for example, a SqlConnection instance) rather than an entity connection." + + + + + NotSupportedException with message like "The collection navigation property '{0}' on the entity of type '{1}' cannot be set because the entity type does not define a navigation property with a set accessor." + + + + + NotSupportedException with message like "Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used." + + + + + InvalidOperationException with message like "Multiple object sets per type are not supported. The object sets '{0}' and '{1}' can both contain instances of type '{2}'." + + + + + InvalidOperationException with message like "The context type '{0}' must have a public constructor taking an EntityConnection." + + + + + NotSupportedException with message like "The database name '{0}' is not supported because it is an MDF file name. A full connection string must be provided to attach an MDF file." + + + + + DataException with message like "An exception occurred while initializing the database. See the InnerException for details." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing ObjectContext is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing DbCompiledModel is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + InvalidOperationException with message like "The context factory type '{0}' must have a public default constructor." + + + + + InvalidOperationException with message like "The generic 'Set' method cannot be called with a proxy type. Either use the actual entity type or call the non-generic 'Set' method." + + + + + InvalidOperationException with message like "MaxLengthAttribute must have a Length value that is greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "MinLengthAttribute must have a Length value that is zero or greater." + + + + + InvalidOperationException with message like "No connection string named '{0}' could be found in the application config file." + + + + + InvalidOperationException with message like "The connection can not be overridden because this context was created from an existing ObjectContext." + + + + + InvalidOperationException with message like "Can not override the connection for this context with a standard DbConnection because the original connection was an EntityConnection." + + + + + InvalidOperationException with message like "Can not override the connection for this context with an EntityConnection because the original connection was a standard DbConnection." + + + + + The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument. + + + + + The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method. + + + + + The exception that is thrown when the author has yet to implement the logic at this point in the program. This can act as an exception based TODO tag. + + + + + The exception that is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or write to a stream that does not support the invoked functionality. + + + + + AutoGenerated resource class. Usage: + + string s = EntityRes.GetString(EntityRes.MyIdenfitier); + + + + + Allows the construction and modification of a user-specified annotation (name-value pair) on a instance. + + + + + Gets or sets an optional namespace that can be used to distinguish the annotation from others with the same value. + + + + + Gets or sets the name of the annotation. + + + + + Gets or sets the value of the annotation. + + + + + + + + + DataModelEventArgs is the base argument type for all events raised by consumers of Entity Data Model (EDM) models. + + + + + Gets a value indicating the that caused the event to be raised. + + + + + Gets an optional value indicating which property of the source item caused the event to be raised. + + + + + Gets a value that identifies the specific error that is being raised. + + + + + Gets an optional descriptive message the describes the error that is being raised. + + + + + DbAliasedMetadataItem provides the base type for all Database Metadata types that can have an optional that should be used instead of the item's when referring to the item in the database. + + + + + NamedDbItem is the base for all types in the Database Metadata construction and modification API with a property. + + + + + The base for all all Database Metadata types that support annotation using . + + + + + DbDataModelItem is the base for all types in the Database Metadata construction and modification API. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets or sets the currently assigned name. + + + + + Gets an optional alternative identifier that should be used when referring to this item in the database. + + + + + When implemented in derived types, allows the construction and modification of a column in a Database Metadata table or row. + + + + + Gets or sets a string indicating the database-specific type of the column. + + + + + Gets or sets a value indicating whether the column is nullable. + + + + + Gets or sets an optional instance that applies additional constraints to the referenced database-specific type of the column. + + + + + Allows the construction and modification of a database in a Database Metadata model. + + + + + Gets or sets an optional value that indicates the database model version. + + + + + Gets or sets the collection of instances that specifies the schemas within the database. + + + + + Allows the construction and modification of a foreign key constraint sourced by a instance. + + + + + Gets or sets the to take when a delete operation is attempted. + + + + + Indicates which Database Metadata concept is represented by a given item. + + + + + Database Kind + + + + + Schema Kind + + + + + Foreign Key Constraint Kind + + + + + Function Kind + + + + + Function Parameter Kind + + + + + Function Return or Parameter Type Kind + + + + + Row Column Kind + + + + + Table Kind + + + + + Table Column Kind + + + + + Primitive Facets Kind + + + + + Specifies the action to take on a given operation. + + + + + Default behavior + + + + + Restrict the operation + + + + + Cascade the operation + + + + + Allows the construction and modification of additional constraints that can be applied to a specific use of a primitive type in a Database Metadata item. + + + + + Returns true if any facet value property currently has a non-null value; otherwise returns false . + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have a fixed or variable length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have its intrinsic maximum length, rather than a specific value. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to be Unicode or non-Unicode. + + + + + Gets or sets an optional value indicating the current constraint on the type's maximum length. + + + + + Gets or sets an optional value indicating the current constraint on the type's precision. + + + + + Gets or sets an optional value indicating the current constraint on the type's scale. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating whether the spatial type is to be type checked strictly. + + + + + Allows the construction and modification of a database schema in a database model. + + + + + Gets or sets the collection of instances that specifies the tables declared within the schema. + + + + + DbSchemaMetadataItem is the base for all types that can be contained in a schema. + + + + + Allows the construction and modification of a column in a table. + + + + + Gets or sets a value indicating whether the column is part of the table's primary key. + + + + + Gets or sets a value indicating if and how the value of the column is automatically generated. + + + + + Gets or sets an optional value indicating the collation specific to this table column. + + + + + Gets or sets an optional value that specifies the default value for the column. + + + + + Allows the construction and modification a table in a database schema. + + + + + Gets or sets the collection of instances that specifies the columns present within the table. + + + + + Gets or sets the collection of instances from the collection of the table that are part of the primary key. + + + + + Gets or sets the collection of instances that defines the foreign key constraints sourced from the table. + + + + + Represents a specific use of a type in a Database Metadata item. + + + + + Gets or sets an optional instance that applies additional constraints to a referenced primitive type. + + + Accessing this property forces the creation of a DbPrimitiveTypeFacets value if no value has previously been set. Use to determine whether or not this property currently has a value. + + + + + Gets or sets a value indicating whether the represented type is a collection type. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered nullable. + + + + + Gets a value indicating whether the type has been configured as a row type by the addition of one or more RowColumns. + + + + + Represents the mapping of an EDM association end ( ) as a collection of property mappings ( ). + + + + + DbMappingMetadataItem is the base for all types in the EDM-to-Database Mapping construction and modification API that support annotation using . + + + + + DbMappingModelItem is the base for all types in the EDM-to-Database Mapping construction and modification API. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets an value representing the association end that is being mapped. + + + + + Gets the collection of s that specifies how the association end key properties are mapped to the table. + + + + + Gets an value representing the association set that is being mapped. + + + + + Gets a value representing the table to which the entity type's properties are being mapped. + + + + + Gets the collection of s that specifies the constant or null values that columns in must have for this type mapping to apply. + + + + + Allows the construction and modification of a condition for a column in a database table. + + + + + Gets or sets a value representing the table column which must contain for this condition to hold. + + + + + Gets or sets the value that must contain for this condition to hold. + + + + + Gets or sets an value representing the model that is being mapped. + + + + + Gets or sets a value representing the database that is the target of the mapping. + + + + + Gets or sets the collection of s that specifies how the model's entity containers are mapped to the database. + + + + + Represents the mapping of an entity property to a column in a database table. + + + + + Gets or sets the collection of instances that defines the mapped property, beginning from a property declared by the mapped entity type and optionally proceeding through properties of complex property result types. + + + + + Gets or sets a value representing the table column to which the entity property is being mapped. + + + + + Allows the construction and modification of the mapping of an EDM entity container ( ) to a database ( ). + + + + + Gets or sets an value representing the entity container that is being mapped. + + + + + Gets or sets the collection of s that specifies how the container's entity sets are mapped to the database. + + + + + Gets the collection of s that specifies how the container's association sets are mapped to the database. + + + + + Allows the construction and modification of the mapping of an EDM entity set ( ) to a database ( ). + + + + + Gets or sets an value representing the entity set that is being mapped. + + + + + Gets or sets the collection of s that specifies how the set's entity types are mapped to the database. + + + + + Allows the construction and modification of a complete or partial mapping of an EDM entity type ( ) or type hierarchy to a specific database table ( ). + + + + + Gets or sets an value representing the entity type or hierarchy that is being mapped. + + + + + Gets or sets a value indicating whether this type mapping applies to and all its direct or indirect subtypes ( true ), or only to ( false ). + + + + + Gets a value representing the table to which the entity type's properties are being mapped. + + + + + Gets the collection of s that specifies how the type's properties are mapped to the table. + + + + + Gets the collection of s that specifies the constant or null values that columns in must have for this type mapping fragment to apply. + + + + + Indicates which EDM-to-Database Mapping concept is represented by a given item. + + + + + Database Mapping Kind + + + + + Entity Container Mapping Kind + + + + + Entity Set Mapping Kind + + + + + Association Set Mapping Kind + + + + + Entity Type Mapping Kind + + + + + Query View Mapping Kind + + + + + Entity Type Mapping Fragment Kind + + + + + Edm Property Mapping Kind + + + + + Association End Mapping Kind + + + + + Column Condition Kind + + + + + Property Condition Kind + + + + + Allows the construction and modification of a constraint applied to an Entity Data Model (EDM) association. + + + + + Gets or sets the that represents the 'dependent' end of the constraint; properties from this association end's entity type contribute to the collection. + + + + + Gets or sets the collection of instances from the of the constraint. The values of these properties are constrained against the primary key values of the remaining, 'principal' association end's entity type. + + + + + Allows the construction and modification of one end of an Entity Data Model (EDM) association. + + + + + Gets or sets the entity type referenced by this association end. + + + + + Gets or sets the of this association end, which indicates the multiplicity of the end and whether or not it is required. + + + + + Gets or sets the to take when a delete operation is attempted. + + + + + Indicates the multiplicity of an and whether or not it is required. + + + + + Allows the construction and modification of an association set in an Entity Data Model (EDM) ). + + + + + Represents an item in an Entity Data Model (EDM) . + + + + + Gets or sets the that specifies the association type for the set. + + + + + Gets or sets the that specifies the entity set corresponding to the association end for this association set. + + + + + Gets or sets the that specifies the entity set corresponding to the association end for this association set. + + + + + + The base for all all Entity Data Model (EDM) types that represent a structured type from the EDM type system. + + + + + Gets or sets the that defines the source end of the association. + + + + + Gets or sets the that defines the target end of the association. + + + + + Gets or sets the optional constraint that indicates whether the relationship is an independent association (no constraint present) or a foreign key relationship ( specified). + + + + + Collection semantics for properties. + + + + + The property does not have a collection type or does not specify explicit collection semantics. + + + + + The property is an unordered collection that may contain duplicates. + + + + + The property is an ordered collection that may contain duplicates. + + + + + Allows the construction and modification of a complex type in an Entity Data Model (EDM) . + + + + + Gets or sets the optional that indicates the base complex type of the complex type. + + + + + Gets or sets a value indicating whether the complex type is abstract. + + + + + Gets or sets the collection of instances that describe the (scalar or complex) properties of the complex type. + + + + + Concurrency mode for properties. + + + + + Default concurrency mode: the property is never validated at write time + + + + + Fixed concurrency mode: the property is always validated at write time + + + + + Allows the construction and modification of an entity container in an Entity Data Model (EDM) . + + + + + Gets all s declared within the namspace. Includes s and s. + + + + + Gets or sets the collection of s that specifies the association sets within the container. + + + + + Gets or sets the collection of s that specifies the entity sets within the container. + + + + + Allows the construction and modification of an entity set in an Entity Data Model (EDM) . + + + + + Gets or sets the that specifies the entity type for the set. + + + + + Allows the construction and modification of an entity type in an Entity Data Model (EDM) . + + + + + Gets or sets the optional that indicates the base entity type of the entity type. + + + + + Gets or sets a value indicating whether the entity type is abstract. + + + + + Gets or sets the collection of s that specifies the properties declared by the entity type. + + + + + Gets or sets the collection of s that indicates which properties from the collection are part of the entity key. + + + + + Gets or sets the optional collection of s that specifies the navigation properties declared by the entity type. + + + + + Indicates which Entity Data Model (EDM) concept is represented by a given item. + + + + + Association End Kind + + + + + Association Set Kind + + + + + Association Type Kind + + + + + Collection Type Kind + + + + + Complex Type Kind + + + + + Entity Container Kind + + + + + Entity Set Kind + + + + + Entity Type Kind + + + + + Function Group Kind + + + + + Function Overload Kind + + + + + Function Import Kind + + + + + Function Parameter Kind + + + + + Navigation Property Kind + + + + + EdmProperty Type Kind + + + + + Association Constraint Type Kind + + + + + Ref Type Kind + + + + + Row Column Kind + + + + + Row Type Kind + + + + + Type Reference Kind + + + + + Model Kind + + + + + Namespace Kind + + + + + Primitive Facets Kind + + + + + Primitive Type Kind + + + + + Enum Type Kind + + + + + Enum Type Member Kind + + + + + EdmModel is the top-level container for namespaces and entity containers belonging to the same logical Entity Data Model (EDM) model. + + + + + Gets or sets an optional value that indicates the entity model version. + + + + + Gets or sets the containers declared within the model. + + + + + Gets or sets the namespaces declared within the model. + + + + + Allows the construction and modification of a namespace in an . + + + + + Gets all s declared within the namspace. Includes s, s, s. + + + + + Gets or sets the s declared within the namespace. + + + + + Gets or sets the s declared within the namespace. + + + + + Gets or sets the s declared within the namespace. + + + + + Allows the construction and modification of an Entity Data Model (EDM) navigation property. + + + + + Gets or sets the that specifies the association over which navigation takes place. + + + + + Gets or sets the that specifies which association end is the 'destination' end of the navigation and produces the navigation property result. + + + + + Specifies the action to take on a given operation. + + + + + Default behavior + + + + + Restrict the operation + + + + + Cascade the operation + + + + + Represents one of the fixed set of Entity Data Model (EDM) primitive types. + + + + + The base for all all Entity Data Model (EDM) types that represent a scalar type from the EDM type system. + + + + + Retrieves the EdmPrimitiveType instance with the corresponding to the specified value, if any. + + The name of the primitive type instance to retrieve + The EdmPrimitiveType with the specified name, if successful; otherwise null . + true if the given name corresponds to an EDM primitive type name; otherwise false . + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets an value that indicates which Entity Data Model (EDM) primitive type this type represents. + + + + + Allows the construction and modification of additional constraints that can be applied to a specific use of a primitive type in an Entity Data Model (EDM) item. See . + + + + + Returns true if any facet value property currently has a non-null value; otherwise returns false . + + + + + Gets or sets an optional value indicating the current constraint on the type's maximum length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have its intrinsic maximum length, rather than a specific value. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have a fixed or variable length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to be Unicode or non-Unicode. + + + + + Gets or sets an optional value indicating the current constraint on the type's precision. + + + + + Gets or sets an optional value indicating the current constraint on the type's scale. + + + + + Gets or sets an optional value indicating that the current spatial type's SRID is unconstrained. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating whether the spatial type is to be type checked strictly. + + + + + Primitive Types as defined by the Entity Data Model (EDM). + + + + + Binary Type Kind + + + + + Boolean Type Kind + + + + + Byte Type Kind + + + + + DateTime Type Kind + + + + + Decimal Type Kind + + + + + Double Type Kind + + + + + Guid Type Kind + + + + + Single Type Kind + + + + + SByte Type Kind + + + + + Int16 Type Kind + + + + + Int32 Type Kind + + + + + Int64 Type Kind + + + + + String Type Kind + + + + + Time Type Kind + + + + + DateTimeOffset Type Kind + + + + + Geometry Type Kind + + + + + Geography Type Kind + + + + + Geometric point type kind + + + + + Geometric linestring type kind + + + + + Geometric polygon type kind + + + + + Geometric multi-point type kind + + + + + Geometric multi-linestring type kind + + + + + Geometric multi-polygon type kind + + + + + Geometric collection type kind + + + + + Geographic point type kind + + + + + Geographic linestring type kind + + + + + Geographic polygon type kind + + + + + Geographic multi-point type kind + + + + + Geographic multi-linestring type kind + + + + + Geographic multi-polygon type kind + + + + + Geographic collection type kind + + + + + Allows the construction and modification of a primitive- or complex-valued property of an Entity Data Model (EDM) entity or complex type. + + + + + Gets or sets an value that indicates which collection semantics - if any - apply to the property. + + + + + Gets or sets a value that indicates whether the property is used for concurrency validation. + + + + + Gets or sets on optional value that indicates an initial default value for the property. + + + + + Gets or sets an that specifies the result type of the property. + + + + + Enumerates all s declared or inherited by an . + + + + + Allows the construction and modification of a specific use of a type in an Entity Data Model (EDM) item. See for examples. + + + + + Gets or sets a value indicating the collection rank of the type reference. A collection rank greater than zero indicates that the type reference represents a collection of its referenced . + + + + + Gets or sets a value indicating the referenced by this type reference. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered nullable. + + + + + Gets or sets an optional instance that applies additional constraints to a referenced primitive type. + + + Accessing this property forces the creation of an EdmPrimitiveTypeFacets value if no value has previously been set. Use to determine whether or not this property currently has a value. + + + + + Gets a value indicating whether the property of this type reference has been assigned an value with at least one facet value specified. + + + + + Indicates whether this type reference represents a collection of its referenced (when is greater than zero) or not. + + + + + Indicates whether the property of this type reference currently refers to an , is not a collection type, and does not have primitive facet values specified. + + + + + Gets the currently referred to by this type reference, or null if the type reference is a collection type or does not refer to a complex type. + + + + + Indicates whether the property of this type reference currently refers to an and is not a collection type. + + + + + Gets the currently referred to by this type reference, or null if the type reference is a collection type or does not refer to a primitive type. + + + + + Contains constant values that apply to the EDM model, regardless of source (for CSDL specific constants see ). + + + + + Parsing code taken from System.dll's System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(string) method to avoid LinkDemand needed to call this method + + + + + + + + + + + Constants for CSDL XML. + + + + + Constants for C-S MSL XML. + + + + + Constants for SSDL XML. + + + + + The acceptable range for this enum is 0000 - 0999; the range 10,000-15,000 is reserved for tools. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Precision out of range + + + + + Scale out of range + + + + + + + + + + + + + One of the required facets is missing + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The facet isn't allow by the property type. + + + + + This facet value is constant and is specified in the schema + + + + + + + + + + + + + Multiplicity value was malformed + + + + + The value for the Action attribute is invalid or not allowed in the current context + + + + + An error occurred processing the On<Operation> elements + + + + + Ends were given for the Property element of a EntityContainer that is not a RelationshipSet + + + + + The extent name used in the EntittyContainerType End does not match the name of any of the EntityContainerProperties in the containing EntityContainer + + + + + An end element was not given, and cannot be inferred because too many EntityContainerEntitySet elements that are good possibilities. + + + + + An end element was not given, and cannot be inferred because there is no EntityContainerEntitySets that are the correct type to be used as an EntitySet. + + + + + Not a valid parameter direction for the parameter in a function + + + + + Unable to infer an optional schema part, to resolve this; be more explicit + + + + + Invalid facet attribute(s) specified in provider manifest + + + + + Invalid role value in the relationship constraint + + + + + Invalid Property in relationship constraint + + + + + Type mismatch between ToProperty and FromProperty in the relationship constraint + + + + + Invalid multiplicity in FromRole in the relationship constraint + + + + + The number of properties in the FromProperty and ToProperty in the relationship constraint must be identical + + + + + No Properties defined in either FromProperty or ToProperty in the relationship constraint + + + + + Missing constraint in relationship type in ssdl + + + + + Same role referred in the ToRole and FromRole of a referential constraint + + + + + Invalid value for attribute ParameterTypeSemantics + + + + + Invalid type used for a Relationship End Type + + + + + Invalid PrimitiveTypeKind + + + + + Invalid TypeConversion DestinationType + + + + + Expected a integer value between 0 - 255 + + + + + Invalid Type specified in function + + + + + Precision must not be greater than 28 + + + + + Properties that are part of entity key must be of scalar type + + + + + Binary type properties which are part of entity key are currently not supported + + + + + The primitive type kind does not have a preferred mapping + + + + + More than one PreferredMapping for a PrimitiveTypeKind + + + + + End with * multiplicity cannot have operations specified + + + + + EntitySet type has no keys + + + + + InvalidNumberOfParametersForAggregateFunction + + + + + InvalidParameterTypeForAggregateFunction + + + + + Composable functions must declare a return type. + + + + + Non-composable functions must not declare a return type. + + + + + Non-composable functions do not permit the aggregate; niladic; or built-in attributes. + + + + + Composable functions can not include command text attribute. + + + + + Functions should not declare both a store name and command text (only one or the other can be used). + + + + + SystemNamespace + + + + + Empty DefiningQuery text + + + + + Schema, Table and DefiningQuery are all specified, and are mutually exclusive + + + + + ConcurrencyMode value was malformed + + + + + Concurrency can't change for any sub types of an EntitySet type. + + + + + Function import return type must be either empty, a collection of entities, or a singleton scalar. + + + + + Function import specifies a non-existent entity set. + + + + + Function import specifies entity type return but no entity set. + + + + + Function import specifies entity type that does not derive from element type of entity set. + + + + + Function import specifies a binding to an entity set but does not return entities. + + + + + InternalError + + + + + Same Entity Set Taking part in the same role of the relationship set in two different relationship sets + + + + + Entity key refers to the same property twice + + + + + Function declares a ReturnType attribute and element + + + + + Nullable Complex Type not supported in Edm V1 + + + + + Only Complex Collections supported in Edm V1.1 + + + + + No Key defined on Entity Type + + + + + Invalid namespace specified in using element + + + + + Need not specify system namespace in using + + + + + Cannot use a reserved/system namespace as alias + + + + + Invalid qualification specified for type + + + + + Invalid Entity Container Name in extends attribute + + + + + Invalid CollectionKind value in property CollectionKind attribute + + + + + Must specify namespace or alias of the schema in which this type is defined + + + + + Entity Container cannot extend itself + + + + + Failed to retrieve provider manifest + + + + + Mismatched Provider Manifest token values in SSDL artifacts + + + + + Missing Provider Manifest token value in SSDL artifact(s) + + + + + Empty CommandText element + + + + + Inconsistent Provider values in SSDL artifacts + + + + + Inconsistent Provider Manifest token values in SSDL artifacts + + + + + Duplicated Function overloads + + + + + InvalidProvider + + + + + FunctionWithNonEdmTypeNotSupported + + + + + ComplexTypeAsReturnTypeAndDefinedEntitySet + + + + + ComplexTypeAsReturnTypeAndDefinedEntitySet + + + + unused 179, + unused 180, + unused 181, + + In model functions facet attribute is allowed only on ScalarTypes + + + + + Captures several conditions where facets are placed on element where it should not exist. + + + + + Return type has not been declared + + + + + Invalid value in the EnumTypeOption + + + + + The structural annotation cannot use codegen namespaces + + + + + Function and type cannot have the same fully qualified name + + + + + Cannot load different version of schema in the same ItemCollection + + + + + Expected bool value + + + + + End without Multiplicity specified + + + + + In SSDL, if composable function returns a collection of rows (TVF), all row properties must be of scalar types. + + + + + The name of NamedEdmItem must not be empty or white space only + + + + + EdmTypeReference is empty + + Unused 199; + + + + Serializes an that conforms to the restrictions of a single CSDL schema file to an XML writer. The model to be serialized must contain a single and a single . + + + + + Serialize the to the XmlWriter. + + The EdmModel to serialize, mut have only one and one + The XmlWriter to serialize to + + + + Serialize the to the XmlWriter + + The DbModel to serialize + The XmlWriter to serialize to + + + + Serialize the to the + + The DbDatabaseMetadata to serialize + Provider information on the Schema element + ProviderManifestToken information on the Schema element + The XmlWriter to serialize to + + + + + author/email + + + + + author/name + + + + + author/uri + + + + + published + + + + + rights + + + + + summary + + + + + title + + + + + contributor/email + + + + + contributor/name + + + + + contributor/uri + + + + + category/@label + + + + + Plaintext + + + + + HTML + + + + + XHTML + + + + + updated + + + + + link/@href + + + + + link/@rel + + + + + link/@type + + + + + link/@hreflang + + + + + link/@title + + + + + link/@length + + + + + category/@term + + + + + category/@scheme + + + + + Return role name pair + + + + + + + + The context for DataModel Validation + + + + + Returns true if the given two ends are similar - the relationship type that this ends belongs to is the same and the entity set refered by the ends are same and they are from the same role + + + + + + + + Return true if the Referential Constraint on the association is ready for further validation, otherwise return false. + + + + + + + Resolves the given property names to the property in the item Also checks whether the properties form the key for the given type and whether all the properties are nullable or not + + + + + + + + + + + Return true if the namespaceName is a Edm System Namespace + + + + + + + Return true if the entityType is a subtype of any entity type in the dictionary keys, and return the corresponding entry EntitySet value. Otherwise return false. + + + + + + + + + Return true if any of the properties in the EdmEntityType defines ConcurrencyMode. Otherwise return false. + + + + + + + Add member name to the Hash set, raise an error if the name exists already. + + + + + + + + + If the string is null, empty, or only whitespace, return false, otherwise return true + + + + + + + Determine if a cycle exists in the type hierarchy: use two pointers to walk the chain, if one catches up with the other, we have a cycle. + + true if a cycle exists in the type hierarchy, false otherwise + + + + RuleSet for DataModel Validation + + + + + Get the related rules given certain DataModelItem + + The to validate + A collection of + + + + Data Model Validator + + + + + Validate the and all of its properties given certain version. + + The root of the model to be validated + True to validate the syntax, otherwise false + + + + The RuleSet for EdmModel + + + + + Get based on version + + a double value of version + + + + + The context for EdmModel Validation + + + + + Visitor for EdmModel Validation + + + + + Edm Model Validator + + + + + validate the from the root with the context + + The root to validate from + The validation context + + + + An implementation of IDatabaseInitializer that will recreate and optionally re-seed the + database only if the database does not exist. + To seed the database, create a derived class and override the Seed method. + + The type of the context. + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + An instances of this class is obtained from an object and can be used + to manage the actual database backing a DbContext or connection. + This includes creating, deleting, and checking for the existence of a database. + Note that deletion and checking for existence of a database can be performed using just a + connection (i.e. without a full context) by using the static methods of this class. + + + + + Creates a Database backed by the given context. This object can be used to create a database, + check for database existence, and delete a database. + + The context that defines the database connection and model. + + + + Gets or sets the database initialization strategy. The database initialization strategy is called when instance + is initialized from a . The strategy can optionally check for database existence, create a new database, and + seed the database with data. + The default strategy is an instance of . + + The type of the context. + The strategy. + The database creation strategy. + + + + Internal version of SetInitializer that allows the strategy to be locked such that it cannot be replaced + by another call to SetInitializer. This allows strategies set in the app.config to win over strategies set + in code. + + The type of the context. + The strategy. + if set to true then the strategy is locked. + + + + Runs the the registered on this context. + + If "force" is set to true, then the initializer is run regardless of whether or not it + has been run before. This can be useful if a database is deleted while an app is running + and needs to be reinitialized. + + If "force" is set to false, then the initializer is only run if it has not already been + run for this context, model, and connection in this app domain. This method is typically + used when it is necessary to ensure that the database has been created and seeded + before starting some operation where doing so lazily will cause issues, such as when the + operation is part of a transaction. + + if set to true the initializer is run even if it has already been run. + + + + Checks whether or not the database is compatible with the the current Code First model. + + + Model compatibility currently uses the following rules. + + If the context was created using either the Model First or Database First approach then the + model is assumed to be compatible with the database and this method returns true. + + For Code First the model is considered compatible if the model is stored in the database + in the Migrations history table and that model has no differences from the current model as + determined by Migrations model differ. + + If the model is not stored in the database but an EF 4.1/4.2 model hash is found instead, + then this is used to check for compatibility. + + + If set to true then an exception will be thrown if no model metadata is found in + the database. If set to false then this method will return true if metadata + is not found. + + True if the model hash in the context and the database match; false otherwise. + + + + + Creates a new database on the database server for the model defined in the backing context. + Note that calling this method before the database initialization strategy has run will disable + executing that strategy. + + + + + Creates a new database on the database server for the model defined in the backing context, but only + if a database with the same name does not already exist on the server. + + True if the database did not exist and was created; false otherwise. + + + + Checks whether or not the database exists on the server. + + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + Calling this method from outside of an initializer will mark the database as having + not been initialized. This means that if an attempt is made to use the database again + after it has been deleted, then any initializer set will run again and, usually, will + try to create the database again automatically. + + True if the database did exist and was deleted; false otherwise. + + + + Checks whether or not the database exists on the server. + The connection to the database is created using the given database name or connection string + in the same way as is described in the documentation for the class. + + The database name or a connection string to the database. + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + The connection to the database is created using the given database name or connection string + in the same way as is described in the documentation for the class. + + The database name or a connection string to the database. + True if the database did exist and was deleted; false otherwise. + + + + Checks whether or not the database exists on the server. + + An existing connection to the database. + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + + An existing connection to the database. + True if the database did exist and was deleted; false otherwise. + + + + Resets the DefaultConnectionFactory to its initial value. + Currently, this method is only used by test code. + + + + + Performs the operation defined by the given delegate using the given lazy connection, ensuring + that the lazy connection is disposed after use. + + Information used to create a DbConnection. + The operation to perform. + The return value of the operation. + + + + Performs the operation defined by the given delegate against a connection. The connection + is either the connection accessed from the context backing this object, or is obtained from + the connection information passed to one of the static methods. + + The connection to use. + The operation to perform. + The return value of the operation. + + + + Returns an empty ObjectContext that can be used to perform delete/exists operations. + + The connection for which to create an ObjectContext + The empty context. + + + + Creates a raw SQL query that will return elements of the given generic type. + The type can be any type that has properties that match the names of the columns returned + from the query, or can be a simple primitive type. The type does not have to be an + entity type. The results of this query are never tracked by the context even if the + type of object returned is an entity type. Use the + method to return entities that are tracked by the context. + + The type of object returned by the query. + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Creates a raw SQL query that will return elements of the given type. + The type can be any type that has properties that match the names of the columns returned + from the query, or can be a simple primitive type. The type does not have to be an + entity type. The results of this query are never tracked by the context even if the + type of object returned is an entity type. Use the + method to return entities that are tracked by the context. + + The type of object returned by the query. + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Executes the given DDL/DML command against the database. + + The command string. + The parameters to apply to the command string. + The result returned by the database after executing the command. + + + + Returns the connection being used by this context. This may cause the + connection to be created if it does not already exist. + + Thrown if the context has been disposed. + + + + Returns the as a delegate that can be called with + an instance of the that owns this Database object, or returns null if + there is no initializer set for this context type. + + The initializer delegate or null. + + + + The connection factory to use when creating a from just + a database name or a connection string. + + + This is used when just a database name or connection string is given to or when + the no database name or connection is given to DbContext in which case the name of + the context class is passed to this factory in order to generate a DbConnection. + By default, the instance to use is read from the applications .config + file from the "EntityFramework DefaultConnectionFactory" entry in appSettings. If no entry is found in + the config file then is used. Setting this property in code + always overrides whatever value is found in the config file. + + + + + Checks wether or not the DefaultConnectionFactory has been set to something other than its default value. + + + + + + + Common code for generic and non-generic string Include. + + + + + + Returns a new query where the entities returned will not be cached in the + or . This method works by calling the AsNoTracking method of the + underlying query object. If the underlying query object does not have a AsNoTracking method, + then calling this method will have no affect. + + The element type. + The source query. + A new query with NoTracking applied, or the source query if NoTracking is not supported. + + + + Returns a new query where the entities returned will not be cached in the + or . This method works by calling the AsNoTracking method of the + underlying query object. If the underlying query object does not have a AsNoTracking method, + then calling this method will have no affect. + + The source query. + A new query with NoTracking applied, or the source query if NoTracking is not supported. + + + + Common code for generic and non-generic AsNoTracking. + + + + + Enumerates the query such that for server queries such as those of , , + , and others the results of the query will be loaded into the associated , + or other cache on the client. + This is equivalent to calling ToList and then throwing away the list without the overhead of actually creating the list. + + The source query. + + + + Returns an implementation that stays in sync with the given . + + The element type. + The collection that the binding list will stay in sync with. + The binding list. + + + + DbModelBuilder is used to map CLR classes to a database schema. + This code centric approach to building an Entity Data Model (EDM) model is known as 'Code First'. + + + DbModelBuilder is typically used to configure a model by overriding . + You can also use DbModelBuilder independently of DbContext to build a model and then construct a + or . + The recommended approach, however, is to use OnModelCreating in as + the workflow is more intuitive and takes care of common tasks, such as caching the created model. + + Types that form your model are registered with DbModelBuilder and optional configuration can be + performed by applying data annotations to your classes and/or using the fluent style DbModelBuilder + API. + + When the Build method is called a set of conventions are run to discover the initial model. + These conventions will automatically discover aspects of the model, such as primary keys, and + will also process any data annotations that were specified on your classes. Finally + any configuration that was performed using the DbModelBuilder API is applied. + + Configuration done via the DbModelBuilder API takes precedence over data annotations which + in turn take precedence over the default conventions. + + + + + Initializes a new instance of the class. + + The process of discovering the initial model will use the set of conventions included + in the most recent version of the Entity Framework installed on your machine. + + + Upgrading to newer versions of the Entity Framework may cause breaking changes + in your application because new conventions may cause the initial model to be + configured differently. There is an alternate constructor that allows a specific + version of conventions to be specified. + + + + + Initializes a new instance of the class that will use + a specific set of conventions to discover the initial model. + + The version of conventions to be used. + + + + Excludes a type from the model. This is used to remove types from the model that were added + by convention during initial model discovery. + + The type to be excluded. + The same DbModelBuilder instance so that multiple calls can be chained. + + + + Excludes a type(s) from the model. This is used to remove types from the model that were added + by convention during initial model discovery. + + The types to be excluded from the model. + The same DbModelBuilder instance so that multiple calls can be chained. + + + + Registers an entity type as part of the model and returns an object that can be used to + configure the entity. This method can be called multiple times for the same entity to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified entity type. + + + + Registers a type as an entity in the model and returns an object that can be used to + configure the entity. This method can be called multiple times for the same type to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified entity type. + + + + Registers a type as a complex type in the model and returns an object that can be used to + configure the complex type. This method can be called multiple times for the same type to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified complex type. + + + + Creates a based on the configuration performed using this builder. + The connection is used to determine the database provider being used as this + affects the database layer of the generated model. + + Connection to use to determine provider information. + The model that was built. + + + + Creates a based on the configuration performed using this builder. + Provider information must be specified because this affects the database layer of the generated model. + For SqlClient the invariant name is 'System.Data.SqlClient' and the manifest token is the version year (i.e. '2005', '2008' etc.) + + The database provider that the model will be used with. + The model that was built. + + + + Provides access to the settings of this DbModelBuilder that deal with conventions. + + + + + Gets the for this DbModelBuilder. + The registrar allows derived entity and complex type configurations to be registered with this builder. + + + + + A value from this enumeration can be provided directly to the + class or can be used in the applied to + a class derived from . The value used defines which version of + the DbContext and DbModelBuilder conventions should be used when building a model from + code--also know as "Code First". + + + Using DbModelBuilderVersion.Latest ensures that all the latest functionality is available + when upgrading to a new release of the Entity Framework. However, it may result in an + application behaving differently with the new release than it did with a previous release. + This can be avoided by using a specific version of the conventions, but if a version + other than the latest is set then not all the latest functionality will be available. + + + + + Indicates that the latest version of the and + conventions should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 4.1 + through 4.3 should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 5.0 + when targeting .NET 4 should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 5.0 + when targeting .NET 4.5 should be used. + + + + + This attribute can be applied to a class derived from to set which + version of the DbContext and conventions should be used when building + a model from code--also know as "Code First". See the + enumeration for details about DbModelBuilder versions. + + + If the attribute is missing from DbContextthen DbContext will always use the latest + version of the conventions. This is equivalent to using DbModelBuilderVersion.Latest. + + + + + Initializes a new instance of the class. + + The conventions version to use. + + + + Gets the conventions version. + + The conventions version. + + + + A non-generic version of which can be used when the type of entity + is not known at build time. + + + + + Represents a non-generic LINQ to Entities query against a DbContext. + + + + + An internal interface implemented by and that allows access to + the internal query without using reflection. + + + + + The underlying internal set. + + + + + Internal constructor prevents external classes deriving from DbQuery. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + Instead populate a DbSet with data, for example by using the Load extension method, and + then bind to local data. For WPF bind to DbSet.Local. For Windows Forms bind to + DbSet.Local.ToBindingList(). + + + Never returns; always throws. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Returns the equivalent generic object. + + The type of element for which the query was created. + The generic set object. + + + + Returns a representation of the underlying query. + + + The query string. + + + + + Returns false. + + false. + + + + The IQueryable element type. + + + + + The IQueryable LINQ Expression. + + + + + The IQueryable provider. + + + + + Gets the underlying internal query object. + + The internal query. + + + + The internal query object that is backing this DbQuery + + + + + An internal interface implemented by and that allows access to + the internal set without using reflection. + + + + + The underlying internal set. + + + + + Internal constructor prevents external classes deriving from DbSet. + + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Returns the equivalent generic object. + + The type of entity for which the set was created. + The generic set object. + + + + Creates a raw SQL query that will return entities in this set. By default, the + entities returned are tracked by the context; this can be changed by calling + AsNoTracking on the returned. + Note that the entities returned are always of the type for this set and never of + a derived type. If the table or tables queried may contain data for other entity + types, then the SQL query must be written appropriately to ensure that only entities of + the correct type are returned. + + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + The internal IQueryable that is backing this DbQuery + + + + + Gets the underlying internal set. + + The internal set. + + + + A DbSet represents the collection of all entities in the context, or that can be queried from the + database, of a given type. DbSet objects are created from a DbContext using the DbContext.Set method. + + + Note that DbSet does not support MEST (Multiple Entity Sets per Type) meaning that there is always a + one-to-one correlation between a type and a set. + + The type that defines the set. + + + + Represents a LINQ to Entities query against a DbContext. + + The type of entity to query for. + + + + Creates a new query that will be backed by the given internal query object. + + The backing query. + + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Throws an exception indicating that binding directly to a store query is not supported. + Instead populate a DbSet with data, for example by using the Load extension method, and + then bind to local data. For WPF bind to DbSet.Local. For Windows Forms bind to + DbSet.Local.ToBindingList(). + + + Never returns; always throws. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Returns a representation of the underlying query. + + + The query string. + + + + + Returns a new instance of the non-generic class for this query. + + A non-generic version. + + + + Returns false. + + false. + + + + The IQueryable element type. + + + + + The IQueryable LINQ Expression. + + + + + The IQueryable provider. + + + + + The internal query object that is backing this DbQuery + + + + + The internal query object that is backing this DbQuery + + + + + An IDbSet represents the collection of all entities in the context, or that can be queried from the + database, of a given type. DbSet is a concrete implementation of IDbSet. + + The type that defines the set. + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + Creates a new set that will be backed by the given . + + The internal set. + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Returns the equivalent non-generic object. + + The non-generic set object. + + + + Creates a raw SQL query that will return entities in this set. By default, the + entities returned are tracked by the context; this can be changed by calling + AsNoTracking on the returned. + Note that the entities returned are always of the type for this set and never of + a derived type. If the table or tables queried may contain data for other entity + types, then the SQL query must be written appropriately to ensure that only entities of + the correct type are returned. + + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + The internal IQueryable that is backing this DbQuery + + + + + An implementation of IDatabaseInitializer that will always recreate and optionally re-seed the + database the first time that a context is used in the app domain. + To seed the database, create a derived class and override the Seed method. + + The type of the context. + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + An implementation of IDatabaseInitializer that will DELETE, recreate, and optionally re-seed the + database only if the model has changed since the database was created. + + + Whether or not the model has changed is determined by the + method. + To seed the database create a derived class and override the Seed method. + + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + Returned by the ChangeTracker method of to provide access to features of + the context that are related to change tracking of entities. + + + + + Initializes a new instance of the class. + + The internal context. + + + + Gets objects for all the entities tracked by this context. + + The entries. + + + + Gets objects for all the entities of the given type + tracked by this context. + + The type of the entity. + The entries. + + + + Detects changes made to the properties and relationships of POCO entities. Note that some types of + entity (such as change tracking proxies and entities that derive from ) + report changes automatically and a call to DetectChanges is not normally needed for these types of entities. + Also note that normally DetectChanges is called automatically by many of the methods of + and its related classes such that it is rare that this method will need to be called explicitly. + However, it may be desirable, usually for performance reasons, to turn off this automatic calling of + DetectChanges using the AutoDetectChangesEnabled flag from . + + + + + A non-generic version of the class. + + + + + This is an abstract base class use to represent a scalar or complex property, or a navigation property + of an entity. Scalar and complex properties use the derived class , + reference navigation properties use the derived class , and collection + navigation properties use the derived class . + + + + + Creates a from information in the given . + This method will create an instance of the appropriate subclass depending on the metadata contained + in the InternalMemberEntry instance. + + The internal member entry. + The new entry. + + + + Validates this property. + + + Collection of objects. Never null. If the entity is valid the collection will be empty. + + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the name of the property. + + The property name. + + + + Gets or sets the current value of this property. + + The current value. + + + + The to which this member belongs. + + An entry for the entity that owns this member. + + + + Gets the backing this object. + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal collection entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the collection of entities from the database. + Note that entities that already exist in the context are not overwritten with values from the database. + + + + + Returns the query that would be used to load this collection from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database, such + as counting the number of entities in the collection in the database without actually loading them. + + A query for the collection. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the collection element. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the collection of entities has been loaded from the database. + + true if the collection is loaded; otherwise, false. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Gets the backing this object as an . + + The internal member entry. + + + + Instances of this class are returned from the Collection method of + and allow operations such as loading to + be performed on the an entity's collection navigation properties. + + The type of the entity to which this property belongs. + The type of the element in the collection of entities. + + + + This is an abstract base class use to represent a scalar or complex property, or a navigation property + of an entity. Scalar and complex properties use the derived class , + reference navigation properties use the derived class , and collection + navigation properties use the derived class . + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + This method will create an instance of the appropriate subclass depending on the metadata contained + in the InternalMemberEntry instance. + + The internal member entry. + The new entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Validates this property. + + + Collection of objects. Never null. If the entity is valid the collection will be empty. + + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets the underlying . + + The internal member entry. + + + + The to which this member belongs. + + An entry for the entity that owns this member. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal collection entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the collection of entities from the database. + Note that entities that already exist in the context are not overwritten with values from the database. + + + + + Returns the query that would be used to load this collection from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database, such + as counting the number of entities in the collection in the database without actually loading them. + + A query for the collection. + + + + Returns a new instance of the non-generic class for + the navigation property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the collection of entities has been loaded from the database. + + true if the collection is loaded; otherwise, false. + + + + Gets the underlying as an . + + The internal member entry. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + An immutable representation of an Entity Data Model (EDM) model that can be used to create an + or can be passed to the constructor of a . + For increased performance, instances of this type should be cached and re-used to construct contexts. + + + + + For mocking. + + + + + Creates a model for the given EDM metadata model. + + The EDM metadata model. + + + + Creates an instance of ObjectContext or class derived from ObjectContext. Note that an instance + of DbContext can be created instead by using the appropriate DbContext constructor. + If a derived ObjectContext is used, then it must have a public constructor with a single + EntityConnection parameter. + The connection passed is used by the ObjectContext created, but is not owned by the context. The caller + must dispose of the connection once the context has been disposed. + + The type of context to create. + An existing connection to a database for use by the context. + + + + + Gets a cached delegate (or creates a new one) used to call the constructor for the given derived ObjectContext type. + + + + + A snapshot of the that was used to create this compiled model. + + + + + The provider info (provider name and manifest token) that was used to create this model. + + + + + A non-generic version of the class. + + + + + A non-generic version of the class. + + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the original value of this property. + + The original value. + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets or sets a value indicating whether the value of this property has been modified since + it was loaded from the database. + + + true if this instance is modified; otherwise, false. + + + + + The to which this property belongs. + + An entry for the entity that owns this property. + + + + The of the property for which this is a nested property. + This method will only return a non-null entry for properties of complex objects; it will + return null for properties of the entity itself. + + An entry for the parent complex property, or null if this is an entity property. + + + + Gets the backing this object. + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The name of the nested property. + An object representing the nested property. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the complex property. + The equivalent generic object. + + + + Instances of this class are returned from the ComplexProperty method of + and allow access to the state of a complex property. + + The type of the entity to which this property belongs. + The type of the property. + + + + Instances of this class are returned from the Property method of + and allow access to the state of the scalar + or complex property. + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the original value of this property. + + The original value. + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets or sets a value indicating whether the value of this property has been modified since + it was loaded from the database. + + + true if this instance is modified; otherwise, false. + + + + + The to which this property belongs. + + An entry for the entity that owns this property. + + + + The of the property for which this is a nested property. + This method will only return a non-null entry for properties of complex objects; it will + return null for properties of the entity itself. + + An entry for the parent complex property, or null if this is an entity property. + + + + Gets the underlying as an . + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The type of the nested property. + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The type of the nested property. + An expression representing the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The type of the nested property. + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The type of the nested property. + An expression representing the nested property. + An object representing the nested property. + + + + Describes the origin of the database connection string associated with a . + + + + + The connection string was created by convention. + + + + + The connection string was read from external configuration. + + + + + The connection string was explicitly specified at runtime. + + + + + The connection string was overriden by connection information supplied to DbContextInfo. + + + + + Returned by the Configuration method of to provide access to configuration + options for the context. + + + + + Initializes a new instance of the class. + + The internal context. + + + + Gets or sets a value indicating whether lazy loading of relationships exposed as + navigation properties is enabled. Lazy loading is enabled by default. + + true if lazy loading is enabled; otherwise, false. + + + + Gets or sets a value indicating whether or not the framework will create instances of + dynamically generated proxy classes whenever it creates an instance of an entity type. + Note that even if proxy creation is enabled with this flag, proxy instances will only + be created for entity types that meet the requirements for being proxied. + Proxy creation is enabled by default. + + true if proxy creation is enabled; otherwise, false. + + + + + Gets or sets a value indicating whether tracked entities should be validated automatically when + is invoked. + The default value is true. + + + + + Provides runtime information about a given type. + + + + + Creates a new instance representing a given type. + + The type deriving from . + + + + Creates a new instance representing a given targeting a specific database. + + The type deriving from . + Connection information for the database to be used. + + + + Creates a new instance representing a given type. An external list of + connection strings can be supplied and will be used during connection string resolution in place + of any connection strings specified in external configuration files. + + + It is preferable to use the constructor that accepts the entire config document instead of using this + constructor. Providing the entire config document allows DefaultConnectionFactroy entries in the config + to be found in addition to explicitly specified connection strings. + + The type deriving from . + A collection of connection strings. + + + + Creates a new instance representing a given type. An external config + object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + + The type deriving from . + An object representing the config file. + + + + Creates a new instance representing a given , targeting a specific database. + An external config object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + + The type deriving from . + An object representing the config file. + Connection information for the database to be used. + + + + Creates a new instance representing a given type. A + can be supplied in order to override the default determined provider used when constructing + the underlying EDM model. + + The type deriving from . + A specifying the underlying ADO.NET provider to target. + + + + Creates a new instance representing a given type. An external config + object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + A can be supplied in order to override the default determined + provider used when constructing the underlying EDM model. This can be useful to prevent EF from + connecting to discover a manifest token. + + The type deriving from . + An object representing the config file. + A specifying the underlying ADO.NET provider to target. + + + + Called internally when a context info is needed for an existing context, which may not be constructable. + + The context instance to get info from. + + + + If instances of the underlying type can be created, returns + a new instance; otherwise returns null. + + A instance. + + + + The concrete type. + + + + + Whether or not instances of the underlying type can be created. + + + + + The connection string used by the underlying type. + + + + + The connection string name used by the underlying type. + + + + + The ADO.NET provider name of the connection used by the underlying type. + + + + + The origin of the connection string used by the underlying type. + + + + + An action to be run on the DbModelBuilder after OnModelCreating has been run on the context. + + + + + A non-generic version of the class. + + + + + Initializes a new instance of the class. + + The internal entry. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + Note that changing the values in the returned dictionary will not update the values in the database. + If the entity is not found in the database then null is returned. + + The store values. + + + + Reloads the entity from the database overwriting any property values with values from the database. + The entity will be in the Unchanged state after calling this method. + + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The name of the property. + An object representing the property. + + + + Gets an object that represents a complex property of this entity. + + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The name of the member. + An object representing the member. + + + + Returns a new instance of the generic class for the given + generic type for the tracked entity represented by this object. + Note that the type of the tracked entity must be compatible with the generic type or + an exception will be thrown. + + The type of the entity. + A generic version. + + + + Validates this instance and returns validation result. + + + Entity validation result. Possibly null if + method is overridden. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the entity. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + + The original values. + + + + Gets InternalEntityEntry object for this DbEntityEntry instance. + + + + + Instances of this class provide access to information about and control of entities that + are being tracked by the . Use the Entity or Entities methods of + the context to obtain objects of this type. + + The type of the entity. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + Note that changing the values in the returned dictionary will not update the values in the database. + If the entity is not found in the database then null is returned. + + The store values. + + + + Reloads the entity from the database overwriting any property values with values from the database. + The entity will be in the Unchanged state after calling this method. + + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The type of the property. + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The type of the property. + An expression representing the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The type of elements in the collection. + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The type of elements in the collection. + An expression representing the navigation property. + An object representing the navigation property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The name of the property. + An object representing the property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The type of the property. + The name of the property. + An object representing the property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The type of the property. + An expression representing the property. + An object representing the property. + + + + Gets an object that represents a complex property of this entity. + + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a complex property of this entity. + + The type of the complex property. + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a complex property of this entity. + + The type of the complex property. + An expression representing the complex property. + An object representing the complex property. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The name of the member. + An object representing the member. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The type of the member. + The name of the member. + An object representing the member. + + + + Returns a new instance of the non-generic class for + the tracked entity represented by this object. + + A non-generic version. + + + + Validates this instance and returns validation result. + + + Entity validation result. Possibly null if + method is overridden. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the entity. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + + The original values. + + + + Represents an Entity Data Model (EDM) created by the . + The Compile method can be used to go from this EDM representation to a + which is a compiled snapshot of the model suitable for caching and creation of + or instances. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + Creates a for this mode which is a compiled snapshot + suitable for caching and creation of instances. + + The compiled model. + + + + A snapshot of the that was used to create this compiled model. + + + + + A collection of all the properties for an underlying entity or complex object. + + + An instance of this class can be converted to an instance of the generic class + using the Cast method. + Complex properties in the underlying entity or complex object are represented in + the property values as nested instances of this class. + + + + + Initializes a new instance of the class. + + The internal dictionary. + + + + Creates an object of the underlying type for this dictionary and hydrates it with property + values from this dictionary. + + The properties of this dictionary copied into a new object. + + + + Sets the values of this dictionary by reading values out of the given object. + The given object can be of any type. Any property on the object with a name that + matches a property name in the dictionary and can be read will be read. Other + properties will be ignored. This allows, for example, copying of properties from + simple Data Transfer Objects (DTOs). + + The object to read values from. + + + + Creates a new dictionary containing copies of all the properties in this dictionary. + Changes made to the new dictionary will not be reflected in this dictionary and vice versa. + + A clone of this dictionary. + + + + Sets the values of this dictionary by reading values from another dictionary. + The other dictionary must be based on the same type as this dictionary, or a type derived + from the type for this dictionary. + + The dictionary to read values from. + + + + Gets the value of the property just like using the indexed property getter but + typed to the type of the generic parameter. This is useful especially with + nested dictionaries to avoid writing expressions with lots of casts. + + The type of the property. + Name of the property. + The value of the property. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + Gets or sets the value of the property with the specified property name. + The value may be a nested instance of this class. + + The property name. + The value of the property. + + + + Gets the internal dictionary. + + The internal dictionary. + + + + A non-generic version of the class. + + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal reference entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the entity from the database. + Note that if the entity already exists in the context, then it will not overwritten with values from the database. + + + + + Returns the query that would be used to load this entity from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database. + + A query for the entity. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the entity has been loaded from the database. + + true if the entity is loaded; otherwise, false. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Gets the backing this object as an . + + The internal member entry. + + + + Instances of this class are returned from the Reference method of + and allow operations such as loading to + be performed on the an entity's reference navigation properties. + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal reference entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the entity from the database. + Note that if the entity already exists in the context, then it will not overwritten with values from the database. + + + + + Returns the query that would be used to load this entity from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database. + + A query for the entity. + + + + Returns a new instance of the non-generic class for + the navigation property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the entity has been loaded from the database. + + true if the entity is loaded; otherwise, false. + + + + Gets the underlying as an . + + The internal member entry. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Represents a SQL query for entities that is created from a + and is executed using the connection from that context. + Instances of this class are obtained from the instance for the + entity type. The query is not executed when this object is created; it is executed + each time it is enumerated, for example by using foreach. + SQL queries for non-entities are created using the . + See for a generic version of this class. + + + + + Initializes a new instance of the class. + + The internal query. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a new query where the results of the query will not be tracked by the associated + . + + A new query with no-tracking applied. + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Gets the internal query. + + The internal query. + + + + Returns false. + + false. + + + + Represents a SQL query for entities that is created from a + and is executed using the connection from that context. + Instances of this class are obtained from the instance for the + entity type. The query is not executed when this object is created; it is executed + each time it is enumerated, for example by using foreach. + SQL queries for non-entities are created using the . + See for a non-generic version of this class. + + + + + Executes the query and returns an enumerator for the elements. + + An + + object that can be used to iterate through the elements. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a new query where the results of the query will not be tracked by the associated + . + + A new query with no-tracking applied. + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Gets the internal query. + + The internal query. + + + + Returns false. + + false. + + + + Exception thrown by when it was expected that SaveChanges for an entity would + result in a database update but in fact no rows in the database were affected. This usually indicates + that the database has been concurrently updated such that a concurrency token that was expected to match + did not actually match. + Note that state entries referenced by this exception are not serialized due to security and accesses to + the state entries after serialization will return null. + + + + + + Initializes a new instance of the class. + + The internal context. + The inner exception. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Subscribes the SerializeObjectState event. + + + + + Gets objects that represents the entities that could not + be saved to the database. + + The entries representing the entities that could not be saved. + + + + Holds exception state that will be serialized when the exception is serialized. + + + + + Completes the deserialization. + + The deserialized object. + + + + Gets or sets a value indicating whether the exception involved independent associations. + + + + + Initializes a new instance of the class. + + The context. + The inner exception. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Represents an entity used to store metadata about an EDM in the database. + + + + + Attempts to get the model hash calculated by Code First for the given context. + This method will return null if the context is not being used in Code First mode. + + The context. + The hash string. + + + + Gets or sets the ID of the metadata entity, which is currently always 1. + + The id. + + + + Gets or sets the model hash which is used to check whether the model has + changed since the database was created from it. + + The model hash. + + + + Contains methods used to access the Entity Data Model created by Code First in the EDMX form. + These methods are typically used for debugging when there is a need to look at the model that + Code First creates internally. + + + + + Uses Code First with the given context and writes the resulting Entity Data Model to the given + writer in EDMX form. This method can only be used with context instances that use Code First + and create the model internally. The method cannot be used for contexts created using Database + First or Model First, for contexts created using a pre-existing , or + for contexts created using a pre-existing . + + The context. + The writer. + + + + Writes the Entity Data Model represented by the given to the + given writer in EDMX form. + + An object representing the EDM. + The writer. + + + + A factory for creating derived instances. Implement this + interface to enable design-time services for context types that do not have a + public default constructor. + + At design-time, derived instances can be created in order to enable specific + design-time experiences such as model rendering, DDL generation etc. To enable design-time instantiation + for derived types that do not have a public, default constructor, implement + this interface. Design-time services will auto-discover implementations of this interface that are in the + same assembly as the derived type. + + + + + + Creates a new instance of a derived type. + + An instance of TContext + + + + This convention causes DbModelBuilder to include metadata about the model + when it builds the model. When creates a model by convention it will + add this convention to the list of those used by the DbModelBuilder. This will then result in + model metadata being written to the database if the DbContext is used to create the database. + This can then be used as a quick check to see if the model has changed since the last time it was + used against the database. + This convention can be removed from the conventions by overriding + the OnModelCreating method on a derived DbContext class. + + + + + Adds metadata to the given model configuration. + + The model configuration. + + + + This convention uses the name of the derived + class as the container for the conceptual model built by + Code First. + + + + + Initializes a new instance of the class. + + The model container name. + + + + Applies the convention to the given model. + + The model. + + + + This convention uses the namespace of the derived + class as the namespace of the conceptual model built by + Code First. + + + + + Initializes a new instance of the class. + + The model namespace. + + + + Applies the convention to the given model. + + The model. + + + + Instances of this class are used internally to create constant expressions for + that are inserted into the expression tree to replace references to + and . + + The type of the element. + + + + Private constructor called by the Create factory method. + + The query. + + + + Factory method called by CreateDelegate to create an instance of this class. + + The query, which must be a generic object of the expected type. + A new instance. + + + + The public property expected in the LINQ expression tree. + + The query. + + + + Instances of this class are used to create DbConnection objects for + SQL Server Compact Edition based on a given database name or connection string. + + + It is necessary to provide the provider invariant name of the SQL Server Compact + Edition to use when creating an instance of this class. This is because different + versions of SQL Server Compact Editions use different invariant names. + An instance of this class can be set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use SQL Server Compact Edition by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Creates a new connection factory with empty (default) DatabaseDirectory and BaseConnectionString + properties. + + The provider invariant name that specifies the version of SQL Server Compact Edition that should be used. + + + + Creates a new connection factory with the given DatabaseDirectory and BaseConnectionString properties. + + + The provider invariant name that specifies the version of SQL Server Compact Edition that should be used. + + + The path to prepend to the database name that will form the file name used by SQL Server Compact Edition + when it creates or reads the database file. An empty string means that SQL Server Compact Edition will use + its default for the database file location. + + + The connection string to use for options to the database other than the 'Data Source'. The Data Source will + be prepended to this string based on the database name when CreateConnection is called. + + + + + Creates a connection for SQL Server Compact Edition based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + The path to prepend to the database name that will form the file name used by + SQL Server Compact Edition when it creates or reads the database file. + The default value is "|DataDirectory|", which means the file will be placed + in the designated data directory. + + + + + The connection string to use for options to the database other than the 'Data Source'. + The Data Source will be prepended to this string based on the database name when + CreateConnection is called. + The default is the empty string, which means no other options will be used. + + + + + The provider invariant name that specifies the version of SQL Server Compact Edition + that should be used. + + + + + Instances of this class are used to create DbConnection objects for + SQL Server based on a given database name or connection string. By default, the connection is + made to '.\SQLEXPRESS'. This can be changed by changing the base connection + string when constructing a factory instance. + + + An instance of this class can be set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use SQL Server by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Creates a new connection factory with a default BaseConnectionString property of + 'Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True'. + + + + + Creates a new connection factory with the given BaseConnectionString property. + + + The connection string to use for options to the database other than the 'Initial Catalog'. The 'Initial Catalog' will + be prepended to this string based on the database name when CreateConnection is called. + + + + + Creates a connection for SQL Server based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + Remove hard dependency on DbProviderFactories. + + + + + The connection string to use for options to the database other than the 'Initial Catalog'. + The 'Initial Catalog' will be prepended to this string based on the database name when + CreateConnection is called. + The default is 'Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True'. + + + + + This attribute can be applied to either an entire derived class or to + individual or properties on that class. When applied + any discovered or properties will still be included + in the model but will not be automatically initialized. + + + + + Thrown when a context is generated from the templates in Database First or Model + First mode and is then used in Code First mode. + + + Code generated using the T4 templates provided for Database First and Model First use may not work + correctly if used in Code First mode. To use these classes with Code First please add any additional + configuration using attributes or the DbModelBuilder API and then remove the code that throws this + exception. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The object that holds the serialized object data. + The contextual information about the source or destination. + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Implements ICachedMetadataWorkspace for a Code First model. + + + + + Represents an object that holds a cached copy of a MetadataWorkspace and optionally the + assemblies containing entity types to use with that workspace. + + + + + Gets the MetadataWorkspace, potentially lazily creating it if it does not already exist. + If the workspace is not compatible with the provider manifest obtained from the given + connection then an exception is thrown. + + The connection to use to create or check SSDL provider info. + The workspace. + + + + The list of assemblies that contain entity types for this workspace, which may be empty, but + will never be null. + + + + + The default container name for code first is the container name that is set from the DbModelBuilder + + + + + The provider info used to construct the workspace. + + + + + Builds and stores the workspace based on the given code first configuration. + + The code first EDM model. + + + + Gets the . + If the workspace is not compatible with the provider manifest obtained from the given + connection then an exception is thrown. + + The connection to use to create or check SSDL provider info. + The workspace. + + + + The default container name for code first is the container name that is set from the DbModelBuilder + + + + + The list of assemblies that contain entity types for this workspace, which may be empty, but + will never be null. + + + + + The provider info used to construct the workspace. + + + + + The methods here are called from multiple places with an ObjectContext that may have + been created in a variety of ways and ensure that the same code is run regardless of + how the context was created. + + + + + Used a delegate to do the actual creation once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + Note however that a context obtained from only a connection will have no model and so + will result in an empty database. + + + + + Used a delegate to do the actual existence check once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + + + + + Used a delegate to do the actual check/delete once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given set of entity types and DbSet initializer delegate. + + + + + The entity types part of the pair. + + + + + The DbSet properties initializer part of the pair. + + + + + Static helper methods only. + + + + + Checks whether the given value is null and throws ArgumentNullException if it is. + This method should only be used in places where Code Contracts are compiled out in the + release build but we still need public surface null-checking, such as where a public + abstract class is implemented by an internal concrete class. + + + + + Checks whether the given string is null, empty, or just whitespace, and throws appropriately + if the check fails. + This method should only be used in places where Code Contracts are compiled out in the + release build but we still need public surface checking, such as where a public + abstract class is implemented by an internal concrete class. + + + + + Given two key values that may or may not be byte arrays, this method determines + whether or not they are equal. For non-binary key values, this is equivalent + to Object.Equals. For binary keys, it is by comparison of every byte in the + arrays. + + + + + Provides a standard helper method for quoting identifiers + + Identifier to be quoted. Does not validate that this identifier is valid. + Quoted string + + + + Checks the given string which might be a database name or a connection string and determines + whether it should be treated as a name or connection string. Currently, the test is simply + whether or not the string contains an '=' character--if it does, then it should be treated + as a connection string. + + The name or connection string. + true if the string should be treated as a connection string; false if it should be treated as a name. + + + + Determines whether the given string should be treated as a database name directly (it contains no '='), + is in the form name=foo, or is some other connection string. If it is a direct name or has name=, then + the name is extracted and the method returns true. + + The name or connection string. + The name. + True if a name is found; false otherwise. + + + + Determines whether the given string is a full EF connection string with provider, provider connection string, + and metadata parts, or is is instead some other form of connection string. + + The name or connection string. + true if the given string is an EF connection string; otherwise, false. + + + + + Parses a property selector expression used for the expression-based versions of the Property, Collection, Reference, + etc methods on and + classes. + + The type of the entity. + The type of the property. + The property. + Name of the method. + Name of the param. + The property name. + + + + Called recursively to parse an expression tree representing a property path such + as can be passed to Include or the Reference/Collection/Property methods of . + This involves parsing simple property accesses like o => o.Products as well as calls to Select like + o => o.Products.Select(p => p.OrderLines). + + The expression to parse. + The expression parsed into an include path, or null if the expression did not match. + True if matching succeeded; false if the expression could not be parsed. + + + + Gets a cached dictionary mapping property names to property types for all the properties + in the given type. + + + + + Gets a dictionary of compiled property setter delegates for the underlying types. + The dictionary is cached for the type in the app domain. + + + + + Used by the property setter delegates to throw for attempts to set null onto + non-nullable properties or otherwise go ahead and set the property. + + + + + Gets a dictionary of compiled property getter delegates for the underlying types. + The dictionary is cached for the type in the app domain. + + + + + Creates a new with the NoTracking merge option applied. + The query object passed in is not changed. + + The query. + A new query with NoTracking applied. + + + + Converts to + + + Name of the property being validated with ValidationAttributes. Null for type-level validation. + + + ValidationResults instances to be converted to instances. + + + An created based on the + . + + + class contains a property with names of properties the error applies to. + On the other hand each applies at most to a single property. As a result for + each name in ValidationResult.MemberNames one will be created (with some + exceptions for special cases like null or empty .MemberNames or null names in the .MemberNames). + + + + + Calculates a "path" to a property. For primitive properties on an entity type it is just the + name of the property. Otherwise it is a dot separated list of names of the property and all + its ancestor properties starting from the entity. + + Property for which to calculate the path. + Dot separated path to the property. + + + + Gets names of the property and its ancestor properties as enumerable walking "bottom-up". + + Property for which to get the segments. + Names of the property and its ancestor properties. + + + + Gets an type for the given element type. + + Type of the element. + The collection type. + + + + Creates a database name given a type derived from DbContext. This handles nested and + generic classes. No attempt is made to ensure that the name is not too long since this + is provider specific. If a too long name is generated then the provider will throw and + the user must correct by specifying their own name in the DbContext constructor. + + Type of the context. + The database name to use. + + + + A local (in-memory) view of the entities in a DbSet. + This view contains Added entities and does not contain Deleted entities. The view extends + from and hooks up events between the collection and the + state manager to keep the view in sync. + + The type of the entity. + + + + Initializes a new instance of the class for entities + of the given generic type in the given internal context. + + The internal context. + + + + Called by the base class when the collection changes. + This method looks at the change made to the collection and reflects those changes in the + state manager. + + The instance containing the event data. + + + + Handles events from the state manager for entities entering, leaving, or being marked as deleted. + The local view is kept in sync with these changes. + + The sender. + The instance containing the event data. + + + + Clears the items by calling remove on each item such that we get Remove events that + can be tracked back to the state manager, rather than a single Reset event that we + cannot deal with. + + + + + Adds a contains check to the base implementation of InsertItem since we can't support + duplicate entities in the set. + + The index at which to insert. + The item to insert. + + + + Returns a cached binding list implementation backed by this ObservableCollection. + + The binding list. + + + + Service used to search for instance properties on a DbContext class that can + be assigned a DbSet instance. Also, if the the property has a public setter, + then a delegate is compiled to set the property to a new instance of DbSet. + All of this information is cached per app domain. + + + + + Creates a set discovery service for the given derived context. + + + + + Processes the given context type to determine the DbSet or IDbSet + properties and collect root entity types from those properties. Also, delegates are + created to initialize any of these properties that have public setters. + If the type has been processed previously in the app domain, then all this information + is returned from a cache. + + A dictionary of potential entity type to the list of the names of the properties that used the type. + + + + Calls the public setter on any property found to initialize it to a new instance of DbSet. + + + + + Registers the entities and their entity set name hints with the given . + + The model builder. + + + + Returns false if SuppressDbSetInitializationAttribute is found on the property or the class, otherwise + returns true. + + + + + Determines whether or not an instance of DbSet/ObjectSet can be assigned to a property of the given type. + + The type to check. + The entity type of the DbSet/ObjectSet that can be assigned, or null if no set type can be assigned. + + + + + A EagerInternalConnection object wraps an already existing DbConnection object. + + + + + InternalConnection objects manage DbConnections. + Two concrete base classes of this abstract interface exist: + and . + + + + + IInternalConnection objects manage DbConnections. + Two concrete implementations of this interface exist--LazyInternalConnection and EagerInternalConnection. + + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Returns the underlying DbConnection. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if the connection contains model info; otherwise, false. + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strins. + + + + + Gets or sets the provider to be used when creating the underlying connection. + + + + + Gets the name of the underlying connection string. + + + + + Gets the original connection string. + + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Called after the connection is initialized for the first time. + + + + + Adds a tracking cookie to the connection string for SqlConnections. Returns the + possibly modified store connection string. + + + + + Returns the underlying DbConnection. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if the connection contains model info; otherwise, false. + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strins. + + + + + Gets or sets the provider to be used when creating the underlying connection. + + + + + Gets the name of the underlying connection string. + + + + + Gets the original connection string. + + + + + Gets or sets the underlying object. No initialization is done when the + connection is obtained, and it can also be set to null. + + The underlying connection. + + + + Creates a new EagerInternalConnection that wraps an existing DbConnection. + + An existing connection. + If set to true then the underlying connection should be disposed when this object is disposed. + + + + Dispose the existing connection is the original caller has specified that it should be disposed + by the framework. + + + + + Returns the origin of the underlying connection string. + + + + + An is an where the + instance that it wraps is set immediately at construction time rather than being created lazily. In this case + the internal context may or may not own the instance but will only dispose it + if it does own it. + + + + + An underlies every instance of and wraps an + instance. + The also acts to expose necessary information to other parts of the design in a + controlled manner without adding a lot of internal methods and properties to the + class itself. + Two concrete classes derive from this abstract class - and + . + + + + + Initializes the object with its owner. + + The owner . + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Creates a new temporary based on the same metadata and connection as the real + and sets it as the context to use DisposeTempObjectContext is called. + This allows this internal context and its DbContext to be used for transient operations + such as initializing and seeding the database, after which it can be thrown away. + This isolates the real from any changes made and and saves performed. + + + + + If a temporary ObjectContext was set with UseTempObjectContext, then this method disposes that context + and returns this internal context and its DbContext to using the real ObjectContext. + + + + + Called by methods of to create a database either using the Migrations pipeline + if possible and the core provider otherwise. + + The context to use for core provider calls. + + + + Internal implementation of . + + True if the model hash in the context and the database match; false otherwise. + + + + Checks whether the given model (an EDMX document) matches the current model. + + + + + Queries the database for a model hash and returns it if found or returns null if the table + or the row doesn't exist in the database. + + The model hash, or null if not found. + + + + Queries the database for a model stored in the MigrationHistory table and returns it as an EDMX, or returns + null if the database does not contain a model. + + + + + Saves the model hash from the context to the database. + + + + + Performs the initialization action that may result in a and + handle the exception to provide more meaning to the user. + + The action. + + + + Registers for the ObjectStateManagerChanged event on the underlying ObjectStateManager. + This is a virtual method on this class so that it can be mocked. + + The event handler. + + + + Checks whether or not the given object is in the context in any state other than Deleted. + This is a virtual method on this class so that it can be mocked. + + The entity. + true if the entity is in the context and not deleted; otherwise false. + + + + Saves all changes made in this context to the underlying database. + + The number of objects written to the underlying database. + + + + Initializes this instance, which means both the context is initialized and the underlying + database is initialized. + + + + + Initializes the underlying ObjectContext but does not cause the database to be initialized. + + + + + Marks the database as having not been initialized. This is called when the app calls Database.Delete so + that the database if the app attempts to then use the database again it will be re-initialized automatically. + + + + + Runs the unless it has already been run or there + is no initializer for this context type in which case this method does nothing. + + + + + Marks the database as having been initialized without actually running the . + + + + + Runs the if one has been set for this context type. + Calling this method will always cause the initializer to run even if the database is marked + as initialized. + + + + + Disposes the context. Override the DisposeContext method to perform + additional work when disposing. + + + + + Performs additional work to dispose a context. + + + + + Calls DetectChanges on the underlying if AutoDetectChangesEnabled is + true or if force is set to true. + + if set to true then DetectChanges is called regardless of the value of AutoDetectChangesEnabled. + + + + Returns the DbSet instance for the given entity type. + This property is virtual and returns to that it can be mocked. + + The entity type for which a set should be returned. + A set for the given entity type. + + + + Returns the non-generic instance for the given entity type. + This property is virtual and returns to that it can be mocked. + + The entity type for which a set should be returned. + A set for the given entity type. + + + + Creates an internal set using an app domain cached delegate. + + Type of the entity. + The set. + + + + Returns the entity set and the base type for that entity set for the given type. + This method does o-space loading if required and throws if the type is not in the model. + + The entity type to lookup. + The entity set and base type pair. + + + + Returns the entity set and the base type for that entity set for the given type if that + type is mapped in the model, otherwise returns null. + This method does o-space loading if required. + + The entity type to lookup. + The entity set and base type pair, or null if not found. + + + + Checks whether or not the given entity type is mapped in the model. + + The entity type to lookup. + True if the type is mapped as an entity; false otherwise. + + + + Gets the local entities of the type specified from the state manager. That is, all + Added, Modified, and Unchanged entities of the given type. + + The type of entity to get. + The entities. + + + + Executes the given SQL query against the database backing this context. The results are not materialized as + entities or tracked. + + The type of the element. + The SQL. + The parameters. + The query results. + + + + Executes the given SQL query against the database backing this context. The results are not materialized as + entities or tracked. + + Type of the element. + The SQL. + The parameters. + The query results. + + + + Calls the generic ExecuteSqlQuery but with a non-generic return type so that it + has the correct signature to be used with CreateDelegate above. + + + + + Executes the given SQL command against the database backing this context. + + The SQL. + The parameters. + The return value from the database. + + + + Gets the underlying for the given entity, or returns null if the entity isn't tracked by this context. + This method is virtual so that it can be mocked. + + The entity. + The state entry or null. + + + + Gets the underlying objects for all entities tracked by + this context. + This method is virtual so that it can be mocked. + + State entries for all tracked entities. + + + + Gets the underlying objects for all entities of the given + type tracked by this context. + This method is virtual so that it can be mocked. + + The type of the entity. + State entries for all tracked entities of the given type. + + + + Helper method that gets the underlying objects for all entities that + match the given predicate. + + + + + Wraps the given in either a or + a depending on the actual exception type and the state + entries involved. + + The update exception. + A new exception wrapping the given exception. + + + + Uses the underlying context to create an entity such that if the context is configured + to create proxies and the entity is suitable then a proxy instance will be returned. + This method is virtual so that it can be mocked. + + The type of the entity. + The new entity instance. + + + + Uses the underlying context to create an entity such that if the context is configured + to create proxies and the entity is suitable then a proxy instance will be returned. + This method is virtual so that it can be mocked. + + The type of entity to create. + The new entity instance. + + + + This method is used by CreateDelegate to transform the CreateObject method with return type TEntity + into a method with return type object which matches the required type of the delegate. + + + + + Replaces the connection that will be used by this context. + The connection can only be changed before the context is initialized. + + The new connection. + + + + Throws if the context has been disposed. + + + + + Checks whether or not the internal cache of types to entity sets has been initialized, + and initializes it if necessary. + + + + + Forces all DbSets to be initialized, which in turn causes o-space loading to happen + for any entity type for which we have a DbSet. This includes all DbSets that were + discovered on the user's DbContext type. + + + + + Performs o-space loading for the type and returns false if the type is not in the model. + + + + + Performs o-space loading for the type and throws if the type is not in the model. + + Type of the entity. + + + + Returns true if the given entity type does not have EdmEntityTypeAttribute but is in + an assembly that has EdmSchemaAttribute. This indicates mixing of POCO and EOCO in the + same assembly, which is something that we don't support. + + + + + Determines whether or not the given clrType is mapped to a complex type. Assumes o-space loading has happened. + + + + + Updates the cache of types to entity sets either for the first time or after potentially + doing some o-space loading. + + + + + The public context instance that owns this internal context. + + + + + Returns the underlying . + + + + + Gets the temp object context, or null if none has been set. + + The temp object context. + + + + The compiled model created from the Code First pipeline, or null if Code First was + not used to create this context. + Causes the Code First pipeline to be run to create the model if it has not already been + created. + + + + + Set to true when a database initializer is performing some actions, such as creating or deleting + a database, or seeding the database. + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + Gets or sets a value indicating whether lazy loading is enabled. + + + + + Gets or sets a value indicating whether proxy creation is enabled. + + + + + Gets or sets a value indicating whether DetectChanges is called automatically in the API. + + + + + Gets or sets a value indicating whether to validate entities when is called. + + + + + True if the context has been disposed. + + + + + The connection underlying this context. Accessing this property does not cause the context + to be initialized, only its connection. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries, + database intializers and connection strings. + + + + + Gets or sets the provider details to be used when building the EDM model. + + + + + Gets the name of the underlying connection string. + + + + + Gets the provider name bsing used either using a cached value or getting it from + the DbConnection in use. + + + + + Gets or sets a custom OnModelCreating action. + + + + + Gets the DatabaseOperations instance to use to perform Create/Delete/Exists operations + against the database. + Note that this virtual property can be mocked to help with unit testing. + + + + + Gets instance used to create validators and validation contexts. + This property is virtual to allow mocking. + + + + + For mocking. + + + + + Constructs an for an already existing . + + The owner . + The existing . + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Does nothing, since the already exists. + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Disposes the context. The underlying is also disposed if it is owned. + + + + + + + + Returns the underlying . + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + The connection underlying this context. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets a value indicating whether lazy loading is enabled. This is just a wrapper + over the same flag in the underlying . + + + + + Gets or sets a value indicating whether proxy creation is enabled. This is just a wrapper + over the same flag in the underlying ObjectContext. + + + + + An implementation of that represents a clone of another + dictionary. That is, all the property values have been been copied into this dictionary. + + + + + The internal class used to implement . + This internal class allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal context with which the entity of complex object is associated. + The type of the entity or complex object. + If set to true this is a dictionary for an entity, otherwise it is a dictionary for a complex object. + + + + Implemented by subclasses to get the dictionary item for a given property name. + Checking that the name is valid should happen before this method is called such + that subclasses do not need to perform the check. + + Name of the property. + An item for the given name. + + + + Creates an object of the underlying type for this dictionary and hydrates it with property + values from this dictionary. + + The properties of this dictionary copied into a new object. + + + + Creates an instance of the underlying type for this dictionary, which may either be an entity type (in which + case CreateObject on the context is used) or a non-entity type (in which case the empty constructor is used.) + In either case, app domain cached compiled delegates are used to do the creation. + + + + + Sets the values of this dictionary by reading values out of the given object. + The given object must be of the type that this dictionary is based on. + + The object to read values from. + + + + Creates a new dictionary containing copies of all the properties in this dictionary. + Changes made to the new dictionary will not be reflected in this dictionary and vice versa. + + A clone of this dictionary. + + + + Sets the values of this dictionary by reading values from another dictionary. + The other dictionary must be based on the same type as this dictionary, or a type derived + from the type for this dictionary. + + The dictionary to read values from. + + + + Gets the dictionary item for the property with the given name. + This method checks that the given name is valid. + + The property name. + The item. + + + + Sets the value of the property only if it is different from the current value and is not + an invalid attempt to set a complex property. + + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + Gets or sets the value of the property with the specified property name. + The value may be a nested instance of this class. + + The property name. + The value of the property. + + + + Gets the entity type of complex type that this dictionary is based on. + + The type of the object underlying this dictionary. + + + + Gets the internal context with which the underlying entity or complex type is associated. + + The internal context. + + + + Gets a value indicating whether the object for this dictionary is an entity or a complex object. + + true if this this is a dictionary for an entity; false if it is a dictionary for a complex object. + + + + Initializes a new instance of the class by copying + values from the given dictionary. + + The dictionary to clone. + If non-null, then the values for the new dictionary are taken from this record rather than from the original dictionary. + + + + Gets the dictionary item for a given property name. + + Name of the property. + An item for the given name. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + An implementation of for an item in a . + + + + + Represents an item in an representing a property name/value. + + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + true If this instance represents a complex property; otherwise, false. + + + + Gets the type of the underlying property. + + The property type. + + + + Initializes a new instance of the class. + + The name. + The value. + The type. + If set to true this item represents a complex property. + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + + true If this instance represents a complex property; otherwise, false. + + + + + Gets the type of the underlying property. + + The property type. + + + + An implementation of that is based on an existing + instance. + + + + + Initializes a new instance of the class. + + The internal context. + The type. + The data record. + If set to true this is a dictionary for an entity, otherwise it is a dictionary for a complex object. + + + + Gets the dictionary item for a given property name. + + Name of the property. + An item for the given name. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + An implementation of for an item in a . + + + + + Initializes a new instance of the class. + + The data record. + The ordinal. + The value. + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + + true If this instance represents a complex property; otherwise, false. + + + + + Gets the type of the underlying property. + + The property type. + + + + This is version of an internal interface that already exists in System.Data.Entity that + is implemented by . Using this interface allows state + entries to be mocked for unit testing. The plan is to remove this version of the + interface and use the one in System.Data.Entity once we roll into the framework. + Note that some members may need to be added to the interface in the framework when + we combine the two. + + + + + The internal class used to implement and + . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Base class for and + containing common code for collection and reference navigation property entries. + + + + + Base class for all internal entries that represent different kinds of properties. + + + + + Initializes a new instance of the class. + + The internal entity entry. + The member metadata. + + + + Validates this property. + + A sequence of validation errors for this property. Empty if no errors. Never null. + + + + Creates a new non-generic backed by this internal entry. + The actual subtype of the DbMemberEntry created depends on the metadata of this internal entry. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The actual subtype of the DbMemberEntry created depends on the metadata of this internal entry. + + The type of the entity. + The type of the property. + The new entry. + + + + Gets the property name. + The property is virtual to allow mocking. + + The property name. + + + + Gets or sets the current value of the navigation property. + + The current value. + + + + Gets the internal entity entry property belongs to. + This property is virtual to allow mocking. + + The internal entity entry. + + + + Gets the entry metadata. + + The entry metadata. + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Calls Load on the underlying . + + + + + Uses CreateSourceQuery on the underlying to create a query for this + navigation property. + + + + + Gets the navigation property value from the object. + + The entity. + The navigation property value. + + + + Validates that the owning entity entry is associated with an underlying and + is not just wrapping a non-attached entity. + If the entity is not detached, then the RelatedEnd for this navigation property is obtained. + + + + + Calls IsLoaded on the underlying . + + + + + Gets the related end, which will be null if the entity is not being tracked. + + The related end. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + This property is virtual so that it can be mocked. + + The current value. + + + + Gets a delegate that can be used to get the value of the property directly from the entity. + Returns null if the property does not have an accessible getter. + + The getter delegate, or null. + + + + Gets a delegate that can be used to set the value of the property directly on the entity. + Returns null if the property does not have an accessible setter. + + The setter delegate, or null. + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Gets the navigation property value from the object. + Since for a collection the related end is an , it means + that the internal representation of the navigation property is just the related end. + + The entity. + The navigation property value. + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Creates a new generic backed by this internal entry. + The actual subtype of the DbCollectionEntry created depends on the metadata of this internal entry. + + The type of the entity. + The type of the element. + The new entry. + + + + Creates a object for the given entity type + and collection element type. + + The type of the entity. + The type of the property. + Type of the element. + The set. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + + The current value. + + + + The internal class used to implement + and . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal context. + The state entry. + + + + Initializes a new instance of the class for an + entity which may or may not be attached to the context. + + The internal context. + The entity. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + + The store values. + + + + Appends a query for the properties in the entity to the given string builder that is being used to + build the eSQL query. This method may be called recursively to query for all the sub-properties of + a complex property. + + The query builder. + The qualifier with which to prefix each property name. + The dictionary that acts as a template for the properties to query. + + + + Validates that a dictionary can be obtained for the state of the entity represented by this entry. + + The method name being used to request a dictionary. + The state that is invalid for the request being processed. + + + + Calls Refresh with StoreWins on the underlying state entry. + + + + + Gets an internal object representing a reference navigation property. + This method is virtual to allow mocking. + + The navigation property. + The type of entity requested, which may be 'object' or null if any type can be accepted. + The entry. + + + + Gets an internal object representing a collection navigation property. + This method is virtual to allow mocking. + + The navigation property. + The type of entity requested, which may be 'object' or null f any type can be accepted. + The entry. + + + + Gets an internal object representing a navigation, scalar, or complex property. + This method is virtual to allow mocking. + + Name of the property. + The type of entity requested, which may be 'object' if any type can be accepted. + The entry. + + + + Gets an internal object representing a scalar or complex property. + This method is virtual to allow mocking. + + The property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Gets an internal object representing a scalar or complex property. + The property may be a nested property on the given . + + The parent property entry, or null if this is a property directly on the entity. + Name of the property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Gets an internal object representing a scalar or complex property. + The property may be a nested property on the given . + + The parent property entry, or null if this is a property directly on the entity. + Name of the property. + The property split out into its parts. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Checks that the given property name is a navigation property and is either a reference property or + collection property according to the value of requireCollection. + + + + + Gets metadata for the given property if that property is a navigation property or returns null + if it is not a navigation property. + + Name of the property. + Navigation property metadata or null. + + + + Gets the type of entity or entities at the target end of the given navigation property. + + The navigation property. + The CLR type of the entity or entities at the other end. + + + + Gets the related end for the navigation property with the given name. + + The navigation property. + + + + + Uses EDM metadata to validate that the property name exists in the model and represents a scalar or + complex property or exists in the CLR type. + This method is public and virtual so that it can be mocked. + + The property name. + The type on which the property is declared. + The type of object requested, which may be 'object' if any type can be accepted. + Metadata for the property. + + + + Splits the given property name into parts delimited by dots. + + Name of the property. + The parts of the name. + + + + Validates that this entry is associated with an underlying and + is not just wrapping a non-attached entity. + + + + + Validates entity represented by this entity entry. + This method is virtual to allow mocking. + + User defined dictionary containing additional info for custom validation. This parameter is optional and can be null. + containing validation result. Never null. + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the tracked entity. + This property is virtual to allow mocking. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + This property is virtual to allow mocking. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + This property is virtual to allow mocking. + + The original values. + + + + Checks whether or not this entry is associated with an underlying or + is just wrapping a non-attached entity. + + + + + Gets the type of the entity being tracked. + + The type of the entity. + + + + Gets the c-space entity type for this entity from the EDM. + + + + + Gets the underlying object state entry. + + + + + Gets the internal context. + + The internal context. + + + + A concrete implementation of used for properties of entities. + + + + + The internal class used to implement and + . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal entry. + The property info. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. If this is a property of an entity, then this method returns + true if the property is modified. If this is a property of a complex object, then + this method returns true if the top-level complex property on the entity is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + If this is a property of an entity, then this method marks it as modified. + If this is a property of a complex object, then this method marks the top-level + complex property as modified. + + + + + Throws if the user attempts to set a complex property to null. + + The value. + + + + Sets the given value directly onto the underlying entity object. + + The value. + True if the property had a setter that we could attempt to call; false if no setter was available. + + + + Sets the property value, potentially by setting individual nested values for a complex + property. + + The value. + + + + Gets an internal object representing a scalar or complex property of this property, + which must be a mapped complex property. + This method is virtual to allow mocking. + + The property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Validates that the owning entity entry is associated with an underlying and + is not just wrapping a non-attached entity. + + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent entity or complex property. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent entity or complex property. + That is, the original values that contains the value for this property. + + The parent original values. + + + + A delegate that reads the value of this property. + May be null if there is no way to set the value due to missing accessors on the type. + + + + + A delegate that sets the value of this property. + May be null if there is no way to set the value due to missing accessors on the type. + + + + + Gets or sets the original value. + Note that complex properties are returned as objects, not property values. + + + + + Gets or sets the current value. + Note that complex properties are returned as objects, not property values. + Also, for complex properties, the object returned is the actual complex object from the entity + and setting the complex object causes the actual object passed to be set onto the entity. + + The current value. + + + + Gets or sets a value indicating whether this property is modified. + + + + + Gets the property metadata. + + The property metadata. + + + + Initializes a new instance of the class. + + The internal entry. + The property info. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. Since this is a property of an entity this method returns + true if the property is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + Since this is a property of an entity this method marks it as modified. + + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent entity. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent entity. + That is, the original values that contains the value for this property. + + The parent original values. + + + + A concrete implementation of used for properties of complex objects. + + + + + Initializes a new instance of the class. + + The parent property entry. + The property metadata. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. Since this is a property of a complex object + this method returns true if the top-level complex property on the entity is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + Since this is a property of a complex object this method marks the top-level + complex property as modified. + + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent complex property. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent complex property. + That is, the original values that contains the value for this property. + + The parent original values. + + + + The internal class used to implement , + and . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Gets the navigation property value from the object. + For reference navigation properties, this means getting the value from the + object. + + The entity. + The navigation property value. + + + + Sets the navigation property value onto the object. + For reference navigation properties, this means setting the value onto the + object. + + The entity. + The value. + + + + Sets the given value on the given which must be an + . + This method is setup in such a way that it can easily be used by CreateDelegate without any + dynamic code generation needed. + + The type of the related entity. + The entity reference. + The value. + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + + The current value. + + + + Contains metadata about a member of an entity type or complex type. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry if the new entry is nested, otherwise null. + The new entry. + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets the name of the property. + + The name. + + + + Gets the type of the entity or complex object that on which the member is declared. + + The type that the member is declared on. + + + + Gets the type of element for the property, which for non-collection properties + is the same as the MemberType and which for collection properties is the type + of element contained in the collection. + + The type of the element. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + The types of member entries supported. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + if set to true this is a collection nav prop. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry which will always be null for navigation entries. + The new entry. + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + Contains metadata for a property of a complex object or entity. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + if set to true the property is mapped in the EDM. + if set to true the property is a complex property. + + + + Validates that the given name is a property of the declaring type (either on the CLR type or in the EDM) + and that it is a complex or scalar property rather than a nav property and then returns metadata about + the property. + + The internal context. + The type that the property is declared on. + The type of property requested, which may be 'object' if any type can be accepted. + Name of the property. + Metadata about the property, or null if the property does not exist or is a navigation property. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry if the new entry is nested, otherwise null. + The new entry. + + + + Gets a value indicating whether this is a complex property. + That is, not whether or not this is a property on a complex object, but rather if the + property itself is a complex property. + + + true if this instance is complex; otherwise, false. + + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets a value indicating whether this instance is mapped in the EDM. + + true if this instance is mapped; otherwise, false. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + An implementation of that wraps an existing set but makes + it read-only. + + + + + + Initializes a new instance of the class wrapped around + another existing set. + + The existing set. + + + + This is a temporary adapter class that wraps an and + presents it as an . This class will be removed once + we roll into the System.Data.Entity assembly. See + for more details. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given EntitySet and BaseType. + + + + + The EntitySet part of the pair. + + + + + The BaseType part of the pair. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given database initializer delegate and a flag + indicating whether or not it is locked. + + + + + The initializer delegate. + + + + + A flag indicating whether or not the initializer is locked and should not be changed. + + + + + Represents a raw SQL query against the context for any type where the results are never + associated with an entity set and are never tracked. + + + + + Represents a raw SQL query against the context that may be for entities in an entity set + or for some other non-entity element type. + + + + + Initializes a new instance of the class. + + The SQL. + The parameters. + + + + If the query is would track entities, then this method returns a new query that will + not track entities. + + A no-tracking query. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Gets the SQL query string, + + The SQL query. + + + + Gets the parameters. + + The parameters. + + + + Returns false. + + false. + + + + Initializes a new instance of the class. + + The internal context. + Type of the element. + The SQL. + The parameters. + + + + Returns this query since it can never be a tracking query. + + This instance. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Generic wrapper around to allow results to be + returned as generic + + The type of the element. + + + + Executes the query and returns an enumerator for the elements. + + An + + object that can be used to iterate through the elements. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Returns false. + + false. + + + + Represents a raw SQL query against the context for entities in an entity set. + + + + + Initializes a new instance of the class. + + The set. + The SQL. + if set to true then the entities will not be tracked. + The parameters. + + + + If the query is would track entities, then this method returns a new query that will + not track entities. + + A no-tracking query. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Gets a value indicating whether this instance is set to track entities or not. + + + true if this instance is no-tracking; otherwise, false. + + + + + A LazyInternalConnection object manages information that can be used to create a DbConnection object and + is responsible for creating that object and disposing it. + + + + + Creates a new LazyInternalConnection using convention to calculate the connection. + The DbConnection object will be created lazily on demand and will be disposed when the LazyInternalConnection is disposed. + + Either the database name or a connection string. + + + + Creates a new LazyInternalConnection targeting a specific database. + The DbConnection object will be created lazily on demand and will be disposed when the LazyInternalConnection is disposed. + + The connection to target. + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Disposes the underlying DbConnection. + Note that dispose actually puts the LazyInternalConnection back to its initial state such that + it can be used again. + + + + + + Searches the app.config/web.config file for a connection that matches the given name. + The connection might be a store connection or an EF connection. + + The connection name. + + True if a connection from the app.config file was found and used. + + + + Attempts to locate a connection entry in the configuration based on the supplied context name. + + The name to search for. + The configuration to search in. + Connection string if found, otherwise null. + + + + Initializes the connection based on a connection string. + + The settings to initialize from. + + + + Returns the underlying DbConnection, creating it first if it does not already exist. + + + + + Returns the origin of the underlying connection string. + + + + + Gets the name of the underlying connection string. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if connection contain model info; otherwise, false. + + + + Gets a value indicating if the lazy connection has been initialized. + + + + + A is a concrete type that will lazily create the + underlying when needed. The created is owned by the + internal context and will be disposed when the internal context is disposed. + + + + + Constructs a for the given owner that will be initialized + on first use. + + The owner . + Responsible for creating a connection lazily when the context is used for the first time. + The model, or null if it will be created by convention + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Saves all changes made in this context to the underlying database, but only if the + context has been initialized. If the context has not been initialized, then this + method does nothing because there is nothing to do; in particular, it does not + cause the context to be initialized. + + The number of objects written to the underlying database. + + + + Disposes the context. The underlying is also disposed. + The connection to the database ( object) is also disposed if it was created by + the context, otherwise it is not disposed. + + + + + + + + Initializes the underlying . + + + + + Creates an immutable, cacheable representation of the model defined by this builder. + This model can be used to create an or can be passed to a + constructor to create a for this model. + + + + + + Creates and configures the instance that will be used to build the + . + + The builder. + + + + Marks the database as having not been initialized. This is called when the app calls Database.Delete so + that the database if the app attempts to then use the database again it will be re-initialized automatically. + + + + + Marks the database as having been initialized without actually running the . + + + + + Runs the unless it has already been run or there + is no initializer for this context type in which case this method does nothing. + + + + + Performs some action (which may do nothing) in such a way that it is guaranteed only to be run + once for the model and connection in this app domain, unless it fails by throwing an exception, + in which case it will be re-tried next time the context is initialized. + + The action. + + + + Returns the underlying . + + + + + The compiled model created from the Code First pipeline, or null if Code First was + not used to create this context. + Causes the Code First pipeline to be run to create the model if it has not already been + created. + + + + + The actually being used, which may be the + temp context for initialization or the real context. + + + + + The connection underlying this context. Accessing this property does not cause the context + to be initialized, only its connection. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strings. + + + + + Gets the name of the underlying connection string. + + + + + Gets or sets the provider details to be used when building the EDM model. + + + + + + + + Gets or sets a custom OnModelCreating action. + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + Gets or sets a value indicating whether lazy loading is enabled. + If the exists, then this property acts as a wrapper over the flag stored there. + If the has not been created yet, then we store the value given so we can later + use it when we create the . This allows the flag to be changed, for example in + a DbContext constructor, without it causing the to be created. + + + + + Gets or sets a value indicating whether proxy creation is enabled. + If the ObjectContext exists, then this property acts as a wrapper over the flag stored there. + If the ObjectContext has not been created yet, then we store the value given so we can later + use it when we create the ObjectContext. This allows the flag to be changed, for example in + a DbContext constructor, without it causing the ObjectContext to be created. + + + + + A wrapping query provider that performs expression transformation and then delegates + to the provider. The objects returned are always instances + of . This provider is associated with generic objects. + + + + + Creates a provider that wraps the given provider. + + The provider to wrap. + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a . + + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a where T is determined + from the element type of the ObjectQuery. + + + + + By default, calls the same method on the wrapped provider. + + + + + By default, calls the same method on the wrapped provider. + + + + + Creates an appropriate generic IQueryable using Reflection and the underlying ElementType of + the given ObjectQuery. + + + + + Performs expression replacement and then delegates to the wrapped provider to create an + . + + + + + Wraps the given as a where T is determined + from the element type of the ObjectQuery. + + + + + Gets the internal context. + + The internal context. + + + + A LINQ expression visitor that finds uses with equivalent + instances. + + + + + Replaces calls to DbContext.Set() with an expression for the equivalent . + + The node to replace. + A new node, which may have had the replacement made. + + + + Replaces a or property with a constant expression + for the underlying . + + The node to replace. + A new node, which may have had the replacement made. + + + + Processes the fields in each constant expression and replaces instances with + the underlying ObjectQuery instance. This handles cases where the query has a closure + containing values. + + + + + Gets a value from the given member, or returns null + if the member doesn't contain a DbContext instance. + + The expression for the object for the member, which may be null for a static member. + The member. + The context or null. + + + + Gets the instance from the given instance or static member, returning null + if the member does not contain a DbContext instance. + + The member. + The value of the object to get the instance from, or null if the member is static. + The context instance or null. + + + + Takes a or and creates an expression + for the underlying . + + + + + Takes a or and extracts the underlying . + + + + + A non-generic interface implemented by that allows operations on + any query object without knowing the type to which it applies. + + + + + An interface implemented by . + + The type of the element. + + + + A non-generic interface implemented by that allows operations on + any set object without knowing the type to which it applies. + + + + + An interface implemented by . + + + + + An instance of this internal class is created whenever an instance of the public + class is needed. This allows the public surface to be non-generic, while the runtime type created + still implements . + + The type of the element. + + + + Creates a new query that will be backed by the given internal query object. + + The backing query. + + + + See comments in . + + + + + See comments in . + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the underlying internal query object. + + The internal query. + + + + An instance of this internal class is created whenever an instance of the public + class is needed. This allows the public surface to be non-generic, while the runtime type created + still implements . + + The type of the entity. + + + + Creates a new set that will be backed by the given internal set. + + The internal set. + + + + Creates an instance of this class. This method is used with CreateDelegate to cache a delegate + that can create a generic instance without calling MakeGenericType every time. + + + The internal set to wrap, or null if a new internal set should be created. + The set. + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the underlying internal query object. + + The internal query. + + + + Gets the underlying internal set. + + The internal set. + + + + See comments in . + + + + + An InternalQuery underlies every instance of DbSet and DbQuery. It acts to lazily initialize a InternalContext as well + as an ObjectQuery and EntitySet the first time that it is used. The InternalQuery also acts to expose necessary + information to other parts of the design in a controlled manner without adding a lot of internal methods and + properties to the DbSet and DbQuery classes themselves. + + The type of entity to query for. + + + + Creates a new query that will be backed by the given InternalContext. + + The backing context. + + + + Creates a new internal query based on the information in an existing query together with + a new underlying ObjectQuery. + + + + + Resets the query to its uninitialized state so that it will be re-lazy initialized the next + time it is used. This allows the ObjectContext backing a DbContext to be switched out. + + + + + Updates the underlying ObjectQuery with the given include path. + + The include path. + A new query containing the defined include path. + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Performs lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that the query can be used. + + + + + Returns a representation of the underlying query, equivalent + to ToTraceString on ObjectQuery. + + + The query string. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + The underlying InternalContext. + + + + + The underlying ObjectQuery. + + + + + The underlying ObjectQuery. + + + + + The LINQ query expression. + + + + + The LINQ query provider for the underlying . + + + + + The IQueryable element type. + + + + + Creates a new query that will be backed by the given InternalContext. + + The backing context. + + + + Resets the set to its uninitialized state so that it will be re-lazy initialized the next + time it is used. This allows the ObjectContext backing a DbContext to be switched out. + + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Finds an entity in the state manager with the given primary key values, or returns null + if no such entity can be found. This includes looking for Added entities with the given + key values. + + + + + Finds an entity in the store with the given primary key values, or returns null + if no such entity can be found. This code is adapted from TryGetObjectByKey to + include type checking in the query. + + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + This method is virtual so that it can be mocked. + + The entity to attach. + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + This method is virtual so that it can be mocked. + + The entity to add. + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + This method is virtual so that it can be mocked. + + The entity to remove. + + + + This method checks whether an entity is already in the context. If it is, then the state + is changed to the new state given. If it isn't, then the action delegate is executed to + either Add or Attach the entity. + + A delegate to Add or Attach the entity. + The new state to give the entity if it is already in the context. + The entity. + Name of the method. + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Performs lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that the query can be used. + This method is virtual so that it can be mocked. + + + + + Attempts to perform lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that o-space loading has happened and the query can be used. This method doesn't throw if the type + for the set is not mapped. + + + + + Creates an underlying for this set. + + if set to true then the query is set to be no-tracking. + The query. + + + + Returns a representation of the underlying query, equivalent + to ToTraceString on ObjectQuery. + + + The query string. + + + + + Updates the underlying ObjectQuery with the given include path. + + The include path. + A new query containing the defined include path. + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Executes the given SQL query against the database materializing entities into the entity set that + backs this set. + + The SQL quey. + if true then the entities are not tracked, otherwise they are. + The parameters. + The query results. + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the ObservableCollection representing the local view for the set based on this query. + + + + + The underlying ObjectQuery. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet name. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet name, quoted for ESQL. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet. Accessing this property will trigger lazy initialization of the query. + + + + + The base type for the underlying entity set. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying InternalContext. Accessing this property will trigger lazy initialization of the query. + + + + + The LINQ query expression. + + + + + The LINQ query provider for the underlying . + + + + + A wrapping query provider that performs expression transformation and then delegates + to the provider. The objects returned + are always instances of when the generic CreateQuery method is + used and are instances of when the non-generic CreateQuery method + is used. This provider is associated with non-generic objects. + + + + + Creates a provider that wraps the given provider. + + The provider to wrap. + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a . + + + + + Delegates to the wrapped provider except returns instances of . + + + + + Creates an appropriate generic IQueryable using Reflection and the underlying ElementType of + the given ObjectQuery. + + + + + Extends to create a sortable binding list that stays in + sync with an underlying . That is, when items are added + or removed from the binding list, they are added or removed from the ObservableCollecion, and + vice-versa. + + The list element type. + + + + An extended BindingList implementation that implements sorting. + This class was adapted from the LINQ to SQL class of the same name. + + The element type. + + + + Initializes a new instance of the class with the + the given underlying list. Note that sorting is dependent on having an actual + rather than some other ICollection implementation. + + The list. + + + + Applies sorting to the list. + + The property to sort by. + The sort direction. + + + + Stops sorting. + + + + + Gets a value indicating whether this list is sorted. + + + true if this instance is sorted; otherwise, false. + + + + + Gets the sort direction. + + The sort direction. + + + + Gets the sort property being used to sort. + + The sort property. + + + + Returns true indicating that this list supports sorting. + + true. + + + + Implements comparing for the implementation. + + + + + Initializes a new instance of the class + for sorting the list. + + The property to sort by. + The sort direction. + + + + Compares two instances of items in the list. + + The left item to compare. + The right item to compare. + + + + + Determines whether this instance can sort for the specified type. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Determines whether this instance can sort for the specified type using IComparable. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Determines whether this instance can sort for the specified type using ToString. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Initializes a new instance of a binding list backed by the given + + The obervable collection. + + + + Creates a new item to be added to the binding list. + + The new item. + + + + Cancels adding of a new item that was started with AddNew. + + Index of the item. + + + + Removes all items from the binding list and underlying ObservableCollection. + + + + + Ends the process of adding a new item that was started with AddNew. + + Index of the item. + + + + Inserts the item into the binding list at the given index. + + The index. + The item. + + + + Removes the item at the specified index. + + The index. + + + + Sets the item into the list at the given position. + + The index to insert at. + The item. + + + + Event handler to update the binding list when the underlying observable collection changes. + + The sender. + Data indicating how the collection has changed. + + + + Adds the item to the underlying observable collection. + + The item. + + + + Removes the item from the underlying from observable collection. + + The item. + + + + Adapted from to allow the initializer to take an input object and + to do one-time initialization that only has side-effects and doesn't return a value. + + The type of the input. + + + + Initializes a new instance of the class. + + The action. + + + + Performs the action unless it has already been successfully performed before. + + The input to the action; ignored if the action has already succeeded. + + + + Adapted from to allow the initializer to take an input object and + to retry initialization if it has previously failed. + + + This class can only be used to initialize reference types that will not be null when + initialized. + + The type of the input. + The type of the result. + + + + Initializes a new instance of the class. + + The value factory. + + + + Gets the value, possibly by running the initializer if it has not been run before or + if all previous times it ran resulted in exceptions. + + The input to the initializer; ignored if initialization has already succeeded. + The initialized object. + + + + Validates a property of a given EDM complex type. + + + This is a composite validator for a complex property of an entity. + + + + + Validates a property of a given EDM property type. + + + This is a composite validator for a property of an entity or a complex type. + + + + + Simple validators for the corresponding property. + + + + + Name of the property the validator was created for. + + + + + Creates an instance of for a given EDM property. + + The EDM property name. + Validators used to validate the given property. + + + + Validates a property. + + Validation context. Never null. + Property to validate. Never null. + Validation errors as . Empty if no errors. Never null. + + + + + Simple validators for the corresponding property. + + + + + Gets the name of the property the validator was created for. + + + + + The complex type validator. + + + + + Creates an instance of for a given complex property. + + The complex property name. + Validators used to validate the given property. + Complex type validator. + + + + Validates a complex property. + + Validation context. Never null. + Property to validate. Never null. + Validation errors as . Empty if no errors. Never null. + + + + + Validator used to validate a property of a given EDM ComplexType. + + + This is a composite validator. + + + + + Validator used to validate an entity of a given EDM Type. + + + This is a composite validator for an EDM Type. + + + + + Creates an instance for a given EDM type. + + Property validators. + Type level validators. + + + + Validates an instance. + + Entity validation context. Must not be null. + The entry for the complex property. Null if validating an entity. + instance. Never null. + + Protected so it doesn't appear on EntityValidator. + + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Returns a validator for a child property. + + Name of the child property for which to return a validator. + + Validator for a child property. Possibly null if there are no validators for requested property. + + + + + Creates an instance for a given EDM complex type. + + Property validators. + Type level validators. + + + + Validates an instance. + + Entity validation context. Must not be null. + The entry for the complex property. Null if validating an entity. + instance. Never null. + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Contains information needed to validate an entity or its properties. + + + + + The entity being validated or the entity that owns the property being validated. + + + + + Initializes a new instance of EntityValidationContext class. + + + The entity being validated or the entity that owns the property being validated. + + + External contexts needed for validation. + + + + + External context needed for validation. + + + + + Gets the entity being validated or the entity that owns the property being validated. + + + + + Validator used to validate an entity of a given EDM EntityType. + + + This is a top level, composite validator. This is also an entry point to getting an entity + validated as validation of an entity is always started by calling Validate method on this type. + + + + + Creates an instance for a given EDM entity type. + + Property validators. + Entity type level validators. + + + + Validates an entity. + + Entity validation context. Must not be null. + instance. Never null. + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Builds validators based on s specified on entity CLR types and properties + as well as based on presence of implementation on entity and complex + type CLR types. It's not sealed and not static for mocking purposes. + + + + + Builds an for the given . + + The entity entry to build the validator for. + Whether the currently processed type is the target type or one of the ancestor types. + + + for the given . Possibly null + if no validation has been specified for this entity type. + + + + + Builds the validator for a given and the corresponding + . + + The CLR type that corresponds to the EDM complex type. + The EDM complex type that type level validation is built for. + A for the given complex type. May be null if no validation specified. + + + + Extracted method from BuildEntityValidator and BuildComplexTypeValidator + + + + + Build validators for the and the corresponding + or . + + Properties to build validators for. + Non-navigation EDM properties. + Navigation EDM properties. + A list of validators. Possibly empty, never null. + + + + Builds a for the given and the corresponding + . If the property is a complex type, type level validators will be built here as + well. + + The CLR property to build the validator for. + The EDM property to build the validator for. + + for the given . Possibly null + if no validation has been specified for this property. + + + + + Builds a for the given transient . + + The CLR property to build the validator for. + + for the given . Possibly null + if no validation has been specified for this property. + + + + + Builds s for given that derive from + . + + Attributes used to build validators. + + A list of s built from . + Possibly empty, never null. + + + + + Returns all non-static non-indexed CLR properties from the . + + The CLR to get the properties from. + + A collection of CLR properties. Possibly empty, never null. + + + + + Builds validators based on the facets of : + * If .Nullable facet set to false adds a validator equivalent to the RequiredAttribute + * If the .MaxLength facet is specified adds a validator equivalent to the MaxLengthAttribute. + However the validator isn't added if .IsMaxLength has been set to true. + + The CLR property to build the facet validators for. + The property for which facet validators will be created + A collection of validators. + + + + Abstracts simple validators used to validate entities and properties. + + + + + Validates an entity or a property. + + Validation context. Never null. + Property to validate. Can be null for type level validation. + Validation error as. Empty if no errors. Never null. + + + + + Contract for IValidator.Validate method. + + Validation context. + Property. + Nothing - always throws. + + + + Validates entities or complex types implementing IValidatableObject interface. + + + + + Display attribute used to specify the display name for an entity or complex property. + + + + + Validates an entity or a complex type implementing IValidatableObject interface. + This method is virtual to allow mocking. + + Validation context. Never null. + + Property to validate. Null if this is the entity that will be validated. Never null if this + is the complex type that will be validated. + + Validation error as . Empty if no errors. Never null. + + + Note that is used to figure out what needs to be validated. If it not null the complex + type will be validated otherwise the entity will be validated. + Also if this is an IValidatableObject complex type but the instance (.CurrentValue) is null we won't validate + anything and will not return any errors. The reason for this is that Validation is supposed to validate using + information the user provided and not some additional implicit rules. (ObjectContext will throw for operations + that involve null complex properties). + + + + + Validates a property, complex property or an entity using validation attributes the property + or the complex/entity type is decorated with. + + + Note that this class is used for validating primitive properties using attributes declared on the property + (property level validation) and complex properties and entities using attributes declared on the type + (type level validation). + + + + + Display attribute used to specify the display name for a property or entity. + + + + + Validation attribute used to validate a property or an entity. + + + + + Creates an instance of class. + + + Validation attribute used to validate a property or an entity. + + + + + Validates a property or an entity. + + Validation context. Never null. + Property to validate. Null for entity validation. Not null for property validation. + + + Validation errors as . Empty if no errors, never null. + + + + + Used to cache and retrieve generated validators and to create context for validating entities or properties. + + + + + Collection of validators keyed by the entity CLR type. Note that if there's no validation for a given type + it will be associated with a null validator. + + + + + Initializes a new instance of class. + + + + + Returns a validator to validate . + + Entity the validator is requested for. + + to validate . Possibly null if no validation + has been specified for the entity. + + + + + Returns a validator to validate . + + Navigation property the validator is requested for. + + Validator to validate . Possibly null if no validation + has been specified for the requested property. + + + + + Gets a validator for the . + + Entity validator. + Property to get a validator for. + + Validator to validate . Possibly null if there is no validation for the + . + + + For complex properties this method walks up the type hierarchy to get to the entity level and then goes down + and gets a validator for the child property that is an ancestor of the property to validate. If a validator + returned for an ancestor is null it means that there is no validation defined beneath and the method just + propagates (and eventually returns) null. + + + + + Creates for . + + Entity entry for which a validation context needs to be created. + User defined dictionary containing additional info for custom validation. This parameter is optional and can be null. + An instance of class. + + + + + A wrapper around EntityKey that allows key/values pairs that have null values to + be used. This allows Added entities with null key values to be searched for in + the ObjectStateManager. + + + + The key name/key value pairs, where some key values may be null + + + + Creates a new WrappedEntityKey instance. + + The entity set that the key belongs to. + The fully qualified name of the given entity set. + The key values, which may be null or contain null values. + The name of the parameter passed for keyValue by the user, which is used when throwing exceptions. + + + + True if any of the key values are null, which means that the EntityKey will also be null. + + + + + An actual EntityKey, or null if any of the key values are null. + + + + + The key name/key value pairs of the key, in which some of the key values may be null. + + + + + Allows configuration to be performed for an complex type in a model. + + A ComplexTypeConfiguration can be obtained via the ComplexType method on + or a custom type derived from ComplexTypeConfiguration + can be registered via the Configurations property on . + + The complex type to be configured. + + + + Allows configuration to be performed for a type in a model. + + The type to be configured. + + + + Configures a property that is defined on this type. + + The type of the property being configured. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + The type of the property being configured. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Excludes a property from the model so that it will not be mapped to the database. + + The type of the property to be ignored. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + + + + Initializes a new instance of ComplexTypeConfiguration + + + + + Allows derived configuration classes for entities and complex types to be registered with a . + + + Derived configuration classes are created by deriving from + or and using a type to be included in the model as the generic + parameter. + + Configuration can be performed without creating derived configuration classes via the Entity and ComplexType + methods on . + + + + + Adds an to the . + Only one can be added for each type in a model. + + The entity type being configured. + The entity type configuration to be added. + The same ConfigurationRegistrar instance so that multiple calls can be chained. + + + + Adds an to the . + Only one can be added for each type in a model. + + The complex type being configured. + The complex type configuration to be added + The same ConfigurationRegistrar instance so that multiple calls can be chained. + + + + Allows the conventions used by a instance to be customized. + Currently removal of one or more default conventions is the only supported operation. + The default conventions can be found in the System.Data.Entity.ModelConfiguration.Conventions namespace. + + + + + Disables a convention for the . + The default conventions that are available for removal can be found in the System.Data.Entity.ModelConfiguration.Conventions namespace. + + The type of the convention to be disabled. + + + + Configures the table and column mapping for an entity type or a sub-set of properties from an entity type. + This configuration functionality is available via the Code First Fluent API, see . + + The entity type to be mapped. + + + + Configures the properties that will be included in this mapping fragment. + If this method is not called then all properties that have not yet been + included in a mapping fragment will be configured. + + An anonymous type including the properties to be mapped. + + A lambda expression to an anonymous type that contains the properties to be mapped. + C#: t => new { t.Id, t.Property1, t.Property2 } + VB.Net: Function(t) New With { p.Id, t.Property1, t.Property2 } + + + + + Re-maps all properties inherited from base types. + + When configuring a derived type to be mapped to a separate table this will cause all properties to + be included in the table rather than just the non-inherited properties. This is known as + Table per Concrete Type (TPC) mapping. + + + + + Configures the table name to be mapped to. + + Name of the table. + + + + Configures the table name and schema to be mapped to. + + Name of the table. + Schema of the table. + + + + Configures the discriminator column used to differentiate between types in an inheritance hierarchy. + + The name of the discriminator column. + A configuration object to further configure the discriminator column and values. + + + + Configures the discriminator condition used to differentiate between types in an inheritance hierarchy. + + The type of the property being used to discriminate between types. + + A lambda expression representing the property being used to discriminate between types. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object to further configure the discriminator condition. + + + + Moves a foreign key constraint from oldTable to newTable and updates column references + + + + + Move any FK constraints that are now completely in newTable and used to refer to oldColumn + + + + + Configures a condition used to discriminate between types in an inheritance hierarchy based on the values assigned to a property. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the condition to require a value in the property. + + Rows that do not have a value assigned to column that this property is stored in are + assumed to be of the base type of this entity type. + + + + + Populate the table mapping structure + + + + + Sets nullability for association set mappings' foreign keys for 1:* and 1:0..1 associations + when no base types share the the association set mapping's table + + + + + Makes sure only the required property mappings are present + + + + + Determines if the table and entity type need mapping, and if not, removes the existing entity type mapping + + + + + Configures a database column used to store a string values. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the column to allow the maximum length supported by the database provider. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + + Configures the column to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be variable length. + Columns are variable length by default. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be optional. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be required. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column. + + Name of the database provider specific data type. + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column. + + The order that this column should appear in the database table. + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to support Unicode string content. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the column supports Unicode string content. + + + Value indicating if the column supports Unicode string content or not. + Specifying 'null' will remove the Unicode facet from the column. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures a discriminator column used to differentiate between types in an inheritance hierarchy. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + Type of the discriminator value. + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + Type of the discriminator value. + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Initializes configurations in the ModelConfiguration so that configuration data + is in a single place + + + + + Configures a many relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be many:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:required with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:required without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:optional with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:optional without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures an optional relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be optional:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:required with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:required without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + + A lambda expression representing the navigation property on the other end of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + A configuration object that can be used to further configure the relationship. + + + + Configures an required relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be required:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:optional with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:optional without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required with a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required without a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required with a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required without a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + A configuration object that can be used to further configure the relationship. + + + + Base class for configuring a property on an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + True if the NavigationProperty's declaring type is the principal end, false if it is not, null if it is not known + + + + + Base class for performing configuration of a relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures a relationship that can support cascade on delete functionality. + + + + + Configures cascade delete to be on for the relationship. + + + + + Configures whether or not cascade delete is on for the relationship. + + Value indicating if cascade delete is on or not. + + + + Configures a relationship that can support foreign key properties that are exposed in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + The dependent entity type. + + + + Configures a relationship that can only support foreign key properties that are not exposed in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the relationship to use foreign key property(s) that are not exposed in the object model. + The column(s) and table can be customized by specifying a configuration action. + If an empty configuration action is specified then column name(s) will be generated by convention. + If foreign key properties are exposed in the object model then use the HasForeignKey method. + Not all relationships support exposing foreign key properties in the object model. + + Action that configures the foreign key column(s) and table. + + A configuration object that can be used to further configure the relationship. + + + + + Configures the relationship to use foreign key property(s) that are exposed in the object model. + If the foreign key property(s) are not exposed in the object model then use the Map method. + + The type of the key. + + A lambda expression representing the property to be used as the foreign key. + If the foreign key is made up of multiple properties then specify an anonymous type including the properties. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the principal entity type. + + A configuration object that can be used to further configure the relationship. + + + + Configures the table and column mapping of a relationship that does not expose foreign key properties in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the name of the column(s) for the foreign key. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table name that the foreign key column(s) reside in. + The table that is specified must already be mapped for the entity type. + + If you want the foreign key(s) to reside in their own table then use the Map method + on to perform + entity splitting to create the table with just the primary key property. Foreign keys can + then be added to the table via this method. + + Name of the table. + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table name and schema that the foreign key column(s) reside in. + The table that is specified must already be mapped for the entity type. + + If you want the foreign key(s) to reside in their own table then use the Map method + on to perform + entity splitting to create the table with just the primary key property. Foreign keys can + then be added to the table via this method. + + Name of the table. + Schema of the table. + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table and column mapping of a many:many relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the join table name for the relationship. + + Name of the table. + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the join table name and schema for the relationship. + + Name of the table. + Schema of the table. + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the column(s) for the left foreign key. + The left foreign key represents the navigation property specified in the HasMany call. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the column(s) for the right foreign key. + The right foreign key represents the navigation property specified in the WithMany call. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures a many:many relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the foreign key column(s) and table used to store the relationship. + + Action that configures the foreign key column(s) and table. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Used to configure a property with length facets for an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Used to configure a primitive property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to allow the maximum length supported by the database provider. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property and a default length will be used for the database column. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + Properties are variable length by default. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to allow the maximum length supported by the database provider. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + properties are variable length by default. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + properties are optional by default. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be a row version in the database. + The actual data type will vary depending on the database provider being used. + Setting the property to be a row version will automatically configure it to be an + optimistic concurrency token. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + properties are required by default. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the precision of the property. + If the database provider does not support precision for the data type of the column then the value is ignored. + + Precision of the property. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + properties are required by default. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the precision and scale of the property. + + The precision of the property. + The scale of the property. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to allow the maximum length supported by the database provider. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property and a default length will be used for the database column.. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + properties are variable length by default. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + properties are optional by default. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to support Unicode string content. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property supports Unicode string content. + + + Value indicating if the property supports Unicode string content or not. + Specifying 'null' will remove the Unicode facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Indicates what parts of a configuration are overridable. + + + + + Nothing in the configuration is overridable. + + + + + The configuration values related to C-Space are overridable. + + + + + The configuration values only related to S-Space are overridable. + + + + + True if this configuration can be replaced in the model configuration, false otherwise + This is only set to true for configurations that are registered automatically via the DbContext + + + + + Base class for conventions that process CLR attributes found in the model. + + The type of member to look for. + The type of the configuration to look for. + The type of the attribute to look for. + + + + Convention to process instances of found on properties in the model + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on foreign key properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on navigation properties in the model. + + + + + Convention to process instances of found on primitive properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to detect navigation properties to be inverses of each other when only one pair + of navigation properties exists between the related types. + + + + + Convention to configure a type as a complex type if it has no primary key, no mapped base type and no navigation properties. + + + + + Convention to convert any data types that were explicitly specified, via data annotations or API, + to be lower case. The default SqlClient provider is case sensitive and requires data types to be lower case. This convention + allows the and API to be case insensitive. + + + + + Convention to add a cascade delete to the join table from both tables involved in a many to many relationship. + + + + + Convention to ensure an invalid/unsupported mapping is not created when mapping inherited properties + + + + + Convention to set the table name to be a pluralized version of the entity type name. + + + + + Convention to set precision to 18 and scale to 2 for decimal properties. + + + + + Convention to move primary key properties to appear first. + + + + + Convention to distinguish between optional and required relationships based on CLR nullability of the foreign key property. + + + + + Convention to process instances of found on navigation properties in the model. + + + + + Convention to detect primary key properties. + Recognized naming patterns in order of precedence are: + 1. 'Id' + 2. [type name]Id + Primary key detection is case insensitive. + + + + + Convention to discover foreign key properties whose names are a combination + of the dependent navigation property name and the principal type primary key property name(s). + + + + + Convention to enable cascade delete for any required relationships. + + + + + Convention to configure the primary key(s) of the dependent entity type as foreign key(s) in a one:one relationship. + + + + + Convention to set the entity set name to be a pluralized version of the entity type name. + + + + + Convention to discover foreign key properties whose names match the principal type primary key property name(s). + + + + + Convention to set a default maximum length of 128 for properties whose type supports length facets. + + + + + Convention to set a default maximum length of 4000 for properties whose type supports length facets when SqlCe is the provider. + + + + + Convention to configure integer primary keys to be identity. + + + + + Checks for the PK property being an FK in a different table. A PK which is also an FK but + in the same table is used for table splitting and can still be an identity column because + the update pipeline is only inserting into one column of one table. + + + + + Convention to discover foreign key properties whose names are a combination + of the principal type name and the principal type primary key property name(s). + + + + + This class provide service for both the singularization and pluralization, it takes the word pairs + in the ctor following the rules that the first one is singular and the second one is plural. + + + + + Factory method for PluralizationService. Only support english pluralization. + Please set the PluralizationService on the System.Data.Entity.Design.EntityModelSchemaGenerator + to extend the service to other locales. + + CultureInfo + PluralizationService + + + + captalize the return word if the parameter is capitalized + if word is "Table", then return "Tables" + + + + + + + + separate one combine word in to two parts, prefix word and the last word(suffix word) + + + + + + + + return true when the word is "[\s]*" or leading or tailing with spaces + or contains non alphabetical characters + + + + + + + This method allow you to add word to internal PluralizationService of English. + If the singluar or the plural value was already added by this method, then an ArgumentException will be thrown. + + + + + + + Attempt to determine the principal and dependent ends of this association. + + The following table illustrates the solution space. + + Source | Target || Prin | Dep | + -------|--------||-------|-------| + 1 | 1 || - | - | + 1 | 0..1 || Sr | Ta | + 1 | * || Sr | Ta | + 0..1 | 1 || Ta | Sr | + 0..1 | 0..1 || - | - | + 0..1 | * || Sr | Ta | + * | 1 || Ta | Sr | + * | 0..1 || Ta | Sr | + * | * || - | - | + + + + + Allows configuration to be performed for an entity type in a model. + + An EntityTypeConfiguration can be obtained via the Entity method on + or a custom type derived from EntityTypeConfiguration + can be registered via the Configurations property on . + + + + + Initializes a new instance of EntityTypeConfiguration + + + + + Configures the primary key property(s) for this entity type. + + The type of the key. + + A lambda expression representing the property to be used as the primary key. + C#: t => t.Id + VB.Net: Function(t) t.Id + + If the primary key is made up of multiple properties then specify an anonymous type including the properties. + C#: t => new { t.Id1, t.Id2 } + VB.Net: Function(t) New With { t.Id1, t.Id2 } + + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures the entity set name to be used for this entity type. + The entity set name can only be configured for the base type in each set. + + The name of the entity set. + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures the table name that this entity type is mapped to. + + The name of the table. + + + + Configures the table name that this entity type is mapped to. + + The name of the table. + The database schema of the table. + + + + Allows advanced configuration related to how this entity type is mapped to the database schema. + By default, any configuration will also apply to any type derived from this entity type. + + Derived types can be configured via the overload of Map that configures a derived type or + by using an EntityTypeConfiguration for the derived type. + + The properties of an entity can be split between multiple tables using multiple Map calls. + + Calls to Map are additive, subsequent calls will not override configuration already preformed via Map. + + An action that performs configuration against an . + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Allows advanced configuration related to how a derived entity type is mapped to the database schema. + Calls to Map are additive, subsequent calls will not override configuration already preformed via Map. + + The derived entity type to be configured. + An action that performs configuration against an . + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures an optional relationship from this entity type. + Instances of the entity type will be able to be saved to the database without this relationship being specified. + The foreign key in the database will be nullable. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures a required relationship from this entity type. + Instances of the entity type will not be able to be saved to the database unless this relationship is specified. + The foreign key in the database will be non-nullable. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures a many relationship from this entity type. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Handles mapping from a CLR property to an EDM assocation and nav. prop. + + + + + Exception thrown by during model creation when an invalid model is generated. + + + + + Initializes a new instance of ModelValidationException + + + + + Initializes a new instance of ModelValidationException + + The exception message. + + + + Initializes a new instance of ModelValidationException + + The exception message. + The inner exception. + + + + Code Contracts hook methods - Called when contracts fail. Here we detect the most common preconditions + so we can throw the correct exceptions. It also means that we can write preconditions using the + simplest Contract.Requires() form. + + + + + Returns true if a variable of this type can be assigned a null value + + + + True if a reference type or a nullable value type, + false otherwise + + + + + Exception thrown from when validating entities fails. + + + + + Initializes a new instance of DbEntityValidationException + + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + Validation results. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + The inner exception. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + Validation results. + The inner exception. + + + + Subscribes the SerializeObjectState event. + + + + + Validation results. + + + + + Holds exception state that will be serialized when the exception is serialized. + + + + + Validation results. + + + + + Completes the deserialization. + + The deserialized object. + + + + Validation results. + + + + + Represents validation results for single entity. + + + + + Entity entry the results applies to. Never null. + + + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Creates an instance of class. + + + Entity entry the results applies to. Never null. + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Creates an instance of class. + + + Entity entry the results applies to. Never null. + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Gets an instance of the results applies to. + + + + + Gets validation errors. Never null. + + + + + Gets an indicator if the entity is valid. + + + + + Exception thrown from when an exception is thrown from the validation + code. + + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + The inner exception. + + + + Initializes a new instance of DbUnexpectedValidationException with the specified serialization info and + context. + + The serialization info. + The streaming context. + + + + Validation error. Can be either entity or property level validation error. + + + + + Name of the invalid property. Can be null (e.g. for entity level validations) + + + + + Validation error message. + + + + + Creates an instance of . + + Name of the invalid property. Can be null. + Validation error message. Can be null. + + + + Gets name of the invalid property. + + + + + Gets validation error message. + + + + diff --git a/Website/LOC.Core/bin/Release/LOC.Core.dll b/Website/LOC.Core/bin/Release/LOC.Core.dll new file mode 100644 index 000000000..565e87c2b Binary files /dev/null and b/Website/LOC.Core/bin/Release/LOC.Core.dll differ diff --git a/Website/LOC.Core/bin/Release/LOC.Core.dll.config b/Website/LOC.Core/bin/Release/LOC.Core.dll.config new file mode 100644 index 000000000..e4a04a17d --- /dev/null +++ b/Website/LOC.Core/bin/Release/LOC.Core.dll.config @@ -0,0 +1,14 @@ + + + + +
+ + + + + + + + + \ No newline at end of file diff --git a/Website/LOC.Core/bin/Release/LOC.Core.pdb b/Website/LOC.Core/bin/Release/LOC.Core.pdb new file mode 100644 index 000000000..441328fb2 Binary files /dev/null and b/Website/LOC.Core/bin/Release/LOC.Core.pdb differ diff --git a/Website/LOC.Core/bin/Release/LinqKit.dll b/Website/LOC.Core/bin/Release/LinqKit.dll new file mode 100644 index 000000000..c802265ad Binary files /dev/null and b/Website/LOC.Core/bin/Release/LinqKit.dll differ diff --git a/Website/LOC.Core/bin/Release/Newtonsoft.Json.dll b/Website/LOC.Core/bin/Release/Newtonsoft.Json.dll new file mode 100644 index 000000000..dc9283f4c Binary files /dev/null and b/Website/LOC.Core/bin/Release/Newtonsoft.Json.dll differ diff --git a/Website/LOC.Core/bin/Release/Newtonsoft.Json.xml b/Website/LOC.Core/bin/Release/Newtonsoft.Json.xml new file mode 100644 index 000000000..ee891563c --- /dev/null +++ b/Website/LOC.Core/bin/Release/Newtonsoft.Json.xml @@ -0,0 +1,7343 @@ + + + + Newtonsoft.Json + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class with the specified . + + + + + Reads the next JSON token from the stream. + + true if the next token was read successfully; false if there are no more tokens to read. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Skips the children of the current token. + + + + + Sets the current token. + + The new token. + + + + Sets the current token and value. + + The new token. + The value. + + + + Sets the state based on current token type. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Releases unmanaged and - optionally - managed resources + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Changes the to Closed. + + + + + Gets the current reader state. + + The current reader state. + + + + Gets or sets a value indicating whether the underlying stream or + should be closed when the reader is closed. + + + true to close the underlying stream or when + the reader is closed; otherwise false. The default is true. + + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + Get or set how time zones are handling when reading JSON. + + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Gets the type of the current JSON token. + + + + + Gets the text value of the current JSON token. + + + + + Gets The Common Language Runtime (CLR) type for the current JSON token. + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Gets the path of the current JSON token. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Specifies the state of the reader. + + + + + The Read method has not been called. + + + + + The end of the file has been reached successfully. + + + + + Reader is at a property. + + + + + Reader is at the start of an object. + + + + + Reader is in an object. + + + + + Reader is at the start of an array. + + + + + Reader is in an array. + + + + + The Close method has been called. + + + + + Reader has just read a value. + + + + + Reader is at the start of a constructor. + + + + + Reader in a constructor. + + + + + An error occurred that prevents the read operation from continuing. + + + + + The end of the file has been reached successfully. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The reader. + + + + Initializes a new instance of the class. + + The stream. + if set to true the root object will be read as a JSON array. + The used when reading values from BSON. + + + + Initializes a new instance of the class. + + The reader. + if set to true the root object will be read as a JSON array. + The used when reading values from BSON. + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + + A . This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Changes the to Closed. + + + + + Gets or sets a value indicating whether binary data reading should compatible with incorrect Json.NET 3.5 written binary. + + + true if binary data reading will be compatible with incorrect Json.NET 3.5 written binary; otherwise, false. + + + + + Gets or sets a value indicating whether the root object will be read as a JSON array. + + + true if the root object will be read as a JSON array; otherwise, false. + + + + + Gets or sets the used when reading values from BSON. + + The used when reading values from BSON. + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Creates an instance of the JsonWriter class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the end of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the end of an array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end constructor. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes the end of the current Json object or array. + + + + + Writes the current token. + + The to read the token from. + + + + Writes the specified end token. + + The end token to write. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON without changing the writer's state. + + The raw JSON to write. + + + + Writes raw JSON where a value is expected and updates the writer's state. + + The raw JSON to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + An error will raised if the value cannot be written as a single JSON token. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Gets or sets a value indicating whether the underlying stream or + should be closed when the writer is closed. + + + true to close the underlying stream or when + the writer is closed; otherwise false. The default is true. + + + + + Gets the top. + + The top. + + + + Gets the state of the writer. + + + + + Gets the path of the writer. + + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling when writing JSON. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The writer. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Writes the end. + + The token. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes raw JSON where a value is expected and updates the writer's state. + + The raw JSON to write. + + + + Writes the beginning of a Json array. + + + + + Writes the beginning of a Json object. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Closes this stream and the underlying stream. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value that represents a BSON object id. + + + + + + Writes a BSON regex. + + The regex pattern. + The regex options. + + + + Gets or sets the used when writing values to BSON. + When set to no conversion will occur. + + The used when writing values to BSON. + + + + Represents a BSON Oid (object id). + + + + + Initializes a new instance of the class. + + The Oid value. + + + + Gets or sets the value of the Oid. + + The value of the Oid. + + + + Converts a binary value to and from a base 64 string value. + + + + + Converts an object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets the of the JSON produced by the JsonConverter. + + The of the JSON produced by the JsonConverter. + + + + Gets a value indicating whether this can read JSON. + + true if this can read JSON; otherwise, false. + + + + Gets a value indicating whether this can write JSON. + + true if this can write JSON; otherwise, false. + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Create a custom object + + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Creates an object which will then be populated by the serializer. + + Type of the object. + + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets a value indicating whether this can write JSON. + + + true if this can write JSON; otherwise, false. + + + + + Provides a base class for converting a to and from JSON. + + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an Entity Framework EntityKey to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an ExpandoObject to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets a value indicating whether this can write JSON. + + + true if this can write JSON; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON and BSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON and BSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an to and from its name string value. + + + Converts an to and from its name string value. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + A cached representation of the Enum string representation to respect per Enum field name. + + The type of the Enum. + A map of enum field name to either the field name, or the configured enum member name (). + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets or sets a value indicating whether the written enum text should be camel case. + + true if the written enum text will be camel case; otherwise, false. + + + + Specifies how constructors are used when initializing objects during deserialization by the . + + + + + First attempt to use the public default constructor, then fall back to single paramatized constructor, then the non-public default constructor. + + + + + Json.NET will use a non-public default constructor before falling back to a paramatized constructor. + + + + + Converts a to and from a string (e.g. "1.2.3.4"). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing property value of the JSON that is being converted. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Specifies how dates are formatted when writing JSON text. + + + + + Dates are written in the ISO 8601 format, e.g. "2012-03-21T05:40Z". + + + + + Dates are written in the Microsoft JSON format, e.g. "\/Date(1198908717056)\/". + + + + + Specifies how to treat the time value when converting between string and . + + + + + Treat as local time. If the object represents a Coordinated Universal Time (UTC), it is converted to the local time. + + + + + Treat as a UTC. If the object represents a local time, it is converted to a UTC. + + + + + Treat as a local time if a is being converted to a string. + If a string is being converted to , convert to a local time if a time zone is specified. + + + + + Time zone information should be preserved when converting. + + + + + Specifies formatting options for the . + + + + + No special formatting is applied. This is the default. + + + + + Causes child objects to be indented according to the and settings. + + + + + Instructs the to use the specified constructor when deserializing that object. + + + + + Represents a raw JSON string. + + + + + Represents a value in JSON (string, integer, date, etc). + + + + + Represents an abstract JSON token. + + + + + Represents a collection of objects. + + The type of token + + + + Gets the with the specified key. + + + + + + Provides an interface to enable a class to return line and position information. + + + + + Gets a value indicating whether the class can return line information. + + + true if LineNumber and LinePosition can be provided; otherwise, false. + + + + + Gets the current line number. + + The current line number or 0 if no line information is available (for example, HasLineInfo returns false). + + + + Gets the current line position. + + The current line position or 0 if no line information is available (for example, HasLineInfo returns false). + + + + Compares the values of two tokens, including the values of all descendant tokens. + + The first to compare. + The second to compare. + true if the tokens are equal; otherwise false. + + + + Adds the specified content immediately after this token. + + A content object that contains simple content or a collection of content objects to be added after this token. + + + + Adds the specified content immediately before this token. + + A content object that contains simple content or a collection of content objects to be added before this token. + + + + Returns a collection of the ancestor tokens of this token. + + A collection of the ancestor tokens of this token. + + + + Returns a collection of the sibling tokens after this token, in document order. + + A collection of the sibling tokens after this tokens, in document order. + + + + Returns a collection of the sibling tokens before this token, in document order. + + A collection of the sibling tokens before this token, in document order. + + + + Gets the with the specified key converted to the specified type. + + The type to convert the token to. + The token key. + The converted token value. + + + + Returns a collection of the child tokens of this token, in document order. + + An of containing the child tokens of this , in document order. + + + + Returns a collection of the child tokens of this token, in document order, filtered by the specified type. + + The type to filter the child tokens on. + A containing the child tokens of this , in document order. + + + + Returns a collection of the child values of this token, in document order. + + The type to convert the values to. + A containing the child values of this , in document order. + + + + Removes this token from its parent. + + + + + Replaces this token with the specified token. + + The value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Returns the indented JSON for this token. + + + The indented JSON for this token. + + + + + Returns the JSON for this token using the given formatting and converters. + + Indicates how the output is formatted. + A collection of which will be used when writing the token. + The JSON for this token using the given formatting and converters. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Creates an for this token. + + An that can be used to read this token and its descendants. + + + + Creates a from an object. + + The object that will be used to create . + A with the value of the specified object + + + + Creates a from an object using the specified . + + The object that will be used to create . + The that will be used when reading the object. + A with the value of the specified object + + + + Creates the specified .NET type from the . + + The new object created from the JSON value. + + + + Creates the specified .NET type from the using the specified . + + The that will be used when creating the object. + The new object created from the JSON value. + + + + Creates a from a . + + An positioned at the token to read into this . + + An that contains the token and its descendant tokens + that were read from the reader. The runtime type of the token is determined + by the token type of the first token encountered in the reader. + + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from a . + + An positioned at the token to read into this . + + An that contains the token and its descendant tokens + that were read from the reader. The runtime type of the token is determined + by the token type of the first token encountered in the reader. + + + + + Selects the token that matches the object path. + + + The object path from the current to the + to be returned. This must be a string of property names or array indexes separated + by periods, such as Tables[0].DefaultView[0].Price in C# or + Tables(0).DefaultView(0).Price in Visual Basic. + + The that matches the object path or a null reference if no matching token is found. + + + + Selects the token that matches the object path. + + + The object path from the current to the + to be returned. This must be a string of property names or array indexes separated + by periods, such as Tables[0].DefaultView[0].Price in C# or + Tables(0).DefaultView(0).Price in Visual Basic. + + A flag to indicate whether an error should be thrown if no token is found. + The that matches the object path. + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Creates a new instance of the . All child tokens are recursively cloned. + + A new instance of the . + + + + Gets a comparer that can compare two tokens for value equality. + + A that can compare two nodes for value equality. + + + + Gets or sets the parent. + + The parent. + + + + Gets the root of this . + + The root of this . + + + + Gets the node type for this . + + The type. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Gets the next sibling token of this node. + + The that contains the next sibling token. + + + + Gets the previous sibling token of this node. + + The that contains the previous sibling token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Get the first child token of this token. + + A containing the first child token of the . + + + + Get the last child token of this token. + + A containing the last child token of the . + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Creates a comment with the given value. + + The value. + A comment with the given value. + + + + Creates a string with the given value. + + The value. + A string with the given value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Indicates whether the current object is equal to another object of the same type. + + + true if the current object is equal to the parameter; otherwise, false. + + An object to compare with this object. + + + + Determines whether the specified is equal to the current . + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + + The parameter is null. + + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format. + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format provider. + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format. + The format provider. + + A that represents this instance. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. + + An object to compare with this instance. + + A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: + Value + Meaning + Less than zero + This instance is less than . + Zero + This instance is equal to . + Greater than zero + This instance is greater than . + + + is not the same type as this instance. + + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Gets the node type for this . + + The type. + + + + Gets or sets the underlying token value. + + The underlying token value. + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class. + + The raw json. + + + + Creates an instance of with the content of the reader's current token. + + The reader. + An instance of with the content of the reader's current token. + + + + Indicating whether a property is required. + + + + + The property is not required. The default state. + + + + + The property must be defined in JSON but can be a null value. + + + + + The property must be defined in JSON and cannot be a null value. + + + + + Contract details for a used by the . + + + + + Contract details for a used by the . + + + + + Gets the underlying type for the contract. + + The underlying type for the contract. + + + + Gets or sets the type created during deserialization. + + The type created during deserialization. + + + + Gets or sets whether this type contract is serialized as a reference. + + Whether this type contract is serialized as a reference. + + + + Gets or sets the default for this contract. + + The converter. + + + + Gets or sets the method called immediately after deserialization of the object. + + The method called immediately after deserialization of the object. + + + + Gets or sets the method called during deserialization of the object. + + The method called during deserialization of the object. + + + + Gets or sets the method called after serialization of the object graph. + + The method called after serialization of the object graph. + + + + Gets or sets the method called before serialization of the object. + + The method called before serialization of the object. + + + + Gets or sets the default creator method used to create the object. + + The default creator method used to create the object. + + + + Gets or sets a value indicating whether the default creator is non public. + + true if the default object creator is non-public; otherwise, false. + + + + Gets or sets the method called when an error is thrown during the serialization of the object. + + The method called when an error is thrown during the serialization of the object. + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets the object's properties. + + The object's properties. + + + + Gets or sets the property name resolver. + + The property name resolver. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the ISerializable object constructor. + + The ISerializable object constructor. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Get and set values for a using dynamic methods. + + + + + Provides methods to get and set values. + + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + Initializes a new instance of the class. + + The member info. + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + Provides data for the Error event. + + + + + Initializes a new instance of the class. + + The current object. + The error context. + + + + Gets the current object the error event is being raised against. + + The current object the error event is being raised against. + + + + Gets the error context. + + The error context. + + + + Represents a view of a . + + + + + Initializes a new instance of the class. + + The name. + Type of the property. + + + + When overridden in a derived class, returns whether resetting an object changes its value. + + + true if resetting the component changes its value; otherwise, false. + + The component to test for reset capability. + + + + + When overridden in a derived class, gets the current value of the property on a component. + + + The value of a property for a given component. + + The component with the property for which to retrieve the value. + + + + + When overridden in a derived class, resets the value for this property of the component to the default value. + + The component with the property value that is to be reset to the default value. + + + + + When overridden in a derived class, sets the value of the component to a different value. + + The component with the property value that is to be set. + The new value. + + + + + When overridden in a derived class, determines a value indicating whether the value of this property needs to be persisted. + + + true if the property should be persisted; otherwise, false. + + The component with the property to be examined for persistence. + + + + + When overridden in a derived class, gets the type of the component this property is bound to. + + + A that represents the type of component this property is bound to. When the or methods are invoked, the object specified might be an instance of this type. + + + + + When overridden in a derived class, gets a value indicating whether this property is read-only. + + + true if the property is read-only; otherwise, false. + + + + + When overridden in a derived class, gets the type of the property. + + + A that represents the type of the property. + + + + + Gets the hash code for the name of the member. + + + + The hash code for the name of the member. + + + + + Used to resolve references when serializing and deserializing JSON by the . + + + + + Resolves a reference to its object. + + The serialization context. + The reference to resolve. + The object that + + + + Gets the reference for the sepecified object. + + The serialization context. + The object to get a reference for. + The reference to the object. + + + + Determines whether the specified object is referenced. + + The serialization context. + The object to test for a reference. + + true if the specified object is referenced; otherwise, false. + + + + + Adds a reference to the specified object. + + The serialization context. + The reference. + The object to reference. + + + + Specifies reference handling options for the . + + + + + Do not preserve references when serializing types. + + + + + Preserve references when serializing into a JSON object structure. + + + + + Preserve references when serializing into a JSON array structure. + + + + + Preserve references when serializing. + + + + + Instructs the how to serialize the collection. + + + + + Instructs the how to serialize the object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets the id. + + The id. + + + + Gets or sets the title. + + The title. + + + + Gets or sets the description. + + The description. + + + + Gets or sets a value that indicates whether to preserve object reference data. + + + true to keep object reference; otherwise, false. The default is false. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a flag indicating whether the array can contain null items + + A flag indicating whether the array can contain null items. + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets a value indicating whether null items are allowed in the collection. + + true if null items are allowed in the collection; otherwise, false. + + + + Specifies default value handling options for the . + + + + + Include members where the member value is the same as the member's default value when serializing objects. + Included members are written to JSON. Has no effect when deserializing. + + + + + Ignore members where the member value is the same as the member's default value when serializing objects + so that is is not written to JSON, and ignores setting members when the JSON value equals the member's default value. + + + + + Members with a default value but no JSON will be set to their default value when deserializing. + + + + + Ignore members where the member value is the same as the member's default value when serializing objects + and sets members to their default value when deserializing. + + + + + Instructs the to use the specified when serializing the member or class. + + + + + Initializes a new instance of the class. + + Type of the converter. + + + + Gets the type of the converter. + + The type of the converter. + + + + Instructs the how to serialize the object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified member serialization. + + The member serialization. + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets the member serialization. + + The member serialization. + + + + Specifies the settings on a object. + + + + + Initializes a new instance of the class. + + + + + Gets or sets how reference loops (e.g. a class referencing itself) is handled. + + Reference loop handling. + + + + Gets or sets how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + Missing member handling. + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets or sets how null values are handled during serialization and deserialization. + + Null value handling. + + + + Gets or sets how null default are handled during serialization and deserialization. + + The default value handling. + + + + Gets or sets a collection that will be used during serialization. + + The converters. + + + + Gets or sets how object references are preserved by the serializer. + + The preserve references handling. + + + + Gets or sets how type name writing and reading is handled by the serializer. + + The type name handling. + + + + Gets or sets how a type name assembly is written and resolved by the serializer. + + The type name assembly format. + + + + Gets or sets how constructors are used during deserialization. + + The constructor handling. + + + + Gets or sets the contract resolver used by the serializer when + serializing .NET objects to JSON and vice versa. + + The contract resolver. + + + + Gets or sets the used by the serializer when resolving references. + + The reference resolver. + + + + Gets or sets the used by the serializer when resolving type names. + + The binder. + + + + Gets or sets the error handler called during serialization and deserialization. + + The error handler called during serialization and deserialization. + + + + Gets or sets the used by the serializer when invoking serialization callback methods. + + The context. + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling during serialization and deserialization. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Represents a reader that provides validation. + + + + + Initializes a new instance of the class that + validates the content returned from the given . + + The to read from while validating. + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. + + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Sets an event handler for receiving schema validation errors. + + + + + Gets the text value of the current Json token. + + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Gets the path of the current JSON token. + + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + + Gets the type of the current Json token. + + + + + + Gets the Common Language Runtime (CLR) type for the current Json token. + + + + + + Gets or sets the schema. + + The schema. + + + + Gets the used to construct this . + + The specified in the constructor. + + + + Compares tokens to determine whether they are equal. + + + + + Determines whether the specified objects are equal. + + The first object of type to compare. + The second object of type to compare. + + true if the specified objects are equal; otherwise, false. + + + + + Returns a hash code for the specified object. + + The for which a hash code is to be returned. + A hash code for the specified object. + The type of is a reference type and is null. + + + + Specifies the member serialization options for the . + + + + + All public members are serialized by default. Members can be excluded using or . + This is the default member serialization mode. + + + + + Only members must be marked with or are serialized. + This member serialization mode can also be set by marking the class with . + + + + + All public and private fields are serialized. Members can be excluded using or . + This member serialization mode can also be set by marking the class with . + + + + + Specifies how object creation is handled by the . + + + + + Reuse existing objects, create new objects when needed. + + + + + Only reuse existing objects. + + + + + Always create new objects. + + + + + Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Gets or sets the date time styles used when converting a date to and from JSON. + + The date time styles used when converting a date to and from JSON. + + + + Gets or sets the date time format used when converting a date to and from JSON. + + The date time format used when converting a date to and from JSON. + + + + Gets or sets the culture used when converting a date to and from JSON. + + The culture used when converting a date to and from JSON. + + + + Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing property value of the JSON that is being converted. + The calling serializer. + The object value. + + + + Converts XML to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The calling serializer. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Checks if the attributeName is a namespace attribute. + + Attribute name to test. + The attribute name prefix if it has one, otherwise an empty string. + True if attribute name is for a namespace attribute, otherwise false. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Gets or sets the name of the root element to insert when deserializing to XML if the JSON structure has produces multiple root elements. + + The name of the deserialize root element. + + + + Gets or sets a flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + true if the array attibute is written to the XML; otherwise, false. + + + + Gets or sets a value indicating whether to write the root JSON object. + + true if the JSON root object is omitted; otherwise, false. + + + + Represents a reader that provides fast, non-cached, forward-only access to JSON text data. + + + + + Initializes a new instance of the class with the specified . + + The TextReader containing the XML data to read. + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Changes the state to closed. + + + + + Gets a value indicating whether the class can return line information. + + + true if LineNumber and LinePosition can be provided; otherwise, false. + + + + + Gets the current line number. + + + The current line number or 0 if no line information is available (for example, HasLineInfo returns false). + + + + + Gets the current line position. + + + The current line position or 0 if no line information is available (for example, HasLineInfo returns false). + + + + + Instructs the to always serialize the member with the specified name. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified name. + + Name of the property. + + + + Gets or sets the null value handling used when serializing this property. + + The null value handling. + + + + Gets or sets the default value handling used when serializing this property. + + The default value handling. + + + + Gets or sets the reference loop handling used when serializing this property. + + The reference loop handling. + + + + Gets or sets the object creation handling used when deserializing this property. + + The object creation handling. + + + + Gets or sets the type name handling used when serializing this property. + + The type name handling. + + + + Gets or sets whether this property's value is serialized as a reference. + + Whether this property's value is serialized as a reference. + + + + Gets or sets the order of serialization and deserialization of a member. + + The numeric order of serialization or deserialization. + + + + Gets or sets the name of the property. + + The name of the property. + + + + Gets or sets a value indicating whether this property is required. + + + A value indicating whether this property is required. + + + + + Instructs the not to serialize the public field or public read/write property value. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Creates an instance of the JsonWriter class using the specified . + + The TextWriter to write to. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the specified end token. + + The end token to write. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + + + + + Gets or sets which character to use to quote attribute values. + + + + + Gets or sets which character to use for indenting when is set to Formatting.Indented. + + + + + Gets or sets a value indicating whether object names will be surrounded with quotes. + + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Gets the line number indicating where the error occurred. + + The line number indicating where the error occurred. + + + + Gets the line position indicating where the error occurred. + + The line position indicating where the error occurred. + + + + Gets the path to the JSON where the error occurred. + + The path to the JSON where the error occurred. + + + + Represents a collection of . + + + + + Provides methods for converting between common language runtime types and JSON types. + + + + + Represents JavaScript's boolean value true as a string. This field is read-only. + + + + + Represents JavaScript's boolean value false as a string. This field is read-only. + + + + + Represents JavaScript's null as a string. This field is read-only. + + + + + Represents JavaScript's undefined as a string. This field is read-only. + + + + + Represents JavaScript's positive infinity as a string. This field is read-only. + + + + + Represents JavaScript's negative infinity as a string. This field is read-only. + + + + + Represents JavaScript's NaN as a string. This field is read-only. + + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation using the specified. + + The value to convert. + The format the date will be converted to. + The time zone handling when the date is converted to a string. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation using the specified. + + The value to convert. + The format the date will be converted to. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + The string delimiter character. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Serializes the specified object to a JSON string. + + The object to serialize. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string. + + The object to serialize. + Indicates how the output is formatted. + + A JSON string representation of the object. + + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A JSON string representation of the object. + + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Deserializes the JSON to a .NET object. + + The JSON to deserialize. + The deserialized object from the Json string. + + + + Deserializes the JSON to a .NET object. + + The JSON to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The of object being deserialized. + The deserialized object from the Json string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + The deserialized object from the Json string. + + + + Deserializes the JSON to the given anonymous type. + + + The anonymous type to deserialize to. This can't be specified + traditionally and must be infered from the anonymous type passed + as a parameter. + + The JSON to deserialize. + The anonymous type object. + The deserialized anonymous type from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The object to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize to. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize to. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + + + Populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + + + Asynchronously populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous populate operation. + + + + + Serializes the XML node to a JSON string. + + The node to serialize. + A JSON string of the XmlNode. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + A JSON string of the XmlNode. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + Omits writing the root object. + A JSON string of the XmlNode. + + + + Deserializes the XmlNode from a JSON string. + + The JSON string. + The deserialized XmlNode + + + + Deserializes the XmlNode from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + The deserialized XmlNode + + + + Deserializes the XmlNode from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + + A flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + The deserialized XmlNode + + + + Serializes the to a JSON string. + + The node to convert to JSON. + A JSON string of the XNode. + + + + Serializes the to a JSON string. + + The node to convert to JSON. + Indicates how the output is formatted. + A JSON string of the XNode. + + + + Serializes the to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + Omits writing the root object. + A JSON string of the XNode. + + + + Deserializes the from a JSON string. + + The JSON string. + The deserialized XNode + + + + Deserializes the from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + The deserialized XNode + + + + Deserializes the from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + + A flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + The deserialized XNode + + + + The exception thrown when an error occurs during Json serialization or deserialization. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Serializes and deserializes objects into and from the JSON format. + The enables you to control how objects are encoded into JSON. + + + + + Initializes a new instance of the class. + + + + + Creates a new instance using the specified . + + The settings to be applied to the . + A new instance using the specified . + + + + Populates the JSON values onto the target object. + + The that contains the JSON structure to reader values from. + The target object to populate values onto. + + + + Populates the JSON values onto the target object. + + The that contains the JSON structure to reader values from. + The target object to populate values onto. + + + + Deserializes the Json structure contained by the specified . + + The that contains the JSON structure to deserialize. + The being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The type of the object to deserialize. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Occurs when the errors during serialization and deserialization. + + + + + Gets or sets the used by the serializer when resolving references. + + + + + Gets or sets the used by the serializer when resolving type names. + + + + + Gets or sets how type name writing and reading is handled by the serializer. + + + + + Gets or sets how a type name assembly is written and resolved by the serializer. + + The type name assembly format. + + + + Gets or sets how object references are preserved by the serializer. + + + + + Get or set how reference loops (e.g. a class referencing itself) is handled. + + + + + Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + + + + Get or set how null values are handled during serialization and deserialization. + + + + + Get or set how null default are handled during serialization and deserialization. + + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets or sets how constructors are used during deserialization. + + The constructor handling. + + + + Gets a collection that will be used during serialization. + + Collection that will be used during serialization. + + + + Gets or sets the contract resolver used by the serializer when + serializing .NET objects to JSON and vice versa. + + + + + Gets or sets the used by the serializer when invoking serialization callback methods. + + The context. + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling during serialization and deserialization. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Contains the LINQ to JSON extension methods. + + + + + Returns a collection of tokens that contains the ancestors of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the ancestors of every node in the source collection. + + + + Returns a collection of tokens that contains the descendants of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the descendants of every node in the source collection. + + + + Returns a collection of child properties of every object in the source collection. + + An of that contains the source collection. + An of that contains the properties of every object in the source collection. + + + + Returns a collection of child values of every object in the source collection with the given key. + + An of that contains the source collection. + The token key. + An of that contains the values of every node in the source collection with the given key. + + + + Returns a collection of child values of every object in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child values of every object in the source collection with the given key. + + The type to convert the values to. + An of that contains the source collection. + The token key. + An that contains the converted values of every node in the source collection with the given key. + + + + Returns a collection of converted child values of every object in the source collection. + + The type to convert the values to. + An of that contains the source collection. + An that contains the converted values of every node in the source collection. + + + + Converts the value. + + The type to convert the value to. + A cast as a of . + A converted value. + + + + Converts the value. + + The source collection type. + The type to convert the value to. + A cast as a of . + A converted value. + + + + Returns a collection of child tokens of every array in the source collection. + + The source collection type. + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child tokens of every array in the source collection. + + An of that contains the source collection. + The type to convert the values to. + The source collection type. + An that contains the converted values of every node in the source collection. + + + + Returns the input typed as . + + An of that contains the source collection. + The input typed as . + + + + Returns the input typed as . + + The source collection type. + An of that contains the source collection. + The input typed as . + + + + Represents a JSON constructor. + + + + + Represents a token that can contain other tokens. + + + + + Raises the event. + + The instance containing the event data. + + + + Raises the event. + + The instance containing the event data. + + + + Raises the event. + + The instance containing the event data. + + + + Returns a collection of the child tokens of this token, in document order. + + + An of containing the child tokens of this , in document order. + + + + + Returns a collection of the child values of this token, in document order. + + The type to convert the values to. + + A containing the child values of this , in document order. + + + + + Returns a collection of the descendant tokens for this token in document order. + + An containing the descendant tokens of the . + + + + Adds the specified content as children of this . + + The content to be added. + + + + Adds the specified content as the first children of this . + + The content to be added. + + + + Creates an that can be used to add tokens to the . + + An that is ready to have content written to it. + + + + Replaces the children nodes of this token with the specified content. + + The content. + + + + Removes the child nodes from this token. + + + + + Occurs when the list changes or an item in the list changes. + + + + + Occurs before an item is added to the collection. + + + + + Occurs when the items list of the collection has changed, or the collection is reset. + + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Get the first child token of this token. + + + A containing the first child token of the . + + + + + Get the last child token of this token. + + + A containing the last child token of the . + + + + + Gets the count of child JSON tokens. + + The count of child JSON tokens + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name. + + The constructor name. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets or sets the name of this constructor. + + The constructor name. + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a collection of objects. + + The type of token + + + + An empty collection of objects. + + + + + Initializes a new instance of the struct. + + The enumerable. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + + + + Determines whether the specified is equal to this instance. + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the with the specified key. + + + + + + Represents a JSON object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Gets an of this object's properties. + + An of this object's properties. + + + + Gets a the specified name. + + The property name. + A with the specified name or null. + + + + Gets an of this object's property values. + + An of this object's property values. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Creates a from an object. + + The object that will be used to create . + The that will be used to read the object. + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Adds the specified property name. + + Name of the property. + The value. + + + + Removes the property with the specified name. + + Name of the property. + true if item was successfully removed; otherwise, false. + + + + Tries the get value. + + Name of the property. + The value. + true if a value was successfully retrieved; otherwise, false. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Raises the event with the provided arguments. + + Name of the property. + + + + Raises the event with the provided arguments. + + Name of the property. + + + + Returns the properties for this instance of a component. + + + A that represents the properties for this component instance. + + + + + Returns the properties for this instance of a component using the attribute array as a filter. + + An array of type that is used as a filter. + + A that represents the filtered properties for this component instance. + + + + + Returns a collection of custom attributes for this instance of a component. + + + An containing the attributes for this object. + + + + + Returns the class name of this instance of a component. + + + The class name of the object, or null if the class does not have a name. + + + + + Returns the name of this instance of a component. + + + The name of the object, or null if the object does not have a name. + + + + + Returns a type converter for this instance of a component. + + + A that is the converter for this object, or null if there is no for this object. + + + + + Returns the default event for this instance of a component. + + + An that represents the default event for this object, or null if this object does not have events. + + + + + Returns the default property for this instance of a component. + + + A that represents the default property for this object, or null if this object does not have properties. + + + + + Returns an editor of the specified type for this instance of a component. + + A that represents the editor for this object. + + An of the specified type that is the editor for this object, or null if the editor cannot be found. + + + + + Returns the events for this instance of a component using the specified attribute array as a filter. + + An array of type that is used as a filter. + + An that represents the filtered events for this component instance. + + + + + Returns the events for this instance of a component. + + + An that represents the events for this component instance. + + + + + Returns an object that contains the property described by the specified property descriptor. + + A that represents the property whose owner is to be found. + + An that represents the owner of the specified property. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Occurs when a property value changes. + + + + + Occurs when a property value is changing. + + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets or sets the with the specified property name. + + + + + + Represents a JSON array. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Creates a from an object. + + The object that will be used to create . + The that will be used to read the object. + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Determines the index of a specific item in the . + + The object to locate in the . + + The index of if found in the list; otherwise, -1. + + + + + Inserts an item to the at the specified index. + + The zero-based index at which should be inserted. + The object to insert into the . + + is not a valid index in the . + The is read-only. + + + + Removes the item at the specified index. + + The zero-based index of the item to remove. + + is not a valid index in the . + The is read-only. + + + + Adds an item to the . + + The object to add to the . + The is read-only. + + + + Removes all items from the . + + The is read-only. + + + + Determines whether the contains a specific value. + + The object to locate in the . + + true if is found in the ; otherwise, false. + + + + + Removes the first occurrence of a specific object from the . + + The object to remove from the . + + true if was successfully removed from the ; otherwise, false. This method also returns false if is not found in the original . + + The is read-only. + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets or sets the at the specified index. + + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class. + + The token to read from. + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Initializes a new instance of the class writing to the given . + + The container being written to. + + + + Initializes a new instance of the class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end. + + The token. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Gets the token being writen. + + The token being writen. + + + + Represents a JSON property. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class. + + The property name. + The property content. + + + + Initializes a new instance of the class. + + The property name. + The property content. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets the property name. + + The property name. + + + + Gets or sets the property value. + + The property value. + + + + Gets the node type for this . + + The type. + + + + Specifies the type of token. + + + + + No token type has been set. + + + + + A JSON object. + + + + + A JSON array. + + + + + A JSON constructor. + + + + + A JSON object property. + + + + + A comment. + + + + + An integer value. + + + + + A float value. + + + + + A string value. + + + + + A boolean value. + + + + + A null value. + + + + + An undefined value. + + + + + A date value. + + + + + A raw JSON value. + + + + + A collection of bytes value. + + + + + A Guid value. + + + + + A Uri value. + + + + + A TimeSpan value. + + + + + Contains the JSON schema extension methods. + + + + + Determines whether the is valid. + + The source to test. + The schema to test with. + + true if the specified is valid; otherwise, false. + + + + + Determines whether the is valid. + + The source to test. + The schema to test with. + When this method returns, contains any error messages generated while validating. + + true if the specified is valid; otherwise, false. + + + + + Validates the specified . + + The source to test. + The schema to test with. + + + + Validates the specified . + + The source to test. + The schema to test with. + The validation event handler. + + + + Returns detailed information about the schema exception. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Gets the line number indicating where the error occurred. + + The line number indicating where the error occurred. + + + + Gets the line position indicating where the error occurred. + + The line position indicating where the error occurred. + + + + Gets the path to the JSON where the error occurred. + + The path to the JSON where the error occurred. + + + + Resolves from an id. + + + + + Initializes a new instance of the class. + + + + + Gets a for the specified id. + + The id. + A for the specified id. + + + + Gets or sets the loaded schemas. + + The loaded schemas. + + + + Specifies undefined schema Id handling options for the . + + + + + Do not infer a schema Id. + + + + + Use the .NET type name as the schema Id. + + + + + Use the assembly qualified .NET type name as the schema Id. + + + + + Returns detailed information related to the . + + + + + Gets the associated with the validation error. + + The JsonSchemaException associated with the validation error. + + + + Gets the path of the JSON location where the validation error occurred. + + The path of the JSON location where the validation error occurred. + + + + Gets the text description corresponding to the validation error. + + The text description. + + + + Represents the callback method that will handle JSON schema validation events and the . + + + + + Resolves member mappings for a type, camel casing property names. + + + + + Used by to resolves a for a given . + + + + + Used by to resolves a for a given . + + + + + Resolves the contract for a given type. + + The type to resolve a contract for. + The contract for a given type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + If set to true the will use a cached shared with other resolvers of the same type. + Sharing the cache will significantly performance because expensive reflection will only happen once but could cause unexpected + behavior if different instances of the resolver are suppose to produce different results. When set to false it is highly + recommended to reuse instances with the . + + + + + Resolves the contract for a given type. + + The type to resolve a contract for. + The contract for a given type. + + + + Gets the serializable members for the type. + + The type to get serializable members for. + The serializable members for the type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates the constructor parameters. + + The constructor to create properties for. + The type's member properties. + Properties for the given . + + + + Creates a for the given . + + The matching member property. + The constructor parameter. + A created for the given . + + + + Resolves the default for the contract. + + Type of the object. + + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Determines which contract type is created for the given type. + + Type of the object. + A for the given type. + + + + Creates properties for the given . + + The type to create properties for. + /// The member serialization mode for the type. + Properties for the given . + + + + Creates the used by the serializer to get and set values from a member. + + The member. + The used by the serializer to get and set values from a member. + + + + Creates a for the given . + + The member's parent . + The member to create a for. + A created for the given . + + + + Resolves the name of the property. + + Name of the property. + Name of the property. + + + + Gets a value indicating whether members are being get and set using dynamic code generation. + This value is determined by the runtime permissions available. + + + true if using dynamic code generation; otherwise, false. + + + + + Gets or sets the default members search flags. + + The default members search flags. + + + + Gets or sets a value indicating whether compiler generated members should be serialized. + + + true if serialized compiler generated members; otherwise, false. + + + + + Gets or sets a value indicating whether to ignore the interface when serializing and deserializing types. + + + true if the interface will be ignored when serializing and deserializing types; otherwise, false. + + + + + Gets or sets a value indicating whether to ignore the attribute when serializing and deserializing types. + + + true if the attribute will be ignored when serializing and deserializing types; otherwise, false. + + + + + Initializes a new instance of the class. + + + + + Resolves the name of the property. + + Name of the property. + The property name camel cased. + + + + The default serialization binder used when resolving and loading classes from type names. + + + + + When overridden in a derived class, controls the binding of a serialized object to a type. + + Specifies the name of the serialized object. + Specifies the name of the serialized object. + + The type of the object the formatter creates a new instance of. + + + + + When overridden in a derived class, controls the binding of a serialized object to a type. + + The type of the object the formatter creates a new instance of. + Specifies the name of the serialized object. + Specifies the name of the serialized object. + + + + Provides information surrounding an error. + + + + + Gets or sets the error. + + The error. + + + + Gets the original object that caused the error. + + The original object that caused the error. + + + + Gets the member that caused the error. + + The member that caused the error. + + + + Gets the path of the JSON location where the error occurred. + + The path of the JSON location where the error occurred. + + + + Gets or sets a value indicating whether this is handled. + + true if handled; otherwise, false. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets the of the collection items. + + The of the collection items. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the property name resolver. + + The property name resolver. + + + + Gets the of the dictionary keys. + + The of the dictionary keys. + + + + Gets the of the dictionary values. + + The of the dictionary values. + + + + Maps a JSON property to a .NET member or constructor parameter. + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Gets or sets the name of the property. + + The name of the property. + + + + Gets or sets the type that declared this property. + + The type that declared this property. + + + + Gets or sets the order of serialization and deserialization of a member. + + The numeric order of serialization or deserialization. + + + + Gets or sets the name of the underlying member or parameter. + + The name of the underlying member or parameter. + + + + Gets the that will get and set the during serialization. + + The that will get and set the during serialization. + + + + Gets or sets the type of the property. + + The type of the property. + + + + Gets or sets the for the property. + If set this converter takes presidence over the contract converter for the property type. + + The converter. + + + + Gets the member converter. + + The member converter. + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + + Gets a value indicating whether this is readable. + + true if readable; otherwise, false. + + + + Gets a value indicating whether this is writable. + + true if writable; otherwise, false. + + + + Gets the default value. + + The default value. + + + + Gets a value indicating whether this is required. + + A value indicating whether this is required. + + + + Gets a value indicating whether this property preserves object references. + + + true if this instance is reference; otherwise, false. + + + + + Gets the property null value handling. + + The null value handling. + + + + Gets the property default value handling. + + The default value handling. + + + + Gets the property reference loop handling. + + The reference loop handling. + + + + Gets the property object creation handling. + + The object creation handling. + + + + Gets or sets the type name handling. + + The type name handling. + + + + Gets or sets a predicate used to determine whether the property should be serialize. + + A predicate used to determine whether the property should be serialize. + + + + Gets or sets a predicate used to determine whether the property should be serialized. + + A predicate used to determine whether the property should be serialized. + + + + Gets or sets an action used to set whether the property has been deserialized. + + An action used to set whether the property has been deserialized. + + + + A collection of objects. + + + + + Initializes a new instance of the class. + + The type. + + + + When implemented in a derived class, extracts the key from the specified element. + + The element from which to extract the key. + The key for the specified element. + + + + Adds a object. + + The property to add to the collection. + + + + Gets the closest matching object. + First attempts to get an exact case match of propertyName and then + a case insensitive match. + + Name of the property. + A matching property if found. + + + + Gets a property by property name. + + The name of the property to get. + Type property name string comparison. + A matching property if found. + + + + Specifies missing member handling options for the . + + + + + Ignore a missing member and do not attempt to deserialize it. + + + + + Throw a when a missing member is encountered during deserialization. + + + + + Specifies null value handling options for the . + + + + + Include null values when serializing and deserializing objects. + + + + + Ignore null values when serializing and deserializing objects. + + + + + Specifies reference loop handling options for the . + + + + + Throw a when a loop is encountered. + + + + + Ignore loop references and do not serialize. + + + + + Serialize loop references. + + + + + An in-memory representation of a JSON Schema. + + + + + Initializes a new instance of the class. + + + + + Reads a from the specified . + + The containing the JSON Schema to read. + The object representing the JSON Schema. + + + + Reads a from the specified . + + The containing the JSON Schema to read. + The to use when resolving schema references. + The object representing the JSON Schema. + + + + Load a from a string that contains schema JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Parses the specified json. + + The json. + The resolver. + A populated from the string that contains JSON. + + + + Writes this schema to a . + + A into which this method will write. + + + + Writes this schema to a using the specified . + + A into which this method will write. + The resolver used. + + + + Returns a that represents the current . + + + A that represents the current . + + + + + Gets or sets the id. + + + + + Gets or sets the title. + + + + + Gets or sets whether the object is required. + + + + + Gets or sets whether the object is read only. + + + + + Gets or sets whether the object is visible to users. + + + + + Gets or sets whether the object is transient. + + + + + Gets or sets the description of the object. + + + + + Gets or sets the types of values allowed by the object. + + The type. + + + + Gets or sets the pattern. + + The pattern. + + + + Gets or sets the minimum length. + + The minimum length. + + + + Gets or sets the maximum length. + + The maximum length. + + + + Gets or sets a number that the value should be divisble by. + + A number that the value should be divisble by. + + + + Gets or sets the minimum. + + The minimum. + + + + Gets or sets the maximum. + + The maximum. + + + + Gets or sets a flag indicating whether the value can not equal the number defined by the "minimum" attribute. + + A flag indicating whether the value can not equal the number defined by the "minimum" attribute. + + + + Gets or sets a flag indicating whether the value can not equal the number defined by the "maximum" attribute. + + A flag indicating whether the value can not equal the number defined by the "maximum" attribute. + + + + Gets or sets the minimum number of items. + + The minimum number of items. + + + + Gets or sets the maximum number of items. + + The maximum number of items. + + + + Gets or sets the of items. + + The of items. + + + + Gets or sets the of properties. + + The of properties. + + + + Gets or sets the of additional properties. + + The of additional properties. + + + + Gets or sets the pattern properties. + + The pattern properties. + + + + Gets or sets a value indicating whether additional properties are allowed. + + + true if additional properties are allowed; otherwise, false. + + + + + Gets or sets the required property if this property is present. + + The required property if this property is present. + + + + Gets or sets the identity. + + The identity. + + + + Gets or sets the a collection of valid enum values allowed. + + A collection of valid enum values allowed. + + + + Gets or sets a collection of options. + + A collection of options. + + + + Gets or sets disallowed types. + + The disallow types. + + + + Gets or sets the default value. + + The default value. + + + + Gets or sets the extend . + + The extended . + + + + Gets or sets the format. + + The format. + + + + Generates a from a specified . + + + + + Generate a from the specified type. + + The type to generate a from. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + The used to resolve schema references. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + Specify whether the generated root will be nullable. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + The used to resolve schema references. + Specify whether the generated root will be nullable. + A generated from the specified type. + + + + Gets or sets how undefined schemas are handled by the serializer. + + + + + Gets or sets the contract resolver. + + The contract resolver. + + + + The value types allowed by the . + + + + + No type specified. + + + + + String type. + + + + + Float type. + + + + + Integer type. + + + + + Boolean type. + + + + + Object type. + + + + + Array type. + + + + + Null type. + + + + + Any type. + + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the object member serialization. + + The member object serialization. + + + + Gets the object's properties. + + The object's properties. + + + + Gets the constructor parameters required for any non-default constructor + + + + + Gets or sets the override constructor used to create the object. + This is set when a constructor is marked up using the + JsonConstructor attribute. + + The override constructor. + + + + Gets or sets the parametrized constructor used to create the object. + + The parametrized constructor. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Get and set values for a using reflection. + + + + + Initializes a new instance of the class. + + The member info. + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + When applied to a method, specifies that the method is called when an error occurs serializing an object. + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic that returns a result + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic, but uses one of the arguments for + the result. + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic, but uses one of the arguments for + the result. + + + + + Returns a Restrictions object which includes our current restrictions merged + with a restriction limiting our type + + + + + Represents a method that constructs an object. + + + + + Specifies type name handling options for the . + + + + + Do not include the .NET type name when serializing types. + + + + + Include the .NET type name when serializing into a JSON object structure. + + + + + Include the .NET type name when serializing into a JSON array structure. + + + + + Always include the .NET type name when serializing. + + + + + Include the .NET type name when the type of the object being serialized is not the same as its declared type. + + + + + Converts the value to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert the value to. + The converted type. + + + + Converts the value to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert the value to. + The converted value if the conversion was successful or the default value of T if it failed. + + true if initialValue was converted successfully; otherwise, false. + + + + + Converts the value to the specified type. If the value is unable to be converted, the + value is checked whether it assignable to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert or cast the value to. + + The converted type. If conversion was unsuccessful, the initial value + is returned if assignable to the target type. + + + + + Gets a dictionary of the names and values of an Enum type. + + + + + + Gets a dictionary of the names and values of an Enum type. + + The enum type to get names and values for. + + + + + Specifies the type of Json token. + + + + + This is returned by the if a method has not been called. + + + + + An object start token. + + + + + An array start token. + + + + + A constructor start token. + + + + + An object property name. + + + + + A comment. + + + + + Raw JSON. + + + + + An integer. + + + + + A float. + + + + + A string. + + + + + A boolean. + + + + + A null token. + + + + + An undefined token. + + + + + An object end token. + + + + + An array end token. + + + + + A constructor end token. + + + + + A Date. + + + + + Byte data. + + + + + Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Adds the elements of the specified collection to the specified generic IList. + + The list to add to. + The collection of elements to add. + + + + Returns the index of the first occurrence in a sequence by using a specified IEqualityComparer. + + The type of the elements of source. + A sequence in which to locate a value. + The object to locate in the sequence + An equality comparer to compare values. + The zero-based index of the first occurrence of value within the entire sequence, if found; otherwise, –1. + + + + Gets the type of the typed collection's items. + + The type. + The type of the typed collection's items. + + + + Gets the member's underlying type. + + The member. + The underlying type of the member. + + + + Determines whether the member is an indexed property. + + The member. + + true if the member is an indexed property; otherwise, false. + + + + + Determines whether the property is an indexed property. + + The property. + + true if the property is an indexed property; otherwise, false. + + + + + Gets the member's value on the object. + + The member. + The target object. + The member's value on the object. + + + + Sets the member's value on the target object. + + The member. + The target. + The value. + + + + Determines whether the specified MemberInfo can be read. + + The MemberInfo to determine whether can be read. + /// if set to true then allow the member to be gotten non-publicly. + + true if the specified MemberInfo can be read; otherwise, false. + + + + + Determines whether the specified MemberInfo can be set. + + The MemberInfo to determine whether can be set. + if set to true then allow the member to be set non-publicly. + if set to true then allow the member to be set if read-only. + + true if the specified MemberInfo can be set; otherwise, false. + + + + + Determines whether the string is all white space. Empty string will return false. + + The string to test whether it is all white space. + + true if the string is all white space; otherwise, false. + + + + + Nulls an empty string. + + The string. + Null if the string was null, otherwise the string unchanged. + + + + Specifies the state of the . + + + + + An exception has been thrown, which has left the in an invalid state. + You may call the method to put the in the Closed state. + Any other method calls results in an being thrown. + + + + + The method has been called. + + + + + An object is being written. + + + + + A array is being written. + + + + + A constructor is being written. + + + + + A property is being written. + + + + + A write method has not been called. + + + + diff --git a/Website/LOC.Core/bin/Release/StructureMap.dll b/Website/LOC.Core/bin/Release/StructureMap.dll new file mode 100644 index 000000000..28a17b021 Binary files /dev/null and b/Website/LOC.Core/bin/Release/StructureMap.dll differ diff --git a/Website/LOC.Core/bin/Release/StructureMap.pdb b/Website/LOC.Core/bin/Release/StructureMap.pdb new file mode 100644 index 000000000..6c4dd1f78 Binary files /dev/null and b/Website/LOC.Core/bin/Release/StructureMap.pdb differ diff --git a/Website/LOC.Core/bin/Release/StructureMap.xml b/Website/LOC.Core/bin/Release/StructureMap.xml new file mode 100644 index 000000000..6376709c4 --- /dev/null +++ b/Website/LOC.Core/bin/Release/StructureMap.xml @@ -0,0 +1,3931 @@ + + + + StructureMap + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Get the object of type T that is valid for this build session. + + + + + + + Get the object of type T that is valid for this build session by name. + + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Register a default object for the given PluginType that will + be used throughout the rest of the current object request + + + + + + + Same as GetInstance, but can gracefully return null if + the Type does not already exist + + + + + + + Same as GetInstance(name), but can gracefully return null if + the Type and name does not already exist + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Gets all objects in the current object graph that can be cast + to T that have already been created + + + + + + + Creates/Resolves every configured instance of PlutinType T + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Gets a reference to the BuildStack for this build session + + + + + The concrete type of the immediate parent object in the object graph + + + + + Gets the root "frame" of the object request + + + + + The requested instance name of the object graph + + + + + Expression Builder that has grammars for defining policies at the + PluginType level. This expression is used for registering + open generic types + + + + + Convenience method that sets the default concrete type of the PluginType. The "concreteType" + can only accept types that do not have any primitive constructor arguments. + StructureMap has to know how to construct all of the constructor argument types. + + + + + + + Use this configured Instance as is + + + + + + Shorter way to call TheDefaultIsConcreteType + + + + + + + Shortcut to add a value by type + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Configure this type as the supplied value + + + + + + Sets the object creation of the instances of the PluginType. For example: PerRequest, + Singleton, ThreadLocal, HttpContext, or Hybrid + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Registers an IBuildInterceptor for this Plugin Type that executes before + any object of this PluginType is created. IBuildInterceptor's can be + used to create a custom scope + + + + + + + Convenience method to mark a PluginFamily as a Singleton + + + + + + Convenience method to mark a PluginFamily as a Hybrid lifecycle + + + + + + Convenience method to mark a PluginFamily as HttpContext scoped + + + + + + + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. You can also chain other declarations after + this method to add constructor and setter arguments + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type by a specified name. You can also chain other declarations after + this method to add constructor and setter arguments + + + + + + + + Specify the value of this explicit argument + + + + + + + Pass in additional arguments by type T + + + + + + + + Pass in additional arguments by type + + + + + + + + Pass in additional arguments by name + + + + + + + Gets the default instance of type T using the explicitly configured arguments from the "args" + + + + + + + Gets a named instance of type T using the explicitly configured arguments from teh "args" + + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + Gets all configured instances of type T using explicitly configured arguments + + + + + + + Returns the System.Reflection.ConstructorInfo for the PluggedType. Uses either + the "greediest" constructor with the most arguments or the constructor function + marked with the [DefaultConstructor] + + + + + + The InstanceKey of the default instance of the PluginFamily + + + + + The CLR Type that defines the "Plugin" interface for the PluginFamily + + + + + Add an Assembly to the scanning operation + + + + + + Add an Assembly by name to the scanning operation + + + + + + Add the currently executing Assembly to the scanning operation + + + + + Add the Assembly that contains type T to the scanning operation + + + + + + Add the Assembly that contains type to the scanning operation + + + + + + Sweep the designated path and add any Assembly's found in this folder to the + scanning operation + + + + + + Sweep the designated path and add any Assembly's found in this folder to the + scanning operation. The assemblyFilter can be used to filter or limit the + Assembly's that are picked up. + + + + + + + Sweep the application base directory of current app domain and add any Assembly's + found to the scanning operation. + + + + + Sweep the application base directory of current app domain and add any Assembly's + found to the scanning operation. The assemblyFilter can be used to filter or limit the + Assembly's that are picked up. + + + + + Adds an ITypeScanner object to the scanning operation + + + + + + Creates and adds a new ITypeScanner of type T to this scanning operation + + + + + + Directs the scanning operation to automatically detect and include any Registry + classes found in the Assembly's being scanned + + + + + Add all concrete types of the Plugin Type as Instances of Plugin Type + + + + + + Add all concrete types of the Plugin Type as Instances of Plugin Type + + + + + + Makes this scanning operation ignore all [PluginFamily] and [Pluggable] attributes + + + + + Exclude types that match the Predicate from being scanned + + + + + + Exclude all types in this nameSpace or its children from the scanning operation + + + + + + Exclude all types in this nameSpace or its children from the scanning operation + + + + + + Only include types matching the Predicate in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Only include types from this nameSpace or its children in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Only include types from this nameSpace or its children in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Exclude this specific type from the scanning operation + + + + + + Adds a registration convention to be applied to all the types in this + logical "scan" operation + + + + + + Adds a registration convention to be applied to all the types in this + logical "scan" operation + + + + + Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete + class named "Something" that implements "ISomething" will be automatically + added to PluginType "ISomething" + + + + + Scans for PluginType's and Concrete Types that close the given open generic type + + + + + + + + + Automatically registers all concrete types without primitive arguments + against its first interface, if any + + + + + Directs the scanning to automatically register any type that is the single + implementation of an interface against that interface. + The filters apply + + + + + Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete + class named "Something" that implements "ISomething" will be automatically + added to PluginType "ISomething" + + + + + Scans for PluginType's and Concrete Types that close the given open generic type + + + + + + + + + Automatically registers all concrete types without primitive arguments + against its first interface, if any + + + + + Directs the scanning to automatically register any type that is the single + implementation of an interface against that interface. + The filters apply + + + + + A TypeInterceptor that is only applied if the MatchesType() + method is true for a given Type + + + + + An InstanceInterceptor can be registered on a per-Instance basis + to act on, or even replace, the object that is created before + it is passed back to the caller. This is primarily a hook + for runtime AOP scenarios. + + + + + Does this TypeInterceptor apply to the given type? + + + + + + + Specify how objects matching the Type predicate + will be intercepted + + + + + + Specify how objects matching the Type predicate + will be intercepted + + + + + + Used for auto-mocking container. When the factory is missing, we can generate a mock for it + + + + + An Instance class that builds objects by calling a constructor function on a concrete type + and filling setter properties. ConfiguredInstance should only be used for open generic types. + Favor SmartInstance{T} for all other usages. + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE + + + + + + + Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE + + + + + + + Inline definition of a constructor or a setter property dependency + + + + + + + Starts the definition of a child instance specifying the argument name + in the case of a constructor function that consumes more than one argument + of type T + + + + + + + + Inline definition of a constructor dependency + + + + + + + + Inline definition of a setter dependency + + + + + + + + Start the definition of a primitive argument to a constructor argument + + + + + + + Configure a primitive constructor argument + + + + + + + Configures an array of Instance's for the array dependency + + + + + + + Part of the Fluent Interface, represents a nonprimitive argument to a + constructure function + + + + + Use a previously configured and named instance for the child + + + + + + + Start the definition of a child instance by defining the concrete type + + + + + + + Start the definition of a child instance by defining the concrete type + + + + + + + Registers a configured instance to use as the argument to the parent's + constructor + + + + + + + Directs StructureMap to fill this dependency with the Default Instance of the + constructor or property type + + + + + + Base class for many of the Instance subclasses to support + method chaining in the Registry DSL for common options + + + + + + Set the name of this Instance + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + + Register an InstanceInterceptor with this Instance + + + + + + + Used to override the constructor of a class to be used by StructureMap to create + a Pluggable object + + + + + Examines a System.Type object and determines the ConstructorInfo to use in creating + instances of the Type + + + + + + + Used to implicitly mark a class as a Plugin candidate for StructureMap + + + + + Determines whether a Type object is marked as Pluggable + + + + + + + The ConcreteKey alias of the Type + + + + + Declares a class, abstract class, or interface to be the target of a PluginFamily in the container + + + + + Determines if a Type object is marked as a PluginFamily + + + + + + + If set, determines the shared "scope" of the instance -- PerRequest, Singleton, ThreadLocal, + HttpContext, etc. + + + + + InstanceKey of the default instance. Used to implicitly define the default without + declaring the instance in StructureMap.config + + + + + Declares the target to be built by StructureMap as a Singleton. One object instance will + be created for each named instance + + + + + Marks a Property in a Pluggable class as filled by setter injection + + + + + Marks a method with no parameters as a method that validates an instance. StructureMap + uses this method to validate the configuration file. If the method does not throw an + exception, the object is assumed to be valid. + + + + + Returns an array of any MethodInfo's on a Type that are marked as ValidationMethod + + CLR Type to search for validation methods + + + + + Constants for the names of Xml nodes and attributes in the StructureMap.config + file + + + + + The name of the default configuration file. The value is always StructurMap.config + + + + + Returns the absolute path to the StructureMap.config file + + + + + + Expression Builder that has grammars for defining policies at the + PluginType level + + + + + Add multiple Instance's to this PluginType + + + + + + + Conditional binding of instances + + + + + + + Access to all of the uncommon Instance types + + + + + + + Access to all of the uncommon Instance types + + + + + + + Convenience method that sets the default concrete type of the PluginType. Type T + can only accept types that do not have any primitive constructor arguments. + StructureMap has to know how to construct all of the constructor argument types. + + + + + + + + Shorthand to say TheDefault.Is.ConstructedBy(func) + + + + + + + Shorthand to say TheDefault.Is.ConstructedBy(func) + + + + + + + Shorthand to say TheDefault.IsThis(@object) + + + + + + + Sets the object creation of the instances of the PluginType. For example: PerRequest, + Singleton, ThreadLocal, HttpContext, or Hybrid + + + + + + + Convenience method to mark a PluginFamily as a Singleton + + + + + + Convenience method to mark a PluginFamily as a Transient + + + + + + Convenience method to mark a PluginFamily as a Hybrid lifecycle + + + + + + Convenience method to mark a PluginFamily as HttpContext scoped + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Adds an Interceptor to only this PluginType + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Registers an ILifecycle for this Plugin Type that executes before + any object of this PluginType is created. ILifecycle's can be + used to create a custom scope + + + + + + + Largely deprecated and unnecessary with the ability to add Xml configuration files + + + + + + + Forces StructureMap to always use a unique instance to + stop the "BuildSession" caching + + + + + + Adds the object to to the PLUGINTYPE + + + + + + + Add an Instance to this type created by a Lambda + + + + + + + Define the Default Instance for this PluginType + + + + + Expression class to help define a runtime Profile + + + + + Starts the definition of the default instance for the containing Profile. This is + still valid, but Type() is recommended + + + + + + + Designate or define the Instance for a type within + this Profile + + + + + + + Use statement to define the Profile defaults for a Generic type + + + + + + + Expression Builder inside of a Profile creation for + open generic types + + + + + Use this concreteType for the Instance of this Profile for the PluginType + + + + + + + Use this concreteType for the Instance of this Profile for the PluginType + + + + + + + Use this Instance for the Profile Instance of this Plugin Type + + + + + + + Use the named Instance as the Profile Instance for this PluginType + + + + + + + Use the named Instance as the Profile Instance for this PluginType + + + + + + + For this type and profile, build the object with this Lambda + + + + + + + Expression Builder within defining a Profile + + + + + + Use a named, preconfigured instance as the default instance for this profile + + + + + + + Use a named, preconfigured instance as the default instance for this profile + + + + + + + Define the default instance of the PluginType for the containing Profile + + + + + + + For this Profile, use an Instance with this Func + + + + + + + For this Profile, use an Instance with this Func + + + + + + + For this Profile, use this object + + + + + + + Access to the uncommon types of Instance + + + + + + For this Profile, use the Concrete Type + + + + + + + For this profile, use this concrete type + + + + + + + A Registry class provides methods and grammars for configuring a Container or ObjectFactory. + Using a Registry subclass is the recommended way of configuring a StructureMap Container. + + + public class MyRegistry : Registry + { + public MyRegistry() + { + ForRequestedType(typeof(IService)).TheDefaultIsConcreteType(typeof(Service)); + } + } + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Imports the configuration from another registry into this registry. + + + + + + Imports the configuration from another registry into this registry. + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + This method is a shortcut for specifying the default constructor and + setter arguments for a ConcreteType. ForConcreteType is shorthand for: + ForRequestedType[T]().Use[T].************** + when the PluginType and ConcreteType are the same Type + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Convenience method. Equivalent of ForRequestedType[PluginType]().AsSingletons() + + + + + + + Uses the configuration expressions of this Registry to create a PluginGraph + object that could be used to initialize a Container. This method is + mostly for internal usage, but might be helpful for diagnostics + + + + + + Adds an additional, non-Default Instance to the PluginType T. + + + + + + + Adds an additional, non-Default Instance to the designated pluginType + This method is mostly meant for open generic types + + + + + + + Expression Builder to define the defaults for a named Profile. Each call + to CreateProfile is additive. + + + + + + + An alternative way to use CreateProfile that uses ProfileExpression + as a Nested Closure. This usage will result in cleaner code for + multiple declarations + + + + + + + Registers a new TypeInterceptor object with the Container + + + + + + Allows you to define a TypeInterceptor inline with Lambdas or anonymous delegates + + + + + IfTypeMatches( ... ).InterceptWith( o => new ObjectWrapper(o) ); + + + + + Designates a policy for scanning assemblies to auto + register types + + + + + + Directs StructureMap to always inject dependencies into any and all public Setter properties + of the type PLUGINTYPE. + + + + + + + Creates automatic "policies" for which public setters are considered mandatory + properties by StructureMap that will be "setter injected" as part of the + construction process. + + + + + + Use to programmatically select the constructor function of a concrete + class. Applies globally to all Containers in a single AppDomain. + + + + + + + All requests For the "TO" types will be filled by fetching the "FROM" + type and casting it to "TO" + GetInstance(typeof(TO)) basically becomes (TO)GetInstance(typeof(FROM)) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( @object ) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( instance ) + + + + + + + + Shorthand for ForRequestedType(pluginType) + + + + + + + + Advanced Usage Only! Skips the Registry and goes right to the inner + Semantic Model of StructureMap. Use with care + + + + + + Adds the concreteType as an Instance of the pluginType. Mostly useful + for conventions + + + + + + + Adds the concreteType as an Instance of the pluginType with a name. Mostly + useful for conventions + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType. + Mostly useful for conventions + + + + + + Imports the configuration from another registry into this registry. + + + + + + Imports the configuration from another registry into this registry. + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + This method is a shortcut for specifying the default constructor and + setter arguments for a ConcreteType. ForConcreteType is shorthand for: + For[T]().Use[T].************** + when the PluginType and ConcreteType are the same Type + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Convenience method. Equivalent of ForRequestedType[PluginType]().Singletons() + + + + + + + Uses the configuration expressions of this Registry to create a PluginGraph + object that could be used to initialize a Container. This method is + mostly for internal usage, but might be helpful for diagnostics + + + + + + Adds an additional, non-Default Instance to the PluginType T. + + + + + + + Adds an additional, non-Default Instance to the designated pluginType + This method is mostly meant for open generic types + + + + + + + Expression Builder to define the defaults for a named Profile. Each call + to CreateProfile is additive. + + + + + + + An alternative way to use CreateProfile that uses ProfileExpression + as a Nested Closure. This usage will result in cleaner code for + multiple declarations + + + + + + + Registers a new TypeInterceptor object with the Container + + + + + + Allows you to define a TypeInterceptor inline with Lambdas or anonymous delegates + + + + + IfTypeMatches( ... ).InterceptWith( o => new ObjectWrapper(o) ); + + + + + Designates a policy for scanning assemblies to auto + register types + + + + + + Directs StructureMap to always inject dependencies into any and all public Setter properties + of the type PLUGINTYPE. + + + + + + + Creates automatic "policies" for which public setters are considered mandatory + properties by StructureMap that will be "setter injected" as part of the + construction process. + + + + + + Use to programmatically select the constructor function of a concrete + class. Applies globally to all Containers in a single AppDomain. + + + + + + + All requests For the "TO" types will be filled by fetching the "FROM" + type and casting it to "TO" + GetInstance(typeof(TO)) basically becomes (TO)GetInstance(typeof(FROM)) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( @object ) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( instance ) + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + + Advanced Usage Only! Skips the Registry and goes right to the inner + Semantic Model of StructureMap. Use with care + + + + + + Define the constructor and setter arguments for the default T + + + + + + Thrown by IProperty classes when an invalid value is applied to + a property of an InstanceGraph + + + + + Main exception for StructureMap. Use the ErrorCode to aid in troubleshooting + StructureMap problems + + + + + Represents a concrete class that can be built by StructureMap as an instance of the parent + PluginFamily’s PluginType. The properties of a Plugin are the CLR Type of the concrete class, + and the human-friendly concrete key that StructureMap will use to identify the Type. + + + + + The ConcreteKey that identifies the Plugin within a PluginFamily + + + + + The concrete CLR Type represented by the Plugin + + + + + Property's that will be filled by setter injection + + + + + Conceptually speaking, a PluginFamily object represents a point of abstraction or variability in + the system. A PluginFamily defines a CLR Type that StructureMap can build, and all of the possible + Plugin’s implementing the CLR Type. + + + + + The CLR Type that defines the "Plugin" interface for the PluginFamily + + + + + The InstanceKey of the default instance of the PluginFamily + + + + + Custom collection class for PluginFamily's + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Models the runtime configuration of a StructureMap Container + + + + + Closes the PluginGraph for adding or removing members. Runs all the AssemblyScanner's + and attempts to attach concrete types to the proper plugin types. Calculates the Profile defaults. + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Adds an AssemblyScanner to the PluginGraph. Used for Testing. + + + + + + Add configuration to a PluginGraph with the Registry DSL + + + + + + Designates whether a PluginGraph has been "Sealed." + + + + + Represents a PropertyInfo of a Plugin.PluggedType that is filled by Setter Injection + + + + + Custom collection class for SetterProperty objects + + + + + Designates a CLR type that is loaded by name. + + + + + Interface for a "Factory" pattern class that creates object instances of the PluginType + + + + + The main "container" object that implements the Service Locator pattern + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates or finds the named instance of T + + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Gets all configured instances of type T using explicitly configured arguments from the "args" + + + + + + + + Gets the default instance of type T using the explicitly configured arguments from the "args" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + Gets the named instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + + Starts a "Nested" Container for atomic, isolated access + + + + + + Starts a new "Nested" Container for atomic, isolated service location. Opens + + + + + + + Provides queryable access to the configured PluginType's and Instances of this Container + + + + + The name of the container. By default this is set to + a random Guid. This is a convience property to + assist with debugging. Feel free to set to anything, + as this is not used in any logic. + + + + + Default implementation of IInstanceFactory + + + + + Constructor to use when troubleshooting possible configuration issues. + + + + + + Constructor to create an Container + + PluginGraph containing the instance and type definitions + for the Container + + + + Creates or finds the named instance of T + + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + Gets all configured instances of type T using explicitly configured arguments from the "args" + + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + + Starts a "Nested" Container for atomic, isolated access + + + + + + Starts a new "Nested" Container for atomic, isolated service location. Opens + + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Sets the default instance for the PluginType + + + + + + + Provides queryable access to the configured PluginType's and Instances of this Container + + + + + The name of the container. By default this is set to + a random Guid. This is a convience property to + assist with debugging. Feel free to set to anything, + as this is not used in any logic. + + + + + GoF Memento representing an Object Instance + + + + + Retrieves the named property value as a string + + + + + + + Template method for implementation specific retrieval of the named property + + + + + + + Returns the named child InstanceMemento + + + + + + + Template method for implementation specific retrieval of the named property + + + + + + + This method is made public for testing. It is not necessary for normal usage. + + + + + + Used to create a templated InstanceMemento + + + + + + + The named type of the object instance represented by the InstanceMemento. Translates to a concrete + type + + + + + The named key of the object instance represented by the InstanceMemento + + + + + Gets the referred template name + + + + + + Template pattern property specifying whether the InstanceMemento is simply a reference + to another named instance. Useful for child objects. + + + + + Template pattern property specifying the instance key that the InstanceMemento refers to + + + + + Is the InstanceMemento a reference to the default instance of the plugin type? + + + + + A TypeInterceptor that always applies to all Instances of a given Plugin Type + + + + + Abstract class that is the supertype of all storage and retrieval mechanisms of + InstanceMemento instances + + + + + Retrieves the named InstanceMemento + + The instanceKey of the requested InstanceMemento + + + + + Retrieves an array of all InstanceMemento's stored by this MementoSource + + + + + + Template pattern method. Determines if the MementoSource contains a definition for the + requested instanceKey. + + + + + + + Template pattern method. Retrieves an InstanceMemento for the instanceKey + + + + + + + The type of MementoSource + + + + + String description of the MementoSource. Used in the StructureMap-Client UI. + + + + + An in-memory implementation of InstanceMemento. + + + + + Creates an instance of MemoryInstanceMemento that represents a reference to another + instance. + + The referenced instance key to another instance + + + + + Creates a MemoryInstanceMemento that represents a reference to the default instance + of a plugin type. + + + + + + Constructs a MemoryInstanceMemento without properties + + The concrete key of the plugin type + The identifying instance key + + + + Constructs a MemoryInstanceMemento with properties + + The concrete key of the plugin type + The identifying instance key + NameValueCollection of instance properties + + + + Sets the value of the named property + + + + + + + Deletes a named property from the DefaultInstanceMemento + + + + + + Links a child InstanceMemento as a named property + + + + + + + Links an array of InstanceMemento's to a named array property + + + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + The main static Facade for the StructureMap container + + + + + Restarts ObjectFactory and blows away all Singleton's and cached instances. Use with caution. + + + + + Remove and dispose all objects scoped by HttpContext. Call this method at the *end* of an Http request to clean up resources + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the named instance of T + + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Provides queryable access to the configured PluginType's and Instances of the inner Container + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + Reads configuration XML documents and builds the structures necessary to initialize + the Container/IInstanceFactory/InstanceBuilder/ObjectInstanceActivator objects + + + + + Reads the configuration information and returns the PluginGraph definition of + plugin families and plugin's + + + + + + Generic implementation of an XmlMementoSource + + + + + Base class for all MementoSource classes that store InstanceMemento's as + node-normalized Xml + + + + + Implementation of MementoSource that stores and retrieves an XmlInstanceMemento per file in a named directory. + DirectoryXmlMementoSource is meant to simplify complicated object graph configurations by isolating each instance to a separate + editable file. + + + + + Stores an Xml InstanceMemento per file in a directory + + A ";" delimited list of directories to look for mementos. DirectoryXmlMementoSource + will use the FIRST directory it finds + The file extension of the InstanceMemento files without a dot. Typically "xml" + NodeNormalized or AttributeNormalized + + + + Implementation of MementoSource that stores and retrieves an XmlInstanceMemento per Embedded Resource file + in a named namespace. EmbeddedFolderXmlMementoSource is meant to simplify complicated object graph configurations + by isolating each instance to a separate + editable file. + + NodeNormalized or AttributeNormalized + The name of the Assembly with the embedded resources + The root namespace of all of the mementos. + The file extension of the memento files - "xml" + + + + An in-memory MementoSource + + + + + Retrieves Xml InstanceMemento's from an xml file stored as an embedded resource in an assembly. + + Designates the nodes that are memento nodes + NodeNormalized or AttributeNormalized + The name of the Assembly the file is embedded into + The path to the embedded resource within the file + + + + Default Constructor + + MementoSource that contains the Memento Templates + MementoSource that contains instances consisting of Template valuee + + + + Stores Attribute-normalized InstanceMemento's in an external file + + + + + Implementation of XmlMementoSource that reads InstanceMemento's from an external file. + Useful to break the StructureMap.config file into smaller pieces. + + + + + Default constructor + + Path to the xml file that contains the instance configuration + XPath expression to the parent node that contains the InstanceMemento nodes. + If empty, it defaults to the top node + The name of the nodes that are InstanceMemento nodes. Useful to store + different types of instances in the same file + + + + An implementation of InstanceMemento that stores properties as Xml attributes + Limited functionality + + + + + Implementation of InstanceMemento that stores information in a node-normalized + Xml format. + + + + + specify what type you'd like the service returned as + + + + + + + Specify the open generic type that should have a single generic parameter + + + + + + + Used as the argument in the Container.Configure() method to describe + configuration directives and specify the sources of configuration for + a Container + + + + + Creates and adds a Registry object of type T. + + The Registry Type + + + + Imports all the configuration from a Registry object + + + + + + Imports configuration from an Xml file. The fileName + must point to an Xml file with valid StructureMap + configuration + + + + + + Imports configuration directly from an XmlNode. This + method was intended for scenarios like Xml being embedded + into an assembly. The node must be a 'StructureMap' node + + + + + + If true, directs StructureMap to look for configuration in the App.config. + The default value is false. + + + + + Expression Builder to define an Instance + + + + + + Register a previously built Instance. This provides a "catch all" + method to attach custom Instance objects. Synonym for Instance() + + + + + + Inject this object directly. Synonym to Object() + + + + + + + Gives you full access to all the different ways to specify an "Instance" + + + + + An Expression Builder to define Instances of a PluginType. + This is mostly used for configuring open generic types + + + + + Shortcut to register a Concrete Type as an instance. This method supports + method chaining to allow you to add constructor and setter arguments for + the concrete type + + + + + + + Shortcut to simply use the Instance with the given name + + + + + + + An Expression Builder that is used throughout the Registry DSL to + add and define Instances + + + + + + Register a previously built Instance. This provides a "catch all" + method to attach custom Instance objects. Synonym for IsThis() + + + + + + Inject this object directly. Synonym to IsThis() + + + + + + + Build the Instance with the constructor function and setter arguments. Starts + the definition of a SmartInstance + + + + + + + Build the Instance with the constructor function and setter arguments. Starts + the definition of a SmartInstance + + + + + + + Build the Instance with the constructor function and setter arguments. Use this + method for open generic types, and favor the generic version of OfConcreteType + for all other types + + + + + + + Build the Instance with the constructor function and setter arguments. Use this + method for open generic types, and favor the generic version of OfConcreteType + for all other types + + + + + + + Create an Instance that builds an object by calling a Lambda or + an anonymous delegate with no arguments + + + + + + + Create an Instance that builds an object by calling a Lambda or + an anonymous delegate with the IContext representing + the current object graph. + + + + + + + Use the Instance of this PluginType with the specified name. This is + generally only used while configuring child dependencies within a deep + object graph + + + + + + + Use the default Instance of this PluginType. This is + generally only used while configuring child dependencies within a deep + object graph + + + + + + Creates an Instance that stores this object of type T, + and returns a cloned copy of the template. + + + + + + + Caches template as a serialized byte stream. Uses deserialization + to create copies when the Instance is built. + + + + + + + Creates an Instance that will load an ASCX user control from the url + + + + + + + Creates an Instance according to conditional rules + + + + + + + Used as an expression builder to specify setter injection policies + + + + + Directs StructureMap to treat all public setters of type T as + mandatory properties + + + + + + Directs StructureMap to tread all public setters with + a PropertyType that matches the predicate as a + mandatory setter + + + + + + Directs StructureMap to treat all public setters that match the + rule as mandatory properties + + + + + + Directs StructureMap to treat all public setters with a property + type in the specified namespace as mandatory properties + + + + + + Directs StructureMap to treat all public setters with a property + type in the specified namespace as mandatory properties + + + + + + Directs StructureMap to treat all public setters where to property name + matches the specified rule as a mandatory property + + + + + + Base class for creating an object instance from an InstanceMemento. SubClasses are + emitted for each concrete Plugin with constructor parameters. + + + + + Allows built-in registration conventions to be configurable through the assembly scanning DSL + + + Intended for StructureMap internal use only. + Custom registration convention instances can be directly configured + before being passed to IAssemblyScanner.With(IRegistrationConvention). + + + + + Simply query to see if there are any implementations registered + + + + + + Ejects any instances of this instance from the current container + and permanently removes the instance from the container configuration + + + + + + Eject all instances of this PluginType from the current container, + but leaves the lifecycle behavior + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Models the state of a Container or ObjectFactory. Can be used to query for the + existence of types registered with StructureMap + + + + + Can StructureMap fulfill a request to ObjectFactory.GetInstance(pluginType) from the + current configuration. This does not include concrete classes that could be auto-configured + upon demand + + + + + + + Can StructureMap fulfill a request to ObjectFactory.GetInstance<T>() from the + current configuration. This does not include concrete classes that could be auto-configured + upon demand + + + + + + + Queryable access to all of the InstanceRef for a given PluginType + + + + + + + Queryable access to all of the InstanceRef for a given PluginType + + + + + + Does the current container have existing configuration for the "pluginType" + + + + + + + Does the current container have existing configuration for the type T + + + + + + Find the concrete type for the default Instance of T. + In other words, when I call Container.GetInstance(Type), + what do I get? May be indeterminate + + + + + + + Find the concrete type for the default Instance of pluginType. + In other words, when I call Container.GetInstance(Type), + what do I get? May be indeterminate + + + + + + Retrieves the configuration for the given type + + + + + + + Retrieves the configuration for the given type + + + + + + + Eject all objects, configuration, and Plugin Types matching this filter + + + + + + Eject all objects and configuration for any Plugin Type that matches this filter + + + + + + Eject all objects and Instance configuration for this PluginType + + + + + + Get each and every configured instance that could possibly + be cast to T + + + + + + + Access to all the Plugin Type registrations + + + + + Makes sure that every request for this object returns a unique object + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + The actual concrete type of this Instance. Not every type of IInstance + can determine the ConcreteType + + + + + Ejects and removes all objects and the configuration for the named instance from the + container + + + + + + + Ejects and removes all objects and configuration for the instances that match the filter + + + + + + + Determines if the pluggedType can be upcast to the pluginType + + + + + + + + Determines if the PluggedType is a valid Plugin into the + PluginType + + + + + + + + Imports configuration from an Xml file. The fileName + must point to an Xml file with valid StructureMap + configuration + + + + + + Imports configuration directly from an XmlNode. This + method was intended for scenarios like Xml being embedded + into an assembly. The node must be a 'StructureMap' node + + + + + + Creates and adds a Registry object of type T. + + The Registry Type + + + + Imports all the configuration from a Registry object + + + + + + If true, makes the existence of the StructureMap.config mandatory. + The default is false. + + + + + If true, the StructureMap.config file will be ignored even if it exists. + The default is false. + + + + + If true, directs StructureMap to look for configuration in the App.config. + The default value is false. + + + + + Designate the Default Profile. This will be applied as soon as the + Container is initialized. + + + + + Retrieves the configuration for the given type + + + + + + + Retrieves the configuration for the given type + + + + + + + Eject all objects, configuration, and Plugin Types matching this filter + + + + + + Eject all objects and configuration for any Plugin Type that matches this filter + + + + + + Eject all objects and Instance configuration for this PluginType + + + + + + Get each and every configured instance that could possibly + be cast to T + + + + + + + The requested PluginType of the Instance being create + + + + + The Name of the Instance being created + + + + + The actual ConcreteType being created. This will not always + be available + + + + + Models the current place in an object graph during the construction of + an instance. Provides contextual information that can be used + to alter the desired construction of child objects + + + + + The requested PluginType of the Instance being create + + + + + The Name of the Instance being created + + + + + The actual ConcreteType being created. This will not always + be available + + + + + Provides metadata about the object graph being constructed. More or less a stack trace of the GetInstance() pipeline + that can be used for "contextual" object construction + + + + + The top level of the object graph. Describes the original requested instance + + + + + The current BuildFrame + + + + + The immediate parent BuildFrame + + + + + Defines the value of a primitive argument to a constructur argument + + + + + Sets the value of the constructor argument + + + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings + + The key in appSettings for the value to use. + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings when it exists. Otherwise uses the provided default value. + + The key in appSettings for the value to use. + The value to use if an entry for does not exist in the appSettings section. + + + + + Instance that builds objects with by calling constructor functions and using setter properties + + The concrete type constructed by SmartInstance + + + + Sets the name of this Instance + + + + + + + Sets the name of this Instance + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register an InstanceInterceptor with this Instance + + + + + + + Define a primitive constructor argument + + + + + + + Set simple setter properties + + + + + + + Define a primitive setter property by specifying the property name with + an expression + + + + + + + Define a primitive setter property by specifying the property name + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type. Do not + use this method if there is more than one constructor arguments of the same type + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type. Do not + use this method if there is more than one constructor arguments of the same type + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type and constructor name. + Use this method if there is more than one constructor arguments of the same type + + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type and constructor name. + Use this method if there is more than one constructor arguments of the same type + + + + + + + + Inline definition of a setter dependency. The property name is specified with an Expression + + + + + + + + Inline definition of a setter dependency. The property name is specified with an Expression + + + + + + + + Inline definition of a setter dependency. Only use this method if there + is only a single property of the SETTERTYPE + + + + + + + Inline definition of a setter dependency. Only use this method if there + is only a single property of the SETTERTYPE + + + + + + + Inline definition of a dependency on an Array of the CHILD type. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + Inline definition of a dependency on an Array of the CHILD type and the specified setter property or constructor argument name. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + + Inline definition of a dependency on an Array of the CHILD type. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + Inline definition of a dependency on an Array of the CHILD type and the specified setter property or constructor argument name. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + + Expression Builder to help define multiple Instances for an Array dependency + + + + + + Nested Closure that allows you to add an unlimited number of child Instances + + + + + + + Specify an array of Instance objects directly for an Array dependency + + + + + + + Expression Builder that helps to define child dependencies inline + + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings + + The key in appSettings for the value to use. + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings when it exists. Otherwise uses the provided default value. + + The key in appSettings for the value to use. + The value to use if an entry for does not exist in the appSettings section. + + + + + Nested Closure to define a child dependency inline + + + + + + + Shortcut to set an inline dependency to an Instance + + + + + + + Shortcut to set an inline dependency to a designated object + + + + + + + Shortcut to set an inline dependency to a designated object + + + + + + + Set an Inline dependency to the Default Instance of the Property type + Used mostly to force an optional Setter property to be filled by + StructureMap + + + + + + Shortcut method to define a child dependency inline + + + + + + + Shortcut method to define a child dependency inline and configure + the child dependency + + + + + + + Provides virtual methods that can be used by subclasses to parse an expression tree. + + + This class actually already exists in the System.Core assembly...as an internal class. + I can only speculate as to why it is internal, but it is obviously much too dangerous + for anyone outside of Microsoft to be using... + + + + diff --git a/Website/LOC.Core/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Website/LOC.Core/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 000000000..9bb88f49e Binary files /dev/null and b/Website/LOC.Core/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Website/LOC.Core/obj/Debug/LOC.Core.csproj.FileListAbsolute.txt b/Website/LOC.Core/obj/Debug/LOC.Core.csproj.FileListAbsolute.txt new file mode 100644 index 000000000..762d9d877 --- /dev/null +++ b/Website/LOC.Core/obj/Debug/LOC.Core.csproj.FileListAbsolute.txt @@ -0,0 +1,14 @@ +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Debug\LOC.Core.dll.config +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Debug\LOC.Core.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Debug\LOC.Core.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Debug\EntityFramework.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Debug\LinqKit.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Debug\Newtonsoft.Json.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Debug\StructureMap.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Debug\EntityFramework.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Debug\Newtonsoft.Json.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Debug\StructureMap.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Debug\StructureMap.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Core\obj\Debug\LOC.Core.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Core\obj\Debug\LOC.Core.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Core\obj\Debug\LOC.Core.csprojResolveAssemblyReference.cache diff --git a/Website/LOC.Core/obj/Debug/LOC.Core.csprojResolveAssemblyReference.cache b/Website/LOC.Core/obj/Debug/LOC.Core.csprojResolveAssemblyReference.cache new file mode 100644 index 000000000..0e99751fb Binary files /dev/null and b/Website/LOC.Core/obj/Debug/LOC.Core.csprojResolveAssemblyReference.cache differ diff --git a/Website/LOC.Core/obj/Debug/LOC.Core.dll b/Website/LOC.Core/obj/Debug/LOC.Core.dll new file mode 100644 index 000000000..84a13849c Binary files /dev/null and b/Website/LOC.Core/obj/Debug/LOC.Core.dll differ diff --git a/Website/LOC.Core/obj/Debug/LOC.Core.pdb b/Website/LOC.Core/obj/Debug/LOC.Core.pdb new file mode 100644 index 000000000..b5418e84e Binary files /dev/null and b/Website/LOC.Core/obj/Debug/LOC.Core.pdb differ diff --git a/Website/LOC.Core/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache b/Website/LOC.Core/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 000000000..ca3ba8cbe Binary files /dev/null and b/Website/LOC.Core/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Website/LOC.Core/obj/Release/LOC.Core.csproj.FileListAbsolute.txt b/Website/LOC.Core/obj/Release/LOC.Core.csproj.FileListAbsolute.txt new file mode 100644 index 000000000..7a7d17029 --- /dev/null +++ b/Website/LOC.Core/obj/Release/LOC.Core.csproj.FileListAbsolute.txt @@ -0,0 +1,13 @@ +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Release\LOC.Core.dll.config +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Release\LOC.Core.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Release\LOC.Core.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Release\EntityFramework.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Release\LinqKit.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Release\Newtonsoft.Json.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Release\StructureMap.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Release\EntityFramework.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Release\Newtonsoft.Json.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Release\StructureMap.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Core\bin\Release\StructureMap.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Core\obj\Release\LOC.Core.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Core\obj\Release\LOC.Core.pdb diff --git a/Website/LOC.Core/obj/Release/LOC.Core.dll b/Website/LOC.Core/obj/Release/LOC.Core.dll new file mode 100644 index 000000000..565e87c2b Binary files /dev/null and b/Website/LOC.Core/obj/Release/LOC.Core.dll differ diff --git a/Website/LOC.Core/obj/Release/LOC.Core.pdb b/Website/LOC.Core/obj/Release/LOC.Core.pdb new file mode 100644 index 000000000..441328fb2 Binary files /dev/null and b/Website/LOC.Core/obj/Release/LOC.Core.pdb differ diff --git a/Website/LOC.Core/packages.config b/Website/LOC.Core/packages.config new file mode 100644 index 000000000..c5cb9475d --- /dev/null +++ b/Website/LOC.Core/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Website/LOC.Website.Common/App.config b/Website/LOC.Website.Common/App.config new file mode 100644 index 000000000..30a36561f --- /dev/null +++ b/Website/LOC.Website.Common/App.config @@ -0,0 +1,17 @@ + + + + +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/Website/LOC.Website.Common/CaptureThePigStatsDisplay.cs b/Website/LOC.Website.Common/CaptureThePigStatsDisplay.cs new file mode 100644 index 000000000..850ea54d6 --- /dev/null +++ b/Website/LOC.Website.Common/CaptureThePigStatsDisplay.cs @@ -0,0 +1,13 @@ +namespace LOC.Website.Common +{ + using System.Collections.Generic; + using Core.Model.Server.GameServer.CaptureThePig.Stats; + + public class CaptureThePigStatsDisplay + { + public List MostPoints { get; set; } + public List MostKills { get; set; } + public List MostAssists { get; set; } + public List MostDeaths { get; set; } + } +} diff --git a/Website/LOC.Website.Common/CodeTemplates/Scaffolders/EntityMetadata/ControllerWithEntityMetadata.ps1 b/Website/LOC.Website.Common/CodeTemplates/Scaffolders/EntityMetadata/ControllerWithEntityMetadata.ps1 new file mode 100644 index 000000000..0002babba --- /dev/null +++ b/Website/LOC.Website.Common/CodeTemplates/Scaffolders/EntityMetadata/ControllerWithEntityMetadata.ps1 @@ -0,0 +1,28 @@ +[T4Scaffolding.Scaffolder(Description = "Generates metadata classes and associated partial classes to pair with EntityFramework-generated entities.")][CmdletBinding()] +param( + [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$Edmx, + [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$Model, + [parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true)][string]$Context, + [string]$Project, + [string]$CodeLanguage, + [string[]]$TemplateFolders, + [switch]$Force = $false +) + +$modelPath = (Get-Project $Project).Properties.Item("FullPath").Value, 'Models\' -join "" +$outputPath = 'Models\Metadata\', $Model, 'Metadata' -join "" +$namespace = (Get-Project $Project).Properties.Item("DefaultNamespace").Value, '.Models' -join "" +$edmxFullPath = $modelPath, $Edmx, '.edmx' -join "" + +write-host 'Attempting to create metadata for', $Model, 'in', $Edmx , '...' + +Add-ProjectItemViaTemplate $outputPath ` + -Template EntityMetadataHelperTemplate ` + -Model @{ Namespace = $namespace; InputFileName = $edmxFullPath ; EntityName=$Model} ` + -SuccessMessage "Created metadata at {0}" ` + -TemplateFolders $TemplateFolders ` + -Project $Project ` + -CodeLanguage $CodeLanguage ` + -Force:$Force + +Scaffold Controller $Model -DbContextType $Context \ No newline at end of file diff --git a/Website/LOC.Website.Common/CodeTemplates/Scaffolders/EntityMetadata/EF.Utility.CS.ttinclude b/Website/LOC.Website.Common/CodeTemplates/Scaffolders/EntityMetadata/EF.Utility.CS.ttinclude new file mode 100644 index 000000000..6858716e6 --- /dev/null +++ b/Website/LOC.Website.Common/CodeTemplates/Scaffolders/EntityMetadata/EF.Utility.CS.ttinclude @@ -0,0 +1,2244 @@ +<#@ assembly name="System.Core" #> +<#@ assembly name="System.Data" #> +<#@ assembly name="System.Data.Entity" #> +<#@ assembly name="System.Data.Entity.Design" #> +<#@ assembly name="System.Xml" #> +<#@ assembly name="System.Xml.Linq"#> +<#@ assembly name="EnvDTE"#> +<#@ import namespace="System" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.IO" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ import namespace="System.Data.Objects" #> +<#@ import namespace="System.Data.Objects.DataClasses" #> +<#@ import namespace="System.Xml" #> +<#@ import namespace="System.Xml.Linq" #> +<#@ import namespace="System.Globalization" #> +<#@ import namespace="System.Reflection" #> +<#@ import namespace="System.Data.Metadata.Edm" #> +<#@ import namespace="System.Data.Mapping" #> +<#@ import namespace="System.Data.Entity.Design" #> +<#@ import namespace="System.CodeDom" #> +<#@ import namespace="System.CodeDom.Compiler" #> +<#@ import namespace="Microsoft.CSharp"#> +<#@ import namespace="System.Text"#> +<#+ +// Copyright (c) Microsoft Corporation. All rights reserved. + +/// +/// Responsible for helping to create source code that is +/// correctly formated and functional +/// +public class CodeGenerationTools +{ + private readonly DynamicTextTransformation _textTransformation; + private readonly CSharpCodeProvider _code; + private readonly MetadataTools _ef; + + /// + /// Initializes a new CodeGenerationTools object with the TextTransformation (T4 generated class) + /// that is currently running + /// + public CodeGenerationTools(object textTransformation) + { + if (textTransformation == null) + { + throw new ArgumentNullException("textTransformation"); + } + + _textTransformation = DynamicTextTransformation.Create(textTransformation); + _code = new CSharpCodeProvider(); + _ef = new MetadataTools(_textTransformation); + FullyQualifySystemTypes = false; + CamelCaseFields = true; + } + + /// + /// When true, all types that are not being generated + /// are fully qualified to keep them from conflicting with + /// types that are being generated. Useful when you have + /// something like a type being generated named System. + /// + /// Default is false. + /// + public bool FullyQualifySystemTypes { get; set; } + + /// + /// When true, the field names are Camel Cased, + /// otherwise they will preserve the case they + /// start with. + /// + /// Default is true. + /// + public bool CamelCaseFields { get; set; } + + /// + /// Returns the NamespaceName suggested by VS if running inside VS. Otherwise, returns + /// null. + /// + public string VsNamespaceSuggestion() + { + string suggestion = _textTransformation.Host.ResolveParameterValue("directiveId", "namespaceDirectiveProcessor", "namespaceHint"); + if (String.IsNullOrEmpty(suggestion)) + { + return null; + } + + return suggestion; + } + + /// + /// Returns a string that is safe for use as an identifier in C#. + /// Keywords are escaped. + /// + public string Escape(string name) + { + if (name == null) + { + return null; + } + + return _code.CreateEscapedIdentifier(name); + } + + /// + /// Returns the name of the TypeUsage's EdmType that is safe for + /// use as an identifier. + /// + public string Escape(TypeUsage typeUsage) + { + if (typeUsage == null) + { + return null; + } + + if (typeUsage.EdmType is ComplexType || + typeUsage.EdmType is EntityType) + { + return Escape(typeUsage.EdmType.Name); + } + else if (typeUsage.EdmType is PrimitiveType) + { + + Type clrType = _ef.ClrType(typeUsage); + string typeName = Escape(clrType); + if (clrType.IsValueType && _ef.IsNullable(typeUsage)) + { + return String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName); + } + + return typeName; + } + else if (typeUsage.EdmType is CollectionType) + { + return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", Escape(((CollectionType)typeUsage.EdmType).TypeUsage)); + } + + + throw new ArgumentException("typeUsage"); + } + + /// + /// Returns the name of the EdmMember that is safe for + /// use as an identifier. + /// + public string Escape(EdmMember member) + { + if (member == null) + { + return null; + } + + return Escape(member.Name); + } + + /// + /// Returns the name of the EdmType that is safe for + /// use as an identifier. + /// + public string Escape(EdmType type) + { + if (type == null) + { + return null; + } + + return Escape(type.Name); + } + + /// + /// Returns the name of the EdmFunction that is safe for + /// use as an identifier. + /// + public string Escape(EdmFunction function) + { + if (function == null) + { + return null; + } + + return Escape(function.Name); + } + + /// + /// Returns the name of the EntityContainer that is safe for + /// use as an identifier. + /// + public string Escape(EntityContainer container) + { + if (container == null) + { + return null; + } + + return Escape(container.Name); + } + + /// + /// Returns the name of the EntitySet that is safe for + /// use as an identifier. + /// + public string Escape(EntitySet set) + { + if (set == null) + { + return null; + } + + return Escape(set.Name); + } + + /// + /// Returns the name of the StructuralType that is safe for + /// use as an identifier. + /// + public string Escape(StructuralType type) + { + if (type == null) + { + return null; + } + + return Escape(type.Name); + } + + /// + /// Returns the NamespaceName with each segment safe to + /// use as an identifier. + /// + public string EscapeNamespace(string namespaceName) + { + if (String.IsNullOrEmpty(namespaceName)) + { + return namespaceName; + } + + string[] parts = namespaceName.Split('.'); + namespaceName = String.Empty; + foreach (string part in parts) + { + if (namespaceName != String.Empty) + { + namespaceName += "."; + } + + namespaceName += Escape(part); + } + + return namespaceName; + } + + /// + /// Returns the name of the EdmMember formatted for + /// use as a field identifier. + /// + /// This method changes behavior based on the CamelCaseFields + /// setting. + /// + public string FieldName(EdmMember member) + { + if (member == null) + { + return null; + } + + return FieldName(member.Name); + } + + /// + /// Returns the name of the EntitySet formatted for + /// use as a field identifier. + /// + /// This method changes behavior based on the CamelCaseFields + /// setting. + /// + public string FieldName(EntitySet set) + { + if (set == null) + { + return null; + } + + return FieldName(set.Name); + + } + + private string FieldName(string name) + { + if (CamelCaseFields) + { + return "_" + CamelCase(name); + } + else + { + return "_" + name; + } + } + + /// + /// Returns the name of the Type object formatted for + /// use in source code. + /// + /// This method changes behavior based on the FullyQualifySystemTypes + /// setting. + /// + public string Escape(Type clrType) + { + if(clrType == null) + { + return null; + } + + string typeName; + if (FullyQualifySystemTypes) + { + typeName = "global::" + clrType.FullName; + } + else + { + typeName = _code.GetTypeOutput(new CodeTypeReference(clrType)); + } + return typeName; + } + + + + /// + /// Returns the abstract option if the entity is Abstract, otherwise returns String.Empty + /// + public string AbstractOption(EntityType entity) + { + if (entity.Abstract) + { + return "abstract"; + } + return String.Empty; + } + + /// + /// Returns the passed in identifier with the first letter changed to lowercase + /// + public string CamelCase(string identifier) + { + if (String.IsNullOrEmpty(identifier)) + { + return identifier; + } + + if (identifier.Length == 1) + { + return identifier[0].ToString(CultureInfo.InvariantCulture).ToLowerInvariant(); + } + + return identifier[0].ToString(CultureInfo.InvariantCulture).ToLowerInvariant() + identifier.Substring(1); + } + + /// + /// If the value parameter is null or empty an empty string is returned, + /// otherwise it retuns value with a single space concatenated on the end. + /// + public string SpaceAfter(string value) + { + return StringAfter(value, " "); + } + + /// + /// If the value parameter is null or empty an empty string is returned, + /// otherwise it retuns value with a single space concatenated on the end. + /// + public string SpaceBefore(string value) + { + return StringBefore(" ", value); + } + + /// + /// If the value parameter is null or empty an empty string is returned, + /// otherwise it retuns value with append concatenated on the end. + /// + public string StringAfter(string value, string append) + { + if (String.IsNullOrEmpty(value)) + { + return String.Empty; + } + + return value + append; + } + + /// + /// If the value parameter is null or empty an empty string is returned, + /// otherwise it retuns value with prepend concatenated on the front. + /// + public string StringBefore(string prepend, string value) + { + if (String.IsNullOrEmpty(value)) + { + return String.Empty; + } + + return prepend + value; + } + + /// + /// Retuns as full of a name as possible, if a namespace is provided + /// the namespace and name are combined with a period, otherwise just + /// the name is returned. + /// + public string CreateFullName(string namespaceName, string name) + { + if (String.IsNullOrEmpty(namespaceName)) + { + return name; + } + + return namespaceName + "." + name; + } + + public string CreateLiteral(object value) + { + if (value == null) + { + return string.Empty; + } + + Type type = value.GetType(); + if (type.IsEnum) + { + return type.FullName + "." + value.ToString(); + } + if (type == typeof(Guid)) + { + return string.Format(CultureInfo.InvariantCulture, "new Guid(\"{0}\")", + ((Guid)value).ToString("D", CultureInfo.InvariantCulture)); + } + else if (type == typeof(DateTime)) + { + return string.Format(CultureInfo.InvariantCulture, "new DateTime({0}, DateTimeKind.Unspecified)", + ((DateTime)value).Ticks); + } + else if (type == typeof(byte[])) + { + var arrayInit = string.Join(", ", ((byte[])value).Select(b => b.ToString(CultureInfo.InvariantCulture)).ToArray()); + return string.Format(CultureInfo.InvariantCulture, "new Byte[] {{{0}}}", arrayInit); + } + else if (type == typeof(DateTimeOffset)) + { + var dto = (DateTimeOffset)value; + return string.Format(CultureInfo.InvariantCulture, "new DateTimeOffset({0}, new TimeSpan({1}))", + dto.Ticks, dto.Offset.Ticks); + } + + var expression = new CodePrimitiveExpression(value); + var writer = new StringWriter(); + CSharpCodeProvider code = new CSharpCodeProvider(); + code.GenerateCodeFromExpression(expression, writer, new CodeGeneratorOptions()); + return writer.ToString(); + } +} + +/// +/// Responsible for making the Entity Framework Metadata more +/// accessible for code generation. +/// +public class MetadataTools +{ + private readonly DynamicTextTransformation _textTransformation; + + /// + /// Initializes an MetadataTools Instance with the + /// TextTransformation (T4 generated class) that is currently running + /// + public MetadataTools(object textTransformation) + { + if (textTransformation == null) + { + throw new ArgumentNullException("textTransformation"); + } + + _textTransformation = DynamicTextTransformation.Create(textTransformation); + } + + /// + /// If the passed in TypeUsage has an EdmType that is a PrimitiveType, this method returns + /// the corosponding Type object, otherwise it returns the Type object for Object. + /// + public Type ClrType(TypeUsage typeUsage) + { + if (typeUsage.EdmType is PrimitiveType) + { + return ((PrimitiveType)typeUsage.EdmType).ClrEquivalentType; + } + + return typeof(object); + } + + /// + /// True if the EdmProperty is a key of its DeclaringType, False otherwise. + /// + public bool IsKey(EdmProperty property) + { + if (property != null && property.DeclaringType.BuiltInTypeKind == BuiltInTypeKind.EntityType) + { + return ((EntityType)property.DeclaringType).KeyMembers.Contains(property); + } + + return false; + } + + /// + /// True if the EdmProperty TypeUsage is Nullable, False otherwise. + /// + public bool IsNullable(EdmProperty property) + { + return property != null && IsNullable(property.TypeUsage); + } + + /// + /// True if the TypeUsage is Nullable, False otherwise. + /// + public bool IsNullable(TypeUsage typeUsage) + { + Facet nullableFacet = null; + if (typeUsage != null && + typeUsage.Facets.TryGetValue("Nullable", true, out nullableFacet)) + { + return (bool)nullableFacet.Value; + } + + return false; + } + + /// + /// If the passed in TypeUsage represents a collection this method returns final element + /// type of the collection, otherwise it returns the value passed in. + /// + public TypeUsage GetElementType(TypeUsage typeUsage) + { + if (typeUsage == null) + { + return null; + } + + if (typeUsage.EdmType is CollectionType) + { + return GetElementType(((CollectionType)typeUsage.EdmType).TypeUsage); + } + else + { + return typeUsage; + } + } + + /// + /// Returns the NavigationProperty that is the other end of the same association set if it is + /// available, otherwise it returns null. + /// + public NavigationProperty Inverse(NavigationProperty navProperty) + { + if(navProperty == null) + { + return null; + } + + EntityType toEntity = navProperty.ToEndMember.GetEntityType(); + return toEntity.NavigationProperties + .SingleOrDefault(n => Object.ReferenceEquals(n.RelationshipType, navProperty.RelationshipType) && !Object.ReferenceEquals(n, navProperty)); + } + + /// + /// Given a property on the dependent end of a referential constraint, returns the corresponding property on the principal end. + /// Requires: The association has a referential constraint, and the specified dependentProperty is one of the properties on the dependent end. + /// + public EdmProperty GetCorrespondingPrincipalProperty(NavigationProperty navProperty, EdmProperty dependentProperty) + { + if (navProperty == null) + { + throw new ArgumentNullException("navProperty"); + } + + if (dependentProperty == null) + { + throw new ArgumentNullException("dependentProperty"); + } + + ReadOnlyMetadataCollection fromProperties = GetPrincipalProperties(navProperty); + ReadOnlyMetadataCollection toProperties = GetDependentProperties(navProperty); + return fromProperties[toProperties.IndexOf(dependentProperty)]; + } + + /// + /// Given a property on the principal end of a referential constraint, returns the corresponding property on the dependent end. + /// Requires: The association has a referential constraint, and the specified principalProperty is one of the properties on the principal end. + /// + public EdmProperty GetCorrespondingDependentProperty(NavigationProperty navProperty, EdmProperty principalProperty) + { + if (navProperty == null) + { + throw new ArgumentNullException("navProperty"); + } + + if (principalProperty == null) + { + throw new ArgumentNullException("principalProperty"); + } + + ReadOnlyMetadataCollection fromProperties = GetPrincipalProperties(navProperty); + ReadOnlyMetadataCollection toProperties = GetDependentProperties(navProperty); + return toProperties[fromProperties.IndexOf(principalProperty)]; + } + + /// + /// Gets the collection of properties that are on the principal end of a referential constraint for the specified navigation property. + /// Requires: The association has a referential constraint. + /// + public ReadOnlyMetadataCollection GetPrincipalProperties(NavigationProperty navProperty) + { + if (navProperty == null) + { + throw new ArgumentNullException("navProperty"); + } + + return ((AssociationType)navProperty.RelationshipType).ReferentialConstraints[0].FromProperties; + } + + /// + /// Gets the collection of properties that are on the dependent end of a referential constraint for the specified navigation property. + /// Requires: The association has a referential constraint. + /// + public ReadOnlyMetadataCollection GetDependentProperties(NavigationProperty navProperty) + { + if (navProperty == null) + { + throw new ArgumentNullException("navProperty"); + } + + return ((AssociationType)navProperty.RelationshipType).ReferentialConstraints[0].ToProperties; + } + + /// + /// True if this entity type requires the HandleCascadeDelete method defined and the method has + /// not been defined on any base type + /// + public bool NeedsHandleCascadeDeleteMethod(ItemCollection itemCollection, EntityType entity) + { + bool needsMethod = ContainsCascadeDeleteAssociation(itemCollection, entity); + // Check to make sure no base types have already declared this method + EntityType baseType = entity.BaseType as EntityType; + while(needsMethod && baseType != null) + { + needsMethod = !ContainsCascadeDeleteAssociation(itemCollection, baseType); + baseType = baseType.BaseType as EntityType; + } + return needsMethod; + } + + /// + /// True if this entity type participates in any relationships where the other end has an OnDelete + /// cascade delete defined, or if it is the dependent in any identifying relationships + /// + private bool ContainsCascadeDeleteAssociation(ItemCollection itemCollection, EntityType entity) + { + return itemCollection.GetItems().Where(a => + ((RefType)a.AssociationEndMembers[0].TypeUsage.EdmType).ElementType == entity && IsCascadeDeletePrincipal(a.AssociationEndMembers[1]) || + ((RefType)a.AssociationEndMembers[1].TypeUsage.EdmType).ElementType == entity && IsCascadeDeletePrincipal(a.AssociationEndMembers[0])).Any(); + } + + /// + /// True if the source end of the specified navigation property is the principal in an identifying relationship. + /// or if the source end has cascade delete defined. + /// + public bool IsCascadeDeletePrincipal(NavigationProperty navProperty) + { + if (navProperty == null) + { + throw new ArgumentNullException("navProperty"); + } + + return IsCascadeDeletePrincipal((AssociationEndMember)navProperty.FromEndMember); + } + + /// + /// True if the specified association end is the principal in an identifying relationship. + /// or if the association end has cascade delete defined. + /// + public bool IsCascadeDeletePrincipal(AssociationEndMember associationEnd) + { + if (associationEnd == null) + { + throw new ArgumentNullException("associationEnd"); + } + + return associationEnd.DeleteBehavior == OperationAction.Cascade || IsPrincipalEndOfIdentifyingRelationship(associationEnd); + } + + /// + /// True if the specified association end is the principal end in an identifying relationship. + /// In order to be an identifying relationship, the association must have a referential constraint where all of the dependent properties are part of the dependent type's primary key. + /// + public bool IsPrincipalEndOfIdentifyingRelationship(AssociationEndMember associationEnd) + { + if (associationEnd == null) + { + throw new ArgumentNullException("associationEnd"); + } + + ReferentialConstraint refConstraint = ((AssociationType)associationEnd.DeclaringType).ReferentialConstraints.Where(rc => rc.FromRole == associationEnd).SingleOrDefault(); + if (refConstraint != null) + { + EntityType entity = refConstraint.ToRole.GetEntityType(); + return !refConstraint.ToProperties.Where(tp => !entity.KeyMembers.Contains(tp)).Any(); + } + return false; + } + + /// + /// True if the specified association type is an identifying relationship. + /// In order to be an identifying relationship, the association must have a referential constraint where all of the dependent properties are part of the dependent type's primary key. + /// + public bool IsIdentifyingRelationship(AssociationType association) + { + if (association == null) + { + throw new ArgumentNullException("association"); + } + + return IsPrincipalEndOfIdentifyingRelationship(association.AssociationEndMembers[0]) || IsPrincipalEndOfIdentifyingRelationship(association.AssociationEndMembers[1]); + } + + /// + /// requires: firstType is not null + /// effects: if secondType is among the base types of the firstType, return true, + /// otherwise returns false. + /// when firstType is same as the secondType, return false. + /// + public bool IsSubtypeOf(EdmType firstType, EdmType secondType) + { + if (secondType == null) + { + return false; + } + + // walk up firstType hierarchy list + for (EdmType t = firstType.BaseType; t != null; t = t.BaseType) + { + if (t == secondType) + return true; + } + return false; + } + + /// + /// Returns the subtype of the EntityType in the current itemCollection + /// + public IEnumerable GetSubtypesOf(EntityType type, ItemCollection itemCollection, bool includeAbstractTypes) + { + if (type != null) + { + IEnumerable typesInCollection = itemCollection.GetItems(); + foreach (EntityType typeInCollection in typesInCollection) + { + if (type.Equals(typeInCollection) == false && this.IsSubtypeOf(typeInCollection, type)) + { + if ( includeAbstractTypes || !typeInCollection.Abstract) + { + yield return typeInCollection; + } + } + } + } + } + + public static bool TryGetStringMetadataPropertySetting(MetadataItem item, string propertyName, out string value) + { + value = null; + MetadataProperty property = item.MetadataProperties.FirstOrDefault(p => p.Name == propertyName); + if (property != null) + { + value = (string)property.Value; + } + return value != null; + } +} + +/// +/// Responsible for loading an EdmItemCollection from a .edmx file or .csdl files +/// +public class MetadataLoader +{ + private readonly DynamicTextTransformation _textTransformation; + + /// + /// Initializes an MetadataLoader Instance with the + /// TextTransformation (T4 generated class) that is currently running + /// + public MetadataLoader(object textTransformation) + { + if (textTransformation == null) + { + throw new ArgumentNullException("textTransformation"); + } + + _textTransformation = DynamicTextTransformation.Create(textTransformation); + } + + /// + /// Load the metadata for Edm, Store, and Mapping collections and register them + /// with a new MetadataWorkspace, returns false if any of the parts can't be + /// created, some of the ItemCollections may be registered and usable even if false is + /// returned + /// + public bool TryLoadAllMetadata(string inputFile, out MetadataWorkspace metadataWorkspace) + { + metadataWorkspace = new MetadataWorkspace(); + + EdmItemCollection edmItemCollection = CreateEdmItemCollection(inputFile); + metadataWorkspace.RegisterItemCollection(edmItemCollection); + + + StoreItemCollection storeItemCollection = null; + if (TryCreateStoreItemCollection(inputFile, out storeItemCollection)) + { + StorageMappingItemCollection storageMappingItemCollection = null; + if (TryCreateStorageMappingItemCollection(inputFile, edmItemCollection, storeItemCollection, out storageMappingItemCollection)) + { + metadataWorkspace.RegisterItemCollection(storeItemCollection); + metadataWorkspace.RegisterItemCollection(storageMappingItemCollection); + return true; + } + } + + return false; + } + + /// + /// Create an EdmItemCollection loaded with the metadata provided + /// + public EdmItemCollection CreateEdmItemCollection(string sourcePath, params string[] referenceSchemas) + { + EdmItemCollection edmItemCollection; + if(TryCreateEdmItemCollection(sourcePath, referenceSchemas, out edmItemCollection)) + { + return edmItemCollection; + } + + return new EdmItemCollection(); + } + + /// + /// Attempts to create a EdmItemCollection from the specified metadata file + /// + public bool TryCreateEdmItemCollection(string sourcePath, out EdmItemCollection edmItemCollection) + { + return TryCreateEdmItemCollection(sourcePath, null, out edmItemCollection); + } + + /// + /// Attempts to create a EdmItemCollection from the specified metadata file + /// + public bool TryCreateEdmItemCollection(string sourcePath, string[] referenceSchemas, out EdmItemCollection edmItemCollection) + { + edmItemCollection = null; + + if (String.IsNullOrEmpty(sourcePath)) + { + throw new ArgumentException("sourcePath"); + } + + if (referenceSchemas == null) + { + referenceSchemas = new string[0]; + } + + ItemCollection itemCollection = null; + sourcePath = _textTransformation.Host.ResolvePath(sourcePath); + EdmItemCollectionBuilder collectionBuilder = new EdmItemCollectionBuilder(_textTransformation, referenceSchemas.Select(s => _textTransformation.Host.ResolvePath(s)).Where(s => s != sourcePath)); + if (collectionBuilder.TryCreateItemCollection(sourcePath, out itemCollection)) + { + edmItemCollection = (EdmItemCollection)itemCollection; + } + + return edmItemCollection != null; + } + + /// + /// Attempts to create a StoreItemCollection from the specified metadata file + /// + public bool TryCreateStoreItemCollection(string sourcePath, out StoreItemCollection storeItemCollection) + { + storeItemCollection = null; + + if (String.IsNullOrEmpty(sourcePath)) + { + throw new ArgumentException("sourcePath"); + } + + ItemCollection itemCollection = null; + StoreItemCollectionBuilder collectionBuilder = new StoreItemCollectionBuilder(_textTransformation); + if (collectionBuilder.TryCreateItemCollection(_textTransformation.Host.ResolvePath(sourcePath), out itemCollection)) + { + storeItemCollection = (StoreItemCollection)itemCollection; + } + return storeItemCollection != null; + } + + /// + /// Attempts to create a StorageMappingItemCollection from the specified metadata file, EdmItemCollection, and StoreItemCollection + /// + public bool TryCreateStorageMappingItemCollection(string sourcePath, EdmItemCollection edmItemCollection, StoreItemCollection storeItemCollection, out StorageMappingItemCollection storageMappingItemCollection) + { + storageMappingItemCollection = null; + + if (String.IsNullOrEmpty(sourcePath)) + { + throw new ArgumentException("sourcePath"); + } + + if (edmItemCollection == null) + { + throw new ArgumentNullException("edmItemCollection"); + } + + if (storeItemCollection == null) + { + throw new ArgumentNullException("storeItemCollection"); + } + + ItemCollection itemCollection = null; + StorageMappingItemCollectionBuilder collectionBuilder = new StorageMappingItemCollectionBuilder(_textTransformation, edmItemCollection, storeItemCollection); + if (collectionBuilder.TryCreateItemCollection(_textTransformation.Host.ResolvePath(sourcePath), out itemCollection)) + { + storageMappingItemCollection = (StorageMappingItemCollection)itemCollection; + } + return storageMappingItemCollection != null; + } + + /// + /// Gets the Model Namespace from the provided schema file. + /// + public string GetModelNamespace(string sourcePath) + { + if (String.IsNullOrEmpty(sourcePath)) + { + throw new ArgumentException("sourcePath"); + } + + if(sourcePath == "$edmxInputFile$") + { + _textTransformation.Errors.Add(new CompilerError(_textTransformation.Host.TemplateFile ?? "Currently Running Template", 0, 0, "", + "Please overwrite the replacement token '$edmxInputFile$' with the actual name of the .edmx file you would like to generate from.")); + return String.Empty; + } + + EdmItemCollectionBuilder builder = new EdmItemCollectionBuilder(_textTransformation); + XElement model; + if(builder.TryLoadRootElement(_textTransformation.Host.ResolvePath(sourcePath), out model)) + { + XAttribute attribute = model.Attribute("Namespace"); + if (attribute != null) + { + return attribute.Value; + } + } + + return String.Empty; + } + + /// + /// base class for ItemCollectionBuilder classes that + /// load the specific types of metadata + /// + private abstract class ItemCollectionBuilder + { + private readonly DynamicTextTransformation _textTransformation; + private readonly string _fileExtension; + private readonly string _namespaceV1; + private readonly string _namespaceV2; + private readonly string _edmxSectionName; + private readonly string _rootElementName; + + /// + /// FileExtension for individual (non-edmx) metadata file for this + /// specific ItemCollection type + /// + public string FileExtension + { + get { return _fileExtension; } + } + + /// + /// EF Version 1 XmlNamespace name + /// + public string NamespaceV1 + { + get { return _namespaceV1; } + } + + /// + /// EF Version 2 XmlNamespace name + /// + public string NamespaceV2 + { + get { return _namespaceV2; } + } + + /// + /// The name of the XmlElement in the .edmx element + /// to find this ItemCollection's metadata + /// + public string EdmxSectionName + { + get { return _edmxSectionName; } + } + + /// + /// The name of the root element of this ItemCollection's metadata + /// + public string RootElementName + { + get { return _rootElementName; } + } + + /// + /// Method to build the appropriate ItemCollection + /// + protected abstract ItemCollection CreateItemCollection(IEnumerable readers, out IList errors); + + /// + /// Ctor to setup the ItemCollectionBuilder members + /// + protected ItemCollectionBuilder(DynamicTextTransformation textTransformation, string fileExtension, string namespaceV1, string namespaceV2, string edmxSectionName, string rootElementName) + { + _textTransformation = textTransformation; + _fileExtension = fileExtension; + _namespaceV1 = namespaceV1; + _namespaceV2 = namespaceV2; + _edmxSectionName = edmxSectionName; + _rootElementName = rootElementName; + } + + /// + /// Try to create an ItemCollection loaded with the metadata provided + /// + public bool TryCreateItemCollection(string sourcePath, out ItemCollection itemCollection) + { + itemCollection = null; + + if (String.IsNullOrEmpty(sourcePath)) + { + throw new ArgumentException("sourcePath"); + } + + if(sourcePath == "$edmxInputFile$" ) + { + _textTransformation.Errors.Add(new CompilerError(_textTransformation.Host.TemplateFile ?? "Currently Running Template", 0, 0, "", + "Please overwrite the replacement token '$edmxInputFile$' with the actual name of the .edmx file you would like to generate from.")); + return false; + } + + XElement schemaElement = null; + if (TryLoadRootElement(sourcePath, out schemaElement)) + { + List readers = new List(); + try + { + readers.Add(schemaElement.CreateReader()); + IList errors = null; + + ItemCollection tempItemCollection = CreateItemCollection(readers, out errors); + if (ProcessErrors(errors, sourcePath)) + { + return false; + } + + itemCollection = tempItemCollection; + return true; + } + finally + { + foreach (XmlReader reader in readers) + { + ((IDisposable)reader).Dispose(); + } + } + } + + return false; + } + + /// + /// Tries to load the root element from the metadata file provided + /// + public bool TryLoadRootElement(string sourcePath, out XElement schemaElement) + { + schemaElement = null; + string extension = Path.GetExtension(sourcePath); + if (extension.Equals(".edmx", StringComparison.InvariantCultureIgnoreCase)) + { + return TryLoadRootElementFromEdmx(sourcePath, out schemaElement); + } + else if(extension.Equals(FileExtension, StringComparison.InvariantCultureIgnoreCase)) + { + // load from single metadata file (.csdl, .ssdl, or .msl) + schemaElement = XElement.Load(sourcePath, LoadOptions.SetBaseUri | LoadOptions.SetLineInfo); + return true; + } + + return false; + } + + /// + /// Trys to load the root element from the edmxDocument provided + /// + private static bool TryLoadRootElementFromEdmx(XElement edmxDocument, string edmxNamespace, string sectionNamespace, string sectionName, string rootElementName, out XElement rootElement) + { + rootElement = null; + + XNamespace edmxNs = edmxNamespace; + XNamespace sectionNs = sectionNamespace; + + XElement runtime = edmxDocument.Element(edmxNs + "Runtime"); + if (runtime == null) + return false; + + XElement section = runtime.Element(edmxNs + sectionName); + if (section == null) + return false; + + rootElement = section.Element(sectionNs + rootElementName); + return rootElement != null; + } + + /// + /// Trys to load the root element from the .edmx metadata file provided + /// + private bool TryLoadRootElementFromEdmx(string edmxPath, out XElement rootElement) + { + rootElement = null; + + XElement element = XElement.Load(edmxPath, LoadOptions.SetBaseUri | LoadOptions.SetLineInfo); + + return TryLoadRootElementFromEdmx(element, MetadataConstants.EDMX_NAMESPACE_V2, NamespaceV2, EdmxSectionName, RootElementName, out rootElement) + || TryLoadRootElementFromEdmx(element, MetadataConstants.EDMX_NAMESPACE_V1, NamespaceV1, EdmxSectionName, RootElementName, out rootElement); + } + + /// + /// Takes an Enumerable of EdmSchemaErrors, and adds them + /// to the errors collection of the template class + /// + private bool ProcessErrors(IEnumerable errors, string sourceFilePath) + { + bool foundErrors = false; + foreach (EdmSchemaError error in errors) + { + CompilerError newError = new CompilerError(error.SchemaLocation, error.Line, error.Column, + error.ErrorCode.ToString(CultureInfo.InvariantCulture), + error.Message); + newError.IsWarning = error.Severity == EdmSchemaErrorSeverity.Warning; + foundErrors |= error.Severity == EdmSchemaErrorSeverity.Error; + if (error.SchemaLocation == null) + { + newError.FileName = sourceFilePath; + } + _textTransformation.Errors.Add(newError); + } + + return foundErrors; + } + } + + /// + /// Builder class for creating a StorageMappingItemCollection + /// + private class StorageMappingItemCollectionBuilder : ItemCollectionBuilder + { + private readonly EdmItemCollection _edmItemCollection; + private readonly StoreItemCollection _storeItemCollection; + + public StorageMappingItemCollectionBuilder(DynamicTextTransformation textTransformation, EdmItemCollection edmItemCollection, StoreItemCollection storeItemCollection) + : base(textTransformation, MetadataConstants.MSL_EXTENSION, MetadataConstants.MSL_NAMESPACE_V1, MetadataConstants.MSL_NAMESPACE_V2, MetadataConstants.MSL_EDMX_SECTION_NAME, MetadataConstants.MSL_ROOT_ELEMENT_NAME) + { + _edmItemCollection = edmItemCollection; + _storeItemCollection = storeItemCollection; + } + + protected override ItemCollection CreateItemCollection(IEnumerable readers, out IList errors) + { + return MetadataItemCollectionFactory.CreateStorageMappingItemCollection(_edmItemCollection, _storeItemCollection, readers, out errors); + } + } + + /// + /// Builder class for creating a StoreItemCollection + /// + private class StoreItemCollectionBuilder : ItemCollectionBuilder + { + public StoreItemCollectionBuilder(DynamicTextTransformation textTransformation) + : base(textTransformation, MetadataConstants.SSDL_EXTENSION, MetadataConstants.SSDL_NAMESPACE_V1, MetadataConstants.SSDL_NAMESPACE_V2, MetadataConstants.SSDL_EDMX_SECTION_NAME, MetadataConstants.SSDL_ROOT_ELEMENT_NAME) + { + } + + protected override ItemCollection CreateItemCollection(IEnumerable readers, out IList errors) + { + return MetadataItemCollectionFactory.CreateStoreItemCollection(readers, out errors); + } + } + + /// + /// Builder class for creating a EdmItemCollection + /// + private class EdmItemCollectionBuilder : ItemCollectionBuilder + { + private List _referenceSchemas = new List(); + + public EdmItemCollectionBuilder(DynamicTextTransformation textTransformation) + : base(textTransformation, MetadataConstants.CSDL_EXTENSION, MetadataConstants.CSDL_NAMESPACE_V1, MetadataConstants.CSDL_NAMESPACE_V2, MetadataConstants.CSDL_EDMX_SECTION_NAME, MetadataConstants.CSDL_ROOT_ELEMENT_NAME) + { + } + + public EdmItemCollectionBuilder(DynamicTextTransformation textTransformation, IEnumerable referenceSchemas) + : this(textTransformation) + { + _referenceSchemas.AddRange(referenceSchemas); + } + + protected override ItemCollection CreateItemCollection(IEnumerable readers, out IList errors) + { + List ownedReaders = new List(); + List allReaders = new List(); + try + { + allReaders.AddRange(readers); + foreach (string path in _referenceSchemas.Distinct()) + { + XElement reference; + if(TryLoadRootElement(path, out reference)) + { + XmlReader reader = reference.CreateReader(); + allReaders.Add(reader); + ownedReaders.Add(reader); + } + } + + return MetadataItemCollectionFactory.CreateEdmItemCollection(allReaders, out errors); + } + finally + { + foreach (XmlReader reader in ownedReaders) + { + ((IDisposable)reader).Dispose(); + } + } + } + } +} + +/// +/// Responsible for encapsulating the retrieval and translation of the CodeGeneration +/// annotations in the EntityFramework Metadata to a form that is useful in code generation. +/// +public static class Accessibility +{ + private const string GETTER_ACCESS = "http://schemas.microsoft.com/ado/2006/04/codegeneration:GetterAccess"; + private const string SETTER_ACCESS = "http://schemas.microsoft.com/ado/2006/04/codegeneration:SetterAccess"; + private const string TYPE_ACCESS = "http://schemas.microsoft.com/ado/2006/04/codegeneration:TypeAccess"; + private const string METHOD_ACCESS = "http://schemas.microsoft.com/ado/2006/04/codegeneration:MethodAccess"; + private const string ACCESS_PROTECTED = "Protected"; + private const string ACCESS_INTERNAL = "Internal"; + private const string ACCESS_PRIVATE = "Private"; + private static readonly Dictionary AccessibilityRankIdLookup = new Dictionary + { + { "private", 1}, + { "internal", 2}, + { "protected", 3}, + { "public", 4}, + }; + + /// + /// Gets the accessibility that should be applied to a type being generated from the provided GlobalItem. + /// + /// defaults to public if no annotation is found. + /// + public static string ForType(GlobalItem item) + { + if (item == null) + { + return null; + } + + return GetAccessibility(item, TYPE_ACCESS); + } + + /// + /// Gets the accessibility that should be applied at the property level for a property being + /// generated from the provided EdmMember. + /// + /// defaults to public if no annotation is found. + /// + public static string ForProperty(EdmMember member) + { + if (member == null) + { + return null; + } + + string getterAccess, setterAccess, propertyAccess; + CalculatePropertyAccessibility(member, out propertyAccess, out getterAccess, out setterAccess); + return propertyAccess; + } + + /// + /// Gets the accessibility that should be applied at the property level for a Read-Only property being + /// generated from the provided EdmMember. + /// + /// defaults to public if no annotation is found. + /// + public static string ForReadOnlyProperty(EdmMember member) + { + if (member == null) + { + return null; + } + + return GetAccessibility(member, GETTER_ACCESS); + } + + /// + /// Gets the accessibility that should be applied at the property level for a property being + /// generated from the provided EntitySet. + /// + /// defaults to public if no annotation is found. + /// + public static string ForReadOnlyProperty(EntitySet set) + { + if (set == null) + { + return null; + } + + return GetAccessibility(set, GETTER_ACCESS); + } + + /// + /// Gets the accessibility that should be applied at the property level for a Write-Only property being + /// generated from the provided EdmMember. + /// + /// defaults to public if no annotation is found. + /// + public static string ForWriteOnlyProperty(EdmMember member) + { + if (member == null) + { + return null; + } + + return GetAccessibility(member, SETTER_ACCESS); + } + + + /// + /// Gets the accessibility that should be applied at the get level for a property being + /// generated from the provided EdmMember. + /// + /// defaults to empty if no annotation is found or the accessibility is the same as the property level. + /// + public static string ForGetter(EdmMember member) + { + if (member == null) + { + return null; + } + + string getterAccess, setterAccess, propertyAccess; + CalculatePropertyAccessibility(member, out propertyAccess, out getterAccess, out setterAccess); + return getterAccess; + } + + /// + /// Gets the accessibility that should be applied at the set level for a property being + /// generated from the provided EdmMember. + /// + /// defaults to empty if no annotation is found or the accessibility is the same as the property level. + /// + public static string ForSetter(EdmMember member) + { + if (member == null) + { + return null; + } + + string getterAccess, setterAccess, propertyAccess; + CalculatePropertyAccessibility(member, out propertyAccess, out getterAccess, out setterAccess); + return setterAccess; + } + + /// + /// Gets the accessibility that should be applied to a method being generated from the provided EdmFunction. + /// + /// defaults to public if no annotation is found. + /// + public static string ForMethod(EdmFunction function) + { + if (function == null) + { + return null; + } + + return GetAccessibility(function, METHOD_ACCESS); + } + + private static void CalculatePropertyAccessibility(MetadataItem item, + out string propertyAccessibility, + out string getterAccessibility, + out string setterAccessibility) + { + getterAccessibility = GetAccessibility(item, GETTER_ACCESS); + int getterRank = AccessibilityRankIdLookup[getterAccessibility]; + + setterAccessibility = GetAccessibility(item, SETTER_ACCESS); + int setterRank = AccessibilityRankIdLookup[setterAccessibility]; + + int propertyRank = Math.Max(getterRank, setterRank); + if (setterRank == propertyRank) + { + setterAccessibility = String.Empty; + } + + if (getterRank == propertyRank) + { + getterAccessibility = String.Empty; + } + + propertyAccessibility = AccessibilityRankIdLookup.Where(v => v.Value == propertyRank).Select(v => v.Key).Single(); + } + + private static string GetAccessibility(MetadataItem item, string name) + { + string accessibility; + if (MetadataTools.TryGetStringMetadataPropertySetting(item, name, out accessibility)) + { + return TranslateUserAccessibilityToCSharpAccessibility(accessibility); + } + + return "public"; + } + + private static string TranslateUserAccessibilityToCSharpAccessibility(string userAccessibility) + { + if (userAccessibility == ACCESS_PROTECTED) + { + return "protected"; + } + else if (userAccessibility == ACCESS_INTERNAL) + { + return "internal"; + } + else if (userAccessibility == ACCESS_PRIVATE) + { + return "private"; + } + else + { + // default to public + return "public"; + } + } + +} + +/// +/// Responsible for creating source code regions in code when the loop inside +/// actually produces something. +/// +public class CodeRegion +{ + private const int STANDARD_INDENT_LENGTH = 4; + + private readonly DynamicTextTransformation _textTransformation; + private int _beforeRegionLength; + private int _emptyRegionLength; + private int _regionIndentLevel = -1; + + /// + /// Initializes an CodeRegion instance with the + /// TextTransformation (T4 generated class) that is currently running + /// + public CodeRegion(object textTransformation) + { + if (textTransformation == null) + { + throw new ArgumentNullException("textTransformation"); + } + + _textTransformation = DynamicTextTransformation.Create(textTransformation); + } + + /// + /// Initializes an CodeRegion instance with the + /// TextTransformation (T4 generated class) that is currently running, + /// and the indent level to start the first region at. + /// + public CodeRegion(object textTransformation, int firstIndentLevel) + : this(textTransformation) + { + if (firstIndentLevel < 0) + { + throw new ArgumentException("firstIndentLevel"); + } + + _regionIndentLevel = firstIndentLevel - 1; + } + + /// + /// Starts the begining of a region + /// + public void Begin(string regionName) + { + if (regionName == null) + { + throw new ArgumentNullException("regionName"); + } + + Begin(regionName, 1); + } + + /// + /// Start the begining of a region, indented + /// the numbers of levels specified + /// + public void Begin(string regionName, int levelsToIncreaseIndent) + { + if (regionName == null) + { + throw new ArgumentNullException("regionName"); + } + + _beforeRegionLength = _textTransformation.GenerationEnvironment.Length; + _regionIndentLevel += levelsToIncreaseIndent; + _textTransformation.Write(GetIndent(_regionIndentLevel)); + _textTransformation.WriteLine("#region " + regionName); + _emptyRegionLength = _textTransformation.GenerationEnvironment.Length; + } + + /// + /// Ends a region, or totaly removes it if nothing + /// was generted since the begining of the region. + /// + public void End() + { + End(1); + } + + /// + /// Ends a region, or totaly removes it if nothing + /// was generted since the begining of the region, also outdents + /// the number of levels specified. + /// + public void End(int levelsToDecrease) + { + int indentLevel = _regionIndentLevel; + _regionIndentLevel -= levelsToDecrease; + + if (_emptyRegionLength == _textTransformation.GenerationEnvironment.Length) + _textTransformation.GenerationEnvironment.Length = _beforeRegionLength; + else + { + _textTransformation.WriteLine(String.Empty); + _textTransformation.Write(GetIndent(indentLevel)); + _textTransformation.WriteLine("#endregion"); + } + } + + /// + /// Gets the current indent level that the next end region statement will be written + /// at + /// + public int CurrentIndentLevel { get { return _regionIndentLevel; } } + + /// + /// Get a string of spaces equivelent to the number of indents + /// desired. + /// + public static string GetIndent(int indentLevel) + { + if (indentLevel < 0) + { + throw new ArgumentException("indentLevel"); + } + + return String.Empty.PadLeft(indentLevel * STANDARD_INDENT_LENGTH); + } +} + + + + +/// +/// Responsible for collecting together the actual method parameters +/// and the parameters that need to be sent to the Execute method. +/// +public class FunctionImportParameter +{ + public FunctionParameter Source { get; set; } + public string RawFunctionParameterName { get; set; } + public string FunctionParameterName { get; set; } + public string FunctionParameterType { get; set; } + public string LocalVariableName { get; set; } + public string RawClrTypeName { get; set; } + public string ExecuteParameterName { get; set; } + public string EsqlParameterName { get; set; } + public bool NeedsLocalVariable { get; set; } + public bool IsNullableOfT { get; set; } + + + /// + /// Creates a set of FunctionImportParameter objects from the parameters passed in. + /// + public static IEnumerable Create(IEnumerable parameters, CodeGenerationTools code, MetadataTools ef) + { + if (parameters == null) + { + throw new ArgumentNullException("parameters"); + } + + if (code == null) + { + throw new ArgumentNullException("code"); + } + + if (ef == null) + { + throw new ArgumentNullException("ef"); + } + + UniqueIdentifierService unique = new UniqueIdentifierService(); + List importParameters = new List(); + foreach (FunctionParameter parameter in parameters) + { + FunctionImportParameter importParameter = new FunctionImportParameter(); + importParameter.Source = parameter; + importParameter.RawFunctionParameterName = unique.AdjustIdentifier(code.CamelCase(parameter.Name)); + importParameter.FunctionParameterName = code.Escape(importParameter.RawFunctionParameterName); + if (parameter.Mode == ParameterMode.In) + { + importParameter.NeedsLocalVariable = true; + importParameter.FunctionParameterType = code.Escape(parameter.TypeUsage); + importParameter.EsqlParameterName = parameter.Name; + Type clrType = ef.ClrType(parameter.TypeUsage); + importParameter.RawClrTypeName = code.Escape(clrType); + importParameter.IsNullableOfT = clrType.IsValueType; + } + else + { + importParameter.NeedsLocalVariable = false; + importParameter.FunctionParameterType = "ObjectParameter"; + importParameter.ExecuteParameterName = importParameter.FunctionParameterName; + } + importParameters.Add(importParameter); + } + + // we save the local parameter uniquification for a second pass to make the visible parameters + // as pretty and sensible as possible + for (int i = 0; i < importParameters.Count; i++) + { + FunctionImportParameter importParameter = importParameters[i]; + if (importParameter.NeedsLocalVariable) + { + importParameter.LocalVariableName = unique.AdjustIdentifier(importParameter.RawFunctionParameterName + "Parameter"); + importParameter.ExecuteParameterName = importParameter.LocalVariableName; + } + } + + return importParameters; + } + + // + // Class to create unique variables within the same scope + // + private sealed class UniqueIdentifierService + { + private readonly HashSet _knownIdentifiers; + + public UniqueIdentifierService() + { + _knownIdentifiers = new HashSet(StringComparer.Ordinal); + } + + /// + /// Given an identifier, makes it unique within the scope by adding + /// a suffix (1, 2, 3, ...), and returns the adjusted identifier. + /// + public string AdjustIdentifier(string identifier) + { + // find a unique name by adding suffix as necessary + int numberOfConflicts = 0; + string adjustedIdentifier = identifier; + + while (!_knownIdentifiers.Add(adjustedIdentifier)) + { + ++numberOfConflicts; + adjustedIdentifier = identifier + numberOfConflicts.ToString(CultureInfo.InvariantCulture); + } + + return adjustedIdentifier; + } + } + + private string FunctionImportTypeName(FunctionParameter parameter) + { + return parameter.Mode == ParameterMode.In ? parameter.TypeUsage.EdmType.Name : "ObjectParameter"; + } +} + +/// +/// Responsible for marking the various sections of the generation, +/// so they can be split up into separate files +/// +public class EntityFrameworkTemplateFileManager +{ + /// + /// Creates the VsEntityFrameworkTemplateFileManager if VS is detected, otherwise + /// creates the file system version. + /// + public static EntityFrameworkTemplateFileManager Create(object textTransformation) + { + DynamicTextTransformation transformation = DynamicTextTransformation.Create(textTransformation); + IDynamicHost host = transformation.Host; + +#if !PREPROCESSED_TEMPLATE + if (host.AsIServiceProvider() != null) + { + return new VsEntityFrameworkTemplateFileManager(transformation); + } +#endif + return new EntityFrameworkTemplateFileManager(transformation); + } + + private sealed class Block + { + public String Name; + public int Start, Length; + } + + private readonly List files = new List(); + private readonly Block footer = new Block(); + private readonly Block header = new Block(); + private readonly DynamicTextTransformation _textTransformation; + + // reference to the GenerationEnvironment StringBuilder on the + // TextTransformation object + private readonly StringBuilder _generationEnvironment; + + private Block currentBlock; + + /// + /// Initializes an EntityFrameworkTemplateFileManager Instance with the + /// TextTransformation (T4 generated class) that is currently running + /// + private EntityFrameworkTemplateFileManager(object textTransformation) + { + if (textTransformation == null) + { + throw new ArgumentNullException("textTransformation"); + } + + _textTransformation = DynamicTextTransformation.Create(textTransformation); + _generationEnvironment = _textTransformation.GenerationEnvironment; + } + + /// + /// Marks the end of the last file if there was one, and starts a new + /// and marks this point in generation as a new file. + /// + public void StartNewFile(string name) + { + if (name == null) + { + throw new ArgumentNullException("name"); + } + + CurrentBlock = new Block { Name = name }; + } + + public void StartFooter() + { + CurrentBlock = footer; + } + + public void StartHeader() + { + CurrentBlock = header; + } + + public void EndBlock() + { + if (CurrentBlock == null) + { + return; + } + + CurrentBlock.Length = _generationEnvironment.Length - CurrentBlock.Start; + + if (CurrentBlock != header && CurrentBlock != footer) + { + files.Add(CurrentBlock); + } + + currentBlock = null; + } + + /// + /// Produce the template output files. + /// + public virtual IEnumerable Process(bool split = true) + { + var generatedFileNames = new List(); + + if (split) + { + EndBlock(); + + var headerText = _generationEnvironment.ToString(header.Start, header.Length); + var footerText = _generationEnvironment.ToString(footer.Start, footer.Length); + var outputPath = Path.GetDirectoryName(_textTransformation.Host.TemplateFile); + + files.Reverse(); + + foreach (var block in files) + { + var fileName = Path.Combine(outputPath, block.Name); + var content = headerText + _generationEnvironment.ToString(block.Start, block.Length) + footerText; + + generatedFileNames.Add(fileName); + CreateFile(fileName, content); + _generationEnvironment.Remove(block.Start, block.Length); + } + } + + return generatedFileNames; + } + + protected virtual void CreateFile(string fileName, string content) + { + if (IsFileContentDifferent(fileName, content)) + { + File.WriteAllText(fileName, content); + } + } + + protected bool IsFileContentDifferent(String fileName, string newContent) + { + return !(File.Exists(fileName) && File.ReadAllText(fileName) == newContent); + } + + private Block CurrentBlock + { + get { return currentBlock; } + set + { + if (CurrentBlock != null) + { + EndBlock(); + } + + if (value != null) + { + value.Start = _generationEnvironment.Length; + } + + currentBlock = value; + } + } + +#if !PREPROCESSED_TEMPLATE + private sealed class VsEntityFrameworkTemplateFileManager : EntityFrameworkTemplateFileManager + { + private EnvDTE.ProjectItem templateProjectItem; + private EnvDTE.DTE dte; + private Action checkOutAction; + private Action> projectSyncAction; + + /// + /// Creates an instance of the VsEntityFrameworkTemplateFileManager class with the IDynamicHost instance + /// + public VsEntityFrameworkTemplateFileManager(object textTemplating) + : base(textTemplating) + { + var hostServiceProvider = _textTransformation.Host.AsIServiceProvider(); + if (hostServiceProvider == null) + { + throw new ArgumentNullException("Could not obtain hostServiceProvider"); + } + + dte = (EnvDTE.DTE) hostServiceProvider.GetService(typeof(EnvDTE.DTE)); + if (dte == null) + { + throw new ArgumentNullException("Could not obtain DTE from host"); + } + + templateProjectItem = dte.Solution.FindProjectItem(_textTransformation.Host.TemplateFile); + + checkOutAction = fileName => dte.SourceControl.CheckOutItem(fileName); + projectSyncAction = keepFileNames => ProjectSync(templateProjectItem, keepFileNames); + } + + public override IEnumerable Process(bool split) + { + if (templateProjectItem.ProjectItems == null) + { + return new List(); + } + + var generatedFileNames = base.Process(split); + + projectSyncAction.EndInvoke(projectSyncAction.BeginInvoke(generatedFileNames, null, null)); + + return generatedFileNames; + } + + protected override void CreateFile(string fileName, string content) + { + if (IsFileContentDifferent(fileName, content)) + { + CheckoutFileIfRequired(fileName); + File.WriteAllText(fileName, content); + } + } + + private static void ProjectSync(EnvDTE.ProjectItem templateProjectItem, IEnumerable keepFileNames) + { + var keepFileNameSet = new HashSet(keepFileNames); + var projectFiles = new Dictionary(); + var originalOutput = Path.GetFileNameWithoutExtension(templateProjectItem.FileNames[0]); + + foreach (EnvDTE.ProjectItem projectItem in templateProjectItem.ProjectItems) + { + projectFiles.Add(projectItem.FileNames[0], projectItem); + } + + // Remove unused items from the project + foreach (var pair in projectFiles) + { + if (!keepFileNames.Contains(pair.Key) + && !(Path.GetFileNameWithoutExtension(pair.Key) + ".").StartsWith(originalOutput + ".")) + { + pair.Value.Delete(); + } + } + + // Add missing files to the project + foreach (string fileName in keepFileNameSet) + { + if (!projectFiles.ContainsKey(fileName)) + { + templateProjectItem.ProjectItems.AddFromFile(fileName); + } + } + } + + private void CheckoutFileIfRequired(string fileName) + { + if (dte.SourceControl == null + || !dte.SourceControl.IsItemUnderSCC(fileName) + || dte.SourceControl.IsItemCheckedOut(fileName)) + { + return; + } + + // run on worker thread to prevent T4 calling back into VS + checkOutAction.EndInvoke(checkOutAction.BeginInvoke(fileName, null, null)); + } + } +#endif +} + +/// +/// Responsible creating an instance that can be passed +/// to helper classes that need to access the TextTransformation +/// members. It accesses member by name and signature rather than +/// by type. This is necessary when the +/// template is being used in Preprocessed mode +/// and there is no common known type that can be +/// passed instead +/// +public class DynamicTextTransformation +{ + private object _instance; + IDynamicHost _dynamicHost; + + private readonly MethodInfo _write; + private readonly MethodInfo _writeLine; + private readonly PropertyInfo _generationEnvironment; + private readonly PropertyInfo _errors; + private readonly PropertyInfo _host; + + /// + /// Creates an instance of the DynamicTextTransformation class around the passed in + /// TextTransformation shapped instance passed in, or if the passed in instance + /// already is a DynamicTextTransformation, it casts it and sends it back. + /// + public static DynamicTextTransformation Create(object instance) + { + if (instance == null) + { + throw new ArgumentNullException("instance"); + } + + DynamicTextTransformation textTransformation = instance as DynamicTextTransformation; + if (textTransformation != null) + { + return textTransformation; + } + + return new DynamicTextTransformation(instance); + } + + private DynamicTextTransformation(object instance) + { + _instance = instance; + Type type = _instance.GetType(); + _write = type.GetMethod("Write", new Type[] { typeof(string) }); + _writeLine = type.GetMethod("WriteLine", new Type[] { typeof(string) }); + _generationEnvironment = type.GetProperty("GenerationEnvironment", BindingFlags.Instance | BindingFlags.NonPublic); + _host = type.GetProperty("Host"); + _errors = type.GetProperty("Errors"); + } + + /// + /// Gets the value of the wrapped TextTranformation instance's GenerationEnvironment property + /// + public StringBuilder GenerationEnvironment { get { return (StringBuilder)_generationEnvironment.GetValue(_instance, null); } } + + /// + /// Gets the value of the wrapped TextTranformation instance's Errors property + /// + public System.CodeDom.Compiler.CompilerErrorCollection Errors { get { return (System.CodeDom.Compiler.CompilerErrorCollection)_errors.GetValue(_instance, null); } } + + /// + /// Calls the wrapped TextTranformation instance's Write method. + /// + public void Write(string text) + { + _write.Invoke(_instance, new object[] { text }); + } + + /// + /// Calls the wrapped TextTranformation instance's WriteLine method. + /// + public void WriteLine(string text) + { + _writeLine.Invoke(_instance, new object[] { text }); + } + + /// + /// Gets the value of the wrapped TextTranformation instance's Host property + /// if available (shows up when hostspecific is set to true in the template directive) and returns + /// the appropriate implementation of IDynamicHost + /// + public IDynamicHost Host + { + get + { + if (_dynamicHost == null) + { + if(_host == null) + { + _dynamicHost = new NullHost(); + } + else + { + _dynamicHost = new DynamicHost(_host.GetValue(_instance, null)); + } + } + return _dynamicHost; + } + } +} + + +/// +/// Reponsible for abstracting the use of Host between times +/// when it is available and not +/// +public interface IDynamicHost +{ + /// + /// An abstracted call to Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost ResolveParameterValue + /// + string ResolveParameterValue(string id, string name, string otherName); + + /// + /// An abstracted call to Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost ResolvePath + /// + string ResolvePath(string path); + + /// + /// An abstracted call to Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost TemplateFile + /// + string TemplateFile { get; } + + /// + /// Returns the Host instance cast as an IServiceProvider + /// + IServiceProvider AsIServiceProvider(); +} + +/// +/// Reponsible for implementing the IDynamicHost as a dynamic +/// shape wrapper over the Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost interface +/// rather than type dependent wrapper. We don't use the +/// interface type so that the code can be run in preprocessed mode +/// on a .net framework only installed machine. +/// +public class DynamicHost : IDynamicHost +{ + private readonly object _instance; + private readonly MethodInfo _resolveParameterValue; + private readonly MethodInfo _resolvePath; + private readonly PropertyInfo _templateFile; + + /// + /// Creates an instance of the DynamicHost class around the passed in + /// Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost shapped instance passed in. + /// + public DynamicHost(object instance) + { + _instance = instance; + Type type = _instance.GetType(); + _resolveParameterValue = type.GetMethod("ResolveParameterValue", new Type[] { typeof(string), typeof(string), typeof(string) }); + _resolvePath = type.GetMethod("ResolvePath", new Type[] { typeof(string) }); + _templateFile = type.GetProperty("TemplateFile"); + + } + + /// + /// A call to Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost ResolveParameterValue + /// + public string ResolveParameterValue(string id, string name, string otherName) + { + return (string)_resolveParameterValue.Invoke(_instance, new object[] { id, name, otherName }); + } + + /// + /// A call to Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost ResolvePath + /// + public string ResolvePath(string path) + { + return (string)_resolvePath.Invoke(_instance, new object[] { path }); + } + + /// + /// A call to Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost TemplateFile + /// + public string TemplateFile + { + get + { + return (string)_templateFile.GetValue(_instance, null); + } + } + + /// + /// Returns the Host instance cast as an IServiceProvider + /// + public IServiceProvider AsIServiceProvider() + { + return _instance as IServiceProvider; + } +} + +/// +/// Reponsible for implementing the IDynamicHost when the +/// Host property is not available on the TextTemplating type. The Host +/// property only exists when the hostspecific attribute of the template +/// directive is set to true. +/// +public class NullHost : IDynamicHost +{ + /// + /// An abstraction of the call to Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost ResolveParameterValue + /// that simply retuns null. + /// + public string ResolveParameterValue(string id, string name, string otherName) + { + return null; + } + + /// + /// An abstraction of the call to Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost ResolvePath + /// that simply retuns the path passed in. + /// + public string ResolvePath(string path) + { + return path; + } + + /// + /// An abstraction of the call to Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost TemplateFile + /// that returns null. + /// + public string TemplateFile + { + get + { + return null; + } + } + + /// + /// Returns null. + /// + public IServiceProvider AsIServiceProvider() + { + return null; + } +} + +/// +/// Responsible for encapsulating the constants defined in Metadata +/// +public static class MetadataConstants +{ + public const string EDMX_NAMESPACE_V1 = "http://schemas.microsoft.com/ado/2007/06/edmx"; + public const string EDMX_NAMESPACE_V2 = "http://schemas.microsoft.com/ado/2008/10/edmx"; + + + public const string CSDL_EXTENSION = ".csdl"; + public const string CSDL_NAMESPACE_V1 = "http://schemas.microsoft.com/ado/2006/04/edm"; + public const string CSDL_NAMESPACE_V2 = "http://schemas.microsoft.com/ado/2008/09/edm"; + public const string CSDL_EDMX_SECTION_NAME = "ConceptualModels"; + public const string CSDL_ROOT_ELEMENT_NAME = "Schema"; + public const string EDM_ANNOTATION_09_02 = "http://schemas.microsoft.com/ado/2009/02/edm/annotation"; + + public const string SSDL_EXTENSION = ".ssdl"; + public const string SSDL_NAMESPACE_V1 = "http://schemas.microsoft.com/ado/2006/04/edm/ssdl"; + public const string SSDL_NAMESPACE_V2 = "http://schemas.microsoft.com/ado/2009/02/edm/ssdl"; + public const string SSDL_EDMX_SECTION_NAME = "StorageModels"; + public const string SSDL_ROOT_ELEMENT_NAME = "Schema"; + + public const string MSL_EXTENSION = ".msl"; + public const string MSL_NAMESPACE_V1 = "urn:schemas-microsoft-com:windows:storage:mapping:CS"; + public const string MSL_NAMESPACE_V2 = "http://schemas.microsoft.com/ado/2008/09/mapping/cs"; + public const string MSL_EDMX_SECTION_NAME = "Mappings"; + public const string MSL_ROOT_ELEMENT_NAME = "Mapping"; +} +#> \ No newline at end of file diff --git a/Website/LOC.Website.Common/CodeTemplates/Scaffolders/EntityMetadata/EntityMetadata.ps1 b/Website/LOC.Website.Common/CodeTemplates/Scaffolders/EntityMetadata/EntityMetadata.ps1 new file mode 100644 index 000000000..53541e4cb --- /dev/null +++ b/Website/LOC.Website.Common/CodeTemplates/Scaffolders/EntityMetadata/EntityMetadata.ps1 @@ -0,0 +1,25 @@ +[T4Scaffolding.Scaffolder(Description = "Generates metadata classes and associated partial classes to pair with EntityFramework-generated entities.")][CmdletBinding()] +param( + [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$Edmx, + [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$Model, + [string]$Project, + [string]$CodeLanguage, + [string[]]$TemplateFolders, + [switch]$Force = $false +) + +$modelPath = (Get-Project $Project).Properties.Item("FullPath").Value, 'Models\' -join "" +$outputPath = 'Models\Metadata\', $Model, 'Metadata' -join "" +$namespace = (Get-Project $Project).Properties.Item("DefaultNamespace").Value, '.Models' -join "" +$edmxFullPath = $modelPath, $Edmx, '.edmx' -join "" + +write-host 'Attempting to create metadata for', $Model, 'in', $Edmx , '...' + +Add-ProjectItemViaTemplate $outputPath ` + -Template EntityMetadataHelperTemplate ` + -Model @{ Namespace = $namespace; InputFileName = $edmxFullPath ; EntityName=$Model} ` + -SuccessMessage "Created metadata at {0}" ` + -TemplateFolders $TemplateFolders ` + -Project $Project ` + -CodeLanguage $CodeLanguage ` + -Force:$Force \ No newline at end of file diff --git a/Website/LOC.Website.Common/CodeTemplates/Scaffolders/EntityMetadata/EntityMetadataHelperTemplate.cs.t4 b/Website/LOC.Website.Common/CodeTemplates/Scaffolders/EntityMetadata/EntityMetadataHelperTemplate.cs.t4 new file mode 100644 index 000000000..b1dd0adff --- /dev/null +++ b/Website/LOC.Website.Common/CodeTemplates/Scaffolders/EntityMetadata/EntityMetadataHelperTemplate.cs.t4 @@ -0,0 +1,152 @@ +<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> +<#@ include file="EF.Utility.CS.ttinclude"#> +<#@ output extension=".cs"#> +<# +CodeGenerationTools code = new CodeGenerationTools(this); +MetadataLoader loader = new MetadataLoader(this); +CodeRegion region = new CodeRegion(this, 1); +MetadataTools ef = new MetadataTools(this); + +// create our item collection from the specified edmx +EdmItemCollection ItemCollection = loader.CreateEdmItemCollection(Model.InputFileName); + +// find our entity from the pool +var entity = ItemCollection.GetItems().Where(e => e.Name == Model.EntityName).First(); + +#> + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace <#=code.EscapeNamespace(Model.Namespace)#> +{ +[MetadataType(typeof(<#=code.Escape(entity)#>Metadata))] +<#=Accessibility.ForType(entity)#> <#=code.SpaceAfter(code.AbstractOption(entity))#>partial class <#=code.Escape(entity)#><#=code.StringBefore(" : ", code.Escape(entity.BaseType))#> { } + +<#=Accessibility.ForType(entity)#> <#=code.SpaceAfter(code.AbstractOption(entity))#>partial class <#=code.Escape(entity)#>Metadata<#=code.StringBefore(" : ", code.Escape(entity.BaseType))#> + { +<# + var propertiesWithDefaultValues = entity.Properties.Where(p => p.TypeUsage.EdmType is PrimitiveType && p.DeclaringType == entity && p.DefaultValue != null); + var collectionNavigationProperties = entity.NavigationProperties.Where(np => np.DeclaringType == entity && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many); + var complexProperties = entity.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == entity); + + var primitiveProperties = entity.Properties.Where(p => p.TypeUsage.EdmType is PrimitiveType && p.DeclaringType == entity); + if (primitiveProperties.Any()) + { + foreach (var edmProperty in primitiveProperties) + { + WriteProperty(code, edmProperty); + } + } + + if (complexProperties.Any()) + { +#> + +<# + foreach(var complexProperty in complexProperties) + { + WriteProperty(code, complexProperty); + } + } + + var navigationProperties = entity.NavigationProperties.Where(np => np.DeclaringType == entity); + if (navigationProperties.Any()) + { +#> + +<# + foreach (var navigationProperty in navigationProperties) + { + WriteNavigationProperty(code, navigationProperty); + } + } +#> + } +} + +<#+ + void WriteProperty(CodeGenerationTools code, EdmProperty edmProperty) +{ + WriteProperty(Accessibility.ForProperty(edmProperty), + code.Escape(edmProperty.TypeUsage), + code.Escape(edmProperty), + edmProperty.Nullable, + GetMaxLengthValue(edmProperty), + code.SpaceAfter(Accessibility.ForGetter(edmProperty)), + code.SpaceAfter(Accessibility.ForSetter(edmProperty))); +} + +void WriteNavigationProperty(CodeGenerationTools code, NavigationProperty navigationProperty) +{ + var endType = code.Escape(navigationProperty.ToEndMember.GetEntityType()); + WriteProperty(PropertyVirtualModifier(Accessibility.ForProperty(navigationProperty)), + navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType, + code.Escape(navigationProperty), + true, + 0, + code.SpaceAfter(Accessibility.ForGetter(navigationProperty)), + code.SpaceAfter(Accessibility.ForSetter(navigationProperty))); + +} + +int GetMaxLengthValue (EdmProperty property) +{ + foreach (Facet facet in property.TypeUsage.Facets) + { + if (facet.Name == "MaxLength" && facet.Value != null && facet.IsUnbounded == false) + { + return (int)facet.Value; + } + } + return 0; +} + +void WriteProperty(string accessibility, string type, string name, bool nullableField, int maxLength, string getterAccessibility, string setterAccessibility) +{ + string displayName = AddSpacesToSentence(name.Replace("ID","")); +#> + [DisplayName("<#=displayName#>")]<#=GetRequiredText(nullableField)#><#=GetMaxLengthText(maxLength)#> + <#=accessibility#> <#=type#> <#=name#> { <#=getterAccessibility#>get; <#=setterAccessibility#>set; } +<#+ +} + +string GetMaxLengthText(int maxLength) +{ + return maxLength > 0 ? string.Format("{0} [MaxLength({1})]", Environment.NewLine, maxLength) : string.Empty; +} + +string GetRequiredText(bool nullableField) +{ + return !nullableField ? string.Format("{0} [Required]", Environment.NewLine) : string.Empty; +} + +string AddSpacesToSentence(string titleString) +{ + if (string.IsNullOrEmpty(titleString)) + return string.Empty; + + StringBuilder sb = new StringBuilder(titleString.Length * 2); + + // add the first char to the string + sb.Append(titleString[0].ToString().ToUpper()); + + for (int i = 1; i < titleString.Length; i++) + { + if (char.IsUpper(titleString[i])) + sb.Append(' '); + sb.Append(titleString[i]); + } + + return sb.ToString(); +} + +string PropertyVirtualModifier(string accessibility) +{ + return accessibility + (accessibility != "private" ? " virtual" : ""); +} + + +#> diff --git a/Website/LOC.Website.Common/Contexts/ILOCDatabaseUpdater.cs b/Website/LOC.Website.Common/Contexts/ILOCDatabaseUpdater.cs new file mode 100644 index 000000000..24e376cb2 --- /dev/null +++ b/Website/LOC.Website.Common/Contexts/ILOCDatabaseUpdater.cs @@ -0,0 +1,7 @@ +namespace LOC.Website.Common.Contexts +{ + public interface ILOCDatabaseUpdater + { + void Update(); + } +} diff --git a/Website/LOC.Website.Common/Contexts/LOCContext.cs b/Website/LOC.Website.Common/Contexts/LOCContext.cs new file mode 100644 index 000000000..7a86f09b9 --- /dev/null +++ b/Website/LOC.Website.Common/Contexts/LOCContext.cs @@ -0,0 +1,97 @@ +using LOC.Core.Model.PvpServer; + +namespace LOC.Website.Common.Contexts +{ + using System.Data.Entity; + using Core; + using Core.GameServer; + using Core.Model.Account; + using Core.Model.GameServer; + using Core.Model.Sales; + using Core.Model.Server; + using Core.Model.Server.GameServer.CaptureThePig.Stats; + using Core.Model.Server.GameServer.Dominate.Stats; + using Core.Model.Server.GameServer.MineKart; + using Core.Model.Server.PvpServer; + using Core.Model.Server.PvpServer.Clan; + + public class LocContext : DbContext + { + public DbSet Accounts { get; set; } + public DbSet Bans { get; set; } + public DbSet Unbans { get; set; } + public DbSet Logins { get; set; } + public DbSet IpAddresses { get; set; } + public DbSet MacAddresses { get; set; } + public DbSet Ranks { get; set; } + public DbSet PvpSalesPackages { get; set; } + public DbSet PvpClasses { get; set; } + public DbSet BenefitItems { get; set; } + public DbSet Weapons { get; set; } + public DbSet Skills { get; set; } + public DbSet Items { get; set; } + public DbSet Pets { get; set; } + public DbSet PetExtras { get; set; } + public DbSet LogEntries { get; set; } + public DbSet Servers { get; set; } + public DbSet ServerHistory { get; set; } + public DbSet ServerStatuses { get; set; } + public DbSet Transactions { get; set; } + public DbSet SalesPackages { get; set; } + public DbSet PvpTransactions { get; set; } + + public DbSet DominatePlayerStats { get; set; } + public DbSet CaptureThePigPlayerStats { get; set; } + + public DbSet MineKarts { get; set; } + + public DbSet Clans { get; set; } + public DbSet ClanRoles { get; set; } + public DbSet ClanTerritories { get; set; } + public DbSet Alliances { get; set; } + public DbSet Wars { get; set; } + + public DbSet Fields { get; set; } + public DbSet FieldOres { get; set; } + public DbSet FieldMonsters { get; set; } + + public DbSet FishCatches { get; set; } + + public DbSet FilteredWords { get; set; } + + protected override void OnModelCreating(DbModelBuilder modelBuilder) + { + modelBuilder.Entity() + .HasMany(x => x.DominateStats) + .WithMany(); + + modelBuilder.Entity() + .HasMany(x => x.IpAddresses) + .WithMany(); + + modelBuilder.Entity() + .HasMany(x => x.CaptureThePigStats) + .WithRequired(); + + modelBuilder.Entity() + .HasMany(x => x.MacAddresses) + .WithMany(); + + modelBuilder.Entity() + .HasOptional(x => x.Clan) + .WithMany(x => x.Members); + + modelBuilder.Entity() + .HasMany(x => x.Alliances) + .WithMany(); + + modelBuilder.Entity() + .HasMany(x => x.Wars) + .WithMany(); + + modelBuilder.Entity() + .HasMany(x => x.Territories) + .WithRequired(x => x.Clan); + } + } +} diff --git a/Website/LOC.Website.Common/Contexts/LOCContextConfiguration.cs b/Website/LOC.Website.Common/Contexts/LOCContextConfiguration.cs new file mode 100644 index 000000000..bc30930ed --- /dev/null +++ b/Website/LOC.Website.Common/Contexts/LOCContextConfiguration.cs @@ -0,0 +1,82 @@ +namespace LOC.Website.Common.Contexts +{ + using System; + using System.Data.Entity.Migrations; + using System.Linq; + using Core; + using Core.GameServer; + using Core.Model.Account; + using Core.Model.Server.PvpServer.Clan; + + internal sealed class LocContextConfiguration : DbMigrationsConfiguration + { + public LocContextConfiguration() + { + AutomaticMigrationsEnabled = true; + AutomaticMigrationDataLossAllowed = true; + } + + protected override void Seed(LocContext context) + { + AddDefaultRanks(context); + AddDefaultServerStatuses(context); + AddDefaultLogEntry(context); + AddDefaultClanRoles(context); + + base.Seed(context); + } + + private static void AddDefaultServerStatuses(LocContext context) + { + var serverStatuses = context.ServerStatuses.ToList(); + + if (!serverStatuses.Any()) + { + context.ServerStatuses.Add(new ServerStatus { Name = "Offline" }); + context.ServerStatuses.Add(new ServerStatus { Name = "Online" }); + + context.SaveChanges(); + } + } + + private static void AddDefaultRanks(LocContext context) + { + var ranks = context.Ranks.ToList(); + + if (!ranks.Any()) + { + context.Ranks.Add(new Rank { Name = "ALL" }); + context.Ranks.Add(new Rank { Name = "ULTRA" }); + context.Ranks.Add(new Rank { Name = "HELPER" }); + context.Ranks.Add(new Rank { Name = "MODERATOR" }); + context.Ranks.Add(new Rank { Name = "ADMIN" }); + context.Ranks.Add(new Rank { Name = "DEVELOPER" }); + context.Ranks.Add(new Rank { Name = "OWNER" }); + + context.SaveChanges(); + } + } + + private static void AddDefaultClanRoles(LocContext context) + { + var clanRoles = context.ClanRoles.ToList(); + + if (!clanRoles.Any()) + { + context.ClanRoles.Add(new ClanRole { Name = "NONE" }); + context.ClanRoles.Add(new ClanRole { Name = "RECRUIT" }); + context.ClanRoles.Add(new ClanRole { Name = "MEMBER" }); + context.ClanRoles.Add(new ClanRole { Name = "ADMIN" }); + context.ClanRoles.Add(new ClanRole { Name = "LEADER" }); + + context.SaveChanges(); + } + } + + private void AddDefaultLogEntry(LocContext context) + { + context.LogEntries.Add(new LogEntry {Date = DateTime.Now, Category = "Log", Message = "test"}); + context.SaveChanges(); + } + } +} diff --git a/Website/LOC.Website.Common/Contexts/LOCDatabaseUpdater.cs b/Website/LOC.Website.Common/Contexts/LOCDatabaseUpdater.cs new file mode 100644 index 000000000..f8fa466da --- /dev/null +++ b/Website/LOC.Website.Common/Contexts/LOCDatabaseUpdater.cs @@ -0,0 +1,13 @@ +namespace LOC.Website.Common.Contexts +{ + using System.Data.Entity.Migrations; + + public class LOCDatabaseUpdater + { + public void Update() + { + var migrator = new DbMigrator(new LocContextConfiguration()); + migrator.Update(); + } + } +} diff --git a/Website/LOC.Website.Common/Data/INautilusRepositoryFactory.cs b/Website/LOC.Website.Common/Data/INautilusRepositoryFactory.cs new file mode 100644 index 000000000..1195cbdd9 --- /dev/null +++ b/Website/LOC.Website.Common/Data/INautilusRepositoryFactory.cs @@ -0,0 +1,9 @@ +namespace LOC.Website.Common.Data +{ + using Core.Data; + + public interface INautilusRepositoryFactory + { + IRepository CreateRepository(); + } +} diff --git a/Website/LOC.Website.Common/DisplayServer.cs b/Website/LOC.Website.Common/DisplayServer.cs new file mode 100644 index 000000000..6f34ad99e --- /dev/null +++ b/Website/LOC.Website.Common/DisplayServer.cs @@ -0,0 +1,64 @@ +namespace LOC.Website.Common +{ + using System.Collections.Generic; + using System.Linq; + using Core.Model.GameServer; + + public class DisplayServer + { + private readonly LinkedList _tps; + private readonly LinkedList _memUsage; + + public DisplayServer(Server server, ServerHistory serverHistory, long started) + { + _tps = new LinkedList(); + _memUsage = new LinkedList(); + + Name = server.Name; + PlayerLimit = server.PlayerLimit; + Address = server.ConnectionAddress; + TimeStarted = started; + LastUpdate = serverHistory.Time; + _tps.AddLast(new [] { 0, serverHistory.TicksPerSecond * 20 }); + _memUsage.AddLast(new[] { 0, serverHistory.MemoryUsage }); + } + + public void Update(ServerHistory serverHistory) + { + LastUpdate = serverHistory.Time; + + if (_tps.Count > 30) + { + _tps.RemoveFirst(); + } + + if (_memUsage.Count > 30) + { + _memUsage.RemoveFirst(); + } + + _tps.AddLast(new[] { _tps.Count * 15, serverHistory.TicksPerSecond * 20 }); + _memUsage.AddLast(new[] { _tps.Count * 15, serverHistory.MemoryUsage }); + } + + public string Name { get; private set; } + + public int PlayerLimit { get; private set; } + + public string Address { get; private set; } + + public long TimeStarted { get; private set; } + + public long LastUpdate { get; private set; } + + public List TicksPerSecond + { + get { return _tps.ToList(); } + } + + public List MemoryUsage + { + get { return _memUsage.ToList(); } + } + } +} diff --git a/Website/LOC.Website.Common/DominateStatsDisplay.cs b/Website/LOC.Website.Common/DominateStatsDisplay.cs new file mode 100644 index 000000000..0688e3fd9 --- /dev/null +++ b/Website/LOC.Website.Common/DominateStatsDisplay.cs @@ -0,0 +1,13 @@ +namespace LOC.Website.Common +{ + using System.Collections.Generic; + using Core.Model.Server.GameServer.Dominate.Stats; + + public class DominateStatsDisplay + { + public List MostPoints { get; set; } + public List MostKills { get; set; } + public List MostAssists { get; set; } + public List MostDeaths { get; set; } + } +} diff --git a/Website/LOC.Website.Common/GameServerMonitor.cs b/Website/LOC.Website.Common/GameServerMonitor.cs new file mode 100644 index 000000000..85045f8c3 --- /dev/null +++ b/Website/LOC.Website.Common/GameServerMonitor.cs @@ -0,0 +1,161 @@ +namespace LOC.Website.Common +{ + using System; + using System.Collections.Generic; + using System.Data.Entity; + using System.Linq; + using System.Timers; + using Contexts; + using Core.Model.Account; + using Core.Model.GameServer; + using Core.Tokens.Client; + + public class GameServerMonitor : IGameServerMonitor + { + public static GameServerMonitor Instance = new GameServerMonitor(); + + private readonly Dictionary _displayServers; + private readonly Dictionary _activeServerStatuses; + private readonly Dictionary _activeServerUpdates; + private readonly Dictionary _accountServerMapping; + + private readonly Timer _cleanUpTimer; + + protected GameServerMonitor() + { + _displayServers = new Dictionary(); + _activeServerStatuses = new Dictionary(); + _activeServerUpdates = new Dictionary(); + _accountServerMapping = new Dictionary(); + + _cleanUpTimer = new Timer(); + _cleanUpTimer.Interval = 60000; + _cleanUpTimer.Elapsed += CleanUpTick; + _cleanUpTimer.AutoReset = true; + } + + public List ServerStatuses { get { return _displayServers.Values.ToList(); } } + + public void Track(Server server) + { + ClearServerUpdates(server.ServerId); + + _displayServers.Remove(server.ServerId); + _displayServers.Add(server.ServerId, new DisplayServer(server, new ServerHistory(), (long)new TimeSpan(DateTime.Now.ToUniversalTime().Ticks - new DateTime(1970, 1, 1).Ticks).TotalMilliseconds)); + + if (!_cleanUpTimer.Enabled) + { + _cleanUpTimer.Enabled = true; + _cleanUpTimer.Start(); + } + } + + public void UnTrack(Server server) + { + _activeServerUpdates.Remove(server.ServerId); + _displayServers.Remove(server.ServerId); + } + + public ServerUpdate GetServerUpdate(int serverId) + { + ServerUpdate serverUpdates; + _activeServerUpdates.TryGetValue(serverId, out serverUpdates); + + return serverUpdates; + } + + public ServerUpdate GetServerUpdatesFor(int serverId) + { + return GetServerUpdate(serverId); + } + + public void ClearServerUpdates(int serverId) + { + _activeServerUpdates.Remove(serverId); + _activeServerUpdates.Add(serverId, new ServerUpdate()); + } + + public void AccountChanged(int accountId) + { + if (_accountServerMapping.ContainsKey(accountId)) + { + int serverId; + if (_accountServerMapping.TryGetValue(accountId, out serverId)) + { + var serverUpdates = GetServerUpdate(serverId); + + if (serverUpdates != null) + { + using (var context = new LocContext()) + { + serverUpdates.ClientTokens.Add(new ClientToken(context.Accounts.Include(x => x.Rank).Include(x => x.PvpTransactions).Single(x => x.AccountId == accountId))); + } + } + } + } + } + + public void PlayerLoggedIn(Account account, int serverId) + { + _accountServerMapping.Remove(account.AccountId); + _accountServerMapping.Add(account.AccountId, serverId); + } + + public void PlayerLoggedOut(Account account) + { + int serverId; + + if (_accountServerMapping.TryGetValue(account.AccountId, out serverId)) + { + _accountServerMapping.Remove(account.AccountId); + + ServerUpdate serverUpdates; + _activeServerUpdates.TryGetValue(serverId, out serverUpdates); + + if (serverUpdates != null && serverUpdates.ClientTokens.Any(x => x.AccountId == account.AccountId)) + { + serverUpdates.ClientTokens.Remove(serverUpdates.ClientTokens.First(x => x.AccountId == account.AccountId)); + + _activeServerUpdates.Remove(serverId); + _activeServerUpdates.Add(serverId, serverUpdates); + } + } + } + + public void WikiItemChanged(int itemWikiId) + { + //throw new NotImplementedException(); + } + + public void WikiPlayerChanged(int playerWikiId) + { + //throw new NotImplementedException(); + } + + public void UpdateServerStatus(ServerHistory serverHistory) + { + _activeServerStatuses.Remove(serverHistory.ServerId); + _activeServerStatuses.Add(serverHistory.ServerId, serverHistory); + + if (_displayServers.Any(x => x.Key == serverHistory.ServerId)) + { + DisplayServer displayServer; + _displayServers.TryGetValue(serverHistory.ServerId, out displayServer); + + displayServer.Update(serverHistory); + } + } + + protected void CleanUpTick(object sender, EventArgs eventArgs) + { + var currentTimeSpan = new TimeSpan(DateTime.Now.ToUniversalTime().Ticks - new DateTime(1970, 1, 1).Ticks); + var deadServers = _activeServerStatuses.Where(x => currentTimeSpan.Subtract(TimeSpan.FromMilliseconds(x.Value.Time)).TotalMilliseconds > TimeSpan.FromMinutes(1).TotalMilliseconds).ToList(); + + foreach (var deadServer in deadServers) + { + _activeServerStatuses.Remove(deadServer.Key); + _displayServers.Remove(deadServer.Key); + } + } + } +} diff --git a/Website/LOC.Website.Common/IGameServerMonitor.cs b/Website/LOC.Website.Common/IGameServerMonitor.cs new file mode 100644 index 000000000..7beb0204e --- /dev/null +++ b/Website/LOC.Website.Common/IGameServerMonitor.cs @@ -0,0 +1,23 @@ +namespace LOC.Website.Common +{ + using System.Collections.Generic; + using Core.Model.Account; + using Core.Model.GameServer; + + public interface IGameServerMonitor + { + List ServerStatuses { get; } + void Track(Server server); + void UnTrack(Server server); + ServerUpdate GetServerUpdatesFor(int serverId); + void UpdateServerStatus(ServerHistory serverHistory); + void ClearServerUpdates(int serverId); + void AccountChanged(int accountId); + void PlayerLoggedIn(Account account, int serverId); + void PlayerLoggedOut(Account account); + + void WikiItemChanged(int itemWikiId); + + void WikiPlayerChanged(int playerWikiId); + } +} diff --git a/Website/LOC.Website.Common/ILogger.cs b/Website/LOC.Website.Common/ILogger.cs new file mode 100644 index 000000000..3b2e005e7 --- /dev/null +++ b/Website/LOC.Website.Common/ILogger.cs @@ -0,0 +1,7 @@ +namespace LOC.Website.Common +{ + public interface ILogger + { + void Log(string category, string message); + } +} diff --git a/Website/LOC.Website.Common/LOC.Website.Common.csproj b/Website/LOC.Website.Common/LOC.Website.Common.csproj new file mode 100644 index 000000000..2f4ed5aca --- /dev/null +++ b/Website/LOC.Website.Common/LOC.Website.Common.csproj @@ -0,0 +1,148 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {B112BCCF-A0E9-497C-9821-FF408F1D0A76} + Library + Properties + LOC.Website.Common + LOC.Website.Common + v4.0 + + + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + False + ..\packages\EntityFramework.5.0.0\lib\net40\EntityFramework.dll + + + ..\Libraries\LinqKit.dll + + + False + ..\packages\Newtonsoft.Json.4.5.2\lib\net40\Newtonsoft.Json.dll + + + ..\packages\structuremap.2.6.4.1\lib\net40\StructureMap.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + + + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {A994B28E-8AAA-4A53-BDFE-0E72F1B0F4AD} + LOC.Core + + + + + \ No newline at end of file diff --git a/Website/LOC.Website.Common/LOC.Website.Common.csproj.user b/Website/LOC.Website.Common/LOC.Website.Common.csproj.user new file mode 100644 index 000000000..55f44b95f --- /dev/null +++ b/Website/LOC.Website.Common/LOC.Website.Common.csproj.user @@ -0,0 +1,6 @@ + + + + ShowAllFiles + + \ No newline at end of file diff --git a/Website/LOC.Website.Common/Logger.cs b/Website/LOC.Website.Common/Logger.cs new file mode 100644 index 000000000..c3c114c38 --- /dev/null +++ b/Website/LOC.Website.Common/Logger.cs @@ -0,0 +1,31 @@ +namespace LOC.Website.Common +{ + using System; + using Contexts; + using Core; + using Data; + + public class Logger : ILogger + { + private readonly INautilusRepositoryFactory _nautilusRepositoryFactory; + + public Logger(INautilusRepositoryFactory nautilusRepositoryFactory) + { + _nautilusRepositoryFactory = nautilusRepositoryFactory; + } + + public void Log(string category, string message) + { + using (var repository = _nautilusRepositoryFactory.CreateRepository()) + { + repository.Add(new LogEntry + { + Date = DateTime.Now, + Category = category, + Message = message + }); + repository.CommitChanges();; + } + } + } +} diff --git a/Website/LOC.Website.Common/Models/AccountAdministrator.cs b/Website/LOC.Website.Common/Models/AccountAdministrator.cs new file mode 100644 index 000000000..c1c08c0ee --- /dev/null +++ b/Website/LOC.Website.Common/Models/AccountAdministrator.cs @@ -0,0 +1,579 @@ +namespace LOC.Website.Common.Models +{ + using System; + using System.Collections.Generic; + using System.Data.Entity; + using System.Linq; + using Core; + using Core.Data; + using Core.Model.Account; + using Core.Model.Sales; + using Core.Model.Server.PvpServer; + using Core.Tokens; + using Core.Tokens.Client; + using Data; + + public class AccountAdministrator : IAccountAdministrator + { + private readonly INautilusRepositoryFactory _repositoryFactory; + private readonly IGameServerMonitor _gameServerMonitor; + + private readonly object _transactionLock = new object(); + + public AccountAdministrator(INautilusRepositoryFactory nautilusRepositoryFactory) + { + _repositoryFactory = nautilusRepositoryFactory; + _gameServerMonitor = GameServerMonitor.Instance; + } + + public List GetAccountNames() + { + using (var repository = _repositoryFactory.CreateRepository()) + { + return repository.GetAll().Select(x => x.Name).ToList(); + } + } + + public List GetAllAccountsMatching() + { + using (var repository = _repositoryFactory.CreateRepository()) + { + return repository.GetAll().Include(x => x.Rank).ToList(); + } + } + + public List GetAllAccountsMatching(string name) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + return repository.GetAll().Where(c => c.Name.ToUpper().Contains(name.ToUpper())).Include(x => x.Rank).ToList(); + } + } + + public List GetAllAccountNamesMatching(string name) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + return repository.GetAll().Where(c => c.Name.ToUpper().Contains(name.ToUpper())).Select(y => y.Name).ToList(); + } + } + + public Account Login(LoginRequestToken loginToken) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = + repository.Where(x => x.Name == loginToken.Name) + .Include(x => x.Rank) + .Include(x => x.Clan) + .Include(x => x.ClanRole) + .Include(x => x.CustomBuilds) + .Include(x => x.FishCatches) + .Include(x => x.IpAddresses) + .Include(x => x.PvpTransactions) + .Include(x => x.AccountTransactions) + .Include(x => x.Pets) + .Include(x => x.Punishments) + .FirstOrDefault() ?? CreateAccount(loginToken, repository); + + // Expire punishments + if (account.Punishments != null) + { + foreach (var expiredPunishment in account.Punishments.Where(x => x.Active && (x.Duration - 0d) > 0 && TimeUtil.GetCurrentMilliseconds() > (x.Time + (x.Duration * 3600000)))) + { + expiredPunishment.Active = false; + } + } + + // Expire ranks + if ((account.Rank.Name == "DIAMOND" || account.Rank.Name == "EMERALD") && !account.RankPerm && DateTime.Now.CompareTo(account.RankExpire) >= 0) + { + account.Rank = repository.Where(x => x.Name == "ALL").First(); + repository.Attach(account.Rank); + } + + var loginAddress = repository.Where(x => x.Address == loginToken.IpAddress).FirstOrDefault() ?? CreateIpAddress(loginToken, repository); + + repository.Attach(loginAddress); + repository.Attach(account); + repository.Edit(account); + + account.IpAddresses.Add(loginAddress); + + repository.CommitChanges(); + + // _gameServerMonitor.PlayerLoggedIn(account, loginToken.Server.ServerId); + + return account; + } + } + + public void Logout(string name) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = GetAccountByName(name, repository); + + if (account.Logins.Any()) + { + account.LastLogin = account.Logins.OrderBy(x => x.Time).Last().Time; + account.TotalPlayingTime += DateTime.Now.Subtract(TimeSpan.FromTicks(account.LastLogin)).Ticks; + } + + repository.CommitChanges(); + + _gameServerMonitor.PlayerLoggedOut(account); + } + } + + public Account GetAccountByName(string name) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + return GetAccountByName(name, repository); + } + } + + public Account GetAccountById(int id) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + return GetAccountByName(repository.GetAll().First(x => x.AccountId == id).Name, repository); + } + } + + public Account CreateAccount(string name) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = repository.Add(new Account + { + Gems = 1200, + Name = name, + Rank = repository.Where(x => x.RankId == 1).First(), + LastVote = DateTime.Today.Subtract(TimeSpan.FromDays(5)), + RankExpire = DateTime.Now + }); + repository.CommitChanges(); + + return account; + } + } + + public Account UpdateAccount(Account account) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + repository.Edit(account); + repository.CommitChanges(); + } + + return account; + } + + public PunishmentResponse Punish(PunishToken punish) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = repository.Where(x => x.Name == punish.Target).Include(x => x.Rank).FirstOrDefault(); + + if (account == null) + return PunishmentResponse.AccountDoesNotExist; + + var punisher = repository.Where(x => x.Name == punish.Admin).Include(x => x.Rank).FirstOrDefault(); + + if (punisher == null) + return PunishmentResponse.NotPunished; + + if (punisher.Rank.RankId <= account.Rank.RankId) + return PunishmentResponse.InsufficientPrivileges; + + var punishment = new Punishment + { + UserId = account.AccountId, + Admin = punish.Admin, + Category = punish.Category, + Sentence = punish.Sentence, + Time = punish.Time, + Reason = punish.Reason, + Duration = punish.Duration, + Severity = punish.Severity, + Active = true + }; + + if (account.Punishments == null) + account.Punishments = new List(); + + account.Punishments.Add(punishment); + repository.Edit(account); + + repository.CommitChanges(); + } + + return PunishmentResponse.Punished; + } + + public PunishmentResponse RemovePunishment(RemovePunishmentToken token) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = repository.Where(x => x.Name == token.Target).Include(x => x.Punishments).FirstOrDefault(); + + if (account == null) + return PunishmentResponse.AccountDoesNotExist; + + if (account.Punishments == null || account.Punishments.Count == 0) + return PunishmentResponse.NotPunished; + + var activePunishment = account.Punishments.FirstOrDefault(x => x.PunishmentId == token.PunishmentId && x.Active); + + if (activePunishment == null) + return PunishmentResponse.NotPunished; + + var punishment = repository.Where(x => x.UserId == account.AccountId && x.PunishmentId == token.PunishmentId && x.Active).First(); + punishment.Active = false; + punishment.Removed = true; + punishment.RemoveAdmin = token.Admin; + punishment.RemoveTime = DateTime.Now.Ticks; + punishment.RemoveReason = token.Reason; + + repository.Edit(punishment); + + repository.CommitChanges(); + } + + return PunishmentResponse.PunishmentRemoved; + } + + public string PurchaseGameSalesPackage(PurchaseToken token) + { + lock (_transactionLock) + { + try + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = + repository.Where(x => x.Name == token.AccountName) + .Include(x => x.PvpTransactions) + .First(); + + var salesPackage = + repository.Where(x => x.GameSalesPackageId == token.SalesPackageId) + .FirstOrDefault(); + + if (account == null || salesPackage == null) + return TransactionResponse.Failed.ToString(); + + if (account.Gems < salesPackage.Gems) + return TransactionResponse.InsufficientFunds.ToString(); + + var accountTransaction = new GameTransaction + { + Account = account, + GameSalesPackageId = salesPackage.GameSalesPackageId, + Gems = salesPackage.Gems, + }; + + repository.Attach(account); + repository.Edit(account); + + if (account.PvpTransactions == null) + account.PvpTransactions = new List {accountTransaction}; + else + { + account.PvpTransactions.Add(accountTransaction); + } + + account.Gems -= salesPackage.Gems; + + repository.CommitChanges(); + + return TransactionResponse.Success.ToString(); + } + } + catch (Exception exception) + { + return TransactionResponse.Failed.ToString() + ":" + exception.Message; + } + } + } + + public bool AccountExists(string name) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + return repository.Any(x => x.Name == name); + } + } + + public void SaveCustomBuild(CustomBuildToken token) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = + repository.Where(x => x.Name == token.PlayerName).Include(x => x.CustomBuilds).First(); + + var customBuild = + account.CustomBuilds.FirstOrDefault( + x => x.PvpClassId == token.PvpClassId && x.CustomBuildNumber == token.CustomBuildNumber); + + if (customBuild == null) + { + customBuild = repository.Add(token.GetCustomBuild()); + account.CustomBuilds.Add(customBuild); + } + else + { + token.UpdateCustomBuild(customBuild); + repository.Edit(customBuild); + } + + if (customBuild.Active) + { + foreach ( + var otherClassBuild in + account.CustomBuilds.Where( + x => + x.PvpClassId == token.PvpClassId && x.CustomBuildNumber != customBuild.CustomBuildNumber) + .ToList()) + { + otherClassBuild.Active = false; + repository.Edit(otherClassBuild); + } + } + + repository.Edit(account); + + repository.CommitChanges(); + } + } + + public void Ignore(string accountName, string ignoredPlayer) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = repository.Where(x => x.Name == accountName).First(); + + account.IgnoredPlayers.Add(ignoredPlayer); + + repository.CommitChanges(); + } + } + + public void RemoveIgnore(string accountName, string ignoredPlayer) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = repository.Where(x => x.Name == accountName).First(); + + account.IgnoredPlayers.Remove(ignoredPlayer); + + repository.CommitChanges(); + } + } + + public string PurchaseUnknownSalesPackage(UnknownPurchaseToken token) + { + lock (_transactionLock) + { + try + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = + repository.Where(x => x.Name == token.AccountName) + .Include(x => x.AccountTransactions) + .First(); + + if (account == null) + return TransactionResponse.Failed.ToString(); + + if (account.Gems < token.Cost) + return TransactionResponse.InsufficientFunds.ToString(); + + var accountTransaction = new AccountTransaction + { + Account = account, + SalesPackageName = token.SalesPackageName, + Gems = token.Cost, + }; + + repository.Attach(account); + repository.Edit(account); + + if (account.AccountTransactions == null) + account.AccountTransactions = new List { accountTransaction }; + else + { + account.AccountTransactions.Add(accountTransaction); + } + + account.Gems -= token.Cost; + + + repository.CommitChanges(); + + return TransactionResponse.Success.ToString(); + } + } + catch (Exception exception) + { + return TransactionResponse.Failed.ToString() + ":" + exception.Message; + } + } + } + + public string UpdateRank(RankUpdateToken token) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = repository.Where(x => String.Equals(x.Name, token.Name)).Include(x => x.Rank).FirstOrDefault(); + var rank = repository.Where(x => String.Equals(x.Name, token.Rank)).FirstOrDefault(); + + if (account == null) + return "ALL"; + + if (rank == null) + return account.Rank.ToString(); + + account.Rank = rank; + account.RankExpire = DateTime.Now.AddMonths(1); + account.RankPerm = token.Perm; + + repository.CommitChanges(); + + return rank.ToString(); + } + } + + public void RemoveBan(RemovePunishmentToken token) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = repository.Where(x => x.Name == token.Target).Include(x => x.Punishments).FirstOrDefault(); + + if (account == null) + return; + + if (account.Punishments == null || account.Punishments.Count == 0) + return; + + var activePunishments = account.Punishments.Where(x => x.Active); + + if (!activePunishments.Any()) + return; + + foreach (Punishment punishment in activePunishments) + { + punishment.Active = false; + punishment.Removed = true; + punishment.RemoveAdmin = token.Admin; + punishment.RemoveTime = DateTime.Now.Ticks; + punishment.RemoveReason = token.Reason; + + repository.Edit(punishment); + } + + repository.CommitChanges(); + } + } + + public void ApplySalesPackage(SalesPackage salesPackage, int accountId, decimal gross, decimal fee) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = repository.Where(x => x.AccountId == accountId).Include(x => x.Transactions).First(); + + var accountTransaction = new Transaction {Account = account, SalesPackage = salesPackage, Fee = fee, Profit = (gross - fee), Time = DateTime.Now}; + + repository.Attach(salesPackage); + + repository.Attach(account); + repository.Edit(account); + + if (account.Transactions == null) + account.Transactions = new List(); + + account.Transactions.Add(accountTransaction); + account.Gems += salesPackage.Gems; + account.Donated = true; + account.RankPerm = salesPackage.RankPerm; + + if (salesPackage.Rank.RankId != 1 && !salesPackage.RankPerm) + { + account.Rank = salesPackage.Rank; + account.RankExpire = DateTime.Now.AddDays(salesPackage.Length); + } + + repository.CommitChanges(); + } + } + + protected Account GetAccountByName(string name, IRepository repository) + { + return repository.Where(x => x.Name == name) + .Include(x => x.Rank) + .Include(x => x.Clan) + .Include(x => x.ClanRole) + .Include(x => x.CustomBuilds) + .Include(x => x.FishCatches) + .Include(x => x.PvpTransactions) + .Include(x => x.Pets) + .Include(x => x.Punishments) + .FirstOrDefault(); + } + + protected Account CreateAccount(LoginRequestToken loginToken, IRepository repository) + { + var newAccount = new Account + { + Name = loginToken.Name, + Rank = repository.Where(x => x.RankId == 1).First(), + Gems = 0, + Transactions = new List(), + PvpTransactions = new List(), + IpAddresses = new List(), + MacAddresses = new List(), + Logins = new List(), + CustomBuilds = new List(), + LastVote = DateTime.Today.Subtract(TimeSpan.FromDays(5)), + RankExpire = DateTime.Now + }; + + newAccount = repository.Add(newAccount); + repository.CommitChanges(); + + newAccount = repository.Where(x => x.AccountId == newAccount.AccountId) + .Include(x => x.Rank) + .Include(x => x.Punishments) + .Include(x => x.Clan) + .Include(x => x.ClanRole) + .Include(x => x.CustomBuilds) + .Include(x => x.FishCatches) + .Include(x => x.PvpTransactions) + .Include(x => x.Pets) + .First(); + + return newAccount; + } + + protected LoginAddress CreateIpAddress(LoginRequestToken loginToken, IRepository repository) + { + var newLoginAddress = new LoginAddress { Address = loginToken.IpAddress }; + + newLoginAddress = repository.Add(newLoginAddress); + repository.CommitChanges(); + + return newLoginAddress; + } + + protected void CreateMacAddress(LoginRequestToken loginToken, IRepository repository) + { + var newMacAddress = new MacAddress { Address = loginToken.MacAddress, Accounts = new List() }; + + repository.Add(newMacAddress); + repository.CommitChanges(); + } + } +} \ No newline at end of file diff --git a/Website/LOC.Website.Common/Models/AccountAdministrator.cs.rej b/Website/LOC.Website.Common/Models/AccountAdministrator.cs.rej new file mode 100644 index 000000000..59cd0b0b6 --- /dev/null +++ b/Website/LOC.Website.Common/Models/AccountAdministrator.cs.rej @@ -0,0 +1,17 @@ +--- AccountAdministrator.cs ++++ AccountAdministrator.cs +@@ -187,6 +190,6 @@ + { + UserId = account.AccountId, + AdminId = repository.Where(x => x.Name == punish.Admin).First().AccountId, +- PunishmentType = punish.PunishType, +- Time = DateTime.Now, ++ Category = punish.Category, ++ Date = punish.Time, + Reason = punish.Reason, +@@ -192,4 +195,4 @@ + Reason = punish.Reason, +- Duration = punish.Hours, ++ Level = punish.Level, + }; + diff --git a/Website/LOC.Website.Common/Models/CaptureThePigAdministrator.cs b/Website/LOC.Website.Common/Models/CaptureThePigAdministrator.cs new file mode 100644 index 000000000..fa209c534 --- /dev/null +++ b/Website/LOC.Website.Common/Models/CaptureThePigAdministrator.cs @@ -0,0 +1,103 @@ +namespace LOC.Website.Common.Models +{ + using System; + using System.Collections.Generic; + using System.Data.Entity; + using System.Linq; + using Core.Data; + using Core.Model.Account; + using Core.Model.Server.GameServer.CaptureThePig.Stats; + using Core.Tokens.Client; + using Data; + + public class CaptureThePigAdministrator : PvpAdministrator, ICaptureThePigAdministrator + { + public CaptureThePigAdministrator(INautilusRepositoryFactory repositoryFactory) : base(repositoryFactory) { } + + public List UploadStats(CaptureThePigGameStatsToken token) + { + var updateTokenList = new List(); + var pointsPerMinute = Math.Min(2 / (token.Length / 60000), 2); + + using (var repository = RepositoryFactory.CreateRepository()) + { + foreach (var playerStats in token.PlayerStats) + { + var account = repository.Where(x => x.Name == playerStats.Name).Include(x => x.CaptureThePigStats).First();; + var earnedPoints = (int)((playerStats.TimePlayed / 60000) * (pointsPerMinute + (playerStats.Won ? 5 : 0))); + + UpdateStatsForAccount(repository, account, earnedPoints, playerStats); + + updateTokenList.Add(new PlayerUpdateToken { Name = account.Name, Gems = earnedPoints }); + } + + repository.CommitChanges(); + } + + return updateTokenList; + } + + private void UpdateStatsForAccount(IRepository repository, Account account, int earnedPoints, CaptureThePigPlayerStatsToken playerStats) + { + account.Gems += earnedPoints; + + if (account.CaptureThePigStats == null) + { + account.CaptureThePigStats = new List(); + } + + var weeklyStats = account.CaptureThePigStats.FirstOrDefault(x => x.Type == "Week"); + var monthStats = account.CaptureThePigStats.FirstOrDefault(x => x.Type == "Month"); + var allStats = account.CaptureThePigStats.FirstOrDefault(x => x.Type == "All"); + + if (weeklyStats == null) + { + weeklyStats = new CaptureThePigPlayerStats(); + weeklyStats.Type = "Week"; + + account.CaptureThePigStats.Add(weeklyStats); + } + + if (monthStats == null) + { + monthStats = new CaptureThePigPlayerStats(); + monthStats.Type = "Month"; + + account.CaptureThePigStats.Add(monthStats); + } + + if (allStats == null) + { + allStats = new CaptureThePigPlayerStats(); + allStats.Type = "All"; + + account.CaptureThePigStats.Add(allStats); + } + + + UpdateStats(weeklyStats, playerStats); + repository.Edit(weeklyStats); + + UpdateStats(monthStats, playerStats); + repository.Edit(monthStats); + + UpdateStats(allStats, playerStats); + repository.Edit(allStats); + + repository.Edit(account); + } + + private void UpdateStats(CaptureThePigPlayerStats statToUpdate, CaptureThePigPlayerStatsToken statAdding) + { + statToUpdate.Captures += statAdding.PlayerStats.Captures; + statToUpdate.Kills += statAdding.PlayerStats.Kills; + statToUpdate.Assists += statAdding.PlayerStats.Assists; + statToUpdate.Deaths += statAdding.PlayerStats.Deaths; + + if (statAdding.Won) + statToUpdate.Wins += 1; + else + statToUpdate.Losses += 1; + } + } +} diff --git a/Website/LOC.Website.Common/Models/ClanAdministrator.cs b/Website/LOC.Website.Common/Models/ClanAdministrator.cs new file mode 100644 index 000000000..22c8b532a --- /dev/null +++ b/Website/LOC.Website.Common/Models/ClanAdministrator.cs @@ -0,0 +1,375 @@ +using LOC.Core.Data; +using LOC.Core.Model.Account; +using LOC.Core.Tokens.Clan; + +namespace LOC.Website.Common.Models +{ + using System.Collections.Generic; + using System.Data.Entity; + using System.Linq; + using Core.Model.Server.PvpServer.Clan; + using Data; + + public class ClanAdministrator : IClanAdministrator + { + private readonly INautilusRepositoryFactory _repositoryFactory; + + private static readonly object _clanLock = new object(); + + public ClanAdministrator(INautilusRepositoryFactory repositoryFactory) + { + _repositoryFactory = repositoryFactory; + } + + public List GetClans(string serverName) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var clanTokens = new List(); + + foreach (var clan in repository.GetAll() + .Include(x => x.Alliances.Select(y => y.Clan)) + .Include(x => x.Wars.Select(y => y.Clan)) + .Include(x => x.Territories) + .Include(x => x.Members.Select(y => y.ClanRole)) + .ToList()) + { + foreach (var territory in clan.Territories.Where(x => x.ServerName != serverName).ToList()) + { + clan.Territories.Remove(territory); + } + + clanTokens.Add(new ClanToken(clan)); + } + + return clanTokens; + } + } + + public void AddClan(ClanToken token) + { + lock (_clanLock) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var clan = new Clan + { + Members = new List(), + Alliances = new List(), + Wars = new List(), + Territories = new List() + }; + + UpdateClanInformation(repository, clan, token); + + repository.Add(clan); + repository.CommitChanges(); + } + } + } + + public void EditClan(ClanToken token) + { + lock (_clanLock) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var clan = + repository.Where(x => x.Name == token.Name) + .Include(x => x.Members) + .Include(x => x.Alliances.Select(y => y.Clan)) + .Include(x => x.Wars.Select(y => y.Clan)) + .Include(x => x.Territories) + .First(); + UpdateClanInformation(repository, clan, token); + + repository.Edit(clan); + repository.CommitChanges(); + } + } + } + + public void DeleteClan(ClanToken token) + { + lock (_clanLock) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var clan = + repository.Where(x => x.Name == token.Name) + .Include(x => x.Members) + .Include(x => x.Alliances.Select(y => y.Clan)) + .Include(x => x.Wars.Select(y => y.Clan)) + .Include(x => x.Territories) + .First(); + + foreach (var clanMember in clan.Members.ToList()) + { + clanMember.Clan = null; + clanMember.ClanRole = null; + repository.Edit(clanMember); + } + + if (clan.Alliances != null) + { + foreach (var alliance in clan.Alliances.ToList()) + { + repository.Delete(alliance); + } + } + + if (clan.Wars != null) + { + foreach (var war in clan.Wars.ToList()) + { + repository.Delete(war); + } + } + + var alliancesToThisClan = repository.Where(x => x.Clan.Name == clan.Name); + + foreach (var alliance in alliancesToThisClan.ToList()) + { + repository.Delete(alliance); + } + + var warsToThisClan = repository.Where(x => x.Clan.Name == clan.Name); + + foreach (var war in warsToThisClan.ToList()) + { + repository.Delete(war); + } + + repository.Delete(clan); + repository.CommitChanges(); + } + } + } + + public void UpdateClanTNTGenerators(List tokens) + { + lock (_clanLock) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + foreach (var token in tokens) + { + UpdateClanTNTGenerator(repository, token); + } + + repository.CommitChanges(); + } + } + } + + public void UpdateClanTNTGenerator(ClanGeneratorToken token) + { + lock (_clanLock) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + UpdateClanTNTGenerator(repository, token); + + repository.CommitChanges(); + } + } + } + + public void ResetClanData() + { + using (var repository = _repositoryFactory.CreateRepository()) + { + foreach (var clan in repository.GetAll()) + { + if (clan.Territories != null) + clan.Territories.Clear(); + + if (clan.Wars != null) + clan.Wars.Clear(); + + if (clan.Alliances != null) + clan.Alliances.Clear(); + + clan.Generator = null; + clan.GeneratorStock = 0; + clan.GeneratorTime = 0; + + repository.Edit(clan); + } + + foreach (var war in repository.GetAll().ToList()) + { + repository.Delete(war); + } + + foreach (var alliance in repository.GetAll().ToList()) + { + repository.Delete(alliance); + } + + foreach (var territory in repository.GetAll().Where(x => x.ServerName == "PVP").ToList()) + { + repository.Delete(territory); + } + + repository.CommitChanges(); + } + } + + private void UpdateClanTNTGenerator(IRepository repository, ClanGeneratorToken token) + { + var clan = repository.Where(x => string.Equals(x.Name, token.Name)).First(); + + clan.Generator = token.Location; + clan.GeneratorStock = token.Stock; + clan.GeneratorTime = token.Time; + + repository.Edit(clan); + } + + private void UpdateClanInformation(IRepository repository, Clan clan, ClanToken token) + { + clan.Name = token.Name; + clan.Description = token.Description; + clan.Power = token.Power; + clan.Home = token.Home; + clan.Admin = token.Admin; + clan.DateCreated = token.DateCreated; + clan.LastTimeOnline = token.LastTimeOnline; + + UpdateClanMembers(repository, clan, token); + UpdateClanAlliances(repository, clan, token); + UpdateClanWars(repository, clan, token); + UpdateClanTerritories(repository, clan, token); + } + + private void UpdateClanMembers(IRepository repository, Clan clan, ClanToken token) + { + if (clan.Members != null) + { + // Remove existing that aren't in token list + var enumerator = clan.Members.Where(member => token.Members.All(x => x.Name != member.Name)).ToList().GetEnumerator(); + + while(enumerator.MoveNext()) + { + enumerator.Current.Clan = null; + enumerator.Current.ClanRole = null; + repository.Edit(enumerator.Current); + } + } + else + { + clan.Members = new List(); + } + + if (token.Members == null) + return; + + // Add or update + foreach (var member in token.Members) + { + var account = repository.GetAll().First(x => x.Name == member.Name); + account.Clan = clan; + account.ClanRole = repository.Where(x => x.Name == member.ClanRole.Name).First(); + + repository.Edit(account); + } + } + + private void UpdateClanAlliances(IRepository repository, Clan clan, ClanToken token) + { + if (clan.Alliances != null) + { + foreach (var relationship in clan.Alliances.ToList()) + { + repository.Delete(relationship); + } + } + else + { + clan.Alliances = new List(); + } + + if (token.Alliances == null) + return; + + // Add or update + foreach (var relationshipToken in token.Alliances) + { + var relationship = new Alliance + { + Clan = + repository.Where(x => x.Name == relationshipToken.ClanName).First(), + Trusted = relationshipToken.Trusted, + }; + + clan.Alliances.Add(relationship); + } + } + + private void UpdateClanWars(IRepository repository, Clan clan, ClanToken token) + { + if (clan.Wars != null) + { + foreach (var relationship in clan.Wars.ToList()) + { + repository.Delete(relationship); + } + } + else + { + clan.Wars = new List(); + } + + if (token.Wars == null) + return; + + // Add or update + foreach (var relationshipToken in token.Wars) + { + var relationship = new War + { + Clan = + repository.Where(x => x.Name == relationshipToken.ClanName).First(), + Cooldown = relationshipToken.Cooldown, + Ended = relationshipToken.Ended, + Dominance = relationshipToken.Dominance, + }; + + clan.Wars.Add(relationship); + } + } + + private void UpdateClanTerritories(IRepository repository, Clan clan, ClanToken token) + { + if (clan.Territories != null) + { + foreach (var relationship in clan.Territories.ToList()) + { + repository.Delete(relationship); + } + } + else + { + clan.Territories = new List(); + } + + if (token.Territories == null) + return; + + // Add or update + foreach (var territoryToken in token.Territories) + { + var territory = new Territory + { + Chunk = territoryToken.Chunk, + Clan = clan, + Safe = territoryToken.Safe, + ServerName = territoryToken.ServerName + }; + + clan.Territories.Add(territory); + } + } + } +} diff --git a/Website/LOC.Website.Common/Models/DominateAdministrator.cs b/Website/LOC.Website.Common/Models/DominateAdministrator.cs new file mode 100644 index 000000000..c27dba8e3 --- /dev/null +++ b/Website/LOC.Website.Common/Models/DominateAdministrator.cs @@ -0,0 +1,107 @@ +namespace LOC.Website.Common.Models +{ + using System; + using System.Collections.Generic; + using System.Data.Entity; + using System.Linq; + using Core.Data; + using Core.Model.Account; + using Core.Model.GameServer.Stats; + using Core.Model.Server.GameServer.Dominate.Stats; + using Core.Tokens.Client; + using Data; + + public class DominateAdministrator : PvpAdministrator, IDominateAdministrator + { + public DominateAdministrator(INautilusRepositoryFactory repositoryFactory) : base(repositoryFactory) { } + + public List UploadStats(DominateGameStatsToken token) + { + var updateTokenList = new List(); + var timeDifference = token.Duration - ((long)new TimeSpan(DateTime.Now.ToUniversalTime().Ticks - new DateTime(1970, 1, 1).Ticks).TotalMilliseconds) - new TimeSpan(0, 15, 0).TotalMilliseconds; + var direction = timeDifference / Math.Abs(timeDifference); + var pointsAccordingToDuration = Math.Min(Math.Abs(timeDifference), 5) * direction + 35; + + using (var repository = RepositoryFactory.CreateRepository()) + { + foreach (var playerStats in token.PlayerStats) + { + var account = repository.Where(x => x.Name == playerStats.Name).Include(x => x.DominateStats).First(); ; + var earnedPoints = (int)pointsAccordingToDuration; + + UpdateStatsForAccount(repository, account, earnedPoints, playerStats); + + updateTokenList.Add(new PlayerUpdateToken { Name = account.Name, Gems = earnedPoints }); + } + + repository.CommitChanges(); + } + + return updateTokenList; + } + + private void UpdateStatsForAccount(IRepository repository, Account account, int earnedPoints, DominatePlayerStatsToken playerStats) + { + account.Gems += earnedPoints; + + if (account.DominateStats == null) + { + account.DominateStats = new List(); + } + + System.Diagnostics.Debug.WriteLine("Dominate Stats : " + account.DominateStats.Count); + + if (!account.DominateStats.Exists(x => x.Type == "Week")) + { + var stats = new DominatePlayerStats(); + stats.Type = "Week"; + + account.DominateStats.Add(stats); + System.Diagnostics.Debug.WriteLine("No Week"); + } + + if (!account.DominateStats.Exists(x => x.Type == "Month")) + { + var stats = new DominatePlayerStats(); + stats.Type = "Month"; + + account.DominateStats.Add(stats); + System.Diagnostics.Debug.WriteLine("No Month"); + } + + if (!account.DominateStats.Exists(x => x.Type == "All")) + { + var stats = new DominatePlayerStats(); + stats.Type = "All"; + + account.DominateStats.Add(stats); + System.Diagnostics.Debug.WriteLine("No All"); + } + + var weeklyStats = account.DominateStats.FirstOrDefault(x => x.Type == "Week"); + var monthStats = account.DominateStats.FirstOrDefault(x => x.Type == "Month"); + var allStats = account.DominateStats.FirstOrDefault(x => x.Type == "All"); + + UpdateStats(weeklyStats, playerStats); + UpdateStats(monthStats, playerStats); + UpdateStats(allStats, playerStats); + + repository.Edit(account); + + System.Diagnostics.Debug.WriteLine("Done with stats."); + } + + private void UpdateStats(DominatePlayerStats statToUpdate, DominatePlayerStatsToken statAdding) + { + statToUpdate.Kills += statAdding.PlayerStats.Kills; + statToUpdate.Assists += statAdding.PlayerStats.Assists; + statToUpdate.Deaths += statAdding.PlayerStats.Deaths; + statToUpdate.Points += statAdding.PlayerStats.Points; + + if (statAdding.Won) + statToUpdate.Wins += 1; + else + statToUpdate.Losses += 1; + } + } +} diff --git a/Website/LOC.Website.Common/Models/GameSalesPackageAdministrator.cs b/Website/LOC.Website.Common/Models/GameSalesPackageAdministrator.cs new file mode 100644 index 000000000..b5ffb3002 --- /dev/null +++ b/Website/LOC.Website.Common/Models/GameSalesPackageAdministrator.cs @@ -0,0 +1,61 @@ +namespace LOC.Website.Common.Models +{ + using System.Collections.Generic; + using System.Data; + using System.Linq; + using Core.Model.Sales; + using Data; + + public class GameSalesPackageAdministrator : IGameSalesPackageAdministrator + { + private readonly INautilusRepositoryFactory _repositoryFactory; + + public GameSalesPackageAdministrator(INautilusRepositoryFactory nautilusRepositoryFactory) + { + _repositoryFactory = nautilusRepositoryFactory; + } + + public List GetSalesPackages() + { + using (var repository = _repositoryFactory.CreateRepository()) + { + return repository.GetAll().ToList(); + } + } + + public GameSalesPackage GetGameSalesPackageById(int id) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + return repository.Where(x => x.GameSalesPackageId == id).First(); + } + } + + public void AddSalesPackage(GameSalesPackage salesPackage) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + repository.Add(salesPackage); + repository.CommitChanges(); + } + } + + public void UpdateSalesPackage(GameSalesPackage salesPackage) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + repository.Edit(salesPackage); + repository.CommitChanges(); + } + } + + public void DeleteSalesPackage(GameSalesPackage salesPackage) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + repository.Delete(salesPackage); + repository.CommitChanges(); + } + } + } +} diff --git a/Website/LOC.Website.Common/Models/IAccountAdministrator.cs b/Website/LOC.Website.Common/Models/IAccountAdministrator.cs new file mode 100644 index 000000000..561286953 --- /dev/null +++ b/Website/LOC.Website.Common/Models/IAccountAdministrator.cs @@ -0,0 +1,36 @@ +namespace LOC.Website.Common.Models +{ + using System; + using System.Collections.Generic; + using Core.Model.Account; + using Core.Model.Sales; + using Core.Tokens; + using Core.Tokens.Client; + + public interface IAccountAdministrator + { + List GetAccountNames(); + List GetAllAccountsMatching(); + List GetAllAccountsMatching(string name); + List GetAllAccountNamesMatching(string name); + Account GetAccountByName(string name); + Account GetAccountById(int id); + Account CreateAccount(string name); + Account UpdateAccount(Account account); + void ApplySalesPackage(SalesPackage salesPackage, int accountId, decimal gross, decimal fee); + Account Login(LoginRequestToken loginToken); + void Logout(string name); + + PunishmentResponse Punish(PunishToken punish); + PunishmentResponse RemovePunishment(RemovePunishmentToken ban); + + string PurchaseGameSalesPackage(PurchaseToken token); + bool AccountExists(string name); + void SaveCustomBuild(CustomBuildToken token); + void Ignore(string accountName, string ignoredPlayer); + void RemoveIgnore(string accountName, string ignoredPlayer); + string PurchaseUnknownSalesPackage(UnknownPurchaseToken token); + string UpdateRank(RankUpdateToken token); + void RemoveBan(RemovePunishmentToken token); + } +} diff --git a/Website/LOC.Website.Common/Models/ICaptureThePigAdministrator.cs b/Website/LOC.Website.Common/Models/ICaptureThePigAdministrator.cs new file mode 100644 index 000000000..3cb3ef580 --- /dev/null +++ b/Website/LOC.Website.Common/Models/ICaptureThePigAdministrator.cs @@ -0,0 +1,11 @@ +namespace LOC.Website.Common.Models +{ + using System.Collections.Generic; + using Core.Model.Server.GameServer.CaptureThePig.Stats; + using Core.Tokens.Client; + + public interface ICaptureThePigAdministrator : IPvpAdministrator + { + List UploadStats(CaptureThePigGameStatsToken token); + } +} diff --git a/Website/LOC.Website.Common/Models/IClanAdministrator.cs b/Website/LOC.Website.Common/Models/IClanAdministrator.cs new file mode 100644 index 000000000..967561f8a --- /dev/null +++ b/Website/LOC.Website.Common/Models/IClanAdministrator.cs @@ -0,0 +1,18 @@ +using LOC.Core.Tokens.Clan; + +namespace LOC.Website.Common.Models +{ + using System.Collections.Generic; + + public interface IClanAdministrator + { + List GetClans(string serverName); + void AddClan(ClanToken clan); + void EditClan(ClanToken clan); + void DeleteClan(ClanToken clan); + void UpdateClanTNTGenerators(List tokens); + void UpdateClanTNTGenerator(ClanGeneratorToken token); + + void ResetClanData(); + } +} diff --git a/Website/LOC.Website.Common/Models/IDominateAdministrator.cs b/Website/LOC.Website.Common/Models/IDominateAdministrator.cs new file mode 100644 index 000000000..ba6bdef2b --- /dev/null +++ b/Website/LOC.Website.Common/Models/IDominateAdministrator.cs @@ -0,0 +1,11 @@ +namespace LOC.Website.Common.Models +{ + using System.Collections.Generic; + using Core.Model.GameServer.Stats; + using Core.Tokens.Client; + + public interface IDominateAdministrator : IPvpAdministrator + { + List UploadStats(DominateGameStatsToken token); + } +} diff --git a/Website/LOC.Website.Common/Models/IGameSalesPackageAdministrator.cs b/Website/LOC.Website.Common/Models/IGameSalesPackageAdministrator.cs new file mode 100644 index 000000000..420b7e8d5 --- /dev/null +++ b/Website/LOC.Website.Common/Models/IGameSalesPackageAdministrator.cs @@ -0,0 +1,14 @@ +namespace LOC.Website.Common.Models +{ + using System.Collections.Generic; + using Core.Model.Sales; + + public interface IGameSalesPackageAdministrator + { + List GetSalesPackages(); + GameSalesPackage GetGameSalesPackageById(int id); + void AddSalesPackage(GameSalesPackage salesPackage); + void UpdateSalesPackage(GameSalesPackage salesPackage); + void DeleteSalesPackage(GameSalesPackage salesPackage); + } +} diff --git a/Website/LOC.Website.Common/Models/IPetAdministrator.cs b/Website/LOC.Website.Common/Models/IPetAdministrator.cs new file mode 100644 index 000000000..40841b2bc --- /dev/null +++ b/Website/LOC.Website.Common/Models/IPetAdministrator.cs @@ -0,0 +1,17 @@ +namespace LOC.Website.Common.Models +{ + using System.Collections.Generic; + using Core.Model.Server; + using Core.Tokens.Client; + + public interface IPetAdministrator + { + List GetPets(List petTokens); + List GetPetExtras(List petExtraTokens); + void AddPet(PetChangeToken pet); + void UpdatePet(PetChangeToken pet); + void RemovePet(PetChangeToken pet); + void AddPetNameTag(string name); + void RemovePetNameTag(string name); + } +} diff --git a/Website/LOC.Website.Common/Models/IPvpAdministrator.cs b/Website/LOC.Website.Common/Models/IPvpAdministrator.cs new file mode 100644 index 000000000..71efb96d0 --- /dev/null +++ b/Website/LOC.Website.Common/Models/IPvpAdministrator.cs @@ -0,0 +1,16 @@ +namespace LOC.Website.Common.Models +{ + using System.Collections.Generic; + using Core.Model.PvpServer; + using Core.Model.Server.PvpServer; + + public interface IPvpAdministrator + { + List GetItems(List items); + List GetSkills(List skills); + List GetWeapons(List weapons); + List GetPvpClasses(List pvpClasses); + List GetBenefitItems(List benefitItems); + + } +} diff --git a/Website/LOC.Website.Common/Models/ISalesPackageAdministrator.cs b/Website/LOC.Website.Common/Models/ISalesPackageAdministrator.cs new file mode 100644 index 000000000..9c0593d3b --- /dev/null +++ b/Website/LOC.Website.Common/Models/ISalesPackageAdministrator.cs @@ -0,0 +1,14 @@ +namespace LOC.Website.Common.Models +{ + using System.Collections.Generic; + using Core.Model.Sales; + + public interface ISalesPackageAdministrator + { + List GetSalesPackages(); + SalesPackage GetSalesPackageById(int id); + void AddSalesPackage(SalesPackage salesPackage); + void UpdateSalesPackage(SalesPackage salesPackage); + void DeleteSalesPackage(SalesPackage salesPackage); + } +} diff --git a/Website/LOC.Website.Common/Models/IServerAdministrator.cs b/Website/LOC.Website.Common/Models/IServerAdministrator.cs new file mode 100644 index 000000000..3d851140f --- /dev/null +++ b/Website/LOC.Website.Common/Models/IServerAdministrator.cs @@ -0,0 +1,14 @@ +namespace LOC.Website.Common.Models +{ + using System.Collections.Generic; + using Core.Model.GameServer; + + public interface IServerAdministrator + { + void Started(Server server); + void Stopped(Server server); + void UpdateServerStatus(ServerHistory serverHistory); + ServerUpdate GetServerUpdates(int serverId); + List GetFilteredWords(); + } +} diff --git a/Website/LOC.Website.Common/Models/NautilusRepositoryFactory.cs b/Website/LOC.Website.Common/Models/NautilusRepositoryFactory.cs new file mode 100644 index 000000000..dcc6bea27 --- /dev/null +++ b/Website/LOC.Website.Common/Models/NautilusRepositoryFactory.cs @@ -0,0 +1,22 @@ +namespace LOC.Website.Common.Data +{ + using Contexts; + using Core.Data; + using StructureMap; + + [PluginFamily(IsSingleton = true, Scope = InstanceScope.Singleton)] + public class NautilusRepositoryFactory : INautilusRepositoryFactory + { + private readonly IRepositoryFactory _repositoryFactory; + + public NautilusRepositoryFactory(IRepositoryFactory repositoryFactory) + { + _repositoryFactory = repositoryFactory; + } + + public IRepository CreateRepository() + { + return _repositoryFactory.CreateRepository(); + } + } +} diff --git a/Website/LOC.Website.Common/Models/PetAdministrator.cs b/Website/LOC.Website.Common/Models/PetAdministrator.cs new file mode 100644 index 000000000..64fad3ef0 --- /dev/null +++ b/Website/LOC.Website.Common/Models/PetAdministrator.cs @@ -0,0 +1,140 @@ +namespace LOC.Website.Common.Models +{ + using System.Collections.Generic; + using System.Data.Entity; + using System.Linq; + using Core.Model.Account; + using Core.Model.Server; + using Core.Tokens.Client; + using Data; + + public class PetAdministrator : IPetAdministrator + { + private readonly INautilusRepositoryFactory _repositoryFactory; + + public PetAdministrator(INautilusRepositoryFactory repositoryFactory) + { + _repositoryFactory = repositoryFactory; + } + + public List GetPets(List petTokens) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + foreach (var item in petTokens.Where(item => !repository.Any(x => x.PetType == item.PetType))) + { + repository.Add(item); + } + + repository.CommitChanges(); + + return repository.GetAll().Include(x => x.SalesPackage).ToList(); + } + } + + public List GetPetExtras(List petExtraTokens) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + foreach (var item in petExtraTokens.Where(item => !repository.Any(x => x.Name == item.Name && x.Material == item.Material))) + { + repository.Add(item); + } + + repository.CommitChanges(); + + return repository.GetAll().Include(x => x.SalesPackage).ToList(); + } + } + + public void AddPet(PetChangeToken token) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = repository.Where(x => x.Name == token.Name).Include(x => x.Pets).FirstOrDefault(); + + if (account == null) + return; + + account.Pets.Add(new OwnedPet { PetType = token.PetType, PetName = token.PetName }); + + repository.CommitChanges(); + } + } + + public void UpdatePet(PetChangeToken token) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = repository.Where(x => x.Name == token.Name).Include(x => x.Pets).FirstOrDefault(); + + if (account == null) + return; + + var pet = account.Pets.FirstOrDefault(x => x.PetType.Equals(token.PetType)); + + if (pet == null) + return; + + pet.PetName = token.PetName; + + repository.Edit(pet); + + repository.CommitChanges(); + } + } + + public void RemovePet(PetChangeToken token) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = repository.Where(x => x.Name == token.Name).Include(x => x.Pets).FirstOrDefault(); + + if (account == null) + return; + + var ownedPet = account.Pets.FirstOrDefault(x => x.PetType == token.PetType); + + if (ownedPet == null) + return; + + account.Pets.Remove(ownedPet); + + repository.CommitChanges(); + } + } + + public void AddPetNameTag(string name) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = repository.Where(x => x.Name == name).FirstOrDefault(); + + if (account == null) + return; + + account.PetNameTagCount++; + + repository.CommitChanges(); + } + } + + public void RemovePetNameTag(string name) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = repository.Where(x => x.Name == name).FirstOrDefault(); + + if (account == null) + return; + + account.PetNameTagCount--; + + if (account.PetNameTagCount < 0) + account.PetNameTagCount = 0; + + repository.CommitChanges(); + } + } + } +} diff --git a/Website/LOC.Website.Common/Models/PvpAdministrator.cs b/Website/LOC.Website.Common/Models/PvpAdministrator.cs new file mode 100644 index 000000000..3f9854326 --- /dev/null +++ b/Website/LOC.Website.Common/Models/PvpAdministrator.cs @@ -0,0 +1,94 @@ +namespace LOC.Website.Common.Models +{ + using System.Collections.Generic; + using System.Data.Entity; + using System.Linq; + using Core.Model.PvpServer; + using Core.Model.Server.PvpServer; + using Data; + + public class PvpAdministrator : IPvpAdministrator + { + protected readonly INautilusRepositoryFactory RepositoryFactory; + + public PvpAdministrator(INautilusRepositoryFactory repositoryFactory) + { + RepositoryFactory = repositoryFactory; + } + + public List GetItems(List items) + { + using (var repository = RepositoryFactory.CreateRepository()) + { + foreach (var item in items.Where(item => !repository.Any(x => x.Name == item.Name))) + { + repository.Add(item); + } + + repository.CommitChanges(); + + return repository.GetAll().Include(x => x.SalesPackage).ToList(); + } + } + + public List GetSkills(List skills) + { + using (var repository = RepositoryFactory.CreateRepository()) + { + foreach (var skill in skills.Where(skill => !repository.Any(x => x.Name == skill.Name && x.Level == skill.Level))) + { + repository.Add(skill); + } + + repository.CommitChanges(); + + return repository.GetAll().Include(x => x.SalesPackage).ToList(); + } + } + + public List GetWeapons(List weapons) + { + using (var repository = RepositoryFactory.CreateRepository()) + { + foreach (var weapon in weapons.Where(weapon => !repository.Any(x => x.Name == weapon.Name))) + { + repository.Add(weapon); + } + + repository.CommitChanges(); + + return repository.GetAll().Include(x => x.SalesPackage).ToList(); + } + } + + public List GetPvpClasses(List pvpClasses) + { + using (var repository = RepositoryFactory.CreateRepository()) + { + foreach (var pvpClass in pvpClasses.Where(pvpClass => !repository.Any(x => x.Name == pvpClass.Name))) + { + repository.Add(pvpClass); + } + + repository.CommitChanges(); + + return repository.GetAll().Include(x => x.SalesPackage).ToList(); + } + } + + public List GetBenefitItems(List benefitItems) + { + using (var repository = RepositoryFactory.CreateRepository()) + { + foreach (var benefitItem in benefitItems.Where(x => !repository.Any(y => y.Name == x.Name))) + { + repository.Add(benefitItem); + } + + repository.CommitChanges(); + + return repository.GetAll().Include(x => x.SalesPackage).ToList(); + } + } + } +} diff --git a/Website/LOC.Website.Common/Models/SalesPackageAdministrator.cs b/Website/LOC.Website.Common/Models/SalesPackageAdministrator.cs new file mode 100644 index 000000000..24d4e8a53 --- /dev/null +++ b/Website/LOC.Website.Common/Models/SalesPackageAdministrator.cs @@ -0,0 +1,61 @@ +namespace LOC.Website.Common.Models +{ + using System.Collections.Generic; + using System.Data.Entity; + using System.Linq; + using Core.Model.Sales; + using Data; + + public class SalesPackageAdministrator : ISalesPackageAdministrator + { + private readonly INautilusRepositoryFactory _repositoryFactory; + + public SalesPackageAdministrator(INautilusRepositoryFactory nautilusRepositoryFactory) + { + _repositoryFactory = nautilusRepositoryFactory; + } + + public List GetSalesPackages() + { + using (var repository = _repositoryFactory.CreateRepository()) + { + return repository.GetAll().Include(x => x.Rank).ToList(); + } + } + + public SalesPackage GetSalesPackageById(int id) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + return repository.Where(x => x.SalesPackageId == id).Include(x => x.Rank).First(); + } + } + + public void AddSalesPackage(SalesPackage salesPackage) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + repository.Add(salesPackage); + repository.CommitChanges(); + } + } + + public void UpdateSalesPackage(SalesPackage salesPackage) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + repository.Attach(salesPackage); + repository.CommitChanges(); + } + } + + public void DeleteSalesPackage(SalesPackage salesPackage) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + repository.Delete(salesPackage); + repository.CommitChanges(); + } + } + } +} diff --git a/Website/LOC.Website.Common/Models/ServerAdministrator.cs b/Website/LOC.Website.Common/Models/ServerAdministrator.cs new file mode 100644 index 000000000..2d2ce62d7 --- /dev/null +++ b/Website/LOC.Website.Common/Models/ServerAdministrator.cs @@ -0,0 +1,64 @@ +namespace LOC.Website.Common.Models +{ + using System.Collections.Generic; + using System.Linq; + using Core.Model.GameServer; + using Core.Model.Server; + using Data; + + public class ServerAdministrator : IServerAdministrator + { + private readonly INautilusRepositoryFactory _repositoryFactory; + private readonly IGameServerMonitor _gameServerMonitor; + + public ServerAdministrator(INautilusRepositoryFactory nautilusRepositoryFactory) + { + _repositoryFactory = nautilusRepositoryFactory; + _gameServerMonitor = GameServerMonitor.Instance; + } + + public void Started(Server server) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + if (!repository.Any(x => x.ConnectionAddress == server.ConnectionAddress)) + { + server = repository.Add(server); + } + + repository.CommitChanges(); + } + + _gameServerMonitor.Track(server); + } + + public void Stopped(Server server) + { + _gameServerMonitor.UnTrack(server); + } + + public void UpdateServerStatus(ServerHistory serverHistory) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + _gameServerMonitor.UpdateServerStatus(repository.Add(serverHistory)); + } + } + + public ServerUpdate GetServerUpdates(int serverId) + { + var serverUpdates = _gameServerMonitor.GetServerUpdatesFor(serverId); + _gameServerMonitor.ClearServerUpdates(serverId); + + return serverUpdates; + } + + public List GetFilteredWords() + { + using (var repository = _repositoryFactory.CreateRepository()) + { + return Enumerable.Select(repository.GetAll(), word => (string) word.Name).ToList(); + } + } + } +} diff --git a/Website/LOC.Website.Common/PingResult.cs b/Website/LOC.Website.Common/PingResult.cs new file mode 100644 index 000000000..84850bd98 --- /dev/null +++ b/Website/LOC.Website.Common/PingResult.cs @@ -0,0 +1,87 @@ +namespace LOC.Website.Common +{ + namespace LobbyProxy + { + using System; + using System.Net.Sockets; + using System.Text; + + public class PingResult + { + public string MessageOfTheDay { get; set; } + + public int Players { get; set; } + + public int MaxPlayers { get; set; } + + public bool Success { get; set; } + + public static PingResult Ping(string address, int port) + { + var pr = new PingResult(); + + try + { + using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + socket.Connect(address, port); + socket.ReceiveTimeout = 500; + socket.SendTimeout = 500; + + socket.Send(new byte[] {0xFE, 0x01}); + var b = new byte[1024]; + int len = socket.Receive(b); + + if (len < 3) + { + pr.Success = false; + return pr; + } + + var result = Encoding.BigEndianUnicode.GetString(b, 3, len - 3); + var parts = result.Split('\0'); + + if (parts.Length != 6) + { + pr.Success = false; + return pr; + } + + int players; + int max; + + pr.MessageOfTheDay = parts[3]; + + if (!int.TryParse(parts[4], out players)) + { + pr.Success = false; + return pr; + } + + if (!int.TryParse(parts[5], out max)) + { + pr.Success = false; + return pr; + } + + pr.Players = players; + pr.MaxPlayers = max; + + pr.Success = true; + + socket.Disconnect(false); + socket.Close(); + socket.Dispose(); + } + } + catch (Exception) + { + // Gulp + } + + return pr; + } + } + } + +} diff --git a/Website/LOC.Website.Common/Properties/AssemblyInfo.cs b/Website/LOC.Website.Common/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..561634795 --- /dev/null +++ b/Website/LOC.Website.Common/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("LOC.Common")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Windows User")] +[assembly: AssemblyProduct("LOC.Common")] +[assembly: AssemblyCopyright("Copyright © Windows User 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("bd41162c-3249-4555-a102-fe61629f99a3")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Website/LOC.Website.Common/Properties/Resources.Designer.cs b/Website/LOC.Website.Common/Properties/Resources.Designer.cs new file mode 100644 index 000000000..1c9b1df8d --- /dev/null +++ b/Website/LOC.Website.Common/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.269 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace LOC.Website.Common.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LOC.Website.Common.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Website/LOC.Website.Common/Properties/Resources.resx b/Website/LOC.Website.Common/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Website/LOC.Website.Common/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Website/LOC.Website.Common/Properties/Settings.Designer.cs b/Website/LOC.Website.Common/Properties/Settings.Designer.cs new file mode 100644 index 000000000..ac4c5faaa --- /dev/null +++ b/Website/LOC.Website.Common/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.269 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace LOC.Website.Common.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Website/LOC.Website.Common/Properties/Settings.settings b/Website/LOC.Website.Common/Properties/Settings.settings new file mode 100644 index 000000000..39645652a --- /dev/null +++ b/Website/LOC.Website.Common/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Website/LOC.Website.Common/PunishmentResponse.cs b/Website/LOC.Website.Common/PunishmentResponse.cs new file mode 100644 index 000000000..db1bb3dd6 --- /dev/null +++ b/Website/LOC.Website.Common/PunishmentResponse.cs @@ -0,0 +1,11 @@ +namespace LOC.Website.Common +{ + public enum PunishmentResponse + { + Punished, + PunishmentRemoved, + AccountDoesNotExist, + NotPunished, + InsufficientPrivileges + } +} diff --git a/Website/LOC.Website.Common/ServerStatus.cs b/Website/LOC.Website.Common/ServerStatus.cs new file mode 100644 index 000000000..3fb1352a8 --- /dev/null +++ b/Website/LOC.Website.Common/ServerStatus.cs @@ -0,0 +1,17 @@ +namespace LOC.Website.Common +{ + public class ServerStatus + { + public string IpAddress { get; set; } + + public int Players { get; set; } + + public int MaxPlayers { get; set; } + + public bool Success { get; set; } + + public string Name { get; set; } + + public string Image { get; set; } + } +} diff --git a/Website/LOC.Website.Common/ServerStatusManager.cs b/Website/LOC.Website.Common/ServerStatusManager.cs new file mode 100644 index 000000000..94ca76eb3 --- /dev/null +++ b/Website/LOC.Website.Common/ServerStatusManager.cs @@ -0,0 +1,82 @@ +namespace LOC.Website.Common +{ + using System.Collections.Generic; + using System.Linq; + using System.Timers; + using LobbyProxy; + + public class ServerStatusManager + { + public static ServerStatusManager Instance = new ServerStatusManager(); + + private readonly Timer _statusTimer; + + private static object _statusUpdateLock = new object(); + + private readonly HashSet _serverAddresses; + private readonly List _serverStatuses; + + protected ServerStatusManager() + { + _statusTimer = new Timer(5000); + _statusTimer.Elapsed += StatusTick; + + _serverAddresses = new HashSet(); + _serverStatuses = new List(); + } + + public List GetServers() + { + lock (_statusUpdateLock) + { + return _serverAddresses.ToList(); + } + } + + public void RegisterServer(string address) + { + lock (_statusUpdateLock) + { + _serverAddresses.Add(address); + } + } + + public void RemoveServer(string address) + { + lock (_statusUpdateLock) + { + _serverAddresses.Remove(address); + } + } + + private void StatusTick(object sender, ElapsedEventArgs e) + { + lock (_statusUpdateLock) + { + _serverStatuses.Clear(); + + /* + _serverStatuses.Add(GetStatus("Dominate", "/Content/Images/Dominate.png", "dom.bettermc.com", 25565)); + _serverStatuses.Add(GetStatus("Dominate2", "/Content/Images/Dominate.png", "dom2.bettermc.com", 25565)); + _serverStatuses.Add(GetStatus("Tutorial", "/Content/Images/Dominate.png", "tut.bettermc.com", 25565)); + //_serverStatuses.Add(GetStatus("CaptureThePig", "/Content/Images/CaptureThePig.png", "ctp.bettermc.com", 25565)); + */ + _serverStatuses.Add(GetStatus("BetterMC Hub", "/Content/Images/Pvp.png", "bettermc.com", 25565)); + } + } + + private ServerStatus GetStatus(string name, string image, string ipAddress, int port) + { + var pingResult = PingResult.Ping(ipAddress, port); + return new ServerStatus + { + Name = name, + Image = image, + IpAddress = ipAddress, + MaxPlayers = pingResult.MaxPlayers, + Players = pingResult.Players, + Success = pingResult.Success + }; + } + } +} diff --git a/Website/LOC.Website.Common/StyleCop.Cache b/Website/LOC.Website.Common/StyleCop.Cache new file mode 100644 index 000000000..3f688be2a --- /dev/null +++ b/Website/LOC.Website.Common/StyleCop.Cache @@ -0,0 +1,614 @@ + + 10 + + + 06/30/2010 08:43:56 + 0 + + 05/29/2012 22:04:51 + 671 + + + The file has no header, the header Xml is invalid, or the header is not located at the top of the file. + 1 + False + + + All using directives must be placed inside of the namespace. + 1 + False + + + All using directives must be placed inside of the namespace. + 2 + False + + + All using directives must be placed inside of the namespace. + 3 + False + + + All using directives must be placed inside of the namespace. + 4 + False + + + The class must have a documentation header. + 8 + False + + + The class must have an access modifier. + 8 + False + + + + + + 06/30/2010 08:43:56 + 0 + + 05/29/2012 22:05:19 + 275 + + + The file has no header, the header Xml is invalid, or the header is not located at the top of the file. + 1 + False + + + All using directives must be placed inside of the namespace. + 1 + False + + + All using directives must be placed inside of the namespace. + 2 + False + + + All using directives must be placed inside of the namespace. + 3 + False + + + All using directives must be placed inside of the namespace. + 4 + False + + + The class must have a documentation header. + 8 + False + + + The class must have an access modifier. + 8 + False + + + + + DEBUG;TRACE + + + DEBUG;TRACE + + + + 06/30/2010 08:43:56 + 0 + + 09/12/2012 22:58:54 + 698 + + + The file has no header, the header Xml is invalid, or the header is not located at the top of the file. + 1 + False + + + The interface must have a documentation header. + 6 + False + + + + + + 06/30/2010 08:43:56 + 0 + + 09/12/2012 22:56:28 + 833 + + + The file has no header, the header Xml is invalid, or the header is not located at the top of the file. + 1 + False + + + The interface must have a documentation header. + 6 + False + + + + + + 06/30/2010 08:43:56 + 0 + + 06/12/2012 23:57:45 + 795 + + + The file has no header, the header Xml is invalid, or the header is not located at the top of the file. + 1 + False + + + The interface must have a documentation header. + 6 + False + + + The method must have a documentation header. + 8 + False + + + + + + 06/30/2010 08:43:56 + 0 + + 08/08/2012 02:03:02 + 513 + + + The file has no header, the header Xml is invalid, or the header is not located at the top of the file. + 1 + False + + + The interface must have a documentation header. + 6 + False + + + The method must have a documentation header. + 8 + False + + + The method must have a documentation header. + 9 + False + + + Adjacent elements must be separated by a blank line. + 9 + False + + + The method must have a documentation header. + 10 + False + + + Adjacent elements must be separated by a blank line. + 10 + False + + + The method must have a documentation header. + 11 + False + + + Adjacent elements must be separated by a blank line. + 11 + False + + + The method must have a documentation header. + 12 + False + + + Adjacent elements must be separated by a blank line. + 12 + False + + + + + + 06/30/2010 08:43:56 + 0 + + 06/17/2012 11:26:19 + 555 + + + The file has no header, the header Xml is invalid, or the header is not located at the top of the file. + 1 + False + + + The interface must have a documentation header. + 6 + False + + + The method must have a documentation header. + 8 + False + + + The method must have a documentation header. + 9 + False + + + Adjacent elements must be separated by a blank line. + 9 + False + + + The method must have a documentation header. + 10 + False + + + Adjacent elements must be separated by a blank line. + 10 + False + + + The method must have a documentation header. + 11 + False + + + Adjacent elements must be separated by a blank line. + 11 + False + + + The method must have a documentation header. + 12 + False + + + Adjacent elements must be separated by a blank line. + 12 + False + + + + + + 06/30/2010 08:43:56 + 0 + + 09/11/2012 22:08:17 + 800 + + + The file has no header, the header Xml is invalid, or the header is not located at the top of the file. + 1 + False + + + The interface must have a documentation header. + 6 + False + + + The method must have a documentation header. + 8 + False + + + The method must have a documentation header. + 9 + False + + + Adjacent elements must be separated by a blank line. + 9 + False + + + The method must have a documentation header. + 10 + False + + + Adjacent elements must be separated by a blank line. + 10 + False + + + The method must have a documentation header. + 11 + False + + + Adjacent elements must be separated by a blank line. + 11 + False + + + + + + 06/30/2010 08:43:56 + 0 + + 06/21/2012 06:40:28 + 389 + + + The file has no header, the header Xml is invalid, or the header is not located at the top of the file. + 1 + False + + + The class must have a documentation header. + 10 + False + + + The method must have a documentation header. + 12 + False + + + The method must have a documentation header. + 20 + False + + + The method must have a documentation header. + 33 + False + + + The method must have a documentation header. + 42 + False + + + The method must have a documentation header. + 51 + False + + + + + + 06/30/2010 08:43:56 + 0 + + 09/11/2012 22:51:44 + 4 + + + The file has no header, the header Xml is invalid, or the header is not located at the top of the file. + 1 + False + + + The class must have a documentation header. + 10 + False + + + The method must have a documentation header. + 12 + False + + + The method must have a documentation header. + 20 + False + + + Invalid spacing around the opening curly bracket. + 27 + False + + + Invalid spacing around the closing curly bracket. + 27 + False + + + The method must have a documentation header. + 38 + False + + + The method must have a documentation header. + 50 + False + + + + + + 06/30/2010 08:43:56 + 0 + + 09/12/2012 22:56:28 + 932 + + + The file has no header, the header Xml is invalid, or the header is not located at the top of the file. + 1 + False + + + The interface must have a documentation header. + 6 + False + + + + + + 06/30/2010 08:43:56 + 0 + + 09/12/2012 22:56:28 + 827 + + + The file has no header, the header Xml is invalid, or the header is not located at the top of the file. + 1 + False + + + The class must have a documentation header. + 8 + False + + + The method must have a documentation header. + 10 + False + + + The method must have a documentation header. + 18 + False + + + The method must have a documentation header. + 29 + False + + + + + + 06/30/2010 08:43:56 + 0 + + 09/12/2012 22:56:28 + 927 + + + The file has no header, the header Xml is invalid, or the header is not located at the top of the file. + 1 + False + + + The class must have a documentation header. + 8 + False + + + The method must have a documentation header. + 10 + False + + + The method must have a documentation header. + 18 + False + + + The method must have a documentation header. + 29 + False + + + Invalid spacing around the opening curly bracket. + 33 + False + + + Invalid spacing around the closing curly bracket. + 33 + False + + + + + + 06/30/2010 08:43:56 + 0 + + 06/12/2012 23:57:45 + 800 + + + The file has no header, the header Xml is invalid, or the header is not located at the top of the file. + 1 + False + + + The class must have a documentation header. + 9 + False + + + The method must have a documentation header. + 11 + False + + + + + + 06/30/2010 08:43:56 + 0 + + 08/08/2012 02:04:24 + 341 + + + The file has no header, the header Xml is invalid, or the header is not located at the top of the file. + 1 + False + + + The class must have a documentation header. + 10 + False + + + The method must have a documentation header. + 12 + False + + + The method must have a documentation header. + 20 + False + + + The method must have a documentation header. + 33 + False + + + The method must have a documentation header. + 42 + False + + + The method must have a documentation header. + 51 + False + + + + \ No newline at end of file diff --git a/Website/LOC.Website.Common/TransactionResponse.cs b/Website/LOC.Website.Common/TransactionResponse.cs new file mode 100644 index 000000000..7e3dcacc0 --- /dev/null +++ b/Website/LOC.Website.Common/TransactionResponse.cs @@ -0,0 +1,9 @@ +namespace LOC.Website.Common +{ + public enum TransactionResponse + { + Success, + InsufficientFunds, + Failed + } +} diff --git a/Website/LOC.Website.Common/bin/Debug/EntityFramework.dll b/Website/LOC.Website.Common/bin/Debug/EntityFramework.dll new file mode 100644 index 000000000..8caef36ac Binary files /dev/null and b/Website/LOC.Website.Common/bin/Debug/EntityFramework.dll differ diff --git a/Website/LOC.Website.Common/bin/Debug/EntityFramework.xml b/Website/LOC.Website.Common/bin/Debug/EntityFramework.xml new file mode 100644 index 000000000..4057d68a4 --- /dev/null +++ b/Website/LOC.Website.Common/bin/Debug/EntityFramework.xml @@ -0,0 +1,18061 @@ + + + + EntityFramework + + + + + Specifies the database column that a property is mapped to. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The name of the column the property is mapped to. + + + + The name of the column the property is mapped to. + + + + + The zero-based order of the column the property is mapped to. + + + + + The database provider specific data type of the column the property is mapped to. + + + + + Denotes that the class is a complex type. + Complex types are non-scalar properties of entity types that enable scalar properties to be organized within entities. + Complex types do not have keys and cannot be managed by the Entity Framework apart from the parent object. + + + + + Specifies how the database generates values for a property. + + + + + Initializes a new instance of the class. + + The pattern used to generate values for the property in the database. + + + + The pattern used to generate values for the property in the database. + + + + + The pattern used to generate values for a property in the database. + + + + + The database does not generate values. + + + + + The database generates a value when a row is inserted. + + + + + The database generates a value when a row is inserted or updated. + + + + + Denotes a property used as a foreign key in a relationship. + The annotation may be placed on the foreign key property and specify the associated navigation property name, + or placed on a navigation property and specify the associated foreign key name. + + + + + Initializes a new instance of the class. + + + If placed on a foreign key property, the name of the associated navigation property. + If placed on a navigation property, the name of the associated foreign key(s). + If a navigation property has multiple foreign keys, a comma separated list should be supplied. + + + + + If placed on a foreign key property, the name of the associated navigation property. + If placed on a navigation property, the name of the associated foreign key(s). + + + + + Specifies the inverse of a navigation property that represents the other end of the same relationship. + + + + + Initializes a new instance of the class. + + The navigation property representing the other end of the same relationship. + + + + The navigation property representing the other end of the same relationship. + + + + + Specifies the maximum length of array/string data allowed in a property. + + + + + Initializes a new instance of the class. + + + The maximum allowable length of array/string data. + Value must be greater than zero. + + + + + Initializes a new instance of the class. + The maximum allowable length supported by the database will be used. + + + + + Determines whether a specified object is valid. (Overrides ) + + + This method returns true if the is null. + It is assumed the is used if the value may not be null. + + The object to validate. + true if the value is null or less than or equal to the specified maximum length, otherwise false + Length is zero or less than negative one. + + + + Applies formatting to a specified error message. (Overrides ) + + The name to include in the formatted string. + A localized string to describe the maximum acceptable length. + + + + Checks that Length has a legal value. Throws InvalidOperationException if not. + + + + + Gets the maximum allowable length of the array/string data. + + + + + Specifies the minimum length of array/string data allowed in a property. + + + + + Initializes a new instance of the class. + + + The minimum allowable length of array/string data. + Value must be greater than or equal to zero. + + + + + Determines whether a specified object is valid. (Overrides ) + + + This method returns true if the is null. + It is assumed the is used if the value may not be null. + + The object to validate. + true if the value is null or greater than or equal to the specified minimum length, otherwise false + Length is less than zero. + + + + Applies formatting to a specified error message. (Overrides ) + + The name to include in the formatted string. + A localized string to describe the minimum acceptable length. + + + + Checks that Length has a legal value. Throws InvalidOperationException if not. + + + + + Gets the minimum allowable length of the array/string data. + + + + + Denotes that a property or class should be excluded from database mapping. + + + + + Specifies the database table that a class is mapped to. + + + + + Initializes a new instance of the class. + + The name of the table the class is mapped to. + + + + The name of the table the class is mapped to. + + + + + The schema of the table the class is mapped to. + + + + + The base for all all Entity Data Model (EDM) types that represent a type from the EDM type system. + + + + + Represents an item in an Entity Data Model (EDM) . + + + + + The base for all all Entity Data Model (EDM) item types that with a Name property that represents a qualified (can be dotted) name. + + + + + The base for all all Entity Data Model (EDM) item types that with a property. + + + + + The base for all all Entity Data Model (EDM) types that support annotation using . + + + + + EdmDataModelItem is the base for all types in the Entity Data Model (EDM) metadata construction and modification API. + + + + + DataModelItem is the base for all types in the EDM metadata reflection, construction and modification API. + + + + + Gets an value indicating which Entity Data Model (EDM) concept is represented by this item. + + + + + IAnnotatedDataModelItem is implemented by model-specific base types for all types with an property. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets or sets the currently assigned annotations. + + + + + Returns all EdmItem children directly contained by this EdmItem. + + + + + INamedDataModelItem is implemented by model-specific base types for all types with a property. + + + + + Gets or sets the currently assigned name. + + + + + Gets or sets the currently assigned name. + + + + + Gets a value indicating whether this type is abstract. + + + + + Gets the optional base type of this type. + + + + + EdmStructuralMember is the base for all types that represent members of structural items in the Entity Data Model (EDM) metadata construction and modification API. + + + + + Represents information about a database connection. + + + + + Creates a new instance of DbConnectionInfo representing a connection that is specified in the application configuration file. + + The name of the connection string in the application configuration. + + + + Creates a new instance of DbConnectionInfo based on a connection string. + + The connection string to use for the connection. + The name of the provider to use for the connection. Use 'System.Data.SqlClient' for SQL Server. + + + + Gets the connection information represented by this instance. + + Configuration to use if connection comes from the configuration file. + + + + Instances of this class are used to create DbConnection objects for + SQL Server LocalDb based on a given database name or connection string. + + + An instance of this class can be set on the class or in the + app.config/web.config for the application to cause all DbContexts created with no + connection information or just a database name to use SQL Server LocalDb by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Implementations of this interface are used to create DbConnection objects for + a type of database server based on a given database name. + An Instance is set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use a certain type of database server by default. + Two implementations of this interface are provided: + is used to create connections to Microsoft SQL Server, including EXPRESS editions. + is used to create connections to Microsoft SQL + Server Compact Editions. + Other implementations for other database servers can be added as needed. + Note that implementations should be thread safe or immutable since they may + be accessed by multiple threads at the same time. + + + + + Creates a connection based on the given database name or connection string. + + The database name or connection string. + An initialized DbConnection. + + + + Creates a new instance of the connection factory for the given version of LocalDb. + For SQL Server 2012 LocalDb use "v11.0". + + The LocalDb version to use. + + + + Creates a new instance of the connection factory for the given version of LocalDb. + For SQL Server 2012 LocalDb use "v11.0". + + + The LocalDb version to use. + + The connection string to use for options to the database other than the 'Initial Catalog', + 'Data Source', and 'AttachDbFilename'. + The 'Initial Catalog' and 'AttachDbFilename' will be prepended to this string based on the + database name when CreateConnection is called. + The 'Data Source' will be set based on the LocalDbVersion argument. + + + + + Creates a connection for SQL Server LocalDb based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + The connection string to use for options to the database other than the 'Initial Catalog', + 'Data Source', and 'AttachDbFilename'. + The 'Initial Catalog' and 'AttachDbFilename' will be prepended to this string based on the + database name when CreateConnection is called. + The 'Data Source' will be set based on the LocalDbVersion argument. + The default is 'Integrated Security=True; MultipleActiveResultSets=True;'. + + + + + Encapsulates a cloned and store . Note that these + objects are disposable and should be used in a using block to ensure both the cloned context and the + cloned connection are disposed. + + + + + For mocking. + + + + + Creates a clone of the given . The underlying of + the context is also cloned and the given connection string is used for the connection string of + the cloned connection. + + + + + Finds the assemblies that were used for loading o-space types in the source context + and loads those assemblies in the cloned context. + + + + + Disposes both the underlying ObjectContext and its store connection. + + + + + The cloned context. + + + + + This is always the store connection of the underlying ObjectContext. + + + + + Represents setting the database initializer for a specific context type + + + + + Represents a parameter to be passed to a method + + + + + Represents a series of parameters to pass to a method + + + + + Adds a new parameter to the collection + Used for unit testing + + + + + Represents the configuration for a series of contexts + + + + + Adds a new context to the collection + Used for unit testing + + + + + Represents the configuration for a specific context type + + + + + Represents setting the default connection factory + + + + + Represents all Entity Framework related configuration + + + + + Handles creating databases either using the core provider or the Migrations pipeline. + + + + + Creates a database using the core provider (i.e. ObjectContext.CreateDatabase) or + by using Code First Migrations to create an empty database + and the perform an automatic migration to the current model. + Migrations is used if Code First is being used and the EF provider is for SQL Server + or SQL Compact. The core is used for non-Code First models and for other providers even + when using Code First. + + + + + A DbContext instance represents a combination of the Unit Of Work and Repository patterns such that + it can be used to query from a database and group together changes that will then be written + back to the store as a unit. + DbContext is conceptually similar to ObjectContext. + + + DbContext is usually used with a derived type that contains properties for + the root entities of the model. These sets are automatically initialized when the + instance of the derived class is created. This behavior can be modified by applying the + attribute to either the entire derived context + class, or to individual properties on the class. + + The Entity Data Model backing the context can be specified in several ways. When using the Code First + approach, the properties on the derived context are used to build a model + by convention. The protected OnModelCreating method can be overridden to tweak this model. More + control over the model used for the Model First approach can be obtained by creating a + explicitly from a and passing this model to one of the DbContext constructors. + + When using the Database First or Model First approach the Entity Data Model can be created using the + Entity Designer (or manually through creation of an EDMX file) and then this model can be specified using + entity connection string or an object. + + The connection to the database (including the name of the database) can be specified in several ways. + If the parameterless DbContext constructor is called from a derived context, then the name of the derived context + is used to find a connection string in the app.config or web.config file. If no connection string is found, then + the name is passed to the DefaultConnectionFactory registered on the class. The connection + factory then uses the context name as the database name in a default connection string. (This default connection + string points to .\SQLEXPRESS on the local machine unless a different DefaultConnectionFactory is registered.) + + Instead of using the derived context name, the connection/database name can also be specified explicitly by + passing the name to one of the DbContext constructors that takes a string. The name can also be passed in + the form "name=myname", in which case the name must be found in the config file or an exception will be thrown. + + Note that the connection found in the app.config or web.config file can be a normal database connection + string (not a special Entity Framework connection string) in which case the DbContext will use Code First. + However, if the connection found in the config file is a special Entity Framework connection string, then the + DbContext will use Database/Model First and the model specified in the connection string will be used. + + An existing or explicitly created DbConnection can also be used instead of the database/connection name. + + A can be applied to a class derived from DbContext to set the + version of conventions used by the context when it creates a model. If no attribute is applied then the + latest version of conventions will be used. + + + + + Interface implemented by objects that can provide an instance. + The class implements this interface to provide access to the underlying + ObjectContext. + + + + + Gets the object context. + + The object context. + + + + Constructs a new context instance using conventions to create the name of the database to + which a connection will be made. The by-convention name is the full name (namespace + class name) + of the derived context class. + See the class remarks for how this is used to create a connection. + + + + + Constructs a new context instance using conventions to create the name of the database to + which a connection will be made, and initializes it from the given model. + The by-convention name is the full name (namespace + class name) of the derived context class. + See the class remarks for how this is used to create a connection. + + The model that will back this context. + + + + Constructs a new context instance using the given string as the name or connection string for the + database to which a connection will be made. + See the class remarks for how this is used to create a connection. + + Either the database name or a connection string. + + + + Constructs a new context instance using the given string as the name or connection string for the + database to which a connection will be made, and initializes it from the given model. + See the class remarks for how this is used to create a connection. + + Either the database name or a connection string. + The model that will back this context. + + + + Constructs a new context instance using the existing connection to connect to a database. + The connection will not be disposed when the context is disposed. + + An existing connection to use for the new context. + If set to true the connection is disposed when + the context is disposed, otherwise the caller must dispose the connection. + + + + Constructs a new context instance using the existing connection to connect to a database, + and initializes it from the given model. + The connection will not be disposed when the context is disposed. + An existing connection to use for the new context. + The model that will back this context. + If set to true the connection is disposed when + the context is disposed, otherwise the caller must dispose the connection. + + + + + Constructs a new context instance around an existing ObjectContext. + An existing ObjectContext to wrap with the new context. + If set to true the ObjectContext is disposed when + the DbContext is disposed, otherwise the caller must dispose the connection. + + + + + Initializes the internal context, discovers and initializes sets, and initializes from a model if one is provided. + + + + + Discovers DbSets and initializes them. + + + + + This method is called when the model for a derived context has been initialized, but + before the model has been locked down and used to initialize the context. The default + implementation of this method does nothing, but it can be overridden in a derived class + such that the model can be further configured before it is locked down. + + + Typically, this method is called only once when the first instance of a derived context + is created. The model for that context is then cached and is for all further instances of + the context in the app domain. This caching can be disabled by setting the ModelCaching + property on the given ModelBuidler, but note that this can seriously degrade performance. + More control over caching is provided through use of the DbModelBuilder and DbContextFactory + classes directly. + + The builder that defines the model for the context being created. + + + + Internal method used to make the call to the real OnModelCreating method. + + The model builder. + + + + Returns a DbSet instance for access to entities of the given type in the context, + the ObjectStateManager, and the underlying store. + + + See the DbSet class for more details. + + The type entity for which a set should be returned. + A set for the given entity type. + + + + Returns a non-generic DbSet instance for access to entities of the given type in the context, + the ObjectStateManager, and the underlying store. + + The type of entity for which a set should be returned. + A set for the given entity type. + + See the DbSet class for more details. + + + + + Saves all changes made in this context to the underlying database. + + The number of objects written to the underlying database. + Thrown if the context has been disposed. + + + + Validates tracked entities and returns a Collection of containing validation results. + + + Collection of validation results for invalid entities. The collection is never null and must not contain null + values or results for valid entities. + + + 1. This method calls DetectChanges() to determine states of the tracked entities unless + DbContextConfiguration.AutoDetectChangesEnabled is set to false. + 2. By default only Added on Modified entities are validated. The user is able to change this behavior + by overriding ShouldValidateEntity method. + + + + + Extension point allowing the user to override the default behavior of validating only + added and modified entities. + + DbEntityEntry instance that is supposed to be validated. + true to proceed with validation. false otherwise. + + + + Extension point allowing the user to customize validation of an entity or filter out validation results. + Called by . + + DbEntityEntry instance to be validated. + User defined dictionary containing additional info for custom validation. + It will be passed to + and will be exposed as . + This parameter is optional and can be null. + Entity validation result. Possibly null when overridden. + + + + Internal method that calls the protected ValidateEntity method. + + DbEntityEntry instance to be validated. + User defined dictionary containing additional info for custom validation. + It will be passed to + and will be exposed as . + This parameter is optional and can be null. + Entity validation result. Possibly null when ValidateEntity is overridden. + + + + Gets a object for the given entity providing access to + information about the entity and the ability to perform actions on the entity. + + The type of the entity. + The entity. + An entry for the entity. + + + + Gets a object for the given entity providing access to + information about the entity and the ability to perform actions on the entity. + + The entity. + An entry for the entity. + + + + Calls the protected Dispose method. + + + + + Disposes the context. The underlying is also disposed if it was created + is by this context or ownership was passed to this context when this context was created. + The connection to the database ( object) is also disposed if it was created + is by this context or ownership was passed to this context when this context was created. + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Creates a Database instance for this context that allows for creation/deletion/existence checks + for the underlying database. + + + + + Returns the Entity Framework ObjectContext that is underlying this context. + + Thrown if the context has been disposed. + + + + Provides access to features of the context that deal with change tracking of entities. + + An object used to access features that deal with change tracking. + + + + Provides access to configuration options for the context. + + An object used to access configuration options. + + + + Provides access to the underlying InternalContext for other parts of the internal design. + + + + + A simple representation of an app.config or web.config file. + + + + + Initializes a new instance of AppConfig based on supplied configuration + + Configuration to load settings from + + + + Initializes a new instance of AppConfig based on supplied connection strings + The default configuration for database initializers and default connection factory will be used + + Connection strings to be used + + + + Initializes a new instance of AppConfig based on the for the AppDomain + + + Use AppConfig.DefaultInstance instead of this constructor + + + + + Appies any database intializers specified in the configuration + + + + + Appies any database intializers specified in the configuration + + + Value indicating if initializers should be re-applied if they have already been applied in this AppDomain + + + + + Gets the specified connection string from the configuration + + Name of the connection string to get + The connection string, or null if there is no connection string with the specified name + + + + Gets the default connection factory based on the configuration + + + + + Gets a singleton instance of configuration based on the for the AppDomain + + + + + Acts as a proxy for that for the most part just passes calls + through to the real object but uses virtual methods/properties such that uses of the object + can be mocked. + + + + + Encapsulates information read from the application config file that specifies a database initializer + and allows that initializer to be dynamically applied. + + + + + Initializes a new instance of the class. + + The key from the entry in the config file. + The value from the enrty in the config file. + + + + Uses the context type and initializer type specified in the config to create an initializer instance + and set it with the DbDbatabase.SetInitializer method. + + + + + Reads all initializers from the application config file and sets them using the Database class. + + + + + Calculates the model hash values used the EdmMetadata table from EF 4.1/4.2. + + + + + Calculates an SHA256 hash of the EDMX from the given code first model. This is the hash stored in + the database in the EdmMetadata table in EF 4.1/4.2. The hash is always calculated using a v2 schema + as was generated by EF 4.1/4.2 and with the entity included in the model. + + + + + Acts as a proxy for that for the most part just passes calls + through to the real object but uses virtual methods/properties such that uses of the object + can be mocked. + + + + + An implementation of that will use Code First Migrations + to update the database to the latest version. + + + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + Initializes a new instance of the MigrateDatabaseToLatestVersion class. + + + + + Initializes a new instance of the MigrateDatabaseToLatestVersion class that will + use a specific connection string from the configuration file to connect to + the database to perform the migration. + + The name of the connection string to use for migration. + + + + + + + Helper class that is used to configure a column. + + + + + Creates a new column definition to store Binary data. + + Value indicating whether or not the column allows null values. + The maximum allowable length of the array data. + Value indicating whether or not all data should be padded to the maximum length. + Value indicating whether or not the maximum length supported by the database provider should be used. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + Value indicating whether or not this column should be configured as a timestamp. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Boolean data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Byte data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store DateTime data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Decimal data. + + Value indicating whether or not the column allows null values. + The numeric precision of the column. + The numeric scale of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + Value indicating whether or not the database will generate values for this column during insert. + The newly constructed column definition. + + + + Creates a new column definition to store Double data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store GUID data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Single data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Short data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Integer data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Long data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store String data. + + Value indicating whether or not the column allows null values. + The maximum allowable length of the string data. + Value indicating whether or not all data should be padded to the maximum length. + Value indicating whether or not the maximum length supported by the database provider should be used. + Value indicating whether or not the column supports Unicode content. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Time data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store DateTimeOffset data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Helper class that is used to further configure a table being created from a CreateTable call on . + + + + + Initializes a new instance of the TableBuilder class. + + The table creation operation to be further configured. + The migration the table is created in. + + + + Specifies a primary key for the table. + + + A lambda expression representing the property to be used as the primary key. + C#: t => t.Id + VB.Net: Function(t) t.Id + + If the primary key is made up of multiple properties then specify an anonymous type including the properties. + C#: t => new { t.Id1, t.Id2 } + VB.Net: Function(t) New With { t.Id1, t.Id2 } + + + The name of the primary key. + If null is supplied, a default name will be generated. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Specifies an index to be created on the table. + + + A lambda expression representing the property to be indexed. + C#: t => t.PropertyOne + VB.Net: Function(t) t.PropertyOne + + If multiple properties are to be indexed then specify an anonymous type including the properties. + C#: t => new { t.PropertyOne, t.PropertyTwo } + VB.Net: Function(t) New With { t.PropertyOne, t.PropertyTwo } + + A value indicating whether or not this is a unique index. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Specifies a foreign key constraint to be created on the table. + + Name of the table that the foreign key constraint targets. + + A lambda expression representing the properties of the foreign key. + C#: t => t.PropertyOne + VB.Net: Function(t) t.PropertyOne + + If multiple properties make up the foreign key then specify an anonymous type including the properties. + C#: t => new { t.PropertyOne, t.PropertyTwo } + VB.Net: Function(t) New With { t.PropertyOne, t.PropertyTwo } + + A value indicating whether or not cascade delete should be configured on the foreign key constraint. + + + The name of this foreign key constraint. + If no name is supplied, a default name will be calculated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Base class for code-based migrations. + + + + + Operations to be performed during the upgrade process. + + + + + Operations to be performed during the downgrade process. + + + + + Adds an operation to create a new table. + + + The columns in this create table operation. + You do not need to specify this type, it will be inferred from the columnsAction parameter you supply. + + The name of the table. Schema name is optional, if no schema is specified then dbo is assumed. + + An action that specifies the columns to be included in the table. + i.e. t => new { Id = t.Int(identity: true), Name = t.String() } + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + An object that allows further configuration of the table creation operation. + + + + Adds an operation to create a new foreign key constraint. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key column. + + The table that contains the column this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The column this foreign key references. + If no value is supplied the primary key of the principal table will be referenced. + + + A value indicating if cascade delete should be configured for the foreign key relationship. + If no value is supplied, cascade delete will be off. + + + The name of the foreign key constraint in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new foreign key constraint. + + + The table that contains the foreign key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key columns. + + The table that contains the columns this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The columns this foreign key references. + If no value is supplied the primary key of the principal table will be referenced. + + + A value indicating if cascade delete should be configured for the foreign key relationship. + If no value is supplied, cascade delete will be off. + + + The name of the foreign key constraint in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on its name. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the foreign key constraint in the database. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on the column it targets. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key column. + + The table that contains the column this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + The columns this foreign key references. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on the columns it targets. + + + The table that contains the foreign key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key columns. + + The table that contains the columns this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + The columns this foreign key references. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a table. + + + The name of the table to be dropped. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to move a table to a new schema. + + + The name of the table to be moved. + Schema name is optional, if no schema is specified then dbo is assumed. + + The schema the table is to be moved to. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to rename a table. To change the schema of a table use MoveTable + + + The name of the table to be renamed. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The new name for the table. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to rename a column. + + + The name of the table that contains the column to be renamed. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be renamed. + The new name for the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to add a column to an existing table. + + + The name of the table to add the column to. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The name of the column to be added. + + + An action that specifies the column to be added. + i.e. c => c.Int(nullable: false, defaultValue: 3) + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing column. + + + The name of the table to drop the column from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to alter the definition of an existing column. + + + The name of the table the column exists in. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be changed. + + An action that specifies the new definition for the column. + i.e. c => c.String(nullable: false, defaultValue: "none") + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new primary key. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The primary key column. + + The name of the primary key in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new primary key based on multiple columns. + + + The table that contains the primary key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The primary key columns. + + The name of the primary key in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing primary key that does not have the default name. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the primary key to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing primary key that was created with the default name. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create an index on a single column. + + + The name of the table to create the index on. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to create the index on. + + A value indicating if this is a unique index. + If no value is supplied a non-unique index will be created. + + + The name to use for the index in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create an index on multiple columns. + + + The name of the table to create the index on. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the columns to create the index on. + + A value indicating if this is a unique index. + If no value is supplied a non-unique index will be created. + + + The name to use for the index in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an index based on its name. + + + The name of the table to drop the index from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the index to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an index based on the columns it targets. + + + The name of the table to drop the index from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column(s) the index targets. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to execute a SQL command. + + The SQL to be executed. + + A value indicating if the SQL should be executed outside of the + transaction being used for the migration process. + If no value is supplied the SQL will be executed within the transaction. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Configuration relating to the use of migrations for a given model. + You will typically create a configuration class that derives + from rather than + using this class. + + + + + Initializes a new instance of the DbMigrationsConfiguration class. + + + + + Adds a new SQL generator to be used for a given database provider. + + Name of the database provider to set the SQL generator for. + The SQL generator to be used. + + + + Gets the SQL generator that is set to be used with a given database provider. + + Name of the database provider to get the SQL generator for. + The SQL generator that is set for the database provider. + + + + Gets or sets a value indicating if automatic migrations can be used when migration the database. + + + + + Gets or sets a value indicating if data loss is acceptable during automatic migration. + If set to false an exception will be thrown if data loss may occur as part of an automatic migration. + + + + + Gets or sets the derived DbContext representing the model to be migrated. + + + + + Gets or sets the namespace used for code-based migrations. + + + + + Gets or sets the sub-directory that code-based migrations are stored in. + + + + + Gets or sets the code generator to be used when scaffolding migrations. + + + + + Gets or sets the assembly containing code-based migrations. + + + + + Gets or sets a value to override the connection of the database to be migrated. + + + + + Gets or sets the timeout value used for the individual commands within a + migration. A null value indicates that the default value of the underlying + provider will be used. + + + + + Configuration relating to the use of migrations for a given model. + + The context representing the model that this configuration applies to. + + + + Initializes a new instance of the DbMigrationsConfiguration class. + + + + + Runs after upgrading to the latest migration to allow seed data to be updated. + + Context to be used for updating seed data. + + + + DbMigrator is used to apply existing migrations to a database. + DbMigrator can be used to upgrade and downgrade to any given migration. + To scaffold migrations based on changes to your model use + + + + + Base class for decorators that wrap the core + + + + + Initializes a new instance of the MigratorBase class. + + The migrator that this decorator is wrapping. + + + + Gets a list of the pending migrations that have not been applied to the database. + + List of migration Ids + + + + Updates the target database to the latest migration. + + + + + Updates the target database to a given migration. + + The migration to upgrade/downgrade to. + + + + Gets a list of the migrations that are defined in the assembly. + + List of migration Ids + + + + Gets a list of the migrations that have been applied to the database. + + List of migration Ids + + + + Gets the configuration being used for the migrations process. + + + + + Migration Id representing the state of the database before any migrations are applied. + + + + + Initializes a new instance of the DbMigrator class. + + Configuration to be used for the migration process. + + + + Gets all migrations that are defined in the configured migrations assembly. + + + + + Gets all migrations that have been applied to the target database. + + + + + Gets all migrations that are defined in the assembly but haven't been applied to the target database. + + + + + Updates the target database to a given migration. + + The migration to upgrade/downgrade to. + + + + Gets the configuration that is being used for the migration process. + + + + + A set of extension methods for + + + + + Adds or updates entities by key when SaveChanges is called. Equivalent to an "upsert" operation + from database terminology. + This method can useful when seeding data using Migrations. + + The entities to add or update. + + When the parameter is a custom or fake IDbSet implementation, this method will + attempt to locate and invoke a public, instance method with the same signature as this extension method. + + + + + Adds or updates entities by a custom identification expression when SaveChanges is called. + Equivalent to an "upsert" operation from database terminology. + This method can useful when seeding data using Migrations. + + + An expression specifying the properties that should be used when determining + whether an Add or Update operation should be performed. + + The entities to add or update. + + When the parameter is a custom or fake IDbSet implementation, this method will + attempt to locate and invoke a public, instance method with the same signature as this extension method. + + + + + Generates C# code for a code-based migration. + + + + + Base class for providers that generate code for code-based migrations. + + + + + Generates the code that should be added to the users project. + + Unique identifier of the migration. + Operations to be performed by the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Gets the namespaces that must be output as "using" or "Imports" directives to handle + the code generated by the given operations. + + The operations for which code is going to be generated. + An ordered list of namespace names. + + + + Gets the default namespaces that must be output as "using" or "Imports" directives for + any code generated. + + A value indicating if this class is being generated for a code-behind file. + An ordered list of namespace names. + + + + + + + Generates the primary code file that the user can view and edit. + + Operations to be performed by the migration. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates the code behind file with migration metadata. + + Unique identifier of the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates a property to return the source or target model in the code behind file. + + Name of the property. + Value to be returned. + Text writer to add the generated code to. + + + + Generates a namespace, using statements and class definition. + + Namespace that code should be generated in. + Name of the class that should be generated. + Text writer to add the generated code to. + Base class for the generated class. + A value indicating if this class is being generated for a code-behind file. + Namespaces for which using directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used. + + + + Generates the closing code for a class that was started with WriteClassStart. + + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify a set of column names using a lambda expression. + + The columns to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify the definition for a . + + The column definition to generate code for. + Text writer to add the generated code to. + A value indicating whether to include the column name in the definition. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column of unknown data type. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Removes any invalid characters from the name of an database artifact. + + The name to be scrubbed. + The scrubbed name. + + + + Gets the type name to use for a column of the given data type. + + The data type to translate. + The type name to use in the generated migration. + + + + Quotes an identifier using appropriate escaping to allow it to be stored in a string. + + The identifier to be quoted. + The quoted identifier. + + + + Scaffolds code-based migrations to apply pending model changes to the database. + + + + + Initializes a new instance of the MigrationScaffolder class. + + Configuration to be used for scaffolding. + + + + Scaffolds a code based migration to apply any pending model changes to the database. + + The name to use for the scaffolded migration. + The scaffolded migration. + + + + Scaffolds a code based migration to apply any pending model changes to the database. + + The name to use for the scaffolded migration. + Whether or not to include model changes. + The scaffolded migration. + + + + Scaffolds the initial code-based migration corresponding to a previously run database initializer. + + The scaffolded migration. + + + + Gets or sets the namespace used in the migration's generated code. + + By default, this is the same as MigrationsNamespace on the migrations + configuration object passed into the constructor. For VB.NET projects, this + will need to be updated to take into account the project's root namespace. + + + + + Represents a code-based migration that has been scaffolded and is ready to be written to a file. + + + + + Gets or sets the unique identifier for this migration. + Typically used for the file name of the generated code. + + + + + Gets or sets the scaffolded migration code that the user can edit. + + + + + Gets or sets the scaffolded migration code that should be stored in a code behind file. + + + + + Gets or sets the programming language used for this migration. + Typically used for the file extension of the generated code. + + + + + Gets or sets the subdirectory in the user's project that this migration should be saved in. + + + + + Gets a dictionary of string resources to add to the migration resource file. + + + + + Represents an exception that occurred while running an operation in another AppDomain in the . + + + + + Initializes a new instance of the ToolingException class. + + Error that explains the reason for the exception. + The type of the exception that was thrown. + The stack trace of the exception that was thrown. + + + + + + + + + + Gets the type of the exception that was thrown. + + + + + Gets the stack trace of the exception that was thrown. + + + + + Helper class that is used by design time tools to run migrations related + commands that need to interact with an application that is being edited + in Visual Studio. + + Because the application is being edited the assemblies need to + be loaded in a separate AppDomain to ensure the latest version + is always loaded. + + The App/Web.config file from the startup project is also copied + to ensure that any configuration is applied. + + + + + Initializes a new instance of the ToolingFacade class. + + + The name of the assembly that contains the migrations configuration to be used. + + + The namespace qualified name of migrations configuration to be used. + + + The working directory containing the compiled assemblies. + + + The path of the config file from the startup project. + + + The path of the application data directory from the startup project. + Typically the App_Data directory for web applications or the working directory for executables. + + + The connection to the database to be migrated. + If null is supplied, the default connection for the context will be used. + + + + + Releases all unmanaged resources used by the facade. + + + + + Gets the fully qualified name of all types deriving from . + + All context types found. + + + + Gets the fully qualified name of a type deriving from . + + The name of the context type. If null, the single context type found in the assembly will be returned. + The context type found. + + + + Gets a list of all migrations that have been applied to the database. + + Ids of applied migrations. + + + + Gets a list of all migrations that have not been applied to the database. + + Ids of pending migrations. + + + + Updates the database to the specified migration. + + + The Id of the migration to migrate to. + If null is supplied, the database will be updated to the latest migration. + + Value indicating if data loss during automatic migration is acceptable. + + + + Generates a SQL script to migrate between two migrations. + + + The migration to update from. + If null is supplied, a script to update the current database will be produced. + + + The migration to update to. + If null is supplied, a script to update to the latest migration will be produced. + + Value indicating if data loss during automatic migration is acceptable. + The generated SQL script. + + + + Scaffolds a code-based migration to apply any pending model changes. + + The name for the generated migration. + The programming language of the generated migration. + The root namespace of the project the migration will be added to. + Whether or not to include model changes. + The scaffolded migration. + + + + Scaffolds the initial code-based migration corresponding to a previously run database initializer. + + The programming language of the generated migration. + The root namespace of the project the migration will be added to. + The scaffolded migration. + + + + + + + Releases all resources used by the facade. + + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + + Gets or sets an action to be run to log information. + + + + + Gets or sets an action to be run to log warnings. + + + + + Gets or sets an action to be run to log verbose information. + + + + + Base class for loggers that can be used for the migrations process. + + + + + Logs an informational message. + + The message to be logged. + + + + Logs a warning that the user should be made aware of. + + The message to be logged. + + + + Logs some additional information that should only be presented to the user if they request verbose output. + + The message to be logged. + + + + Generates VB.Net code for a code-based migration. + + + + + + + + Generates the primary code file that the user can view and edit. + + Operations to be performed by the migration. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates the code behind file with migration metadata. + + Unique identifier of the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates a property to return the source or target model in the code behind file. + + Name of the property. + Value to be returned. + Text writer to add the generated code to. + + + + Generates a namespace, using statements and class definition. + + Namespace that code should be generated in. + Name of the class that should be generated. + Text writer to add the generated code to. + Base class for the generated class. + A value indicating if this class is being generated for a code-behind file. + Namespaces for which Imports directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used. + + + + Generates the closing code for a class that was started with WriteClassStart. + + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify a set of column names using a lambda expression. + + The columns to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify the definition for a . + + The column definition to generate code for. + Text writer to add the generated code to. + A value indicating whether to include the column name in the definition. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column of unknown data type. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Removes any invalid characters from the name of an database artifact. + + The name to be scrubbed. + The scrubbed name. + + + + Gets the type name to use for a column of the given data type. + + The data type to translate. + The type name to use in the generated migration. + + + + Quotes an identifier using appropriate escaping to allow it to be stored in a string. + + The identifier to be quoted. + The quoted identifier. + + + + This class is used by Code First Migrations to read and write migration history + from the database. It is not intended to be used by other code and is only public + so that it can be accessed by EF when running under partial trust. It may be + changed or removed in the future. + + + + + Gets or sets the Id of the migration this row represents. + + + + + Gets or sets the date and time that this migrations history entry was created. + + + + + Gets or sets the state of the model after this migration was applied. + + + + + Gets or sets the version of Entity Framework that created this entry. + + + + + This is a version of the HistoryContext that still includes CreatedOn in its model. + It is used when figuring out whether or not the CreatedOn column exists and so should + be dropped. + + + + + Represents an error that occurs when an automatic migration would result in data loss. + + + + + Represents errors that occur inside the Code First Migrations pipeline. + + + + + Initializes a new instance of the MigrationsException class. + + + + + Initializes a new instance of the MigrationsException class. + + The message that describes the error. + + + + Initializes a new instance of the MigrationsException class. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the MigrationsException class with serialized data. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + + + Initializes a new instance of the AutomaticDataLossException class. + + The message that describes the error. + + + + Represents an error that occurs when there are pending model changes after applying the last migration and automatic migration is disabled. + + + + + Initializes a new instance of the AutomaticMigrationsDisabledException class. + + The message that describes the error. + + + + Provides additional metadata about a code-based migration. + + + + + Gets the unique identifier for the migration. + + + + + Gets the state of the model before this migration is run. + + + + + Gets the state of the model after this migration is run. + + + + + Decorator to provide logging during migrations operations.. + + + + + Initializes a new instance of the MigratorLoggingDecorator class. + + The migrator that this decorator is wrapping. + The logger to write messages to. + + + + Decorator to produce a SQL script instead of applying changes to the database. + Using this decorator to wrap will prevent + from applying any changes to the target database. + + + + + Initializes a new instance of the MigratorScriptingDecorator class. + + The migrator that this decorator is wrapping. + + + + + Represents a column being added to a table. + + + + + Represents an operation to modify a database schema. + + + + + Initializes a new instance of the MigrationOperation class. + + + + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets additional arguments that may be processed by providers. + + + + + Gets an operation that will revert this operation. + + + + + Gets a value indicating if this operation may result in data loss. + + + + + Initializes a new instance of the AddColumnOperation class. + + The name of the table the column should be added to. + Details of the column being added. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column should be added to. + + + + + Gets the details of the column being added. + + + + + Gets an operation that represents dropping the added column. + + + + + + + + Represents a foreign key constraint being added to a table. + + + + + Base class for changes that affect foreign key constraints. + + + + + Initializes a new instance of the ForeignKeyOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the name of the table that the foreign key constraint targets. + + + + + Gets or sets the name of the table that the foreign key columns exist in. + + + + + The names of the foreign key column(s). + + + + + Gets a value indicating if a specific name has been supplied for this foreign key constraint. + + + + + Gets or sets the name of this foreign key constraint. + If no name is supplied, a default name will be calculated. + + + + + Initializes a new instance of the AddForeignKeyOperation class. + The PrincipalTable, PrincipalColumns, DependentTable and DependentColumns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to create an index on the foreign key column(s). + + An operation to add the index. + + + + The names of the column(s) that the foreign key constraint should target. + + + + + Gets or sets a value indicating if cascade delete should be configured on the foreign key constraint. + + + + + Gets an operation to drop the foreign key constraint. + + + + + + + + Represents adding a primary key to a table. + + + + + Common base class to represent operations affecting primary keys. + + + + + Initializes a new instance of the PrimaryKeyOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the name of the table that contains the primary key. + + + + + Gets the column(s) that make up the primary key. + + + + + Gets a value indicating if a specific name has been supplied for this primary key. + + + + + Gets or sets the name of this primary key. + If no name is supplied, a default name will be calculated. + + + + + + + + Initializes a new instance of the AddPrimaryKeyOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to drop the primary key. + + + + + Represents altering an existing column. + + + + + Initializes a new instance of the AlterColumnOperation class. + + The name of the table that the column belongs to. + Details of what the column should be altered to. + Value indicating if this change will result in data loss. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the AlterColumnOperation class. + + The name of the table that the column belongs to. + Details of what the column should be altered to. + Value indicating if this change will result in data loss. + An operation to revert this alteration of the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table that the column belongs to. + + + + + Gets the new definition for the column. + + + + + Gets an operation that represents reverting the alteration. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents information about a column. + + + + + Initializes a new instance of the class. + + The data type for this column. + + + + Initializes a new instance of the class. + + The data type for this column. + + Additional details about the data type. + This includes details such as maximum length, nullability etc. + + + + + Determines if this column is a narrower data type than another column. + Used to determine if altering the supplied column definition to this definition will result in data loss. + + The column to compare to. + Details of the database provider being used. + True if this column is of a narrower data type. + + + + Gets the data type for this column. + + + + + Gets the CLR type corresponding to the database type of this column. + + + + + Gets the default value for the CLR type corresponding to the database type of this column. + + + + + Gets additional details about the data type of this column. + This includes details such as maximum length, nullability etc. + + + + + Gets or sets the name of the column. + + + + + Gets or sets a provider specific data type to use for this column. + + + + + Gets or sets a value indicating if this column can store null values. + + + + + Gets or sets a value indicating if values for this column will be generated by the database using the identity pattern. + + + + + Gets or sets the maximum length for this column. + Only valid for array data types. + + + + + Gets or sets the precision for this column. + Only valid for decimal data types. + + + + + Gets or sets the scale for this column. + Only valid for decimal data types. + + + + + Gets or sets a constant value to use as the default value for this column. + + + + + Gets or sets a SQL expression used as the default value for this column. + + + + + Gets or sets a value indicating if this column is fixed length. + Only valid for array data types. + + + + + Gets or sets a value indicating if this column supports Unicode characters. + Only valid for textual data types. + + + + + Gets or sets a value indicating if this column should be configured as a timestamp. + + + + + Represents creating a database index. + + + + + Common base class for operations affecting indexes. + + + + + Initializes a new instance of the IndexOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the table the index belongs to. + + + + + Gets or sets the columns that are indexed. + + + + + Gets a value indicating if a specific name has been supplied for this index. + + + + + Gets or sets the name of this index. + If no name is supplied, a default name will be calculated. + + + + + Initializes a new instance of the CreateIndexOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets a value indicating if this is a unique index. + + + + + Gets an operation to drop this index. + + + + + + + + Represents creating a table. + + + + + Initializes a new instance of the CreateTableOperation class. + + Name of the table to be created. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be created. + + + + + Gets the columns to be included in the new table. + + + + + Gets or sets the primary key for the new table. + + + + + Gets an operation to drop the table. + + + + + + + + Represents deleting a new record from the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Common base class for operations that affect the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Initializes a new instance of the HistoryOperation class. + + Name of the migrations history table. + Name of the migration being affected. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the migrations history table. + + + + + Gets the name of the migration being affected. + + + + + + + + Initializes a new instance of the DeleteHistoryOperation class. + + Name of the migrations history table. + Id of the migration record to be deleted. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Represents a column being dropped from a table. + + + + + Initializes a new instance of the DropColumnOperation class. + + The name of the table the column should be dropped from. + The name of the column to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropColumnOperation class. + + The name of the table the column should be dropped from. + The name of the column to be dropped. + The operation that represents reverting the drop operation. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column should be dropped from. + + + + + Gets the name of the column to be dropped. + + + + + Gets an operation that represents reverting dropping the column. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents a foreign key constraint being dropped from a table. + + + + + Initializes a new instance of the DropForeignKeyOperation class. + The PrincipalTable, DependentTable and DependentColumns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropForeignKeyOperation class. + + The operation that represents reverting dropping the foreign key constraint. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to drop the associated index on the foreign key column(s). + + An operation to drop the index. + + + + Gets an operation that represents reverting dropping the foreign key constraint. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents dropping an existing index. + + + + + Initializes a new instance of the DropIndexOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropIndexOperation class. + + The operation that represents reverting dropping the index. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation that represents reverting dropping the index. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents dropping a primary key from a table. + + + + + Initializes a new instance of the DropPrimaryKeyOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to add the primary key. + + + + + Represents dropping an existing table. + + + + + Initializes a new instance of the DropTableOperation class. + + The name of the table to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropTableOperation class. + + The name of the table to be dropped. + An operation that represents reverting dropping the table. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be dropped. + + + + + Gets an operation that represents reverting dropping the table. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents inserting a new record into the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Initializes a new instance of the InsertHistoryOperation class. + + Name of the migrations history table. + Id of the migration record to be inserted. + Value to be stored in the model column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the value to store in the history table representing the target model of the migration. + + + + + Gets the value to store in the history table indicating the version of Entity Framework used to produce this migration. + + + + + + + + Represents moving a table from one schema to another. + + + + + Initializes a new instance of the MoveTableOperation class. + + Name of the table to be moved. + Name of the schema to move the table to. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be moved. + + + + + Gets the name of the schema to move the table to. + + + + + Gets an operation that moves the table back to its original schema. + + + + + + + + Represents renaming an existing column. + + + + + Initializes a new instance of the RenameColumnOperation class. + + Name of the table the column belongs to. + Name of the column to be renamed. + New name for the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column belongs to. + + + + + Gets the name of the column to be renamed. + + + + + Gets the new name for the column. + + + + + Gets an operation that reverts the rename. + + + + + + + + Represents renaming an existing table. + + + + + Initializes a new instance of the RenameTableOperation class. + + Name of the table to be renamed. + New name for the table. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be renamed. + + + + + Gets the new name for the table. + + + + + Gets an operation that reverts the rename. + + + + + + + + Represents a provider specific SQL statement to be executed directly against the target database. + + + + + Initializes a new instance of the SqlOperation class. + + The SQL to be executed. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the SQL to be executed. + + + + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + + + + Common base class for providers that convert provider agnostic migration + operations into database provider specific SQL commands. + + + + + Converts a set of migration operations into database provider specific SQL. + + The operations to be converted. + Token representing the version of the database being targeted. + A list of SQL statements to be executed to perform the migration operations. + + + + Represents a migration operation that has been translated into a SQL statement. + + + + + Gets or sets the SQL to be executed to perform this migration operation. + + + + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + Provider to convert provider agnostic migration operations into SQL commands + that can be run against Microsoft SQL Server Compact Edition. + + + + + Provider to convert provider agnostic migration operations into SQL commands + that can be run against a Microsoft SQL Server database. + + + + + Converts a set of migration operations into Microsoft SQL Server specific SQL. + + The operations to be converted. + Token representing the version of SQL Server being targeted (i.e. "2005", "2008"). + A list of SQL statements to be executed to perform the migration operations. + + + + Creates an empty connection for the current provider. + Allows derived providers to use connection other than . + + + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL to mark a table as a system table. + Generated SQL should be added using the Statement method. + + The table to mark as a system table. + + + + Generates SQL to create a database schema. + Generated SQL should be added using the Statement method. + + The name of the schema to create. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL to specify a constant byte[] default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant bool default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant DateTime default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant DateTimeOffset default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant Guid default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant string default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant TimeSpan default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify the data type of a column. + This method just generates the actual type, not the SQL to create the column. + + The definition of the column. + SQL representing the data type. + + + + Generates a quoted name. The supplied name may or may not contain the schema. + + The name to be quoted. + The quoted name. + + + + Quotes an identifier for SQL Server. + + The identifier to be quoted. + The quoted identifier. + + + + Adds a new Statement to be executed against the database. + + The statement to be executed. + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + Gets a new that can be used to build SQL. + + This is just a helper method to create a writer. Writing to the writer will + not cause SQL to be registered for execution. You must pass the generated + SQL to the Statement method. + + An empty text writer to use for SQL generation. + + + + Adds a new Statement to be executed against the database. + + The writer containing the SQL to be executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Utility class to prep the user's config file to run in an AppDomain + + + + + Updates a config file by adding binding redirects for EntityFramework.dll. + This ensures that the user's code can be ran in an AppDomain and the exact + same version of the assembly will be used for both domains. + + That path of the user's config file. Can also be null or a path to an non-existent file. + The path of the updated config file. It is the caller's responsibility to delete this. + + + + The same as but works in partial trust. + + + + + Specifies the default tab string. This field is constant. + + + + + Initializes a new instance of the IndentedTextWriter class using the specified text writer and default tab string. + + The to use for output. + + + + Initializes a new instance of the IndentedTextWriter class using the specified text writer and tab string. + + The to use for output. + The tab string to use for indentation. + + + + Closes the document being written to. + + + + + Flushes the stream. + + + + + Outputs the tab string once for each level of indentation according to the property. + + + + + Writes the specified string to the text stream. + + The string to write. + + + + Writes the text representation of a Boolean value to the text stream. + + The Boolean value to write. + + + + Writes a character to the text stream. + + The character to write. + + + + Writes a character array to the text stream. + + The character array to write. + + + + Writes a subarray of characters to the text stream. + + The character array to write data from. + Starting index in the buffer. + The number of characters to write. + + + + Writes the text representation of a Double to the text stream. + + The double to write. + + + + Writes the text representation of a Single to the text stream. + + The single to write. + + + + Writes the text representation of an integer to the text stream. + + The integer to write. + + + + Writes the text representation of an 8-byte integer to the text stream. + + The 8-byte integer to write. + + + + Writes the text representation of an object to the text stream. + + The object to write. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string. + The object to write into the formatted string. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string to use. + The first object to write into the formatted string. + The second object to write into the formatted string. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string to use. + The argument array to output. + + + + Writes the specified string to a line without tabs. + + The string to write. + + + + Writes the specified string, followed by a line terminator, to the text stream. + + The string to write. + + + + Writes a line terminator. + + + + + Writes the text representation of a Boolean, followed by a line terminator, to the text stream. + + The Boolean to write. + + + + Writes a character, followed by a line terminator, to the text stream. + + The character to write. + + + + Writes a character array, followed by a line terminator, to the text stream. + + The character array to write. + + + + Writes a subarray of characters, followed by a line terminator, to the text stream. + + The character array to write data from. + Starting index in the buffer. + The number of characters to write. + + + + Writes the text representation of a Double, followed by a line terminator, to the text stream. + + The double to write. + + + + Writes the text representation of a Single, followed by a line terminator, to the text stream. + + The single to write. + + + + Writes the text representation of an integer, followed by a line terminator, to the text stream. + + The integer to write. + + + + Writes the text representation of an 8-byte integer, followed by a line terminator, to the text stream. + + The 8-byte integer to write. + + + + Writes the text representation of an object, followed by a line terminator, to the text stream. + + The object to write. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string. + The object to write into the formatted string. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string to use. + The first object to write into the formatted string. + The second object to write into the formatted string. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string to use. + The argument array to output. + + + + Writes the text representation of a UInt32, followed by a line terminator, to the text stream. + + A UInt32 to output. + + + + Gets the encoding for the text writer to use. + + + An that indicates the encoding for the text writer to use. + + + + + Gets or sets the new line character to use. + + + The new line character to use. + + + + + Gets or sets the number of spaces to indent. + + + The number of spaces to indent. + + + + + Gets the to use. + + + The to use. + + + + + Used for generating values that are always in sequential + order for the calling thread. + + + + + Returns the value of unless this value would be the same as the + last value returned by this thread calling this method, in which case the thread pushes the value + a little bit into the future. The comparison is in terms of the form used to store migration ID + in the database--i.e. to the 1/10 second. + + + There should never be any pushing to the future involved for normal use of migrations, but when + this method is called in rapid succession while testing or otherwise calling the DbMigrator APIs + there may be occasional sleeping. + + + + + Same as UtcNow method bur returns the time in the timestamp format used in migration IDs. + + + + + Convention to apply column ordering specified via + or the API. This convention throws if a duplicate configured column order + is detected. + + + + + Convention to apply column ordering specified via + or the API. + + + + + Identifies conventions that can be removed from a instance. + + /// + Note that implementations of this interface must be immutable. + + + + + Strongly-typed and parameterized string resources. + + + + + A string like "Applying automatic migration: {0}." + + + + + A string like "Reverting automatic migration: {0}." + + + + + A string like "Applying code-based migration: {0}." + + + + + A string like "Reverting code-based migration: {0}." + + + + + A string like "Applying code-based migrations: [{1}]." + + + + + A string like "Reverting migrations: [{1}]." + + + + + A string like "Target database is already at version {0}." + + + + + A string like "Target database is: {0}." + + + + + A string like "'{1}' (DataSource: {0}, Provider: {2}, Origin: {3})" + + + + + A string like "The specified target migration '{0}' does not exist. Ensure that target migration refers to an existing migration id." + + + + + A string like "The Foreign Key on table '{0}' with columns '{1}' could not be created because the principal key columns could not be determined. Use the AddForeignKey fluent API to fully specify the Foreign Key." + + + + + A string like "'{0}' is not a valid target migration. When targeting a previously applied automatic migration, use the full migration id including timestamp." + + + + + A string like "'{0}' is not a valid migration. Code-based migrations must be used for both source and target when scripting the upgrade between them." + + + + + A string like "The target context '{0}' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory." + + + + + A string like "The specified migration name '{0}' is ambiguous. Specify the full migration id including timestamp instead." + + + + + A string like "The migrations configuration type '{0}' was not be found in the assembly '{1}'." + + + + + A string like "More than one migrations configuration type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the one to use." + + + + + A string like "No migrations configuration type was found in the assembly '{0}'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)." + + + + + A string like "More than one migrations configuration type was found in the assembly '{0}'. Specify the name of the one to use." + + + + + A string like "The type '{0}' is not a migrations configuration type." + + + + + A string like "The migrations configuration type '{0}' must have a public default constructor." + + + + + A string like "The migrations configuration type '{0}' must not be abstract." + + + + + A string like "The migrations configuration type '{0}' must not be generic." + + + + + A string like "In VB.NET projects, the migrations namespace '{0}' must be under the root namespace '{1}'. Update the migrations project's root namespace to allow classes under the migrations namespace to be added." + + + + + + A string like "No MigrationSqlGenerator found for provider '{0}'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators." + + + + + A string like "Could not load assembly '{0}'. (If you are using Code First Migrations inside Visual Studio this can happen if the startUp project for your solution does not reference the project that contains your migrations. You can either change the startUp project for your solution or use the -StartUpProjectName parameter.)" + + + + + A string like "No context type was found in the assembly '{0}'." + + + + + A string like "More than one context type was found in the assembly '{0}'." + + + + + A string like "To enable migrations for {0}, use Enable-Migrations -ContextTypeName {0}." + + + + + A string like "The context type '{0}' was not found in the assembly '{1}'." + + + + + A string like "More than one context type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the context." + + + + + A string like "The argument '{0}' cannot be null, empty or contain only white space." + + + + + A string like "The argument property '{0}' cannot be null." + + + + + A string like "The precondition '{0}' failed. {1}" + + + + + A string like "The type '{0}' has already been configured as a complex type. It cannot be reconfigured as an entity type." + + + + + A string like "The type '{0}' has already been configured as an entity type. It cannot be reconfigured as a complex type." + + + + + A string like "The key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + A string like "The foreign key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + A string like "The property '{0}' is not a declared property on type '{1}'. Verify that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property." + + + + + A string like "The navigation property '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property." + + + + + A string like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'." + + + + + A string like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. Use dotted paths for nested properties: C#: 't => t.MyProperty.MyProperty' VB.Net: 'Function(t) t.MyProperty.MyProperty'." + + + + + A string like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + A string like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + + A string like "Conflicting configuration settings were specified for property '{0}' on type '{1}': {2}" + + + + + A string like "Conflicting configuration settings were specified for column '{0}' on table '{1}': {2}" + + + + + A string like "{0} = {1} conflicts with {2} = {3}" + + + + + A string like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from ComplexObject." + + + + + A string like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject." + + + + + A string like "The navigation property '{0}' declared on type '{1}' cannot be the inverse of itself." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting foreign keys." + + + + + A string like "Values of incompatible types ('{1}' and '{2}') were assigned to the '{0}' discriminator column. Values of the same type must be specified. To explicitly specify the type of the discriminator column use the HasColumnType method." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting mapping information." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting cascade delete operations using 'WillCascadeOnDelete'." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting multiplicities." + + + + + A string like "The MaxLengthAttribute on property '{0}' on type '{1} is not valid. The Length value must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "The StringLengthAttribute on property '{0}' on type '{1}' is not valid. The maximum length must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "Unable to determine composite primary key ordering for type '{0}'. Use the ColumnAttribute or the HasKey method to specify an order for composite primary keys." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. Name must not be empty." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The foreign key name '{2}' was not found on the dependent type '{3}'. The Name value should be a comma separated list of foreign key property names." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The navigation property '{2}' was not found on the dependent type '{1}'. The Name value should be a valid navigation property name." + + + + + A string like "Unable to determine a composite foreign key ordering for foreign key on type {0}. When using the ForeignKey data annotation on composite foreign key properties ensure order is specified by using the Column data annotation or the fluent API." + + + + + A string like "The InversePropertyAttribute on property '{2}' on type '{3}' is not valid. The property '{0}' is not a valid navigation property on the related type '{1}'. Ensure that the property exists and is a valid reference or collection navigation property." + + + + + A string like "A relationship cannot be established from property '{0}' on type '{1}' to property '{0}' on type '{1}'. Check the values in the InversePropertyAttribute to ensure relationship definitions are unique and reference from one navigation property to its corresponding inverse navigation property." + + + + + A string like "\t{0}: {1}: {2}" + + + + + A string like "A key is registered for the derived type '{0}'. Keys can only be registered for the root type '{1}'." + + + + + A string like "The {0} value '{1}' already exists in the user-defined dictionary." + + + + + A string like "The type '{0}' has already been mapped to table '{1}'. Specify all mapping aspects of a table in a single Map call." + + + + + A string like "Map was called more than once for type '{0}' and at least one of the calls didn't specify the target table name." + + + + + A string like "The derived type '{0}' has already been mapped using the chaining syntax. A derived type can only be mapped once using the chaining syntax." + + + + + A string like "An "is not null" condition cannot be specified on property '{0}' on type '{1}' because this property is not included in the model. Check that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation." + + + + + A string like "Values of type '{0}' cannot be used as type discriminator values. Supported types include byte, signed byte, bool, int16, int32, int64, and string." + + + + + A string like "Unable to add the convention '{0}'. Could not find an existing convention of type '{1}' in the current convention set." + + + + + A string like "Not all properties for type '{0}' have been mapped. Either map those properties or explicitly excluded them from the model." + + + + + A string like "Unable to determine the provider name for connection of type '{0}'." + + + + + A string like "The qualified table name '{0}' contains an invalid schema name. Schema names must have a non-zero length." + + + + + A string like "The qualified table name '{0}' contains an invalid table name. Table names must have a non-zero length." + + + + + A string like "Properties for type '{0}' can only be mapped once. Ensure the MapInheritedProperties method is only used during one call to the Map method." + + + + + A string like "Properties for type '{0}' can only be mapped once. Ensure the Properties method is used and that repeated calls specify each non-key property only once." + + + + + A string like "Properties for type '{0}' can only be mapped once. The non-key property '{1}' is mapped more than once. Ensure the Properties method specifies each non-key property only once." + + + + + A string like "The property '{1}' on type '{0}' cannot be mapped because it has been explicitly excluded from the model or it is of a type not supported by the DbModelBuilderVersion being used." + + + + + A string like "The entity types '{0}' and '{1}' cannot share table '{2}' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them." + + + + + A string like "You cannot use Ignore method on the property '{0}' on type '{1}' because this type inherits from the type '{2}' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type." + + + + + A string like "The property '{0}' cannot be used as a key property on the entity '{1}' because the property type is not a valid key type. Only scalar types, string and byte[] are supported key types." + + + + + A string like "The specified table '{0}' was not found in the model. Ensure that the table name has been correctly specified." + + + + + A string like "The specified association foreign key columns '{0}' are invalid. The number of columns specified must match the number of primary key columns." + + + + + A string like "Unable to determine the principal end of an association between the types '{0}' and '{1}'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." + + + + + A string like "The abstract type '{0}' has no mapped descendents and so cannot be mapped. Either remove '{0}' from the model or add one or more types deriving from '{0}' to the model. " + + + + + A string like "The type '{0}' cannot be mapped as defined because it maps inherited properties from types that use entity splitting or another form of inheritance. Either choose a different inheritance mapping strategy so as to not map inherited properties, or change all types in the hierarchy to map inherited properties and to not use splitting. " + + + + + A string like "The table '{0}' was configured but is not used in any mappings. Verify the mapping configuration for '{0}' is correct." + + + + + A string like "The configured column orders for the table '{0}' contains duplicates. Ensure the specified column order values are distinct." + + + + + A string like "The enum or spatial property '{1}' on type '{0}' cannot be mapped. Use DbModelBuilderVersion 'V5_0' or later to map enum or spatial properties." + + + + + A string like "Multiple potential primary key properties named '{0}' but differing only by case were found on entity type '{1}'. Configure the primary key explicitly using the HasKey fluent API or the KeyAttribute data annotation." + + + + + A string like "Cannot get value for property '{0}' from entity of type '{1}' because the property has no get accessor." + + + + + A string like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor." + + + + + + A string like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor and is in the '{2}' state." + + + + + A string like "Member '{0}' cannot be called for property '{1}' on entity of type '{2}' because the property is not part of the Entity Data Model." + + + + + + A string like "Cannot call the {0} method for an entity of type '{1}' on a DbSet for entities of type '{2}'. Only entities of type '{2}' or derived from type '{2}' can be added, attached, or removed." + + + + + A string like "Cannot call the Create method for the type '{0}' on a DbSet for entities of type '{1}'. Only entities of type '{1}' or derived from type '{1}' can be created." + + + + + + + A string like "The property '{0}' on type '{1}' is a collection navigation property. The Collection method should be used instead of the Reference method." + + + + + A string like "The property '{0}' on type '{1}' is a reference navigation property. The Reference method should be used instead of the Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a navigation property. The Reference and Collection methods can only be used with navigation properties. Use the Property or ComplexProperty method." + + + + + A string like "The property '{0}' on type '{1}' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a complex property. The ComplexProperty method can only be used with complex properties. Use the Property, Reference or Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a primitive property, complex property, collection navigation property, or reference navigation property." + + + + + A string like ""The property '{0}' from the property path '{1}' is not a complex property on type '{2}'. Property paths must be composed of complex properties for all except the final property."" + + + + + A string like ""The property path '{0}' cannot be used for navigation properties. Property paths can only be used to access primitive or complex properties."" + + + + + A string like "The navigation property '{0}' on entity type '{1}' cannot be used for entities of type '{2}' because it refers to entities of type '{3}'." + + + + + A string like "The generic type argument '{0}' cannot be used with the Member method when accessing the collection navigation property '{1}' on entity type '{2}'. The generic type argument '{3}' must be used instead." + + + + + A string like "The property '{0}' on entity type '{1}' cannot be used for objects of type '{2}' because it is a property for objects of type '{3}'." + + + + + A string like "The expression passed to method {0} must represent a property defined on the type '{1}'." + + + + + A string like "{0} cannot be used for entities in the {1} state." + + + + + A string like "Cannot set non-nullable property '{0}' of type '{1}' to null on object of type '{2}'." + + + + + A string like "The property '{0}' in the entity of type '{1}' is null. Store values cannot be obtained for an entity with a null complex property." + + + + + A string like "Cannot assign value of type '{0}' to property '{1}' of type '{2}' in property values for type '{3}'." + + + + + A string like "The '{0}' property does not exist or is not mapped for the type '{1}'." + + + + + A string like "Cannot copy values from DbPropertyValues for type '{0}' into DbPropertyValues for type '{1}'." + + + + + A string like "Cannot copy from property values for object of type '{0}' into property values for object of type '{1}'." + + + + + A string like "The value of the complex property '{0}' on entity of type '{1}' is null. Complex properties cannot be set to null and values cannot be set for null complex properties." + + + + + A string like "The value of the nested property values property '{0}' on the values for entity of type '{1}' is null. Nested property values cannot be set to null and values cannot be set for null complex properties." + + + + + A string like "Cannot set the value of the nested property '{0}' because value of the complex property '{1}' to which it belongs is null." + + + + + A string like "Cannot set the original value of the nested property '{0}' because the original value of the complex property '{1}' to which it belongs is null." + + + + + A string like "The model backing the '{0}' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)." + + + + + A string like "Database '{0}' cannot be created because it already exists." + + + + + + + A string like "Failed to set database initializer of type '{0}' for DbContext type '{1}' specified in the application configuration. See inner exception for details." + + + + + A string like "Configuration for DbContext type '{0}' is specified multiple times in the application configuration. Each context can only be configured once." + + + + + A string like "Failed to set Database.DefaultConnectionFactory to an instance of the '{0}' type as specified in the application configuration. See inner exception for details." + + + + + A string like "The type '{0}' could not be found. The type name must be an assembly-qualified name." + + + + + A string like "The connection string '{0}' in the application's configuration file does not contain the required providerName attribute."" + + + + + A string like "The entity found was of type {0} when an entity of type {1} was requested." + + + + + A string like "The type '{0}' is mapped as a complex type. The Set method, DbSet objects, and DbEntityEntry objects can only be used with entity types, not complex types." + + + + + A string like "The type '{0}' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute." + + + + + A string like "The entity type {0} is not part of the model for the current context." + + + + + A string like "No connection string named '{0}' could be found in the application config file." + + + + + A string like "The collection navigation property '{0}' on the entity of type '{1}' cannot be set because the entity type does not define a navigation property with a set accessor." + + + + + A string like "Multiple object sets per type are not supported. The object sets '{0}' and '{1}' can both contain instances of type '{2}'." + + + + + A string like "The context type '{0}' must have a public constructor taking an EntityConnection." + + + + + A string like "An unexpected exception was thrown during validation of '{0}' when invoking {1}.IsValid. See the inner exception for details." + + + + + A string like "An unexpected exception was thrown during validation of '{0}' when invoking {1}.Validate. See the inner exception for details." + + + + + A string like "The database name '{0}' is not supported because it is an MDF file name. A full connection string must be provided to attach an MDF file." + + + + + A string like "The context factory type '{0}' must have a public default constructor." + + + + + A string like "The '{0}' property of EdmPrimitiveType is fixed and cannot be set." + + + + + A string like "The namespace '{0}' is a system namespace and cannot be used by other schemas. Choose another namespace name." + + + + + A string like "Role '{0}' in AssociationSets '{1}' and '{2}' refers to the same EntitySet '{3}' in EntityContainer '{4}'. Make sure that if two or more AssociationSets refer to the same AssociationType, the ends do not refer to the same EntitySet." + + + + + A string like "The referenced EntitySet '{0}' for End '{1}' could not be found in the containing EntityContainer." + + + + + A string like "Type '{0}' is derived from type '{1}' that is the type for EntitySet '{2}'. Type '{0}' defines new concurrency requirements that are not allowed for subtypes of base EntitySet types." + + + + + A string like "EntitySet '{0}' is based on type '{1}' that has no keys defined." + + + + + A string like "The end name '{0}' is already defined." + + + + + A string like "The key specified in EntityType '{0}' is not valid. Property '{1}' is referenced more than once in the Key element." + + + + + A string like "Property '{0}' has a CollectionKind specified but is not a collection property." + + + + + A string like "Property '{0}' has a CollectionKind specified. CollectionKind is only supported in version 1.1 EDM models." + + + + + A string like "ComplexType '{0}' is marked as abstract. Abstract ComplexTypes are only supported in version 1.1 EDM models." + + + + + A string like "ComplexType '{0}' has a BaseType specified. ComplexType inheritance is only supported in version 1.1 EDM models." + + + + + A string like "Key part '{0}' for type '{1}' is not valid. All parts of the key must be non-nullable." + + + + + A string like "The property '{0}' in EntityType '{1}' is not valid. All properties that are part of the EntityKey must be of PrimitiveType." + + + + + A string like "Key usage is not valid. The {0} class cannot define keys because one of its base classes ('{1}') defines keys." + + + + + A string like "EntityType '{0}' has no key defined. Define the key for this EntityType." + + + + + A string like "NavigationProperty is not valid. Role '{0}' or Role '{1}' is not defined in Relationship '{2}'." + + + + + A string like "End '{0}' on relationship '{1}' cannot have an operation specified because its multiplicity is '*'. Operations cannot be specified on ends with multiplicity '*'." + + + + + A string like "Each Name and PluralName in a relationship must be unique. '{0}' is already defined." + + + + + A string like "In relationship '{0}', the Principal and Dependent Role of the referential constraint refer to the same Role in the relationship type." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Valid values for multiplicity for the Principal Role are '0..1' or '1'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because all the properties in the Dependent Role are nullable, multiplicity of the Principal Role must be '0..1'." + + + + + A string like "Multiplicity conflicts with the referential constraint in Role '{0}' in relationship '{1}'. Because at least one of the properties in the Dependent Role is non-nullable, multiplicity of the Principal Role must be '1'." + + + + + A string like "Multiplicity conflicts with the referential constraint in Role '{0}' in relationship '{1}'. Because all of the properties in the Dependent Role are non-nullable, multiplicity of the Principal Role must be '1'." + + + + + A string like "Properties referred by the Dependent Role '{0}' must be a subset of the key of the EntityType '{1}' referred to by the Dependent Role in the referential constraint for relationship '{2}'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because the Dependent Role refers to the key properties, the upper bound of the multiplicity of the Dependent Role must be '1'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because the Dependent Role properties are not the key properties, the upper bound of the multiplicity of the Dependent Role must be '*'." + + + + + A string like "The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property '{0}' on entity '{1}' does not match the type of property '{2}' on entity '{3}' in the referential constraint '{4}'." + + + + + A string like "There is no property with name '{0}' defined in the type referred to by Role '{1}'." + + + + + A string like "A nullable ComplexType is not supported. Property '{0}' must not allow nulls." + + + + + A string like "A property cannot be of type '{0}'. The property type must be a ComplexType or a PrimitiveType." + + + + + A string like "Each member name in an EntityContainer must be unique. A member with name '{0}' is already defined." + + + + + A string like "Each type name in a schema must be unique. Type name '{0}' is already defined." + + + + + A string like "Name '{0}' cannot be used in type '{1}'. Member names cannot be the same as their enclosing type." + + + + + A string like "Each property name in a type must be unique. Property name '{0}' is already defined." + + + + + A string like "A cycle was detected in the type hierarchy of '{0}'." + + + + + A string like "A property cannot be of type '{0}'. The property type must be a ComplexType, a PrimitiveType, or a CollectionType." + + + + + A string like "A property cannot be of type {0}. The property type must be a ComplexType, a PrimitiveType or an EnumType." + + + + + A string like "The specified name must not be longer than 480 characters: '{0}'." + + + + + A string like "The specified name is not allowed: '{0}'." + + + + + A string like "The field {0} must be a string or array type with a maximum length of '{1}'." + + + + + A string like "The field {0} must be a string or array type with a minimum length of '{1}'." + + + + + A string like "No connection string named '{0}' could be found in the application config file." + + + + + A string like "AutomaticMigration" + + + + + A string like "BootstrapMigration" + + + + + A string like "InitialCreate" + + + + + A string like "Automatic migration was not applied because it would result in data loss." + + + + + A string like "[Inserting migration history record]" + + + + + A string like "[Deleting migration history record]" + + + + + A string like "[Updating EdmMetadata model hash]" + + + + + A string like "Running Seed method." + + + + + A string like "No pending code-based migrations." + + + + + A string like "Explicit" + + + + + A string like "Upgrading history table." + + + + + A string like "Cannot scaffold the next migration because the target database was created with a version of Code First earlier than EF 4.3 and does not contain the migrations history table. To start using migrations against this database, ensure the current model is compatible with the target database and execute the migrations Update process. (In Visual Studio you can use the Update-Database command from Package Manager Console to execute the migrations Update process)." + + + + + A string like "Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration." + + + + + A string like "Scripting the downgrade between two specified migrations is not supported." + + + + + A string like "Direct column renaming is not supported by SQL Server Compact. To rename a column in SQL Server Compact, you will need to recreate it." + + + + + A string like "One or more validation errors were detected during model generation:" + + + + + A string like "A circular ComplexType hierarchy was detected. Self-referencing ComplexTypes are not supported." + + + + + A string like "Connection to the database failed. The connection string is configured with an invalid LocalDB server name. This may have been set in 'global.asax' by a pre-release version of MVC4. The default connection factory is now set in web.config so the line in 'global.asax' starting with 'Database.DefaultConnectionFactory = ' should be removed. See http://go.microsoft.com/fwlink/?LinkId=243166 for details." + + + + + A string like "An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct." + + + + + A string like "Setting IsModified to false for a modified property is not supported." + + + + + A string like "An error occurred while saving entities that do not expose foreign key properties for their relationships. The EntityEntries property will return null because a single entity cannot be identified as the source of the exception. Handling of exceptions while saving can be made easier by exposing foreign key properties in your entity types. See the InnerException for details." + + + + + A string like "The set of property value names is read-only." + + + + + A string like "A property of a complex type must be set to an instance of the generic or non-generic DbPropertyValues class for that type." + + + + + A string like "Model compatibility cannot be checked because the DbContext instance was not created using Code First patterns. DbContext instances created from an ObjectContext or using an EDMX file cannot be checked for compatibility." + + + + + A string like "Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions." + + + + + A string like "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations." + + + + + A string like "The context cannot be used while the model is being created." + + + + + A string like "The DbContext class cannot be used with models that have multiple entity sets per type (MEST)." + + + + + A string like "The operation cannot be completed because the DbContext has been disposed." + + + + + A string like "The provider factory returned a null connection." + + + + + A string like "The DbConnectionFactory instance returned a null connection." + + + + + A string like "The number of primary key values passed must match number of primary key values defined on the entity." + + + + + A string like "The type of one of the primary key values did not match the type defined in the entity. See inner exception for details." + + + + + A string like "Multiple entities were found in the Added state that match the given primary key values." + + + + + A string like "Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList()." + + + + + A string like "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties." + + + + + A string like "Cannot initialize a DbContext from an entity connection string or an EntityConnection instance together with a DbCompiledModel. If an entity connection string or EntityConnection instance is used, then the model will be created from the metadata in the connection. If a DbCompiledModel is used, then the connection supplied should be a standard database connection (for example, a SqlConnection instance) rather than an entity connection." + + + + + A string like "Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used." + + + + + A string like "Validation failed for one or more entities. See 'EntityValidationErrors' property for more details." + + + + + A string like "An exception occurred while initializing the database. See the InnerException for details." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing ObjectContext is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing DbCompiledModel is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Code generated using the T4 templates for Database First and Model First development may not work correctly if used in Code First mode. To continue using Database First or Model First ensure that the Entity Framework connection string is specified in the config file of executing application. To use these classes, that were generated from Database First or Model First, with Code First add any additional configuration using attributes or the DbModelBuilder API and then remove the code that throws this exception." + + + + + A string like "The generic 'Set' method cannot be called with a proxy type. Either use the actual entity type or call the non-generic 'Set' method." + + + + + A string like "NavigationProperty is not valid. The FromRole and ToRole are the same." + + + + + A string like "OnDelete can be specified on only one End of an EdmAssociation." + + + + + A string like "The number of properties in the Dependent and Principal Roles in a relationship constraint must be identical." + + + + + A string like "The name is missing or not valid." + + + + + A string like "AssociationEnd must not be null." + + + + + A string like "DependentEnd must not be null." + + + + + A string like "DependentProperties must not be empty." + + + + + A string like "Association must not be null." + + + + + A string like "ResultEnd must not be null." + + + + + A string like "EntityType must not be null." + + + + + A string like "ElementType must not be null." + + + + + A string like "ElementType must not be null." + + + + + A string like "SourceSet must not be null." + + + + + A string like "TargetSet must not be null." + + + + + A string like "The type is not a valid EdmTypeReference." + + + + + A string like "Serializer can only serialize an EdmModel that has one EdmNamespace and one EdmEntityContainer." + + + + + A string like "MaxLengthAttribute must have a Length value that is greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "MinLengthAttribute must have a Length value that is zero or greater." + + + + + A string like "The connection can not be overridden because this context was created from an existing ObjectContext." + + + + + A string like "Can not override the connection for this context with a standard DbConnection because the original connection was an EntityConnection." + + + + + A string like "Can not override the connection for this context with an EntityConnection because the original connection was a standard DbConnection." + + + + + Strongly-typed and parameterized exception factory. + + + + + Migrations.Infrastructure.AutomaticDataLossException with message like "Automatic migration was not applied because it would result in data loss." + + + + + Migrations.Infrastructure.MigrationsException with message like "Cannot scaffold the next migration because the target database was created with a version of Code First earlier than EF 4.3 and does not contain the migrations history table. To start using migrations against this database, ensure the current model is compatible with the target database and execute the migrations Update process. (In Visual Studio you can use the Update-Database command from Package Manager Console to execute the migrations Update process)." + + + + + Migrations.Infrastructure.MigrationsException with message like "The specified target migration '{0}' does not exist. Ensure that target migration refers to an existing migration id." + + + + + Migrations.Infrastructure.MigrationsException with message like "The Foreign Key on table '{0}' with columns '{1}' could not be created because the principal key columns could not be determined. Use the AddForeignKey fluent API to fully specify the Foreign Key." + + + + + Migrations.Infrastructure.MigrationsException with message like "'{0}' is not a valid target migration. When targeting a previously applied automatic migration, use the full migration id including timestamp." + + + + + Migrations.Infrastructure.MigrationsException with message like "'{0}' is not a valid migration. Code-based migrations must be used for both source and target when scripting the upgrade between them." + + + + + Migrations.Infrastructure.MigrationsException with message like "The target context '{0}' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory." + + + + + Migrations.Infrastructure.MigrationsException with message like "The specified migration name '{0}' is ambiguous. Specify the full migration id including timestamp instead." + + + + + Migrations.Infrastructure.AutomaticMigrationsDisabledException with message like "Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration." + + + + + Migrations.Infrastructure.MigrationsException with message like "Scripting the downgrade between two specified migrations is not supported." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' was not be found in the assembly '{1}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one migrations configuration type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the one to use." + + + + + Migrations.Infrastructure.MigrationsException with message like "No migrations configuration type was found in the assembly '{0}'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one migrations configuration type was found in the assembly '{0}'. Specify the name of the one to use." + + + + + Migrations.Infrastructure.MigrationsException with message like "The type '{0}' is not a migrations configuration type." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must have a public default constructor." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must not be abstract." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must not be generic." + + + + + Migrations.Infrastructure.MigrationsException with message like "Direct column renaming is not supported by SQL Server Compact. To rename a column in SQL Server Compact, you will need to recreate it." + + + + + Migrations.Infrastructure.MigrationsException with message like "In VB.NET projects, the migrations namespace '{0}' must be under the root namespace '{1}'. Update the migrations project's root namespace to allow classes under the migrations namespace to be added." + + + + + + Migrations.Infrastructure.MigrationsException with message like "No MigrationSqlGenerator found for provider '{0}'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators." + + + + + Migrations.Infrastructure.MigrationsException with message like "No context type was found in the assembly '{0}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "The context type '{0}' was not found in the assembly '{1}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one context type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the context." + + + + + ArgumentException with message like "The argument '{0}' cannot be null, empty or contain only white space." + + + + + ArgumentException with message like "The argument property '{0}' cannot be null." + + + + + ArgumentException with message like "The precondition '{0}' failed. {1}" + + + + + InvalidOperationException with message like "The type '{0}' has already been configured as a complex type. It cannot be reconfigured as an entity type." + + + + + InvalidOperationException with message like "The type '{0}' has already been configured as an entity type. It cannot be reconfigured as a complex type." + + + + + InvalidOperationException with message like "The key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + InvalidOperationException with message like "The foreign key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + InvalidOperationException with message like "The property '{0}' is not a declared property on type '{1}'. Verify that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property." + + + + + InvalidOperationException with message like "The navigation property '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property." + + + + + InvalidOperationException with message like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'." + + + + + InvalidOperationException with message like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. Use dotted paths for nested properties: C#: 't => t.MyProperty.MyProperty' VB.Net: 'Function(t) t.MyProperty.MyProperty'." + + + + + InvalidOperationException with message like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + InvalidOperationException with message like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + + InvalidOperationException with message like "Conflicting configuration settings were specified for property '{0}' on type '{1}': {2}" + + + + + InvalidOperationException with message like "Conflicting configuration settings were specified for column '{0}' on table '{1}': {2}" + + + + + InvalidOperationException with message like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from ComplexObject." + + + + + InvalidOperationException with message like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' cannot be the inverse of itself." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting foreign keys." + + + + + MappingException with message like "Values of incompatible types ('{1}' and '{2}') were assigned to the '{0}' discriminator column. Values of the same type must be specified. To explicitly specify the type of the discriminator column use the HasColumnType method." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting mapping information." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting cascade delete operations using 'WillCascadeOnDelete'." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting multiplicities." + + + + + InvalidOperationException with message like "The MaxLengthAttribute on property '{0}' on type '{1} is not valid. The Length value must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "The StringLengthAttribute on property '{0}' on type '{1}' is not valid. The maximum length must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "Unable to determine composite primary key ordering for type '{0}'. Use the ColumnAttribute or the HasKey method to specify an order for composite primary keys." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. Name must not be empty." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The foreign key name '{2}' was not found on the dependent type '{3}'. The Name value should be a comma separated list of foreign key property names." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The navigation property '{2}' was not found on the dependent type '{1}'. The Name value should be a valid navigation property name." + + + + + InvalidOperationException with message like "Unable to determine a composite foreign key ordering for foreign key on type {0}. When using the ForeignKey data annotation on composite foreign key properties ensure order is specified by using the Column data annotation or the fluent API." + + + + + InvalidOperationException with message like "The InversePropertyAttribute on property '{2}' on type '{3}' is not valid. The property '{0}' is not a valid navigation property on the related type '{1}'. Ensure that the property exists and is a valid reference or collection navigation property." + + + + + InvalidOperationException with message like "A relationship cannot be established from property '{0}' on type '{1}' to property '{0}' on type '{1}'. Check the values in the InversePropertyAttribute to ensure relationship definitions are unique and reference from one navigation property to its corresponding inverse navigation property." + + + + + InvalidOperationException with message like "A key is registered for the derived type '{0}'. Keys can only be registered for the root type '{1}'." + + + + + InvalidOperationException with message like "The type '{0}' has already been mapped to table '{1}'. Specify all mapping aspects of a table in a single Map call." + + + + + InvalidOperationException with message like "Map was called more than once for type '{0}' and at least one of the calls didn't specify the target table name." + + + + + InvalidOperationException with message like "The derived type '{0}' has already been mapped using the chaining syntax. A derived type can only be mapped once using the chaining syntax." + + + + + InvalidOperationException with message like "An "is not null" condition cannot be specified on property '{0}' on type '{1}' because this property is not included in the model. Check that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation." + + + + + ArgumentException with message like "Values of type '{0}' cannot be used as type discriminator values. Supported types include byte, signed byte, bool, int16, int32, int64, and string." + + + + + InvalidOperationException with message like "Unable to add the convention '{0}'. Could not find an existing convention of type '{1}' in the current convention set." + + + + + InvalidOperationException with message like "Not all properties for type '{0}' have been mapped. Either map those properties or explicitly excluded them from the model." + + + + + NotSupportedException with message like "Unable to determine the provider name for connection of type '{0}'." + + + + + ArgumentException with message like "The qualified table name '{0}' contains an invalid schema name. Schema names must have a non-zero length." + + + + + ArgumentException with message like "The qualified table name '{0}' contains an invalid table name. Table names must have a non-zero length." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. Ensure the MapInheritedProperties method is only used during one call to the Map method." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. Ensure the Properties method is used and that repeated calls specify each non-key property only once." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. The non-key property '{1}' is mapped more than once. Ensure the Properties method specifies each non-key property only once." + + + + + InvalidOperationException with message like "The property '{1}' on type '{0}' cannot be mapped because it has been explicitly excluded from the model or it is of a type not supported by the DbModelBuilderVersion being used." + + + + + InvalidOperationException with message like "The entity types '{0}' and '{1}' cannot share table '{2}' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them." + + + + + InvalidOperationException with message like "You cannot use Ignore method on the property '{0}' on type '{1}' because this type inherits from the type '{2}' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type." + + + + + InvalidOperationException with message like "The property '{0}' cannot be used as a key property on the entity '{1}' because the property type is not a valid key type. Only scalar types, string and byte[] are supported key types." + + + + + InvalidOperationException with message like "The specified table '{0}' was not found in the model. Ensure that the table name has been correctly specified." + + + + + InvalidOperationException with message like "The specified association foreign key columns '{0}' are invalid. The number of columns specified must match the number of primary key columns." + + + + + InvalidOperationException with message like "A circular ComplexType hierarchy was detected. Self-referencing ComplexTypes are not supported." + + + + + InvalidOperationException with message like "Unable to determine the principal end of an association between the types '{0}' and '{1}'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." + + + + + InvalidOperationException with message like "The abstract type '{0}' has no mapped descendents and so cannot be mapped. Either remove '{0}' from the model or add one or more types deriving from '{0}' to the model. " + + + + + NotSupportedException with message like "The type '{0}' cannot be mapped as defined because it maps inherited properties from types that use entity splitting or another form of inheritance. Either choose a different inheritance mapping strategy so as to not map inherited properties, or change all types in the hierarchy to map inherited properties and to not use splitting. " + + + + + InvalidOperationException with message like "The table '{0}' was configured but is not used in any mappings. Verify the mapping configuration for '{0}' is correct." + + + + + InvalidOperationException with message like "The configured column orders for the table '{0}' contains duplicates. Ensure the specified column order values are distinct." + + + + + NotSupportedException with message like "The enum or spatial property '{1}' on type '{0}' cannot be mapped. Use DbModelBuilderVersion 'V5_0' or later to map enum or spatial properties." + + + + + InvalidOperationException with message like "Multiple potential primary key properties named '{0}' but differing only by case were found on entity type '{1}'. Configure the primary key explicitly using the HasKey fluent API or the KeyAttribute data annotation." + + + + + InvalidOperationException with message like "Cannot get value for property '{0}' from entity of type '{1}' because the property has no get accessor." + + + + + InvalidOperationException with message like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor." + + + + + + NotSupportedException with message like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor and is in the '{2}' state." + + + + + InvalidOperationException with message like "Member '{0}' cannot be called for property '{1}' on entity of type '{2}' because the property is not part of the Entity Data Model." + + + + + + ArgumentException with message like "Cannot call the {0} method for an entity of type '{1}' on a DbSet for entities of type '{2}'. Only entities of type '{2}' or derived from type '{2}' can be added, attached, or removed." + + + + + ArgumentException with message like "Cannot call the Create method for the type '{0}' on a DbSet for entities of type '{1}'. Only entities of type '{1}' or derived from type '{1}' can be created." + + + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is a collection navigation property. The Collection method should be used instead of the Reference method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is a reference navigation property. The Reference method should be used instead of the Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a navigation property. The Reference and Collection methods can only be used with navigation properties. Use the Property or ComplexProperty method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a complex property. The ComplexProperty method can only be used with complex properties. Use the Property, Reference or Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a primitive property, complex property, collection navigation property, or reference navigation property." + + + + + ArgumentException with message like ""The property '{0}' from the property path '{1}' is not a complex property on type '{2}'. Property paths must be composed of complex properties for all except the final property."" + + + + + NotSupportedException with message like "Setting IsModified to false for a modified property is not supported." + + + + + ArgumentException with message like ""The property path '{0}' cannot be used for navigation properties. Property paths can only be used to access primitive or complex properties."" + + + + + ArgumentException with message like "The navigation property '{0}' on entity type '{1}' cannot be used for entities of type '{2}' because it refers to entities of type '{3}'." + + + + + ArgumentException with message like "The generic type argument '{0}' cannot be used with the Member method when accessing the collection navigation property '{1}' on entity type '{2}'. The generic type argument '{3}' must be used instead." + + + + + ArgumentException with message like "The property '{0}' on entity type '{1}' cannot be used for objects of type '{2}' because it is a property for objects of type '{3}'." + + + + + ArgumentException with message like "The expression passed to method {0} must represent a property defined on the type '{1}'." + + + + + InvalidOperationException with message like "{0} cannot be used for entities in the {1} state." + + + + + InvalidOperationException with message like "Cannot set non-nullable property '{0}' of type '{1}' to null on object of type '{2}'." + + + + + InvalidOperationException with message like "The property '{0}' in the entity of type '{1}' is null. Store values cannot be obtained for an entity with a null complex property." + + + + + InvalidOperationException with message like "Cannot assign value of type '{0}' to property '{1}' of type '{2}' in property values for type '{3}'." + + + + + NotSupportedException with message like "The set of property value names is read-only." + + + + + ArgumentException with message like "The '{0}' property does not exist or is not mapped for the type '{1}'." + + + + + ArgumentException with message like "Cannot copy values from DbPropertyValues for type '{0}' into DbPropertyValues for type '{1}'." + + + + + ArgumentException with message like "Cannot copy from property values for object of type '{0}' into property values for object of type '{1}'." + + + + + ArgumentException with message like "A property of a complex type must be set to an instance of the generic or non-generic DbPropertyValues class for that type." + + + + + InvalidOperationException with message like "The value of the complex property '{0}' on entity of type '{1}' is null. Complex properties cannot be set to null and values cannot be set for null complex properties." + + + + + InvalidOperationException with message like "The value of the nested property values property '{0}' on the values for entity of type '{1}' is null. Nested property values cannot be set to null and values cannot be set for null complex properties." + + + + + InvalidOperationException with message like "Cannot set the value of the nested property '{0}' because value of the complex property '{1}' to which it belongs is null." + + + + + InvalidOperationException with message like "Cannot set the original value of the nested property '{0}' because the original value of the complex property '{1}' to which it belongs is null." + + + + + InvalidOperationException with message like "The model backing the '{0}' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)." + + + + + InvalidOperationException with message like "Database '{0}' cannot be created because it already exists." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the DbContext instance was not created using Code First patterns. DbContext instances created from an ObjectContext or using an EDMX file cannot be checked for compatibility." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations." + + + + + + + InvalidOperationException with message like "Failed to set database initializer of type '{0}' for DbContext type '{1}' specified in the application configuration. See inner exception for details." + + + + + InvalidOperationException with message like "Configuration for DbContext type '{0}' is specified multiple times in the application configuration. Each context can only be configured once." + + + + + InvalidOperationException with message like "Failed to set Database.DefaultConnectionFactory to an instance of the '{0}' type as specified in the application configuration. See inner exception for details." + + + + + InvalidOperationException with message like "The type '{0}' could not be found. The type name must be an assembly-qualified name." + + + + + InvalidOperationException with message like "The context cannot be used while the model is being created." + + + + + InvalidOperationException with message like "The DbContext class cannot be used with models that have multiple entity sets per type (MEST)." + + + + + InvalidOperationException with message like "The operation cannot be completed because the DbContext has been disposed." + + + + + InvalidOperationException with message like "The provider factory returned a null connection." + + + + + InvalidOperationException with message like "The connection string '{0}' in the application's configuration file does not contain the required providerName attribute."" + + + + + InvalidOperationException with message like "The DbConnectionFactory instance returned a null connection." + + + + + ArgumentException with message like "The number of primary key values passed must match number of primary key values defined on the entity." + + + + + ArgumentException with message like "The type of one of the primary key values did not match the type defined in the entity. See inner exception for details." + + + + + InvalidOperationException with message like "The entity found was of type {0} when an entity of type {1} was requested." + + + + + InvalidOperationException with message like "Multiple entities were found in the Added state that match the given primary key values." + + + + + InvalidOperationException with message like "The type '{0}' is mapped as a complex type. The Set method, DbSet objects, and DbEntityEntry objects can only be used with entity types, not complex types." + + + + + InvalidOperationException with message like "The type '{0}' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute." + + + + + InvalidOperationException with message like "The entity type {0} is not part of the model for the current context." + + + + + NotSupportedException with message like "Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList()." + + + + + ArgumentException with message like "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties." + + + + + InvalidOperationException with message like "No connection string named '{0}' could be found in the application config file." + + + + + InvalidOperationException with message like "Cannot initialize a DbContext from an entity connection string or an EntityConnection instance together with a DbCompiledModel. If an entity connection string or EntityConnection instance is used, then the model will be created from the metadata in the connection. If a DbCompiledModel is used, then the connection supplied should be a standard database connection (for example, a SqlConnection instance) rather than an entity connection." + + + + + NotSupportedException with message like "The collection navigation property '{0}' on the entity of type '{1}' cannot be set because the entity type does not define a navigation property with a set accessor." + + + + + NotSupportedException with message like "Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used." + + + + + InvalidOperationException with message like "Multiple object sets per type are not supported. The object sets '{0}' and '{1}' can both contain instances of type '{2}'." + + + + + InvalidOperationException with message like "The context type '{0}' must have a public constructor taking an EntityConnection." + + + + + NotSupportedException with message like "The database name '{0}' is not supported because it is an MDF file name. A full connection string must be provided to attach an MDF file." + + + + + DataException with message like "An exception occurred while initializing the database. See the InnerException for details." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing ObjectContext is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing DbCompiledModel is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + InvalidOperationException with message like "The context factory type '{0}' must have a public default constructor." + + + + + InvalidOperationException with message like "The generic 'Set' method cannot be called with a proxy type. Either use the actual entity type or call the non-generic 'Set' method." + + + + + InvalidOperationException with message like "MaxLengthAttribute must have a Length value that is greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "MinLengthAttribute must have a Length value that is zero or greater." + + + + + InvalidOperationException with message like "No connection string named '{0}' could be found in the application config file." + + + + + InvalidOperationException with message like "The connection can not be overridden because this context was created from an existing ObjectContext." + + + + + InvalidOperationException with message like "Can not override the connection for this context with a standard DbConnection because the original connection was an EntityConnection." + + + + + InvalidOperationException with message like "Can not override the connection for this context with an EntityConnection because the original connection was a standard DbConnection." + + + + + The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument. + + + + + The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method. + + + + + The exception that is thrown when the author has yet to implement the logic at this point in the program. This can act as an exception based TODO tag. + + + + + The exception that is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or write to a stream that does not support the invoked functionality. + + + + + AutoGenerated resource class. Usage: + + string s = EntityRes.GetString(EntityRes.MyIdenfitier); + + + + + Allows the construction and modification of a user-specified annotation (name-value pair) on a instance. + + + + + Gets or sets an optional namespace that can be used to distinguish the annotation from others with the same value. + + + + + Gets or sets the name of the annotation. + + + + + Gets or sets the value of the annotation. + + + + + + + + + DataModelEventArgs is the base argument type for all events raised by consumers of Entity Data Model (EDM) models. + + + + + Gets a value indicating the that caused the event to be raised. + + + + + Gets an optional value indicating which property of the source item caused the event to be raised. + + + + + Gets a value that identifies the specific error that is being raised. + + + + + Gets an optional descriptive message the describes the error that is being raised. + + + + + DbAliasedMetadataItem provides the base type for all Database Metadata types that can have an optional that should be used instead of the item's when referring to the item in the database. + + + + + NamedDbItem is the base for all types in the Database Metadata construction and modification API with a property. + + + + + The base for all all Database Metadata types that support annotation using . + + + + + DbDataModelItem is the base for all types in the Database Metadata construction and modification API. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets or sets the currently assigned name. + + + + + Gets an optional alternative identifier that should be used when referring to this item in the database. + + + + + When implemented in derived types, allows the construction and modification of a column in a Database Metadata table or row. + + + + + Gets or sets a string indicating the database-specific type of the column. + + + + + Gets or sets a value indicating whether the column is nullable. + + + + + Gets or sets an optional instance that applies additional constraints to the referenced database-specific type of the column. + + + + + Allows the construction and modification of a database in a Database Metadata model. + + + + + Gets or sets an optional value that indicates the database model version. + + + + + Gets or sets the collection of instances that specifies the schemas within the database. + + + + + Allows the construction and modification of a foreign key constraint sourced by a instance. + + + + + Gets or sets the to take when a delete operation is attempted. + + + + + Indicates which Database Metadata concept is represented by a given item. + + + + + Database Kind + + + + + Schema Kind + + + + + Foreign Key Constraint Kind + + + + + Function Kind + + + + + Function Parameter Kind + + + + + Function Return or Parameter Type Kind + + + + + Row Column Kind + + + + + Table Kind + + + + + Table Column Kind + + + + + Primitive Facets Kind + + + + + Specifies the action to take on a given operation. + + + + + Default behavior + + + + + Restrict the operation + + + + + Cascade the operation + + + + + Allows the construction and modification of additional constraints that can be applied to a specific use of a primitive type in a Database Metadata item. + + + + + Returns true if any facet value property currently has a non-null value; otherwise returns false . + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have a fixed or variable length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have its intrinsic maximum length, rather than a specific value. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to be Unicode or non-Unicode. + + + + + Gets or sets an optional value indicating the current constraint on the type's maximum length. + + + + + Gets or sets an optional value indicating the current constraint on the type's precision. + + + + + Gets or sets an optional value indicating the current constraint on the type's scale. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating whether the spatial type is to be type checked strictly. + + + + + Allows the construction and modification of a database schema in a database model. + + + + + Gets or sets the collection of instances that specifies the tables declared within the schema. + + + + + DbSchemaMetadataItem is the base for all types that can be contained in a schema. + + + + + Allows the construction and modification of a column in a table. + + + + + Gets or sets a value indicating whether the column is part of the table's primary key. + + + + + Gets or sets a value indicating if and how the value of the column is automatically generated. + + + + + Gets or sets an optional value indicating the collation specific to this table column. + + + + + Gets or sets an optional value that specifies the default value for the column. + + + + + Allows the construction and modification a table in a database schema. + + + + + Gets or sets the collection of instances that specifies the columns present within the table. + + + + + Gets or sets the collection of instances from the collection of the table that are part of the primary key. + + + + + Gets or sets the collection of instances that defines the foreign key constraints sourced from the table. + + + + + Represents a specific use of a type in a Database Metadata item. + + + + + Gets or sets an optional instance that applies additional constraints to a referenced primitive type. + + + Accessing this property forces the creation of a DbPrimitiveTypeFacets value if no value has previously been set. Use to determine whether or not this property currently has a value. + + + + + Gets or sets a value indicating whether the represented type is a collection type. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered nullable. + + + + + Gets a value indicating whether the type has been configured as a row type by the addition of one or more RowColumns. + + + + + Represents the mapping of an EDM association end ( ) as a collection of property mappings ( ). + + + + + DbMappingMetadataItem is the base for all types in the EDM-to-Database Mapping construction and modification API that support annotation using . + + + + + DbMappingModelItem is the base for all types in the EDM-to-Database Mapping construction and modification API. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets an value representing the association end that is being mapped. + + + + + Gets the collection of s that specifies how the association end key properties are mapped to the table. + + + + + Gets an value representing the association set that is being mapped. + + + + + Gets a value representing the table to which the entity type's properties are being mapped. + + + + + Gets the collection of s that specifies the constant or null values that columns in must have for this type mapping to apply. + + + + + Allows the construction and modification of a condition for a column in a database table. + + + + + Gets or sets a value representing the table column which must contain for this condition to hold. + + + + + Gets or sets the value that must contain for this condition to hold. + + + + + Gets or sets an value representing the model that is being mapped. + + + + + Gets or sets a value representing the database that is the target of the mapping. + + + + + Gets or sets the collection of s that specifies how the model's entity containers are mapped to the database. + + + + + Represents the mapping of an entity property to a column in a database table. + + + + + Gets or sets the collection of instances that defines the mapped property, beginning from a property declared by the mapped entity type and optionally proceeding through properties of complex property result types. + + + + + Gets or sets a value representing the table column to which the entity property is being mapped. + + + + + Allows the construction and modification of the mapping of an EDM entity container ( ) to a database ( ). + + + + + Gets or sets an value representing the entity container that is being mapped. + + + + + Gets or sets the collection of s that specifies how the container's entity sets are mapped to the database. + + + + + Gets the collection of s that specifies how the container's association sets are mapped to the database. + + + + + Allows the construction and modification of the mapping of an EDM entity set ( ) to a database ( ). + + + + + Gets or sets an value representing the entity set that is being mapped. + + + + + Gets or sets the collection of s that specifies how the set's entity types are mapped to the database. + + + + + Allows the construction and modification of a complete or partial mapping of an EDM entity type ( ) or type hierarchy to a specific database table ( ). + + + + + Gets or sets an value representing the entity type or hierarchy that is being mapped. + + + + + Gets or sets a value indicating whether this type mapping applies to and all its direct or indirect subtypes ( true ), or only to ( false ). + + + + + Gets a value representing the table to which the entity type's properties are being mapped. + + + + + Gets the collection of s that specifies how the type's properties are mapped to the table. + + + + + Gets the collection of s that specifies the constant or null values that columns in must have for this type mapping fragment to apply. + + + + + Indicates which EDM-to-Database Mapping concept is represented by a given item. + + + + + Database Mapping Kind + + + + + Entity Container Mapping Kind + + + + + Entity Set Mapping Kind + + + + + Association Set Mapping Kind + + + + + Entity Type Mapping Kind + + + + + Query View Mapping Kind + + + + + Entity Type Mapping Fragment Kind + + + + + Edm Property Mapping Kind + + + + + Association End Mapping Kind + + + + + Column Condition Kind + + + + + Property Condition Kind + + + + + Allows the construction and modification of a constraint applied to an Entity Data Model (EDM) association. + + + + + Gets or sets the that represents the 'dependent' end of the constraint; properties from this association end's entity type contribute to the collection. + + + + + Gets or sets the collection of instances from the of the constraint. The values of these properties are constrained against the primary key values of the remaining, 'principal' association end's entity type. + + + + + Allows the construction and modification of one end of an Entity Data Model (EDM) association. + + + + + Gets or sets the entity type referenced by this association end. + + + + + Gets or sets the of this association end, which indicates the multiplicity of the end and whether or not it is required. + + + + + Gets or sets the to take when a delete operation is attempted. + + + + + Indicates the multiplicity of an and whether or not it is required. + + + + + Allows the construction and modification of an association set in an Entity Data Model (EDM) ). + + + + + Represents an item in an Entity Data Model (EDM) . + + + + + Gets or sets the that specifies the association type for the set. + + + + + Gets or sets the that specifies the entity set corresponding to the association end for this association set. + + + + + Gets or sets the that specifies the entity set corresponding to the association end for this association set. + + + + + + The base for all all Entity Data Model (EDM) types that represent a structured type from the EDM type system. + + + + + Gets or sets the that defines the source end of the association. + + + + + Gets or sets the that defines the target end of the association. + + + + + Gets or sets the optional constraint that indicates whether the relationship is an independent association (no constraint present) or a foreign key relationship ( specified). + + + + + Collection semantics for properties. + + + + + The property does not have a collection type or does not specify explicit collection semantics. + + + + + The property is an unordered collection that may contain duplicates. + + + + + The property is an ordered collection that may contain duplicates. + + + + + Allows the construction and modification of a complex type in an Entity Data Model (EDM) . + + + + + Gets or sets the optional that indicates the base complex type of the complex type. + + + + + Gets or sets a value indicating whether the complex type is abstract. + + + + + Gets or sets the collection of instances that describe the (scalar or complex) properties of the complex type. + + + + + Concurrency mode for properties. + + + + + Default concurrency mode: the property is never validated at write time + + + + + Fixed concurrency mode: the property is always validated at write time + + + + + Allows the construction and modification of an entity container in an Entity Data Model (EDM) . + + + + + Gets all s declared within the namspace. Includes s and s. + + + + + Gets or sets the collection of s that specifies the association sets within the container. + + + + + Gets or sets the collection of s that specifies the entity sets within the container. + + + + + Allows the construction and modification of an entity set in an Entity Data Model (EDM) . + + + + + Gets or sets the that specifies the entity type for the set. + + + + + Allows the construction and modification of an entity type in an Entity Data Model (EDM) . + + + + + Gets or sets the optional that indicates the base entity type of the entity type. + + + + + Gets or sets a value indicating whether the entity type is abstract. + + + + + Gets or sets the collection of s that specifies the properties declared by the entity type. + + + + + Gets or sets the collection of s that indicates which properties from the collection are part of the entity key. + + + + + Gets or sets the optional collection of s that specifies the navigation properties declared by the entity type. + + + + + Indicates which Entity Data Model (EDM) concept is represented by a given item. + + + + + Association End Kind + + + + + Association Set Kind + + + + + Association Type Kind + + + + + Collection Type Kind + + + + + Complex Type Kind + + + + + Entity Container Kind + + + + + Entity Set Kind + + + + + Entity Type Kind + + + + + Function Group Kind + + + + + Function Overload Kind + + + + + Function Import Kind + + + + + Function Parameter Kind + + + + + Navigation Property Kind + + + + + EdmProperty Type Kind + + + + + Association Constraint Type Kind + + + + + Ref Type Kind + + + + + Row Column Kind + + + + + Row Type Kind + + + + + Type Reference Kind + + + + + Model Kind + + + + + Namespace Kind + + + + + Primitive Facets Kind + + + + + Primitive Type Kind + + + + + Enum Type Kind + + + + + Enum Type Member Kind + + + + + EdmModel is the top-level container for namespaces and entity containers belonging to the same logical Entity Data Model (EDM) model. + + + + + Gets or sets an optional value that indicates the entity model version. + + + + + Gets or sets the containers declared within the model. + + + + + Gets or sets the namespaces declared within the model. + + + + + Allows the construction and modification of a namespace in an . + + + + + Gets all s declared within the namspace. Includes s, s, s. + + + + + Gets or sets the s declared within the namespace. + + + + + Gets or sets the s declared within the namespace. + + + + + Gets or sets the s declared within the namespace. + + + + + Allows the construction and modification of an Entity Data Model (EDM) navigation property. + + + + + Gets or sets the that specifies the association over which navigation takes place. + + + + + Gets or sets the that specifies which association end is the 'destination' end of the navigation and produces the navigation property result. + + + + + Specifies the action to take on a given operation. + + + + + Default behavior + + + + + Restrict the operation + + + + + Cascade the operation + + + + + Represents one of the fixed set of Entity Data Model (EDM) primitive types. + + + + + The base for all all Entity Data Model (EDM) types that represent a scalar type from the EDM type system. + + + + + Retrieves the EdmPrimitiveType instance with the corresponding to the specified value, if any. + + The name of the primitive type instance to retrieve + The EdmPrimitiveType with the specified name, if successful; otherwise null . + true if the given name corresponds to an EDM primitive type name; otherwise false . + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets an value that indicates which Entity Data Model (EDM) primitive type this type represents. + + + + + Allows the construction and modification of additional constraints that can be applied to a specific use of a primitive type in an Entity Data Model (EDM) item. See . + + + + + Returns true if any facet value property currently has a non-null value; otherwise returns false . + + + + + Gets or sets an optional value indicating the current constraint on the type's maximum length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have its intrinsic maximum length, rather than a specific value. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have a fixed or variable length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to be Unicode or non-Unicode. + + + + + Gets or sets an optional value indicating the current constraint on the type's precision. + + + + + Gets or sets an optional value indicating the current constraint on the type's scale. + + + + + Gets or sets an optional value indicating that the current spatial type's SRID is unconstrained. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating whether the spatial type is to be type checked strictly. + + + + + Primitive Types as defined by the Entity Data Model (EDM). + + + + + Binary Type Kind + + + + + Boolean Type Kind + + + + + Byte Type Kind + + + + + DateTime Type Kind + + + + + Decimal Type Kind + + + + + Double Type Kind + + + + + Guid Type Kind + + + + + Single Type Kind + + + + + SByte Type Kind + + + + + Int16 Type Kind + + + + + Int32 Type Kind + + + + + Int64 Type Kind + + + + + String Type Kind + + + + + Time Type Kind + + + + + DateTimeOffset Type Kind + + + + + Geometry Type Kind + + + + + Geography Type Kind + + + + + Geometric point type kind + + + + + Geometric linestring type kind + + + + + Geometric polygon type kind + + + + + Geometric multi-point type kind + + + + + Geometric multi-linestring type kind + + + + + Geometric multi-polygon type kind + + + + + Geometric collection type kind + + + + + Geographic point type kind + + + + + Geographic linestring type kind + + + + + Geographic polygon type kind + + + + + Geographic multi-point type kind + + + + + Geographic multi-linestring type kind + + + + + Geographic multi-polygon type kind + + + + + Geographic collection type kind + + + + + Allows the construction and modification of a primitive- or complex-valued property of an Entity Data Model (EDM) entity or complex type. + + + + + Gets or sets an value that indicates which collection semantics - if any - apply to the property. + + + + + Gets or sets a value that indicates whether the property is used for concurrency validation. + + + + + Gets or sets on optional value that indicates an initial default value for the property. + + + + + Gets or sets an that specifies the result type of the property. + + + + + Enumerates all s declared or inherited by an . + + + + + Allows the construction and modification of a specific use of a type in an Entity Data Model (EDM) item. See for examples. + + + + + Gets or sets a value indicating the collection rank of the type reference. A collection rank greater than zero indicates that the type reference represents a collection of its referenced . + + + + + Gets or sets a value indicating the referenced by this type reference. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered nullable. + + + + + Gets or sets an optional instance that applies additional constraints to a referenced primitive type. + + + Accessing this property forces the creation of an EdmPrimitiveTypeFacets value if no value has previously been set. Use to determine whether or not this property currently has a value. + + + + + Gets a value indicating whether the property of this type reference has been assigned an value with at least one facet value specified. + + + + + Indicates whether this type reference represents a collection of its referenced (when is greater than zero) or not. + + + + + Indicates whether the property of this type reference currently refers to an , is not a collection type, and does not have primitive facet values specified. + + + + + Gets the currently referred to by this type reference, or null if the type reference is a collection type or does not refer to a complex type. + + + + + Indicates whether the property of this type reference currently refers to an and is not a collection type. + + + + + Gets the currently referred to by this type reference, or null if the type reference is a collection type or does not refer to a primitive type. + + + + + Contains constant values that apply to the EDM model, regardless of source (for CSDL specific constants see ). + + + + + Parsing code taken from System.dll's System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(string) method to avoid LinkDemand needed to call this method + + + + + + + + + + + Constants for CSDL XML. + + + + + Constants for C-S MSL XML. + + + + + Constants for SSDL XML. + + + + + The acceptable range for this enum is 0000 - 0999; the range 10,000-15,000 is reserved for tools. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Precision out of range + + + + + Scale out of range + + + + + + + + + + + + + One of the required facets is missing + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The facet isn't allow by the property type. + + + + + This facet value is constant and is specified in the schema + + + + + + + + + + + + + Multiplicity value was malformed + + + + + The value for the Action attribute is invalid or not allowed in the current context + + + + + An error occurred processing the On<Operation> elements + + + + + Ends were given for the Property element of a EntityContainer that is not a RelationshipSet + + + + + The extent name used in the EntittyContainerType End does not match the name of any of the EntityContainerProperties in the containing EntityContainer + + + + + An end element was not given, and cannot be inferred because too many EntityContainerEntitySet elements that are good possibilities. + + + + + An end element was not given, and cannot be inferred because there is no EntityContainerEntitySets that are the correct type to be used as an EntitySet. + + + + + Not a valid parameter direction for the parameter in a function + + + + + Unable to infer an optional schema part, to resolve this; be more explicit + + + + + Invalid facet attribute(s) specified in provider manifest + + + + + Invalid role value in the relationship constraint + + + + + Invalid Property in relationship constraint + + + + + Type mismatch between ToProperty and FromProperty in the relationship constraint + + + + + Invalid multiplicity in FromRole in the relationship constraint + + + + + The number of properties in the FromProperty and ToProperty in the relationship constraint must be identical + + + + + No Properties defined in either FromProperty or ToProperty in the relationship constraint + + + + + Missing constraint in relationship type in ssdl + + + + + Same role referred in the ToRole and FromRole of a referential constraint + + + + + Invalid value for attribute ParameterTypeSemantics + + + + + Invalid type used for a Relationship End Type + + + + + Invalid PrimitiveTypeKind + + + + + Invalid TypeConversion DestinationType + + + + + Expected a integer value between 0 - 255 + + + + + Invalid Type specified in function + + + + + Precision must not be greater than 28 + + + + + Properties that are part of entity key must be of scalar type + + + + + Binary type properties which are part of entity key are currently not supported + + + + + The primitive type kind does not have a preferred mapping + + + + + More than one PreferredMapping for a PrimitiveTypeKind + + + + + End with * multiplicity cannot have operations specified + + + + + EntitySet type has no keys + + + + + InvalidNumberOfParametersForAggregateFunction + + + + + InvalidParameterTypeForAggregateFunction + + + + + Composable functions must declare a return type. + + + + + Non-composable functions must not declare a return type. + + + + + Non-composable functions do not permit the aggregate; niladic; or built-in attributes. + + + + + Composable functions can not include command text attribute. + + + + + Functions should not declare both a store name and command text (only one or the other can be used). + + + + + SystemNamespace + + + + + Empty DefiningQuery text + + + + + Schema, Table and DefiningQuery are all specified, and are mutually exclusive + + + + + ConcurrencyMode value was malformed + + + + + Concurrency can't change for any sub types of an EntitySet type. + + + + + Function import return type must be either empty, a collection of entities, or a singleton scalar. + + + + + Function import specifies a non-existent entity set. + + + + + Function import specifies entity type return but no entity set. + + + + + Function import specifies entity type that does not derive from element type of entity set. + + + + + Function import specifies a binding to an entity set but does not return entities. + + + + + InternalError + + + + + Same Entity Set Taking part in the same role of the relationship set in two different relationship sets + + + + + Entity key refers to the same property twice + + + + + Function declares a ReturnType attribute and element + + + + + Nullable Complex Type not supported in Edm V1 + + + + + Only Complex Collections supported in Edm V1.1 + + + + + No Key defined on Entity Type + + + + + Invalid namespace specified in using element + + + + + Need not specify system namespace in using + + + + + Cannot use a reserved/system namespace as alias + + + + + Invalid qualification specified for type + + + + + Invalid Entity Container Name in extends attribute + + + + + Invalid CollectionKind value in property CollectionKind attribute + + + + + Must specify namespace or alias of the schema in which this type is defined + + + + + Entity Container cannot extend itself + + + + + Failed to retrieve provider manifest + + + + + Mismatched Provider Manifest token values in SSDL artifacts + + + + + Missing Provider Manifest token value in SSDL artifact(s) + + + + + Empty CommandText element + + + + + Inconsistent Provider values in SSDL artifacts + + + + + Inconsistent Provider Manifest token values in SSDL artifacts + + + + + Duplicated Function overloads + + + + + InvalidProvider + + + + + FunctionWithNonEdmTypeNotSupported + + + + + ComplexTypeAsReturnTypeAndDefinedEntitySet + + + + + ComplexTypeAsReturnTypeAndDefinedEntitySet + + + + unused 179, + unused 180, + unused 181, + + In model functions facet attribute is allowed only on ScalarTypes + + + + + Captures several conditions where facets are placed on element where it should not exist. + + + + + Return type has not been declared + + + + + Invalid value in the EnumTypeOption + + + + + The structural annotation cannot use codegen namespaces + + + + + Function and type cannot have the same fully qualified name + + + + + Cannot load different version of schema in the same ItemCollection + + + + + Expected bool value + + + + + End without Multiplicity specified + + + + + In SSDL, if composable function returns a collection of rows (TVF), all row properties must be of scalar types. + + + + + The name of NamedEdmItem must not be empty or white space only + + + + + EdmTypeReference is empty + + Unused 199; + + + + Serializes an that conforms to the restrictions of a single CSDL schema file to an XML writer. The model to be serialized must contain a single and a single . + + + + + Serialize the to the XmlWriter. + + The EdmModel to serialize, mut have only one and one + The XmlWriter to serialize to + + + + Serialize the to the XmlWriter + + The DbModel to serialize + The XmlWriter to serialize to + + + + Serialize the to the + + The DbDatabaseMetadata to serialize + Provider information on the Schema element + ProviderManifestToken information on the Schema element + The XmlWriter to serialize to + + + + + author/email + + + + + author/name + + + + + author/uri + + + + + published + + + + + rights + + + + + summary + + + + + title + + + + + contributor/email + + + + + contributor/name + + + + + contributor/uri + + + + + category/@label + + + + + Plaintext + + + + + HTML + + + + + XHTML + + + + + updated + + + + + link/@href + + + + + link/@rel + + + + + link/@type + + + + + link/@hreflang + + + + + link/@title + + + + + link/@length + + + + + category/@term + + + + + category/@scheme + + + + + Return role name pair + + + + + + + + The context for DataModel Validation + + + + + Returns true if the given two ends are similar - the relationship type that this ends belongs to is the same and the entity set refered by the ends are same and they are from the same role + + + + + + + + Return true if the Referential Constraint on the association is ready for further validation, otherwise return false. + + + + + + + Resolves the given property names to the property in the item Also checks whether the properties form the key for the given type and whether all the properties are nullable or not + + + + + + + + + + + Return true if the namespaceName is a Edm System Namespace + + + + + + + Return true if the entityType is a subtype of any entity type in the dictionary keys, and return the corresponding entry EntitySet value. Otherwise return false. + + + + + + + + + Return true if any of the properties in the EdmEntityType defines ConcurrencyMode. Otherwise return false. + + + + + + + Add member name to the Hash set, raise an error if the name exists already. + + + + + + + + + If the string is null, empty, or only whitespace, return false, otherwise return true + + + + + + + Determine if a cycle exists in the type hierarchy: use two pointers to walk the chain, if one catches up with the other, we have a cycle. + + true if a cycle exists in the type hierarchy, false otherwise + + + + RuleSet for DataModel Validation + + + + + Get the related rules given certain DataModelItem + + The to validate + A collection of + + + + Data Model Validator + + + + + Validate the and all of its properties given certain version. + + The root of the model to be validated + True to validate the syntax, otherwise false + + + + The RuleSet for EdmModel + + + + + Get based on version + + a double value of version + + + + + The context for EdmModel Validation + + + + + Visitor for EdmModel Validation + + + + + Edm Model Validator + + + + + validate the from the root with the context + + The root to validate from + The validation context + + + + An implementation of IDatabaseInitializer that will recreate and optionally re-seed the + database only if the database does not exist. + To seed the database, create a derived class and override the Seed method. + + The type of the context. + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + An instances of this class is obtained from an object and can be used + to manage the actual database backing a DbContext or connection. + This includes creating, deleting, and checking for the existence of a database. + Note that deletion and checking for existence of a database can be performed using just a + connection (i.e. without a full context) by using the static methods of this class. + + + + + Creates a Database backed by the given context. This object can be used to create a database, + check for database existence, and delete a database. + + The context that defines the database connection and model. + + + + Gets or sets the database initialization strategy. The database initialization strategy is called when instance + is initialized from a . The strategy can optionally check for database existence, create a new database, and + seed the database with data. + The default strategy is an instance of . + + The type of the context. + The strategy. + The database creation strategy. + + + + Internal version of SetInitializer that allows the strategy to be locked such that it cannot be replaced + by another call to SetInitializer. This allows strategies set in the app.config to win over strategies set + in code. + + The type of the context. + The strategy. + if set to true then the strategy is locked. + + + + Runs the the registered on this context. + + If "force" is set to true, then the initializer is run regardless of whether or not it + has been run before. This can be useful if a database is deleted while an app is running + and needs to be reinitialized. + + If "force" is set to false, then the initializer is only run if it has not already been + run for this context, model, and connection in this app domain. This method is typically + used when it is necessary to ensure that the database has been created and seeded + before starting some operation where doing so lazily will cause issues, such as when the + operation is part of a transaction. + + if set to true the initializer is run even if it has already been run. + + + + Checks whether or not the database is compatible with the the current Code First model. + + + Model compatibility currently uses the following rules. + + If the context was created using either the Model First or Database First approach then the + model is assumed to be compatible with the database and this method returns true. + + For Code First the model is considered compatible if the model is stored in the database + in the Migrations history table and that model has no differences from the current model as + determined by Migrations model differ. + + If the model is not stored in the database but an EF 4.1/4.2 model hash is found instead, + then this is used to check for compatibility. + + + If set to true then an exception will be thrown if no model metadata is found in + the database. If set to false then this method will return true if metadata + is not found. + + True if the model hash in the context and the database match; false otherwise. + + + + + Creates a new database on the database server for the model defined in the backing context. + Note that calling this method before the database initialization strategy has run will disable + executing that strategy. + + + + + Creates a new database on the database server for the model defined in the backing context, but only + if a database with the same name does not already exist on the server. + + True if the database did not exist and was created; false otherwise. + + + + Checks whether or not the database exists on the server. + + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + Calling this method from outside of an initializer will mark the database as having + not been initialized. This means that if an attempt is made to use the database again + after it has been deleted, then any initializer set will run again and, usually, will + try to create the database again automatically. + + True if the database did exist and was deleted; false otherwise. + + + + Checks whether or not the database exists on the server. + The connection to the database is created using the given database name or connection string + in the same way as is described in the documentation for the class. + + The database name or a connection string to the database. + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + The connection to the database is created using the given database name or connection string + in the same way as is described in the documentation for the class. + + The database name or a connection string to the database. + True if the database did exist and was deleted; false otherwise. + + + + Checks whether or not the database exists on the server. + + An existing connection to the database. + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + + An existing connection to the database. + True if the database did exist and was deleted; false otherwise. + + + + Resets the DefaultConnectionFactory to its initial value. + Currently, this method is only used by test code. + + + + + Performs the operation defined by the given delegate using the given lazy connection, ensuring + that the lazy connection is disposed after use. + + Information used to create a DbConnection. + The operation to perform. + The return value of the operation. + + + + Performs the operation defined by the given delegate against a connection. The connection + is either the connection accessed from the context backing this object, or is obtained from + the connection information passed to one of the static methods. + + The connection to use. + The operation to perform. + The return value of the operation. + + + + Returns an empty ObjectContext that can be used to perform delete/exists operations. + + The connection for which to create an ObjectContext + The empty context. + + + + Creates a raw SQL query that will return elements of the given generic type. + The type can be any type that has properties that match the names of the columns returned + from the query, or can be a simple primitive type. The type does not have to be an + entity type. The results of this query are never tracked by the context even if the + type of object returned is an entity type. Use the + method to return entities that are tracked by the context. + + The type of object returned by the query. + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Creates a raw SQL query that will return elements of the given type. + The type can be any type that has properties that match the names of the columns returned + from the query, or can be a simple primitive type. The type does not have to be an + entity type. The results of this query are never tracked by the context even if the + type of object returned is an entity type. Use the + method to return entities that are tracked by the context. + + The type of object returned by the query. + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Executes the given DDL/DML command against the database. + + The command string. + The parameters to apply to the command string. + The result returned by the database after executing the command. + + + + Returns the connection being used by this context. This may cause the + connection to be created if it does not already exist. + + Thrown if the context has been disposed. + + + + Returns the as a delegate that can be called with + an instance of the that owns this Database object, or returns null if + there is no initializer set for this context type. + + The initializer delegate or null. + + + + The connection factory to use when creating a from just + a database name or a connection string. + + + This is used when just a database name or connection string is given to or when + the no database name or connection is given to DbContext in which case the name of + the context class is passed to this factory in order to generate a DbConnection. + By default, the instance to use is read from the applications .config + file from the "EntityFramework DefaultConnectionFactory" entry in appSettings. If no entry is found in + the config file then is used. Setting this property in code + always overrides whatever value is found in the config file. + + + + + Checks wether or not the DefaultConnectionFactory has been set to something other than its default value. + + + + + + + Common code for generic and non-generic string Include. + + + + + + Returns a new query where the entities returned will not be cached in the + or . This method works by calling the AsNoTracking method of the + underlying query object. If the underlying query object does not have a AsNoTracking method, + then calling this method will have no affect. + + The element type. + The source query. + A new query with NoTracking applied, or the source query if NoTracking is not supported. + + + + Returns a new query where the entities returned will not be cached in the + or . This method works by calling the AsNoTracking method of the + underlying query object. If the underlying query object does not have a AsNoTracking method, + then calling this method will have no affect. + + The source query. + A new query with NoTracking applied, or the source query if NoTracking is not supported. + + + + Common code for generic and non-generic AsNoTracking. + + + + + Enumerates the query such that for server queries such as those of , , + , and others the results of the query will be loaded into the associated , + or other cache on the client. + This is equivalent to calling ToList and then throwing away the list without the overhead of actually creating the list. + + The source query. + + + + Returns an implementation that stays in sync with the given . + + The element type. + The collection that the binding list will stay in sync with. + The binding list. + + + + DbModelBuilder is used to map CLR classes to a database schema. + This code centric approach to building an Entity Data Model (EDM) model is known as 'Code First'. + + + DbModelBuilder is typically used to configure a model by overriding . + You can also use DbModelBuilder independently of DbContext to build a model and then construct a + or . + The recommended approach, however, is to use OnModelCreating in as + the workflow is more intuitive and takes care of common tasks, such as caching the created model. + + Types that form your model are registered with DbModelBuilder and optional configuration can be + performed by applying data annotations to your classes and/or using the fluent style DbModelBuilder + API. + + When the Build method is called a set of conventions are run to discover the initial model. + These conventions will automatically discover aspects of the model, such as primary keys, and + will also process any data annotations that were specified on your classes. Finally + any configuration that was performed using the DbModelBuilder API is applied. + + Configuration done via the DbModelBuilder API takes precedence over data annotations which + in turn take precedence over the default conventions. + + + + + Initializes a new instance of the class. + + The process of discovering the initial model will use the set of conventions included + in the most recent version of the Entity Framework installed on your machine. + + + Upgrading to newer versions of the Entity Framework may cause breaking changes + in your application because new conventions may cause the initial model to be + configured differently. There is an alternate constructor that allows a specific + version of conventions to be specified. + + + + + Initializes a new instance of the class that will use + a specific set of conventions to discover the initial model. + + The version of conventions to be used. + + + + Excludes a type from the model. This is used to remove types from the model that were added + by convention during initial model discovery. + + The type to be excluded. + The same DbModelBuilder instance so that multiple calls can be chained. + + + + Excludes a type(s) from the model. This is used to remove types from the model that were added + by convention during initial model discovery. + + The types to be excluded from the model. + The same DbModelBuilder instance so that multiple calls can be chained. + + + + Registers an entity type as part of the model and returns an object that can be used to + configure the entity. This method can be called multiple times for the same entity to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified entity type. + + + + Registers a type as an entity in the model and returns an object that can be used to + configure the entity. This method can be called multiple times for the same type to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified entity type. + + + + Registers a type as a complex type in the model and returns an object that can be used to + configure the complex type. This method can be called multiple times for the same type to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified complex type. + + + + Creates a based on the configuration performed using this builder. + The connection is used to determine the database provider being used as this + affects the database layer of the generated model. + + Connection to use to determine provider information. + The model that was built. + + + + Creates a based on the configuration performed using this builder. + Provider information must be specified because this affects the database layer of the generated model. + For SqlClient the invariant name is 'System.Data.SqlClient' and the manifest token is the version year (i.e. '2005', '2008' etc.) + + The database provider that the model will be used with. + The model that was built. + + + + Provides access to the settings of this DbModelBuilder that deal with conventions. + + + + + Gets the for this DbModelBuilder. + The registrar allows derived entity and complex type configurations to be registered with this builder. + + + + + A value from this enumeration can be provided directly to the + class or can be used in the applied to + a class derived from . The value used defines which version of + the DbContext and DbModelBuilder conventions should be used when building a model from + code--also know as "Code First". + + + Using DbModelBuilderVersion.Latest ensures that all the latest functionality is available + when upgrading to a new release of the Entity Framework. However, it may result in an + application behaving differently with the new release than it did with a previous release. + This can be avoided by using a specific version of the conventions, but if a version + other than the latest is set then not all the latest functionality will be available. + + + + + Indicates that the latest version of the and + conventions should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 4.1 + through 4.3 should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 5.0 + when targeting .NET 4 should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 5.0 + when targeting .NET 4.5 should be used. + + + + + This attribute can be applied to a class derived from to set which + version of the DbContext and conventions should be used when building + a model from code--also know as "Code First". See the + enumeration for details about DbModelBuilder versions. + + + If the attribute is missing from DbContextthen DbContext will always use the latest + version of the conventions. This is equivalent to using DbModelBuilderVersion.Latest. + + + + + Initializes a new instance of the class. + + The conventions version to use. + + + + Gets the conventions version. + + The conventions version. + + + + A non-generic version of which can be used when the type of entity + is not known at build time. + + + + + Represents a non-generic LINQ to Entities query against a DbContext. + + + + + An internal interface implemented by and that allows access to + the internal query without using reflection. + + + + + The underlying internal set. + + + + + Internal constructor prevents external classes deriving from DbQuery. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + Instead populate a DbSet with data, for example by using the Load extension method, and + then bind to local data. For WPF bind to DbSet.Local. For Windows Forms bind to + DbSet.Local.ToBindingList(). + + + Never returns; always throws. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Returns the equivalent generic object. + + The type of element for which the query was created. + The generic set object. + + + + Returns a representation of the underlying query. + + + The query string. + + + + + Returns false. + + false. + + + + The IQueryable element type. + + + + + The IQueryable LINQ Expression. + + + + + The IQueryable provider. + + + + + Gets the underlying internal query object. + + The internal query. + + + + The internal query object that is backing this DbQuery + + + + + An internal interface implemented by and that allows access to + the internal set without using reflection. + + + + + The underlying internal set. + + + + + Internal constructor prevents external classes deriving from DbSet. + + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Returns the equivalent generic object. + + The type of entity for which the set was created. + The generic set object. + + + + Creates a raw SQL query that will return entities in this set. By default, the + entities returned are tracked by the context; this can be changed by calling + AsNoTracking on the returned. + Note that the entities returned are always of the type for this set and never of + a derived type. If the table or tables queried may contain data for other entity + types, then the SQL query must be written appropriately to ensure that only entities of + the correct type are returned. + + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + The internal IQueryable that is backing this DbQuery + + + + + Gets the underlying internal set. + + The internal set. + + + + A DbSet represents the collection of all entities in the context, or that can be queried from the + database, of a given type. DbSet objects are created from a DbContext using the DbContext.Set method. + + + Note that DbSet does not support MEST (Multiple Entity Sets per Type) meaning that there is always a + one-to-one correlation between a type and a set. + + The type that defines the set. + + + + Represents a LINQ to Entities query against a DbContext. + + The type of entity to query for. + + + + Creates a new query that will be backed by the given internal query object. + + The backing query. + + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Throws an exception indicating that binding directly to a store query is not supported. + Instead populate a DbSet with data, for example by using the Load extension method, and + then bind to local data. For WPF bind to DbSet.Local. For Windows Forms bind to + DbSet.Local.ToBindingList(). + + + Never returns; always throws. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Returns a representation of the underlying query. + + + The query string. + + + + + Returns a new instance of the non-generic class for this query. + + A non-generic version. + + + + Returns false. + + false. + + + + The IQueryable element type. + + + + + The IQueryable LINQ Expression. + + + + + The IQueryable provider. + + + + + The internal query object that is backing this DbQuery + + + + + The internal query object that is backing this DbQuery + + + + + An IDbSet represents the collection of all entities in the context, or that can be queried from the + database, of a given type. DbSet is a concrete implementation of IDbSet. + + The type that defines the set. + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + Creates a new set that will be backed by the given . + + The internal set. + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Returns the equivalent non-generic object. + + The non-generic set object. + + + + Creates a raw SQL query that will return entities in this set. By default, the + entities returned are tracked by the context; this can be changed by calling + AsNoTracking on the returned. + Note that the entities returned are always of the type for this set and never of + a derived type. If the table or tables queried may contain data for other entity + types, then the SQL query must be written appropriately to ensure that only entities of + the correct type are returned. + + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + The internal IQueryable that is backing this DbQuery + + + + + An implementation of IDatabaseInitializer that will always recreate and optionally re-seed the + database the first time that a context is used in the app domain. + To seed the database, create a derived class and override the Seed method. + + The type of the context. + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + An implementation of IDatabaseInitializer that will DELETE, recreate, and optionally re-seed the + database only if the model has changed since the database was created. + + + Whether or not the model has changed is determined by the + method. + To seed the database create a derived class and override the Seed method. + + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + Returned by the ChangeTracker method of to provide access to features of + the context that are related to change tracking of entities. + + + + + Initializes a new instance of the class. + + The internal context. + + + + Gets objects for all the entities tracked by this context. + + The entries. + + + + Gets objects for all the entities of the given type + tracked by this context. + + The type of the entity. + The entries. + + + + Detects changes made to the properties and relationships of POCO entities. Note that some types of + entity (such as change tracking proxies and entities that derive from ) + report changes automatically and a call to DetectChanges is not normally needed for these types of entities. + Also note that normally DetectChanges is called automatically by many of the methods of + and its related classes such that it is rare that this method will need to be called explicitly. + However, it may be desirable, usually for performance reasons, to turn off this automatic calling of + DetectChanges using the AutoDetectChangesEnabled flag from . + + + + + A non-generic version of the class. + + + + + This is an abstract base class use to represent a scalar or complex property, or a navigation property + of an entity. Scalar and complex properties use the derived class , + reference navigation properties use the derived class , and collection + navigation properties use the derived class . + + + + + Creates a from information in the given . + This method will create an instance of the appropriate subclass depending on the metadata contained + in the InternalMemberEntry instance. + + The internal member entry. + The new entry. + + + + Validates this property. + + + Collection of objects. Never null. If the entity is valid the collection will be empty. + + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the name of the property. + + The property name. + + + + Gets or sets the current value of this property. + + The current value. + + + + The to which this member belongs. + + An entry for the entity that owns this member. + + + + Gets the backing this object. + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal collection entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the collection of entities from the database. + Note that entities that already exist in the context are not overwritten with values from the database. + + + + + Returns the query that would be used to load this collection from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database, such + as counting the number of entities in the collection in the database without actually loading them. + + A query for the collection. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the collection element. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the collection of entities has been loaded from the database. + + true if the collection is loaded; otherwise, false. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Gets the backing this object as an . + + The internal member entry. + + + + Instances of this class are returned from the Collection method of + and allow operations such as loading to + be performed on the an entity's collection navigation properties. + + The type of the entity to which this property belongs. + The type of the element in the collection of entities. + + + + This is an abstract base class use to represent a scalar or complex property, or a navigation property + of an entity. Scalar and complex properties use the derived class , + reference navigation properties use the derived class , and collection + navigation properties use the derived class . + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + This method will create an instance of the appropriate subclass depending on the metadata contained + in the InternalMemberEntry instance. + + The internal member entry. + The new entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Validates this property. + + + Collection of objects. Never null. If the entity is valid the collection will be empty. + + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets the underlying . + + The internal member entry. + + + + The to which this member belongs. + + An entry for the entity that owns this member. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal collection entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the collection of entities from the database. + Note that entities that already exist in the context are not overwritten with values from the database. + + + + + Returns the query that would be used to load this collection from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database, such + as counting the number of entities in the collection in the database without actually loading them. + + A query for the collection. + + + + Returns a new instance of the non-generic class for + the navigation property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the collection of entities has been loaded from the database. + + true if the collection is loaded; otherwise, false. + + + + Gets the underlying as an . + + The internal member entry. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + An immutable representation of an Entity Data Model (EDM) model that can be used to create an + or can be passed to the constructor of a . + For increased performance, instances of this type should be cached and re-used to construct contexts. + + + + + For mocking. + + + + + Creates a model for the given EDM metadata model. + + The EDM metadata model. + + + + Creates an instance of ObjectContext or class derived from ObjectContext. Note that an instance + of DbContext can be created instead by using the appropriate DbContext constructor. + If a derived ObjectContext is used, then it must have a public constructor with a single + EntityConnection parameter. + The connection passed is used by the ObjectContext created, but is not owned by the context. The caller + must dispose of the connection once the context has been disposed. + + The type of context to create. + An existing connection to a database for use by the context. + + + + + Gets a cached delegate (or creates a new one) used to call the constructor for the given derived ObjectContext type. + + + + + A snapshot of the that was used to create this compiled model. + + + + + The provider info (provider name and manifest token) that was used to create this model. + + + + + A non-generic version of the class. + + + + + A non-generic version of the class. + + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the original value of this property. + + The original value. + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets or sets a value indicating whether the value of this property has been modified since + it was loaded from the database. + + + true if this instance is modified; otherwise, false. + + + + + The to which this property belongs. + + An entry for the entity that owns this property. + + + + The of the property for which this is a nested property. + This method will only return a non-null entry for properties of complex objects; it will + return null for properties of the entity itself. + + An entry for the parent complex property, or null if this is an entity property. + + + + Gets the backing this object. + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The name of the nested property. + An object representing the nested property. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the complex property. + The equivalent generic object. + + + + Instances of this class are returned from the ComplexProperty method of + and allow access to the state of a complex property. + + The type of the entity to which this property belongs. + The type of the property. + + + + Instances of this class are returned from the Property method of + and allow access to the state of the scalar + or complex property. + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the original value of this property. + + The original value. + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets or sets a value indicating whether the value of this property has been modified since + it was loaded from the database. + + + true if this instance is modified; otherwise, false. + + + + + The to which this property belongs. + + An entry for the entity that owns this property. + + + + The of the property for which this is a nested property. + This method will only return a non-null entry for properties of complex objects; it will + return null for properties of the entity itself. + + An entry for the parent complex property, or null if this is an entity property. + + + + Gets the underlying as an . + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The type of the nested property. + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The type of the nested property. + An expression representing the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The type of the nested property. + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The type of the nested property. + An expression representing the nested property. + An object representing the nested property. + + + + Describes the origin of the database connection string associated with a . + + + + + The connection string was created by convention. + + + + + The connection string was read from external configuration. + + + + + The connection string was explicitly specified at runtime. + + + + + The connection string was overriden by connection information supplied to DbContextInfo. + + + + + Returned by the Configuration method of to provide access to configuration + options for the context. + + + + + Initializes a new instance of the class. + + The internal context. + + + + Gets or sets a value indicating whether lazy loading of relationships exposed as + navigation properties is enabled. Lazy loading is enabled by default. + + true if lazy loading is enabled; otherwise, false. + + + + Gets or sets a value indicating whether or not the framework will create instances of + dynamically generated proxy classes whenever it creates an instance of an entity type. + Note that even if proxy creation is enabled with this flag, proxy instances will only + be created for entity types that meet the requirements for being proxied. + Proxy creation is enabled by default. + + true if proxy creation is enabled; otherwise, false. + + + + + Gets or sets a value indicating whether tracked entities should be validated automatically when + is invoked. + The default value is true. + + + + + Provides runtime information about a given type. + + + + + Creates a new instance representing a given type. + + The type deriving from . + + + + Creates a new instance representing a given targeting a specific database. + + The type deriving from . + Connection information for the database to be used. + + + + Creates a new instance representing a given type. An external list of + connection strings can be supplied and will be used during connection string resolution in place + of any connection strings specified in external configuration files. + + + It is preferable to use the constructor that accepts the entire config document instead of using this + constructor. Providing the entire config document allows DefaultConnectionFactroy entries in the config + to be found in addition to explicitly specified connection strings. + + The type deriving from . + A collection of connection strings. + + + + Creates a new instance representing a given type. An external config + object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + + The type deriving from . + An object representing the config file. + + + + Creates a new instance representing a given , targeting a specific database. + An external config object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + + The type deriving from . + An object representing the config file. + Connection information for the database to be used. + + + + Creates a new instance representing a given type. A + can be supplied in order to override the default determined provider used when constructing + the underlying EDM model. + + The type deriving from . + A specifying the underlying ADO.NET provider to target. + + + + Creates a new instance representing a given type. An external config + object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + A can be supplied in order to override the default determined + provider used when constructing the underlying EDM model. This can be useful to prevent EF from + connecting to discover a manifest token. + + The type deriving from . + An object representing the config file. + A specifying the underlying ADO.NET provider to target. + + + + Called internally when a context info is needed for an existing context, which may not be constructable. + + The context instance to get info from. + + + + If instances of the underlying type can be created, returns + a new instance; otherwise returns null. + + A instance. + + + + The concrete type. + + + + + Whether or not instances of the underlying type can be created. + + + + + The connection string used by the underlying type. + + + + + The connection string name used by the underlying type. + + + + + The ADO.NET provider name of the connection used by the underlying type. + + + + + The origin of the connection string used by the underlying type. + + + + + An action to be run on the DbModelBuilder after OnModelCreating has been run on the context. + + + + + A non-generic version of the class. + + + + + Initializes a new instance of the class. + + The internal entry. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + Note that changing the values in the returned dictionary will not update the values in the database. + If the entity is not found in the database then null is returned. + + The store values. + + + + Reloads the entity from the database overwriting any property values with values from the database. + The entity will be in the Unchanged state after calling this method. + + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The name of the property. + An object representing the property. + + + + Gets an object that represents a complex property of this entity. + + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The name of the member. + An object representing the member. + + + + Returns a new instance of the generic class for the given + generic type for the tracked entity represented by this object. + Note that the type of the tracked entity must be compatible with the generic type or + an exception will be thrown. + + The type of the entity. + A generic version. + + + + Validates this instance and returns validation result. + + + Entity validation result. Possibly null if + method is overridden. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the entity. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + + The original values. + + + + Gets InternalEntityEntry object for this DbEntityEntry instance. + + + + + Instances of this class provide access to information about and control of entities that + are being tracked by the . Use the Entity or Entities methods of + the context to obtain objects of this type. + + The type of the entity. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + Note that changing the values in the returned dictionary will not update the values in the database. + If the entity is not found in the database then null is returned. + + The store values. + + + + Reloads the entity from the database overwriting any property values with values from the database. + The entity will be in the Unchanged state after calling this method. + + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The type of the property. + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The type of the property. + An expression representing the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The type of elements in the collection. + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The type of elements in the collection. + An expression representing the navigation property. + An object representing the navigation property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The name of the property. + An object representing the property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The type of the property. + The name of the property. + An object representing the property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The type of the property. + An expression representing the property. + An object representing the property. + + + + Gets an object that represents a complex property of this entity. + + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a complex property of this entity. + + The type of the complex property. + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a complex property of this entity. + + The type of the complex property. + An expression representing the complex property. + An object representing the complex property. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The name of the member. + An object representing the member. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The type of the member. + The name of the member. + An object representing the member. + + + + Returns a new instance of the non-generic class for + the tracked entity represented by this object. + + A non-generic version. + + + + Validates this instance and returns validation result. + + + Entity validation result. Possibly null if + method is overridden. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the entity. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + + The original values. + + + + Represents an Entity Data Model (EDM) created by the . + The Compile method can be used to go from this EDM representation to a + which is a compiled snapshot of the model suitable for caching and creation of + or instances. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + Creates a for this mode which is a compiled snapshot + suitable for caching and creation of instances. + + The compiled model. + + + + A snapshot of the that was used to create this compiled model. + + + + + A collection of all the properties for an underlying entity or complex object. + + + An instance of this class can be converted to an instance of the generic class + using the Cast method. + Complex properties in the underlying entity or complex object are represented in + the property values as nested instances of this class. + + + + + Initializes a new instance of the class. + + The internal dictionary. + + + + Creates an object of the underlying type for this dictionary and hydrates it with property + values from this dictionary. + + The properties of this dictionary copied into a new object. + + + + Sets the values of this dictionary by reading values out of the given object. + The given object can be of any type. Any property on the object with a name that + matches a property name in the dictionary and can be read will be read. Other + properties will be ignored. This allows, for example, copying of properties from + simple Data Transfer Objects (DTOs). + + The object to read values from. + + + + Creates a new dictionary containing copies of all the properties in this dictionary. + Changes made to the new dictionary will not be reflected in this dictionary and vice versa. + + A clone of this dictionary. + + + + Sets the values of this dictionary by reading values from another dictionary. + The other dictionary must be based on the same type as this dictionary, or a type derived + from the type for this dictionary. + + The dictionary to read values from. + + + + Gets the value of the property just like using the indexed property getter but + typed to the type of the generic parameter. This is useful especially with + nested dictionaries to avoid writing expressions with lots of casts. + + The type of the property. + Name of the property. + The value of the property. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + Gets or sets the value of the property with the specified property name. + The value may be a nested instance of this class. + + The property name. + The value of the property. + + + + Gets the internal dictionary. + + The internal dictionary. + + + + A non-generic version of the class. + + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal reference entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the entity from the database. + Note that if the entity already exists in the context, then it will not overwritten with values from the database. + + + + + Returns the query that would be used to load this entity from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database. + + A query for the entity. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the entity has been loaded from the database. + + true if the entity is loaded; otherwise, false. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Gets the backing this object as an . + + The internal member entry. + + + + Instances of this class are returned from the Reference method of + and allow operations such as loading to + be performed on the an entity's reference navigation properties. + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal reference entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the entity from the database. + Note that if the entity already exists in the context, then it will not overwritten with values from the database. + + + + + Returns the query that would be used to load this entity from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database. + + A query for the entity. + + + + Returns a new instance of the non-generic class for + the navigation property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the entity has been loaded from the database. + + true if the entity is loaded; otherwise, false. + + + + Gets the underlying as an . + + The internal member entry. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Represents a SQL query for entities that is created from a + and is executed using the connection from that context. + Instances of this class are obtained from the instance for the + entity type. The query is not executed when this object is created; it is executed + each time it is enumerated, for example by using foreach. + SQL queries for non-entities are created using the . + See for a generic version of this class. + + + + + Initializes a new instance of the class. + + The internal query. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a new query where the results of the query will not be tracked by the associated + . + + A new query with no-tracking applied. + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Gets the internal query. + + The internal query. + + + + Returns false. + + false. + + + + Represents a SQL query for entities that is created from a + and is executed using the connection from that context. + Instances of this class are obtained from the instance for the + entity type. The query is not executed when this object is created; it is executed + each time it is enumerated, for example by using foreach. + SQL queries for non-entities are created using the . + See for a non-generic version of this class. + + + + + Executes the query and returns an enumerator for the elements. + + An + + object that can be used to iterate through the elements. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a new query where the results of the query will not be tracked by the associated + . + + A new query with no-tracking applied. + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Gets the internal query. + + The internal query. + + + + Returns false. + + false. + + + + Exception thrown by when it was expected that SaveChanges for an entity would + result in a database update but in fact no rows in the database were affected. This usually indicates + that the database has been concurrently updated such that a concurrency token that was expected to match + did not actually match. + Note that state entries referenced by this exception are not serialized due to security and accesses to + the state entries after serialization will return null. + + + + + + Initializes a new instance of the class. + + The internal context. + The inner exception. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Subscribes the SerializeObjectState event. + + + + + Gets objects that represents the entities that could not + be saved to the database. + + The entries representing the entities that could not be saved. + + + + Holds exception state that will be serialized when the exception is serialized. + + + + + Completes the deserialization. + + The deserialized object. + + + + Gets or sets a value indicating whether the exception involved independent associations. + + + + + Initializes a new instance of the class. + + The context. + The inner exception. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Represents an entity used to store metadata about an EDM in the database. + + + + + Attempts to get the model hash calculated by Code First for the given context. + This method will return null if the context is not being used in Code First mode. + + The context. + The hash string. + + + + Gets or sets the ID of the metadata entity, which is currently always 1. + + The id. + + + + Gets or sets the model hash which is used to check whether the model has + changed since the database was created from it. + + The model hash. + + + + Contains methods used to access the Entity Data Model created by Code First in the EDMX form. + These methods are typically used for debugging when there is a need to look at the model that + Code First creates internally. + + + + + Uses Code First with the given context and writes the resulting Entity Data Model to the given + writer in EDMX form. This method can only be used with context instances that use Code First + and create the model internally. The method cannot be used for contexts created using Database + First or Model First, for contexts created using a pre-existing , or + for contexts created using a pre-existing . + + The context. + The writer. + + + + Writes the Entity Data Model represented by the given to the + given writer in EDMX form. + + An object representing the EDM. + The writer. + + + + A factory for creating derived instances. Implement this + interface to enable design-time services for context types that do not have a + public default constructor. + + At design-time, derived instances can be created in order to enable specific + design-time experiences such as model rendering, DDL generation etc. To enable design-time instantiation + for derived types that do not have a public, default constructor, implement + this interface. Design-time services will auto-discover implementations of this interface that are in the + same assembly as the derived type. + + + + + + Creates a new instance of a derived type. + + An instance of TContext + + + + This convention causes DbModelBuilder to include metadata about the model + when it builds the model. When creates a model by convention it will + add this convention to the list of those used by the DbModelBuilder. This will then result in + model metadata being written to the database if the DbContext is used to create the database. + This can then be used as a quick check to see if the model has changed since the last time it was + used against the database. + This convention can be removed from the conventions by overriding + the OnModelCreating method on a derived DbContext class. + + + + + Adds metadata to the given model configuration. + + The model configuration. + + + + This convention uses the name of the derived + class as the container for the conceptual model built by + Code First. + + + + + Initializes a new instance of the class. + + The model container name. + + + + Applies the convention to the given model. + + The model. + + + + This convention uses the namespace of the derived + class as the namespace of the conceptual model built by + Code First. + + + + + Initializes a new instance of the class. + + The model namespace. + + + + Applies the convention to the given model. + + The model. + + + + Instances of this class are used internally to create constant expressions for + that are inserted into the expression tree to replace references to + and . + + The type of the element. + + + + Private constructor called by the Create factory method. + + The query. + + + + Factory method called by CreateDelegate to create an instance of this class. + + The query, which must be a generic object of the expected type. + A new instance. + + + + The public property expected in the LINQ expression tree. + + The query. + + + + Instances of this class are used to create DbConnection objects for + SQL Server Compact Edition based on a given database name or connection string. + + + It is necessary to provide the provider invariant name of the SQL Server Compact + Edition to use when creating an instance of this class. This is because different + versions of SQL Server Compact Editions use different invariant names. + An instance of this class can be set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use SQL Server Compact Edition by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Creates a new connection factory with empty (default) DatabaseDirectory and BaseConnectionString + properties. + + The provider invariant name that specifies the version of SQL Server Compact Edition that should be used. + + + + Creates a new connection factory with the given DatabaseDirectory and BaseConnectionString properties. + + + The provider invariant name that specifies the version of SQL Server Compact Edition that should be used. + + + The path to prepend to the database name that will form the file name used by SQL Server Compact Edition + when it creates or reads the database file. An empty string means that SQL Server Compact Edition will use + its default for the database file location. + + + The connection string to use for options to the database other than the 'Data Source'. The Data Source will + be prepended to this string based on the database name when CreateConnection is called. + + + + + Creates a connection for SQL Server Compact Edition based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + The path to prepend to the database name that will form the file name used by + SQL Server Compact Edition when it creates or reads the database file. + The default value is "|DataDirectory|", which means the file will be placed + in the designated data directory. + + + + + The connection string to use for options to the database other than the 'Data Source'. + The Data Source will be prepended to this string based on the database name when + CreateConnection is called. + The default is the empty string, which means no other options will be used. + + + + + The provider invariant name that specifies the version of SQL Server Compact Edition + that should be used. + + + + + Instances of this class are used to create DbConnection objects for + SQL Server based on a given database name or connection string. By default, the connection is + made to '.\SQLEXPRESS'. This can be changed by changing the base connection + string when constructing a factory instance. + + + An instance of this class can be set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use SQL Server by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Creates a new connection factory with a default BaseConnectionString property of + 'Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True'. + + + + + Creates a new connection factory with the given BaseConnectionString property. + + + The connection string to use for options to the database other than the 'Initial Catalog'. The 'Initial Catalog' will + be prepended to this string based on the database name when CreateConnection is called. + + + + + Creates a connection for SQL Server based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + Remove hard dependency on DbProviderFactories. + + + + + The connection string to use for options to the database other than the 'Initial Catalog'. + The 'Initial Catalog' will be prepended to this string based on the database name when + CreateConnection is called. + The default is 'Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True'. + + + + + This attribute can be applied to either an entire derived class or to + individual or properties on that class. When applied + any discovered or properties will still be included + in the model but will not be automatically initialized. + + + + + Thrown when a context is generated from the templates in Database First or Model + First mode and is then used in Code First mode. + + + Code generated using the T4 templates provided for Database First and Model First use may not work + correctly if used in Code First mode. To use these classes with Code First please add any additional + configuration using attributes or the DbModelBuilder API and then remove the code that throws this + exception. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The object that holds the serialized object data. + The contextual information about the source or destination. + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Implements ICachedMetadataWorkspace for a Code First model. + + + + + Represents an object that holds a cached copy of a MetadataWorkspace and optionally the + assemblies containing entity types to use with that workspace. + + + + + Gets the MetadataWorkspace, potentially lazily creating it if it does not already exist. + If the workspace is not compatible with the provider manifest obtained from the given + connection then an exception is thrown. + + The connection to use to create or check SSDL provider info. + The workspace. + + + + The list of assemblies that contain entity types for this workspace, which may be empty, but + will never be null. + + + + + The default container name for code first is the container name that is set from the DbModelBuilder + + + + + The provider info used to construct the workspace. + + + + + Builds and stores the workspace based on the given code first configuration. + + The code first EDM model. + + + + Gets the . + If the workspace is not compatible with the provider manifest obtained from the given + connection then an exception is thrown. + + The connection to use to create or check SSDL provider info. + The workspace. + + + + The default container name for code first is the container name that is set from the DbModelBuilder + + + + + The list of assemblies that contain entity types for this workspace, which may be empty, but + will never be null. + + + + + The provider info used to construct the workspace. + + + + + The methods here are called from multiple places with an ObjectContext that may have + been created in a variety of ways and ensure that the same code is run regardless of + how the context was created. + + + + + Used a delegate to do the actual creation once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + Note however that a context obtained from only a connection will have no model and so + will result in an empty database. + + + + + Used a delegate to do the actual existence check once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + + + + + Used a delegate to do the actual check/delete once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given set of entity types and DbSet initializer delegate. + + + + + The entity types part of the pair. + + + + + The DbSet properties initializer part of the pair. + + + + + Static helper methods only. + + + + + Checks whether the given value is null and throws ArgumentNullException if it is. + This method should only be used in places where Code Contracts are compiled out in the + release build but we still need public surface null-checking, such as where a public + abstract class is implemented by an internal concrete class. + + + + + Checks whether the given string is null, empty, or just whitespace, and throws appropriately + if the check fails. + This method should only be used in places where Code Contracts are compiled out in the + release build but we still need public surface checking, such as where a public + abstract class is implemented by an internal concrete class. + + + + + Given two key values that may or may not be byte arrays, this method determines + whether or not they are equal. For non-binary key values, this is equivalent + to Object.Equals. For binary keys, it is by comparison of every byte in the + arrays. + + + + + Provides a standard helper method for quoting identifiers + + Identifier to be quoted. Does not validate that this identifier is valid. + Quoted string + + + + Checks the given string which might be a database name or a connection string and determines + whether it should be treated as a name or connection string. Currently, the test is simply + whether or not the string contains an '=' character--if it does, then it should be treated + as a connection string. + + The name or connection string. + true if the string should be treated as a connection string; false if it should be treated as a name. + + + + Determines whether the given string should be treated as a database name directly (it contains no '='), + is in the form name=foo, or is some other connection string. If it is a direct name or has name=, then + the name is extracted and the method returns true. + + The name or connection string. + The name. + True if a name is found; false otherwise. + + + + Determines whether the given string is a full EF connection string with provider, provider connection string, + and metadata parts, or is is instead some other form of connection string. + + The name or connection string. + true if the given string is an EF connection string; otherwise, false. + + + + + Parses a property selector expression used for the expression-based versions of the Property, Collection, Reference, + etc methods on and + classes. + + The type of the entity. + The type of the property. + The property. + Name of the method. + Name of the param. + The property name. + + + + Called recursively to parse an expression tree representing a property path such + as can be passed to Include or the Reference/Collection/Property methods of . + This involves parsing simple property accesses like o => o.Products as well as calls to Select like + o => o.Products.Select(p => p.OrderLines). + + The expression to parse. + The expression parsed into an include path, or null if the expression did not match. + True if matching succeeded; false if the expression could not be parsed. + + + + Gets a cached dictionary mapping property names to property types for all the properties + in the given type. + + + + + Gets a dictionary of compiled property setter delegates for the underlying types. + The dictionary is cached for the type in the app domain. + + + + + Used by the property setter delegates to throw for attempts to set null onto + non-nullable properties or otherwise go ahead and set the property. + + + + + Gets a dictionary of compiled property getter delegates for the underlying types. + The dictionary is cached for the type in the app domain. + + + + + Creates a new with the NoTracking merge option applied. + The query object passed in is not changed. + + The query. + A new query with NoTracking applied. + + + + Converts to + + + Name of the property being validated with ValidationAttributes. Null for type-level validation. + + + ValidationResults instances to be converted to instances. + + + An created based on the + . + + + class contains a property with names of properties the error applies to. + On the other hand each applies at most to a single property. As a result for + each name in ValidationResult.MemberNames one will be created (with some + exceptions for special cases like null or empty .MemberNames or null names in the .MemberNames). + + + + + Calculates a "path" to a property. For primitive properties on an entity type it is just the + name of the property. Otherwise it is a dot separated list of names of the property and all + its ancestor properties starting from the entity. + + Property for which to calculate the path. + Dot separated path to the property. + + + + Gets names of the property and its ancestor properties as enumerable walking "bottom-up". + + Property for which to get the segments. + Names of the property and its ancestor properties. + + + + Gets an type for the given element type. + + Type of the element. + The collection type. + + + + Creates a database name given a type derived from DbContext. This handles nested and + generic classes. No attempt is made to ensure that the name is not too long since this + is provider specific. If a too long name is generated then the provider will throw and + the user must correct by specifying their own name in the DbContext constructor. + + Type of the context. + The database name to use. + + + + A local (in-memory) view of the entities in a DbSet. + This view contains Added entities and does not contain Deleted entities. The view extends + from and hooks up events between the collection and the + state manager to keep the view in sync. + + The type of the entity. + + + + Initializes a new instance of the class for entities + of the given generic type in the given internal context. + + The internal context. + + + + Called by the base class when the collection changes. + This method looks at the change made to the collection and reflects those changes in the + state manager. + + The instance containing the event data. + + + + Handles events from the state manager for entities entering, leaving, or being marked as deleted. + The local view is kept in sync with these changes. + + The sender. + The instance containing the event data. + + + + Clears the items by calling remove on each item such that we get Remove events that + can be tracked back to the state manager, rather than a single Reset event that we + cannot deal with. + + + + + Adds a contains check to the base implementation of InsertItem since we can't support + duplicate entities in the set. + + The index at which to insert. + The item to insert. + + + + Returns a cached binding list implementation backed by this ObservableCollection. + + The binding list. + + + + Service used to search for instance properties on a DbContext class that can + be assigned a DbSet instance. Also, if the the property has a public setter, + then a delegate is compiled to set the property to a new instance of DbSet. + All of this information is cached per app domain. + + + + + Creates a set discovery service for the given derived context. + + + + + Processes the given context type to determine the DbSet or IDbSet + properties and collect root entity types from those properties. Also, delegates are + created to initialize any of these properties that have public setters. + If the type has been processed previously in the app domain, then all this information + is returned from a cache. + + A dictionary of potential entity type to the list of the names of the properties that used the type. + + + + Calls the public setter on any property found to initialize it to a new instance of DbSet. + + + + + Registers the entities and their entity set name hints with the given . + + The model builder. + + + + Returns false if SuppressDbSetInitializationAttribute is found on the property or the class, otherwise + returns true. + + + + + Determines whether or not an instance of DbSet/ObjectSet can be assigned to a property of the given type. + + The type to check. + The entity type of the DbSet/ObjectSet that can be assigned, or null if no set type can be assigned. + + + + + A EagerInternalConnection object wraps an already existing DbConnection object. + + + + + InternalConnection objects manage DbConnections. + Two concrete base classes of this abstract interface exist: + and . + + + + + IInternalConnection objects manage DbConnections. + Two concrete implementations of this interface exist--LazyInternalConnection and EagerInternalConnection. + + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Returns the underlying DbConnection. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if the connection contains model info; otherwise, false. + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strins. + + + + + Gets or sets the provider to be used when creating the underlying connection. + + + + + Gets the name of the underlying connection string. + + + + + Gets the original connection string. + + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Called after the connection is initialized for the first time. + + + + + Adds a tracking cookie to the connection string for SqlConnections. Returns the + possibly modified store connection string. + + + + + Returns the underlying DbConnection. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if the connection contains model info; otherwise, false. + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strins. + + + + + Gets or sets the provider to be used when creating the underlying connection. + + + + + Gets the name of the underlying connection string. + + + + + Gets the original connection string. + + + + + Gets or sets the underlying object. No initialization is done when the + connection is obtained, and it can also be set to null. + + The underlying connection. + + + + Creates a new EagerInternalConnection that wraps an existing DbConnection. + + An existing connection. + If set to true then the underlying connection should be disposed when this object is disposed. + + + + Dispose the existing connection is the original caller has specified that it should be disposed + by the framework. + + + + + Returns the origin of the underlying connection string. + + + + + An is an where the + instance that it wraps is set immediately at construction time rather than being created lazily. In this case + the internal context may or may not own the instance but will only dispose it + if it does own it. + + + + + An underlies every instance of and wraps an + instance. + The also acts to expose necessary information to other parts of the design in a + controlled manner without adding a lot of internal methods and properties to the + class itself. + Two concrete classes derive from this abstract class - and + . + + + + + Initializes the object with its owner. + + The owner . + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Creates a new temporary based on the same metadata and connection as the real + and sets it as the context to use DisposeTempObjectContext is called. + This allows this internal context and its DbContext to be used for transient operations + such as initializing and seeding the database, after which it can be thrown away. + This isolates the real from any changes made and and saves performed. + + + + + If a temporary ObjectContext was set with UseTempObjectContext, then this method disposes that context + and returns this internal context and its DbContext to using the real ObjectContext. + + + + + Called by methods of to create a database either using the Migrations pipeline + if possible and the core provider otherwise. + + The context to use for core provider calls. + + + + Internal implementation of . + + True if the model hash in the context and the database match; false otherwise. + + + + Checks whether the given model (an EDMX document) matches the current model. + + + + + Queries the database for a model hash and returns it if found or returns null if the table + or the row doesn't exist in the database. + + The model hash, or null if not found. + + + + Queries the database for a model stored in the MigrationHistory table and returns it as an EDMX, or returns + null if the database does not contain a model. + + + + + Saves the model hash from the context to the database. + + + + + Performs the initialization action that may result in a and + handle the exception to provide more meaning to the user. + + The action. + + + + Registers for the ObjectStateManagerChanged event on the underlying ObjectStateManager. + This is a virtual method on this class so that it can be mocked. + + The event handler. + + + + Checks whether or not the given object is in the context in any state other than Deleted. + This is a virtual method on this class so that it can be mocked. + + The entity. + true if the entity is in the context and not deleted; otherwise false. + + + + Saves all changes made in this context to the underlying database. + + The number of objects written to the underlying database. + + + + Initializes this instance, which means both the context is initialized and the underlying + database is initialized. + + + + + Initializes the underlying ObjectContext but does not cause the database to be initialized. + + + + + Marks the database as having not been initialized. This is called when the app calls Database.Delete so + that the database if the app attempts to then use the database again it will be re-initialized automatically. + + + + + Runs the unless it has already been run or there + is no initializer for this context type in which case this method does nothing. + + + + + Marks the database as having been initialized without actually running the . + + + + + Runs the if one has been set for this context type. + Calling this method will always cause the initializer to run even if the database is marked + as initialized. + + + + + Disposes the context. Override the DisposeContext method to perform + additional work when disposing. + + + + + Performs additional work to dispose a context. + + + + + Calls DetectChanges on the underlying if AutoDetectChangesEnabled is + true or if force is set to true. + + if set to true then DetectChanges is called regardless of the value of AutoDetectChangesEnabled. + + + + Returns the DbSet instance for the given entity type. + This property is virtual and returns to that it can be mocked. + + The entity type for which a set should be returned. + A set for the given entity type. + + + + Returns the non-generic instance for the given entity type. + This property is virtual and returns to that it can be mocked. + + The entity type for which a set should be returned. + A set for the given entity type. + + + + Creates an internal set using an app domain cached delegate. + + Type of the entity. + The set. + + + + Returns the entity set and the base type for that entity set for the given type. + This method does o-space loading if required and throws if the type is not in the model. + + The entity type to lookup. + The entity set and base type pair. + + + + Returns the entity set and the base type for that entity set for the given type if that + type is mapped in the model, otherwise returns null. + This method does o-space loading if required. + + The entity type to lookup. + The entity set and base type pair, or null if not found. + + + + Checks whether or not the given entity type is mapped in the model. + + The entity type to lookup. + True if the type is mapped as an entity; false otherwise. + + + + Gets the local entities of the type specified from the state manager. That is, all + Added, Modified, and Unchanged entities of the given type. + + The type of entity to get. + The entities. + + + + Executes the given SQL query against the database backing this context. The results are not materialized as + entities or tracked. + + The type of the element. + The SQL. + The parameters. + The query results. + + + + Executes the given SQL query against the database backing this context. The results are not materialized as + entities or tracked. + + Type of the element. + The SQL. + The parameters. + The query results. + + + + Calls the generic ExecuteSqlQuery but with a non-generic return type so that it + has the correct signature to be used with CreateDelegate above. + + + + + Executes the given SQL command against the database backing this context. + + The SQL. + The parameters. + The return value from the database. + + + + Gets the underlying for the given entity, or returns null if the entity isn't tracked by this context. + This method is virtual so that it can be mocked. + + The entity. + The state entry or null. + + + + Gets the underlying objects for all entities tracked by + this context. + This method is virtual so that it can be mocked. + + State entries for all tracked entities. + + + + Gets the underlying objects for all entities of the given + type tracked by this context. + This method is virtual so that it can be mocked. + + The type of the entity. + State entries for all tracked entities of the given type. + + + + Helper method that gets the underlying objects for all entities that + match the given predicate. + + + + + Wraps the given in either a or + a depending on the actual exception type and the state + entries involved. + + The update exception. + A new exception wrapping the given exception. + + + + Uses the underlying context to create an entity such that if the context is configured + to create proxies and the entity is suitable then a proxy instance will be returned. + This method is virtual so that it can be mocked. + + The type of the entity. + The new entity instance. + + + + Uses the underlying context to create an entity such that if the context is configured + to create proxies and the entity is suitable then a proxy instance will be returned. + This method is virtual so that it can be mocked. + + The type of entity to create. + The new entity instance. + + + + This method is used by CreateDelegate to transform the CreateObject method with return type TEntity + into a method with return type object which matches the required type of the delegate. + + + + + Replaces the connection that will be used by this context. + The connection can only be changed before the context is initialized. + + The new connection. + + + + Throws if the context has been disposed. + + + + + Checks whether or not the internal cache of types to entity sets has been initialized, + and initializes it if necessary. + + + + + Forces all DbSets to be initialized, which in turn causes o-space loading to happen + for any entity type for which we have a DbSet. This includes all DbSets that were + discovered on the user's DbContext type. + + + + + Performs o-space loading for the type and returns false if the type is not in the model. + + + + + Performs o-space loading for the type and throws if the type is not in the model. + + Type of the entity. + + + + Returns true if the given entity type does not have EdmEntityTypeAttribute but is in + an assembly that has EdmSchemaAttribute. This indicates mixing of POCO and EOCO in the + same assembly, which is something that we don't support. + + + + + Determines whether or not the given clrType is mapped to a complex type. Assumes o-space loading has happened. + + + + + Updates the cache of types to entity sets either for the first time or after potentially + doing some o-space loading. + + + + + The public context instance that owns this internal context. + + + + + Returns the underlying . + + + + + Gets the temp object context, or null if none has been set. + + The temp object context. + + + + The compiled model created from the Code First pipeline, or null if Code First was + not used to create this context. + Causes the Code First pipeline to be run to create the model if it has not already been + created. + + + + + Set to true when a database initializer is performing some actions, such as creating or deleting + a database, or seeding the database. + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + Gets or sets a value indicating whether lazy loading is enabled. + + + + + Gets or sets a value indicating whether proxy creation is enabled. + + + + + Gets or sets a value indicating whether DetectChanges is called automatically in the API. + + + + + Gets or sets a value indicating whether to validate entities when is called. + + + + + True if the context has been disposed. + + + + + The connection underlying this context. Accessing this property does not cause the context + to be initialized, only its connection. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries, + database intializers and connection strings. + + + + + Gets or sets the provider details to be used when building the EDM model. + + + + + Gets the name of the underlying connection string. + + + + + Gets the provider name bsing used either using a cached value or getting it from + the DbConnection in use. + + + + + Gets or sets a custom OnModelCreating action. + + + + + Gets the DatabaseOperations instance to use to perform Create/Delete/Exists operations + against the database. + Note that this virtual property can be mocked to help with unit testing. + + + + + Gets instance used to create validators and validation contexts. + This property is virtual to allow mocking. + + + + + For mocking. + + + + + Constructs an for an already existing . + + The owner . + The existing . + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Does nothing, since the already exists. + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Disposes the context. The underlying is also disposed if it is owned. + + + + + + + + Returns the underlying . + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + The connection underlying this context. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets a value indicating whether lazy loading is enabled. This is just a wrapper + over the same flag in the underlying . + + + + + Gets or sets a value indicating whether proxy creation is enabled. This is just a wrapper + over the same flag in the underlying ObjectContext. + + + + + An implementation of that represents a clone of another + dictionary. That is, all the property values have been been copied into this dictionary. + + + + + The internal class used to implement . + This internal class allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal context with which the entity of complex object is associated. + The type of the entity or complex object. + If set to true this is a dictionary for an entity, otherwise it is a dictionary for a complex object. + + + + Implemented by subclasses to get the dictionary item for a given property name. + Checking that the name is valid should happen before this method is called such + that subclasses do not need to perform the check. + + Name of the property. + An item for the given name. + + + + Creates an object of the underlying type for this dictionary and hydrates it with property + values from this dictionary. + + The properties of this dictionary copied into a new object. + + + + Creates an instance of the underlying type for this dictionary, which may either be an entity type (in which + case CreateObject on the context is used) or a non-entity type (in which case the empty constructor is used.) + In either case, app domain cached compiled delegates are used to do the creation. + + + + + Sets the values of this dictionary by reading values out of the given object. + The given object must be of the type that this dictionary is based on. + + The object to read values from. + + + + Creates a new dictionary containing copies of all the properties in this dictionary. + Changes made to the new dictionary will not be reflected in this dictionary and vice versa. + + A clone of this dictionary. + + + + Sets the values of this dictionary by reading values from another dictionary. + The other dictionary must be based on the same type as this dictionary, or a type derived + from the type for this dictionary. + + The dictionary to read values from. + + + + Gets the dictionary item for the property with the given name. + This method checks that the given name is valid. + + The property name. + The item. + + + + Sets the value of the property only if it is different from the current value and is not + an invalid attempt to set a complex property. + + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + Gets or sets the value of the property with the specified property name. + The value may be a nested instance of this class. + + The property name. + The value of the property. + + + + Gets the entity type of complex type that this dictionary is based on. + + The type of the object underlying this dictionary. + + + + Gets the internal context with which the underlying entity or complex type is associated. + + The internal context. + + + + Gets a value indicating whether the object for this dictionary is an entity or a complex object. + + true if this this is a dictionary for an entity; false if it is a dictionary for a complex object. + + + + Initializes a new instance of the class by copying + values from the given dictionary. + + The dictionary to clone. + If non-null, then the values for the new dictionary are taken from this record rather than from the original dictionary. + + + + Gets the dictionary item for a given property name. + + Name of the property. + An item for the given name. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + An implementation of for an item in a . + + + + + Represents an item in an representing a property name/value. + + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + true If this instance represents a complex property; otherwise, false. + + + + Gets the type of the underlying property. + + The property type. + + + + Initializes a new instance of the class. + + The name. + The value. + The type. + If set to true this item represents a complex property. + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + + true If this instance represents a complex property; otherwise, false. + + + + + Gets the type of the underlying property. + + The property type. + + + + An implementation of that is based on an existing + instance. + + + + + Initializes a new instance of the class. + + The internal context. + The type. + The data record. + If set to true this is a dictionary for an entity, otherwise it is a dictionary for a complex object. + + + + Gets the dictionary item for a given property name. + + Name of the property. + An item for the given name. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + An implementation of for an item in a . + + + + + Initializes a new instance of the class. + + The data record. + The ordinal. + The value. + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + + true If this instance represents a complex property; otherwise, false. + + + + + Gets the type of the underlying property. + + The property type. + + + + This is version of an internal interface that already exists in System.Data.Entity that + is implemented by . Using this interface allows state + entries to be mocked for unit testing. The plan is to remove this version of the + interface and use the one in System.Data.Entity once we roll into the framework. + Note that some members may need to be added to the interface in the framework when + we combine the two. + + + + + The internal class used to implement and + . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Base class for and + containing common code for collection and reference navigation property entries. + + + + + Base class for all internal entries that represent different kinds of properties. + + + + + Initializes a new instance of the class. + + The internal entity entry. + The member metadata. + + + + Validates this property. + + A sequence of validation errors for this property. Empty if no errors. Never null. + + + + Creates a new non-generic backed by this internal entry. + The actual subtype of the DbMemberEntry created depends on the metadata of this internal entry. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The actual subtype of the DbMemberEntry created depends on the metadata of this internal entry. + + The type of the entity. + The type of the property. + The new entry. + + + + Gets the property name. + The property is virtual to allow mocking. + + The property name. + + + + Gets or sets the current value of the navigation property. + + The current value. + + + + Gets the internal entity entry property belongs to. + This property is virtual to allow mocking. + + The internal entity entry. + + + + Gets the entry metadata. + + The entry metadata. + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Calls Load on the underlying . + + + + + Uses CreateSourceQuery on the underlying to create a query for this + navigation property. + + + + + Gets the navigation property value from the object. + + The entity. + The navigation property value. + + + + Validates that the owning entity entry is associated with an underlying and + is not just wrapping a non-attached entity. + If the entity is not detached, then the RelatedEnd for this navigation property is obtained. + + + + + Calls IsLoaded on the underlying . + + + + + Gets the related end, which will be null if the entity is not being tracked. + + The related end. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + This property is virtual so that it can be mocked. + + The current value. + + + + Gets a delegate that can be used to get the value of the property directly from the entity. + Returns null if the property does not have an accessible getter. + + The getter delegate, or null. + + + + Gets a delegate that can be used to set the value of the property directly on the entity. + Returns null if the property does not have an accessible setter. + + The setter delegate, or null. + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Gets the navigation property value from the object. + Since for a collection the related end is an , it means + that the internal representation of the navigation property is just the related end. + + The entity. + The navigation property value. + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Creates a new generic backed by this internal entry. + The actual subtype of the DbCollectionEntry created depends on the metadata of this internal entry. + + The type of the entity. + The type of the element. + The new entry. + + + + Creates a object for the given entity type + and collection element type. + + The type of the entity. + The type of the property. + Type of the element. + The set. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + + The current value. + + + + The internal class used to implement + and . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal context. + The state entry. + + + + Initializes a new instance of the class for an + entity which may or may not be attached to the context. + + The internal context. + The entity. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + + The store values. + + + + Appends a query for the properties in the entity to the given string builder that is being used to + build the eSQL query. This method may be called recursively to query for all the sub-properties of + a complex property. + + The query builder. + The qualifier with which to prefix each property name. + The dictionary that acts as a template for the properties to query. + + + + Validates that a dictionary can be obtained for the state of the entity represented by this entry. + + The method name being used to request a dictionary. + The state that is invalid for the request being processed. + + + + Calls Refresh with StoreWins on the underlying state entry. + + + + + Gets an internal object representing a reference navigation property. + This method is virtual to allow mocking. + + The navigation property. + The type of entity requested, which may be 'object' or null if any type can be accepted. + The entry. + + + + Gets an internal object representing a collection navigation property. + This method is virtual to allow mocking. + + The navigation property. + The type of entity requested, which may be 'object' or null f any type can be accepted. + The entry. + + + + Gets an internal object representing a navigation, scalar, or complex property. + This method is virtual to allow mocking. + + Name of the property. + The type of entity requested, which may be 'object' if any type can be accepted. + The entry. + + + + Gets an internal object representing a scalar or complex property. + This method is virtual to allow mocking. + + The property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Gets an internal object representing a scalar or complex property. + The property may be a nested property on the given . + + The parent property entry, or null if this is a property directly on the entity. + Name of the property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Gets an internal object representing a scalar or complex property. + The property may be a nested property on the given . + + The parent property entry, or null if this is a property directly on the entity. + Name of the property. + The property split out into its parts. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Checks that the given property name is a navigation property and is either a reference property or + collection property according to the value of requireCollection. + + + + + Gets metadata for the given property if that property is a navigation property or returns null + if it is not a navigation property. + + Name of the property. + Navigation property metadata or null. + + + + Gets the type of entity or entities at the target end of the given navigation property. + + The navigation property. + The CLR type of the entity or entities at the other end. + + + + Gets the related end for the navigation property with the given name. + + The navigation property. + + + + + Uses EDM metadata to validate that the property name exists in the model and represents a scalar or + complex property or exists in the CLR type. + This method is public and virtual so that it can be mocked. + + The property name. + The type on which the property is declared. + The type of object requested, which may be 'object' if any type can be accepted. + Metadata for the property. + + + + Splits the given property name into parts delimited by dots. + + Name of the property. + The parts of the name. + + + + Validates that this entry is associated with an underlying and + is not just wrapping a non-attached entity. + + + + + Validates entity represented by this entity entry. + This method is virtual to allow mocking. + + User defined dictionary containing additional info for custom validation. This parameter is optional and can be null. + containing validation result. Never null. + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the tracked entity. + This property is virtual to allow mocking. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + This property is virtual to allow mocking. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + This property is virtual to allow mocking. + + The original values. + + + + Checks whether or not this entry is associated with an underlying or + is just wrapping a non-attached entity. + + + + + Gets the type of the entity being tracked. + + The type of the entity. + + + + Gets the c-space entity type for this entity from the EDM. + + + + + Gets the underlying object state entry. + + + + + Gets the internal context. + + The internal context. + + + + A concrete implementation of used for properties of entities. + + + + + The internal class used to implement and + . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal entry. + The property info. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. If this is a property of an entity, then this method returns + true if the property is modified. If this is a property of a complex object, then + this method returns true if the top-level complex property on the entity is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + If this is a property of an entity, then this method marks it as modified. + If this is a property of a complex object, then this method marks the top-level + complex property as modified. + + + + + Throws if the user attempts to set a complex property to null. + + The value. + + + + Sets the given value directly onto the underlying entity object. + + The value. + True if the property had a setter that we could attempt to call; false if no setter was available. + + + + Sets the property value, potentially by setting individual nested values for a complex + property. + + The value. + + + + Gets an internal object representing a scalar or complex property of this property, + which must be a mapped complex property. + This method is virtual to allow mocking. + + The property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Validates that the owning entity entry is associated with an underlying and + is not just wrapping a non-attached entity. + + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent entity or complex property. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent entity or complex property. + That is, the original values that contains the value for this property. + + The parent original values. + + + + A delegate that reads the value of this property. + May be null if there is no way to set the value due to missing accessors on the type. + + + + + A delegate that sets the value of this property. + May be null if there is no way to set the value due to missing accessors on the type. + + + + + Gets or sets the original value. + Note that complex properties are returned as objects, not property values. + + + + + Gets or sets the current value. + Note that complex properties are returned as objects, not property values. + Also, for complex properties, the object returned is the actual complex object from the entity + and setting the complex object causes the actual object passed to be set onto the entity. + + The current value. + + + + Gets or sets a value indicating whether this property is modified. + + + + + Gets the property metadata. + + The property metadata. + + + + Initializes a new instance of the class. + + The internal entry. + The property info. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. Since this is a property of an entity this method returns + true if the property is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + Since this is a property of an entity this method marks it as modified. + + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent entity. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent entity. + That is, the original values that contains the value for this property. + + The parent original values. + + + + A concrete implementation of used for properties of complex objects. + + + + + Initializes a new instance of the class. + + The parent property entry. + The property metadata. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. Since this is a property of a complex object + this method returns true if the top-level complex property on the entity is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + Since this is a property of a complex object this method marks the top-level + complex property as modified. + + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent complex property. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent complex property. + That is, the original values that contains the value for this property. + + The parent original values. + + + + The internal class used to implement , + and . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Gets the navigation property value from the object. + For reference navigation properties, this means getting the value from the + object. + + The entity. + The navigation property value. + + + + Sets the navigation property value onto the object. + For reference navigation properties, this means setting the value onto the + object. + + The entity. + The value. + + + + Sets the given value on the given which must be an + . + This method is setup in such a way that it can easily be used by CreateDelegate without any + dynamic code generation needed. + + The type of the related entity. + The entity reference. + The value. + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + + The current value. + + + + Contains metadata about a member of an entity type or complex type. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry if the new entry is nested, otherwise null. + The new entry. + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets the name of the property. + + The name. + + + + Gets the type of the entity or complex object that on which the member is declared. + + The type that the member is declared on. + + + + Gets the type of element for the property, which for non-collection properties + is the same as the MemberType and which for collection properties is the type + of element contained in the collection. + + The type of the element. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + The types of member entries supported. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + if set to true this is a collection nav prop. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry which will always be null for navigation entries. + The new entry. + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + Contains metadata for a property of a complex object or entity. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + if set to true the property is mapped in the EDM. + if set to true the property is a complex property. + + + + Validates that the given name is a property of the declaring type (either on the CLR type or in the EDM) + and that it is a complex or scalar property rather than a nav property and then returns metadata about + the property. + + The internal context. + The type that the property is declared on. + The type of property requested, which may be 'object' if any type can be accepted. + Name of the property. + Metadata about the property, or null if the property does not exist or is a navigation property. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry if the new entry is nested, otherwise null. + The new entry. + + + + Gets a value indicating whether this is a complex property. + That is, not whether or not this is a property on a complex object, but rather if the + property itself is a complex property. + + + true if this instance is complex; otherwise, false. + + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets a value indicating whether this instance is mapped in the EDM. + + true if this instance is mapped; otherwise, false. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + An implementation of that wraps an existing set but makes + it read-only. + + + + + + Initializes a new instance of the class wrapped around + another existing set. + + The existing set. + + + + This is a temporary adapter class that wraps an and + presents it as an . This class will be removed once + we roll into the System.Data.Entity assembly. See + for more details. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given EntitySet and BaseType. + + + + + The EntitySet part of the pair. + + + + + The BaseType part of the pair. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given database initializer delegate and a flag + indicating whether or not it is locked. + + + + + The initializer delegate. + + + + + A flag indicating whether or not the initializer is locked and should not be changed. + + + + + Represents a raw SQL query against the context for any type where the results are never + associated with an entity set and are never tracked. + + + + + Represents a raw SQL query against the context that may be for entities in an entity set + or for some other non-entity element type. + + + + + Initializes a new instance of the class. + + The SQL. + The parameters. + + + + If the query is would track entities, then this method returns a new query that will + not track entities. + + A no-tracking query. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Gets the SQL query string, + + The SQL query. + + + + Gets the parameters. + + The parameters. + + + + Returns false. + + false. + + + + Initializes a new instance of the class. + + The internal context. + Type of the element. + The SQL. + The parameters. + + + + Returns this query since it can never be a tracking query. + + This instance. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Generic wrapper around to allow results to be + returned as generic + + The type of the element. + + + + Executes the query and returns an enumerator for the elements. + + An + + object that can be used to iterate through the elements. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Returns false. + + false. + + + + Represents a raw SQL query against the context for entities in an entity set. + + + + + Initializes a new instance of the class. + + The set. + The SQL. + if set to true then the entities will not be tracked. + The parameters. + + + + If the query is would track entities, then this method returns a new query that will + not track entities. + + A no-tracking query. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Gets a value indicating whether this instance is set to track entities or not. + + + true if this instance is no-tracking; otherwise, false. + + + + + A LazyInternalConnection object manages information that can be used to create a DbConnection object and + is responsible for creating that object and disposing it. + + + + + Creates a new LazyInternalConnection using convention to calculate the connection. + The DbConnection object will be created lazily on demand and will be disposed when the LazyInternalConnection is disposed. + + Either the database name or a connection string. + + + + Creates a new LazyInternalConnection targeting a specific database. + The DbConnection object will be created lazily on demand and will be disposed when the LazyInternalConnection is disposed. + + The connection to target. + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Disposes the underlying DbConnection. + Note that dispose actually puts the LazyInternalConnection back to its initial state such that + it can be used again. + + + + + + Searches the app.config/web.config file for a connection that matches the given name. + The connection might be a store connection or an EF connection. + + The connection name. + + True if a connection from the app.config file was found and used. + + + + Attempts to locate a connection entry in the configuration based on the supplied context name. + + The name to search for. + The configuration to search in. + Connection string if found, otherwise null. + + + + Initializes the connection based on a connection string. + + The settings to initialize from. + + + + Returns the underlying DbConnection, creating it first if it does not already exist. + + + + + Returns the origin of the underlying connection string. + + + + + Gets the name of the underlying connection string. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if connection contain model info; otherwise, false. + + + + Gets a value indicating if the lazy connection has been initialized. + + + + + A is a concrete type that will lazily create the + underlying when needed. The created is owned by the + internal context and will be disposed when the internal context is disposed. + + + + + Constructs a for the given owner that will be initialized + on first use. + + The owner . + Responsible for creating a connection lazily when the context is used for the first time. + The model, or null if it will be created by convention + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Saves all changes made in this context to the underlying database, but only if the + context has been initialized. If the context has not been initialized, then this + method does nothing because there is nothing to do; in particular, it does not + cause the context to be initialized. + + The number of objects written to the underlying database. + + + + Disposes the context. The underlying is also disposed. + The connection to the database ( object) is also disposed if it was created by + the context, otherwise it is not disposed. + + + + + + + + Initializes the underlying . + + + + + Creates an immutable, cacheable representation of the model defined by this builder. + This model can be used to create an or can be passed to a + constructor to create a for this model. + + + + + + Creates and configures the instance that will be used to build the + . + + The builder. + + + + Marks the database as having not been initialized. This is called when the app calls Database.Delete so + that the database if the app attempts to then use the database again it will be re-initialized automatically. + + + + + Marks the database as having been initialized without actually running the . + + + + + Runs the unless it has already been run or there + is no initializer for this context type in which case this method does nothing. + + + + + Performs some action (which may do nothing) in such a way that it is guaranteed only to be run + once for the model and connection in this app domain, unless it fails by throwing an exception, + in which case it will be re-tried next time the context is initialized. + + The action. + + + + Returns the underlying . + + + + + The compiled model created from the Code First pipeline, or null if Code First was + not used to create this context. + Causes the Code First pipeline to be run to create the model if it has not already been + created. + + + + + The actually being used, which may be the + temp context for initialization or the real context. + + + + + The connection underlying this context. Accessing this property does not cause the context + to be initialized, only its connection. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strings. + + + + + Gets the name of the underlying connection string. + + + + + Gets or sets the provider details to be used when building the EDM model. + + + + + + + + Gets or sets a custom OnModelCreating action. + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + Gets or sets a value indicating whether lazy loading is enabled. + If the exists, then this property acts as a wrapper over the flag stored there. + If the has not been created yet, then we store the value given so we can later + use it when we create the . This allows the flag to be changed, for example in + a DbContext constructor, without it causing the to be created. + + + + + Gets or sets a value indicating whether proxy creation is enabled. + If the ObjectContext exists, then this property acts as a wrapper over the flag stored there. + If the ObjectContext has not been created yet, then we store the value given so we can later + use it when we create the ObjectContext. This allows the flag to be changed, for example in + a DbContext constructor, without it causing the ObjectContext to be created. + + + + + A wrapping query provider that performs expression transformation and then delegates + to the provider. The objects returned are always instances + of . This provider is associated with generic objects. + + + + + Creates a provider that wraps the given provider. + + The provider to wrap. + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a . + + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a where T is determined + from the element type of the ObjectQuery. + + + + + By default, calls the same method on the wrapped provider. + + + + + By default, calls the same method on the wrapped provider. + + + + + Creates an appropriate generic IQueryable using Reflection and the underlying ElementType of + the given ObjectQuery. + + + + + Performs expression replacement and then delegates to the wrapped provider to create an + . + + + + + Wraps the given as a where T is determined + from the element type of the ObjectQuery. + + + + + Gets the internal context. + + The internal context. + + + + A LINQ expression visitor that finds uses with equivalent + instances. + + + + + Replaces calls to DbContext.Set() with an expression for the equivalent . + + The node to replace. + A new node, which may have had the replacement made. + + + + Replaces a or property with a constant expression + for the underlying . + + The node to replace. + A new node, which may have had the replacement made. + + + + Processes the fields in each constant expression and replaces instances with + the underlying ObjectQuery instance. This handles cases where the query has a closure + containing values. + + + + + Gets a value from the given member, or returns null + if the member doesn't contain a DbContext instance. + + The expression for the object for the member, which may be null for a static member. + The member. + The context or null. + + + + Gets the instance from the given instance or static member, returning null + if the member does not contain a DbContext instance. + + The member. + The value of the object to get the instance from, or null if the member is static. + The context instance or null. + + + + Takes a or and creates an expression + for the underlying . + + + + + Takes a or and extracts the underlying . + + + + + A non-generic interface implemented by that allows operations on + any query object without knowing the type to which it applies. + + + + + An interface implemented by . + + The type of the element. + + + + A non-generic interface implemented by that allows operations on + any set object without knowing the type to which it applies. + + + + + An interface implemented by . + + + + + An instance of this internal class is created whenever an instance of the public + class is needed. This allows the public surface to be non-generic, while the runtime type created + still implements . + + The type of the element. + + + + Creates a new query that will be backed by the given internal query object. + + The backing query. + + + + See comments in . + + + + + See comments in . + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the underlying internal query object. + + The internal query. + + + + An instance of this internal class is created whenever an instance of the public + class is needed. This allows the public surface to be non-generic, while the runtime type created + still implements . + + The type of the entity. + + + + Creates a new set that will be backed by the given internal set. + + The internal set. + + + + Creates an instance of this class. This method is used with CreateDelegate to cache a delegate + that can create a generic instance without calling MakeGenericType every time. + + + The internal set to wrap, or null if a new internal set should be created. + The set. + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the underlying internal query object. + + The internal query. + + + + Gets the underlying internal set. + + The internal set. + + + + See comments in . + + + + + An InternalQuery underlies every instance of DbSet and DbQuery. It acts to lazily initialize a InternalContext as well + as an ObjectQuery and EntitySet the first time that it is used. The InternalQuery also acts to expose necessary + information to other parts of the design in a controlled manner without adding a lot of internal methods and + properties to the DbSet and DbQuery classes themselves. + + The type of entity to query for. + + + + Creates a new query that will be backed by the given InternalContext. + + The backing context. + + + + Creates a new internal query based on the information in an existing query together with + a new underlying ObjectQuery. + + + + + Resets the query to its uninitialized state so that it will be re-lazy initialized the next + time it is used. This allows the ObjectContext backing a DbContext to be switched out. + + + + + Updates the underlying ObjectQuery with the given include path. + + The include path. + A new query containing the defined include path. + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Performs lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that the query can be used. + + + + + Returns a representation of the underlying query, equivalent + to ToTraceString on ObjectQuery. + + + The query string. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + The underlying InternalContext. + + + + + The underlying ObjectQuery. + + + + + The underlying ObjectQuery. + + + + + The LINQ query expression. + + + + + The LINQ query provider for the underlying . + + + + + The IQueryable element type. + + + + + Creates a new query that will be backed by the given InternalContext. + + The backing context. + + + + Resets the set to its uninitialized state so that it will be re-lazy initialized the next + time it is used. This allows the ObjectContext backing a DbContext to be switched out. + + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Finds an entity in the state manager with the given primary key values, or returns null + if no such entity can be found. This includes looking for Added entities with the given + key values. + + + + + Finds an entity in the store with the given primary key values, or returns null + if no such entity can be found. This code is adapted from TryGetObjectByKey to + include type checking in the query. + + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + This method is virtual so that it can be mocked. + + The entity to attach. + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + This method is virtual so that it can be mocked. + + The entity to add. + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + This method is virtual so that it can be mocked. + + The entity to remove. + + + + This method checks whether an entity is already in the context. If it is, then the state + is changed to the new state given. If it isn't, then the action delegate is executed to + either Add or Attach the entity. + + A delegate to Add or Attach the entity. + The new state to give the entity if it is already in the context. + The entity. + Name of the method. + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Performs lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that the query can be used. + This method is virtual so that it can be mocked. + + + + + Attempts to perform lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that o-space loading has happened and the query can be used. This method doesn't throw if the type + for the set is not mapped. + + + + + Creates an underlying for this set. + + if set to true then the query is set to be no-tracking. + The query. + + + + Returns a representation of the underlying query, equivalent + to ToTraceString on ObjectQuery. + + + The query string. + + + + + Updates the underlying ObjectQuery with the given include path. + + The include path. + A new query containing the defined include path. + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Executes the given SQL query against the database materializing entities into the entity set that + backs this set. + + The SQL quey. + if true then the entities are not tracked, otherwise they are. + The parameters. + The query results. + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the ObservableCollection representing the local view for the set based on this query. + + + + + The underlying ObjectQuery. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet name. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet name, quoted for ESQL. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet. Accessing this property will trigger lazy initialization of the query. + + + + + The base type for the underlying entity set. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying InternalContext. Accessing this property will trigger lazy initialization of the query. + + + + + The LINQ query expression. + + + + + The LINQ query provider for the underlying . + + + + + A wrapping query provider that performs expression transformation and then delegates + to the provider. The objects returned + are always instances of when the generic CreateQuery method is + used and are instances of when the non-generic CreateQuery method + is used. This provider is associated with non-generic objects. + + + + + Creates a provider that wraps the given provider. + + The provider to wrap. + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a . + + + + + Delegates to the wrapped provider except returns instances of . + + + + + Creates an appropriate generic IQueryable using Reflection and the underlying ElementType of + the given ObjectQuery. + + + + + Extends to create a sortable binding list that stays in + sync with an underlying . That is, when items are added + or removed from the binding list, they are added or removed from the ObservableCollecion, and + vice-versa. + + The list element type. + + + + An extended BindingList implementation that implements sorting. + This class was adapted from the LINQ to SQL class of the same name. + + The element type. + + + + Initializes a new instance of the class with the + the given underlying list. Note that sorting is dependent on having an actual + rather than some other ICollection implementation. + + The list. + + + + Applies sorting to the list. + + The property to sort by. + The sort direction. + + + + Stops sorting. + + + + + Gets a value indicating whether this list is sorted. + + + true if this instance is sorted; otherwise, false. + + + + + Gets the sort direction. + + The sort direction. + + + + Gets the sort property being used to sort. + + The sort property. + + + + Returns true indicating that this list supports sorting. + + true. + + + + Implements comparing for the implementation. + + + + + Initializes a new instance of the class + for sorting the list. + + The property to sort by. + The sort direction. + + + + Compares two instances of items in the list. + + The left item to compare. + The right item to compare. + + + + + Determines whether this instance can sort for the specified type. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Determines whether this instance can sort for the specified type using IComparable. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Determines whether this instance can sort for the specified type using ToString. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Initializes a new instance of a binding list backed by the given + + The obervable collection. + + + + Creates a new item to be added to the binding list. + + The new item. + + + + Cancels adding of a new item that was started with AddNew. + + Index of the item. + + + + Removes all items from the binding list and underlying ObservableCollection. + + + + + Ends the process of adding a new item that was started with AddNew. + + Index of the item. + + + + Inserts the item into the binding list at the given index. + + The index. + The item. + + + + Removes the item at the specified index. + + The index. + + + + Sets the item into the list at the given position. + + The index to insert at. + The item. + + + + Event handler to update the binding list when the underlying observable collection changes. + + The sender. + Data indicating how the collection has changed. + + + + Adds the item to the underlying observable collection. + + The item. + + + + Removes the item from the underlying from observable collection. + + The item. + + + + Adapted from to allow the initializer to take an input object and + to do one-time initialization that only has side-effects and doesn't return a value. + + The type of the input. + + + + Initializes a new instance of the class. + + The action. + + + + Performs the action unless it has already been successfully performed before. + + The input to the action; ignored if the action has already succeeded. + + + + Adapted from to allow the initializer to take an input object and + to retry initialization if it has previously failed. + + + This class can only be used to initialize reference types that will not be null when + initialized. + + The type of the input. + The type of the result. + + + + Initializes a new instance of the class. + + The value factory. + + + + Gets the value, possibly by running the initializer if it has not been run before or + if all previous times it ran resulted in exceptions. + + The input to the initializer; ignored if initialization has already succeeded. + The initialized object. + + + + Validates a property of a given EDM complex type. + + + This is a composite validator for a complex property of an entity. + + + + + Validates a property of a given EDM property type. + + + This is a composite validator for a property of an entity or a complex type. + + + + + Simple validators for the corresponding property. + + + + + Name of the property the validator was created for. + + + + + Creates an instance of for a given EDM property. + + The EDM property name. + Validators used to validate the given property. + + + + Validates a property. + + Validation context. Never null. + Property to validate. Never null. + Validation errors as . Empty if no errors. Never null. + + + + + Simple validators for the corresponding property. + + + + + Gets the name of the property the validator was created for. + + + + + The complex type validator. + + + + + Creates an instance of for a given complex property. + + The complex property name. + Validators used to validate the given property. + Complex type validator. + + + + Validates a complex property. + + Validation context. Never null. + Property to validate. Never null. + Validation errors as . Empty if no errors. Never null. + + + + + Validator used to validate a property of a given EDM ComplexType. + + + This is a composite validator. + + + + + Validator used to validate an entity of a given EDM Type. + + + This is a composite validator for an EDM Type. + + + + + Creates an instance for a given EDM type. + + Property validators. + Type level validators. + + + + Validates an instance. + + Entity validation context. Must not be null. + The entry for the complex property. Null if validating an entity. + instance. Never null. + + Protected so it doesn't appear on EntityValidator. + + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Returns a validator for a child property. + + Name of the child property for which to return a validator. + + Validator for a child property. Possibly null if there are no validators for requested property. + + + + + Creates an instance for a given EDM complex type. + + Property validators. + Type level validators. + + + + Validates an instance. + + Entity validation context. Must not be null. + The entry for the complex property. Null if validating an entity. + instance. Never null. + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Contains information needed to validate an entity or its properties. + + + + + The entity being validated or the entity that owns the property being validated. + + + + + Initializes a new instance of EntityValidationContext class. + + + The entity being validated or the entity that owns the property being validated. + + + External contexts needed for validation. + + + + + External context needed for validation. + + + + + Gets the entity being validated or the entity that owns the property being validated. + + + + + Validator used to validate an entity of a given EDM EntityType. + + + This is a top level, composite validator. This is also an entry point to getting an entity + validated as validation of an entity is always started by calling Validate method on this type. + + + + + Creates an instance for a given EDM entity type. + + Property validators. + Entity type level validators. + + + + Validates an entity. + + Entity validation context. Must not be null. + instance. Never null. + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Builds validators based on s specified on entity CLR types and properties + as well as based on presence of implementation on entity and complex + type CLR types. It's not sealed and not static for mocking purposes. + + + + + Builds an for the given . + + The entity entry to build the validator for. + Whether the currently processed type is the target type or one of the ancestor types. + + + for the given . Possibly null + if no validation has been specified for this entity type. + + + + + Builds the validator for a given and the corresponding + . + + The CLR type that corresponds to the EDM complex type. + The EDM complex type that type level validation is built for. + A for the given complex type. May be null if no validation specified. + + + + Extracted method from BuildEntityValidator and BuildComplexTypeValidator + + + + + Build validators for the and the corresponding + or . + + Properties to build validators for. + Non-navigation EDM properties. + Navigation EDM properties. + A list of validators. Possibly empty, never null. + + + + Builds a for the given and the corresponding + . If the property is a complex type, type level validators will be built here as + well. + + The CLR property to build the validator for. + The EDM property to build the validator for. + + for the given . Possibly null + if no validation has been specified for this property. + + + + + Builds a for the given transient . + + The CLR property to build the validator for. + + for the given . Possibly null + if no validation has been specified for this property. + + + + + Builds s for given that derive from + . + + Attributes used to build validators. + + A list of s built from . + Possibly empty, never null. + + + + + Returns all non-static non-indexed CLR properties from the . + + The CLR to get the properties from. + + A collection of CLR properties. Possibly empty, never null. + + + + + Builds validators based on the facets of : + * If .Nullable facet set to false adds a validator equivalent to the RequiredAttribute + * If the .MaxLength facet is specified adds a validator equivalent to the MaxLengthAttribute. + However the validator isn't added if .IsMaxLength has been set to true. + + The CLR property to build the facet validators for. + The property for which facet validators will be created + A collection of validators. + + + + Abstracts simple validators used to validate entities and properties. + + + + + Validates an entity or a property. + + Validation context. Never null. + Property to validate. Can be null for type level validation. + Validation error as. Empty if no errors. Never null. + + + + + Contract for IValidator.Validate method. + + Validation context. + Property. + Nothing - always throws. + + + + Validates entities or complex types implementing IValidatableObject interface. + + + + + Display attribute used to specify the display name for an entity or complex property. + + + + + Validates an entity or a complex type implementing IValidatableObject interface. + This method is virtual to allow mocking. + + Validation context. Never null. + + Property to validate. Null if this is the entity that will be validated. Never null if this + is the complex type that will be validated. + + Validation error as . Empty if no errors. Never null. + + + Note that is used to figure out what needs to be validated. If it not null the complex + type will be validated otherwise the entity will be validated. + Also if this is an IValidatableObject complex type but the instance (.CurrentValue) is null we won't validate + anything and will not return any errors. The reason for this is that Validation is supposed to validate using + information the user provided and not some additional implicit rules. (ObjectContext will throw for operations + that involve null complex properties). + + + + + Validates a property, complex property or an entity using validation attributes the property + or the complex/entity type is decorated with. + + + Note that this class is used for validating primitive properties using attributes declared on the property + (property level validation) and complex properties and entities using attributes declared on the type + (type level validation). + + + + + Display attribute used to specify the display name for a property or entity. + + + + + Validation attribute used to validate a property or an entity. + + + + + Creates an instance of class. + + + Validation attribute used to validate a property or an entity. + + + + + Validates a property or an entity. + + Validation context. Never null. + Property to validate. Null for entity validation. Not null for property validation. + + + Validation errors as . Empty if no errors, never null. + + + + + Used to cache and retrieve generated validators and to create context for validating entities or properties. + + + + + Collection of validators keyed by the entity CLR type. Note that if there's no validation for a given type + it will be associated with a null validator. + + + + + Initializes a new instance of class. + + + + + Returns a validator to validate . + + Entity the validator is requested for. + + to validate . Possibly null if no validation + has been specified for the entity. + + + + + Returns a validator to validate . + + Navigation property the validator is requested for. + + Validator to validate . Possibly null if no validation + has been specified for the requested property. + + + + + Gets a validator for the . + + Entity validator. + Property to get a validator for. + + Validator to validate . Possibly null if there is no validation for the + . + + + For complex properties this method walks up the type hierarchy to get to the entity level and then goes down + and gets a validator for the child property that is an ancestor of the property to validate. If a validator + returned for an ancestor is null it means that there is no validation defined beneath and the method just + propagates (and eventually returns) null. + + + + + Creates for . + + Entity entry for which a validation context needs to be created. + User defined dictionary containing additional info for custom validation. This parameter is optional and can be null. + An instance of class. + + + + + A wrapper around EntityKey that allows key/values pairs that have null values to + be used. This allows Added entities with null key values to be searched for in + the ObjectStateManager. + + + + The key name/key value pairs, where some key values may be null + + + + Creates a new WrappedEntityKey instance. + + The entity set that the key belongs to. + The fully qualified name of the given entity set. + The key values, which may be null or contain null values. + The name of the parameter passed for keyValue by the user, which is used when throwing exceptions. + + + + True if any of the key values are null, which means that the EntityKey will also be null. + + + + + An actual EntityKey, or null if any of the key values are null. + + + + + The key name/key value pairs of the key, in which some of the key values may be null. + + + + + Allows configuration to be performed for an complex type in a model. + + A ComplexTypeConfiguration can be obtained via the ComplexType method on + or a custom type derived from ComplexTypeConfiguration + can be registered via the Configurations property on . + + The complex type to be configured. + + + + Allows configuration to be performed for a type in a model. + + The type to be configured. + + + + Configures a property that is defined on this type. + + The type of the property being configured. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + The type of the property being configured. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Excludes a property from the model so that it will not be mapped to the database. + + The type of the property to be ignored. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + + + + Initializes a new instance of ComplexTypeConfiguration + + + + + Allows derived configuration classes for entities and complex types to be registered with a . + + + Derived configuration classes are created by deriving from + or and using a type to be included in the model as the generic + parameter. + + Configuration can be performed without creating derived configuration classes via the Entity and ComplexType + methods on . + + + + + Adds an to the . + Only one can be added for each type in a model. + + The entity type being configured. + The entity type configuration to be added. + The same ConfigurationRegistrar instance so that multiple calls can be chained. + + + + Adds an to the . + Only one can be added for each type in a model. + + The complex type being configured. + The complex type configuration to be added + The same ConfigurationRegistrar instance so that multiple calls can be chained. + + + + Allows the conventions used by a instance to be customized. + Currently removal of one or more default conventions is the only supported operation. + The default conventions can be found in the System.Data.Entity.ModelConfiguration.Conventions namespace. + + + + + Disables a convention for the . + The default conventions that are available for removal can be found in the System.Data.Entity.ModelConfiguration.Conventions namespace. + + The type of the convention to be disabled. + + + + Configures the table and column mapping for an entity type or a sub-set of properties from an entity type. + This configuration functionality is available via the Code First Fluent API, see . + + The entity type to be mapped. + + + + Configures the properties that will be included in this mapping fragment. + If this method is not called then all properties that have not yet been + included in a mapping fragment will be configured. + + An anonymous type including the properties to be mapped. + + A lambda expression to an anonymous type that contains the properties to be mapped. + C#: t => new { t.Id, t.Property1, t.Property2 } + VB.Net: Function(t) New With { p.Id, t.Property1, t.Property2 } + + + + + Re-maps all properties inherited from base types. + + When configuring a derived type to be mapped to a separate table this will cause all properties to + be included in the table rather than just the non-inherited properties. This is known as + Table per Concrete Type (TPC) mapping. + + + + + Configures the table name to be mapped to. + + Name of the table. + + + + Configures the table name and schema to be mapped to. + + Name of the table. + Schema of the table. + + + + Configures the discriminator column used to differentiate between types in an inheritance hierarchy. + + The name of the discriminator column. + A configuration object to further configure the discriminator column and values. + + + + Configures the discriminator condition used to differentiate between types in an inheritance hierarchy. + + The type of the property being used to discriminate between types. + + A lambda expression representing the property being used to discriminate between types. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object to further configure the discriminator condition. + + + + Moves a foreign key constraint from oldTable to newTable and updates column references + + + + + Move any FK constraints that are now completely in newTable and used to refer to oldColumn + + + + + Configures a condition used to discriminate between types in an inheritance hierarchy based on the values assigned to a property. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the condition to require a value in the property. + + Rows that do not have a value assigned to column that this property is stored in are + assumed to be of the base type of this entity type. + + + + + Populate the table mapping structure + + + + + Sets nullability for association set mappings' foreign keys for 1:* and 1:0..1 associations + when no base types share the the association set mapping's table + + + + + Makes sure only the required property mappings are present + + + + + Determines if the table and entity type need mapping, and if not, removes the existing entity type mapping + + + + + Configures a database column used to store a string values. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the column to allow the maximum length supported by the database provider. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + + Configures the column to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be variable length. + Columns are variable length by default. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be optional. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be required. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column. + + Name of the database provider specific data type. + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column. + + The order that this column should appear in the database table. + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to support Unicode string content. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the column supports Unicode string content. + + + Value indicating if the column supports Unicode string content or not. + Specifying 'null' will remove the Unicode facet from the column. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures a discriminator column used to differentiate between types in an inheritance hierarchy. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + Type of the discriminator value. + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + Type of the discriminator value. + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Initializes configurations in the ModelConfiguration so that configuration data + is in a single place + + + + + Configures a many relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be many:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:required with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:required without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:optional with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:optional without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures an optional relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be optional:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:required with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:required without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + + A lambda expression representing the navigation property on the other end of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + A configuration object that can be used to further configure the relationship. + + + + Configures an required relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be required:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:optional with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:optional without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required with a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required without a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required with a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required without a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + A configuration object that can be used to further configure the relationship. + + + + Base class for configuring a property on an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + True if the NavigationProperty's declaring type is the principal end, false if it is not, null if it is not known + + + + + Base class for performing configuration of a relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures a relationship that can support cascade on delete functionality. + + + + + Configures cascade delete to be on for the relationship. + + + + + Configures whether or not cascade delete is on for the relationship. + + Value indicating if cascade delete is on or not. + + + + Configures a relationship that can support foreign key properties that are exposed in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + The dependent entity type. + + + + Configures a relationship that can only support foreign key properties that are not exposed in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the relationship to use foreign key property(s) that are not exposed in the object model. + The column(s) and table can be customized by specifying a configuration action. + If an empty configuration action is specified then column name(s) will be generated by convention. + If foreign key properties are exposed in the object model then use the HasForeignKey method. + Not all relationships support exposing foreign key properties in the object model. + + Action that configures the foreign key column(s) and table. + + A configuration object that can be used to further configure the relationship. + + + + + Configures the relationship to use foreign key property(s) that are exposed in the object model. + If the foreign key property(s) are not exposed in the object model then use the Map method. + + The type of the key. + + A lambda expression representing the property to be used as the foreign key. + If the foreign key is made up of multiple properties then specify an anonymous type including the properties. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the principal entity type. + + A configuration object that can be used to further configure the relationship. + + + + Configures the table and column mapping of a relationship that does not expose foreign key properties in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the name of the column(s) for the foreign key. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table name that the foreign key column(s) reside in. + The table that is specified must already be mapped for the entity type. + + If you want the foreign key(s) to reside in their own table then use the Map method + on to perform + entity splitting to create the table with just the primary key property. Foreign keys can + then be added to the table via this method. + + Name of the table. + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table name and schema that the foreign key column(s) reside in. + The table that is specified must already be mapped for the entity type. + + If you want the foreign key(s) to reside in their own table then use the Map method + on to perform + entity splitting to create the table with just the primary key property. Foreign keys can + then be added to the table via this method. + + Name of the table. + Schema of the table. + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table and column mapping of a many:many relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the join table name for the relationship. + + Name of the table. + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the join table name and schema for the relationship. + + Name of the table. + Schema of the table. + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the column(s) for the left foreign key. + The left foreign key represents the navigation property specified in the HasMany call. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the column(s) for the right foreign key. + The right foreign key represents the navigation property specified in the WithMany call. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures a many:many relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the foreign key column(s) and table used to store the relationship. + + Action that configures the foreign key column(s) and table. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Used to configure a property with length facets for an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Used to configure a primitive property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to allow the maximum length supported by the database provider. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property and a default length will be used for the database column. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + Properties are variable length by default. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to allow the maximum length supported by the database provider. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + properties are variable length by default. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + properties are optional by default. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be a row version in the database. + The actual data type will vary depending on the database provider being used. + Setting the property to be a row version will automatically configure it to be an + optimistic concurrency token. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + properties are required by default. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the precision of the property. + If the database provider does not support precision for the data type of the column then the value is ignored. + + Precision of the property. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + properties are required by default. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the precision and scale of the property. + + The precision of the property. + The scale of the property. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to allow the maximum length supported by the database provider. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property and a default length will be used for the database column.. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + properties are variable length by default. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + properties are optional by default. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to support Unicode string content. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property supports Unicode string content. + + + Value indicating if the property supports Unicode string content or not. + Specifying 'null' will remove the Unicode facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Indicates what parts of a configuration are overridable. + + + + + Nothing in the configuration is overridable. + + + + + The configuration values related to C-Space are overridable. + + + + + The configuration values only related to S-Space are overridable. + + + + + True if this configuration can be replaced in the model configuration, false otherwise + This is only set to true for configurations that are registered automatically via the DbContext + + + + + Base class for conventions that process CLR attributes found in the model. + + The type of member to look for. + The type of the configuration to look for. + The type of the attribute to look for. + + + + Convention to process instances of found on properties in the model + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on foreign key properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on navigation properties in the model. + + + + + Convention to process instances of found on primitive properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to detect navigation properties to be inverses of each other when only one pair + of navigation properties exists between the related types. + + + + + Convention to configure a type as a complex type if it has no primary key, no mapped base type and no navigation properties. + + + + + Convention to convert any data types that were explicitly specified, via data annotations or API, + to be lower case. The default SqlClient provider is case sensitive and requires data types to be lower case. This convention + allows the and API to be case insensitive. + + + + + Convention to add a cascade delete to the join table from both tables involved in a many to many relationship. + + + + + Convention to ensure an invalid/unsupported mapping is not created when mapping inherited properties + + + + + Convention to set the table name to be a pluralized version of the entity type name. + + + + + Convention to set precision to 18 and scale to 2 for decimal properties. + + + + + Convention to move primary key properties to appear first. + + + + + Convention to distinguish between optional and required relationships based on CLR nullability of the foreign key property. + + + + + Convention to process instances of found on navigation properties in the model. + + + + + Convention to detect primary key properties. + Recognized naming patterns in order of precedence are: + 1. 'Id' + 2. [type name]Id + Primary key detection is case insensitive. + + + + + Convention to discover foreign key properties whose names are a combination + of the dependent navigation property name and the principal type primary key property name(s). + + + + + Convention to enable cascade delete for any required relationships. + + + + + Convention to configure the primary key(s) of the dependent entity type as foreign key(s) in a one:one relationship. + + + + + Convention to set the entity set name to be a pluralized version of the entity type name. + + + + + Convention to discover foreign key properties whose names match the principal type primary key property name(s). + + + + + Convention to set a default maximum length of 128 for properties whose type supports length facets. + + + + + Convention to set a default maximum length of 4000 for properties whose type supports length facets when SqlCe is the provider. + + + + + Convention to configure integer primary keys to be identity. + + + + + Checks for the PK property being an FK in a different table. A PK which is also an FK but + in the same table is used for table splitting and can still be an identity column because + the update pipeline is only inserting into one column of one table. + + + + + Convention to discover foreign key properties whose names are a combination + of the principal type name and the principal type primary key property name(s). + + + + + This class provide service for both the singularization and pluralization, it takes the word pairs + in the ctor following the rules that the first one is singular and the second one is plural. + + + + + Factory method for PluralizationService. Only support english pluralization. + Please set the PluralizationService on the System.Data.Entity.Design.EntityModelSchemaGenerator + to extend the service to other locales. + + CultureInfo + PluralizationService + + + + captalize the return word if the parameter is capitalized + if word is "Table", then return "Tables" + + + + + + + + separate one combine word in to two parts, prefix word and the last word(suffix word) + + + + + + + + return true when the word is "[\s]*" or leading or tailing with spaces + or contains non alphabetical characters + + + + + + + This method allow you to add word to internal PluralizationService of English. + If the singluar or the plural value was already added by this method, then an ArgumentException will be thrown. + + + + + + + Attempt to determine the principal and dependent ends of this association. + + The following table illustrates the solution space. + + Source | Target || Prin | Dep | + -------|--------||-------|-------| + 1 | 1 || - | - | + 1 | 0..1 || Sr | Ta | + 1 | * || Sr | Ta | + 0..1 | 1 || Ta | Sr | + 0..1 | 0..1 || - | - | + 0..1 | * || Sr | Ta | + * | 1 || Ta | Sr | + * | 0..1 || Ta | Sr | + * | * || - | - | + + + + + Allows configuration to be performed for an entity type in a model. + + An EntityTypeConfiguration can be obtained via the Entity method on + or a custom type derived from EntityTypeConfiguration + can be registered via the Configurations property on . + + + + + Initializes a new instance of EntityTypeConfiguration + + + + + Configures the primary key property(s) for this entity type. + + The type of the key. + + A lambda expression representing the property to be used as the primary key. + C#: t => t.Id + VB.Net: Function(t) t.Id + + If the primary key is made up of multiple properties then specify an anonymous type including the properties. + C#: t => new { t.Id1, t.Id2 } + VB.Net: Function(t) New With { t.Id1, t.Id2 } + + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures the entity set name to be used for this entity type. + The entity set name can only be configured for the base type in each set. + + The name of the entity set. + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures the table name that this entity type is mapped to. + + The name of the table. + + + + Configures the table name that this entity type is mapped to. + + The name of the table. + The database schema of the table. + + + + Allows advanced configuration related to how this entity type is mapped to the database schema. + By default, any configuration will also apply to any type derived from this entity type. + + Derived types can be configured via the overload of Map that configures a derived type or + by using an EntityTypeConfiguration for the derived type. + + The properties of an entity can be split between multiple tables using multiple Map calls. + + Calls to Map are additive, subsequent calls will not override configuration already preformed via Map. + + An action that performs configuration against an . + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Allows advanced configuration related to how a derived entity type is mapped to the database schema. + Calls to Map are additive, subsequent calls will not override configuration already preformed via Map. + + The derived entity type to be configured. + An action that performs configuration against an . + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures an optional relationship from this entity type. + Instances of the entity type will be able to be saved to the database without this relationship being specified. + The foreign key in the database will be nullable. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures a required relationship from this entity type. + Instances of the entity type will not be able to be saved to the database unless this relationship is specified. + The foreign key in the database will be non-nullable. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures a many relationship from this entity type. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Handles mapping from a CLR property to an EDM assocation and nav. prop. + + + + + Exception thrown by during model creation when an invalid model is generated. + + + + + Initializes a new instance of ModelValidationException + + + + + Initializes a new instance of ModelValidationException + + The exception message. + + + + Initializes a new instance of ModelValidationException + + The exception message. + The inner exception. + + + + Code Contracts hook methods - Called when contracts fail. Here we detect the most common preconditions + so we can throw the correct exceptions. It also means that we can write preconditions using the + simplest Contract.Requires() form. + + + + + Returns true if a variable of this type can be assigned a null value + + + + True if a reference type or a nullable value type, + false otherwise + + + + + Exception thrown from when validating entities fails. + + + + + Initializes a new instance of DbEntityValidationException + + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + Validation results. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + The inner exception. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + Validation results. + The inner exception. + + + + Subscribes the SerializeObjectState event. + + + + + Validation results. + + + + + Holds exception state that will be serialized when the exception is serialized. + + + + + Validation results. + + + + + Completes the deserialization. + + The deserialized object. + + + + Validation results. + + + + + Represents validation results for single entity. + + + + + Entity entry the results applies to. Never null. + + + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Creates an instance of class. + + + Entity entry the results applies to. Never null. + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Creates an instance of class. + + + Entity entry the results applies to. Never null. + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Gets an instance of the results applies to. + + + + + Gets validation errors. Never null. + + + + + Gets an indicator if the entity is valid. + + + + + Exception thrown from when an exception is thrown from the validation + code. + + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + The inner exception. + + + + Initializes a new instance of DbUnexpectedValidationException with the specified serialization info and + context. + + The serialization info. + The streaming context. + + + + Validation error. Can be either entity or property level validation error. + + + + + Name of the invalid property. Can be null (e.g. for entity level validations) + + + + + Validation error message. + + + + + Creates an instance of . + + Name of the invalid property. Can be null. + Validation error message. Can be null. + + + + Gets name of the invalid property. + + + + + Gets validation error message. + + + + diff --git a/Website/LOC.Website.Common/bin/Debug/LOC.Core.dll b/Website/LOC.Website.Common/bin/Debug/LOC.Core.dll new file mode 100644 index 000000000..84a13849c Binary files /dev/null and b/Website/LOC.Website.Common/bin/Debug/LOC.Core.dll differ diff --git a/Website/LOC.Website.Common/bin/Debug/LOC.Core.pdb b/Website/LOC.Website.Common/bin/Debug/LOC.Core.pdb new file mode 100644 index 000000000..b5418e84e Binary files /dev/null and b/Website/LOC.Website.Common/bin/Debug/LOC.Core.pdb differ diff --git a/Website/LOC.Website.Common/bin/Debug/LOC.Website.Common.dll b/Website/LOC.Website.Common/bin/Debug/LOC.Website.Common.dll new file mode 100644 index 000000000..b9484e327 Binary files /dev/null and b/Website/LOC.Website.Common/bin/Debug/LOC.Website.Common.dll differ diff --git a/Website/LOC.Website.Common/bin/Debug/LOC.Website.Common.dll.config b/Website/LOC.Website.Common/bin/Debug/LOC.Website.Common.dll.config new file mode 100644 index 000000000..30a36561f --- /dev/null +++ b/Website/LOC.Website.Common/bin/Debug/LOC.Website.Common.dll.config @@ -0,0 +1,17 @@ + + + + +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/Website/LOC.Website.Common/bin/Debug/LOC.Website.Common.pdb b/Website/LOC.Website.Common/bin/Debug/LOC.Website.Common.pdb new file mode 100644 index 000000000..35277edd3 Binary files /dev/null and b/Website/LOC.Website.Common/bin/Debug/LOC.Website.Common.pdb differ diff --git a/Website/LOC.Website.Common/bin/Debug/LinqKit.dll b/Website/LOC.Website.Common/bin/Debug/LinqKit.dll new file mode 100644 index 000000000..c802265ad Binary files /dev/null and b/Website/LOC.Website.Common/bin/Debug/LinqKit.dll differ diff --git a/Website/LOC.Website.Common/bin/Debug/Newtonsoft.Json.dll b/Website/LOC.Website.Common/bin/Debug/Newtonsoft.Json.dll new file mode 100644 index 000000000..dc9283f4c Binary files /dev/null and b/Website/LOC.Website.Common/bin/Debug/Newtonsoft.Json.dll differ diff --git a/Website/LOC.Website.Common/bin/Debug/Newtonsoft.Json.xml b/Website/LOC.Website.Common/bin/Debug/Newtonsoft.Json.xml new file mode 100644 index 000000000..ee891563c --- /dev/null +++ b/Website/LOC.Website.Common/bin/Debug/Newtonsoft.Json.xml @@ -0,0 +1,7343 @@ + + + + Newtonsoft.Json + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class with the specified . + + + + + Reads the next JSON token from the stream. + + true if the next token was read successfully; false if there are no more tokens to read. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Skips the children of the current token. + + + + + Sets the current token. + + The new token. + + + + Sets the current token and value. + + The new token. + The value. + + + + Sets the state based on current token type. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Releases unmanaged and - optionally - managed resources + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Changes the to Closed. + + + + + Gets the current reader state. + + The current reader state. + + + + Gets or sets a value indicating whether the underlying stream or + should be closed when the reader is closed. + + + true to close the underlying stream or when + the reader is closed; otherwise false. The default is true. + + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + Get or set how time zones are handling when reading JSON. + + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Gets the type of the current JSON token. + + + + + Gets the text value of the current JSON token. + + + + + Gets The Common Language Runtime (CLR) type for the current JSON token. + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Gets the path of the current JSON token. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Specifies the state of the reader. + + + + + The Read method has not been called. + + + + + The end of the file has been reached successfully. + + + + + Reader is at a property. + + + + + Reader is at the start of an object. + + + + + Reader is in an object. + + + + + Reader is at the start of an array. + + + + + Reader is in an array. + + + + + The Close method has been called. + + + + + Reader has just read a value. + + + + + Reader is at the start of a constructor. + + + + + Reader in a constructor. + + + + + An error occurred that prevents the read operation from continuing. + + + + + The end of the file has been reached successfully. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The reader. + + + + Initializes a new instance of the class. + + The stream. + if set to true the root object will be read as a JSON array. + The used when reading values from BSON. + + + + Initializes a new instance of the class. + + The reader. + if set to true the root object will be read as a JSON array. + The used when reading values from BSON. + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + + A . This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Changes the to Closed. + + + + + Gets or sets a value indicating whether binary data reading should compatible with incorrect Json.NET 3.5 written binary. + + + true if binary data reading will be compatible with incorrect Json.NET 3.5 written binary; otherwise, false. + + + + + Gets or sets a value indicating whether the root object will be read as a JSON array. + + + true if the root object will be read as a JSON array; otherwise, false. + + + + + Gets or sets the used when reading values from BSON. + + The used when reading values from BSON. + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Creates an instance of the JsonWriter class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the end of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the end of an array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end constructor. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes the end of the current Json object or array. + + + + + Writes the current token. + + The to read the token from. + + + + Writes the specified end token. + + The end token to write. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON without changing the writer's state. + + The raw JSON to write. + + + + Writes raw JSON where a value is expected and updates the writer's state. + + The raw JSON to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + An error will raised if the value cannot be written as a single JSON token. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Gets or sets a value indicating whether the underlying stream or + should be closed when the writer is closed. + + + true to close the underlying stream or when + the writer is closed; otherwise false. The default is true. + + + + + Gets the top. + + The top. + + + + Gets the state of the writer. + + + + + Gets the path of the writer. + + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling when writing JSON. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The writer. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Writes the end. + + The token. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes raw JSON where a value is expected and updates the writer's state. + + The raw JSON to write. + + + + Writes the beginning of a Json array. + + + + + Writes the beginning of a Json object. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Closes this stream and the underlying stream. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value that represents a BSON object id. + + + + + + Writes a BSON regex. + + The regex pattern. + The regex options. + + + + Gets or sets the used when writing values to BSON. + When set to no conversion will occur. + + The used when writing values to BSON. + + + + Represents a BSON Oid (object id). + + + + + Initializes a new instance of the class. + + The Oid value. + + + + Gets or sets the value of the Oid. + + The value of the Oid. + + + + Converts a binary value to and from a base 64 string value. + + + + + Converts an object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets the of the JSON produced by the JsonConverter. + + The of the JSON produced by the JsonConverter. + + + + Gets a value indicating whether this can read JSON. + + true if this can read JSON; otherwise, false. + + + + Gets a value indicating whether this can write JSON. + + true if this can write JSON; otherwise, false. + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Create a custom object + + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Creates an object which will then be populated by the serializer. + + Type of the object. + + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets a value indicating whether this can write JSON. + + + true if this can write JSON; otherwise, false. + + + + + Provides a base class for converting a to and from JSON. + + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an Entity Framework EntityKey to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an ExpandoObject to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets a value indicating whether this can write JSON. + + + true if this can write JSON; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON and BSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON and BSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an to and from its name string value. + + + Converts an to and from its name string value. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + A cached representation of the Enum string representation to respect per Enum field name. + + The type of the Enum. + A map of enum field name to either the field name, or the configured enum member name (). + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets or sets a value indicating whether the written enum text should be camel case. + + true if the written enum text will be camel case; otherwise, false. + + + + Specifies how constructors are used when initializing objects during deserialization by the . + + + + + First attempt to use the public default constructor, then fall back to single paramatized constructor, then the non-public default constructor. + + + + + Json.NET will use a non-public default constructor before falling back to a paramatized constructor. + + + + + Converts a to and from a string (e.g. "1.2.3.4"). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing property value of the JSON that is being converted. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Specifies how dates are formatted when writing JSON text. + + + + + Dates are written in the ISO 8601 format, e.g. "2012-03-21T05:40Z". + + + + + Dates are written in the Microsoft JSON format, e.g. "\/Date(1198908717056)\/". + + + + + Specifies how to treat the time value when converting between string and . + + + + + Treat as local time. If the object represents a Coordinated Universal Time (UTC), it is converted to the local time. + + + + + Treat as a UTC. If the object represents a local time, it is converted to a UTC. + + + + + Treat as a local time if a is being converted to a string. + If a string is being converted to , convert to a local time if a time zone is specified. + + + + + Time zone information should be preserved when converting. + + + + + Specifies formatting options for the . + + + + + No special formatting is applied. This is the default. + + + + + Causes child objects to be indented according to the and settings. + + + + + Instructs the to use the specified constructor when deserializing that object. + + + + + Represents a raw JSON string. + + + + + Represents a value in JSON (string, integer, date, etc). + + + + + Represents an abstract JSON token. + + + + + Represents a collection of objects. + + The type of token + + + + Gets the with the specified key. + + + + + + Provides an interface to enable a class to return line and position information. + + + + + Gets a value indicating whether the class can return line information. + + + true if LineNumber and LinePosition can be provided; otherwise, false. + + + + + Gets the current line number. + + The current line number or 0 if no line information is available (for example, HasLineInfo returns false). + + + + Gets the current line position. + + The current line position or 0 if no line information is available (for example, HasLineInfo returns false). + + + + Compares the values of two tokens, including the values of all descendant tokens. + + The first to compare. + The second to compare. + true if the tokens are equal; otherwise false. + + + + Adds the specified content immediately after this token. + + A content object that contains simple content or a collection of content objects to be added after this token. + + + + Adds the specified content immediately before this token. + + A content object that contains simple content or a collection of content objects to be added before this token. + + + + Returns a collection of the ancestor tokens of this token. + + A collection of the ancestor tokens of this token. + + + + Returns a collection of the sibling tokens after this token, in document order. + + A collection of the sibling tokens after this tokens, in document order. + + + + Returns a collection of the sibling tokens before this token, in document order. + + A collection of the sibling tokens before this token, in document order. + + + + Gets the with the specified key converted to the specified type. + + The type to convert the token to. + The token key. + The converted token value. + + + + Returns a collection of the child tokens of this token, in document order. + + An of containing the child tokens of this , in document order. + + + + Returns a collection of the child tokens of this token, in document order, filtered by the specified type. + + The type to filter the child tokens on. + A containing the child tokens of this , in document order. + + + + Returns a collection of the child values of this token, in document order. + + The type to convert the values to. + A containing the child values of this , in document order. + + + + Removes this token from its parent. + + + + + Replaces this token with the specified token. + + The value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Returns the indented JSON for this token. + + + The indented JSON for this token. + + + + + Returns the JSON for this token using the given formatting and converters. + + Indicates how the output is formatted. + A collection of which will be used when writing the token. + The JSON for this token using the given formatting and converters. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Creates an for this token. + + An that can be used to read this token and its descendants. + + + + Creates a from an object. + + The object that will be used to create . + A with the value of the specified object + + + + Creates a from an object using the specified . + + The object that will be used to create . + The that will be used when reading the object. + A with the value of the specified object + + + + Creates the specified .NET type from the . + + The new object created from the JSON value. + + + + Creates the specified .NET type from the using the specified . + + The that will be used when creating the object. + The new object created from the JSON value. + + + + Creates a from a . + + An positioned at the token to read into this . + + An that contains the token and its descendant tokens + that were read from the reader. The runtime type of the token is determined + by the token type of the first token encountered in the reader. + + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from a . + + An positioned at the token to read into this . + + An that contains the token and its descendant tokens + that were read from the reader. The runtime type of the token is determined + by the token type of the first token encountered in the reader. + + + + + Selects the token that matches the object path. + + + The object path from the current to the + to be returned. This must be a string of property names or array indexes separated + by periods, such as Tables[0].DefaultView[0].Price in C# or + Tables(0).DefaultView(0).Price in Visual Basic. + + The that matches the object path or a null reference if no matching token is found. + + + + Selects the token that matches the object path. + + + The object path from the current to the + to be returned. This must be a string of property names or array indexes separated + by periods, such as Tables[0].DefaultView[0].Price in C# or + Tables(0).DefaultView(0).Price in Visual Basic. + + A flag to indicate whether an error should be thrown if no token is found. + The that matches the object path. + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Creates a new instance of the . All child tokens are recursively cloned. + + A new instance of the . + + + + Gets a comparer that can compare two tokens for value equality. + + A that can compare two nodes for value equality. + + + + Gets or sets the parent. + + The parent. + + + + Gets the root of this . + + The root of this . + + + + Gets the node type for this . + + The type. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Gets the next sibling token of this node. + + The that contains the next sibling token. + + + + Gets the previous sibling token of this node. + + The that contains the previous sibling token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Get the first child token of this token. + + A containing the first child token of the . + + + + Get the last child token of this token. + + A containing the last child token of the . + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Creates a comment with the given value. + + The value. + A comment with the given value. + + + + Creates a string with the given value. + + The value. + A string with the given value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Indicates whether the current object is equal to another object of the same type. + + + true if the current object is equal to the parameter; otherwise, false. + + An object to compare with this object. + + + + Determines whether the specified is equal to the current . + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + + The parameter is null. + + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format. + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format provider. + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format. + The format provider. + + A that represents this instance. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. + + An object to compare with this instance. + + A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: + Value + Meaning + Less than zero + This instance is less than . + Zero + This instance is equal to . + Greater than zero + This instance is greater than . + + + is not the same type as this instance. + + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Gets the node type for this . + + The type. + + + + Gets or sets the underlying token value. + + The underlying token value. + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class. + + The raw json. + + + + Creates an instance of with the content of the reader's current token. + + The reader. + An instance of with the content of the reader's current token. + + + + Indicating whether a property is required. + + + + + The property is not required. The default state. + + + + + The property must be defined in JSON but can be a null value. + + + + + The property must be defined in JSON and cannot be a null value. + + + + + Contract details for a used by the . + + + + + Contract details for a used by the . + + + + + Gets the underlying type for the contract. + + The underlying type for the contract. + + + + Gets or sets the type created during deserialization. + + The type created during deserialization. + + + + Gets or sets whether this type contract is serialized as a reference. + + Whether this type contract is serialized as a reference. + + + + Gets or sets the default for this contract. + + The converter. + + + + Gets or sets the method called immediately after deserialization of the object. + + The method called immediately after deserialization of the object. + + + + Gets or sets the method called during deserialization of the object. + + The method called during deserialization of the object. + + + + Gets or sets the method called after serialization of the object graph. + + The method called after serialization of the object graph. + + + + Gets or sets the method called before serialization of the object. + + The method called before serialization of the object. + + + + Gets or sets the default creator method used to create the object. + + The default creator method used to create the object. + + + + Gets or sets a value indicating whether the default creator is non public. + + true if the default object creator is non-public; otherwise, false. + + + + Gets or sets the method called when an error is thrown during the serialization of the object. + + The method called when an error is thrown during the serialization of the object. + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets the object's properties. + + The object's properties. + + + + Gets or sets the property name resolver. + + The property name resolver. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the ISerializable object constructor. + + The ISerializable object constructor. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Get and set values for a using dynamic methods. + + + + + Provides methods to get and set values. + + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + Initializes a new instance of the class. + + The member info. + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + Provides data for the Error event. + + + + + Initializes a new instance of the class. + + The current object. + The error context. + + + + Gets the current object the error event is being raised against. + + The current object the error event is being raised against. + + + + Gets the error context. + + The error context. + + + + Represents a view of a . + + + + + Initializes a new instance of the class. + + The name. + Type of the property. + + + + When overridden in a derived class, returns whether resetting an object changes its value. + + + true if resetting the component changes its value; otherwise, false. + + The component to test for reset capability. + + + + + When overridden in a derived class, gets the current value of the property on a component. + + + The value of a property for a given component. + + The component with the property for which to retrieve the value. + + + + + When overridden in a derived class, resets the value for this property of the component to the default value. + + The component with the property value that is to be reset to the default value. + + + + + When overridden in a derived class, sets the value of the component to a different value. + + The component with the property value that is to be set. + The new value. + + + + + When overridden in a derived class, determines a value indicating whether the value of this property needs to be persisted. + + + true if the property should be persisted; otherwise, false. + + The component with the property to be examined for persistence. + + + + + When overridden in a derived class, gets the type of the component this property is bound to. + + + A that represents the type of component this property is bound to. When the or methods are invoked, the object specified might be an instance of this type. + + + + + When overridden in a derived class, gets a value indicating whether this property is read-only. + + + true if the property is read-only; otherwise, false. + + + + + When overridden in a derived class, gets the type of the property. + + + A that represents the type of the property. + + + + + Gets the hash code for the name of the member. + + + + The hash code for the name of the member. + + + + + Used to resolve references when serializing and deserializing JSON by the . + + + + + Resolves a reference to its object. + + The serialization context. + The reference to resolve. + The object that + + + + Gets the reference for the sepecified object. + + The serialization context. + The object to get a reference for. + The reference to the object. + + + + Determines whether the specified object is referenced. + + The serialization context. + The object to test for a reference. + + true if the specified object is referenced; otherwise, false. + + + + + Adds a reference to the specified object. + + The serialization context. + The reference. + The object to reference. + + + + Specifies reference handling options for the . + + + + + Do not preserve references when serializing types. + + + + + Preserve references when serializing into a JSON object structure. + + + + + Preserve references when serializing into a JSON array structure. + + + + + Preserve references when serializing. + + + + + Instructs the how to serialize the collection. + + + + + Instructs the how to serialize the object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets the id. + + The id. + + + + Gets or sets the title. + + The title. + + + + Gets or sets the description. + + The description. + + + + Gets or sets a value that indicates whether to preserve object reference data. + + + true to keep object reference; otherwise, false. The default is false. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a flag indicating whether the array can contain null items + + A flag indicating whether the array can contain null items. + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets a value indicating whether null items are allowed in the collection. + + true if null items are allowed in the collection; otherwise, false. + + + + Specifies default value handling options for the . + + + + + Include members where the member value is the same as the member's default value when serializing objects. + Included members are written to JSON. Has no effect when deserializing. + + + + + Ignore members where the member value is the same as the member's default value when serializing objects + so that is is not written to JSON, and ignores setting members when the JSON value equals the member's default value. + + + + + Members with a default value but no JSON will be set to their default value when deserializing. + + + + + Ignore members where the member value is the same as the member's default value when serializing objects + and sets members to their default value when deserializing. + + + + + Instructs the to use the specified when serializing the member or class. + + + + + Initializes a new instance of the class. + + Type of the converter. + + + + Gets the type of the converter. + + The type of the converter. + + + + Instructs the how to serialize the object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified member serialization. + + The member serialization. + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets the member serialization. + + The member serialization. + + + + Specifies the settings on a object. + + + + + Initializes a new instance of the class. + + + + + Gets or sets how reference loops (e.g. a class referencing itself) is handled. + + Reference loop handling. + + + + Gets or sets how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + Missing member handling. + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets or sets how null values are handled during serialization and deserialization. + + Null value handling. + + + + Gets or sets how null default are handled during serialization and deserialization. + + The default value handling. + + + + Gets or sets a collection that will be used during serialization. + + The converters. + + + + Gets or sets how object references are preserved by the serializer. + + The preserve references handling. + + + + Gets or sets how type name writing and reading is handled by the serializer. + + The type name handling. + + + + Gets or sets how a type name assembly is written and resolved by the serializer. + + The type name assembly format. + + + + Gets or sets how constructors are used during deserialization. + + The constructor handling. + + + + Gets or sets the contract resolver used by the serializer when + serializing .NET objects to JSON and vice versa. + + The contract resolver. + + + + Gets or sets the used by the serializer when resolving references. + + The reference resolver. + + + + Gets or sets the used by the serializer when resolving type names. + + The binder. + + + + Gets or sets the error handler called during serialization and deserialization. + + The error handler called during serialization and deserialization. + + + + Gets or sets the used by the serializer when invoking serialization callback methods. + + The context. + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling during serialization and deserialization. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Represents a reader that provides validation. + + + + + Initializes a new instance of the class that + validates the content returned from the given . + + The to read from while validating. + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. + + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Sets an event handler for receiving schema validation errors. + + + + + Gets the text value of the current Json token. + + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Gets the path of the current JSON token. + + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + + Gets the type of the current Json token. + + + + + + Gets the Common Language Runtime (CLR) type for the current Json token. + + + + + + Gets or sets the schema. + + The schema. + + + + Gets the used to construct this . + + The specified in the constructor. + + + + Compares tokens to determine whether they are equal. + + + + + Determines whether the specified objects are equal. + + The first object of type to compare. + The second object of type to compare. + + true if the specified objects are equal; otherwise, false. + + + + + Returns a hash code for the specified object. + + The for which a hash code is to be returned. + A hash code for the specified object. + The type of is a reference type and is null. + + + + Specifies the member serialization options for the . + + + + + All public members are serialized by default. Members can be excluded using or . + This is the default member serialization mode. + + + + + Only members must be marked with or are serialized. + This member serialization mode can also be set by marking the class with . + + + + + All public and private fields are serialized. Members can be excluded using or . + This member serialization mode can also be set by marking the class with . + + + + + Specifies how object creation is handled by the . + + + + + Reuse existing objects, create new objects when needed. + + + + + Only reuse existing objects. + + + + + Always create new objects. + + + + + Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Gets or sets the date time styles used when converting a date to and from JSON. + + The date time styles used when converting a date to and from JSON. + + + + Gets or sets the date time format used when converting a date to and from JSON. + + The date time format used when converting a date to and from JSON. + + + + Gets or sets the culture used when converting a date to and from JSON. + + The culture used when converting a date to and from JSON. + + + + Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing property value of the JSON that is being converted. + The calling serializer. + The object value. + + + + Converts XML to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The calling serializer. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Checks if the attributeName is a namespace attribute. + + Attribute name to test. + The attribute name prefix if it has one, otherwise an empty string. + True if attribute name is for a namespace attribute, otherwise false. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Gets or sets the name of the root element to insert when deserializing to XML if the JSON structure has produces multiple root elements. + + The name of the deserialize root element. + + + + Gets or sets a flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + true if the array attibute is written to the XML; otherwise, false. + + + + Gets or sets a value indicating whether to write the root JSON object. + + true if the JSON root object is omitted; otherwise, false. + + + + Represents a reader that provides fast, non-cached, forward-only access to JSON text data. + + + + + Initializes a new instance of the class with the specified . + + The TextReader containing the XML data to read. + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Changes the state to closed. + + + + + Gets a value indicating whether the class can return line information. + + + true if LineNumber and LinePosition can be provided; otherwise, false. + + + + + Gets the current line number. + + + The current line number or 0 if no line information is available (for example, HasLineInfo returns false). + + + + + Gets the current line position. + + + The current line position or 0 if no line information is available (for example, HasLineInfo returns false). + + + + + Instructs the to always serialize the member with the specified name. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified name. + + Name of the property. + + + + Gets or sets the null value handling used when serializing this property. + + The null value handling. + + + + Gets or sets the default value handling used when serializing this property. + + The default value handling. + + + + Gets or sets the reference loop handling used when serializing this property. + + The reference loop handling. + + + + Gets or sets the object creation handling used when deserializing this property. + + The object creation handling. + + + + Gets or sets the type name handling used when serializing this property. + + The type name handling. + + + + Gets or sets whether this property's value is serialized as a reference. + + Whether this property's value is serialized as a reference. + + + + Gets or sets the order of serialization and deserialization of a member. + + The numeric order of serialization or deserialization. + + + + Gets or sets the name of the property. + + The name of the property. + + + + Gets or sets a value indicating whether this property is required. + + + A value indicating whether this property is required. + + + + + Instructs the not to serialize the public field or public read/write property value. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Creates an instance of the JsonWriter class using the specified . + + The TextWriter to write to. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the specified end token. + + The end token to write. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + + + + + Gets or sets which character to use to quote attribute values. + + + + + Gets or sets which character to use for indenting when is set to Formatting.Indented. + + + + + Gets or sets a value indicating whether object names will be surrounded with quotes. + + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Gets the line number indicating where the error occurred. + + The line number indicating where the error occurred. + + + + Gets the line position indicating where the error occurred. + + The line position indicating where the error occurred. + + + + Gets the path to the JSON where the error occurred. + + The path to the JSON where the error occurred. + + + + Represents a collection of . + + + + + Provides methods for converting between common language runtime types and JSON types. + + + + + Represents JavaScript's boolean value true as a string. This field is read-only. + + + + + Represents JavaScript's boolean value false as a string. This field is read-only. + + + + + Represents JavaScript's null as a string. This field is read-only. + + + + + Represents JavaScript's undefined as a string. This field is read-only. + + + + + Represents JavaScript's positive infinity as a string. This field is read-only. + + + + + Represents JavaScript's negative infinity as a string. This field is read-only. + + + + + Represents JavaScript's NaN as a string. This field is read-only. + + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation using the specified. + + The value to convert. + The format the date will be converted to. + The time zone handling when the date is converted to a string. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation using the specified. + + The value to convert. + The format the date will be converted to. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + The string delimiter character. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Serializes the specified object to a JSON string. + + The object to serialize. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string. + + The object to serialize. + Indicates how the output is formatted. + + A JSON string representation of the object. + + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A JSON string representation of the object. + + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Deserializes the JSON to a .NET object. + + The JSON to deserialize. + The deserialized object from the Json string. + + + + Deserializes the JSON to a .NET object. + + The JSON to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The of object being deserialized. + The deserialized object from the Json string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + The deserialized object from the Json string. + + + + Deserializes the JSON to the given anonymous type. + + + The anonymous type to deserialize to. This can't be specified + traditionally and must be infered from the anonymous type passed + as a parameter. + + The JSON to deserialize. + The anonymous type object. + The deserialized anonymous type from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The object to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize to. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize to. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + + + Populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + + + Asynchronously populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous populate operation. + + + + + Serializes the XML node to a JSON string. + + The node to serialize. + A JSON string of the XmlNode. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + A JSON string of the XmlNode. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + Omits writing the root object. + A JSON string of the XmlNode. + + + + Deserializes the XmlNode from a JSON string. + + The JSON string. + The deserialized XmlNode + + + + Deserializes the XmlNode from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + The deserialized XmlNode + + + + Deserializes the XmlNode from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + + A flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + The deserialized XmlNode + + + + Serializes the to a JSON string. + + The node to convert to JSON. + A JSON string of the XNode. + + + + Serializes the to a JSON string. + + The node to convert to JSON. + Indicates how the output is formatted. + A JSON string of the XNode. + + + + Serializes the to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + Omits writing the root object. + A JSON string of the XNode. + + + + Deserializes the from a JSON string. + + The JSON string. + The deserialized XNode + + + + Deserializes the from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + The deserialized XNode + + + + Deserializes the from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + + A flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + The deserialized XNode + + + + The exception thrown when an error occurs during Json serialization or deserialization. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Serializes and deserializes objects into and from the JSON format. + The enables you to control how objects are encoded into JSON. + + + + + Initializes a new instance of the class. + + + + + Creates a new instance using the specified . + + The settings to be applied to the . + A new instance using the specified . + + + + Populates the JSON values onto the target object. + + The that contains the JSON structure to reader values from. + The target object to populate values onto. + + + + Populates the JSON values onto the target object. + + The that contains the JSON structure to reader values from. + The target object to populate values onto. + + + + Deserializes the Json structure contained by the specified . + + The that contains the JSON structure to deserialize. + The being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The type of the object to deserialize. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Occurs when the errors during serialization and deserialization. + + + + + Gets or sets the used by the serializer when resolving references. + + + + + Gets or sets the used by the serializer when resolving type names. + + + + + Gets or sets how type name writing and reading is handled by the serializer. + + + + + Gets or sets how a type name assembly is written and resolved by the serializer. + + The type name assembly format. + + + + Gets or sets how object references are preserved by the serializer. + + + + + Get or set how reference loops (e.g. a class referencing itself) is handled. + + + + + Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + + + + Get or set how null values are handled during serialization and deserialization. + + + + + Get or set how null default are handled during serialization and deserialization. + + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets or sets how constructors are used during deserialization. + + The constructor handling. + + + + Gets a collection that will be used during serialization. + + Collection that will be used during serialization. + + + + Gets or sets the contract resolver used by the serializer when + serializing .NET objects to JSON and vice versa. + + + + + Gets or sets the used by the serializer when invoking serialization callback methods. + + The context. + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling during serialization and deserialization. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Contains the LINQ to JSON extension methods. + + + + + Returns a collection of tokens that contains the ancestors of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the ancestors of every node in the source collection. + + + + Returns a collection of tokens that contains the descendants of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the descendants of every node in the source collection. + + + + Returns a collection of child properties of every object in the source collection. + + An of that contains the source collection. + An of that contains the properties of every object in the source collection. + + + + Returns a collection of child values of every object in the source collection with the given key. + + An of that contains the source collection. + The token key. + An of that contains the values of every node in the source collection with the given key. + + + + Returns a collection of child values of every object in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child values of every object in the source collection with the given key. + + The type to convert the values to. + An of that contains the source collection. + The token key. + An that contains the converted values of every node in the source collection with the given key. + + + + Returns a collection of converted child values of every object in the source collection. + + The type to convert the values to. + An of that contains the source collection. + An that contains the converted values of every node in the source collection. + + + + Converts the value. + + The type to convert the value to. + A cast as a of . + A converted value. + + + + Converts the value. + + The source collection type. + The type to convert the value to. + A cast as a of . + A converted value. + + + + Returns a collection of child tokens of every array in the source collection. + + The source collection type. + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child tokens of every array in the source collection. + + An of that contains the source collection. + The type to convert the values to. + The source collection type. + An that contains the converted values of every node in the source collection. + + + + Returns the input typed as . + + An of that contains the source collection. + The input typed as . + + + + Returns the input typed as . + + The source collection type. + An of that contains the source collection. + The input typed as . + + + + Represents a JSON constructor. + + + + + Represents a token that can contain other tokens. + + + + + Raises the event. + + The instance containing the event data. + + + + Raises the event. + + The instance containing the event data. + + + + Raises the event. + + The instance containing the event data. + + + + Returns a collection of the child tokens of this token, in document order. + + + An of containing the child tokens of this , in document order. + + + + + Returns a collection of the child values of this token, in document order. + + The type to convert the values to. + + A containing the child values of this , in document order. + + + + + Returns a collection of the descendant tokens for this token in document order. + + An containing the descendant tokens of the . + + + + Adds the specified content as children of this . + + The content to be added. + + + + Adds the specified content as the first children of this . + + The content to be added. + + + + Creates an that can be used to add tokens to the . + + An that is ready to have content written to it. + + + + Replaces the children nodes of this token with the specified content. + + The content. + + + + Removes the child nodes from this token. + + + + + Occurs when the list changes or an item in the list changes. + + + + + Occurs before an item is added to the collection. + + + + + Occurs when the items list of the collection has changed, or the collection is reset. + + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Get the first child token of this token. + + + A containing the first child token of the . + + + + + Get the last child token of this token. + + + A containing the last child token of the . + + + + + Gets the count of child JSON tokens. + + The count of child JSON tokens + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name. + + The constructor name. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets or sets the name of this constructor. + + The constructor name. + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a collection of objects. + + The type of token + + + + An empty collection of objects. + + + + + Initializes a new instance of the struct. + + The enumerable. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + + + + Determines whether the specified is equal to this instance. + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the with the specified key. + + + + + + Represents a JSON object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Gets an of this object's properties. + + An of this object's properties. + + + + Gets a the specified name. + + The property name. + A with the specified name or null. + + + + Gets an of this object's property values. + + An of this object's property values. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Creates a from an object. + + The object that will be used to create . + The that will be used to read the object. + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Adds the specified property name. + + Name of the property. + The value. + + + + Removes the property with the specified name. + + Name of the property. + true if item was successfully removed; otherwise, false. + + + + Tries the get value. + + Name of the property. + The value. + true if a value was successfully retrieved; otherwise, false. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Raises the event with the provided arguments. + + Name of the property. + + + + Raises the event with the provided arguments. + + Name of the property. + + + + Returns the properties for this instance of a component. + + + A that represents the properties for this component instance. + + + + + Returns the properties for this instance of a component using the attribute array as a filter. + + An array of type that is used as a filter. + + A that represents the filtered properties for this component instance. + + + + + Returns a collection of custom attributes for this instance of a component. + + + An containing the attributes for this object. + + + + + Returns the class name of this instance of a component. + + + The class name of the object, or null if the class does not have a name. + + + + + Returns the name of this instance of a component. + + + The name of the object, or null if the object does not have a name. + + + + + Returns a type converter for this instance of a component. + + + A that is the converter for this object, or null if there is no for this object. + + + + + Returns the default event for this instance of a component. + + + An that represents the default event for this object, or null if this object does not have events. + + + + + Returns the default property for this instance of a component. + + + A that represents the default property for this object, or null if this object does not have properties. + + + + + Returns an editor of the specified type for this instance of a component. + + A that represents the editor for this object. + + An of the specified type that is the editor for this object, or null if the editor cannot be found. + + + + + Returns the events for this instance of a component using the specified attribute array as a filter. + + An array of type that is used as a filter. + + An that represents the filtered events for this component instance. + + + + + Returns the events for this instance of a component. + + + An that represents the events for this component instance. + + + + + Returns an object that contains the property described by the specified property descriptor. + + A that represents the property whose owner is to be found. + + An that represents the owner of the specified property. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Occurs when a property value changes. + + + + + Occurs when a property value is changing. + + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets or sets the with the specified property name. + + + + + + Represents a JSON array. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Creates a from an object. + + The object that will be used to create . + The that will be used to read the object. + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Determines the index of a specific item in the . + + The object to locate in the . + + The index of if found in the list; otherwise, -1. + + + + + Inserts an item to the at the specified index. + + The zero-based index at which should be inserted. + The object to insert into the . + + is not a valid index in the . + The is read-only. + + + + Removes the item at the specified index. + + The zero-based index of the item to remove. + + is not a valid index in the . + The is read-only. + + + + Adds an item to the . + + The object to add to the . + The is read-only. + + + + Removes all items from the . + + The is read-only. + + + + Determines whether the contains a specific value. + + The object to locate in the . + + true if is found in the ; otherwise, false. + + + + + Removes the first occurrence of a specific object from the . + + The object to remove from the . + + true if was successfully removed from the ; otherwise, false. This method also returns false if is not found in the original . + + The is read-only. + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets or sets the at the specified index. + + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class. + + The token to read from. + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Initializes a new instance of the class writing to the given . + + The container being written to. + + + + Initializes a new instance of the class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end. + + The token. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Gets the token being writen. + + The token being writen. + + + + Represents a JSON property. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class. + + The property name. + The property content. + + + + Initializes a new instance of the class. + + The property name. + The property content. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets the property name. + + The property name. + + + + Gets or sets the property value. + + The property value. + + + + Gets the node type for this . + + The type. + + + + Specifies the type of token. + + + + + No token type has been set. + + + + + A JSON object. + + + + + A JSON array. + + + + + A JSON constructor. + + + + + A JSON object property. + + + + + A comment. + + + + + An integer value. + + + + + A float value. + + + + + A string value. + + + + + A boolean value. + + + + + A null value. + + + + + An undefined value. + + + + + A date value. + + + + + A raw JSON value. + + + + + A collection of bytes value. + + + + + A Guid value. + + + + + A Uri value. + + + + + A TimeSpan value. + + + + + Contains the JSON schema extension methods. + + + + + Determines whether the is valid. + + The source to test. + The schema to test with. + + true if the specified is valid; otherwise, false. + + + + + Determines whether the is valid. + + The source to test. + The schema to test with. + When this method returns, contains any error messages generated while validating. + + true if the specified is valid; otherwise, false. + + + + + Validates the specified . + + The source to test. + The schema to test with. + + + + Validates the specified . + + The source to test. + The schema to test with. + The validation event handler. + + + + Returns detailed information about the schema exception. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Gets the line number indicating where the error occurred. + + The line number indicating where the error occurred. + + + + Gets the line position indicating where the error occurred. + + The line position indicating where the error occurred. + + + + Gets the path to the JSON where the error occurred. + + The path to the JSON where the error occurred. + + + + Resolves from an id. + + + + + Initializes a new instance of the class. + + + + + Gets a for the specified id. + + The id. + A for the specified id. + + + + Gets or sets the loaded schemas. + + The loaded schemas. + + + + Specifies undefined schema Id handling options for the . + + + + + Do not infer a schema Id. + + + + + Use the .NET type name as the schema Id. + + + + + Use the assembly qualified .NET type name as the schema Id. + + + + + Returns detailed information related to the . + + + + + Gets the associated with the validation error. + + The JsonSchemaException associated with the validation error. + + + + Gets the path of the JSON location where the validation error occurred. + + The path of the JSON location where the validation error occurred. + + + + Gets the text description corresponding to the validation error. + + The text description. + + + + Represents the callback method that will handle JSON schema validation events and the . + + + + + Resolves member mappings for a type, camel casing property names. + + + + + Used by to resolves a for a given . + + + + + Used by to resolves a for a given . + + + + + Resolves the contract for a given type. + + The type to resolve a contract for. + The contract for a given type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + If set to true the will use a cached shared with other resolvers of the same type. + Sharing the cache will significantly performance because expensive reflection will only happen once but could cause unexpected + behavior if different instances of the resolver are suppose to produce different results. When set to false it is highly + recommended to reuse instances with the . + + + + + Resolves the contract for a given type. + + The type to resolve a contract for. + The contract for a given type. + + + + Gets the serializable members for the type. + + The type to get serializable members for. + The serializable members for the type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates the constructor parameters. + + The constructor to create properties for. + The type's member properties. + Properties for the given . + + + + Creates a for the given . + + The matching member property. + The constructor parameter. + A created for the given . + + + + Resolves the default for the contract. + + Type of the object. + + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Determines which contract type is created for the given type. + + Type of the object. + A for the given type. + + + + Creates properties for the given . + + The type to create properties for. + /// The member serialization mode for the type. + Properties for the given . + + + + Creates the used by the serializer to get and set values from a member. + + The member. + The used by the serializer to get and set values from a member. + + + + Creates a for the given . + + The member's parent . + The member to create a for. + A created for the given . + + + + Resolves the name of the property. + + Name of the property. + Name of the property. + + + + Gets a value indicating whether members are being get and set using dynamic code generation. + This value is determined by the runtime permissions available. + + + true if using dynamic code generation; otherwise, false. + + + + + Gets or sets the default members search flags. + + The default members search flags. + + + + Gets or sets a value indicating whether compiler generated members should be serialized. + + + true if serialized compiler generated members; otherwise, false. + + + + + Gets or sets a value indicating whether to ignore the interface when serializing and deserializing types. + + + true if the interface will be ignored when serializing and deserializing types; otherwise, false. + + + + + Gets or sets a value indicating whether to ignore the attribute when serializing and deserializing types. + + + true if the attribute will be ignored when serializing and deserializing types; otherwise, false. + + + + + Initializes a new instance of the class. + + + + + Resolves the name of the property. + + Name of the property. + The property name camel cased. + + + + The default serialization binder used when resolving and loading classes from type names. + + + + + When overridden in a derived class, controls the binding of a serialized object to a type. + + Specifies the name of the serialized object. + Specifies the name of the serialized object. + + The type of the object the formatter creates a new instance of. + + + + + When overridden in a derived class, controls the binding of a serialized object to a type. + + The type of the object the formatter creates a new instance of. + Specifies the name of the serialized object. + Specifies the name of the serialized object. + + + + Provides information surrounding an error. + + + + + Gets or sets the error. + + The error. + + + + Gets the original object that caused the error. + + The original object that caused the error. + + + + Gets the member that caused the error. + + The member that caused the error. + + + + Gets the path of the JSON location where the error occurred. + + The path of the JSON location where the error occurred. + + + + Gets or sets a value indicating whether this is handled. + + true if handled; otherwise, false. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets the of the collection items. + + The of the collection items. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the property name resolver. + + The property name resolver. + + + + Gets the of the dictionary keys. + + The of the dictionary keys. + + + + Gets the of the dictionary values. + + The of the dictionary values. + + + + Maps a JSON property to a .NET member or constructor parameter. + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Gets or sets the name of the property. + + The name of the property. + + + + Gets or sets the type that declared this property. + + The type that declared this property. + + + + Gets or sets the order of serialization and deserialization of a member. + + The numeric order of serialization or deserialization. + + + + Gets or sets the name of the underlying member or parameter. + + The name of the underlying member or parameter. + + + + Gets the that will get and set the during serialization. + + The that will get and set the during serialization. + + + + Gets or sets the type of the property. + + The type of the property. + + + + Gets or sets the for the property. + If set this converter takes presidence over the contract converter for the property type. + + The converter. + + + + Gets the member converter. + + The member converter. + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + + Gets a value indicating whether this is readable. + + true if readable; otherwise, false. + + + + Gets a value indicating whether this is writable. + + true if writable; otherwise, false. + + + + Gets the default value. + + The default value. + + + + Gets a value indicating whether this is required. + + A value indicating whether this is required. + + + + Gets a value indicating whether this property preserves object references. + + + true if this instance is reference; otherwise, false. + + + + + Gets the property null value handling. + + The null value handling. + + + + Gets the property default value handling. + + The default value handling. + + + + Gets the property reference loop handling. + + The reference loop handling. + + + + Gets the property object creation handling. + + The object creation handling. + + + + Gets or sets the type name handling. + + The type name handling. + + + + Gets or sets a predicate used to determine whether the property should be serialize. + + A predicate used to determine whether the property should be serialize. + + + + Gets or sets a predicate used to determine whether the property should be serialized. + + A predicate used to determine whether the property should be serialized. + + + + Gets or sets an action used to set whether the property has been deserialized. + + An action used to set whether the property has been deserialized. + + + + A collection of objects. + + + + + Initializes a new instance of the class. + + The type. + + + + When implemented in a derived class, extracts the key from the specified element. + + The element from which to extract the key. + The key for the specified element. + + + + Adds a object. + + The property to add to the collection. + + + + Gets the closest matching object. + First attempts to get an exact case match of propertyName and then + a case insensitive match. + + Name of the property. + A matching property if found. + + + + Gets a property by property name. + + The name of the property to get. + Type property name string comparison. + A matching property if found. + + + + Specifies missing member handling options for the . + + + + + Ignore a missing member and do not attempt to deserialize it. + + + + + Throw a when a missing member is encountered during deserialization. + + + + + Specifies null value handling options for the . + + + + + Include null values when serializing and deserializing objects. + + + + + Ignore null values when serializing and deserializing objects. + + + + + Specifies reference loop handling options for the . + + + + + Throw a when a loop is encountered. + + + + + Ignore loop references and do not serialize. + + + + + Serialize loop references. + + + + + An in-memory representation of a JSON Schema. + + + + + Initializes a new instance of the class. + + + + + Reads a from the specified . + + The containing the JSON Schema to read. + The object representing the JSON Schema. + + + + Reads a from the specified . + + The containing the JSON Schema to read. + The to use when resolving schema references. + The object representing the JSON Schema. + + + + Load a from a string that contains schema JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Parses the specified json. + + The json. + The resolver. + A populated from the string that contains JSON. + + + + Writes this schema to a . + + A into which this method will write. + + + + Writes this schema to a using the specified . + + A into which this method will write. + The resolver used. + + + + Returns a that represents the current . + + + A that represents the current . + + + + + Gets or sets the id. + + + + + Gets or sets the title. + + + + + Gets or sets whether the object is required. + + + + + Gets or sets whether the object is read only. + + + + + Gets or sets whether the object is visible to users. + + + + + Gets or sets whether the object is transient. + + + + + Gets or sets the description of the object. + + + + + Gets or sets the types of values allowed by the object. + + The type. + + + + Gets or sets the pattern. + + The pattern. + + + + Gets or sets the minimum length. + + The minimum length. + + + + Gets or sets the maximum length. + + The maximum length. + + + + Gets or sets a number that the value should be divisble by. + + A number that the value should be divisble by. + + + + Gets or sets the minimum. + + The minimum. + + + + Gets or sets the maximum. + + The maximum. + + + + Gets or sets a flag indicating whether the value can not equal the number defined by the "minimum" attribute. + + A flag indicating whether the value can not equal the number defined by the "minimum" attribute. + + + + Gets or sets a flag indicating whether the value can not equal the number defined by the "maximum" attribute. + + A flag indicating whether the value can not equal the number defined by the "maximum" attribute. + + + + Gets or sets the minimum number of items. + + The minimum number of items. + + + + Gets or sets the maximum number of items. + + The maximum number of items. + + + + Gets or sets the of items. + + The of items. + + + + Gets or sets the of properties. + + The of properties. + + + + Gets or sets the of additional properties. + + The of additional properties. + + + + Gets or sets the pattern properties. + + The pattern properties. + + + + Gets or sets a value indicating whether additional properties are allowed. + + + true if additional properties are allowed; otherwise, false. + + + + + Gets or sets the required property if this property is present. + + The required property if this property is present. + + + + Gets or sets the identity. + + The identity. + + + + Gets or sets the a collection of valid enum values allowed. + + A collection of valid enum values allowed. + + + + Gets or sets a collection of options. + + A collection of options. + + + + Gets or sets disallowed types. + + The disallow types. + + + + Gets or sets the default value. + + The default value. + + + + Gets or sets the extend . + + The extended . + + + + Gets or sets the format. + + The format. + + + + Generates a from a specified . + + + + + Generate a from the specified type. + + The type to generate a from. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + The used to resolve schema references. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + Specify whether the generated root will be nullable. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + The used to resolve schema references. + Specify whether the generated root will be nullable. + A generated from the specified type. + + + + Gets or sets how undefined schemas are handled by the serializer. + + + + + Gets or sets the contract resolver. + + The contract resolver. + + + + The value types allowed by the . + + + + + No type specified. + + + + + String type. + + + + + Float type. + + + + + Integer type. + + + + + Boolean type. + + + + + Object type. + + + + + Array type. + + + + + Null type. + + + + + Any type. + + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the object member serialization. + + The member object serialization. + + + + Gets the object's properties. + + The object's properties. + + + + Gets the constructor parameters required for any non-default constructor + + + + + Gets or sets the override constructor used to create the object. + This is set when a constructor is marked up using the + JsonConstructor attribute. + + The override constructor. + + + + Gets or sets the parametrized constructor used to create the object. + + The parametrized constructor. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Get and set values for a using reflection. + + + + + Initializes a new instance of the class. + + The member info. + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + When applied to a method, specifies that the method is called when an error occurs serializing an object. + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic that returns a result + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic, but uses one of the arguments for + the result. + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic, but uses one of the arguments for + the result. + + + + + Returns a Restrictions object which includes our current restrictions merged + with a restriction limiting our type + + + + + Represents a method that constructs an object. + + + + + Specifies type name handling options for the . + + + + + Do not include the .NET type name when serializing types. + + + + + Include the .NET type name when serializing into a JSON object structure. + + + + + Include the .NET type name when serializing into a JSON array structure. + + + + + Always include the .NET type name when serializing. + + + + + Include the .NET type name when the type of the object being serialized is not the same as its declared type. + + + + + Converts the value to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert the value to. + The converted type. + + + + Converts the value to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert the value to. + The converted value if the conversion was successful or the default value of T if it failed. + + true if initialValue was converted successfully; otherwise, false. + + + + + Converts the value to the specified type. If the value is unable to be converted, the + value is checked whether it assignable to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert or cast the value to. + + The converted type. If conversion was unsuccessful, the initial value + is returned if assignable to the target type. + + + + + Gets a dictionary of the names and values of an Enum type. + + + + + + Gets a dictionary of the names and values of an Enum type. + + The enum type to get names and values for. + + + + + Specifies the type of Json token. + + + + + This is returned by the if a method has not been called. + + + + + An object start token. + + + + + An array start token. + + + + + A constructor start token. + + + + + An object property name. + + + + + A comment. + + + + + Raw JSON. + + + + + An integer. + + + + + A float. + + + + + A string. + + + + + A boolean. + + + + + A null token. + + + + + An undefined token. + + + + + An object end token. + + + + + An array end token. + + + + + A constructor end token. + + + + + A Date. + + + + + Byte data. + + + + + Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Adds the elements of the specified collection to the specified generic IList. + + The list to add to. + The collection of elements to add. + + + + Returns the index of the first occurrence in a sequence by using a specified IEqualityComparer. + + The type of the elements of source. + A sequence in which to locate a value. + The object to locate in the sequence + An equality comparer to compare values. + The zero-based index of the first occurrence of value within the entire sequence, if found; otherwise, –1. + + + + Gets the type of the typed collection's items. + + The type. + The type of the typed collection's items. + + + + Gets the member's underlying type. + + The member. + The underlying type of the member. + + + + Determines whether the member is an indexed property. + + The member. + + true if the member is an indexed property; otherwise, false. + + + + + Determines whether the property is an indexed property. + + The property. + + true if the property is an indexed property; otherwise, false. + + + + + Gets the member's value on the object. + + The member. + The target object. + The member's value on the object. + + + + Sets the member's value on the target object. + + The member. + The target. + The value. + + + + Determines whether the specified MemberInfo can be read. + + The MemberInfo to determine whether can be read. + /// if set to true then allow the member to be gotten non-publicly. + + true if the specified MemberInfo can be read; otherwise, false. + + + + + Determines whether the specified MemberInfo can be set. + + The MemberInfo to determine whether can be set. + if set to true then allow the member to be set non-publicly. + if set to true then allow the member to be set if read-only. + + true if the specified MemberInfo can be set; otherwise, false. + + + + + Determines whether the string is all white space. Empty string will return false. + + The string to test whether it is all white space. + + true if the string is all white space; otherwise, false. + + + + + Nulls an empty string. + + The string. + Null if the string was null, otherwise the string unchanged. + + + + Specifies the state of the . + + + + + An exception has been thrown, which has left the in an invalid state. + You may call the method to put the in the Closed state. + Any other method calls results in an being thrown. + + + + + The method has been called. + + + + + An object is being written. + + + + + A array is being written. + + + + + A constructor is being written. + + + + + A property is being written. + + + + + A write method has not been called. + + + + diff --git a/Website/LOC.Website.Common/bin/Debug/StructureMap.dll b/Website/LOC.Website.Common/bin/Debug/StructureMap.dll new file mode 100644 index 000000000..28a17b021 Binary files /dev/null and b/Website/LOC.Website.Common/bin/Debug/StructureMap.dll differ diff --git a/Website/LOC.Website.Common/bin/Debug/StructureMap.pdb b/Website/LOC.Website.Common/bin/Debug/StructureMap.pdb new file mode 100644 index 000000000..6c4dd1f78 Binary files /dev/null and b/Website/LOC.Website.Common/bin/Debug/StructureMap.pdb differ diff --git a/Website/LOC.Website.Common/bin/Debug/StructureMap.xml b/Website/LOC.Website.Common/bin/Debug/StructureMap.xml new file mode 100644 index 000000000..6376709c4 --- /dev/null +++ b/Website/LOC.Website.Common/bin/Debug/StructureMap.xml @@ -0,0 +1,3931 @@ + + + + StructureMap + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Get the object of type T that is valid for this build session. + + + + + + + Get the object of type T that is valid for this build session by name. + + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Register a default object for the given PluginType that will + be used throughout the rest of the current object request + + + + + + + Same as GetInstance, but can gracefully return null if + the Type does not already exist + + + + + + + Same as GetInstance(name), but can gracefully return null if + the Type and name does not already exist + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Gets all objects in the current object graph that can be cast + to T that have already been created + + + + + + + Creates/Resolves every configured instance of PlutinType T + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Gets a reference to the BuildStack for this build session + + + + + The concrete type of the immediate parent object in the object graph + + + + + Gets the root "frame" of the object request + + + + + The requested instance name of the object graph + + + + + Expression Builder that has grammars for defining policies at the + PluginType level. This expression is used for registering + open generic types + + + + + Convenience method that sets the default concrete type of the PluginType. The "concreteType" + can only accept types that do not have any primitive constructor arguments. + StructureMap has to know how to construct all of the constructor argument types. + + + + + + + Use this configured Instance as is + + + + + + Shorter way to call TheDefaultIsConcreteType + + + + + + + Shortcut to add a value by type + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Configure this type as the supplied value + + + + + + Sets the object creation of the instances of the PluginType. For example: PerRequest, + Singleton, ThreadLocal, HttpContext, or Hybrid + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Registers an IBuildInterceptor for this Plugin Type that executes before + any object of this PluginType is created. IBuildInterceptor's can be + used to create a custom scope + + + + + + + Convenience method to mark a PluginFamily as a Singleton + + + + + + Convenience method to mark a PluginFamily as a Hybrid lifecycle + + + + + + Convenience method to mark a PluginFamily as HttpContext scoped + + + + + + + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. You can also chain other declarations after + this method to add constructor and setter arguments + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type by a specified name. You can also chain other declarations after + this method to add constructor and setter arguments + + + + + + + + Specify the value of this explicit argument + + + + + + + Pass in additional arguments by type T + + + + + + + + Pass in additional arguments by type + + + + + + + + Pass in additional arguments by name + + + + + + + Gets the default instance of type T using the explicitly configured arguments from the "args" + + + + + + + Gets a named instance of type T using the explicitly configured arguments from teh "args" + + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + Gets all configured instances of type T using explicitly configured arguments + + + + + + + Returns the System.Reflection.ConstructorInfo for the PluggedType. Uses either + the "greediest" constructor with the most arguments or the constructor function + marked with the [DefaultConstructor] + + + + + + The InstanceKey of the default instance of the PluginFamily + + + + + The CLR Type that defines the "Plugin" interface for the PluginFamily + + + + + Add an Assembly to the scanning operation + + + + + + Add an Assembly by name to the scanning operation + + + + + + Add the currently executing Assembly to the scanning operation + + + + + Add the Assembly that contains type T to the scanning operation + + + + + + Add the Assembly that contains type to the scanning operation + + + + + + Sweep the designated path and add any Assembly's found in this folder to the + scanning operation + + + + + + Sweep the designated path and add any Assembly's found in this folder to the + scanning operation. The assemblyFilter can be used to filter or limit the + Assembly's that are picked up. + + + + + + + Sweep the application base directory of current app domain and add any Assembly's + found to the scanning operation. + + + + + Sweep the application base directory of current app domain and add any Assembly's + found to the scanning operation. The assemblyFilter can be used to filter or limit the + Assembly's that are picked up. + + + + + Adds an ITypeScanner object to the scanning operation + + + + + + Creates and adds a new ITypeScanner of type T to this scanning operation + + + + + + Directs the scanning operation to automatically detect and include any Registry + classes found in the Assembly's being scanned + + + + + Add all concrete types of the Plugin Type as Instances of Plugin Type + + + + + + Add all concrete types of the Plugin Type as Instances of Plugin Type + + + + + + Makes this scanning operation ignore all [PluginFamily] and [Pluggable] attributes + + + + + Exclude types that match the Predicate from being scanned + + + + + + Exclude all types in this nameSpace or its children from the scanning operation + + + + + + Exclude all types in this nameSpace or its children from the scanning operation + + + + + + Only include types matching the Predicate in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Only include types from this nameSpace or its children in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Only include types from this nameSpace or its children in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Exclude this specific type from the scanning operation + + + + + + Adds a registration convention to be applied to all the types in this + logical "scan" operation + + + + + + Adds a registration convention to be applied to all the types in this + logical "scan" operation + + + + + Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete + class named "Something" that implements "ISomething" will be automatically + added to PluginType "ISomething" + + + + + Scans for PluginType's and Concrete Types that close the given open generic type + + + + + + + + + Automatically registers all concrete types without primitive arguments + against its first interface, if any + + + + + Directs the scanning to automatically register any type that is the single + implementation of an interface against that interface. + The filters apply + + + + + Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete + class named "Something" that implements "ISomething" will be automatically + added to PluginType "ISomething" + + + + + Scans for PluginType's and Concrete Types that close the given open generic type + + + + + + + + + Automatically registers all concrete types without primitive arguments + against its first interface, if any + + + + + Directs the scanning to automatically register any type that is the single + implementation of an interface against that interface. + The filters apply + + + + + A TypeInterceptor that is only applied if the MatchesType() + method is true for a given Type + + + + + An InstanceInterceptor can be registered on a per-Instance basis + to act on, or even replace, the object that is created before + it is passed back to the caller. This is primarily a hook + for runtime AOP scenarios. + + + + + Does this TypeInterceptor apply to the given type? + + + + + + + Specify how objects matching the Type predicate + will be intercepted + + + + + + Specify how objects matching the Type predicate + will be intercepted + + + + + + Used for auto-mocking container. When the factory is missing, we can generate a mock for it + + + + + An Instance class that builds objects by calling a constructor function on a concrete type + and filling setter properties. ConfiguredInstance should only be used for open generic types. + Favor SmartInstance{T} for all other usages. + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE + + + + + + + Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE + + + + + + + Inline definition of a constructor or a setter property dependency + + + + + + + Starts the definition of a child instance specifying the argument name + in the case of a constructor function that consumes more than one argument + of type T + + + + + + + + Inline definition of a constructor dependency + + + + + + + + Inline definition of a setter dependency + + + + + + + + Start the definition of a primitive argument to a constructor argument + + + + + + + Configure a primitive constructor argument + + + + + + + Configures an array of Instance's for the array dependency + + + + + + + Part of the Fluent Interface, represents a nonprimitive argument to a + constructure function + + + + + Use a previously configured and named instance for the child + + + + + + + Start the definition of a child instance by defining the concrete type + + + + + + + Start the definition of a child instance by defining the concrete type + + + + + + + Registers a configured instance to use as the argument to the parent's + constructor + + + + + + + Directs StructureMap to fill this dependency with the Default Instance of the + constructor or property type + + + + + + Base class for many of the Instance subclasses to support + method chaining in the Registry DSL for common options + + + + + + Set the name of this Instance + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + + Register an InstanceInterceptor with this Instance + + + + + + + Used to override the constructor of a class to be used by StructureMap to create + a Pluggable object + + + + + Examines a System.Type object and determines the ConstructorInfo to use in creating + instances of the Type + + + + + + + Used to implicitly mark a class as a Plugin candidate for StructureMap + + + + + Determines whether a Type object is marked as Pluggable + + + + + + + The ConcreteKey alias of the Type + + + + + Declares a class, abstract class, or interface to be the target of a PluginFamily in the container + + + + + Determines if a Type object is marked as a PluginFamily + + + + + + + If set, determines the shared "scope" of the instance -- PerRequest, Singleton, ThreadLocal, + HttpContext, etc. + + + + + InstanceKey of the default instance. Used to implicitly define the default without + declaring the instance in StructureMap.config + + + + + Declares the target to be built by StructureMap as a Singleton. One object instance will + be created for each named instance + + + + + Marks a Property in a Pluggable class as filled by setter injection + + + + + Marks a method with no parameters as a method that validates an instance. StructureMap + uses this method to validate the configuration file. If the method does not throw an + exception, the object is assumed to be valid. + + + + + Returns an array of any MethodInfo's on a Type that are marked as ValidationMethod + + CLR Type to search for validation methods + + + + + Constants for the names of Xml nodes and attributes in the StructureMap.config + file + + + + + The name of the default configuration file. The value is always StructurMap.config + + + + + Returns the absolute path to the StructureMap.config file + + + + + + Expression Builder that has grammars for defining policies at the + PluginType level + + + + + Add multiple Instance's to this PluginType + + + + + + + Conditional binding of instances + + + + + + + Access to all of the uncommon Instance types + + + + + + + Access to all of the uncommon Instance types + + + + + + + Convenience method that sets the default concrete type of the PluginType. Type T + can only accept types that do not have any primitive constructor arguments. + StructureMap has to know how to construct all of the constructor argument types. + + + + + + + + Shorthand to say TheDefault.Is.ConstructedBy(func) + + + + + + + Shorthand to say TheDefault.Is.ConstructedBy(func) + + + + + + + Shorthand to say TheDefault.IsThis(@object) + + + + + + + Sets the object creation of the instances of the PluginType. For example: PerRequest, + Singleton, ThreadLocal, HttpContext, or Hybrid + + + + + + + Convenience method to mark a PluginFamily as a Singleton + + + + + + Convenience method to mark a PluginFamily as a Transient + + + + + + Convenience method to mark a PluginFamily as a Hybrid lifecycle + + + + + + Convenience method to mark a PluginFamily as HttpContext scoped + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Adds an Interceptor to only this PluginType + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Registers an ILifecycle for this Plugin Type that executes before + any object of this PluginType is created. ILifecycle's can be + used to create a custom scope + + + + + + + Largely deprecated and unnecessary with the ability to add Xml configuration files + + + + + + + Forces StructureMap to always use a unique instance to + stop the "BuildSession" caching + + + + + + Adds the object to to the PLUGINTYPE + + + + + + + Add an Instance to this type created by a Lambda + + + + + + + Define the Default Instance for this PluginType + + + + + Expression class to help define a runtime Profile + + + + + Starts the definition of the default instance for the containing Profile. This is + still valid, but Type() is recommended + + + + + + + Designate or define the Instance for a type within + this Profile + + + + + + + Use statement to define the Profile defaults for a Generic type + + + + + + + Expression Builder inside of a Profile creation for + open generic types + + + + + Use this concreteType for the Instance of this Profile for the PluginType + + + + + + + Use this concreteType for the Instance of this Profile for the PluginType + + + + + + + Use this Instance for the Profile Instance of this Plugin Type + + + + + + + Use the named Instance as the Profile Instance for this PluginType + + + + + + + Use the named Instance as the Profile Instance for this PluginType + + + + + + + For this type and profile, build the object with this Lambda + + + + + + + Expression Builder within defining a Profile + + + + + + Use a named, preconfigured instance as the default instance for this profile + + + + + + + Use a named, preconfigured instance as the default instance for this profile + + + + + + + Define the default instance of the PluginType for the containing Profile + + + + + + + For this Profile, use an Instance with this Func + + + + + + + For this Profile, use an Instance with this Func + + + + + + + For this Profile, use this object + + + + + + + Access to the uncommon types of Instance + + + + + + For this Profile, use the Concrete Type + + + + + + + For this profile, use this concrete type + + + + + + + A Registry class provides methods and grammars for configuring a Container or ObjectFactory. + Using a Registry subclass is the recommended way of configuring a StructureMap Container. + + + public class MyRegistry : Registry + { + public MyRegistry() + { + ForRequestedType(typeof(IService)).TheDefaultIsConcreteType(typeof(Service)); + } + } + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Imports the configuration from another registry into this registry. + + + + + + Imports the configuration from another registry into this registry. + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + This method is a shortcut for specifying the default constructor and + setter arguments for a ConcreteType. ForConcreteType is shorthand for: + ForRequestedType[T]().Use[T].************** + when the PluginType and ConcreteType are the same Type + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Convenience method. Equivalent of ForRequestedType[PluginType]().AsSingletons() + + + + + + + Uses the configuration expressions of this Registry to create a PluginGraph + object that could be used to initialize a Container. This method is + mostly for internal usage, but might be helpful for diagnostics + + + + + + Adds an additional, non-Default Instance to the PluginType T. + + + + + + + Adds an additional, non-Default Instance to the designated pluginType + This method is mostly meant for open generic types + + + + + + + Expression Builder to define the defaults for a named Profile. Each call + to CreateProfile is additive. + + + + + + + An alternative way to use CreateProfile that uses ProfileExpression + as a Nested Closure. This usage will result in cleaner code for + multiple declarations + + + + + + + Registers a new TypeInterceptor object with the Container + + + + + + Allows you to define a TypeInterceptor inline with Lambdas or anonymous delegates + + + + + IfTypeMatches( ... ).InterceptWith( o => new ObjectWrapper(o) ); + + + + + Designates a policy for scanning assemblies to auto + register types + + + + + + Directs StructureMap to always inject dependencies into any and all public Setter properties + of the type PLUGINTYPE. + + + + + + + Creates automatic "policies" for which public setters are considered mandatory + properties by StructureMap that will be "setter injected" as part of the + construction process. + + + + + + Use to programmatically select the constructor function of a concrete + class. Applies globally to all Containers in a single AppDomain. + + + + + + + All requests For the "TO" types will be filled by fetching the "FROM" + type and casting it to "TO" + GetInstance(typeof(TO)) basically becomes (TO)GetInstance(typeof(FROM)) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( @object ) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( instance ) + + + + + + + + Shorthand for ForRequestedType(pluginType) + + + + + + + + Advanced Usage Only! Skips the Registry and goes right to the inner + Semantic Model of StructureMap. Use with care + + + + + + Adds the concreteType as an Instance of the pluginType. Mostly useful + for conventions + + + + + + + Adds the concreteType as an Instance of the pluginType with a name. Mostly + useful for conventions + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType. + Mostly useful for conventions + + + + + + Imports the configuration from another registry into this registry. + + + + + + Imports the configuration from another registry into this registry. + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + This method is a shortcut for specifying the default constructor and + setter arguments for a ConcreteType. ForConcreteType is shorthand for: + For[T]().Use[T].************** + when the PluginType and ConcreteType are the same Type + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Convenience method. Equivalent of ForRequestedType[PluginType]().Singletons() + + + + + + + Uses the configuration expressions of this Registry to create a PluginGraph + object that could be used to initialize a Container. This method is + mostly for internal usage, but might be helpful for diagnostics + + + + + + Adds an additional, non-Default Instance to the PluginType T. + + + + + + + Adds an additional, non-Default Instance to the designated pluginType + This method is mostly meant for open generic types + + + + + + + Expression Builder to define the defaults for a named Profile. Each call + to CreateProfile is additive. + + + + + + + An alternative way to use CreateProfile that uses ProfileExpression + as a Nested Closure. This usage will result in cleaner code for + multiple declarations + + + + + + + Registers a new TypeInterceptor object with the Container + + + + + + Allows you to define a TypeInterceptor inline with Lambdas or anonymous delegates + + + + + IfTypeMatches( ... ).InterceptWith( o => new ObjectWrapper(o) ); + + + + + Designates a policy for scanning assemblies to auto + register types + + + + + + Directs StructureMap to always inject dependencies into any and all public Setter properties + of the type PLUGINTYPE. + + + + + + + Creates automatic "policies" for which public setters are considered mandatory + properties by StructureMap that will be "setter injected" as part of the + construction process. + + + + + + Use to programmatically select the constructor function of a concrete + class. Applies globally to all Containers in a single AppDomain. + + + + + + + All requests For the "TO" types will be filled by fetching the "FROM" + type and casting it to "TO" + GetInstance(typeof(TO)) basically becomes (TO)GetInstance(typeof(FROM)) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( @object ) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( instance ) + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + + Advanced Usage Only! Skips the Registry and goes right to the inner + Semantic Model of StructureMap. Use with care + + + + + + Define the constructor and setter arguments for the default T + + + + + + Thrown by IProperty classes when an invalid value is applied to + a property of an InstanceGraph + + + + + Main exception for StructureMap. Use the ErrorCode to aid in troubleshooting + StructureMap problems + + + + + Represents a concrete class that can be built by StructureMap as an instance of the parent + PluginFamily’s PluginType. The properties of a Plugin are the CLR Type of the concrete class, + and the human-friendly concrete key that StructureMap will use to identify the Type. + + + + + The ConcreteKey that identifies the Plugin within a PluginFamily + + + + + The concrete CLR Type represented by the Plugin + + + + + Property's that will be filled by setter injection + + + + + Conceptually speaking, a PluginFamily object represents a point of abstraction or variability in + the system. A PluginFamily defines a CLR Type that StructureMap can build, and all of the possible + Plugin’s implementing the CLR Type. + + + + + The CLR Type that defines the "Plugin" interface for the PluginFamily + + + + + The InstanceKey of the default instance of the PluginFamily + + + + + Custom collection class for PluginFamily's + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Models the runtime configuration of a StructureMap Container + + + + + Closes the PluginGraph for adding or removing members. Runs all the AssemblyScanner's + and attempts to attach concrete types to the proper plugin types. Calculates the Profile defaults. + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Adds an AssemblyScanner to the PluginGraph. Used for Testing. + + + + + + Add configuration to a PluginGraph with the Registry DSL + + + + + + Designates whether a PluginGraph has been "Sealed." + + + + + Represents a PropertyInfo of a Plugin.PluggedType that is filled by Setter Injection + + + + + Custom collection class for SetterProperty objects + + + + + Designates a CLR type that is loaded by name. + + + + + Interface for a "Factory" pattern class that creates object instances of the PluginType + + + + + The main "container" object that implements the Service Locator pattern + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates or finds the named instance of T + + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Gets all configured instances of type T using explicitly configured arguments from the "args" + + + + + + + + Gets the default instance of type T using the explicitly configured arguments from the "args" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + Gets the named instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + + Starts a "Nested" Container for atomic, isolated access + + + + + + Starts a new "Nested" Container for atomic, isolated service location. Opens + + + + + + + Provides queryable access to the configured PluginType's and Instances of this Container + + + + + The name of the container. By default this is set to + a random Guid. This is a convience property to + assist with debugging. Feel free to set to anything, + as this is not used in any logic. + + + + + Default implementation of IInstanceFactory + + + + + Constructor to use when troubleshooting possible configuration issues. + + + + + + Constructor to create an Container + + PluginGraph containing the instance and type definitions + for the Container + + + + Creates or finds the named instance of T + + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + Gets all configured instances of type T using explicitly configured arguments from the "args" + + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + + Starts a "Nested" Container for atomic, isolated access + + + + + + Starts a new "Nested" Container for atomic, isolated service location. Opens + + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Sets the default instance for the PluginType + + + + + + + Provides queryable access to the configured PluginType's and Instances of this Container + + + + + The name of the container. By default this is set to + a random Guid. This is a convience property to + assist with debugging. Feel free to set to anything, + as this is not used in any logic. + + + + + GoF Memento representing an Object Instance + + + + + Retrieves the named property value as a string + + + + + + + Template method for implementation specific retrieval of the named property + + + + + + + Returns the named child InstanceMemento + + + + + + + Template method for implementation specific retrieval of the named property + + + + + + + This method is made public for testing. It is not necessary for normal usage. + + + + + + Used to create a templated InstanceMemento + + + + + + + The named type of the object instance represented by the InstanceMemento. Translates to a concrete + type + + + + + The named key of the object instance represented by the InstanceMemento + + + + + Gets the referred template name + + + + + + Template pattern property specifying whether the InstanceMemento is simply a reference + to another named instance. Useful for child objects. + + + + + Template pattern property specifying the instance key that the InstanceMemento refers to + + + + + Is the InstanceMemento a reference to the default instance of the plugin type? + + + + + A TypeInterceptor that always applies to all Instances of a given Plugin Type + + + + + Abstract class that is the supertype of all storage and retrieval mechanisms of + InstanceMemento instances + + + + + Retrieves the named InstanceMemento + + The instanceKey of the requested InstanceMemento + + + + + Retrieves an array of all InstanceMemento's stored by this MementoSource + + + + + + Template pattern method. Determines if the MementoSource contains a definition for the + requested instanceKey. + + + + + + + Template pattern method. Retrieves an InstanceMemento for the instanceKey + + + + + + + The type of MementoSource + + + + + String description of the MementoSource. Used in the StructureMap-Client UI. + + + + + An in-memory implementation of InstanceMemento. + + + + + Creates an instance of MemoryInstanceMemento that represents a reference to another + instance. + + The referenced instance key to another instance + + + + + Creates a MemoryInstanceMemento that represents a reference to the default instance + of a plugin type. + + + + + + Constructs a MemoryInstanceMemento without properties + + The concrete key of the plugin type + The identifying instance key + + + + Constructs a MemoryInstanceMemento with properties + + The concrete key of the plugin type + The identifying instance key + NameValueCollection of instance properties + + + + Sets the value of the named property + + + + + + + Deletes a named property from the DefaultInstanceMemento + + + + + + Links a child InstanceMemento as a named property + + + + + + + Links an array of InstanceMemento's to a named array property + + + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + The main static Facade for the StructureMap container + + + + + Restarts ObjectFactory and blows away all Singleton's and cached instances. Use with caution. + + + + + Remove and dispose all objects scoped by HttpContext. Call this method at the *end* of an Http request to clean up resources + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the named instance of T + + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Provides queryable access to the configured PluginType's and Instances of the inner Container + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + Reads configuration XML documents and builds the structures necessary to initialize + the Container/IInstanceFactory/InstanceBuilder/ObjectInstanceActivator objects + + + + + Reads the configuration information and returns the PluginGraph definition of + plugin families and plugin's + + + + + + Generic implementation of an XmlMementoSource + + + + + Base class for all MementoSource classes that store InstanceMemento's as + node-normalized Xml + + + + + Implementation of MementoSource that stores and retrieves an XmlInstanceMemento per file in a named directory. + DirectoryXmlMementoSource is meant to simplify complicated object graph configurations by isolating each instance to a separate + editable file. + + + + + Stores an Xml InstanceMemento per file in a directory + + A ";" delimited list of directories to look for mementos. DirectoryXmlMementoSource + will use the FIRST directory it finds + The file extension of the InstanceMemento files without a dot. Typically "xml" + NodeNormalized or AttributeNormalized + + + + Implementation of MementoSource that stores and retrieves an XmlInstanceMemento per Embedded Resource file + in a named namespace. EmbeddedFolderXmlMementoSource is meant to simplify complicated object graph configurations + by isolating each instance to a separate + editable file. + + NodeNormalized or AttributeNormalized + The name of the Assembly with the embedded resources + The root namespace of all of the mementos. + The file extension of the memento files - "xml" + + + + An in-memory MementoSource + + + + + Retrieves Xml InstanceMemento's from an xml file stored as an embedded resource in an assembly. + + Designates the nodes that are memento nodes + NodeNormalized or AttributeNormalized + The name of the Assembly the file is embedded into + The path to the embedded resource within the file + + + + Default Constructor + + MementoSource that contains the Memento Templates + MementoSource that contains instances consisting of Template valuee + + + + Stores Attribute-normalized InstanceMemento's in an external file + + + + + Implementation of XmlMementoSource that reads InstanceMemento's from an external file. + Useful to break the StructureMap.config file into smaller pieces. + + + + + Default constructor + + Path to the xml file that contains the instance configuration + XPath expression to the parent node that contains the InstanceMemento nodes. + If empty, it defaults to the top node + The name of the nodes that are InstanceMemento nodes. Useful to store + different types of instances in the same file + + + + An implementation of InstanceMemento that stores properties as Xml attributes + Limited functionality + + + + + Implementation of InstanceMemento that stores information in a node-normalized + Xml format. + + + + + specify what type you'd like the service returned as + + + + + + + Specify the open generic type that should have a single generic parameter + + + + + + + Used as the argument in the Container.Configure() method to describe + configuration directives and specify the sources of configuration for + a Container + + + + + Creates and adds a Registry object of type T. + + The Registry Type + + + + Imports all the configuration from a Registry object + + + + + + Imports configuration from an Xml file. The fileName + must point to an Xml file with valid StructureMap + configuration + + + + + + Imports configuration directly from an XmlNode. This + method was intended for scenarios like Xml being embedded + into an assembly. The node must be a 'StructureMap' node + + + + + + If true, directs StructureMap to look for configuration in the App.config. + The default value is false. + + + + + Expression Builder to define an Instance + + + + + + Register a previously built Instance. This provides a "catch all" + method to attach custom Instance objects. Synonym for Instance() + + + + + + Inject this object directly. Synonym to Object() + + + + + + + Gives you full access to all the different ways to specify an "Instance" + + + + + An Expression Builder to define Instances of a PluginType. + This is mostly used for configuring open generic types + + + + + Shortcut to register a Concrete Type as an instance. This method supports + method chaining to allow you to add constructor and setter arguments for + the concrete type + + + + + + + Shortcut to simply use the Instance with the given name + + + + + + + An Expression Builder that is used throughout the Registry DSL to + add and define Instances + + + + + + Register a previously built Instance. This provides a "catch all" + method to attach custom Instance objects. Synonym for IsThis() + + + + + + Inject this object directly. Synonym to IsThis() + + + + + + + Build the Instance with the constructor function and setter arguments. Starts + the definition of a SmartInstance + + + + + + + Build the Instance with the constructor function and setter arguments. Starts + the definition of a SmartInstance + + + + + + + Build the Instance with the constructor function and setter arguments. Use this + method for open generic types, and favor the generic version of OfConcreteType + for all other types + + + + + + + Build the Instance with the constructor function and setter arguments. Use this + method for open generic types, and favor the generic version of OfConcreteType + for all other types + + + + + + + Create an Instance that builds an object by calling a Lambda or + an anonymous delegate with no arguments + + + + + + + Create an Instance that builds an object by calling a Lambda or + an anonymous delegate with the IContext representing + the current object graph. + + + + + + + Use the Instance of this PluginType with the specified name. This is + generally only used while configuring child dependencies within a deep + object graph + + + + + + + Use the default Instance of this PluginType. This is + generally only used while configuring child dependencies within a deep + object graph + + + + + + Creates an Instance that stores this object of type T, + and returns a cloned copy of the template. + + + + + + + Caches template as a serialized byte stream. Uses deserialization + to create copies when the Instance is built. + + + + + + + Creates an Instance that will load an ASCX user control from the url + + + + + + + Creates an Instance according to conditional rules + + + + + + + Used as an expression builder to specify setter injection policies + + + + + Directs StructureMap to treat all public setters of type T as + mandatory properties + + + + + + Directs StructureMap to tread all public setters with + a PropertyType that matches the predicate as a + mandatory setter + + + + + + Directs StructureMap to treat all public setters that match the + rule as mandatory properties + + + + + + Directs StructureMap to treat all public setters with a property + type in the specified namespace as mandatory properties + + + + + + Directs StructureMap to treat all public setters with a property + type in the specified namespace as mandatory properties + + + + + + Directs StructureMap to treat all public setters where to property name + matches the specified rule as a mandatory property + + + + + + Base class for creating an object instance from an InstanceMemento. SubClasses are + emitted for each concrete Plugin with constructor parameters. + + + + + Allows built-in registration conventions to be configurable through the assembly scanning DSL + + + Intended for StructureMap internal use only. + Custom registration convention instances can be directly configured + before being passed to IAssemblyScanner.With(IRegistrationConvention). + + + + + Simply query to see if there are any implementations registered + + + + + + Ejects any instances of this instance from the current container + and permanently removes the instance from the container configuration + + + + + + Eject all instances of this PluginType from the current container, + but leaves the lifecycle behavior + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Models the state of a Container or ObjectFactory. Can be used to query for the + existence of types registered with StructureMap + + + + + Can StructureMap fulfill a request to ObjectFactory.GetInstance(pluginType) from the + current configuration. This does not include concrete classes that could be auto-configured + upon demand + + + + + + + Can StructureMap fulfill a request to ObjectFactory.GetInstance<T>() from the + current configuration. This does not include concrete classes that could be auto-configured + upon demand + + + + + + + Queryable access to all of the InstanceRef for a given PluginType + + + + + + + Queryable access to all of the InstanceRef for a given PluginType + + + + + + Does the current container have existing configuration for the "pluginType" + + + + + + + Does the current container have existing configuration for the type T + + + + + + Find the concrete type for the default Instance of T. + In other words, when I call Container.GetInstance(Type), + what do I get? May be indeterminate + + + + + + + Find the concrete type for the default Instance of pluginType. + In other words, when I call Container.GetInstance(Type), + what do I get? May be indeterminate + + + + + + Retrieves the configuration for the given type + + + + + + + Retrieves the configuration for the given type + + + + + + + Eject all objects, configuration, and Plugin Types matching this filter + + + + + + Eject all objects and configuration for any Plugin Type that matches this filter + + + + + + Eject all objects and Instance configuration for this PluginType + + + + + + Get each and every configured instance that could possibly + be cast to T + + + + + + + Access to all the Plugin Type registrations + + + + + Makes sure that every request for this object returns a unique object + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + The actual concrete type of this Instance. Not every type of IInstance + can determine the ConcreteType + + + + + Ejects and removes all objects and the configuration for the named instance from the + container + + + + + + + Ejects and removes all objects and configuration for the instances that match the filter + + + + + + + Determines if the pluggedType can be upcast to the pluginType + + + + + + + + Determines if the PluggedType is a valid Plugin into the + PluginType + + + + + + + + Imports configuration from an Xml file. The fileName + must point to an Xml file with valid StructureMap + configuration + + + + + + Imports configuration directly from an XmlNode. This + method was intended for scenarios like Xml being embedded + into an assembly. The node must be a 'StructureMap' node + + + + + + Creates and adds a Registry object of type T. + + The Registry Type + + + + Imports all the configuration from a Registry object + + + + + + If true, makes the existence of the StructureMap.config mandatory. + The default is false. + + + + + If true, the StructureMap.config file will be ignored even if it exists. + The default is false. + + + + + If true, directs StructureMap to look for configuration in the App.config. + The default value is false. + + + + + Designate the Default Profile. This will be applied as soon as the + Container is initialized. + + + + + Retrieves the configuration for the given type + + + + + + + Retrieves the configuration for the given type + + + + + + + Eject all objects, configuration, and Plugin Types matching this filter + + + + + + Eject all objects and configuration for any Plugin Type that matches this filter + + + + + + Eject all objects and Instance configuration for this PluginType + + + + + + Get each and every configured instance that could possibly + be cast to T + + + + + + + The requested PluginType of the Instance being create + + + + + The Name of the Instance being created + + + + + The actual ConcreteType being created. This will not always + be available + + + + + Models the current place in an object graph during the construction of + an instance. Provides contextual information that can be used + to alter the desired construction of child objects + + + + + The requested PluginType of the Instance being create + + + + + The Name of the Instance being created + + + + + The actual ConcreteType being created. This will not always + be available + + + + + Provides metadata about the object graph being constructed. More or less a stack trace of the GetInstance() pipeline + that can be used for "contextual" object construction + + + + + The top level of the object graph. Describes the original requested instance + + + + + The current BuildFrame + + + + + The immediate parent BuildFrame + + + + + Defines the value of a primitive argument to a constructur argument + + + + + Sets the value of the constructor argument + + + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings + + The key in appSettings for the value to use. + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings when it exists. Otherwise uses the provided default value. + + The key in appSettings for the value to use. + The value to use if an entry for does not exist in the appSettings section. + + + + + Instance that builds objects with by calling constructor functions and using setter properties + + The concrete type constructed by SmartInstance + + + + Sets the name of this Instance + + + + + + + Sets the name of this Instance + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register an InstanceInterceptor with this Instance + + + + + + + Define a primitive constructor argument + + + + + + + Set simple setter properties + + + + + + + Define a primitive setter property by specifying the property name with + an expression + + + + + + + Define a primitive setter property by specifying the property name + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type. Do not + use this method if there is more than one constructor arguments of the same type + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type. Do not + use this method if there is more than one constructor arguments of the same type + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type and constructor name. + Use this method if there is more than one constructor arguments of the same type + + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type and constructor name. + Use this method if there is more than one constructor arguments of the same type + + + + + + + + Inline definition of a setter dependency. The property name is specified with an Expression + + + + + + + + Inline definition of a setter dependency. The property name is specified with an Expression + + + + + + + + Inline definition of a setter dependency. Only use this method if there + is only a single property of the SETTERTYPE + + + + + + + Inline definition of a setter dependency. Only use this method if there + is only a single property of the SETTERTYPE + + + + + + + Inline definition of a dependency on an Array of the CHILD type. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + Inline definition of a dependency on an Array of the CHILD type and the specified setter property or constructor argument name. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + + Inline definition of a dependency on an Array of the CHILD type. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + Inline definition of a dependency on an Array of the CHILD type and the specified setter property or constructor argument name. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + + Expression Builder to help define multiple Instances for an Array dependency + + + + + + Nested Closure that allows you to add an unlimited number of child Instances + + + + + + + Specify an array of Instance objects directly for an Array dependency + + + + + + + Expression Builder that helps to define child dependencies inline + + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings + + The key in appSettings for the value to use. + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings when it exists. Otherwise uses the provided default value. + + The key in appSettings for the value to use. + The value to use if an entry for does not exist in the appSettings section. + + + + + Nested Closure to define a child dependency inline + + + + + + + Shortcut to set an inline dependency to an Instance + + + + + + + Shortcut to set an inline dependency to a designated object + + + + + + + Shortcut to set an inline dependency to a designated object + + + + + + + Set an Inline dependency to the Default Instance of the Property type + Used mostly to force an optional Setter property to be filled by + StructureMap + + + + + + Shortcut method to define a child dependency inline + + + + + + + Shortcut method to define a child dependency inline and configure + the child dependency + + + + + + + Provides virtual methods that can be used by subclasses to parse an expression tree. + + + This class actually already exists in the System.Core assembly...as an internal class. + I can only speculate as to why it is internal, but it is obviously much too dangerous + for anyone outside of Microsoft to be using... + + + + diff --git a/Website/LOC.Website.Common/bin/Release/EntityFramework.dll b/Website/LOC.Website.Common/bin/Release/EntityFramework.dll new file mode 100644 index 000000000..8caef36ac Binary files /dev/null and b/Website/LOC.Website.Common/bin/Release/EntityFramework.dll differ diff --git a/Website/LOC.Website.Common/bin/Release/EntityFramework.xml b/Website/LOC.Website.Common/bin/Release/EntityFramework.xml new file mode 100644 index 000000000..4057d68a4 --- /dev/null +++ b/Website/LOC.Website.Common/bin/Release/EntityFramework.xml @@ -0,0 +1,18061 @@ + + + + EntityFramework + + + + + Specifies the database column that a property is mapped to. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The name of the column the property is mapped to. + + + + The name of the column the property is mapped to. + + + + + The zero-based order of the column the property is mapped to. + + + + + The database provider specific data type of the column the property is mapped to. + + + + + Denotes that the class is a complex type. + Complex types are non-scalar properties of entity types that enable scalar properties to be organized within entities. + Complex types do not have keys and cannot be managed by the Entity Framework apart from the parent object. + + + + + Specifies how the database generates values for a property. + + + + + Initializes a new instance of the class. + + The pattern used to generate values for the property in the database. + + + + The pattern used to generate values for the property in the database. + + + + + The pattern used to generate values for a property in the database. + + + + + The database does not generate values. + + + + + The database generates a value when a row is inserted. + + + + + The database generates a value when a row is inserted or updated. + + + + + Denotes a property used as a foreign key in a relationship. + The annotation may be placed on the foreign key property and specify the associated navigation property name, + or placed on a navigation property and specify the associated foreign key name. + + + + + Initializes a new instance of the class. + + + If placed on a foreign key property, the name of the associated navigation property. + If placed on a navigation property, the name of the associated foreign key(s). + If a navigation property has multiple foreign keys, a comma separated list should be supplied. + + + + + If placed on a foreign key property, the name of the associated navigation property. + If placed on a navigation property, the name of the associated foreign key(s). + + + + + Specifies the inverse of a navigation property that represents the other end of the same relationship. + + + + + Initializes a new instance of the class. + + The navigation property representing the other end of the same relationship. + + + + The navigation property representing the other end of the same relationship. + + + + + Specifies the maximum length of array/string data allowed in a property. + + + + + Initializes a new instance of the class. + + + The maximum allowable length of array/string data. + Value must be greater than zero. + + + + + Initializes a new instance of the class. + The maximum allowable length supported by the database will be used. + + + + + Determines whether a specified object is valid. (Overrides ) + + + This method returns true if the is null. + It is assumed the is used if the value may not be null. + + The object to validate. + true if the value is null or less than or equal to the specified maximum length, otherwise false + Length is zero or less than negative one. + + + + Applies formatting to a specified error message. (Overrides ) + + The name to include in the formatted string. + A localized string to describe the maximum acceptable length. + + + + Checks that Length has a legal value. Throws InvalidOperationException if not. + + + + + Gets the maximum allowable length of the array/string data. + + + + + Specifies the minimum length of array/string data allowed in a property. + + + + + Initializes a new instance of the class. + + + The minimum allowable length of array/string data. + Value must be greater than or equal to zero. + + + + + Determines whether a specified object is valid. (Overrides ) + + + This method returns true if the is null. + It is assumed the is used if the value may not be null. + + The object to validate. + true if the value is null or greater than or equal to the specified minimum length, otherwise false + Length is less than zero. + + + + Applies formatting to a specified error message. (Overrides ) + + The name to include in the formatted string. + A localized string to describe the minimum acceptable length. + + + + Checks that Length has a legal value. Throws InvalidOperationException if not. + + + + + Gets the minimum allowable length of the array/string data. + + + + + Denotes that a property or class should be excluded from database mapping. + + + + + Specifies the database table that a class is mapped to. + + + + + Initializes a new instance of the class. + + The name of the table the class is mapped to. + + + + The name of the table the class is mapped to. + + + + + The schema of the table the class is mapped to. + + + + + The base for all all Entity Data Model (EDM) types that represent a type from the EDM type system. + + + + + Represents an item in an Entity Data Model (EDM) . + + + + + The base for all all Entity Data Model (EDM) item types that with a Name property that represents a qualified (can be dotted) name. + + + + + The base for all all Entity Data Model (EDM) item types that with a property. + + + + + The base for all all Entity Data Model (EDM) types that support annotation using . + + + + + EdmDataModelItem is the base for all types in the Entity Data Model (EDM) metadata construction and modification API. + + + + + DataModelItem is the base for all types in the EDM metadata reflection, construction and modification API. + + + + + Gets an value indicating which Entity Data Model (EDM) concept is represented by this item. + + + + + IAnnotatedDataModelItem is implemented by model-specific base types for all types with an property. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets or sets the currently assigned annotations. + + + + + Returns all EdmItem children directly contained by this EdmItem. + + + + + INamedDataModelItem is implemented by model-specific base types for all types with a property. + + + + + Gets or sets the currently assigned name. + + + + + Gets or sets the currently assigned name. + + + + + Gets a value indicating whether this type is abstract. + + + + + Gets the optional base type of this type. + + + + + EdmStructuralMember is the base for all types that represent members of structural items in the Entity Data Model (EDM) metadata construction and modification API. + + + + + Represents information about a database connection. + + + + + Creates a new instance of DbConnectionInfo representing a connection that is specified in the application configuration file. + + The name of the connection string in the application configuration. + + + + Creates a new instance of DbConnectionInfo based on a connection string. + + The connection string to use for the connection. + The name of the provider to use for the connection. Use 'System.Data.SqlClient' for SQL Server. + + + + Gets the connection information represented by this instance. + + Configuration to use if connection comes from the configuration file. + + + + Instances of this class are used to create DbConnection objects for + SQL Server LocalDb based on a given database name or connection string. + + + An instance of this class can be set on the class or in the + app.config/web.config for the application to cause all DbContexts created with no + connection information or just a database name to use SQL Server LocalDb by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Implementations of this interface are used to create DbConnection objects for + a type of database server based on a given database name. + An Instance is set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use a certain type of database server by default. + Two implementations of this interface are provided: + is used to create connections to Microsoft SQL Server, including EXPRESS editions. + is used to create connections to Microsoft SQL + Server Compact Editions. + Other implementations for other database servers can be added as needed. + Note that implementations should be thread safe or immutable since they may + be accessed by multiple threads at the same time. + + + + + Creates a connection based on the given database name or connection string. + + The database name or connection string. + An initialized DbConnection. + + + + Creates a new instance of the connection factory for the given version of LocalDb. + For SQL Server 2012 LocalDb use "v11.0". + + The LocalDb version to use. + + + + Creates a new instance of the connection factory for the given version of LocalDb. + For SQL Server 2012 LocalDb use "v11.0". + + + The LocalDb version to use. + + The connection string to use for options to the database other than the 'Initial Catalog', + 'Data Source', and 'AttachDbFilename'. + The 'Initial Catalog' and 'AttachDbFilename' will be prepended to this string based on the + database name when CreateConnection is called. + The 'Data Source' will be set based on the LocalDbVersion argument. + + + + + Creates a connection for SQL Server LocalDb based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + The connection string to use for options to the database other than the 'Initial Catalog', + 'Data Source', and 'AttachDbFilename'. + The 'Initial Catalog' and 'AttachDbFilename' will be prepended to this string based on the + database name when CreateConnection is called. + The 'Data Source' will be set based on the LocalDbVersion argument. + The default is 'Integrated Security=True; MultipleActiveResultSets=True;'. + + + + + Encapsulates a cloned and store . Note that these + objects are disposable and should be used in a using block to ensure both the cloned context and the + cloned connection are disposed. + + + + + For mocking. + + + + + Creates a clone of the given . The underlying of + the context is also cloned and the given connection string is used for the connection string of + the cloned connection. + + + + + Finds the assemblies that were used for loading o-space types in the source context + and loads those assemblies in the cloned context. + + + + + Disposes both the underlying ObjectContext and its store connection. + + + + + The cloned context. + + + + + This is always the store connection of the underlying ObjectContext. + + + + + Represents setting the database initializer for a specific context type + + + + + Represents a parameter to be passed to a method + + + + + Represents a series of parameters to pass to a method + + + + + Adds a new parameter to the collection + Used for unit testing + + + + + Represents the configuration for a series of contexts + + + + + Adds a new context to the collection + Used for unit testing + + + + + Represents the configuration for a specific context type + + + + + Represents setting the default connection factory + + + + + Represents all Entity Framework related configuration + + + + + Handles creating databases either using the core provider or the Migrations pipeline. + + + + + Creates a database using the core provider (i.e. ObjectContext.CreateDatabase) or + by using Code First Migrations to create an empty database + and the perform an automatic migration to the current model. + Migrations is used if Code First is being used and the EF provider is for SQL Server + or SQL Compact. The core is used for non-Code First models and for other providers even + when using Code First. + + + + + A DbContext instance represents a combination of the Unit Of Work and Repository patterns such that + it can be used to query from a database and group together changes that will then be written + back to the store as a unit. + DbContext is conceptually similar to ObjectContext. + + + DbContext is usually used with a derived type that contains properties for + the root entities of the model. These sets are automatically initialized when the + instance of the derived class is created. This behavior can be modified by applying the + attribute to either the entire derived context + class, or to individual properties on the class. + + The Entity Data Model backing the context can be specified in several ways. When using the Code First + approach, the properties on the derived context are used to build a model + by convention. The protected OnModelCreating method can be overridden to tweak this model. More + control over the model used for the Model First approach can be obtained by creating a + explicitly from a and passing this model to one of the DbContext constructors. + + When using the Database First or Model First approach the Entity Data Model can be created using the + Entity Designer (or manually through creation of an EDMX file) and then this model can be specified using + entity connection string or an object. + + The connection to the database (including the name of the database) can be specified in several ways. + If the parameterless DbContext constructor is called from a derived context, then the name of the derived context + is used to find a connection string in the app.config or web.config file. If no connection string is found, then + the name is passed to the DefaultConnectionFactory registered on the class. The connection + factory then uses the context name as the database name in a default connection string. (This default connection + string points to .\SQLEXPRESS on the local machine unless a different DefaultConnectionFactory is registered.) + + Instead of using the derived context name, the connection/database name can also be specified explicitly by + passing the name to one of the DbContext constructors that takes a string. The name can also be passed in + the form "name=myname", in which case the name must be found in the config file or an exception will be thrown. + + Note that the connection found in the app.config or web.config file can be a normal database connection + string (not a special Entity Framework connection string) in which case the DbContext will use Code First. + However, if the connection found in the config file is a special Entity Framework connection string, then the + DbContext will use Database/Model First and the model specified in the connection string will be used. + + An existing or explicitly created DbConnection can also be used instead of the database/connection name. + + A can be applied to a class derived from DbContext to set the + version of conventions used by the context when it creates a model. If no attribute is applied then the + latest version of conventions will be used. + + + + + Interface implemented by objects that can provide an instance. + The class implements this interface to provide access to the underlying + ObjectContext. + + + + + Gets the object context. + + The object context. + + + + Constructs a new context instance using conventions to create the name of the database to + which a connection will be made. The by-convention name is the full name (namespace + class name) + of the derived context class. + See the class remarks for how this is used to create a connection. + + + + + Constructs a new context instance using conventions to create the name of the database to + which a connection will be made, and initializes it from the given model. + The by-convention name is the full name (namespace + class name) of the derived context class. + See the class remarks for how this is used to create a connection. + + The model that will back this context. + + + + Constructs a new context instance using the given string as the name or connection string for the + database to which a connection will be made. + See the class remarks for how this is used to create a connection. + + Either the database name or a connection string. + + + + Constructs a new context instance using the given string as the name or connection string for the + database to which a connection will be made, and initializes it from the given model. + See the class remarks for how this is used to create a connection. + + Either the database name or a connection string. + The model that will back this context. + + + + Constructs a new context instance using the existing connection to connect to a database. + The connection will not be disposed when the context is disposed. + + An existing connection to use for the new context. + If set to true the connection is disposed when + the context is disposed, otherwise the caller must dispose the connection. + + + + Constructs a new context instance using the existing connection to connect to a database, + and initializes it from the given model. + The connection will not be disposed when the context is disposed. + An existing connection to use for the new context. + The model that will back this context. + If set to true the connection is disposed when + the context is disposed, otherwise the caller must dispose the connection. + + + + + Constructs a new context instance around an existing ObjectContext. + An existing ObjectContext to wrap with the new context. + If set to true the ObjectContext is disposed when + the DbContext is disposed, otherwise the caller must dispose the connection. + + + + + Initializes the internal context, discovers and initializes sets, and initializes from a model if one is provided. + + + + + Discovers DbSets and initializes them. + + + + + This method is called when the model for a derived context has been initialized, but + before the model has been locked down and used to initialize the context. The default + implementation of this method does nothing, but it can be overridden in a derived class + such that the model can be further configured before it is locked down. + + + Typically, this method is called only once when the first instance of a derived context + is created. The model for that context is then cached and is for all further instances of + the context in the app domain. This caching can be disabled by setting the ModelCaching + property on the given ModelBuidler, but note that this can seriously degrade performance. + More control over caching is provided through use of the DbModelBuilder and DbContextFactory + classes directly. + + The builder that defines the model for the context being created. + + + + Internal method used to make the call to the real OnModelCreating method. + + The model builder. + + + + Returns a DbSet instance for access to entities of the given type in the context, + the ObjectStateManager, and the underlying store. + + + See the DbSet class for more details. + + The type entity for which a set should be returned. + A set for the given entity type. + + + + Returns a non-generic DbSet instance for access to entities of the given type in the context, + the ObjectStateManager, and the underlying store. + + The type of entity for which a set should be returned. + A set for the given entity type. + + See the DbSet class for more details. + + + + + Saves all changes made in this context to the underlying database. + + The number of objects written to the underlying database. + Thrown if the context has been disposed. + + + + Validates tracked entities and returns a Collection of containing validation results. + + + Collection of validation results for invalid entities. The collection is never null and must not contain null + values or results for valid entities. + + + 1. This method calls DetectChanges() to determine states of the tracked entities unless + DbContextConfiguration.AutoDetectChangesEnabled is set to false. + 2. By default only Added on Modified entities are validated. The user is able to change this behavior + by overriding ShouldValidateEntity method. + + + + + Extension point allowing the user to override the default behavior of validating only + added and modified entities. + + DbEntityEntry instance that is supposed to be validated. + true to proceed with validation. false otherwise. + + + + Extension point allowing the user to customize validation of an entity or filter out validation results. + Called by . + + DbEntityEntry instance to be validated. + User defined dictionary containing additional info for custom validation. + It will be passed to + and will be exposed as . + This parameter is optional and can be null. + Entity validation result. Possibly null when overridden. + + + + Internal method that calls the protected ValidateEntity method. + + DbEntityEntry instance to be validated. + User defined dictionary containing additional info for custom validation. + It will be passed to + and will be exposed as . + This parameter is optional and can be null. + Entity validation result. Possibly null when ValidateEntity is overridden. + + + + Gets a object for the given entity providing access to + information about the entity and the ability to perform actions on the entity. + + The type of the entity. + The entity. + An entry for the entity. + + + + Gets a object for the given entity providing access to + information about the entity and the ability to perform actions on the entity. + + The entity. + An entry for the entity. + + + + Calls the protected Dispose method. + + + + + Disposes the context. The underlying is also disposed if it was created + is by this context or ownership was passed to this context when this context was created. + The connection to the database ( object) is also disposed if it was created + is by this context or ownership was passed to this context when this context was created. + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Creates a Database instance for this context that allows for creation/deletion/existence checks + for the underlying database. + + + + + Returns the Entity Framework ObjectContext that is underlying this context. + + Thrown if the context has been disposed. + + + + Provides access to features of the context that deal with change tracking of entities. + + An object used to access features that deal with change tracking. + + + + Provides access to configuration options for the context. + + An object used to access configuration options. + + + + Provides access to the underlying InternalContext for other parts of the internal design. + + + + + A simple representation of an app.config or web.config file. + + + + + Initializes a new instance of AppConfig based on supplied configuration + + Configuration to load settings from + + + + Initializes a new instance of AppConfig based on supplied connection strings + The default configuration for database initializers and default connection factory will be used + + Connection strings to be used + + + + Initializes a new instance of AppConfig based on the for the AppDomain + + + Use AppConfig.DefaultInstance instead of this constructor + + + + + Appies any database intializers specified in the configuration + + + + + Appies any database intializers specified in the configuration + + + Value indicating if initializers should be re-applied if they have already been applied in this AppDomain + + + + + Gets the specified connection string from the configuration + + Name of the connection string to get + The connection string, or null if there is no connection string with the specified name + + + + Gets the default connection factory based on the configuration + + + + + Gets a singleton instance of configuration based on the for the AppDomain + + + + + Acts as a proxy for that for the most part just passes calls + through to the real object but uses virtual methods/properties such that uses of the object + can be mocked. + + + + + Encapsulates information read from the application config file that specifies a database initializer + and allows that initializer to be dynamically applied. + + + + + Initializes a new instance of the class. + + The key from the entry in the config file. + The value from the enrty in the config file. + + + + Uses the context type and initializer type specified in the config to create an initializer instance + and set it with the DbDbatabase.SetInitializer method. + + + + + Reads all initializers from the application config file and sets them using the Database class. + + + + + Calculates the model hash values used the EdmMetadata table from EF 4.1/4.2. + + + + + Calculates an SHA256 hash of the EDMX from the given code first model. This is the hash stored in + the database in the EdmMetadata table in EF 4.1/4.2. The hash is always calculated using a v2 schema + as was generated by EF 4.1/4.2 and with the entity included in the model. + + + + + Acts as a proxy for that for the most part just passes calls + through to the real object but uses virtual methods/properties such that uses of the object + can be mocked. + + + + + An implementation of that will use Code First Migrations + to update the database to the latest version. + + + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + Initializes a new instance of the MigrateDatabaseToLatestVersion class. + + + + + Initializes a new instance of the MigrateDatabaseToLatestVersion class that will + use a specific connection string from the configuration file to connect to + the database to perform the migration. + + The name of the connection string to use for migration. + + + + + + + Helper class that is used to configure a column. + + + + + Creates a new column definition to store Binary data. + + Value indicating whether or not the column allows null values. + The maximum allowable length of the array data. + Value indicating whether or not all data should be padded to the maximum length. + Value indicating whether or not the maximum length supported by the database provider should be used. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + Value indicating whether or not this column should be configured as a timestamp. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Boolean data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Byte data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store DateTime data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Decimal data. + + Value indicating whether or not the column allows null values. + The numeric precision of the column. + The numeric scale of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + Value indicating whether or not the database will generate values for this column during insert. + The newly constructed column definition. + + + + Creates a new column definition to store Double data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store GUID data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Single data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Short data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Integer data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Long data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store String data. + + Value indicating whether or not the column allows null values. + The maximum allowable length of the string data. + Value indicating whether or not all data should be padded to the maximum length. + Value indicating whether or not the maximum length supported by the database provider should be used. + Value indicating whether or not the column supports Unicode content. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Time data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store DateTimeOffset data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Helper class that is used to further configure a table being created from a CreateTable call on . + + + + + Initializes a new instance of the TableBuilder class. + + The table creation operation to be further configured. + The migration the table is created in. + + + + Specifies a primary key for the table. + + + A lambda expression representing the property to be used as the primary key. + C#: t => t.Id + VB.Net: Function(t) t.Id + + If the primary key is made up of multiple properties then specify an anonymous type including the properties. + C#: t => new { t.Id1, t.Id2 } + VB.Net: Function(t) New With { t.Id1, t.Id2 } + + + The name of the primary key. + If null is supplied, a default name will be generated. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Specifies an index to be created on the table. + + + A lambda expression representing the property to be indexed. + C#: t => t.PropertyOne + VB.Net: Function(t) t.PropertyOne + + If multiple properties are to be indexed then specify an anonymous type including the properties. + C#: t => new { t.PropertyOne, t.PropertyTwo } + VB.Net: Function(t) New With { t.PropertyOne, t.PropertyTwo } + + A value indicating whether or not this is a unique index. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Specifies a foreign key constraint to be created on the table. + + Name of the table that the foreign key constraint targets. + + A lambda expression representing the properties of the foreign key. + C#: t => t.PropertyOne + VB.Net: Function(t) t.PropertyOne + + If multiple properties make up the foreign key then specify an anonymous type including the properties. + C#: t => new { t.PropertyOne, t.PropertyTwo } + VB.Net: Function(t) New With { t.PropertyOne, t.PropertyTwo } + + A value indicating whether or not cascade delete should be configured on the foreign key constraint. + + + The name of this foreign key constraint. + If no name is supplied, a default name will be calculated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Base class for code-based migrations. + + + + + Operations to be performed during the upgrade process. + + + + + Operations to be performed during the downgrade process. + + + + + Adds an operation to create a new table. + + + The columns in this create table operation. + You do not need to specify this type, it will be inferred from the columnsAction parameter you supply. + + The name of the table. Schema name is optional, if no schema is specified then dbo is assumed. + + An action that specifies the columns to be included in the table. + i.e. t => new { Id = t.Int(identity: true), Name = t.String() } + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + An object that allows further configuration of the table creation operation. + + + + Adds an operation to create a new foreign key constraint. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key column. + + The table that contains the column this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The column this foreign key references. + If no value is supplied the primary key of the principal table will be referenced. + + + A value indicating if cascade delete should be configured for the foreign key relationship. + If no value is supplied, cascade delete will be off. + + + The name of the foreign key constraint in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new foreign key constraint. + + + The table that contains the foreign key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key columns. + + The table that contains the columns this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The columns this foreign key references. + If no value is supplied the primary key of the principal table will be referenced. + + + A value indicating if cascade delete should be configured for the foreign key relationship. + If no value is supplied, cascade delete will be off. + + + The name of the foreign key constraint in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on its name. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the foreign key constraint in the database. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on the column it targets. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key column. + + The table that contains the column this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + The columns this foreign key references. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on the columns it targets. + + + The table that contains the foreign key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key columns. + + The table that contains the columns this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + The columns this foreign key references. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a table. + + + The name of the table to be dropped. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to move a table to a new schema. + + + The name of the table to be moved. + Schema name is optional, if no schema is specified then dbo is assumed. + + The schema the table is to be moved to. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to rename a table. To change the schema of a table use MoveTable + + + The name of the table to be renamed. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The new name for the table. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to rename a column. + + + The name of the table that contains the column to be renamed. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be renamed. + The new name for the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to add a column to an existing table. + + + The name of the table to add the column to. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The name of the column to be added. + + + An action that specifies the column to be added. + i.e. c => c.Int(nullable: false, defaultValue: 3) + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing column. + + + The name of the table to drop the column from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to alter the definition of an existing column. + + + The name of the table the column exists in. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be changed. + + An action that specifies the new definition for the column. + i.e. c => c.String(nullable: false, defaultValue: "none") + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new primary key. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The primary key column. + + The name of the primary key in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new primary key based on multiple columns. + + + The table that contains the primary key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The primary key columns. + + The name of the primary key in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing primary key that does not have the default name. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the primary key to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing primary key that was created with the default name. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create an index on a single column. + + + The name of the table to create the index on. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to create the index on. + + A value indicating if this is a unique index. + If no value is supplied a non-unique index will be created. + + + The name to use for the index in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create an index on multiple columns. + + + The name of the table to create the index on. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the columns to create the index on. + + A value indicating if this is a unique index. + If no value is supplied a non-unique index will be created. + + + The name to use for the index in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an index based on its name. + + + The name of the table to drop the index from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the index to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an index based on the columns it targets. + + + The name of the table to drop the index from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column(s) the index targets. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to execute a SQL command. + + The SQL to be executed. + + A value indicating if the SQL should be executed outside of the + transaction being used for the migration process. + If no value is supplied the SQL will be executed within the transaction. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Configuration relating to the use of migrations for a given model. + You will typically create a configuration class that derives + from rather than + using this class. + + + + + Initializes a new instance of the DbMigrationsConfiguration class. + + + + + Adds a new SQL generator to be used for a given database provider. + + Name of the database provider to set the SQL generator for. + The SQL generator to be used. + + + + Gets the SQL generator that is set to be used with a given database provider. + + Name of the database provider to get the SQL generator for. + The SQL generator that is set for the database provider. + + + + Gets or sets a value indicating if automatic migrations can be used when migration the database. + + + + + Gets or sets a value indicating if data loss is acceptable during automatic migration. + If set to false an exception will be thrown if data loss may occur as part of an automatic migration. + + + + + Gets or sets the derived DbContext representing the model to be migrated. + + + + + Gets or sets the namespace used for code-based migrations. + + + + + Gets or sets the sub-directory that code-based migrations are stored in. + + + + + Gets or sets the code generator to be used when scaffolding migrations. + + + + + Gets or sets the assembly containing code-based migrations. + + + + + Gets or sets a value to override the connection of the database to be migrated. + + + + + Gets or sets the timeout value used for the individual commands within a + migration. A null value indicates that the default value of the underlying + provider will be used. + + + + + Configuration relating to the use of migrations for a given model. + + The context representing the model that this configuration applies to. + + + + Initializes a new instance of the DbMigrationsConfiguration class. + + + + + Runs after upgrading to the latest migration to allow seed data to be updated. + + Context to be used for updating seed data. + + + + DbMigrator is used to apply existing migrations to a database. + DbMigrator can be used to upgrade and downgrade to any given migration. + To scaffold migrations based on changes to your model use + + + + + Base class for decorators that wrap the core + + + + + Initializes a new instance of the MigratorBase class. + + The migrator that this decorator is wrapping. + + + + Gets a list of the pending migrations that have not been applied to the database. + + List of migration Ids + + + + Updates the target database to the latest migration. + + + + + Updates the target database to a given migration. + + The migration to upgrade/downgrade to. + + + + Gets a list of the migrations that are defined in the assembly. + + List of migration Ids + + + + Gets a list of the migrations that have been applied to the database. + + List of migration Ids + + + + Gets the configuration being used for the migrations process. + + + + + Migration Id representing the state of the database before any migrations are applied. + + + + + Initializes a new instance of the DbMigrator class. + + Configuration to be used for the migration process. + + + + Gets all migrations that are defined in the configured migrations assembly. + + + + + Gets all migrations that have been applied to the target database. + + + + + Gets all migrations that are defined in the assembly but haven't been applied to the target database. + + + + + Updates the target database to a given migration. + + The migration to upgrade/downgrade to. + + + + Gets the configuration that is being used for the migration process. + + + + + A set of extension methods for + + + + + Adds or updates entities by key when SaveChanges is called. Equivalent to an "upsert" operation + from database terminology. + This method can useful when seeding data using Migrations. + + The entities to add or update. + + When the parameter is a custom or fake IDbSet implementation, this method will + attempt to locate and invoke a public, instance method with the same signature as this extension method. + + + + + Adds or updates entities by a custom identification expression when SaveChanges is called. + Equivalent to an "upsert" operation from database terminology. + This method can useful when seeding data using Migrations. + + + An expression specifying the properties that should be used when determining + whether an Add or Update operation should be performed. + + The entities to add or update. + + When the parameter is a custom or fake IDbSet implementation, this method will + attempt to locate and invoke a public, instance method with the same signature as this extension method. + + + + + Generates C# code for a code-based migration. + + + + + Base class for providers that generate code for code-based migrations. + + + + + Generates the code that should be added to the users project. + + Unique identifier of the migration. + Operations to be performed by the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Gets the namespaces that must be output as "using" or "Imports" directives to handle + the code generated by the given operations. + + The operations for which code is going to be generated. + An ordered list of namespace names. + + + + Gets the default namespaces that must be output as "using" or "Imports" directives for + any code generated. + + A value indicating if this class is being generated for a code-behind file. + An ordered list of namespace names. + + + + + + + Generates the primary code file that the user can view and edit. + + Operations to be performed by the migration. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates the code behind file with migration metadata. + + Unique identifier of the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates a property to return the source or target model in the code behind file. + + Name of the property. + Value to be returned. + Text writer to add the generated code to. + + + + Generates a namespace, using statements and class definition. + + Namespace that code should be generated in. + Name of the class that should be generated. + Text writer to add the generated code to. + Base class for the generated class. + A value indicating if this class is being generated for a code-behind file. + Namespaces for which using directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used. + + + + Generates the closing code for a class that was started with WriteClassStart. + + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify a set of column names using a lambda expression. + + The columns to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify the definition for a . + + The column definition to generate code for. + Text writer to add the generated code to. + A value indicating whether to include the column name in the definition. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column of unknown data type. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Removes any invalid characters from the name of an database artifact. + + The name to be scrubbed. + The scrubbed name. + + + + Gets the type name to use for a column of the given data type. + + The data type to translate. + The type name to use in the generated migration. + + + + Quotes an identifier using appropriate escaping to allow it to be stored in a string. + + The identifier to be quoted. + The quoted identifier. + + + + Scaffolds code-based migrations to apply pending model changes to the database. + + + + + Initializes a new instance of the MigrationScaffolder class. + + Configuration to be used for scaffolding. + + + + Scaffolds a code based migration to apply any pending model changes to the database. + + The name to use for the scaffolded migration. + The scaffolded migration. + + + + Scaffolds a code based migration to apply any pending model changes to the database. + + The name to use for the scaffolded migration. + Whether or not to include model changes. + The scaffolded migration. + + + + Scaffolds the initial code-based migration corresponding to a previously run database initializer. + + The scaffolded migration. + + + + Gets or sets the namespace used in the migration's generated code. + + By default, this is the same as MigrationsNamespace on the migrations + configuration object passed into the constructor. For VB.NET projects, this + will need to be updated to take into account the project's root namespace. + + + + + Represents a code-based migration that has been scaffolded and is ready to be written to a file. + + + + + Gets or sets the unique identifier for this migration. + Typically used for the file name of the generated code. + + + + + Gets or sets the scaffolded migration code that the user can edit. + + + + + Gets or sets the scaffolded migration code that should be stored in a code behind file. + + + + + Gets or sets the programming language used for this migration. + Typically used for the file extension of the generated code. + + + + + Gets or sets the subdirectory in the user's project that this migration should be saved in. + + + + + Gets a dictionary of string resources to add to the migration resource file. + + + + + Represents an exception that occurred while running an operation in another AppDomain in the . + + + + + Initializes a new instance of the ToolingException class. + + Error that explains the reason for the exception. + The type of the exception that was thrown. + The stack trace of the exception that was thrown. + + + + + + + + + + Gets the type of the exception that was thrown. + + + + + Gets the stack trace of the exception that was thrown. + + + + + Helper class that is used by design time tools to run migrations related + commands that need to interact with an application that is being edited + in Visual Studio. + + Because the application is being edited the assemblies need to + be loaded in a separate AppDomain to ensure the latest version + is always loaded. + + The App/Web.config file from the startup project is also copied + to ensure that any configuration is applied. + + + + + Initializes a new instance of the ToolingFacade class. + + + The name of the assembly that contains the migrations configuration to be used. + + + The namespace qualified name of migrations configuration to be used. + + + The working directory containing the compiled assemblies. + + + The path of the config file from the startup project. + + + The path of the application data directory from the startup project. + Typically the App_Data directory for web applications or the working directory for executables. + + + The connection to the database to be migrated. + If null is supplied, the default connection for the context will be used. + + + + + Releases all unmanaged resources used by the facade. + + + + + Gets the fully qualified name of all types deriving from . + + All context types found. + + + + Gets the fully qualified name of a type deriving from . + + The name of the context type. If null, the single context type found in the assembly will be returned. + The context type found. + + + + Gets a list of all migrations that have been applied to the database. + + Ids of applied migrations. + + + + Gets a list of all migrations that have not been applied to the database. + + Ids of pending migrations. + + + + Updates the database to the specified migration. + + + The Id of the migration to migrate to. + If null is supplied, the database will be updated to the latest migration. + + Value indicating if data loss during automatic migration is acceptable. + + + + Generates a SQL script to migrate between two migrations. + + + The migration to update from. + If null is supplied, a script to update the current database will be produced. + + + The migration to update to. + If null is supplied, a script to update to the latest migration will be produced. + + Value indicating if data loss during automatic migration is acceptable. + The generated SQL script. + + + + Scaffolds a code-based migration to apply any pending model changes. + + The name for the generated migration. + The programming language of the generated migration. + The root namespace of the project the migration will be added to. + Whether or not to include model changes. + The scaffolded migration. + + + + Scaffolds the initial code-based migration corresponding to a previously run database initializer. + + The programming language of the generated migration. + The root namespace of the project the migration will be added to. + The scaffolded migration. + + + + + + + Releases all resources used by the facade. + + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + + Gets or sets an action to be run to log information. + + + + + Gets or sets an action to be run to log warnings. + + + + + Gets or sets an action to be run to log verbose information. + + + + + Base class for loggers that can be used for the migrations process. + + + + + Logs an informational message. + + The message to be logged. + + + + Logs a warning that the user should be made aware of. + + The message to be logged. + + + + Logs some additional information that should only be presented to the user if they request verbose output. + + The message to be logged. + + + + Generates VB.Net code for a code-based migration. + + + + + + + + Generates the primary code file that the user can view and edit. + + Operations to be performed by the migration. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates the code behind file with migration metadata. + + Unique identifier of the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates a property to return the source or target model in the code behind file. + + Name of the property. + Value to be returned. + Text writer to add the generated code to. + + + + Generates a namespace, using statements and class definition. + + Namespace that code should be generated in. + Name of the class that should be generated. + Text writer to add the generated code to. + Base class for the generated class. + A value indicating if this class is being generated for a code-behind file. + Namespaces for which Imports directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used. + + + + Generates the closing code for a class that was started with WriteClassStart. + + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify a set of column names using a lambda expression. + + The columns to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify the definition for a . + + The column definition to generate code for. + Text writer to add the generated code to. + A value indicating whether to include the column name in the definition. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column of unknown data type. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Removes any invalid characters from the name of an database artifact. + + The name to be scrubbed. + The scrubbed name. + + + + Gets the type name to use for a column of the given data type. + + The data type to translate. + The type name to use in the generated migration. + + + + Quotes an identifier using appropriate escaping to allow it to be stored in a string. + + The identifier to be quoted. + The quoted identifier. + + + + This class is used by Code First Migrations to read and write migration history + from the database. It is not intended to be used by other code and is only public + so that it can be accessed by EF when running under partial trust. It may be + changed or removed in the future. + + + + + Gets or sets the Id of the migration this row represents. + + + + + Gets or sets the date and time that this migrations history entry was created. + + + + + Gets or sets the state of the model after this migration was applied. + + + + + Gets or sets the version of Entity Framework that created this entry. + + + + + This is a version of the HistoryContext that still includes CreatedOn in its model. + It is used when figuring out whether or not the CreatedOn column exists and so should + be dropped. + + + + + Represents an error that occurs when an automatic migration would result in data loss. + + + + + Represents errors that occur inside the Code First Migrations pipeline. + + + + + Initializes a new instance of the MigrationsException class. + + + + + Initializes a new instance of the MigrationsException class. + + The message that describes the error. + + + + Initializes a new instance of the MigrationsException class. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the MigrationsException class with serialized data. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + + + Initializes a new instance of the AutomaticDataLossException class. + + The message that describes the error. + + + + Represents an error that occurs when there are pending model changes after applying the last migration and automatic migration is disabled. + + + + + Initializes a new instance of the AutomaticMigrationsDisabledException class. + + The message that describes the error. + + + + Provides additional metadata about a code-based migration. + + + + + Gets the unique identifier for the migration. + + + + + Gets the state of the model before this migration is run. + + + + + Gets the state of the model after this migration is run. + + + + + Decorator to provide logging during migrations operations.. + + + + + Initializes a new instance of the MigratorLoggingDecorator class. + + The migrator that this decorator is wrapping. + The logger to write messages to. + + + + Decorator to produce a SQL script instead of applying changes to the database. + Using this decorator to wrap will prevent + from applying any changes to the target database. + + + + + Initializes a new instance of the MigratorScriptingDecorator class. + + The migrator that this decorator is wrapping. + + + + + Represents a column being added to a table. + + + + + Represents an operation to modify a database schema. + + + + + Initializes a new instance of the MigrationOperation class. + + + + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets additional arguments that may be processed by providers. + + + + + Gets an operation that will revert this operation. + + + + + Gets a value indicating if this operation may result in data loss. + + + + + Initializes a new instance of the AddColumnOperation class. + + The name of the table the column should be added to. + Details of the column being added. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column should be added to. + + + + + Gets the details of the column being added. + + + + + Gets an operation that represents dropping the added column. + + + + + + + + Represents a foreign key constraint being added to a table. + + + + + Base class for changes that affect foreign key constraints. + + + + + Initializes a new instance of the ForeignKeyOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the name of the table that the foreign key constraint targets. + + + + + Gets or sets the name of the table that the foreign key columns exist in. + + + + + The names of the foreign key column(s). + + + + + Gets a value indicating if a specific name has been supplied for this foreign key constraint. + + + + + Gets or sets the name of this foreign key constraint. + If no name is supplied, a default name will be calculated. + + + + + Initializes a new instance of the AddForeignKeyOperation class. + The PrincipalTable, PrincipalColumns, DependentTable and DependentColumns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to create an index on the foreign key column(s). + + An operation to add the index. + + + + The names of the column(s) that the foreign key constraint should target. + + + + + Gets or sets a value indicating if cascade delete should be configured on the foreign key constraint. + + + + + Gets an operation to drop the foreign key constraint. + + + + + + + + Represents adding a primary key to a table. + + + + + Common base class to represent operations affecting primary keys. + + + + + Initializes a new instance of the PrimaryKeyOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the name of the table that contains the primary key. + + + + + Gets the column(s) that make up the primary key. + + + + + Gets a value indicating if a specific name has been supplied for this primary key. + + + + + Gets or sets the name of this primary key. + If no name is supplied, a default name will be calculated. + + + + + + + + Initializes a new instance of the AddPrimaryKeyOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to drop the primary key. + + + + + Represents altering an existing column. + + + + + Initializes a new instance of the AlterColumnOperation class. + + The name of the table that the column belongs to. + Details of what the column should be altered to. + Value indicating if this change will result in data loss. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the AlterColumnOperation class. + + The name of the table that the column belongs to. + Details of what the column should be altered to. + Value indicating if this change will result in data loss. + An operation to revert this alteration of the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table that the column belongs to. + + + + + Gets the new definition for the column. + + + + + Gets an operation that represents reverting the alteration. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents information about a column. + + + + + Initializes a new instance of the class. + + The data type for this column. + + + + Initializes a new instance of the class. + + The data type for this column. + + Additional details about the data type. + This includes details such as maximum length, nullability etc. + + + + + Determines if this column is a narrower data type than another column. + Used to determine if altering the supplied column definition to this definition will result in data loss. + + The column to compare to. + Details of the database provider being used. + True if this column is of a narrower data type. + + + + Gets the data type for this column. + + + + + Gets the CLR type corresponding to the database type of this column. + + + + + Gets the default value for the CLR type corresponding to the database type of this column. + + + + + Gets additional details about the data type of this column. + This includes details such as maximum length, nullability etc. + + + + + Gets or sets the name of the column. + + + + + Gets or sets a provider specific data type to use for this column. + + + + + Gets or sets a value indicating if this column can store null values. + + + + + Gets or sets a value indicating if values for this column will be generated by the database using the identity pattern. + + + + + Gets or sets the maximum length for this column. + Only valid for array data types. + + + + + Gets or sets the precision for this column. + Only valid for decimal data types. + + + + + Gets or sets the scale for this column. + Only valid for decimal data types. + + + + + Gets or sets a constant value to use as the default value for this column. + + + + + Gets or sets a SQL expression used as the default value for this column. + + + + + Gets or sets a value indicating if this column is fixed length. + Only valid for array data types. + + + + + Gets or sets a value indicating if this column supports Unicode characters. + Only valid for textual data types. + + + + + Gets or sets a value indicating if this column should be configured as a timestamp. + + + + + Represents creating a database index. + + + + + Common base class for operations affecting indexes. + + + + + Initializes a new instance of the IndexOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the table the index belongs to. + + + + + Gets or sets the columns that are indexed. + + + + + Gets a value indicating if a specific name has been supplied for this index. + + + + + Gets or sets the name of this index. + If no name is supplied, a default name will be calculated. + + + + + Initializes a new instance of the CreateIndexOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets a value indicating if this is a unique index. + + + + + Gets an operation to drop this index. + + + + + + + + Represents creating a table. + + + + + Initializes a new instance of the CreateTableOperation class. + + Name of the table to be created. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be created. + + + + + Gets the columns to be included in the new table. + + + + + Gets or sets the primary key for the new table. + + + + + Gets an operation to drop the table. + + + + + + + + Represents deleting a new record from the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Common base class for operations that affect the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Initializes a new instance of the HistoryOperation class. + + Name of the migrations history table. + Name of the migration being affected. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the migrations history table. + + + + + Gets the name of the migration being affected. + + + + + + + + Initializes a new instance of the DeleteHistoryOperation class. + + Name of the migrations history table. + Id of the migration record to be deleted. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Represents a column being dropped from a table. + + + + + Initializes a new instance of the DropColumnOperation class. + + The name of the table the column should be dropped from. + The name of the column to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropColumnOperation class. + + The name of the table the column should be dropped from. + The name of the column to be dropped. + The operation that represents reverting the drop operation. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column should be dropped from. + + + + + Gets the name of the column to be dropped. + + + + + Gets an operation that represents reverting dropping the column. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents a foreign key constraint being dropped from a table. + + + + + Initializes a new instance of the DropForeignKeyOperation class. + The PrincipalTable, DependentTable and DependentColumns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropForeignKeyOperation class. + + The operation that represents reverting dropping the foreign key constraint. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to drop the associated index on the foreign key column(s). + + An operation to drop the index. + + + + Gets an operation that represents reverting dropping the foreign key constraint. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents dropping an existing index. + + + + + Initializes a new instance of the DropIndexOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropIndexOperation class. + + The operation that represents reverting dropping the index. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation that represents reverting dropping the index. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents dropping a primary key from a table. + + + + + Initializes a new instance of the DropPrimaryKeyOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to add the primary key. + + + + + Represents dropping an existing table. + + + + + Initializes a new instance of the DropTableOperation class. + + The name of the table to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropTableOperation class. + + The name of the table to be dropped. + An operation that represents reverting dropping the table. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be dropped. + + + + + Gets an operation that represents reverting dropping the table. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents inserting a new record into the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Initializes a new instance of the InsertHistoryOperation class. + + Name of the migrations history table. + Id of the migration record to be inserted. + Value to be stored in the model column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the value to store in the history table representing the target model of the migration. + + + + + Gets the value to store in the history table indicating the version of Entity Framework used to produce this migration. + + + + + + + + Represents moving a table from one schema to another. + + + + + Initializes a new instance of the MoveTableOperation class. + + Name of the table to be moved. + Name of the schema to move the table to. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be moved. + + + + + Gets the name of the schema to move the table to. + + + + + Gets an operation that moves the table back to its original schema. + + + + + + + + Represents renaming an existing column. + + + + + Initializes a new instance of the RenameColumnOperation class. + + Name of the table the column belongs to. + Name of the column to be renamed. + New name for the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column belongs to. + + + + + Gets the name of the column to be renamed. + + + + + Gets the new name for the column. + + + + + Gets an operation that reverts the rename. + + + + + + + + Represents renaming an existing table. + + + + + Initializes a new instance of the RenameTableOperation class. + + Name of the table to be renamed. + New name for the table. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be renamed. + + + + + Gets the new name for the table. + + + + + Gets an operation that reverts the rename. + + + + + + + + Represents a provider specific SQL statement to be executed directly against the target database. + + + + + Initializes a new instance of the SqlOperation class. + + The SQL to be executed. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the SQL to be executed. + + + + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + + + + Common base class for providers that convert provider agnostic migration + operations into database provider specific SQL commands. + + + + + Converts a set of migration operations into database provider specific SQL. + + The operations to be converted. + Token representing the version of the database being targeted. + A list of SQL statements to be executed to perform the migration operations. + + + + Represents a migration operation that has been translated into a SQL statement. + + + + + Gets or sets the SQL to be executed to perform this migration operation. + + + + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + Provider to convert provider agnostic migration operations into SQL commands + that can be run against Microsoft SQL Server Compact Edition. + + + + + Provider to convert provider agnostic migration operations into SQL commands + that can be run against a Microsoft SQL Server database. + + + + + Converts a set of migration operations into Microsoft SQL Server specific SQL. + + The operations to be converted. + Token representing the version of SQL Server being targeted (i.e. "2005", "2008"). + A list of SQL statements to be executed to perform the migration operations. + + + + Creates an empty connection for the current provider. + Allows derived providers to use connection other than . + + + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL to mark a table as a system table. + Generated SQL should be added using the Statement method. + + The table to mark as a system table. + + + + Generates SQL to create a database schema. + Generated SQL should be added using the Statement method. + + The name of the schema to create. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL to specify a constant byte[] default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant bool default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant DateTime default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant DateTimeOffset default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant Guid default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant string default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant TimeSpan default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify the data type of a column. + This method just generates the actual type, not the SQL to create the column. + + The definition of the column. + SQL representing the data type. + + + + Generates a quoted name. The supplied name may or may not contain the schema. + + The name to be quoted. + The quoted name. + + + + Quotes an identifier for SQL Server. + + The identifier to be quoted. + The quoted identifier. + + + + Adds a new Statement to be executed against the database. + + The statement to be executed. + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + Gets a new that can be used to build SQL. + + This is just a helper method to create a writer. Writing to the writer will + not cause SQL to be registered for execution. You must pass the generated + SQL to the Statement method. + + An empty text writer to use for SQL generation. + + + + Adds a new Statement to be executed against the database. + + The writer containing the SQL to be executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Utility class to prep the user's config file to run in an AppDomain + + + + + Updates a config file by adding binding redirects for EntityFramework.dll. + This ensures that the user's code can be ran in an AppDomain and the exact + same version of the assembly will be used for both domains. + + That path of the user's config file. Can also be null or a path to an non-existent file. + The path of the updated config file. It is the caller's responsibility to delete this. + + + + The same as but works in partial trust. + + + + + Specifies the default tab string. This field is constant. + + + + + Initializes a new instance of the IndentedTextWriter class using the specified text writer and default tab string. + + The to use for output. + + + + Initializes a new instance of the IndentedTextWriter class using the specified text writer and tab string. + + The to use for output. + The tab string to use for indentation. + + + + Closes the document being written to. + + + + + Flushes the stream. + + + + + Outputs the tab string once for each level of indentation according to the property. + + + + + Writes the specified string to the text stream. + + The string to write. + + + + Writes the text representation of a Boolean value to the text stream. + + The Boolean value to write. + + + + Writes a character to the text stream. + + The character to write. + + + + Writes a character array to the text stream. + + The character array to write. + + + + Writes a subarray of characters to the text stream. + + The character array to write data from. + Starting index in the buffer. + The number of characters to write. + + + + Writes the text representation of a Double to the text stream. + + The double to write. + + + + Writes the text representation of a Single to the text stream. + + The single to write. + + + + Writes the text representation of an integer to the text stream. + + The integer to write. + + + + Writes the text representation of an 8-byte integer to the text stream. + + The 8-byte integer to write. + + + + Writes the text representation of an object to the text stream. + + The object to write. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string. + The object to write into the formatted string. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string to use. + The first object to write into the formatted string. + The second object to write into the formatted string. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string to use. + The argument array to output. + + + + Writes the specified string to a line without tabs. + + The string to write. + + + + Writes the specified string, followed by a line terminator, to the text stream. + + The string to write. + + + + Writes a line terminator. + + + + + Writes the text representation of a Boolean, followed by a line terminator, to the text stream. + + The Boolean to write. + + + + Writes a character, followed by a line terminator, to the text stream. + + The character to write. + + + + Writes a character array, followed by a line terminator, to the text stream. + + The character array to write. + + + + Writes a subarray of characters, followed by a line terminator, to the text stream. + + The character array to write data from. + Starting index in the buffer. + The number of characters to write. + + + + Writes the text representation of a Double, followed by a line terminator, to the text stream. + + The double to write. + + + + Writes the text representation of a Single, followed by a line terminator, to the text stream. + + The single to write. + + + + Writes the text representation of an integer, followed by a line terminator, to the text stream. + + The integer to write. + + + + Writes the text representation of an 8-byte integer, followed by a line terminator, to the text stream. + + The 8-byte integer to write. + + + + Writes the text representation of an object, followed by a line terminator, to the text stream. + + The object to write. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string. + The object to write into the formatted string. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string to use. + The first object to write into the formatted string. + The second object to write into the formatted string. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string to use. + The argument array to output. + + + + Writes the text representation of a UInt32, followed by a line terminator, to the text stream. + + A UInt32 to output. + + + + Gets the encoding for the text writer to use. + + + An that indicates the encoding for the text writer to use. + + + + + Gets or sets the new line character to use. + + + The new line character to use. + + + + + Gets or sets the number of spaces to indent. + + + The number of spaces to indent. + + + + + Gets the to use. + + + The to use. + + + + + Used for generating values that are always in sequential + order for the calling thread. + + + + + Returns the value of unless this value would be the same as the + last value returned by this thread calling this method, in which case the thread pushes the value + a little bit into the future. The comparison is in terms of the form used to store migration ID + in the database--i.e. to the 1/10 second. + + + There should never be any pushing to the future involved for normal use of migrations, but when + this method is called in rapid succession while testing or otherwise calling the DbMigrator APIs + there may be occasional sleeping. + + + + + Same as UtcNow method bur returns the time in the timestamp format used in migration IDs. + + + + + Convention to apply column ordering specified via + or the API. This convention throws if a duplicate configured column order + is detected. + + + + + Convention to apply column ordering specified via + or the API. + + + + + Identifies conventions that can be removed from a instance. + + /// + Note that implementations of this interface must be immutable. + + + + + Strongly-typed and parameterized string resources. + + + + + A string like "Applying automatic migration: {0}." + + + + + A string like "Reverting automatic migration: {0}." + + + + + A string like "Applying code-based migration: {0}." + + + + + A string like "Reverting code-based migration: {0}." + + + + + A string like "Applying code-based migrations: [{1}]." + + + + + A string like "Reverting migrations: [{1}]." + + + + + A string like "Target database is already at version {0}." + + + + + A string like "Target database is: {0}." + + + + + A string like "'{1}' (DataSource: {0}, Provider: {2}, Origin: {3})" + + + + + A string like "The specified target migration '{0}' does not exist. Ensure that target migration refers to an existing migration id." + + + + + A string like "The Foreign Key on table '{0}' with columns '{1}' could not be created because the principal key columns could not be determined. Use the AddForeignKey fluent API to fully specify the Foreign Key." + + + + + A string like "'{0}' is not a valid target migration. When targeting a previously applied automatic migration, use the full migration id including timestamp." + + + + + A string like "'{0}' is not a valid migration. Code-based migrations must be used for both source and target when scripting the upgrade between them." + + + + + A string like "The target context '{0}' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory." + + + + + A string like "The specified migration name '{0}' is ambiguous. Specify the full migration id including timestamp instead." + + + + + A string like "The migrations configuration type '{0}' was not be found in the assembly '{1}'." + + + + + A string like "More than one migrations configuration type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the one to use." + + + + + A string like "No migrations configuration type was found in the assembly '{0}'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)." + + + + + A string like "More than one migrations configuration type was found in the assembly '{0}'. Specify the name of the one to use." + + + + + A string like "The type '{0}' is not a migrations configuration type." + + + + + A string like "The migrations configuration type '{0}' must have a public default constructor." + + + + + A string like "The migrations configuration type '{0}' must not be abstract." + + + + + A string like "The migrations configuration type '{0}' must not be generic." + + + + + A string like "In VB.NET projects, the migrations namespace '{0}' must be under the root namespace '{1}'. Update the migrations project's root namespace to allow classes under the migrations namespace to be added." + + + + + + A string like "No MigrationSqlGenerator found for provider '{0}'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators." + + + + + A string like "Could not load assembly '{0}'. (If you are using Code First Migrations inside Visual Studio this can happen if the startUp project for your solution does not reference the project that contains your migrations. You can either change the startUp project for your solution or use the -StartUpProjectName parameter.)" + + + + + A string like "No context type was found in the assembly '{0}'." + + + + + A string like "More than one context type was found in the assembly '{0}'." + + + + + A string like "To enable migrations for {0}, use Enable-Migrations -ContextTypeName {0}." + + + + + A string like "The context type '{0}' was not found in the assembly '{1}'." + + + + + A string like "More than one context type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the context." + + + + + A string like "The argument '{0}' cannot be null, empty or contain only white space." + + + + + A string like "The argument property '{0}' cannot be null." + + + + + A string like "The precondition '{0}' failed. {1}" + + + + + A string like "The type '{0}' has already been configured as a complex type. It cannot be reconfigured as an entity type." + + + + + A string like "The type '{0}' has already been configured as an entity type. It cannot be reconfigured as a complex type." + + + + + A string like "The key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + A string like "The foreign key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + A string like "The property '{0}' is not a declared property on type '{1}'. Verify that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property." + + + + + A string like "The navigation property '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property." + + + + + A string like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'." + + + + + A string like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. Use dotted paths for nested properties: C#: 't => t.MyProperty.MyProperty' VB.Net: 'Function(t) t.MyProperty.MyProperty'." + + + + + A string like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + A string like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + + A string like "Conflicting configuration settings were specified for property '{0}' on type '{1}': {2}" + + + + + A string like "Conflicting configuration settings were specified for column '{0}' on table '{1}': {2}" + + + + + A string like "{0} = {1} conflicts with {2} = {3}" + + + + + A string like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from ComplexObject." + + + + + A string like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject." + + + + + A string like "The navigation property '{0}' declared on type '{1}' cannot be the inverse of itself." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting foreign keys." + + + + + A string like "Values of incompatible types ('{1}' and '{2}') were assigned to the '{0}' discriminator column. Values of the same type must be specified. To explicitly specify the type of the discriminator column use the HasColumnType method." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting mapping information." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting cascade delete operations using 'WillCascadeOnDelete'." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting multiplicities." + + + + + A string like "The MaxLengthAttribute on property '{0}' on type '{1} is not valid. The Length value must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "The StringLengthAttribute on property '{0}' on type '{1}' is not valid. The maximum length must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "Unable to determine composite primary key ordering for type '{0}'. Use the ColumnAttribute or the HasKey method to specify an order for composite primary keys." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. Name must not be empty." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The foreign key name '{2}' was not found on the dependent type '{3}'. The Name value should be a comma separated list of foreign key property names." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The navigation property '{2}' was not found on the dependent type '{1}'. The Name value should be a valid navigation property name." + + + + + A string like "Unable to determine a composite foreign key ordering for foreign key on type {0}. When using the ForeignKey data annotation on composite foreign key properties ensure order is specified by using the Column data annotation or the fluent API." + + + + + A string like "The InversePropertyAttribute on property '{2}' on type '{3}' is not valid. The property '{0}' is not a valid navigation property on the related type '{1}'. Ensure that the property exists and is a valid reference or collection navigation property." + + + + + A string like "A relationship cannot be established from property '{0}' on type '{1}' to property '{0}' on type '{1}'. Check the values in the InversePropertyAttribute to ensure relationship definitions are unique and reference from one navigation property to its corresponding inverse navigation property." + + + + + A string like "\t{0}: {1}: {2}" + + + + + A string like "A key is registered for the derived type '{0}'. Keys can only be registered for the root type '{1}'." + + + + + A string like "The {0} value '{1}' already exists in the user-defined dictionary." + + + + + A string like "The type '{0}' has already been mapped to table '{1}'. Specify all mapping aspects of a table in a single Map call." + + + + + A string like "Map was called more than once for type '{0}' and at least one of the calls didn't specify the target table name." + + + + + A string like "The derived type '{0}' has already been mapped using the chaining syntax. A derived type can only be mapped once using the chaining syntax." + + + + + A string like "An "is not null" condition cannot be specified on property '{0}' on type '{1}' because this property is not included in the model. Check that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation." + + + + + A string like "Values of type '{0}' cannot be used as type discriminator values. Supported types include byte, signed byte, bool, int16, int32, int64, and string." + + + + + A string like "Unable to add the convention '{0}'. Could not find an existing convention of type '{1}' in the current convention set." + + + + + A string like "Not all properties for type '{0}' have been mapped. Either map those properties or explicitly excluded them from the model." + + + + + A string like "Unable to determine the provider name for connection of type '{0}'." + + + + + A string like "The qualified table name '{0}' contains an invalid schema name. Schema names must have a non-zero length." + + + + + A string like "The qualified table name '{0}' contains an invalid table name. Table names must have a non-zero length." + + + + + A string like "Properties for type '{0}' can only be mapped once. Ensure the MapInheritedProperties method is only used during one call to the Map method." + + + + + A string like "Properties for type '{0}' can only be mapped once. Ensure the Properties method is used and that repeated calls specify each non-key property only once." + + + + + A string like "Properties for type '{0}' can only be mapped once. The non-key property '{1}' is mapped more than once. Ensure the Properties method specifies each non-key property only once." + + + + + A string like "The property '{1}' on type '{0}' cannot be mapped because it has been explicitly excluded from the model or it is of a type not supported by the DbModelBuilderVersion being used." + + + + + A string like "The entity types '{0}' and '{1}' cannot share table '{2}' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them." + + + + + A string like "You cannot use Ignore method on the property '{0}' on type '{1}' because this type inherits from the type '{2}' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type." + + + + + A string like "The property '{0}' cannot be used as a key property on the entity '{1}' because the property type is not a valid key type. Only scalar types, string and byte[] are supported key types." + + + + + A string like "The specified table '{0}' was not found in the model. Ensure that the table name has been correctly specified." + + + + + A string like "The specified association foreign key columns '{0}' are invalid. The number of columns specified must match the number of primary key columns." + + + + + A string like "Unable to determine the principal end of an association between the types '{0}' and '{1}'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." + + + + + A string like "The abstract type '{0}' has no mapped descendents and so cannot be mapped. Either remove '{0}' from the model or add one or more types deriving from '{0}' to the model. " + + + + + A string like "The type '{0}' cannot be mapped as defined because it maps inherited properties from types that use entity splitting or another form of inheritance. Either choose a different inheritance mapping strategy so as to not map inherited properties, or change all types in the hierarchy to map inherited properties and to not use splitting. " + + + + + A string like "The table '{0}' was configured but is not used in any mappings. Verify the mapping configuration for '{0}' is correct." + + + + + A string like "The configured column orders for the table '{0}' contains duplicates. Ensure the specified column order values are distinct." + + + + + A string like "The enum or spatial property '{1}' on type '{0}' cannot be mapped. Use DbModelBuilderVersion 'V5_0' or later to map enum or spatial properties." + + + + + A string like "Multiple potential primary key properties named '{0}' but differing only by case were found on entity type '{1}'. Configure the primary key explicitly using the HasKey fluent API or the KeyAttribute data annotation." + + + + + A string like "Cannot get value for property '{0}' from entity of type '{1}' because the property has no get accessor." + + + + + A string like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor." + + + + + + A string like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor and is in the '{2}' state." + + + + + A string like "Member '{0}' cannot be called for property '{1}' on entity of type '{2}' because the property is not part of the Entity Data Model." + + + + + + A string like "Cannot call the {0} method for an entity of type '{1}' on a DbSet for entities of type '{2}'. Only entities of type '{2}' or derived from type '{2}' can be added, attached, or removed." + + + + + A string like "Cannot call the Create method for the type '{0}' on a DbSet for entities of type '{1}'. Only entities of type '{1}' or derived from type '{1}' can be created." + + + + + + + A string like "The property '{0}' on type '{1}' is a collection navigation property. The Collection method should be used instead of the Reference method." + + + + + A string like "The property '{0}' on type '{1}' is a reference navigation property. The Reference method should be used instead of the Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a navigation property. The Reference and Collection methods can only be used with navigation properties. Use the Property or ComplexProperty method." + + + + + A string like "The property '{0}' on type '{1}' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a complex property. The ComplexProperty method can only be used with complex properties. Use the Property, Reference or Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a primitive property, complex property, collection navigation property, or reference navigation property." + + + + + A string like ""The property '{0}' from the property path '{1}' is not a complex property on type '{2}'. Property paths must be composed of complex properties for all except the final property."" + + + + + A string like ""The property path '{0}' cannot be used for navigation properties. Property paths can only be used to access primitive or complex properties."" + + + + + A string like "The navigation property '{0}' on entity type '{1}' cannot be used for entities of type '{2}' because it refers to entities of type '{3}'." + + + + + A string like "The generic type argument '{0}' cannot be used with the Member method when accessing the collection navigation property '{1}' on entity type '{2}'. The generic type argument '{3}' must be used instead." + + + + + A string like "The property '{0}' on entity type '{1}' cannot be used for objects of type '{2}' because it is a property for objects of type '{3}'." + + + + + A string like "The expression passed to method {0} must represent a property defined on the type '{1}'." + + + + + A string like "{0} cannot be used for entities in the {1} state." + + + + + A string like "Cannot set non-nullable property '{0}' of type '{1}' to null on object of type '{2}'." + + + + + A string like "The property '{0}' in the entity of type '{1}' is null. Store values cannot be obtained for an entity with a null complex property." + + + + + A string like "Cannot assign value of type '{0}' to property '{1}' of type '{2}' in property values for type '{3}'." + + + + + A string like "The '{0}' property does not exist or is not mapped for the type '{1}'." + + + + + A string like "Cannot copy values from DbPropertyValues for type '{0}' into DbPropertyValues for type '{1}'." + + + + + A string like "Cannot copy from property values for object of type '{0}' into property values for object of type '{1}'." + + + + + A string like "The value of the complex property '{0}' on entity of type '{1}' is null. Complex properties cannot be set to null and values cannot be set for null complex properties." + + + + + A string like "The value of the nested property values property '{0}' on the values for entity of type '{1}' is null. Nested property values cannot be set to null and values cannot be set for null complex properties." + + + + + A string like "Cannot set the value of the nested property '{0}' because value of the complex property '{1}' to which it belongs is null." + + + + + A string like "Cannot set the original value of the nested property '{0}' because the original value of the complex property '{1}' to which it belongs is null." + + + + + A string like "The model backing the '{0}' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)." + + + + + A string like "Database '{0}' cannot be created because it already exists." + + + + + + + A string like "Failed to set database initializer of type '{0}' for DbContext type '{1}' specified in the application configuration. See inner exception for details." + + + + + A string like "Configuration for DbContext type '{0}' is specified multiple times in the application configuration. Each context can only be configured once." + + + + + A string like "Failed to set Database.DefaultConnectionFactory to an instance of the '{0}' type as specified in the application configuration. See inner exception for details." + + + + + A string like "The type '{0}' could not be found. The type name must be an assembly-qualified name." + + + + + A string like "The connection string '{0}' in the application's configuration file does not contain the required providerName attribute."" + + + + + A string like "The entity found was of type {0} when an entity of type {1} was requested." + + + + + A string like "The type '{0}' is mapped as a complex type. The Set method, DbSet objects, and DbEntityEntry objects can only be used with entity types, not complex types." + + + + + A string like "The type '{0}' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute." + + + + + A string like "The entity type {0} is not part of the model for the current context." + + + + + A string like "No connection string named '{0}' could be found in the application config file." + + + + + A string like "The collection navigation property '{0}' on the entity of type '{1}' cannot be set because the entity type does not define a navigation property with a set accessor." + + + + + A string like "Multiple object sets per type are not supported. The object sets '{0}' and '{1}' can both contain instances of type '{2}'." + + + + + A string like "The context type '{0}' must have a public constructor taking an EntityConnection." + + + + + A string like "An unexpected exception was thrown during validation of '{0}' when invoking {1}.IsValid. See the inner exception for details." + + + + + A string like "An unexpected exception was thrown during validation of '{0}' when invoking {1}.Validate. See the inner exception for details." + + + + + A string like "The database name '{0}' is not supported because it is an MDF file name. A full connection string must be provided to attach an MDF file." + + + + + A string like "The context factory type '{0}' must have a public default constructor." + + + + + A string like "The '{0}' property of EdmPrimitiveType is fixed and cannot be set." + + + + + A string like "The namespace '{0}' is a system namespace and cannot be used by other schemas. Choose another namespace name." + + + + + A string like "Role '{0}' in AssociationSets '{1}' and '{2}' refers to the same EntitySet '{3}' in EntityContainer '{4}'. Make sure that if two or more AssociationSets refer to the same AssociationType, the ends do not refer to the same EntitySet." + + + + + A string like "The referenced EntitySet '{0}' for End '{1}' could not be found in the containing EntityContainer." + + + + + A string like "Type '{0}' is derived from type '{1}' that is the type for EntitySet '{2}'. Type '{0}' defines new concurrency requirements that are not allowed for subtypes of base EntitySet types." + + + + + A string like "EntitySet '{0}' is based on type '{1}' that has no keys defined." + + + + + A string like "The end name '{0}' is already defined." + + + + + A string like "The key specified in EntityType '{0}' is not valid. Property '{1}' is referenced more than once in the Key element." + + + + + A string like "Property '{0}' has a CollectionKind specified but is not a collection property." + + + + + A string like "Property '{0}' has a CollectionKind specified. CollectionKind is only supported in version 1.1 EDM models." + + + + + A string like "ComplexType '{0}' is marked as abstract. Abstract ComplexTypes are only supported in version 1.1 EDM models." + + + + + A string like "ComplexType '{0}' has a BaseType specified. ComplexType inheritance is only supported in version 1.1 EDM models." + + + + + A string like "Key part '{0}' for type '{1}' is not valid. All parts of the key must be non-nullable." + + + + + A string like "The property '{0}' in EntityType '{1}' is not valid. All properties that are part of the EntityKey must be of PrimitiveType." + + + + + A string like "Key usage is not valid. The {0} class cannot define keys because one of its base classes ('{1}') defines keys." + + + + + A string like "EntityType '{0}' has no key defined. Define the key for this EntityType." + + + + + A string like "NavigationProperty is not valid. Role '{0}' or Role '{1}' is not defined in Relationship '{2}'." + + + + + A string like "End '{0}' on relationship '{1}' cannot have an operation specified because its multiplicity is '*'. Operations cannot be specified on ends with multiplicity '*'." + + + + + A string like "Each Name and PluralName in a relationship must be unique. '{0}' is already defined." + + + + + A string like "In relationship '{0}', the Principal and Dependent Role of the referential constraint refer to the same Role in the relationship type." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Valid values for multiplicity for the Principal Role are '0..1' or '1'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because all the properties in the Dependent Role are nullable, multiplicity of the Principal Role must be '0..1'." + + + + + A string like "Multiplicity conflicts with the referential constraint in Role '{0}' in relationship '{1}'. Because at least one of the properties in the Dependent Role is non-nullable, multiplicity of the Principal Role must be '1'." + + + + + A string like "Multiplicity conflicts with the referential constraint in Role '{0}' in relationship '{1}'. Because all of the properties in the Dependent Role are non-nullable, multiplicity of the Principal Role must be '1'." + + + + + A string like "Properties referred by the Dependent Role '{0}' must be a subset of the key of the EntityType '{1}' referred to by the Dependent Role in the referential constraint for relationship '{2}'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because the Dependent Role refers to the key properties, the upper bound of the multiplicity of the Dependent Role must be '1'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because the Dependent Role properties are not the key properties, the upper bound of the multiplicity of the Dependent Role must be '*'." + + + + + A string like "The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property '{0}' on entity '{1}' does not match the type of property '{2}' on entity '{3}' in the referential constraint '{4}'." + + + + + A string like "There is no property with name '{0}' defined in the type referred to by Role '{1}'." + + + + + A string like "A nullable ComplexType is not supported. Property '{0}' must not allow nulls." + + + + + A string like "A property cannot be of type '{0}'. The property type must be a ComplexType or a PrimitiveType." + + + + + A string like "Each member name in an EntityContainer must be unique. A member with name '{0}' is already defined." + + + + + A string like "Each type name in a schema must be unique. Type name '{0}' is already defined." + + + + + A string like "Name '{0}' cannot be used in type '{1}'. Member names cannot be the same as their enclosing type." + + + + + A string like "Each property name in a type must be unique. Property name '{0}' is already defined." + + + + + A string like "A cycle was detected in the type hierarchy of '{0}'." + + + + + A string like "A property cannot be of type '{0}'. The property type must be a ComplexType, a PrimitiveType, or a CollectionType." + + + + + A string like "A property cannot be of type {0}. The property type must be a ComplexType, a PrimitiveType or an EnumType." + + + + + A string like "The specified name must not be longer than 480 characters: '{0}'." + + + + + A string like "The specified name is not allowed: '{0}'." + + + + + A string like "The field {0} must be a string or array type with a maximum length of '{1}'." + + + + + A string like "The field {0} must be a string or array type with a minimum length of '{1}'." + + + + + A string like "No connection string named '{0}' could be found in the application config file." + + + + + A string like "AutomaticMigration" + + + + + A string like "BootstrapMigration" + + + + + A string like "InitialCreate" + + + + + A string like "Automatic migration was not applied because it would result in data loss." + + + + + A string like "[Inserting migration history record]" + + + + + A string like "[Deleting migration history record]" + + + + + A string like "[Updating EdmMetadata model hash]" + + + + + A string like "Running Seed method." + + + + + A string like "No pending code-based migrations." + + + + + A string like "Explicit" + + + + + A string like "Upgrading history table." + + + + + A string like "Cannot scaffold the next migration because the target database was created with a version of Code First earlier than EF 4.3 and does not contain the migrations history table. To start using migrations against this database, ensure the current model is compatible with the target database and execute the migrations Update process. (In Visual Studio you can use the Update-Database command from Package Manager Console to execute the migrations Update process)." + + + + + A string like "Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration." + + + + + A string like "Scripting the downgrade between two specified migrations is not supported." + + + + + A string like "Direct column renaming is not supported by SQL Server Compact. To rename a column in SQL Server Compact, you will need to recreate it." + + + + + A string like "One or more validation errors were detected during model generation:" + + + + + A string like "A circular ComplexType hierarchy was detected. Self-referencing ComplexTypes are not supported." + + + + + A string like "Connection to the database failed. The connection string is configured with an invalid LocalDB server name. This may have been set in 'global.asax' by a pre-release version of MVC4. The default connection factory is now set in web.config so the line in 'global.asax' starting with 'Database.DefaultConnectionFactory = ' should be removed. See http://go.microsoft.com/fwlink/?LinkId=243166 for details." + + + + + A string like "An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct." + + + + + A string like "Setting IsModified to false for a modified property is not supported." + + + + + A string like "An error occurred while saving entities that do not expose foreign key properties for their relationships. The EntityEntries property will return null because a single entity cannot be identified as the source of the exception. Handling of exceptions while saving can be made easier by exposing foreign key properties in your entity types. See the InnerException for details." + + + + + A string like "The set of property value names is read-only." + + + + + A string like "A property of a complex type must be set to an instance of the generic or non-generic DbPropertyValues class for that type." + + + + + A string like "Model compatibility cannot be checked because the DbContext instance was not created using Code First patterns. DbContext instances created from an ObjectContext or using an EDMX file cannot be checked for compatibility." + + + + + A string like "Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions." + + + + + A string like "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations." + + + + + A string like "The context cannot be used while the model is being created." + + + + + A string like "The DbContext class cannot be used with models that have multiple entity sets per type (MEST)." + + + + + A string like "The operation cannot be completed because the DbContext has been disposed." + + + + + A string like "The provider factory returned a null connection." + + + + + A string like "The DbConnectionFactory instance returned a null connection." + + + + + A string like "The number of primary key values passed must match number of primary key values defined on the entity." + + + + + A string like "The type of one of the primary key values did not match the type defined in the entity. See inner exception for details." + + + + + A string like "Multiple entities were found in the Added state that match the given primary key values." + + + + + A string like "Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList()." + + + + + A string like "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties." + + + + + A string like "Cannot initialize a DbContext from an entity connection string or an EntityConnection instance together with a DbCompiledModel. If an entity connection string or EntityConnection instance is used, then the model will be created from the metadata in the connection. If a DbCompiledModel is used, then the connection supplied should be a standard database connection (for example, a SqlConnection instance) rather than an entity connection." + + + + + A string like "Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used." + + + + + A string like "Validation failed for one or more entities. See 'EntityValidationErrors' property for more details." + + + + + A string like "An exception occurred while initializing the database. See the InnerException for details." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing ObjectContext is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing DbCompiledModel is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Code generated using the T4 templates for Database First and Model First development may not work correctly if used in Code First mode. To continue using Database First or Model First ensure that the Entity Framework connection string is specified in the config file of executing application. To use these classes, that were generated from Database First or Model First, with Code First add any additional configuration using attributes or the DbModelBuilder API and then remove the code that throws this exception." + + + + + A string like "The generic 'Set' method cannot be called with a proxy type. Either use the actual entity type or call the non-generic 'Set' method." + + + + + A string like "NavigationProperty is not valid. The FromRole and ToRole are the same." + + + + + A string like "OnDelete can be specified on only one End of an EdmAssociation." + + + + + A string like "The number of properties in the Dependent and Principal Roles in a relationship constraint must be identical." + + + + + A string like "The name is missing or not valid." + + + + + A string like "AssociationEnd must not be null." + + + + + A string like "DependentEnd must not be null." + + + + + A string like "DependentProperties must not be empty." + + + + + A string like "Association must not be null." + + + + + A string like "ResultEnd must not be null." + + + + + A string like "EntityType must not be null." + + + + + A string like "ElementType must not be null." + + + + + A string like "ElementType must not be null." + + + + + A string like "SourceSet must not be null." + + + + + A string like "TargetSet must not be null." + + + + + A string like "The type is not a valid EdmTypeReference." + + + + + A string like "Serializer can only serialize an EdmModel that has one EdmNamespace and one EdmEntityContainer." + + + + + A string like "MaxLengthAttribute must have a Length value that is greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "MinLengthAttribute must have a Length value that is zero or greater." + + + + + A string like "The connection can not be overridden because this context was created from an existing ObjectContext." + + + + + A string like "Can not override the connection for this context with a standard DbConnection because the original connection was an EntityConnection." + + + + + A string like "Can not override the connection for this context with an EntityConnection because the original connection was a standard DbConnection." + + + + + Strongly-typed and parameterized exception factory. + + + + + Migrations.Infrastructure.AutomaticDataLossException with message like "Automatic migration was not applied because it would result in data loss." + + + + + Migrations.Infrastructure.MigrationsException with message like "Cannot scaffold the next migration because the target database was created with a version of Code First earlier than EF 4.3 and does not contain the migrations history table. To start using migrations against this database, ensure the current model is compatible with the target database and execute the migrations Update process. (In Visual Studio you can use the Update-Database command from Package Manager Console to execute the migrations Update process)." + + + + + Migrations.Infrastructure.MigrationsException with message like "The specified target migration '{0}' does not exist. Ensure that target migration refers to an existing migration id." + + + + + Migrations.Infrastructure.MigrationsException with message like "The Foreign Key on table '{0}' with columns '{1}' could not be created because the principal key columns could not be determined. Use the AddForeignKey fluent API to fully specify the Foreign Key." + + + + + Migrations.Infrastructure.MigrationsException with message like "'{0}' is not a valid target migration. When targeting a previously applied automatic migration, use the full migration id including timestamp." + + + + + Migrations.Infrastructure.MigrationsException with message like "'{0}' is not a valid migration. Code-based migrations must be used for both source and target when scripting the upgrade between them." + + + + + Migrations.Infrastructure.MigrationsException with message like "The target context '{0}' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory." + + + + + Migrations.Infrastructure.MigrationsException with message like "The specified migration name '{0}' is ambiguous. Specify the full migration id including timestamp instead." + + + + + Migrations.Infrastructure.AutomaticMigrationsDisabledException with message like "Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration." + + + + + Migrations.Infrastructure.MigrationsException with message like "Scripting the downgrade between two specified migrations is not supported." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' was not be found in the assembly '{1}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one migrations configuration type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the one to use." + + + + + Migrations.Infrastructure.MigrationsException with message like "No migrations configuration type was found in the assembly '{0}'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one migrations configuration type was found in the assembly '{0}'. Specify the name of the one to use." + + + + + Migrations.Infrastructure.MigrationsException with message like "The type '{0}' is not a migrations configuration type." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must have a public default constructor." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must not be abstract." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must not be generic." + + + + + Migrations.Infrastructure.MigrationsException with message like "Direct column renaming is not supported by SQL Server Compact. To rename a column in SQL Server Compact, you will need to recreate it." + + + + + Migrations.Infrastructure.MigrationsException with message like "In VB.NET projects, the migrations namespace '{0}' must be under the root namespace '{1}'. Update the migrations project's root namespace to allow classes under the migrations namespace to be added." + + + + + + Migrations.Infrastructure.MigrationsException with message like "No MigrationSqlGenerator found for provider '{0}'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators." + + + + + Migrations.Infrastructure.MigrationsException with message like "No context type was found in the assembly '{0}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "The context type '{0}' was not found in the assembly '{1}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one context type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the context." + + + + + ArgumentException with message like "The argument '{0}' cannot be null, empty or contain only white space." + + + + + ArgumentException with message like "The argument property '{0}' cannot be null." + + + + + ArgumentException with message like "The precondition '{0}' failed. {1}" + + + + + InvalidOperationException with message like "The type '{0}' has already been configured as a complex type. It cannot be reconfigured as an entity type." + + + + + InvalidOperationException with message like "The type '{0}' has already been configured as an entity type. It cannot be reconfigured as a complex type." + + + + + InvalidOperationException with message like "The key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + InvalidOperationException with message like "The foreign key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + InvalidOperationException with message like "The property '{0}' is not a declared property on type '{1}'. Verify that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property." + + + + + InvalidOperationException with message like "The navigation property '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property." + + + + + InvalidOperationException with message like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'." + + + + + InvalidOperationException with message like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. Use dotted paths for nested properties: C#: 't => t.MyProperty.MyProperty' VB.Net: 'Function(t) t.MyProperty.MyProperty'." + + + + + InvalidOperationException with message like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + InvalidOperationException with message like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + + InvalidOperationException with message like "Conflicting configuration settings were specified for property '{0}' on type '{1}': {2}" + + + + + InvalidOperationException with message like "Conflicting configuration settings were specified for column '{0}' on table '{1}': {2}" + + + + + InvalidOperationException with message like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from ComplexObject." + + + + + InvalidOperationException with message like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' cannot be the inverse of itself." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting foreign keys." + + + + + MappingException with message like "Values of incompatible types ('{1}' and '{2}') were assigned to the '{0}' discriminator column. Values of the same type must be specified. To explicitly specify the type of the discriminator column use the HasColumnType method." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting mapping information." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting cascade delete operations using 'WillCascadeOnDelete'." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting multiplicities." + + + + + InvalidOperationException with message like "The MaxLengthAttribute on property '{0}' on type '{1} is not valid. The Length value must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "The StringLengthAttribute on property '{0}' on type '{1}' is not valid. The maximum length must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "Unable to determine composite primary key ordering for type '{0}'. Use the ColumnAttribute or the HasKey method to specify an order for composite primary keys." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. Name must not be empty." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The foreign key name '{2}' was not found on the dependent type '{3}'. The Name value should be a comma separated list of foreign key property names." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The navigation property '{2}' was not found on the dependent type '{1}'. The Name value should be a valid navigation property name." + + + + + InvalidOperationException with message like "Unable to determine a composite foreign key ordering for foreign key on type {0}. When using the ForeignKey data annotation on composite foreign key properties ensure order is specified by using the Column data annotation or the fluent API." + + + + + InvalidOperationException with message like "The InversePropertyAttribute on property '{2}' on type '{3}' is not valid. The property '{0}' is not a valid navigation property on the related type '{1}'. Ensure that the property exists and is a valid reference or collection navigation property." + + + + + InvalidOperationException with message like "A relationship cannot be established from property '{0}' on type '{1}' to property '{0}' on type '{1}'. Check the values in the InversePropertyAttribute to ensure relationship definitions are unique and reference from one navigation property to its corresponding inverse navigation property." + + + + + InvalidOperationException with message like "A key is registered for the derived type '{0}'. Keys can only be registered for the root type '{1}'." + + + + + InvalidOperationException with message like "The type '{0}' has already been mapped to table '{1}'. Specify all mapping aspects of a table in a single Map call." + + + + + InvalidOperationException with message like "Map was called more than once for type '{0}' and at least one of the calls didn't specify the target table name." + + + + + InvalidOperationException with message like "The derived type '{0}' has already been mapped using the chaining syntax. A derived type can only be mapped once using the chaining syntax." + + + + + InvalidOperationException with message like "An "is not null" condition cannot be specified on property '{0}' on type '{1}' because this property is not included in the model. Check that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation." + + + + + ArgumentException with message like "Values of type '{0}' cannot be used as type discriminator values. Supported types include byte, signed byte, bool, int16, int32, int64, and string." + + + + + InvalidOperationException with message like "Unable to add the convention '{0}'. Could not find an existing convention of type '{1}' in the current convention set." + + + + + InvalidOperationException with message like "Not all properties for type '{0}' have been mapped. Either map those properties or explicitly excluded them from the model." + + + + + NotSupportedException with message like "Unable to determine the provider name for connection of type '{0}'." + + + + + ArgumentException with message like "The qualified table name '{0}' contains an invalid schema name. Schema names must have a non-zero length." + + + + + ArgumentException with message like "The qualified table name '{0}' contains an invalid table name. Table names must have a non-zero length." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. Ensure the MapInheritedProperties method is only used during one call to the Map method." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. Ensure the Properties method is used and that repeated calls specify each non-key property only once." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. The non-key property '{1}' is mapped more than once. Ensure the Properties method specifies each non-key property only once." + + + + + InvalidOperationException with message like "The property '{1}' on type '{0}' cannot be mapped because it has been explicitly excluded from the model or it is of a type not supported by the DbModelBuilderVersion being used." + + + + + InvalidOperationException with message like "The entity types '{0}' and '{1}' cannot share table '{2}' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them." + + + + + InvalidOperationException with message like "You cannot use Ignore method on the property '{0}' on type '{1}' because this type inherits from the type '{2}' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type." + + + + + InvalidOperationException with message like "The property '{0}' cannot be used as a key property on the entity '{1}' because the property type is not a valid key type. Only scalar types, string and byte[] are supported key types." + + + + + InvalidOperationException with message like "The specified table '{0}' was not found in the model. Ensure that the table name has been correctly specified." + + + + + InvalidOperationException with message like "The specified association foreign key columns '{0}' are invalid. The number of columns specified must match the number of primary key columns." + + + + + InvalidOperationException with message like "A circular ComplexType hierarchy was detected. Self-referencing ComplexTypes are not supported." + + + + + InvalidOperationException with message like "Unable to determine the principal end of an association between the types '{0}' and '{1}'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." + + + + + InvalidOperationException with message like "The abstract type '{0}' has no mapped descendents and so cannot be mapped. Either remove '{0}' from the model or add one or more types deriving from '{0}' to the model. " + + + + + NotSupportedException with message like "The type '{0}' cannot be mapped as defined because it maps inherited properties from types that use entity splitting or another form of inheritance. Either choose a different inheritance mapping strategy so as to not map inherited properties, or change all types in the hierarchy to map inherited properties and to not use splitting. " + + + + + InvalidOperationException with message like "The table '{0}' was configured but is not used in any mappings. Verify the mapping configuration for '{0}' is correct." + + + + + InvalidOperationException with message like "The configured column orders for the table '{0}' contains duplicates. Ensure the specified column order values are distinct." + + + + + NotSupportedException with message like "The enum or spatial property '{1}' on type '{0}' cannot be mapped. Use DbModelBuilderVersion 'V5_0' or later to map enum or spatial properties." + + + + + InvalidOperationException with message like "Multiple potential primary key properties named '{0}' but differing only by case were found on entity type '{1}'. Configure the primary key explicitly using the HasKey fluent API or the KeyAttribute data annotation." + + + + + InvalidOperationException with message like "Cannot get value for property '{0}' from entity of type '{1}' because the property has no get accessor." + + + + + InvalidOperationException with message like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor." + + + + + + NotSupportedException with message like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor and is in the '{2}' state." + + + + + InvalidOperationException with message like "Member '{0}' cannot be called for property '{1}' on entity of type '{2}' because the property is not part of the Entity Data Model." + + + + + + ArgumentException with message like "Cannot call the {0} method for an entity of type '{1}' on a DbSet for entities of type '{2}'. Only entities of type '{2}' or derived from type '{2}' can be added, attached, or removed." + + + + + ArgumentException with message like "Cannot call the Create method for the type '{0}' on a DbSet for entities of type '{1}'. Only entities of type '{1}' or derived from type '{1}' can be created." + + + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is a collection navigation property. The Collection method should be used instead of the Reference method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is a reference navigation property. The Reference method should be used instead of the Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a navigation property. The Reference and Collection methods can only be used with navigation properties. Use the Property or ComplexProperty method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a complex property. The ComplexProperty method can only be used with complex properties. Use the Property, Reference or Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a primitive property, complex property, collection navigation property, or reference navigation property." + + + + + ArgumentException with message like ""The property '{0}' from the property path '{1}' is not a complex property on type '{2}'. Property paths must be composed of complex properties for all except the final property."" + + + + + NotSupportedException with message like "Setting IsModified to false for a modified property is not supported." + + + + + ArgumentException with message like ""The property path '{0}' cannot be used for navigation properties. Property paths can only be used to access primitive or complex properties."" + + + + + ArgumentException with message like "The navigation property '{0}' on entity type '{1}' cannot be used for entities of type '{2}' because it refers to entities of type '{3}'." + + + + + ArgumentException with message like "The generic type argument '{0}' cannot be used with the Member method when accessing the collection navigation property '{1}' on entity type '{2}'. The generic type argument '{3}' must be used instead." + + + + + ArgumentException with message like "The property '{0}' on entity type '{1}' cannot be used for objects of type '{2}' because it is a property for objects of type '{3}'." + + + + + ArgumentException with message like "The expression passed to method {0} must represent a property defined on the type '{1}'." + + + + + InvalidOperationException with message like "{0} cannot be used for entities in the {1} state." + + + + + InvalidOperationException with message like "Cannot set non-nullable property '{0}' of type '{1}' to null on object of type '{2}'." + + + + + InvalidOperationException with message like "The property '{0}' in the entity of type '{1}' is null. Store values cannot be obtained for an entity with a null complex property." + + + + + InvalidOperationException with message like "Cannot assign value of type '{0}' to property '{1}' of type '{2}' in property values for type '{3}'." + + + + + NotSupportedException with message like "The set of property value names is read-only." + + + + + ArgumentException with message like "The '{0}' property does not exist or is not mapped for the type '{1}'." + + + + + ArgumentException with message like "Cannot copy values from DbPropertyValues for type '{0}' into DbPropertyValues for type '{1}'." + + + + + ArgumentException with message like "Cannot copy from property values for object of type '{0}' into property values for object of type '{1}'." + + + + + ArgumentException with message like "A property of a complex type must be set to an instance of the generic or non-generic DbPropertyValues class for that type." + + + + + InvalidOperationException with message like "The value of the complex property '{0}' on entity of type '{1}' is null. Complex properties cannot be set to null and values cannot be set for null complex properties." + + + + + InvalidOperationException with message like "The value of the nested property values property '{0}' on the values for entity of type '{1}' is null. Nested property values cannot be set to null and values cannot be set for null complex properties." + + + + + InvalidOperationException with message like "Cannot set the value of the nested property '{0}' because value of the complex property '{1}' to which it belongs is null." + + + + + InvalidOperationException with message like "Cannot set the original value of the nested property '{0}' because the original value of the complex property '{1}' to which it belongs is null." + + + + + InvalidOperationException with message like "The model backing the '{0}' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)." + + + + + InvalidOperationException with message like "Database '{0}' cannot be created because it already exists." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the DbContext instance was not created using Code First patterns. DbContext instances created from an ObjectContext or using an EDMX file cannot be checked for compatibility." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations." + + + + + + + InvalidOperationException with message like "Failed to set database initializer of type '{0}' for DbContext type '{1}' specified in the application configuration. See inner exception for details." + + + + + InvalidOperationException with message like "Configuration for DbContext type '{0}' is specified multiple times in the application configuration. Each context can only be configured once." + + + + + InvalidOperationException with message like "Failed to set Database.DefaultConnectionFactory to an instance of the '{0}' type as specified in the application configuration. See inner exception for details." + + + + + InvalidOperationException with message like "The type '{0}' could not be found. The type name must be an assembly-qualified name." + + + + + InvalidOperationException with message like "The context cannot be used while the model is being created." + + + + + InvalidOperationException with message like "The DbContext class cannot be used with models that have multiple entity sets per type (MEST)." + + + + + InvalidOperationException with message like "The operation cannot be completed because the DbContext has been disposed." + + + + + InvalidOperationException with message like "The provider factory returned a null connection." + + + + + InvalidOperationException with message like "The connection string '{0}' in the application's configuration file does not contain the required providerName attribute."" + + + + + InvalidOperationException with message like "The DbConnectionFactory instance returned a null connection." + + + + + ArgumentException with message like "The number of primary key values passed must match number of primary key values defined on the entity." + + + + + ArgumentException with message like "The type of one of the primary key values did not match the type defined in the entity. See inner exception for details." + + + + + InvalidOperationException with message like "The entity found was of type {0} when an entity of type {1} was requested." + + + + + InvalidOperationException with message like "Multiple entities were found in the Added state that match the given primary key values." + + + + + InvalidOperationException with message like "The type '{0}' is mapped as a complex type. The Set method, DbSet objects, and DbEntityEntry objects can only be used with entity types, not complex types." + + + + + InvalidOperationException with message like "The type '{0}' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute." + + + + + InvalidOperationException with message like "The entity type {0} is not part of the model for the current context." + + + + + NotSupportedException with message like "Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList()." + + + + + ArgumentException with message like "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties." + + + + + InvalidOperationException with message like "No connection string named '{0}' could be found in the application config file." + + + + + InvalidOperationException with message like "Cannot initialize a DbContext from an entity connection string or an EntityConnection instance together with a DbCompiledModel. If an entity connection string or EntityConnection instance is used, then the model will be created from the metadata in the connection. If a DbCompiledModel is used, then the connection supplied should be a standard database connection (for example, a SqlConnection instance) rather than an entity connection." + + + + + NotSupportedException with message like "The collection navigation property '{0}' on the entity of type '{1}' cannot be set because the entity type does not define a navigation property with a set accessor." + + + + + NotSupportedException with message like "Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used." + + + + + InvalidOperationException with message like "Multiple object sets per type are not supported. The object sets '{0}' and '{1}' can both contain instances of type '{2}'." + + + + + InvalidOperationException with message like "The context type '{0}' must have a public constructor taking an EntityConnection." + + + + + NotSupportedException with message like "The database name '{0}' is not supported because it is an MDF file name. A full connection string must be provided to attach an MDF file." + + + + + DataException with message like "An exception occurred while initializing the database. See the InnerException for details." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing ObjectContext is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing DbCompiledModel is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + InvalidOperationException with message like "The context factory type '{0}' must have a public default constructor." + + + + + InvalidOperationException with message like "The generic 'Set' method cannot be called with a proxy type. Either use the actual entity type or call the non-generic 'Set' method." + + + + + InvalidOperationException with message like "MaxLengthAttribute must have a Length value that is greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "MinLengthAttribute must have a Length value that is zero or greater." + + + + + InvalidOperationException with message like "No connection string named '{0}' could be found in the application config file." + + + + + InvalidOperationException with message like "The connection can not be overridden because this context was created from an existing ObjectContext." + + + + + InvalidOperationException with message like "Can not override the connection for this context with a standard DbConnection because the original connection was an EntityConnection." + + + + + InvalidOperationException with message like "Can not override the connection for this context with an EntityConnection because the original connection was a standard DbConnection." + + + + + The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument. + + + + + The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method. + + + + + The exception that is thrown when the author has yet to implement the logic at this point in the program. This can act as an exception based TODO tag. + + + + + The exception that is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or write to a stream that does not support the invoked functionality. + + + + + AutoGenerated resource class. Usage: + + string s = EntityRes.GetString(EntityRes.MyIdenfitier); + + + + + Allows the construction and modification of a user-specified annotation (name-value pair) on a instance. + + + + + Gets or sets an optional namespace that can be used to distinguish the annotation from others with the same value. + + + + + Gets or sets the name of the annotation. + + + + + Gets or sets the value of the annotation. + + + + + + + + + DataModelEventArgs is the base argument type for all events raised by consumers of Entity Data Model (EDM) models. + + + + + Gets a value indicating the that caused the event to be raised. + + + + + Gets an optional value indicating which property of the source item caused the event to be raised. + + + + + Gets a value that identifies the specific error that is being raised. + + + + + Gets an optional descriptive message the describes the error that is being raised. + + + + + DbAliasedMetadataItem provides the base type for all Database Metadata types that can have an optional that should be used instead of the item's when referring to the item in the database. + + + + + NamedDbItem is the base for all types in the Database Metadata construction and modification API with a property. + + + + + The base for all all Database Metadata types that support annotation using . + + + + + DbDataModelItem is the base for all types in the Database Metadata construction and modification API. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets or sets the currently assigned name. + + + + + Gets an optional alternative identifier that should be used when referring to this item in the database. + + + + + When implemented in derived types, allows the construction and modification of a column in a Database Metadata table or row. + + + + + Gets or sets a string indicating the database-specific type of the column. + + + + + Gets or sets a value indicating whether the column is nullable. + + + + + Gets or sets an optional instance that applies additional constraints to the referenced database-specific type of the column. + + + + + Allows the construction and modification of a database in a Database Metadata model. + + + + + Gets or sets an optional value that indicates the database model version. + + + + + Gets or sets the collection of instances that specifies the schemas within the database. + + + + + Allows the construction and modification of a foreign key constraint sourced by a instance. + + + + + Gets or sets the to take when a delete operation is attempted. + + + + + Indicates which Database Metadata concept is represented by a given item. + + + + + Database Kind + + + + + Schema Kind + + + + + Foreign Key Constraint Kind + + + + + Function Kind + + + + + Function Parameter Kind + + + + + Function Return or Parameter Type Kind + + + + + Row Column Kind + + + + + Table Kind + + + + + Table Column Kind + + + + + Primitive Facets Kind + + + + + Specifies the action to take on a given operation. + + + + + Default behavior + + + + + Restrict the operation + + + + + Cascade the operation + + + + + Allows the construction and modification of additional constraints that can be applied to a specific use of a primitive type in a Database Metadata item. + + + + + Returns true if any facet value property currently has a non-null value; otherwise returns false . + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have a fixed or variable length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have its intrinsic maximum length, rather than a specific value. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to be Unicode or non-Unicode. + + + + + Gets or sets an optional value indicating the current constraint on the type's maximum length. + + + + + Gets or sets an optional value indicating the current constraint on the type's precision. + + + + + Gets or sets an optional value indicating the current constraint on the type's scale. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating whether the spatial type is to be type checked strictly. + + + + + Allows the construction and modification of a database schema in a database model. + + + + + Gets or sets the collection of instances that specifies the tables declared within the schema. + + + + + DbSchemaMetadataItem is the base for all types that can be contained in a schema. + + + + + Allows the construction and modification of a column in a table. + + + + + Gets or sets a value indicating whether the column is part of the table's primary key. + + + + + Gets or sets a value indicating if and how the value of the column is automatically generated. + + + + + Gets or sets an optional value indicating the collation specific to this table column. + + + + + Gets or sets an optional value that specifies the default value for the column. + + + + + Allows the construction and modification a table in a database schema. + + + + + Gets or sets the collection of instances that specifies the columns present within the table. + + + + + Gets or sets the collection of instances from the collection of the table that are part of the primary key. + + + + + Gets or sets the collection of instances that defines the foreign key constraints sourced from the table. + + + + + Represents a specific use of a type in a Database Metadata item. + + + + + Gets or sets an optional instance that applies additional constraints to a referenced primitive type. + + + Accessing this property forces the creation of a DbPrimitiveTypeFacets value if no value has previously been set. Use to determine whether or not this property currently has a value. + + + + + Gets or sets a value indicating whether the represented type is a collection type. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered nullable. + + + + + Gets a value indicating whether the type has been configured as a row type by the addition of one or more RowColumns. + + + + + Represents the mapping of an EDM association end ( ) as a collection of property mappings ( ). + + + + + DbMappingMetadataItem is the base for all types in the EDM-to-Database Mapping construction and modification API that support annotation using . + + + + + DbMappingModelItem is the base for all types in the EDM-to-Database Mapping construction and modification API. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets an value representing the association end that is being mapped. + + + + + Gets the collection of s that specifies how the association end key properties are mapped to the table. + + + + + Gets an value representing the association set that is being mapped. + + + + + Gets a value representing the table to which the entity type's properties are being mapped. + + + + + Gets the collection of s that specifies the constant or null values that columns in must have for this type mapping to apply. + + + + + Allows the construction and modification of a condition for a column in a database table. + + + + + Gets or sets a value representing the table column which must contain for this condition to hold. + + + + + Gets or sets the value that must contain for this condition to hold. + + + + + Gets or sets an value representing the model that is being mapped. + + + + + Gets or sets a value representing the database that is the target of the mapping. + + + + + Gets or sets the collection of s that specifies how the model's entity containers are mapped to the database. + + + + + Represents the mapping of an entity property to a column in a database table. + + + + + Gets or sets the collection of instances that defines the mapped property, beginning from a property declared by the mapped entity type and optionally proceeding through properties of complex property result types. + + + + + Gets or sets a value representing the table column to which the entity property is being mapped. + + + + + Allows the construction and modification of the mapping of an EDM entity container ( ) to a database ( ). + + + + + Gets or sets an value representing the entity container that is being mapped. + + + + + Gets or sets the collection of s that specifies how the container's entity sets are mapped to the database. + + + + + Gets the collection of s that specifies how the container's association sets are mapped to the database. + + + + + Allows the construction and modification of the mapping of an EDM entity set ( ) to a database ( ). + + + + + Gets or sets an value representing the entity set that is being mapped. + + + + + Gets or sets the collection of s that specifies how the set's entity types are mapped to the database. + + + + + Allows the construction and modification of a complete or partial mapping of an EDM entity type ( ) or type hierarchy to a specific database table ( ). + + + + + Gets or sets an value representing the entity type or hierarchy that is being mapped. + + + + + Gets or sets a value indicating whether this type mapping applies to and all its direct or indirect subtypes ( true ), or only to ( false ). + + + + + Gets a value representing the table to which the entity type's properties are being mapped. + + + + + Gets the collection of s that specifies how the type's properties are mapped to the table. + + + + + Gets the collection of s that specifies the constant or null values that columns in must have for this type mapping fragment to apply. + + + + + Indicates which EDM-to-Database Mapping concept is represented by a given item. + + + + + Database Mapping Kind + + + + + Entity Container Mapping Kind + + + + + Entity Set Mapping Kind + + + + + Association Set Mapping Kind + + + + + Entity Type Mapping Kind + + + + + Query View Mapping Kind + + + + + Entity Type Mapping Fragment Kind + + + + + Edm Property Mapping Kind + + + + + Association End Mapping Kind + + + + + Column Condition Kind + + + + + Property Condition Kind + + + + + Allows the construction and modification of a constraint applied to an Entity Data Model (EDM) association. + + + + + Gets or sets the that represents the 'dependent' end of the constraint; properties from this association end's entity type contribute to the collection. + + + + + Gets or sets the collection of instances from the of the constraint. The values of these properties are constrained against the primary key values of the remaining, 'principal' association end's entity type. + + + + + Allows the construction and modification of one end of an Entity Data Model (EDM) association. + + + + + Gets or sets the entity type referenced by this association end. + + + + + Gets or sets the of this association end, which indicates the multiplicity of the end and whether or not it is required. + + + + + Gets or sets the to take when a delete operation is attempted. + + + + + Indicates the multiplicity of an and whether or not it is required. + + + + + Allows the construction and modification of an association set in an Entity Data Model (EDM) ). + + + + + Represents an item in an Entity Data Model (EDM) . + + + + + Gets or sets the that specifies the association type for the set. + + + + + Gets or sets the that specifies the entity set corresponding to the association end for this association set. + + + + + Gets or sets the that specifies the entity set corresponding to the association end for this association set. + + + + + + The base for all all Entity Data Model (EDM) types that represent a structured type from the EDM type system. + + + + + Gets or sets the that defines the source end of the association. + + + + + Gets or sets the that defines the target end of the association. + + + + + Gets or sets the optional constraint that indicates whether the relationship is an independent association (no constraint present) or a foreign key relationship ( specified). + + + + + Collection semantics for properties. + + + + + The property does not have a collection type or does not specify explicit collection semantics. + + + + + The property is an unordered collection that may contain duplicates. + + + + + The property is an ordered collection that may contain duplicates. + + + + + Allows the construction and modification of a complex type in an Entity Data Model (EDM) . + + + + + Gets or sets the optional that indicates the base complex type of the complex type. + + + + + Gets or sets a value indicating whether the complex type is abstract. + + + + + Gets or sets the collection of instances that describe the (scalar or complex) properties of the complex type. + + + + + Concurrency mode for properties. + + + + + Default concurrency mode: the property is never validated at write time + + + + + Fixed concurrency mode: the property is always validated at write time + + + + + Allows the construction and modification of an entity container in an Entity Data Model (EDM) . + + + + + Gets all s declared within the namspace. Includes s and s. + + + + + Gets or sets the collection of s that specifies the association sets within the container. + + + + + Gets or sets the collection of s that specifies the entity sets within the container. + + + + + Allows the construction and modification of an entity set in an Entity Data Model (EDM) . + + + + + Gets or sets the that specifies the entity type for the set. + + + + + Allows the construction and modification of an entity type in an Entity Data Model (EDM) . + + + + + Gets or sets the optional that indicates the base entity type of the entity type. + + + + + Gets or sets a value indicating whether the entity type is abstract. + + + + + Gets or sets the collection of s that specifies the properties declared by the entity type. + + + + + Gets or sets the collection of s that indicates which properties from the collection are part of the entity key. + + + + + Gets or sets the optional collection of s that specifies the navigation properties declared by the entity type. + + + + + Indicates which Entity Data Model (EDM) concept is represented by a given item. + + + + + Association End Kind + + + + + Association Set Kind + + + + + Association Type Kind + + + + + Collection Type Kind + + + + + Complex Type Kind + + + + + Entity Container Kind + + + + + Entity Set Kind + + + + + Entity Type Kind + + + + + Function Group Kind + + + + + Function Overload Kind + + + + + Function Import Kind + + + + + Function Parameter Kind + + + + + Navigation Property Kind + + + + + EdmProperty Type Kind + + + + + Association Constraint Type Kind + + + + + Ref Type Kind + + + + + Row Column Kind + + + + + Row Type Kind + + + + + Type Reference Kind + + + + + Model Kind + + + + + Namespace Kind + + + + + Primitive Facets Kind + + + + + Primitive Type Kind + + + + + Enum Type Kind + + + + + Enum Type Member Kind + + + + + EdmModel is the top-level container for namespaces and entity containers belonging to the same logical Entity Data Model (EDM) model. + + + + + Gets or sets an optional value that indicates the entity model version. + + + + + Gets or sets the containers declared within the model. + + + + + Gets or sets the namespaces declared within the model. + + + + + Allows the construction and modification of a namespace in an . + + + + + Gets all s declared within the namspace. Includes s, s, s. + + + + + Gets or sets the s declared within the namespace. + + + + + Gets or sets the s declared within the namespace. + + + + + Gets or sets the s declared within the namespace. + + + + + Allows the construction and modification of an Entity Data Model (EDM) navigation property. + + + + + Gets or sets the that specifies the association over which navigation takes place. + + + + + Gets or sets the that specifies which association end is the 'destination' end of the navigation and produces the navigation property result. + + + + + Specifies the action to take on a given operation. + + + + + Default behavior + + + + + Restrict the operation + + + + + Cascade the operation + + + + + Represents one of the fixed set of Entity Data Model (EDM) primitive types. + + + + + The base for all all Entity Data Model (EDM) types that represent a scalar type from the EDM type system. + + + + + Retrieves the EdmPrimitiveType instance with the corresponding to the specified value, if any. + + The name of the primitive type instance to retrieve + The EdmPrimitiveType with the specified name, if successful; otherwise null . + true if the given name corresponds to an EDM primitive type name; otherwise false . + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets an value that indicates which Entity Data Model (EDM) primitive type this type represents. + + + + + Allows the construction and modification of additional constraints that can be applied to a specific use of a primitive type in an Entity Data Model (EDM) item. See . + + + + + Returns true if any facet value property currently has a non-null value; otherwise returns false . + + + + + Gets or sets an optional value indicating the current constraint on the type's maximum length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have its intrinsic maximum length, rather than a specific value. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have a fixed or variable length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to be Unicode or non-Unicode. + + + + + Gets or sets an optional value indicating the current constraint on the type's precision. + + + + + Gets or sets an optional value indicating the current constraint on the type's scale. + + + + + Gets or sets an optional value indicating that the current spatial type's SRID is unconstrained. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating whether the spatial type is to be type checked strictly. + + + + + Primitive Types as defined by the Entity Data Model (EDM). + + + + + Binary Type Kind + + + + + Boolean Type Kind + + + + + Byte Type Kind + + + + + DateTime Type Kind + + + + + Decimal Type Kind + + + + + Double Type Kind + + + + + Guid Type Kind + + + + + Single Type Kind + + + + + SByte Type Kind + + + + + Int16 Type Kind + + + + + Int32 Type Kind + + + + + Int64 Type Kind + + + + + String Type Kind + + + + + Time Type Kind + + + + + DateTimeOffset Type Kind + + + + + Geometry Type Kind + + + + + Geography Type Kind + + + + + Geometric point type kind + + + + + Geometric linestring type kind + + + + + Geometric polygon type kind + + + + + Geometric multi-point type kind + + + + + Geometric multi-linestring type kind + + + + + Geometric multi-polygon type kind + + + + + Geometric collection type kind + + + + + Geographic point type kind + + + + + Geographic linestring type kind + + + + + Geographic polygon type kind + + + + + Geographic multi-point type kind + + + + + Geographic multi-linestring type kind + + + + + Geographic multi-polygon type kind + + + + + Geographic collection type kind + + + + + Allows the construction and modification of a primitive- or complex-valued property of an Entity Data Model (EDM) entity or complex type. + + + + + Gets or sets an value that indicates which collection semantics - if any - apply to the property. + + + + + Gets or sets a value that indicates whether the property is used for concurrency validation. + + + + + Gets or sets on optional value that indicates an initial default value for the property. + + + + + Gets or sets an that specifies the result type of the property. + + + + + Enumerates all s declared or inherited by an . + + + + + Allows the construction and modification of a specific use of a type in an Entity Data Model (EDM) item. See for examples. + + + + + Gets or sets a value indicating the collection rank of the type reference. A collection rank greater than zero indicates that the type reference represents a collection of its referenced . + + + + + Gets or sets a value indicating the referenced by this type reference. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered nullable. + + + + + Gets or sets an optional instance that applies additional constraints to a referenced primitive type. + + + Accessing this property forces the creation of an EdmPrimitiveTypeFacets value if no value has previously been set. Use to determine whether or not this property currently has a value. + + + + + Gets a value indicating whether the property of this type reference has been assigned an value with at least one facet value specified. + + + + + Indicates whether this type reference represents a collection of its referenced (when is greater than zero) or not. + + + + + Indicates whether the property of this type reference currently refers to an , is not a collection type, and does not have primitive facet values specified. + + + + + Gets the currently referred to by this type reference, or null if the type reference is a collection type or does not refer to a complex type. + + + + + Indicates whether the property of this type reference currently refers to an and is not a collection type. + + + + + Gets the currently referred to by this type reference, or null if the type reference is a collection type or does not refer to a primitive type. + + + + + Contains constant values that apply to the EDM model, regardless of source (for CSDL specific constants see ). + + + + + Parsing code taken from System.dll's System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(string) method to avoid LinkDemand needed to call this method + + + + + + + + + + + Constants for CSDL XML. + + + + + Constants for C-S MSL XML. + + + + + Constants for SSDL XML. + + + + + The acceptable range for this enum is 0000 - 0999; the range 10,000-15,000 is reserved for tools. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Precision out of range + + + + + Scale out of range + + + + + + + + + + + + + One of the required facets is missing + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The facet isn't allow by the property type. + + + + + This facet value is constant and is specified in the schema + + + + + + + + + + + + + Multiplicity value was malformed + + + + + The value for the Action attribute is invalid or not allowed in the current context + + + + + An error occurred processing the On<Operation> elements + + + + + Ends were given for the Property element of a EntityContainer that is not a RelationshipSet + + + + + The extent name used in the EntittyContainerType End does not match the name of any of the EntityContainerProperties in the containing EntityContainer + + + + + An end element was not given, and cannot be inferred because too many EntityContainerEntitySet elements that are good possibilities. + + + + + An end element was not given, and cannot be inferred because there is no EntityContainerEntitySets that are the correct type to be used as an EntitySet. + + + + + Not a valid parameter direction for the parameter in a function + + + + + Unable to infer an optional schema part, to resolve this; be more explicit + + + + + Invalid facet attribute(s) specified in provider manifest + + + + + Invalid role value in the relationship constraint + + + + + Invalid Property in relationship constraint + + + + + Type mismatch between ToProperty and FromProperty in the relationship constraint + + + + + Invalid multiplicity in FromRole in the relationship constraint + + + + + The number of properties in the FromProperty and ToProperty in the relationship constraint must be identical + + + + + No Properties defined in either FromProperty or ToProperty in the relationship constraint + + + + + Missing constraint in relationship type in ssdl + + + + + Same role referred in the ToRole and FromRole of a referential constraint + + + + + Invalid value for attribute ParameterTypeSemantics + + + + + Invalid type used for a Relationship End Type + + + + + Invalid PrimitiveTypeKind + + + + + Invalid TypeConversion DestinationType + + + + + Expected a integer value between 0 - 255 + + + + + Invalid Type specified in function + + + + + Precision must not be greater than 28 + + + + + Properties that are part of entity key must be of scalar type + + + + + Binary type properties which are part of entity key are currently not supported + + + + + The primitive type kind does not have a preferred mapping + + + + + More than one PreferredMapping for a PrimitiveTypeKind + + + + + End with * multiplicity cannot have operations specified + + + + + EntitySet type has no keys + + + + + InvalidNumberOfParametersForAggregateFunction + + + + + InvalidParameterTypeForAggregateFunction + + + + + Composable functions must declare a return type. + + + + + Non-composable functions must not declare a return type. + + + + + Non-composable functions do not permit the aggregate; niladic; or built-in attributes. + + + + + Composable functions can not include command text attribute. + + + + + Functions should not declare both a store name and command text (only one or the other can be used). + + + + + SystemNamespace + + + + + Empty DefiningQuery text + + + + + Schema, Table and DefiningQuery are all specified, and are mutually exclusive + + + + + ConcurrencyMode value was malformed + + + + + Concurrency can't change for any sub types of an EntitySet type. + + + + + Function import return type must be either empty, a collection of entities, or a singleton scalar. + + + + + Function import specifies a non-existent entity set. + + + + + Function import specifies entity type return but no entity set. + + + + + Function import specifies entity type that does not derive from element type of entity set. + + + + + Function import specifies a binding to an entity set but does not return entities. + + + + + InternalError + + + + + Same Entity Set Taking part in the same role of the relationship set in two different relationship sets + + + + + Entity key refers to the same property twice + + + + + Function declares a ReturnType attribute and element + + + + + Nullable Complex Type not supported in Edm V1 + + + + + Only Complex Collections supported in Edm V1.1 + + + + + No Key defined on Entity Type + + + + + Invalid namespace specified in using element + + + + + Need not specify system namespace in using + + + + + Cannot use a reserved/system namespace as alias + + + + + Invalid qualification specified for type + + + + + Invalid Entity Container Name in extends attribute + + + + + Invalid CollectionKind value in property CollectionKind attribute + + + + + Must specify namespace or alias of the schema in which this type is defined + + + + + Entity Container cannot extend itself + + + + + Failed to retrieve provider manifest + + + + + Mismatched Provider Manifest token values in SSDL artifacts + + + + + Missing Provider Manifest token value in SSDL artifact(s) + + + + + Empty CommandText element + + + + + Inconsistent Provider values in SSDL artifacts + + + + + Inconsistent Provider Manifest token values in SSDL artifacts + + + + + Duplicated Function overloads + + + + + InvalidProvider + + + + + FunctionWithNonEdmTypeNotSupported + + + + + ComplexTypeAsReturnTypeAndDefinedEntitySet + + + + + ComplexTypeAsReturnTypeAndDefinedEntitySet + + + + unused 179, + unused 180, + unused 181, + + In model functions facet attribute is allowed only on ScalarTypes + + + + + Captures several conditions where facets are placed on element where it should not exist. + + + + + Return type has not been declared + + + + + Invalid value in the EnumTypeOption + + + + + The structural annotation cannot use codegen namespaces + + + + + Function and type cannot have the same fully qualified name + + + + + Cannot load different version of schema in the same ItemCollection + + + + + Expected bool value + + + + + End without Multiplicity specified + + + + + In SSDL, if composable function returns a collection of rows (TVF), all row properties must be of scalar types. + + + + + The name of NamedEdmItem must not be empty or white space only + + + + + EdmTypeReference is empty + + Unused 199; + + + + Serializes an that conforms to the restrictions of a single CSDL schema file to an XML writer. The model to be serialized must contain a single and a single . + + + + + Serialize the to the XmlWriter. + + The EdmModel to serialize, mut have only one and one + The XmlWriter to serialize to + + + + Serialize the to the XmlWriter + + The DbModel to serialize + The XmlWriter to serialize to + + + + Serialize the to the + + The DbDatabaseMetadata to serialize + Provider information on the Schema element + ProviderManifestToken information on the Schema element + The XmlWriter to serialize to + + + + + author/email + + + + + author/name + + + + + author/uri + + + + + published + + + + + rights + + + + + summary + + + + + title + + + + + contributor/email + + + + + contributor/name + + + + + contributor/uri + + + + + category/@label + + + + + Plaintext + + + + + HTML + + + + + XHTML + + + + + updated + + + + + link/@href + + + + + link/@rel + + + + + link/@type + + + + + link/@hreflang + + + + + link/@title + + + + + link/@length + + + + + category/@term + + + + + category/@scheme + + + + + Return role name pair + + + + + + + + The context for DataModel Validation + + + + + Returns true if the given two ends are similar - the relationship type that this ends belongs to is the same and the entity set refered by the ends are same and they are from the same role + + + + + + + + Return true if the Referential Constraint on the association is ready for further validation, otherwise return false. + + + + + + + Resolves the given property names to the property in the item Also checks whether the properties form the key for the given type and whether all the properties are nullable or not + + + + + + + + + + + Return true if the namespaceName is a Edm System Namespace + + + + + + + Return true if the entityType is a subtype of any entity type in the dictionary keys, and return the corresponding entry EntitySet value. Otherwise return false. + + + + + + + + + Return true if any of the properties in the EdmEntityType defines ConcurrencyMode. Otherwise return false. + + + + + + + Add member name to the Hash set, raise an error if the name exists already. + + + + + + + + + If the string is null, empty, or only whitespace, return false, otherwise return true + + + + + + + Determine if a cycle exists in the type hierarchy: use two pointers to walk the chain, if one catches up with the other, we have a cycle. + + true if a cycle exists in the type hierarchy, false otherwise + + + + RuleSet for DataModel Validation + + + + + Get the related rules given certain DataModelItem + + The to validate + A collection of + + + + Data Model Validator + + + + + Validate the and all of its properties given certain version. + + The root of the model to be validated + True to validate the syntax, otherwise false + + + + The RuleSet for EdmModel + + + + + Get based on version + + a double value of version + + + + + The context for EdmModel Validation + + + + + Visitor for EdmModel Validation + + + + + Edm Model Validator + + + + + validate the from the root with the context + + The root to validate from + The validation context + + + + An implementation of IDatabaseInitializer that will recreate and optionally re-seed the + database only if the database does not exist. + To seed the database, create a derived class and override the Seed method. + + The type of the context. + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + An instances of this class is obtained from an object and can be used + to manage the actual database backing a DbContext or connection. + This includes creating, deleting, and checking for the existence of a database. + Note that deletion and checking for existence of a database can be performed using just a + connection (i.e. without a full context) by using the static methods of this class. + + + + + Creates a Database backed by the given context. This object can be used to create a database, + check for database existence, and delete a database. + + The context that defines the database connection and model. + + + + Gets or sets the database initialization strategy. The database initialization strategy is called when instance + is initialized from a . The strategy can optionally check for database existence, create a new database, and + seed the database with data. + The default strategy is an instance of . + + The type of the context. + The strategy. + The database creation strategy. + + + + Internal version of SetInitializer that allows the strategy to be locked such that it cannot be replaced + by another call to SetInitializer. This allows strategies set in the app.config to win over strategies set + in code. + + The type of the context. + The strategy. + if set to true then the strategy is locked. + + + + Runs the the registered on this context. + + If "force" is set to true, then the initializer is run regardless of whether or not it + has been run before. This can be useful if a database is deleted while an app is running + and needs to be reinitialized. + + If "force" is set to false, then the initializer is only run if it has not already been + run for this context, model, and connection in this app domain. This method is typically + used when it is necessary to ensure that the database has been created and seeded + before starting some operation where doing so lazily will cause issues, such as when the + operation is part of a transaction. + + if set to true the initializer is run even if it has already been run. + + + + Checks whether or not the database is compatible with the the current Code First model. + + + Model compatibility currently uses the following rules. + + If the context was created using either the Model First or Database First approach then the + model is assumed to be compatible with the database and this method returns true. + + For Code First the model is considered compatible if the model is stored in the database + in the Migrations history table and that model has no differences from the current model as + determined by Migrations model differ. + + If the model is not stored in the database but an EF 4.1/4.2 model hash is found instead, + then this is used to check for compatibility. + + + If set to true then an exception will be thrown if no model metadata is found in + the database. If set to false then this method will return true if metadata + is not found. + + True if the model hash in the context and the database match; false otherwise. + + + + + Creates a new database on the database server for the model defined in the backing context. + Note that calling this method before the database initialization strategy has run will disable + executing that strategy. + + + + + Creates a new database on the database server for the model defined in the backing context, but only + if a database with the same name does not already exist on the server. + + True if the database did not exist and was created; false otherwise. + + + + Checks whether or not the database exists on the server. + + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + Calling this method from outside of an initializer will mark the database as having + not been initialized. This means that if an attempt is made to use the database again + after it has been deleted, then any initializer set will run again and, usually, will + try to create the database again automatically. + + True if the database did exist and was deleted; false otherwise. + + + + Checks whether or not the database exists on the server. + The connection to the database is created using the given database name or connection string + in the same way as is described in the documentation for the class. + + The database name or a connection string to the database. + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + The connection to the database is created using the given database name or connection string + in the same way as is described in the documentation for the class. + + The database name or a connection string to the database. + True if the database did exist and was deleted; false otherwise. + + + + Checks whether or not the database exists on the server. + + An existing connection to the database. + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + + An existing connection to the database. + True if the database did exist and was deleted; false otherwise. + + + + Resets the DefaultConnectionFactory to its initial value. + Currently, this method is only used by test code. + + + + + Performs the operation defined by the given delegate using the given lazy connection, ensuring + that the lazy connection is disposed after use. + + Information used to create a DbConnection. + The operation to perform. + The return value of the operation. + + + + Performs the operation defined by the given delegate against a connection. The connection + is either the connection accessed from the context backing this object, or is obtained from + the connection information passed to one of the static methods. + + The connection to use. + The operation to perform. + The return value of the operation. + + + + Returns an empty ObjectContext that can be used to perform delete/exists operations. + + The connection for which to create an ObjectContext + The empty context. + + + + Creates a raw SQL query that will return elements of the given generic type. + The type can be any type that has properties that match the names of the columns returned + from the query, or can be a simple primitive type. The type does not have to be an + entity type. The results of this query are never tracked by the context even if the + type of object returned is an entity type. Use the + method to return entities that are tracked by the context. + + The type of object returned by the query. + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Creates a raw SQL query that will return elements of the given type. + The type can be any type that has properties that match the names of the columns returned + from the query, or can be a simple primitive type. The type does not have to be an + entity type. The results of this query are never tracked by the context even if the + type of object returned is an entity type. Use the + method to return entities that are tracked by the context. + + The type of object returned by the query. + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Executes the given DDL/DML command against the database. + + The command string. + The parameters to apply to the command string. + The result returned by the database after executing the command. + + + + Returns the connection being used by this context. This may cause the + connection to be created if it does not already exist. + + Thrown if the context has been disposed. + + + + Returns the as a delegate that can be called with + an instance of the that owns this Database object, or returns null if + there is no initializer set for this context type. + + The initializer delegate or null. + + + + The connection factory to use when creating a from just + a database name or a connection string. + + + This is used when just a database name or connection string is given to or when + the no database name or connection is given to DbContext in which case the name of + the context class is passed to this factory in order to generate a DbConnection. + By default, the instance to use is read from the applications .config + file from the "EntityFramework DefaultConnectionFactory" entry in appSettings. If no entry is found in + the config file then is used. Setting this property in code + always overrides whatever value is found in the config file. + + + + + Checks wether or not the DefaultConnectionFactory has been set to something other than its default value. + + + + + + + Common code for generic and non-generic string Include. + + + + + + Returns a new query where the entities returned will not be cached in the + or . This method works by calling the AsNoTracking method of the + underlying query object. If the underlying query object does not have a AsNoTracking method, + then calling this method will have no affect. + + The element type. + The source query. + A new query with NoTracking applied, or the source query if NoTracking is not supported. + + + + Returns a new query where the entities returned will not be cached in the + or . This method works by calling the AsNoTracking method of the + underlying query object. If the underlying query object does not have a AsNoTracking method, + then calling this method will have no affect. + + The source query. + A new query with NoTracking applied, or the source query if NoTracking is not supported. + + + + Common code for generic and non-generic AsNoTracking. + + + + + Enumerates the query such that for server queries such as those of , , + , and others the results of the query will be loaded into the associated , + or other cache on the client. + This is equivalent to calling ToList and then throwing away the list without the overhead of actually creating the list. + + The source query. + + + + Returns an implementation that stays in sync with the given . + + The element type. + The collection that the binding list will stay in sync with. + The binding list. + + + + DbModelBuilder is used to map CLR classes to a database schema. + This code centric approach to building an Entity Data Model (EDM) model is known as 'Code First'. + + + DbModelBuilder is typically used to configure a model by overriding . + You can also use DbModelBuilder independently of DbContext to build a model and then construct a + or . + The recommended approach, however, is to use OnModelCreating in as + the workflow is more intuitive and takes care of common tasks, such as caching the created model. + + Types that form your model are registered with DbModelBuilder and optional configuration can be + performed by applying data annotations to your classes and/or using the fluent style DbModelBuilder + API. + + When the Build method is called a set of conventions are run to discover the initial model. + These conventions will automatically discover aspects of the model, such as primary keys, and + will also process any data annotations that were specified on your classes. Finally + any configuration that was performed using the DbModelBuilder API is applied. + + Configuration done via the DbModelBuilder API takes precedence over data annotations which + in turn take precedence over the default conventions. + + + + + Initializes a new instance of the class. + + The process of discovering the initial model will use the set of conventions included + in the most recent version of the Entity Framework installed on your machine. + + + Upgrading to newer versions of the Entity Framework may cause breaking changes + in your application because new conventions may cause the initial model to be + configured differently. There is an alternate constructor that allows a specific + version of conventions to be specified. + + + + + Initializes a new instance of the class that will use + a specific set of conventions to discover the initial model. + + The version of conventions to be used. + + + + Excludes a type from the model. This is used to remove types from the model that were added + by convention during initial model discovery. + + The type to be excluded. + The same DbModelBuilder instance so that multiple calls can be chained. + + + + Excludes a type(s) from the model. This is used to remove types from the model that were added + by convention during initial model discovery. + + The types to be excluded from the model. + The same DbModelBuilder instance so that multiple calls can be chained. + + + + Registers an entity type as part of the model and returns an object that can be used to + configure the entity. This method can be called multiple times for the same entity to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified entity type. + + + + Registers a type as an entity in the model and returns an object that can be used to + configure the entity. This method can be called multiple times for the same type to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified entity type. + + + + Registers a type as a complex type in the model and returns an object that can be used to + configure the complex type. This method can be called multiple times for the same type to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified complex type. + + + + Creates a based on the configuration performed using this builder. + The connection is used to determine the database provider being used as this + affects the database layer of the generated model. + + Connection to use to determine provider information. + The model that was built. + + + + Creates a based on the configuration performed using this builder. + Provider information must be specified because this affects the database layer of the generated model. + For SqlClient the invariant name is 'System.Data.SqlClient' and the manifest token is the version year (i.e. '2005', '2008' etc.) + + The database provider that the model will be used with. + The model that was built. + + + + Provides access to the settings of this DbModelBuilder that deal with conventions. + + + + + Gets the for this DbModelBuilder. + The registrar allows derived entity and complex type configurations to be registered with this builder. + + + + + A value from this enumeration can be provided directly to the + class or can be used in the applied to + a class derived from . The value used defines which version of + the DbContext and DbModelBuilder conventions should be used when building a model from + code--also know as "Code First". + + + Using DbModelBuilderVersion.Latest ensures that all the latest functionality is available + when upgrading to a new release of the Entity Framework. However, it may result in an + application behaving differently with the new release than it did with a previous release. + This can be avoided by using a specific version of the conventions, but if a version + other than the latest is set then not all the latest functionality will be available. + + + + + Indicates that the latest version of the and + conventions should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 4.1 + through 4.3 should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 5.0 + when targeting .NET 4 should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 5.0 + when targeting .NET 4.5 should be used. + + + + + This attribute can be applied to a class derived from to set which + version of the DbContext and conventions should be used when building + a model from code--also know as "Code First". See the + enumeration for details about DbModelBuilder versions. + + + If the attribute is missing from DbContextthen DbContext will always use the latest + version of the conventions. This is equivalent to using DbModelBuilderVersion.Latest. + + + + + Initializes a new instance of the class. + + The conventions version to use. + + + + Gets the conventions version. + + The conventions version. + + + + A non-generic version of which can be used when the type of entity + is not known at build time. + + + + + Represents a non-generic LINQ to Entities query against a DbContext. + + + + + An internal interface implemented by and that allows access to + the internal query without using reflection. + + + + + The underlying internal set. + + + + + Internal constructor prevents external classes deriving from DbQuery. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + Instead populate a DbSet with data, for example by using the Load extension method, and + then bind to local data. For WPF bind to DbSet.Local. For Windows Forms bind to + DbSet.Local.ToBindingList(). + + + Never returns; always throws. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Returns the equivalent generic object. + + The type of element for which the query was created. + The generic set object. + + + + Returns a representation of the underlying query. + + + The query string. + + + + + Returns false. + + false. + + + + The IQueryable element type. + + + + + The IQueryable LINQ Expression. + + + + + The IQueryable provider. + + + + + Gets the underlying internal query object. + + The internal query. + + + + The internal query object that is backing this DbQuery + + + + + An internal interface implemented by and that allows access to + the internal set without using reflection. + + + + + The underlying internal set. + + + + + Internal constructor prevents external classes deriving from DbSet. + + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Returns the equivalent generic object. + + The type of entity for which the set was created. + The generic set object. + + + + Creates a raw SQL query that will return entities in this set. By default, the + entities returned are tracked by the context; this can be changed by calling + AsNoTracking on the returned. + Note that the entities returned are always of the type for this set and never of + a derived type. If the table or tables queried may contain data for other entity + types, then the SQL query must be written appropriately to ensure that only entities of + the correct type are returned. + + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + The internal IQueryable that is backing this DbQuery + + + + + Gets the underlying internal set. + + The internal set. + + + + A DbSet represents the collection of all entities in the context, or that can be queried from the + database, of a given type. DbSet objects are created from a DbContext using the DbContext.Set method. + + + Note that DbSet does not support MEST (Multiple Entity Sets per Type) meaning that there is always a + one-to-one correlation between a type and a set. + + The type that defines the set. + + + + Represents a LINQ to Entities query against a DbContext. + + The type of entity to query for. + + + + Creates a new query that will be backed by the given internal query object. + + The backing query. + + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Throws an exception indicating that binding directly to a store query is not supported. + Instead populate a DbSet with data, for example by using the Load extension method, and + then bind to local data. For WPF bind to DbSet.Local. For Windows Forms bind to + DbSet.Local.ToBindingList(). + + + Never returns; always throws. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Returns a representation of the underlying query. + + + The query string. + + + + + Returns a new instance of the non-generic class for this query. + + A non-generic version. + + + + Returns false. + + false. + + + + The IQueryable element type. + + + + + The IQueryable LINQ Expression. + + + + + The IQueryable provider. + + + + + The internal query object that is backing this DbQuery + + + + + The internal query object that is backing this DbQuery + + + + + An IDbSet represents the collection of all entities in the context, or that can be queried from the + database, of a given type. DbSet is a concrete implementation of IDbSet. + + The type that defines the set. + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + Creates a new set that will be backed by the given . + + The internal set. + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Returns the equivalent non-generic object. + + The non-generic set object. + + + + Creates a raw SQL query that will return entities in this set. By default, the + entities returned are tracked by the context; this can be changed by calling + AsNoTracking on the returned. + Note that the entities returned are always of the type for this set and never of + a derived type. If the table or tables queried may contain data for other entity + types, then the SQL query must be written appropriately to ensure that only entities of + the correct type are returned. + + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + The internal IQueryable that is backing this DbQuery + + + + + An implementation of IDatabaseInitializer that will always recreate and optionally re-seed the + database the first time that a context is used in the app domain. + To seed the database, create a derived class and override the Seed method. + + The type of the context. + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + An implementation of IDatabaseInitializer that will DELETE, recreate, and optionally re-seed the + database only if the model has changed since the database was created. + + + Whether or not the model has changed is determined by the + method. + To seed the database create a derived class and override the Seed method. + + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + Returned by the ChangeTracker method of to provide access to features of + the context that are related to change tracking of entities. + + + + + Initializes a new instance of the class. + + The internal context. + + + + Gets objects for all the entities tracked by this context. + + The entries. + + + + Gets objects for all the entities of the given type + tracked by this context. + + The type of the entity. + The entries. + + + + Detects changes made to the properties and relationships of POCO entities. Note that some types of + entity (such as change tracking proxies and entities that derive from ) + report changes automatically and a call to DetectChanges is not normally needed for these types of entities. + Also note that normally DetectChanges is called automatically by many of the methods of + and its related classes such that it is rare that this method will need to be called explicitly. + However, it may be desirable, usually for performance reasons, to turn off this automatic calling of + DetectChanges using the AutoDetectChangesEnabled flag from . + + + + + A non-generic version of the class. + + + + + This is an abstract base class use to represent a scalar or complex property, or a navigation property + of an entity. Scalar and complex properties use the derived class , + reference navigation properties use the derived class , and collection + navigation properties use the derived class . + + + + + Creates a from information in the given . + This method will create an instance of the appropriate subclass depending on the metadata contained + in the InternalMemberEntry instance. + + The internal member entry. + The new entry. + + + + Validates this property. + + + Collection of objects. Never null. If the entity is valid the collection will be empty. + + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the name of the property. + + The property name. + + + + Gets or sets the current value of this property. + + The current value. + + + + The to which this member belongs. + + An entry for the entity that owns this member. + + + + Gets the backing this object. + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal collection entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the collection of entities from the database. + Note that entities that already exist in the context are not overwritten with values from the database. + + + + + Returns the query that would be used to load this collection from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database, such + as counting the number of entities in the collection in the database without actually loading them. + + A query for the collection. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the collection element. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the collection of entities has been loaded from the database. + + true if the collection is loaded; otherwise, false. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Gets the backing this object as an . + + The internal member entry. + + + + Instances of this class are returned from the Collection method of + and allow operations such as loading to + be performed on the an entity's collection navigation properties. + + The type of the entity to which this property belongs. + The type of the element in the collection of entities. + + + + This is an abstract base class use to represent a scalar or complex property, or a navigation property + of an entity. Scalar and complex properties use the derived class , + reference navigation properties use the derived class , and collection + navigation properties use the derived class . + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + This method will create an instance of the appropriate subclass depending on the metadata contained + in the InternalMemberEntry instance. + + The internal member entry. + The new entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Validates this property. + + + Collection of objects. Never null. If the entity is valid the collection will be empty. + + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets the underlying . + + The internal member entry. + + + + The to which this member belongs. + + An entry for the entity that owns this member. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal collection entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the collection of entities from the database. + Note that entities that already exist in the context are not overwritten with values from the database. + + + + + Returns the query that would be used to load this collection from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database, such + as counting the number of entities in the collection in the database without actually loading them. + + A query for the collection. + + + + Returns a new instance of the non-generic class for + the navigation property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the collection of entities has been loaded from the database. + + true if the collection is loaded; otherwise, false. + + + + Gets the underlying as an . + + The internal member entry. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + An immutable representation of an Entity Data Model (EDM) model that can be used to create an + or can be passed to the constructor of a . + For increased performance, instances of this type should be cached and re-used to construct contexts. + + + + + For mocking. + + + + + Creates a model for the given EDM metadata model. + + The EDM metadata model. + + + + Creates an instance of ObjectContext or class derived from ObjectContext. Note that an instance + of DbContext can be created instead by using the appropriate DbContext constructor. + If a derived ObjectContext is used, then it must have a public constructor with a single + EntityConnection parameter. + The connection passed is used by the ObjectContext created, but is not owned by the context. The caller + must dispose of the connection once the context has been disposed. + + The type of context to create. + An existing connection to a database for use by the context. + + + + + Gets a cached delegate (or creates a new one) used to call the constructor for the given derived ObjectContext type. + + + + + A snapshot of the that was used to create this compiled model. + + + + + The provider info (provider name and manifest token) that was used to create this model. + + + + + A non-generic version of the class. + + + + + A non-generic version of the class. + + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the original value of this property. + + The original value. + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets or sets a value indicating whether the value of this property has been modified since + it was loaded from the database. + + + true if this instance is modified; otherwise, false. + + + + + The to which this property belongs. + + An entry for the entity that owns this property. + + + + The of the property for which this is a nested property. + This method will only return a non-null entry for properties of complex objects; it will + return null for properties of the entity itself. + + An entry for the parent complex property, or null if this is an entity property. + + + + Gets the backing this object. + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The name of the nested property. + An object representing the nested property. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the complex property. + The equivalent generic object. + + + + Instances of this class are returned from the ComplexProperty method of + and allow access to the state of a complex property. + + The type of the entity to which this property belongs. + The type of the property. + + + + Instances of this class are returned from the Property method of + and allow access to the state of the scalar + or complex property. + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the original value of this property. + + The original value. + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets or sets a value indicating whether the value of this property has been modified since + it was loaded from the database. + + + true if this instance is modified; otherwise, false. + + + + + The to which this property belongs. + + An entry for the entity that owns this property. + + + + The of the property for which this is a nested property. + This method will only return a non-null entry for properties of complex objects; it will + return null for properties of the entity itself. + + An entry for the parent complex property, or null if this is an entity property. + + + + Gets the underlying as an . + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The type of the nested property. + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The type of the nested property. + An expression representing the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The type of the nested property. + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The type of the nested property. + An expression representing the nested property. + An object representing the nested property. + + + + Describes the origin of the database connection string associated with a . + + + + + The connection string was created by convention. + + + + + The connection string was read from external configuration. + + + + + The connection string was explicitly specified at runtime. + + + + + The connection string was overriden by connection information supplied to DbContextInfo. + + + + + Returned by the Configuration method of to provide access to configuration + options for the context. + + + + + Initializes a new instance of the class. + + The internal context. + + + + Gets or sets a value indicating whether lazy loading of relationships exposed as + navigation properties is enabled. Lazy loading is enabled by default. + + true if lazy loading is enabled; otherwise, false. + + + + Gets or sets a value indicating whether or not the framework will create instances of + dynamically generated proxy classes whenever it creates an instance of an entity type. + Note that even if proxy creation is enabled with this flag, proxy instances will only + be created for entity types that meet the requirements for being proxied. + Proxy creation is enabled by default. + + true if proxy creation is enabled; otherwise, false. + + + + + Gets or sets a value indicating whether tracked entities should be validated automatically when + is invoked. + The default value is true. + + + + + Provides runtime information about a given type. + + + + + Creates a new instance representing a given type. + + The type deriving from . + + + + Creates a new instance representing a given targeting a specific database. + + The type deriving from . + Connection information for the database to be used. + + + + Creates a new instance representing a given type. An external list of + connection strings can be supplied and will be used during connection string resolution in place + of any connection strings specified in external configuration files. + + + It is preferable to use the constructor that accepts the entire config document instead of using this + constructor. Providing the entire config document allows DefaultConnectionFactroy entries in the config + to be found in addition to explicitly specified connection strings. + + The type deriving from . + A collection of connection strings. + + + + Creates a new instance representing a given type. An external config + object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + + The type deriving from . + An object representing the config file. + + + + Creates a new instance representing a given , targeting a specific database. + An external config object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + + The type deriving from . + An object representing the config file. + Connection information for the database to be used. + + + + Creates a new instance representing a given type. A + can be supplied in order to override the default determined provider used when constructing + the underlying EDM model. + + The type deriving from . + A specifying the underlying ADO.NET provider to target. + + + + Creates a new instance representing a given type. An external config + object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + A can be supplied in order to override the default determined + provider used when constructing the underlying EDM model. This can be useful to prevent EF from + connecting to discover a manifest token. + + The type deriving from . + An object representing the config file. + A specifying the underlying ADO.NET provider to target. + + + + Called internally when a context info is needed for an existing context, which may not be constructable. + + The context instance to get info from. + + + + If instances of the underlying type can be created, returns + a new instance; otherwise returns null. + + A instance. + + + + The concrete type. + + + + + Whether or not instances of the underlying type can be created. + + + + + The connection string used by the underlying type. + + + + + The connection string name used by the underlying type. + + + + + The ADO.NET provider name of the connection used by the underlying type. + + + + + The origin of the connection string used by the underlying type. + + + + + An action to be run on the DbModelBuilder after OnModelCreating has been run on the context. + + + + + A non-generic version of the class. + + + + + Initializes a new instance of the class. + + The internal entry. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + Note that changing the values in the returned dictionary will not update the values in the database. + If the entity is not found in the database then null is returned. + + The store values. + + + + Reloads the entity from the database overwriting any property values with values from the database. + The entity will be in the Unchanged state after calling this method. + + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The name of the property. + An object representing the property. + + + + Gets an object that represents a complex property of this entity. + + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The name of the member. + An object representing the member. + + + + Returns a new instance of the generic class for the given + generic type for the tracked entity represented by this object. + Note that the type of the tracked entity must be compatible with the generic type or + an exception will be thrown. + + The type of the entity. + A generic version. + + + + Validates this instance and returns validation result. + + + Entity validation result. Possibly null if + method is overridden. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the entity. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + + The original values. + + + + Gets InternalEntityEntry object for this DbEntityEntry instance. + + + + + Instances of this class provide access to information about and control of entities that + are being tracked by the . Use the Entity or Entities methods of + the context to obtain objects of this type. + + The type of the entity. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + Note that changing the values in the returned dictionary will not update the values in the database. + If the entity is not found in the database then null is returned. + + The store values. + + + + Reloads the entity from the database overwriting any property values with values from the database. + The entity will be in the Unchanged state after calling this method. + + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The type of the property. + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The type of the property. + An expression representing the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The type of elements in the collection. + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The type of elements in the collection. + An expression representing the navigation property. + An object representing the navigation property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The name of the property. + An object representing the property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The type of the property. + The name of the property. + An object representing the property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The type of the property. + An expression representing the property. + An object representing the property. + + + + Gets an object that represents a complex property of this entity. + + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a complex property of this entity. + + The type of the complex property. + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a complex property of this entity. + + The type of the complex property. + An expression representing the complex property. + An object representing the complex property. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The name of the member. + An object representing the member. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The type of the member. + The name of the member. + An object representing the member. + + + + Returns a new instance of the non-generic class for + the tracked entity represented by this object. + + A non-generic version. + + + + Validates this instance and returns validation result. + + + Entity validation result. Possibly null if + method is overridden. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the entity. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + + The original values. + + + + Represents an Entity Data Model (EDM) created by the . + The Compile method can be used to go from this EDM representation to a + which is a compiled snapshot of the model suitable for caching and creation of + or instances. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + Creates a for this mode which is a compiled snapshot + suitable for caching and creation of instances. + + The compiled model. + + + + A snapshot of the that was used to create this compiled model. + + + + + A collection of all the properties for an underlying entity or complex object. + + + An instance of this class can be converted to an instance of the generic class + using the Cast method. + Complex properties in the underlying entity or complex object are represented in + the property values as nested instances of this class. + + + + + Initializes a new instance of the class. + + The internal dictionary. + + + + Creates an object of the underlying type for this dictionary and hydrates it with property + values from this dictionary. + + The properties of this dictionary copied into a new object. + + + + Sets the values of this dictionary by reading values out of the given object. + The given object can be of any type. Any property on the object with a name that + matches a property name in the dictionary and can be read will be read. Other + properties will be ignored. This allows, for example, copying of properties from + simple Data Transfer Objects (DTOs). + + The object to read values from. + + + + Creates a new dictionary containing copies of all the properties in this dictionary. + Changes made to the new dictionary will not be reflected in this dictionary and vice versa. + + A clone of this dictionary. + + + + Sets the values of this dictionary by reading values from another dictionary. + The other dictionary must be based on the same type as this dictionary, or a type derived + from the type for this dictionary. + + The dictionary to read values from. + + + + Gets the value of the property just like using the indexed property getter but + typed to the type of the generic parameter. This is useful especially with + nested dictionaries to avoid writing expressions with lots of casts. + + The type of the property. + Name of the property. + The value of the property. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + Gets or sets the value of the property with the specified property name. + The value may be a nested instance of this class. + + The property name. + The value of the property. + + + + Gets the internal dictionary. + + The internal dictionary. + + + + A non-generic version of the class. + + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal reference entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the entity from the database. + Note that if the entity already exists in the context, then it will not overwritten with values from the database. + + + + + Returns the query that would be used to load this entity from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database. + + A query for the entity. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the entity has been loaded from the database. + + true if the entity is loaded; otherwise, false. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Gets the backing this object as an . + + The internal member entry. + + + + Instances of this class are returned from the Reference method of + and allow operations such as loading to + be performed on the an entity's reference navigation properties. + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal reference entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the entity from the database. + Note that if the entity already exists in the context, then it will not overwritten with values from the database. + + + + + Returns the query that would be used to load this entity from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database. + + A query for the entity. + + + + Returns a new instance of the non-generic class for + the navigation property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the entity has been loaded from the database. + + true if the entity is loaded; otherwise, false. + + + + Gets the underlying as an . + + The internal member entry. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Represents a SQL query for entities that is created from a + and is executed using the connection from that context. + Instances of this class are obtained from the instance for the + entity type. The query is not executed when this object is created; it is executed + each time it is enumerated, for example by using foreach. + SQL queries for non-entities are created using the . + See for a generic version of this class. + + + + + Initializes a new instance of the class. + + The internal query. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a new query where the results of the query will not be tracked by the associated + . + + A new query with no-tracking applied. + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Gets the internal query. + + The internal query. + + + + Returns false. + + false. + + + + Represents a SQL query for entities that is created from a + and is executed using the connection from that context. + Instances of this class are obtained from the instance for the + entity type. The query is not executed when this object is created; it is executed + each time it is enumerated, for example by using foreach. + SQL queries for non-entities are created using the . + See for a non-generic version of this class. + + + + + Executes the query and returns an enumerator for the elements. + + An + + object that can be used to iterate through the elements. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a new query where the results of the query will not be tracked by the associated + . + + A new query with no-tracking applied. + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Gets the internal query. + + The internal query. + + + + Returns false. + + false. + + + + Exception thrown by when it was expected that SaveChanges for an entity would + result in a database update but in fact no rows in the database were affected. This usually indicates + that the database has been concurrently updated such that a concurrency token that was expected to match + did not actually match. + Note that state entries referenced by this exception are not serialized due to security and accesses to + the state entries after serialization will return null. + + + + + + Initializes a new instance of the class. + + The internal context. + The inner exception. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Subscribes the SerializeObjectState event. + + + + + Gets objects that represents the entities that could not + be saved to the database. + + The entries representing the entities that could not be saved. + + + + Holds exception state that will be serialized when the exception is serialized. + + + + + Completes the deserialization. + + The deserialized object. + + + + Gets or sets a value indicating whether the exception involved independent associations. + + + + + Initializes a new instance of the class. + + The context. + The inner exception. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Represents an entity used to store metadata about an EDM in the database. + + + + + Attempts to get the model hash calculated by Code First for the given context. + This method will return null if the context is not being used in Code First mode. + + The context. + The hash string. + + + + Gets or sets the ID of the metadata entity, which is currently always 1. + + The id. + + + + Gets or sets the model hash which is used to check whether the model has + changed since the database was created from it. + + The model hash. + + + + Contains methods used to access the Entity Data Model created by Code First in the EDMX form. + These methods are typically used for debugging when there is a need to look at the model that + Code First creates internally. + + + + + Uses Code First with the given context and writes the resulting Entity Data Model to the given + writer in EDMX form. This method can only be used with context instances that use Code First + and create the model internally. The method cannot be used for contexts created using Database + First or Model First, for contexts created using a pre-existing , or + for contexts created using a pre-existing . + + The context. + The writer. + + + + Writes the Entity Data Model represented by the given to the + given writer in EDMX form. + + An object representing the EDM. + The writer. + + + + A factory for creating derived instances. Implement this + interface to enable design-time services for context types that do not have a + public default constructor. + + At design-time, derived instances can be created in order to enable specific + design-time experiences such as model rendering, DDL generation etc. To enable design-time instantiation + for derived types that do not have a public, default constructor, implement + this interface. Design-time services will auto-discover implementations of this interface that are in the + same assembly as the derived type. + + + + + + Creates a new instance of a derived type. + + An instance of TContext + + + + This convention causes DbModelBuilder to include metadata about the model + when it builds the model. When creates a model by convention it will + add this convention to the list of those used by the DbModelBuilder. This will then result in + model metadata being written to the database if the DbContext is used to create the database. + This can then be used as a quick check to see if the model has changed since the last time it was + used against the database. + This convention can be removed from the conventions by overriding + the OnModelCreating method on a derived DbContext class. + + + + + Adds metadata to the given model configuration. + + The model configuration. + + + + This convention uses the name of the derived + class as the container for the conceptual model built by + Code First. + + + + + Initializes a new instance of the class. + + The model container name. + + + + Applies the convention to the given model. + + The model. + + + + This convention uses the namespace of the derived + class as the namespace of the conceptual model built by + Code First. + + + + + Initializes a new instance of the class. + + The model namespace. + + + + Applies the convention to the given model. + + The model. + + + + Instances of this class are used internally to create constant expressions for + that are inserted into the expression tree to replace references to + and . + + The type of the element. + + + + Private constructor called by the Create factory method. + + The query. + + + + Factory method called by CreateDelegate to create an instance of this class. + + The query, which must be a generic object of the expected type. + A new instance. + + + + The public property expected in the LINQ expression tree. + + The query. + + + + Instances of this class are used to create DbConnection objects for + SQL Server Compact Edition based on a given database name or connection string. + + + It is necessary to provide the provider invariant name of the SQL Server Compact + Edition to use when creating an instance of this class. This is because different + versions of SQL Server Compact Editions use different invariant names. + An instance of this class can be set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use SQL Server Compact Edition by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Creates a new connection factory with empty (default) DatabaseDirectory and BaseConnectionString + properties. + + The provider invariant name that specifies the version of SQL Server Compact Edition that should be used. + + + + Creates a new connection factory with the given DatabaseDirectory and BaseConnectionString properties. + + + The provider invariant name that specifies the version of SQL Server Compact Edition that should be used. + + + The path to prepend to the database name that will form the file name used by SQL Server Compact Edition + when it creates or reads the database file. An empty string means that SQL Server Compact Edition will use + its default for the database file location. + + + The connection string to use for options to the database other than the 'Data Source'. The Data Source will + be prepended to this string based on the database name when CreateConnection is called. + + + + + Creates a connection for SQL Server Compact Edition based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + The path to prepend to the database name that will form the file name used by + SQL Server Compact Edition when it creates or reads the database file. + The default value is "|DataDirectory|", which means the file will be placed + in the designated data directory. + + + + + The connection string to use for options to the database other than the 'Data Source'. + The Data Source will be prepended to this string based on the database name when + CreateConnection is called. + The default is the empty string, which means no other options will be used. + + + + + The provider invariant name that specifies the version of SQL Server Compact Edition + that should be used. + + + + + Instances of this class are used to create DbConnection objects for + SQL Server based on a given database name or connection string. By default, the connection is + made to '.\SQLEXPRESS'. This can be changed by changing the base connection + string when constructing a factory instance. + + + An instance of this class can be set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use SQL Server by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Creates a new connection factory with a default BaseConnectionString property of + 'Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True'. + + + + + Creates a new connection factory with the given BaseConnectionString property. + + + The connection string to use for options to the database other than the 'Initial Catalog'. The 'Initial Catalog' will + be prepended to this string based on the database name when CreateConnection is called. + + + + + Creates a connection for SQL Server based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + Remove hard dependency on DbProviderFactories. + + + + + The connection string to use for options to the database other than the 'Initial Catalog'. + The 'Initial Catalog' will be prepended to this string based on the database name when + CreateConnection is called. + The default is 'Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True'. + + + + + This attribute can be applied to either an entire derived class or to + individual or properties on that class. When applied + any discovered or properties will still be included + in the model but will not be automatically initialized. + + + + + Thrown when a context is generated from the templates in Database First or Model + First mode and is then used in Code First mode. + + + Code generated using the T4 templates provided for Database First and Model First use may not work + correctly if used in Code First mode. To use these classes with Code First please add any additional + configuration using attributes or the DbModelBuilder API and then remove the code that throws this + exception. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The object that holds the serialized object data. + The contextual information about the source or destination. + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Implements ICachedMetadataWorkspace for a Code First model. + + + + + Represents an object that holds a cached copy of a MetadataWorkspace and optionally the + assemblies containing entity types to use with that workspace. + + + + + Gets the MetadataWorkspace, potentially lazily creating it if it does not already exist. + If the workspace is not compatible with the provider manifest obtained from the given + connection then an exception is thrown. + + The connection to use to create or check SSDL provider info. + The workspace. + + + + The list of assemblies that contain entity types for this workspace, which may be empty, but + will never be null. + + + + + The default container name for code first is the container name that is set from the DbModelBuilder + + + + + The provider info used to construct the workspace. + + + + + Builds and stores the workspace based on the given code first configuration. + + The code first EDM model. + + + + Gets the . + If the workspace is not compatible with the provider manifest obtained from the given + connection then an exception is thrown. + + The connection to use to create or check SSDL provider info. + The workspace. + + + + The default container name for code first is the container name that is set from the DbModelBuilder + + + + + The list of assemblies that contain entity types for this workspace, which may be empty, but + will never be null. + + + + + The provider info used to construct the workspace. + + + + + The methods here are called from multiple places with an ObjectContext that may have + been created in a variety of ways and ensure that the same code is run regardless of + how the context was created. + + + + + Used a delegate to do the actual creation once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + Note however that a context obtained from only a connection will have no model and so + will result in an empty database. + + + + + Used a delegate to do the actual existence check once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + + + + + Used a delegate to do the actual check/delete once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given set of entity types and DbSet initializer delegate. + + + + + The entity types part of the pair. + + + + + The DbSet properties initializer part of the pair. + + + + + Static helper methods only. + + + + + Checks whether the given value is null and throws ArgumentNullException if it is. + This method should only be used in places where Code Contracts are compiled out in the + release build but we still need public surface null-checking, such as where a public + abstract class is implemented by an internal concrete class. + + + + + Checks whether the given string is null, empty, or just whitespace, and throws appropriately + if the check fails. + This method should only be used in places where Code Contracts are compiled out in the + release build but we still need public surface checking, such as where a public + abstract class is implemented by an internal concrete class. + + + + + Given two key values that may or may not be byte arrays, this method determines + whether or not they are equal. For non-binary key values, this is equivalent + to Object.Equals. For binary keys, it is by comparison of every byte in the + arrays. + + + + + Provides a standard helper method for quoting identifiers + + Identifier to be quoted. Does not validate that this identifier is valid. + Quoted string + + + + Checks the given string which might be a database name or a connection string and determines + whether it should be treated as a name or connection string. Currently, the test is simply + whether or not the string contains an '=' character--if it does, then it should be treated + as a connection string. + + The name or connection string. + true if the string should be treated as a connection string; false if it should be treated as a name. + + + + Determines whether the given string should be treated as a database name directly (it contains no '='), + is in the form name=foo, or is some other connection string. If it is a direct name or has name=, then + the name is extracted and the method returns true. + + The name or connection string. + The name. + True if a name is found; false otherwise. + + + + Determines whether the given string is a full EF connection string with provider, provider connection string, + and metadata parts, or is is instead some other form of connection string. + + The name or connection string. + true if the given string is an EF connection string; otherwise, false. + + + + + Parses a property selector expression used for the expression-based versions of the Property, Collection, Reference, + etc methods on and + classes. + + The type of the entity. + The type of the property. + The property. + Name of the method. + Name of the param. + The property name. + + + + Called recursively to parse an expression tree representing a property path such + as can be passed to Include or the Reference/Collection/Property methods of . + This involves parsing simple property accesses like o => o.Products as well as calls to Select like + o => o.Products.Select(p => p.OrderLines). + + The expression to parse. + The expression parsed into an include path, or null if the expression did not match. + True if matching succeeded; false if the expression could not be parsed. + + + + Gets a cached dictionary mapping property names to property types for all the properties + in the given type. + + + + + Gets a dictionary of compiled property setter delegates for the underlying types. + The dictionary is cached for the type in the app domain. + + + + + Used by the property setter delegates to throw for attempts to set null onto + non-nullable properties or otherwise go ahead and set the property. + + + + + Gets a dictionary of compiled property getter delegates for the underlying types. + The dictionary is cached for the type in the app domain. + + + + + Creates a new with the NoTracking merge option applied. + The query object passed in is not changed. + + The query. + A new query with NoTracking applied. + + + + Converts to + + + Name of the property being validated with ValidationAttributes. Null for type-level validation. + + + ValidationResults instances to be converted to instances. + + + An created based on the + . + + + class contains a property with names of properties the error applies to. + On the other hand each applies at most to a single property. As a result for + each name in ValidationResult.MemberNames one will be created (with some + exceptions for special cases like null or empty .MemberNames or null names in the .MemberNames). + + + + + Calculates a "path" to a property. For primitive properties on an entity type it is just the + name of the property. Otherwise it is a dot separated list of names of the property and all + its ancestor properties starting from the entity. + + Property for which to calculate the path. + Dot separated path to the property. + + + + Gets names of the property and its ancestor properties as enumerable walking "bottom-up". + + Property for which to get the segments. + Names of the property and its ancestor properties. + + + + Gets an type for the given element type. + + Type of the element. + The collection type. + + + + Creates a database name given a type derived from DbContext. This handles nested and + generic classes. No attempt is made to ensure that the name is not too long since this + is provider specific. If a too long name is generated then the provider will throw and + the user must correct by specifying their own name in the DbContext constructor. + + Type of the context. + The database name to use. + + + + A local (in-memory) view of the entities in a DbSet. + This view contains Added entities and does not contain Deleted entities. The view extends + from and hooks up events between the collection and the + state manager to keep the view in sync. + + The type of the entity. + + + + Initializes a new instance of the class for entities + of the given generic type in the given internal context. + + The internal context. + + + + Called by the base class when the collection changes. + This method looks at the change made to the collection and reflects those changes in the + state manager. + + The instance containing the event data. + + + + Handles events from the state manager for entities entering, leaving, or being marked as deleted. + The local view is kept in sync with these changes. + + The sender. + The instance containing the event data. + + + + Clears the items by calling remove on each item such that we get Remove events that + can be tracked back to the state manager, rather than a single Reset event that we + cannot deal with. + + + + + Adds a contains check to the base implementation of InsertItem since we can't support + duplicate entities in the set. + + The index at which to insert. + The item to insert. + + + + Returns a cached binding list implementation backed by this ObservableCollection. + + The binding list. + + + + Service used to search for instance properties on a DbContext class that can + be assigned a DbSet instance. Also, if the the property has a public setter, + then a delegate is compiled to set the property to a new instance of DbSet. + All of this information is cached per app domain. + + + + + Creates a set discovery service for the given derived context. + + + + + Processes the given context type to determine the DbSet or IDbSet + properties and collect root entity types from those properties. Also, delegates are + created to initialize any of these properties that have public setters. + If the type has been processed previously in the app domain, then all this information + is returned from a cache. + + A dictionary of potential entity type to the list of the names of the properties that used the type. + + + + Calls the public setter on any property found to initialize it to a new instance of DbSet. + + + + + Registers the entities and their entity set name hints with the given . + + The model builder. + + + + Returns false if SuppressDbSetInitializationAttribute is found on the property or the class, otherwise + returns true. + + + + + Determines whether or not an instance of DbSet/ObjectSet can be assigned to a property of the given type. + + The type to check. + The entity type of the DbSet/ObjectSet that can be assigned, or null if no set type can be assigned. + + + + + A EagerInternalConnection object wraps an already existing DbConnection object. + + + + + InternalConnection objects manage DbConnections. + Two concrete base classes of this abstract interface exist: + and . + + + + + IInternalConnection objects manage DbConnections. + Two concrete implementations of this interface exist--LazyInternalConnection and EagerInternalConnection. + + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Returns the underlying DbConnection. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if the connection contains model info; otherwise, false. + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strins. + + + + + Gets or sets the provider to be used when creating the underlying connection. + + + + + Gets the name of the underlying connection string. + + + + + Gets the original connection string. + + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Called after the connection is initialized for the first time. + + + + + Adds a tracking cookie to the connection string for SqlConnections. Returns the + possibly modified store connection string. + + + + + Returns the underlying DbConnection. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if the connection contains model info; otherwise, false. + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strins. + + + + + Gets or sets the provider to be used when creating the underlying connection. + + + + + Gets the name of the underlying connection string. + + + + + Gets the original connection string. + + + + + Gets or sets the underlying object. No initialization is done when the + connection is obtained, and it can also be set to null. + + The underlying connection. + + + + Creates a new EagerInternalConnection that wraps an existing DbConnection. + + An existing connection. + If set to true then the underlying connection should be disposed when this object is disposed. + + + + Dispose the existing connection is the original caller has specified that it should be disposed + by the framework. + + + + + Returns the origin of the underlying connection string. + + + + + An is an where the + instance that it wraps is set immediately at construction time rather than being created lazily. In this case + the internal context may or may not own the instance but will only dispose it + if it does own it. + + + + + An underlies every instance of and wraps an + instance. + The also acts to expose necessary information to other parts of the design in a + controlled manner without adding a lot of internal methods and properties to the + class itself. + Two concrete classes derive from this abstract class - and + . + + + + + Initializes the object with its owner. + + The owner . + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Creates a new temporary based on the same metadata and connection as the real + and sets it as the context to use DisposeTempObjectContext is called. + This allows this internal context and its DbContext to be used for transient operations + such as initializing and seeding the database, after which it can be thrown away. + This isolates the real from any changes made and and saves performed. + + + + + If a temporary ObjectContext was set with UseTempObjectContext, then this method disposes that context + and returns this internal context and its DbContext to using the real ObjectContext. + + + + + Called by methods of to create a database either using the Migrations pipeline + if possible and the core provider otherwise. + + The context to use for core provider calls. + + + + Internal implementation of . + + True if the model hash in the context and the database match; false otherwise. + + + + Checks whether the given model (an EDMX document) matches the current model. + + + + + Queries the database for a model hash and returns it if found or returns null if the table + or the row doesn't exist in the database. + + The model hash, or null if not found. + + + + Queries the database for a model stored in the MigrationHistory table and returns it as an EDMX, or returns + null if the database does not contain a model. + + + + + Saves the model hash from the context to the database. + + + + + Performs the initialization action that may result in a and + handle the exception to provide more meaning to the user. + + The action. + + + + Registers for the ObjectStateManagerChanged event on the underlying ObjectStateManager. + This is a virtual method on this class so that it can be mocked. + + The event handler. + + + + Checks whether or not the given object is in the context in any state other than Deleted. + This is a virtual method on this class so that it can be mocked. + + The entity. + true if the entity is in the context and not deleted; otherwise false. + + + + Saves all changes made in this context to the underlying database. + + The number of objects written to the underlying database. + + + + Initializes this instance, which means both the context is initialized and the underlying + database is initialized. + + + + + Initializes the underlying ObjectContext but does not cause the database to be initialized. + + + + + Marks the database as having not been initialized. This is called when the app calls Database.Delete so + that the database if the app attempts to then use the database again it will be re-initialized automatically. + + + + + Runs the unless it has already been run or there + is no initializer for this context type in which case this method does nothing. + + + + + Marks the database as having been initialized without actually running the . + + + + + Runs the if one has been set for this context type. + Calling this method will always cause the initializer to run even if the database is marked + as initialized. + + + + + Disposes the context. Override the DisposeContext method to perform + additional work when disposing. + + + + + Performs additional work to dispose a context. + + + + + Calls DetectChanges on the underlying if AutoDetectChangesEnabled is + true or if force is set to true. + + if set to true then DetectChanges is called regardless of the value of AutoDetectChangesEnabled. + + + + Returns the DbSet instance for the given entity type. + This property is virtual and returns to that it can be mocked. + + The entity type for which a set should be returned. + A set for the given entity type. + + + + Returns the non-generic instance for the given entity type. + This property is virtual and returns to that it can be mocked. + + The entity type for which a set should be returned. + A set for the given entity type. + + + + Creates an internal set using an app domain cached delegate. + + Type of the entity. + The set. + + + + Returns the entity set and the base type for that entity set for the given type. + This method does o-space loading if required and throws if the type is not in the model. + + The entity type to lookup. + The entity set and base type pair. + + + + Returns the entity set and the base type for that entity set for the given type if that + type is mapped in the model, otherwise returns null. + This method does o-space loading if required. + + The entity type to lookup. + The entity set and base type pair, or null if not found. + + + + Checks whether or not the given entity type is mapped in the model. + + The entity type to lookup. + True if the type is mapped as an entity; false otherwise. + + + + Gets the local entities of the type specified from the state manager. That is, all + Added, Modified, and Unchanged entities of the given type. + + The type of entity to get. + The entities. + + + + Executes the given SQL query against the database backing this context. The results are not materialized as + entities or tracked. + + The type of the element. + The SQL. + The parameters. + The query results. + + + + Executes the given SQL query against the database backing this context. The results are not materialized as + entities or tracked. + + Type of the element. + The SQL. + The parameters. + The query results. + + + + Calls the generic ExecuteSqlQuery but with a non-generic return type so that it + has the correct signature to be used with CreateDelegate above. + + + + + Executes the given SQL command against the database backing this context. + + The SQL. + The parameters. + The return value from the database. + + + + Gets the underlying for the given entity, or returns null if the entity isn't tracked by this context. + This method is virtual so that it can be mocked. + + The entity. + The state entry or null. + + + + Gets the underlying objects for all entities tracked by + this context. + This method is virtual so that it can be mocked. + + State entries for all tracked entities. + + + + Gets the underlying objects for all entities of the given + type tracked by this context. + This method is virtual so that it can be mocked. + + The type of the entity. + State entries for all tracked entities of the given type. + + + + Helper method that gets the underlying objects for all entities that + match the given predicate. + + + + + Wraps the given in either a or + a depending on the actual exception type and the state + entries involved. + + The update exception. + A new exception wrapping the given exception. + + + + Uses the underlying context to create an entity such that if the context is configured + to create proxies and the entity is suitable then a proxy instance will be returned. + This method is virtual so that it can be mocked. + + The type of the entity. + The new entity instance. + + + + Uses the underlying context to create an entity such that if the context is configured + to create proxies and the entity is suitable then a proxy instance will be returned. + This method is virtual so that it can be mocked. + + The type of entity to create. + The new entity instance. + + + + This method is used by CreateDelegate to transform the CreateObject method with return type TEntity + into a method with return type object which matches the required type of the delegate. + + + + + Replaces the connection that will be used by this context. + The connection can only be changed before the context is initialized. + + The new connection. + + + + Throws if the context has been disposed. + + + + + Checks whether or not the internal cache of types to entity sets has been initialized, + and initializes it if necessary. + + + + + Forces all DbSets to be initialized, which in turn causes o-space loading to happen + for any entity type for which we have a DbSet. This includes all DbSets that were + discovered on the user's DbContext type. + + + + + Performs o-space loading for the type and returns false if the type is not in the model. + + + + + Performs o-space loading for the type and throws if the type is not in the model. + + Type of the entity. + + + + Returns true if the given entity type does not have EdmEntityTypeAttribute but is in + an assembly that has EdmSchemaAttribute. This indicates mixing of POCO and EOCO in the + same assembly, which is something that we don't support. + + + + + Determines whether or not the given clrType is mapped to a complex type. Assumes o-space loading has happened. + + + + + Updates the cache of types to entity sets either for the first time or after potentially + doing some o-space loading. + + + + + The public context instance that owns this internal context. + + + + + Returns the underlying . + + + + + Gets the temp object context, or null if none has been set. + + The temp object context. + + + + The compiled model created from the Code First pipeline, or null if Code First was + not used to create this context. + Causes the Code First pipeline to be run to create the model if it has not already been + created. + + + + + Set to true when a database initializer is performing some actions, such as creating or deleting + a database, or seeding the database. + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + Gets or sets a value indicating whether lazy loading is enabled. + + + + + Gets or sets a value indicating whether proxy creation is enabled. + + + + + Gets or sets a value indicating whether DetectChanges is called automatically in the API. + + + + + Gets or sets a value indicating whether to validate entities when is called. + + + + + True if the context has been disposed. + + + + + The connection underlying this context. Accessing this property does not cause the context + to be initialized, only its connection. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries, + database intializers and connection strings. + + + + + Gets or sets the provider details to be used when building the EDM model. + + + + + Gets the name of the underlying connection string. + + + + + Gets the provider name bsing used either using a cached value or getting it from + the DbConnection in use. + + + + + Gets or sets a custom OnModelCreating action. + + + + + Gets the DatabaseOperations instance to use to perform Create/Delete/Exists operations + against the database. + Note that this virtual property can be mocked to help with unit testing. + + + + + Gets instance used to create validators and validation contexts. + This property is virtual to allow mocking. + + + + + For mocking. + + + + + Constructs an for an already existing . + + The owner . + The existing . + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Does nothing, since the already exists. + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Disposes the context. The underlying is also disposed if it is owned. + + + + + + + + Returns the underlying . + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + The connection underlying this context. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets a value indicating whether lazy loading is enabled. This is just a wrapper + over the same flag in the underlying . + + + + + Gets or sets a value indicating whether proxy creation is enabled. This is just a wrapper + over the same flag in the underlying ObjectContext. + + + + + An implementation of that represents a clone of another + dictionary. That is, all the property values have been been copied into this dictionary. + + + + + The internal class used to implement . + This internal class allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal context with which the entity of complex object is associated. + The type of the entity or complex object. + If set to true this is a dictionary for an entity, otherwise it is a dictionary for a complex object. + + + + Implemented by subclasses to get the dictionary item for a given property name. + Checking that the name is valid should happen before this method is called such + that subclasses do not need to perform the check. + + Name of the property. + An item for the given name. + + + + Creates an object of the underlying type for this dictionary and hydrates it with property + values from this dictionary. + + The properties of this dictionary copied into a new object. + + + + Creates an instance of the underlying type for this dictionary, which may either be an entity type (in which + case CreateObject on the context is used) or a non-entity type (in which case the empty constructor is used.) + In either case, app domain cached compiled delegates are used to do the creation. + + + + + Sets the values of this dictionary by reading values out of the given object. + The given object must be of the type that this dictionary is based on. + + The object to read values from. + + + + Creates a new dictionary containing copies of all the properties in this dictionary. + Changes made to the new dictionary will not be reflected in this dictionary and vice versa. + + A clone of this dictionary. + + + + Sets the values of this dictionary by reading values from another dictionary. + The other dictionary must be based on the same type as this dictionary, or a type derived + from the type for this dictionary. + + The dictionary to read values from. + + + + Gets the dictionary item for the property with the given name. + This method checks that the given name is valid. + + The property name. + The item. + + + + Sets the value of the property only if it is different from the current value and is not + an invalid attempt to set a complex property. + + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + Gets or sets the value of the property with the specified property name. + The value may be a nested instance of this class. + + The property name. + The value of the property. + + + + Gets the entity type of complex type that this dictionary is based on. + + The type of the object underlying this dictionary. + + + + Gets the internal context with which the underlying entity or complex type is associated. + + The internal context. + + + + Gets a value indicating whether the object for this dictionary is an entity or a complex object. + + true if this this is a dictionary for an entity; false if it is a dictionary for a complex object. + + + + Initializes a new instance of the class by copying + values from the given dictionary. + + The dictionary to clone. + If non-null, then the values for the new dictionary are taken from this record rather than from the original dictionary. + + + + Gets the dictionary item for a given property name. + + Name of the property. + An item for the given name. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + An implementation of for an item in a . + + + + + Represents an item in an representing a property name/value. + + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + true If this instance represents a complex property; otherwise, false. + + + + Gets the type of the underlying property. + + The property type. + + + + Initializes a new instance of the class. + + The name. + The value. + The type. + If set to true this item represents a complex property. + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + + true If this instance represents a complex property; otherwise, false. + + + + + Gets the type of the underlying property. + + The property type. + + + + An implementation of that is based on an existing + instance. + + + + + Initializes a new instance of the class. + + The internal context. + The type. + The data record. + If set to true this is a dictionary for an entity, otherwise it is a dictionary for a complex object. + + + + Gets the dictionary item for a given property name. + + Name of the property. + An item for the given name. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + An implementation of for an item in a . + + + + + Initializes a new instance of the class. + + The data record. + The ordinal. + The value. + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + + true If this instance represents a complex property; otherwise, false. + + + + + Gets the type of the underlying property. + + The property type. + + + + This is version of an internal interface that already exists in System.Data.Entity that + is implemented by . Using this interface allows state + entries to be mocked for unit testing. The plan is to remove this version of the + interface and use the one in System.Data.Entity once we roll into the framework. + Note that some members may need to be added to the interface in the framework when + we combine the two. + + + + + The internal class used to implement and + . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Base class for and + containing common code for collection and reference navigation property entries. + + + + + Base class for all internal entries that represent different kinds of properties. + + + + + Initializes a new instance of the class. + + The internal entity entry. + The member metadata. + + + + Validates this property. + + A sequence of validation errors for this property. Empty if no errors. Never null. + + + + Creates a new non-generic backed by this internal entry. + The actual subtype of the DbMemberEntry created depends on the metadata of this internal entry. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The actual subtype of the DbMemberEntry created depends on the metadata of this internal entry. + + The type of the entity. + The type of the property. + The new entry. + + + + Gets the property name. + The property is virtual to allow mocking. + + The property name. + + + + Gets or sets the current value of the navigation property. + + The current value. + + + + Gets the internal entity entry property belongs to. + This property is virtual to allow mocking. + + The internal entity entry. + + + + Gets the entry metadata. + + The entry metadata. + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Calls Load on the underlying . + + + + + Uses CreateSourceQuery on the underlying to create a query for this + navigation property. + + + + + Gets the navigation property value from the object. + + The entity. + The navigation property value. + + + + Validates that the owning entity entry is associated with an underlying and + is not just wrapping a non-attached entity. + If the entity is not detached, then the RelatedEnd for this navigation property is obtained. + + + + + Calls IsLoaded on the underlying . + + + + + Gets the related end, which will be null if the entity is not being tracked. + + The related end. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + This property is virtual so that it can be mocked. + + The current value. + + + + Gets a delegate that can be used to get the value of the property directly from the entity. + Returns null if the property does not have an accessible getter. + + The getter delegate, or null. + + + + Gets a delegate that can be used to set the value of the property directly on the entity. + Returns null if the property does not have an accessible setter. + + The setter delegate, or null. + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Gets the navigation property value from the object. + Since for a collection the related end is an , it means + that the internal representation of the navigation property is just the related end. + + The entity. + The navigation property value. + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Creates a new generic backed by this internal entry. + The actual subtype of the DbCollectionEntry created depends on the metadata of this internal entry. + + The type of the entity. + The type of the element. + The new entry. + + + + Creates a object for the given entity type + and collection element type. + + The type of the entity. + The type of the property. + Type of the element. + The set. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + + The current value. + + + + The internal class used to implement + and . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal context. + The state entry. + + + + Initializes a new instance of the class for an + entity which may or may not be attached to the context. + + The internal context. + The entity. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + + The store values. + + + + Appends a query for the properties in the entity to the given string builder that is being used to + build the eSQL query. This method may be called recursively to query for all the sub-properties of + a complex property. + + The query builder. + The qualifier with which to prefix each property name. + The dictionary that acts as a template for the properties to query. + + + + Validates that a dictionary can be obtained for the state of the entity represented by this entry. + + The method name being used to request a dictionary. + The state that is invalid for the request being processed. + + + + Calls Refresh with StoreWins on the underlying state entry. + + + + + Gets an internal object representing a reference navigation property. + This method is virtual to allow mocking. + + The navigation property. + The type of entity requested, which may be 'object' or null if any type can be accepted. + The entry. + + + + Gets an internal object representing a collection navigation property. + This method is virtual to allow mocking. + + The navigation property. + The type of entity requested, which may be 'object' or null f any type can be accepted. + The entry. + + + + Gets an internal object representing a navigation, scalar, or complex property. + This method is virtual to allow mocking. + + Name of the property. + The type of entity requested, which may be 'object' if any type can be accepted. + The entry. + + + + Gets an internal object representing a scalar or complex property. + This method is virtual to allow mocking. + + The property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Gets an internal object representing a scalar or complex property. + The property may be a nested property on the given . + + The parent property entry, or null if this is a property directly on the entity. + Name of the property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Gets an internal object representing a scalar or complex property. + The property may be a nested property on the given . + + The parent property entry, or null if this is a property directly on the entity. + Name of the property. + The property split out into its parts. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Checks that the given property name is a navigation property and is either a reference property or + collection property according to the value of requireCollection. + + + + + Gets metadata for the given property if that property is a navigation property or returns null + if it is not a navigation property. + + Name of the property. + Navigation property metadata or null. + + + + Gets the type of entity or entities at the target end of the given navigation property. + + The navigation property. + The CLR type of the entity or entities at the other end. + + + + Gets the related end for the navigation property with the given name. + + The navigation property. + + + + + Uses EDM metadata to validate that the property name exists in the model and represents a scalar or + complex property or exists in the CLR type. + This method is public and virtual so that it can be mocked. + + The property name. + The type on which the property is declared. + The type of object requested, which may be 'object' if any type can be accepted. + Metadata for the property. + + + + Splits the given property name into parts delimited by dots. + + Name of the property. + The parts of the name. + + + + Validates that this entry is associated with an underlying and + is not just wrapping a non-attached entity. + + + + + Validates entity represented by this entity entry. + This method is virtual to allow mocking. + + User defined dictionary containing additional info for custom validation. This parameter is optional and can be null. + containing validation result. Never null. + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the tracked entity. + This property is virtual to allow mocking. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + This property is virtual to allow mocking. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + This property is virtual to allow mocking. + + The original values. + + + + Checks whether or not this entry is associated with an underlying or + is just wrapping a non-attached entity. + + + + + Gets the type of the entity being tracked. + + The type of the entity. + + + + Gets the c-space entity type for this entity from the EDM. + + + + + Gets the underlying object state entry. + + + + + Gets the internal context. + + The internal context. + + + + A concrete implementation of used for properties of entities. + + + + + The internal class used to implement and + . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal entry. + The property info. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. If this is a property of an entity, then this method returns + true if the property is modified. If this is a property of a complex object, then + this method returns true if the top-level complex property on the entity is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + If this is a property of an entity, then this method marks it as modified. + If this is a property of a complex object, then this method marks the top-level + complex property as modified. + + + + + Throws if the user attempts to set a complex property to null. + + The value. + + + + Sets the given value directly onto the underlying entity object. + + The value. + True if the property had a setter that we could attempt to call; false if no setter was available. + + + + Sets the property value, potentially by setting individual nested values for a complex + property. + + The value. + + + + Gets an internal object representing a scalar or complex property of this property, + which must be a mapped complex property. + This method is virtual to allow mocking. + + The property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Validates that the owning entity entry is associated with an underlying and + is not just wrapping a non-attached entity. + + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent entity or complex property. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent entity or complex property. + That is, the original values that contains the value for this property. + + The parent original values. + + + + A delegate that reads the value of this property. + May be null if there is no way to set the value due to missing accessors on the type. + + + + + A delegate that sets the value of this property. + May be null if there is no way to set the value due to missing accessors on the type. + + + + + Gets or sets the original value. + Note that complex properties are returned as objects, not property values. + + + + + Gets or sets the current value. + Note that complex properties are returned as objects, not property values. + Also, for complex properties, the object returned is the actual complex object from the entity + and setting the complex object causes the actual object passed to be set onto the entity. + + The current value. + + + + Gets or sets a value indicating whether this property is modified. + + + + + Gets the property metadata. + + The property metadata. + + + + Initializes a new instance of the class. + + The internal entry. + The property info. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. Since this is a property of an entity this method returns + true if the property is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + Since this is a property of an entity this method marks it as modified. + + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent entity. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent entity. + That is, the original values that contains the value for this property. + + The parent original values. + + + + A concrete implementation of used for properties of complex objects. + + + + + Initializes a new instance of the class. + + The parent property entry. + The property metadata. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. Since this is a property of a complex object + this method returns true if the top-level complex property on the entity is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + Since this is a property of a complex object this method marks the top-level + complex property as modified. + + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent complex property. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent complex property. + That is, the original values that contains the value for this property. + + The parent original values. + + + + The internal class used to implement , + and . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Gets the navigation property value from the object. + For reference navigation properties, this means getting the value from the + object. + + The entity. + The navigation property value. + + + + Sets the navigation property value onto the object. + For reference navigation properties, this means setting the value onto the + object. + + The entity. + The value. + + + + Sets the given value on the given which must be an + . + This method is setup in such a way that it can easily be used by CreateDelegate without any + dynamic code generation needed. + + The type of the related entity. + The entity reference. + The value. + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + + The current value. + + + + Contains metadata about a member of an entity type or complex type. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry if the new entry is nested, otherwise null. + The new entry. + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets the name of the property. + + The name. + + + + Gets the type of the entity or complex object that on which the member is declared. + + The type that the member is declared on. + + + + Gets the type of element for the property, which for non-collection properties + is the same as the MemberType and which for collection properties is the type + of element contained in the collection. + + The type of the element. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + The types of member entries supported. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + if set to true this is a collection nav prop. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry which will always be null for navigation entries. + The new entry. + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + Contains metadata for a property of a complex object or entity. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + if set to true the property is mapped in the EDM. + if set to true the property is a complex property. + + + + Validates that the given name is a property of the declaring type (either on the CLR type or in the EDM) + and that it is a complex or scalar property rather than a nav property and then returns metadata about + the property. + + The internal context. + The type that the property is declared on. + The type of property requested, which may be 'object' if any type can be accepted. + Name of the property. + Metadata about the property, or null if the property does not exist or is a navigation property. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry if the new entry is nested, otherwise null. + The new entry. + + + + Gets a value indicating whether this is a complex property. + That is, not whether or not this is a property on a complex object, but rather if the + property itself is a complex property. + + + true if this instance is complex; otherwise, false. + + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets a value indicating whether this instance is mapped in the EDM. + + true if this instance is mapped; otherwise, false. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + An implementation of that wraps an existing set but makes + it read-only. + + + + + + Initializes a new instance of the class wrapped around + another existing set. + + The existing set. + + + + This is a temporary adapter class that wraps an and + presents it as an . This class will be removed once + we roll into the System.Data.Entity assembly. See + for more details. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given EntitySet and BaseType. + + + + + The EntitySet part of the pair. + + + + + The BaseType part of the pair. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given database initializer delegate and a flag + indicating whether or not it is locked. + + + + + The initializer delegate. + + + + + A flag indicating whether or not the initializer is locked and should not be changed. + + + + + Represents a raw SQL query against the context for any type where the results are never + associated with an entity set and are never tracked. + + + + + Represents a raw SQL query against the context that may be for entities in an entity set + or for some other non-entity element type. + + + + + Initializes a new instance of the class. + + The SQL. + The parameters. + + + + If the query is would track entities, then this method returns a new query that will + not track entities. + + A no-tracking query. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Gets the SQL query string, + + The SQL query. + + + + Gets the parameters. + + The parameters. + + + + Returns false. + + false. + + + + Initializes a new instance of the class. + + The internal context. + Type of the element. + The SQL. + The parameters. + + + + Returns this query since it can never be a tracking query. + + This instance. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Generic wrapper around to allow results to be + returned as generic + + The type of the element. + + + + Executes the query and returns an enumerator for the elements. + + An + + object that can be used to iterate through the elements. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Returns false. + + false. + + + + Represents a raw SQL query against the context for entities in an entity set. + + + + + Initializes a new instance of the class. + + The set. + The SQL. + if set to true then the entities will not be tracked. + The parameters. + + + + If the query is would track entities, then this method returns a new query that will + not track entities. + + A no-tracking query. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Gets a value indicating whether this instance is set to track entities or not. + + + true if this instance is no-tracking; otherwise, false. + + + + + A LazyInternalConnection object manages information that can be used to create a DbConnection object and + is responsible for creating that object and disposing it. + + + + + Creates a new LazyInternalConnection using convention to calculate the connection. + The DbConnection object will be created lazily on demand and will be disposed when the LazyInternalConnection is disposed. + + Either the database name or a connection string. + + + + Creates a new LazyInternalConnection targeting a specific database. + The DbConnection object will be created lazily on demand and will be disposed when the LazyInternalConnection is disposed. + + The connection to target. + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Disposes the underlying DbConnection. + Note that dispose actually puts the LazyInternalConnection back to its initial state such that + it can be used again. + + + + + + Searches the app.config/web.config file for a connection that matches the given name. + The connection might be a store connection or an EF connection. + + The connection name. + + True if a connection from the app.config file was found and used. + + + + Attempts to locate a connection entry in the configuration based on the supplied context name. + + The name to search for. + The configuration to search in. + Connection string if found, otherwise null. + + + + Initializes the connection based on a connection string. + + The settings to initialize from. + + + + Returns the underlying DbConnection, creating it first if it does not already exist. + + + + + Returns the origin of the underlying connection string. + + + + + Gets the name of the underlying connection string. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if connection contain model info; otherwise, false. + + + + Gets a value indicating if the lazy connection has been initialized. + + + + + A is a concrete type that will lazily create the + underlying when needed. The created is owned by the + internal context and will be disposed when the internal context is disposed. + + + + + Constructs a for the given owner that will be initialized + on first use. + + The owner . + Responsible for creating a connection lazily when the context is used for the first time. + The model, or null if it will be created by convention + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Saves all changes made in this context to the underlying database, but only if the + context has been initialized. If the context has not been initialized, then this + method does nothing because there is nothing to do; in particular, it does not + cause the context to be initialized. + + The number of objects written to the underlying database. + + + + Disposes the context. The underlying is also disposed. + The connection to the database ( object) is also disposed if it was created by + the context, otherwise it is not disposed. + + + + + + + + Initializes the underlying . + + + + + Creates an immutable, cacheable representation of the model defined by this builder. + This model can be used to create an or can be passed to a + constructor to create a for this model. + + + + + + Creates and configures the instance that will be used to build the + . + + The builder. + + + + Marks the database as having not been initialized. This is called when the app calls Database.Delete so + that the database if the app attempts to then use the database again it will be re-initialized automatically. + + + + + Marks the database as having been initialized without actually running the . + + + + + Runs the unless it has already been run or there + is no initializer for this context type in which case this method does nothing. + + + + + Performs some action (which may do nothing) in such a way that it is guaranteed only to be run + once for the model and connection in this app domain, unless it fails by throwing an exception, + in which case it will be re-tried next time the context is initialized. + + The action. + + + + Returns the underlying . + + + + + The compiled model created from the Code First pipeline, or null if Code First was + not used to create this context. + Causes the Code First pipeline to be run to create the model if it has not already been + created. + + + + + The actually being used, which may be the + temp context for initialization or the real context. + + + + + The connection underlying this context. Accessing this property does not cause the context + to be initialized, only its connection. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strings. + + + + + Gets the name of the underlying connection string. + + + + + Gets or sets the provider details to be used when building the EDM model. + + + + + + + + Gets or sets a custom OnModelCreating action. + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + Gets or sets a value indicating whether lazy loading is enabled. + If the exists, then this property acts as a wrapper over the flag stored there. + If the has not been created yet, then we store the value given so we can later + use it when we create the . This allows the flag to be changed, for example in + a DbContext constructor, without it causing the to be created. + + + + + Gets or sets a value indicating whether proxy creation is enabled. + If the ObjectContext exists, then this property acts as a wrapper over the flag stored there. + If the ObjectContext has not been created yet, then we store the value given so we can later + use it when we create the ObjectContext. This allows the flag to be changed, for example in + a DbContext constructor, without it causing the ObjectContext to be created. + + + + + A wrapping query provider that performs expression transformation and then delegates + to the provider. The objects returned are always instances + of . This provider is associated with generic objects. + + + + + Creates a provider that wraps the given provider. + + The provider to wrap. + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a . + + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a where T is determined + from the element type of the ObjectQuery. + + + + + By default, calls the same method on the wrapped provider. + + + + + By default, calls the same method on the wrapped provider. + + + + + Creates an appropriate generic IQueryable using Reflection and the underlying ElementType of + the given ObjectQuery. + + + + + Performs expression replacement and then delegates to the wrapped provider to create an + . + + + + + Wraps the given as a where T is determined + from the element type of the ObjectQuery. + + + + + Gets the internal context. + + The internal context. + + + + A LINQ expression visitor that finds uses with equivalent + instances. + + + + + Replaces calls to DbContext.Set() with an expression for the equivalent . + + The node to replace. + A new node, which may have had the replacement made. + + + + Replaces a or property with a constant expression + for the underlying . + + The node to replace. + A new node, which may have had the replacement made. + + + + Processes the fields in each constant expression and replaces instances with + the underlying ObjectQuery instance. This handles cases where the query has a closure + containing values. + + + + + Gets a value from the given member, or returns null + if the member doesn't contain a DbContext instance. + + The expression for the object for the member, which may be null for a static member. + The member. + The context or null. + + + + Gets the instance from the given instance or static member, returning null + if the member does not contain a DbContext instance. + + The member. + The value of the object to get the instance from, or null if the member is static. + The context instance or null. + + + + Takes a or and creates an expression + for the underlying . + + + + + Takes a or and extracts the underlying . + + + + + A non-generic interface implemented by that allows operations on + any query object without knowing the type to which it applies. + + + + + An interface implemented by . + + The type of the element. + + + + A non-generic interface implemented by that allows operations on + any set object without knowing the type to which it applies. + + + + + An interface implemented by . + + + + + An instance of this internal class is created whenever an instance of the public + class is needed. This allows the public surface to be non-generic, while the runtime type created + still implements . + + The type of the element. + + + + Creates a new query that will be backed by the given internal query object. + + The backing query. + + + + See comments in . + + + + + See comments in . + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the underlying internal query object. + + The internal query. + + + + An instance of this internal class is created whenever an instance of the public + class is needed. This allows the public surface to be non-generic, while the runtime type created + still implements . + + The type of the entity. + + + + Creates a new set that will be backed by the given internal set. + + The internal set. + + + + Creates an instance of this class. This method is used with CreateDelegate to cache a delegate + that can create a generic instance without calling MakeGenericType every time. + + + The internal set to wrap, or null if a new internal set should be created. + The set. + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the underlying internal query object. + + The internal query. + + + + Gets the underlying internal set. + + The internal set. + + + + See comments in . + + + + + An InternalQuery underlies every instance of DbSet and DbQuery. It acts to lazily initialize a InternalContext as well + as an ObjectQuery and EntitySet the first time that it is used. The InternalQuery also acts to expose necessary + information to other parts of the design in a controlled manner without adding a lot of internal methods and + properties to the DbSet and DbQuery classes themselves. + + The type of entity to query for. + + + + Creates a new query that will be backed by the given InternalContext. + + The backing context. + + + + Creates a new internal query based on the information in an existing query together with + a new underlying ObjectQuery. + + + + + Resets the query to its uninitialized state so that it will be re-lazy initialized the next + time it is used. This allows the ObjectContext backing a DbContext to be switched out. + + + + + Updates the underlying ObjectQuery with the given include path. + + The include path. + A new query containing the defined include path. + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Performs lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that the query can be used. + + + + + Returns a representation of the underlying query, equivalent + to ToTraceString on ObjectQuery. + + + The query string. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + The underlying InternalContext. + + + + + The underlying ObjectQuery. + + + + + The underlying ObjectQuery. + + + + + The LINQ query expression. + + + + + The LINQ query provider for the underlying . + + + + + The IQueryable element type. + + + + + Creates a new query that will be backed by the given InternalContext. + + The backing context. + + + + Resets the set to its uninitialized state so that it will be re-lazy initialized the next + time it is used. This allows the ObjectContext backing a DbContext to be switched out. + + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Finds an entity in the state manager with the given primary key values, or returns null + if no such entity can be found. This includes looking for Added entities with the given + key values. + + + + + Finds an entity in the store with the given primary key values, or returns null + if no such entity can be found. This code is adapted from TryGetObjectByKey to + include type checking in the query. + + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + This method is virtual so that it can be mocked. + + The entity to attach. + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + This method is virtual so that it can be mocked. + + The entity to add. + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + This method is virtual so that it can be mocked. + + The entity to remove. + + + + This method checks whether an entity is already in the context. If it is, then the state + is changed to the new state given. If it isn't, then the action delegate is executed to + either Add or Attach the entity. + + A delegate to Add or Attach the entity. + The new state to give the entity if it is already in the context. + The entity. + Name of the method. + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Performs lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that the query can be used. + This method is virtual so that it can be mocked. + + + + + Attempts to perform lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that o-space loading has happened and the query can be used. This method doesn't throw if the type + for the set is not mapped. + + + + + Creates an underlying for this set. + + if set to true then the query is set to be no-tracking. + The query. + + + + Returns a representation of the underlying query, equivalent + to ToTraceString on ObjectQuery. + + + The query string. + + + + + Updates the underlying ObjectQuery with the given include path. + + The include path. + A new query containing the defined include path. + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Executes the given SQL query against the database materializing entities into the entity set that + backs this set. + + The SQL quey. + if true then the entities are not tracked, otherwise they are. + The parameters. + The query results. + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the ObservableCollection representing the local view for the set based on this query. + + + + + The underlying ObjectQuery. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet name. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet name, quoted for ESQL. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet. Accessing this property will trigger lazy initialization of the query. + + + + + The base type for the underlying entity set. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying InternalContext. Accessing this property will trigger lazy initialization of the query. + + + + + The LINQ query expression. + + + + + The LINQ query provider for the underlying . + + + + + A wrapping query provider that performs expression transformation and then delegates + to the provider. The objects returned + are always instances of when the generic CreateQuery method is + used and are instances of when the non-generic CreateQuery method + is used. This provider is associated with non-generic objects. + + + + + Creates a provider that wraps the given provider. + + The provider to wrap. + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a . + + + + + Delegates to the wrapped provider except returns instances of . + + + + + Creates an appropriate generic IQueryable using Reflection and the underlying ElementType of + the given ObjectQuery. + + + + + Extends to create a sortable binding list that stays in + sync with an underlying . That is, when items are added + or removed from the binding list, they are added or removed from the ObservableCollecion, and + vice-versa. + + The list element type. + + + + An extended BindingList implementation that implements sorting. + This class was adapted from the LINQ to SQL class of the same name. + + The element type. + + + + Initializes a new instance of the class with the + the given underlying list. Note that sorting is dependent on having an actual + rather than some other ICollection implementation. + + The list. + + + + Applies sorting to the list. + + The property to sort by. + The sort direction. + + + + Stops sorting. + + + + + Gets a value indicating whether this list is sorted. + + + true if this instance is sorted; otherwise, false. + + + + + Gets the sort direction. + + The sort direction. + + + + Gets the sort property being used to sort. + + The sort property. + + + + Returns true indicating that this list supports sorting. + + true. + + + + Implements comparing for the implementation. + + + + + Initializes a new instance of the class + for sorting the list. + + The property to sort by. + The sort direction. + + + + Compares two instances of items in the list. + + The left item to compare. + The right item to compare. + + + + + Determines whether this instance can sort for the specified type. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Determines whether this instance can sort for the specified type using IComparable. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Determines whether this instance can sort for the specified type using ToString. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Initializes a new instance of a binding list backed by the given + + The obervable collection. + + + + Creates a new item to be added to the binding list. + + The new item. + + + + Cancels adding of a new item that was started with AddNew. + + Index of the item. + + + + Removes all items from the binding list and underlying ObservableCollection. + + + + + Ends the process of adding a new item that was started with AddNew. + + Index of the item. + + + + Inserts the item into the binding list at the given index. + + The index. + The item. + + + + Removes the item at the specified index. + + The index. + + + + Sets the item into the list at the given position. + + The index to insert at. + The item. + + + + Event handler to update the binding list when the underlying observable collection changes. + + The sender. + Data indicating how the collection has changed. + + + + Adds the item to the underlying observable collection. + + The item. + + + + Removes the item from the underlying from observable collection. + + The item. + + + + Adapted from to allow the initializer to take an input object and + to do one-time initialization that only has side-effects and doesn't return a value. + + The type of the input. + + + + Initializes a new instance of the class. + + The action. + + + + Performs the action unless it has already been successfully performed before. + + The input to the action; ignored if the action has already succeeded. + + + + Adapted from to allow the initializer to take an input object and + to retry initialization if it has previously failed. + + + This class can only be used to initialize reference types that will not be null when + initialized. + + The type of the input. + The type of the result. + + + + Initializes a new instance of the class. + + The value factory. + + + + Gets the value, possibly by running the initializer if it has not been run before or + if all previous times it ran resulted in exceptions. + + The input to the initializer; ignored if initialization has already succeeded. + The initialized object. + + + + Validates a property of a given EDM complex type. + + + This is a composite validator for a complex property of an entity. + + + + + Validates a property of a given EDM property type. + + + This is a composite validator for a property of an entity or a complex type. + + + + + Simple validators for the corresponding property. + + + + + Name of the property the validator was created for. + + + + + Creates an instance of for a given EDM property. + + The EDM property name. + Validators used to validate the given property. + + + + Validates a property. + + Validation context. Never null. + Property to validate. Never null. + Validation errors as . Empty if no errors. Never null. + + + + + Simple validators for the corresponding property. + + + + + Gets the name of the property the validator was created for. + + + + + The complex type validator. + + + + + Creates an instance of for a given complex property. + + The complex property name. + Validators used to validate the given property. + Complex type validator. + + + + Validates a complex property. + + Validation context. Never null. + Property to validate. Never null. + Validation errors as . Empty if no errors. Never null. + + + + + Validator used to validate a property of a given EDM ComplexType. + + + This is a composite validator. + + + + + Validator used to validate an entity of a given EDM Type. + + + This is a composite validator for an EDM Type. + + + + + Creates an instance for a given EDM type. + + Property validators. + Type level validators. + + + + Validates an instance. + + Entity validation context. Must not be null. + The entry for the complex property. Null if validating an entity. + instance. Never null. + + Protected so it doesn't appear on EntityValidator. + + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Returns a validator for a child property. + + Name of the child property for which to return a validator. + + Validator for a child property. Possibly null if there are no validators for requested property. + + + + + Creates an instance for a given EDM complex type. + + Property validators. + Type level validators. + + + + Validates an instance. + + Entity validation context. Must not be null. + The entry for the complex property. Null if validating an entity. + instance. Never null. + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Contains information needed to validate an entity or its properties. + + + + + The entity being validated or the entity that owns the property being validated. + + + + + Initializes a new instance of EntityValidationContext class. + + + The entity being validated or the entity that owns the property being validated. + + + External contexts needed for validation. + + + + + External context needed for validation. + + + + + Gets the entity being validated or the entity that owns the property being validated. + + + + + Validator used to validate an entity of a given EDM EntityType. + + + This is a top level, composite validator. This is also an entry point to getting an entity + validated as validation of an entity is always started by calling Validate method on this type. + + + + + Creates an instance for a given EDM entity type. + + Property validators. + Entity type level validators. + + + + Validates an entity. + + Entity validation context. Must not be null. + instance. Never null. + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Builds validators based on s specified on entity CLR types and properties + as well as based on presence of implementation on entity and complex + type CLR types. It's not sealed and not static for mocking purposes. + + + + + Builds an for the given . + + The entity entry to build the validator for. + Whether the currently processed type is the target type or one of the ancestor types. + + + for the given . Possibly null + if no validation has been specified for this entity type. + + + + + Builds the validator for a given and the corresponding + . + + The CLR type that corresponds to the EDM complex type. + The EDM complex type that type level validation is built for. + A for the given complex type. May be null if no validation specified. + + + + Extracted method from BuildEntityValidator and BuildComplexTypeValidator + + + + + Build validators for the and the corresponding + or . + + Properties to build validators for. + Non-navigation EDM properties. + Navigation EDM properties. + A list of validators. Possibly empty, never null. + + + + Builds a for the given and the corresponding + . If the property is a complex type, type level validators will be built here as + well. + + The CLR property to build the validator for. + The EDM property to build the validator for. + + for the given . Possibly null + if no validation has been specified for this property. + + + + + Builds a for the given transient . + + The CLR property to build the validator for. + + for the given . Possibly null + if no validation has been specified for this property. + + + + + Builds s for given that derive from + . + + Attributes used to build validators. + + A list of s built from . + Possibly empty, never null. + + + + + Returns all non-static non-indexed CLR properties from the . + + The CLR to get the properties from. + + A collection of CLR properties. Possibly empty, never null. + + + + + Builds validators based on the facets of : + * If .Nullable facet set to false adds a validator equivalent to the RequiredAttribute + * If the .MaxLength facet is specified adds a validator equivalent to the MaxLengthAttribute. + However the validator isn't added if .IsMaxLength has been set to true. + + The CLR property to build the facet validators for. + The property for which facet validators will be created + A collection of validators. + + + + Abstracts simple validators used to validate entities and properties. + + + + + Validates an entity or a property. + + Validation context. Never null. + Property to validate. Can be null for type level validation. + Validation error as. Empty if no errors. Never null. + + + + + Contract for IValidator.Validate method. + + Validation context. + Property. + Nothing - always throws. + + + + Validates entities or complex types implementing IValidatableObject interface. + + + + + Display attribute used to specify the display name for an entity or complex property. + + + + + Validates an entity or a complex type implementing IValidatableObject interface. + This method is virtual to allow mocking. + + Validation context. Never null. + + Property to validate. Null if this is the entity that will be validated. Never null if this + is the complex type that will be validated. + + Validation error as . Empty if no errors. Never null. + + + Note that is used to figure out what needs to be validated. If it not null the complex + type will be validated otherwise the entity will be validated. + Also if this is an IValidatableObject complex type but the instance (.CurrentValue) is null we won't validate + anything and will not return any errors. The reason for this is that Validation is supposed to validate using + information the user provided and not some additional implicit rules. (ObjectContext will throw for operations + that involve null complex properties). + + + + + Validates a property, complex property or an entity using validation attributes the property + or the complex/entity type is decorated with. + + + Note that this class is used for validating primitive properties using attributes declared on the property + (property level validation) and complex properties and entities using attributes declared on the type + (type level validation). + + + + + Display attribute used to specify the display name for a property or entity. + + + + + Validation attribute used to validate a property or an entity. + + + + + Creates an instance of class. + + + Validation attribute used to validate a property or an entity. + + + + + Validates a property or an entity. + + Validation context. Never null. + Property to validate. Null for entity validation. Not null for property validation. + + + Validation errors as . Empty if no errors, never null. + + + + + Used to cache and retrieve generated validators and to create context for validating entities or properties. + + + + + Collection of validators keyed by the entity CLR type. Note that if there's no validation for a given type + it will be associated with a null validator. + + + + + Initializes a new instance of class. + + + + + Returns a validator to validate . + + Entity the validator is requested for. + + to validate . Possibly null if no validation + has been specified for the entity. + + + + + Returns a validator to validate . + + Navigation property the validator is requested for. + + Validator to validate . Possibly null if no validation + has been specified for the requested property. + + + + + Gets a validator for the . + + Entity validator. + Property to get a validator for. + + Validator to validate . Possibly null if there is no validation for the + . + + + For complex properties this method walks up the type hierarchy to get to the entity level and then goes down + and gets a validator for the child property that is an ancestor of the property to validate. If a validator + returned for an ancestor is null it means that there is no validation defined beneath and the method just + propagates (and eventually returns) null. + + + + + Creates for . + + Entity entry for which a validation context needs to be created. + User defined dictionary containing additional info for custom validation. This parameter is optional and can be null. + An instance of class. + + + + + A wrapper around EntityKey that allows key/values pairs that have null values to + be used. This allows Added entities with null key values to be searched for in + the ObjectStateManager. + + + + The key name/key value pairs, where some key values may be null + + + + Creates a new WrappedEntityKey instance. + + The entity set that the key belongs to. + The fully qualified name of the given entity set. + The key values, which may be null or contain null values. + The name of the parameter passed for keyValue by the user, which is used when throwing exceptions. + + + + True if any of the key values are null, which means that the EntityKey will also be null. + + + + + An actual EntityKey, or null if any of the key values are null. + + + + + The key name/key value pairs of the key, in which some of the key values may be null. + + + + + Allows configuration to be performed for an complex type in a model. + + A ComplexTypeConfiguration can be obtained via the ComplexType method on + or a custom type derived from ComplexTypeConfiguration + can be registered via the Configurations property on . + + The complex type to be configured. + + + + Allows configuration to be performed for a type in a model. + + The type to be configured. + + + + Configures a property that is defined on this type. + + The type of the property being configured. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + The type of the property being configured. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Excludes a property from the model so that it will not be mapped to the database. + + The type of the property to be ignored. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + + + + Initializes a new instance of ComplexTypeConfiguration + + + + + Allows derived configuration classes for entities and complex types to be registered with a . + + + Derived configuration classes are created by deriving from + or and using a type to be included in the model as the generic + parameter. + + Configuration can be performed without creating derived configuration classes via the Entity and ComplexType + methods on . + + + + + Adds an to the . + Only one can be added for each type in a model. + + The entity type being configured. + The entity type configuration to be added. + The same ConfigurationRegistrar instance so that multiple calls can be chained. + + + + Adds an to the . + Only one can be added for each type in a model. + + The complex type being configured. + The complex type configuration to be added + The same ConfigurationRegistrar instance so that multiple calls can be chained. + + + + Allows the conventions used by a instance to be customized. + Currently removal of one or more default conventions is the only supported operation. + The default conventions can be found in the System.Data.Entity.ModelConfiguration.Conventions namespace. + + + + + Disables a convention for the . + The default conventions that are available for removal can be found in the System.Data.Entity.ModelConfiguration.Conventions namespace. + + The type of the convention to be disabled. + + + + Configures the table and column mapping for an entity type or a sub-set of properties from an entity type. + This configuration functionality is available via the Code First Fluent API, see . + + The entity type to be mapped. + + + + Configures the properties that will be included in this mapping fragment. + If this method is not called then all properties that have not yet been + included in a mapping fragment will be configured. + + An anonymous type including the properties to be mapped. + + A lambda expression to an anonymous type that contains the properties to be mapped. + C#: t => new { t.Id, t.Property1, t.Property2 } + VB.Net: Function(t) New With { p.Id, t.Property1, t.Property2 } + + + + + Re-maps all properties inherited from base types. + + When configuring a derived type to be mapped to a separate table this will cause all properties to + be included in the table rather than just the non-inherited properties. This is known as + Table per Concrete Type (TPC) mapping. + + + + + Configures the table name to be mapped to. + + Name of the table. + + + + Configures the table name and schema to be mapped to. + + Name of the table. + Schema of the table. + + + + Configures the discriminator column used to differentiate between types in an inheritance hierarchy. + + The name of the discriminator column. + A configuration object to further configure the discriminator column and values. + + + + Configures the discriminator condition used to differentiate between types in an inheritance hierarchy. + + The type of the property being used to discriminate between types. + + A lambda expression representing the property being used to discriminate between types. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object to further configure the discriminator condition. + + + + Moves a foreign key constraint from oldTable to newTable and updates column references + + + + + Move any FK constraints that are now completely in newTable and used to refer to oldColumn + + + + + Configures a condition used to discriminate between types in an inheritance hierarchy based on the values assigned to a property. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the condition to require a value in the property. + + Rows that do not have a value assigned to column that this property is stored in are + assumed to be of the base type of this entity type. + + + + + Populate the table mapping structure + + + + + Sets nullability for association set mappings' foreign keys for 1:* and 1:0..1 associations + when no base types share the the association set mapping's table + + + + + Makes sure only the required property mappings are present + + + + + Determines if the table and entity type need mapping, and if not, removes the existing entity type mapping + + + + + Configures a database column used to store a string values. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the column to allow the maximum length supported by the database provider. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + + Configures the column to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be variable length. + Columns are variable length by default. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be optional. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be required. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column. + + Name of the database provider specific data type. + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column. + + The order that this column should appear in the database table. + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to support Unicode string content. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the column supports Unicode string content. + + + Value indicating if the column supports Unicode string content or not. + Specifying 'null' will remove the Unicode facet from the column. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures a discriminator column used to differentiate between types in an inheritance hierarchy. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + Type of the discriminator value. + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + Type of the discriminator value. + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Initializes configurations in the ModelConfiguration so that configuration data + is in a single place + + + + + Configures a many relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be many:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:required with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:required without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:optional with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:optional without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures an optional relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be optional:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:required with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:required without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + + A lambda expression representing the navigation property on the other end of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + A configuration object that can be used to further configure the relationship. + + + + Configures an required relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be required:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:optional with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:optional without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required with a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required without a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required with a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required without a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + A configuration object that can be used to further configure the relationship. + + + + Base class for configuring a property on an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + True if the NavigationProperty's declaring type is the principal end, false if it is not, null if it is not known + + + + + Base class for performing configuration of a relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures a relationship that can support cascade on delete functionality. + + + + + Configures cascade delete to be on for the relationship. + + + + + Configures whether or not cascade delete is on for the relationship. + + Value indicating if cascade delete is on or not. + + + + Configures a relationship that can support foreign key properties that are exposed in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + The dependent entity type. + + + + Configures a relationship that can only support foreign key properties that are not exposed in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the relationship to use foreign key property(s) that are not exposed in the object model. + The column(s) and table can be customized by specifying a configuration action. + If an empty configuration action is specified then column name(s) will be generated by convention. + If foreign key properties are exposed in the object model then use the HasForeignKey method. + Not all relationships support exposing foreign key properties in the object model. + + Action that configures the foreign key column(s) and table. + + A configuration object that can be used to further configure the relationship. + + + + + Configures the relationship to use foreign key property(s) that are exposed in the object model. + If the foreign key property(s) are not exposed in the object model then use the Map method. + + The type of the key. + + A lambda expression representing the property to be used as the foreign key. + If the foreign key is made up of multiple properties then specify an anonymous type including the properties. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the principal entity type. + + A configuration object that can be used to further configure the relationship. + + + + Configures the table and column mapping of a relationship that does not expose foreign key properties in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the name of the column(s) for the foreign key. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table name that the foreign key column(s) reside in. + The table that is specified must already be mapped for the entity type. + + If you want the foreign key(s) to reside in their own table then use the Map method + on to perform + entity splitting to create the table with just the primary key property. Foreign keys can + then be added to the table via this method. + + Name of the table. + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table name and schema that the foreign key column(s) reside in. + The table that is specified must already be mapped for the entity type. + + If you want the foreign key(s) to reside in their own table then use the Map method + on to perform + entity splitting to create the table with just the primary key property. Foreign keys can + then be added to the table via this method. + + Name of the table. + Schema of the table. + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table and column mapping of a many:many relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the join table name for the relationship. + + Name of the table. + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the join table name and schema for the relationship. + + Name of the table. + Schema of the table. + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the column(s) for the left foreign key. + The left foreign key represents the navigation property specified in the HasMany call. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the column(s) for the right foreign key. + The right foreign key represents the navigation property specified in the WithMany call. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures a many:many relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the foreign key column(s) and table used to store the relationship. + + Action that configures the foreign key column(s) and table. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Used to configure a property with length facets for an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Used to configure a primitive property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to allow the maximum length supported by the database provider. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property and a default length will be used for the database column. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + Properties are variable length by default. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to allow the maximum length supported by the database provider. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + properties are variable length by default. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + properties are optional by default. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be a row version in the database. + The actual data type will vary depending on the database provider being used. + Setting the property to be a row version will automatically configure it to be an + optimistic concurrency token. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + properties are required by default. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the precision of the property. + If the database provider does not support precision for the data type of the column then the value is ignored. + + Precision of the property. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + properties are required by default. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the precision and scale of the property. + + The precision of the property. + The scale of the property. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to allow the maximum length supported by the database provider. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property and a default length will be used for the database column.. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + properties are variable length by default. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + properties are optional by default. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to support Unicode string content. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property supports Unicode string content. + + + Value indicating if the property supports Unicode string content or not. + Specifying 'null' will remove the Unicode facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Indicates what parts of a configuration are overridable. + + + + + Nothing in the configuration is overridable. + + + + + The configuration values related to C-Space are overridable. + + + + + The configuration values only related to S-Space are overridable. + + + + + True if this configuration can be replaced in the model configuration, false otherwise + This is only set to true for configurations that are registered automatically via the DbContext + + + + + Base class for conventions that process CLR attributes found in the model. + + The type of member to look for. + The type of the configuration to look for. + The type of the attribute to look for. + + + + Convention to process instances of found on properties in the model + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on foreign key properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on navigation properties in the model. + + + + + Convention to process instances of found on primitive properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to detect navigation properties to be inverses of each other when only one pair + of navigation properties exists between the related types. + + + + + Convention to configure a type as a complex type if it has no primary key, no mapped base type and no navigation properties. + + + + + Convention to convert any data types that were explicitly specified, via data annotations or API, + to be lower case. The default SqlClient provider is case sensitive and requires data types to be lower case. This convention + allows the and API to be case insensitive. + + + + + Convention to add a cascade delete to the join table from both tables involved in a many to many relationship. + + + + + Convention to ensure an invalid/unsupported mapping is not created when mapping inherited properties + + + + + Convention to set the table name to be a pluralized version of the entity type name. + + + + + Convention to set precision to 18 and scale to 2 for decimal properties. + + + + + Convention to move primary key properties to appear first. + + + + + Convention to distinguish between optional and required relationships based on CLR nullability of the foreign key property. + + + + + Convention to process instances of found on navigation properties in the model. + + + + + Convention to detect primary key properties. + Recognized naming patterns in order of precedence are: + 1. 'Id' + 2. [type name]Id + Primary key detection is case insensitive. + + + + + Convention to discover foreign key properties whose names are a combination + of the dependent navigation property name and the principal type primary key property name(s). + + + + + Convention to enable cascade delete for any required relationships. + + + + + Convention to configure the primary key(s) of the dependent entity type as foreign key(s) in a one:one relationship. + + + + + Convention to set the entity set name to be a pluralized version of the entity type name. + + + + + Convention to discover foreign key properties whose names match the principal type primary key property name(s). + + + + + Convention to set a default maximum length of 128 for properties whose type supports length facets. + + + + + Convention to set a default maximum length of 4000 for properties whose type supports length facets when SqlCe is the provider. + + + + + Convention to configure integer primary keys to be identity. + + + + + Checks for the PK property being an FK in a different table. A PK which is also an FK but + in the same table is used for table splitting and can still be an identity column because + the update pipeline is only inserting into one column of one table. + + + + + Convention to discover foreign key properties whose names are a combination + of the principal type name and the principal type primary key property name(s). + + + + + This class provide service for both the singularization and pluralization, it takes the word pairs + in the ctor following the rules that the first one is singular and the second one is plural. + + + + + Factory method for PluralizationService. Only support english pluralization. + Please set the PluralizationService on the System.Data.Entity.Design.EntityModelSchemaGenerator + to extend the service to other locales. + + CultureInfo + PluralizationService + + + + captalize the return word if the parameter is capitalized + if word is "Table", then return "Tables" + + + + + + + + separate one combine word in to two parts, prefix word and the last word(suffix word) + + + + + + + + return true when the word is "[\s]*" or leading or tailing with spaces + or contains non alphabetical characters + + + + + + + This method allow you to add word to internal PluralizationService of English. + If the singluar or the plural value was already added by this method, then an ArgumentException will be thrown. + + + + + + + Attempt to determine the principal and dependent ends of this association. + + The following table illustrates the solution space. + + Source | Target || Prin | Dep | + -------|--------||-------|-------| + 1 | 1 || - | - | + 1 | 0..1 || Sr | Ta | + 1 | * || Sr | Ta | + 0..1 | 1 || Ta | Sr | + 0..1 | 0..1 || - | - | + 0..1 | * || Sr | Ta | + * | 1 || Ta | Sr | + * | 0..1 || Ta | Sr | + * | * || - | - | + + + + + Allows configuration to be performed for an entity type in a model. + + An EntityTypeConfiguration can be obtained via the Entity method on + or a custom type derived from EntityTypeConfiguration + can be registered via the Configurations property on . + + + + + Initializes a new instance of EntityTypeConfiguration + + + + + Configures the primary key property(s) for this entity type. + + The type of the key. + + A lambda expression representing the property to be used as the primary key. + C#: t => t.Id + VB.Net: Function(t) t.Id + + If the primary key is made up of multiple properties then specify an anonymous type including the properties. + C#: t => new { t.Id1, t.Id2 } + VB.Net: Function(t) New With { t.Id1, t.Id2 } + + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures the entity set name to be used for this entity type. + The entity set name can only be configured for the base type in each set. + + The name of the entity set. + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures the table name that this entity type is mapped to. + + The name of the table. + + + + Configures the table name that this entity type is mapped to. + + The name of the table. + The database schema of the table. + + + + Allows advanced configuration related to how this entity type is mapped to the database schema. + By default, any configuration will also apply to any type derived from this entity type. + + Derived types can be configured via the overload of Map that configures a derived type or + by using an EntityTypeConfiguration for the derived type. + + The properties of an entity can be split between multiple tables using multiple Map calls. + + Calls to Map are additive, subsequent calls will not override configuration already preformed via Map. + + An action that performs configuration against an . + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Allows advanced configuration related to how a derived entity type is mapped to the database schema. + Calls to Map are additive, subsequent calls will not override configuration already preformed via Map. + + The derived entity type to be configured. + An action that performs configuration against an . + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures an optional relationship from this entity type. + Instances of the entity type will be able to be saved to the database without this relationship being specified. + The foreign key in the database will be nullable. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures a required relationship from this entity type. + Instances of the entity type will not be able to be saved to the database unless this relationship is specified. + The foreign key in the database will be non-nullable. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures a many relationship from this entity type. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Handles mapping from a CLR property to an EDM assocation and nav. prop. + + + + + Exception thrown by during model creation when an invalid model is generated. + + + + + Initializes a new instance of ModelValidationException + + + + + Initializes a new instance of ModelValidationException + + The exception message. + + + + Initializes a new instance of ModelValidationException + + The exception message. + The inner exception. + + + + Code Contracts hook methods - Called when contracts fail. Here we detect the most common preconditions + so we can throw the correct exceptions. It also means that we can write preconditions using the + simplest Contract.Requires() form. + + + + + Returns true if a variable of this type can be assigned a null value + + + + True if a reference type or a nullable value type, + false otherwise + + + + + Exception thrown from when validating entities fails. + + + + + Initializes a new instance of DbEntityValidationException + + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + Validation results. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + The inner exception. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + Validation results. + The inner exception. + + + + Subscribes the SerializeObjectState event. + + + + + Validation results. + + + + + Holds exception state that will be serialized when the exception is serialized. + + + + + Validation results. + + + + + Completes the deserialization. + + The deserialized object. + + + + Validation results. + + + + + Represents validation results for single entity. + + + + + Entity entry the results applies to. Never null. + + + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Creates an instance of class. + + + Entity entry the results applies to. Never null. + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Creates an instance of class. + + + Entity entry the results applies to. Never null. + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Gets an instance of the results applies to. + + + + + Gets validation errors. Never null. + + + + + Gets an indicator if the entity is valid. + + + + + Exception thrown from when an exception is thrown from the validation + code. + + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + The inner exception. + + + + Initializes a new instance of DbUnexpectedValidationException with the specified serialization info and + context. + + The serialization info. + The streaming context. + + + + Validation error. Can be either entity or property level validation error. + + + + + Name of the invalid property. Can be null (e.g. for entity level validations) + + + + + Validation error message. + + + + + Creates an instance of . + + Name of the invalid property. Can be null. + Validation error message. Can be null. + + + + Gets name of the invalid property. + + + + + Gets validation error message. + + + + diff --git a/Website/LOC.Website.Common/bin/Release/LOC.Core.dll b/Website/LOC.Website.Common/bin/Release/LOC.Core.dll new file mode 100644 index 000000000..565e87c2b Binary files /dev/null and b/Website/LOC.Website.Common/bin/Release/LOC.Core.dll differ diff --git a/Website/LOC.Website.Common/bin/Release/LOC.Core.pdb b/Website/LOC.Website.Common/bin/Release/LOC.Core.pdb new file mode 100644 index 000000000..441328fb2 Binary files /dev/null and b/Website/LOC.Website.Common/bin/Release/LOC.Core.pdb differ diff --git a/Website/LOC.Website.Common/bin/Release/LOC.Website.Common.dll b/Website/LOC.Website.Common/bin/Release/LOC.Website.Common.dll new file mode 100644 index 000000000..17dfddfae Binary files /dev/null and b/Website/LOC.Website.Common/bin/Release/LOC.Website.Common.dll differ diff --git a/Website/LOC.Website.Common/bin/Release/LOC.Website.Common.dll.config b/Website/LOC.Website.Common/bin/Release/LOC.Website.Common.dll.config new file mode 100644 index 000000000..30a36561f --- /dev/null +++ b/Website/LOC.Website.Common/bin/Release/LOC.Website.Common.dll.config @@ -0,0 +1,17 @@ + + + + +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/Website/LOC.Website.Common/bin/Release/LOC.Website.Common.pdb b/Website/LOC.Website.Common/bin/Release/LOC.Website.Common.pdb new file mode 100644 index 000000000..8c5fdca7f Binary files /dev/null and b/Website/LOC.Website.Common/bin/Release/LOC.Website.Common.pdb differ diff --git a/Website/LOC.Website.Common/bin/Release/LinqKit.dll b/Website/LOC.Website.Common/bin/Release/LinqKit.dll new file mode 100644 index 000000000..c802265ad Binary files /dev/null and b/Website/LOC.Website.Common/bin/Release/LinqKit.dll differ diff --git a/Website/LOC.Website.Common/bin/Release/Newtonsoft.Json.dll b/Website/LOC.Website.Common/bin/Release/Newtonsoft.Json.dll new file mode 100644 index 000000000..dc9283f4c Binary files /dev/null and b/Website/LOC.Website.Common/bin/Release/Newtonsoft.Json.dll differ diff --git a/Website/LOC.Website.Common/bin/Release/Newtonsoft.Json.xml b/Website/LOC.Website.Common/bin/Release/Newtonsoft.Json.xml new file mode 100644 index 000000000..ee891563c --- /dev/null +++ b/Website/LOC.Website.Common/bin/Release/Newtonsoft.Json.xml @@ -0,0 +1,7343 @@ + + + + Newtonsoft.Json + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class with the specified . + + + + + Reads the next JSON token from the stream. + + true if the next token was read successfully; false if there are no more tokens to read. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Skips the children of the current token. + + + + + Sets the current token. + + The new token. + + + + Sets the current token and value. + + The new token. + The value. + + + + Sets the state based on current token type. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Releases unmanaged and - optionally - managed resources + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Changes the to Closed. + + + + + Gets the current reader state. + + The current reader state. + + + + Gets or sets a value indicating whether the underlying stream or + should be closed when the reader is closed. + + + true to close the underlying stream or when + the reader is closed; otherwise false. The default is true. + + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + Get or set how time zones are handling when reading JSON. + + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Gets the type of the current JSON token. + + + + + Gets the text value of the current JSON token. + + + + + Gets The Common Language Runtime (CLR) type for the current JSON token. + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Gets the path of the current JSON token. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Specifies the state of the reader. + + + + + The Read method has not been called. + + + + + The end of the file has been reached successfully. + + + + + Reader is at a property. + + + + + Reader is at the start of an object. + + + + + Reader is in an object. + + + + + Reader is at the start of an array. + + + + + Reader is in an array. + + + + + The Close method has been called. + + + + + Reader has just read a value. + + + + + Reader is at the start of a constructor. + + + + + Reader in a constructor. + + + + + An error occurred that prevents the read operation from continuing. + + + + + The end of the file has been reached successfully. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The reader. + + + + Initializes a new instance of the class. + + The stream. + if set to true the root object will be read as a JSON array. + The used when reading values from BSON. + + + + Initializes a new instance of the class. + + The reader. + if set to true the root object will be read as a JSON array. + The used when reading values from BSON. + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + + A . This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Changes the to Closed. + + + + + Gets or sets a value indicating whether binary data reading should compatible with incorrect Json.NET 3.5 written binary. + + + true if binary data reading will be compatible with incorrect Json.NET 3.5 written binary; otherwise, false. + + + + + Gets or sets a value indicating whether the root object will be read as a JSON array. + + + true if the root object will be read as a JSON array; otherwise, false. + + + + + Gets or sets the used when reading values from BSON. + + The used when reading values from BSON. + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Creates an instance of the JsonWriter class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the end of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the end of an array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end constructor. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes the end of the current Json object or array. + + + + + Writes the current token. + + The to read the token from. + + + + Writes the specified end token. + + The end token to write. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON without changing the writer's state. + + The raw JSON to write. + + + + Writes raw JSON where a value is expected and updates the writer's state. + + The raw JSON to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + An error will raised if the value cannot be written as a single JSON token. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Gets or sets a value indicating whether the underlying stream or + should be closed when the writer is closed. + + + true to close the underlying stream or when + the writer is closed; otherwise false. The default is true. + + + + + Gets the top. + + The top. + + + + Gets the state of the writer. + + + + + Gets the path of the writer. + + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling when writing JSON. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The writer. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Writes the end. + + The token. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes raw JSON where a value is expected and updates the writer's state. + + The raw JSON to write. + + + + Writes the beginning of a Json array. + + + + + Writes the beginning of a Json object. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Closes this stream and the underlying stream. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value that represents a BSON object id. + + + + + + Writes a BSON regex. + + The regex pattern. + The regex options. + + + + Gets or sets the used when writing values to BSON. + When set to no conversion will occur. + + The used when writing values to BSON. + + + + Represents a BSON Oid (object id). + + + + + Initializes a new instance of the class. + + The Oid value. + + + + Gets or sets the value of the Oid. + + The value of the Oid. + + + + Converts a binary value to and from a base 64 string value. + + + + + Converts an object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets the of the JSON produced by the JsonConverter. + + The of the JSON produced by the JsonConverter. + + + + Gets a value indicating whether this can read JSON. + + true if this can read JSON; otherwise, false. + + + + Gets a value indicating whether this can write JSON. + + true if this can write JSON; otherwise, false. + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Create a custom object + + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Creates an object which will then be populated by the serializer. + + Type of the object. + + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets a value indicating whether this can write JSON. + + + true if this can write JSON; otherwise, false. + + + + + Provides a base class for converting a to and from JSON. + + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an Entity Framework EntityKey to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an ExpandoObject to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets a value indicating whether this can write JSON. + + + true if this can write JSON; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON and BSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON and BSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an to and from its name string value. + + + Converts an to and from its name string value. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + A cached representation of the Enum string representation to respect per Enum field name. + + The type of the Enum. + A map of enum field name to either the field name, or the configured enum member name (). + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets or sets a value indicating whether the written enum text should be camel case. + + true if the written enum text will be camel case; otherwise, false. + + + + Specifies how constructors are used when initializing objects during deserialization by the . + + + + + First attempt to use the public default constructor, then fall back to single paramatized constructor, then the non-public default constructor. + + + + + Json.NET will use a non-public default constructor before falling back to a paramatized constructor. + + + + + Converts a to and from a string (e.g. "1.2.3.4"). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing property value of the JSON that is being converted. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Specifies how dates are formatted when writing JSON text. + + + + + Dates are written in the ISO 8601 format, e.g. "2012-03-21T05:40Z". + + + + + Dates are written in the Microsoft JSON format, e.g. "\/Date(1198908717056)\/". + + + + + Specifies how to treat the time value when converting between string and . + + + + + Treat as local time. If the object represents a Coordinated Universal Time (UTC), it is converted to the local time. + + + + + Treat as a UTC. If the object represents a local time, it is converted to a UTC. + + + + + Treat as a local time if a is being converted to a string. + If a string is being converted to , convert to a local time if a time zone is specified. + + + + + Time zone information should be preserved when converting. + + + + + Specifies formatting options for the . + + + + + No special formatting is applied. This is the default. + + + + + Causes child objects to be indented according to the and settings. + + + + + Instructs the to use the specified constructor when deserializing that object. + + + + + Represents a raw JSON string. + + + + + Represents a value in JSON (string, integer, date, etc). + + + + + Represents an abstract JSON token. + + + + + Represents a collection of objects. + + The type of token + + + + Gets the with the specified key. + + + + + + Provides an interface to enable a class to return line and position information. + + + + + Gets a value indicating whether the class can return line information. + + + true if LineNumber and LinePosition can be provided; otherwise, false. + + + + + Gets the current line number. + + The current line number or 0 if no line information is available (for example, HasLineInfo returns false). + + + + Gets the current line position. + + The current line position or 0 if no line information is available (for example, HasLineInfo returns false). + + + + Compares the values of two tokens, including the values of all descendant tokens. + + The first to compare. + The second to compare. + true if the tokens are equal; otherwise false. + + + + Adds the specified content immediately after this token. + + A content object that contains simple content or a collection of content objects to be added after this token. + + + + Adds the specified content immediately before this token. + + A content object that contains simple content or a collection of content objects to be added before this token. + + + + Returns a collection of the ancestor tokens of this token. + + A collection of the ancestor tokens of this token. + + + + Returns a collection of the sibling tokens after this token, in document order. + + A collection of the sibling tokens after this tokens, in document order. + + + + Returns a collection of the sibling tokens before this token, in document order. + + A collection of the sibling tokens before this token, in document order. + + + + Gets the with the specified key converted to the specified type. + + The type to convert the token to. + The token key. + The converted token value. + + + + Returns a collection of the child tokens of this token, in document order. + + An of containing the child tokens of this , in document order. + + + + Returns a collection of the child tokens of this token, in document order, filtered by the specified type. + + The type to filter the child tokens on. + A containing the child tokens of this , in document order. + + + + Returns a collection of the child values of this token, in document order. + + The type to convert the values to. + A containing the child values of this , in document order. + + + + Removes this token from its parent. + + + + + Replaces this token with the specified token. + + The value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Returns the indented JSON for this token. + + + The indented JSON for this token. + + + + + Returns the JSON for this token using the given formatting and converters. + + Indicates how the output is formatted. + A collection of which will be used when writing the token. + The JSON for this token using the given formatting and converters. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Creates an for this token. + + An that can be used to read this token and its descendants. + + + + Creates a from an object. + + The object that will be used to create . + A with the value of the specified object + + + + Creates a from an object using the specified . + + The object that will be used to create . + The that will be used when reading the object. + A with the value of the specified object + + + + Creates the specified .NET type from the . + + The new object created from the JSON value. + + + + Creates the specified .NET type from the using the specified . + + The that will be used when creating the object. + The new object created from the JSON value. + + + + Creates a from a . + + An positioned at the token to read into this . + + An that contains the token and its descendant tokens + that were read from the reader. The runtime type of the token is determined + by the token type of the first token encountered in the reader. + + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from a . + + An positioned at the token to read into this . + + An that contains the token and its descendant tokens + that were read from the reader. The runtime type of the token is determined + by the token type of the first token encountered in the reader. + + + + + Selects the token that matches the object path. + + + The object path from the current to the + to be returned. This must be a string of property names or array indexes separated + by periods, such as Tables[0].DefaultView[0].Price in C# or + Tables(0).DefaultView(0).Price in Visual Basic. + + The that matches the object path or a null reference if no matching token is found. + + + + Selects the token that matches the object path. + + + The object path from the current to the + to be returned. This must be a string of property names or array indexes separated + by periods, such as Tables[0].DefaultView[0].Price in C# or + Tables(0).DefaultView(0).Price in Visual Basic. + + A flag to indicate whether an error should be thrown if no token is found. + The that matches the object path. + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Creates a new instance of the . All child tokens are recursively cloned. + + A new instance of the . + + + + Gets a comparer that can compare two tokens for value equality. + + A that can compare two nodes for value equality. + + + + Gets or sets the parent. + + The parent. + + + + Gets the root of this . + + The root of this . + + + + Gets the node type for this . + + The type. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Gets the next sibling token of this node. + + The that contains the next sibling token. + + + + Gets the previous sibling token of this node. + + The that contains the previous sibling token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Get the first child token of this token. + + A containing the first child token of the . + + + + Get the last child token of this token. + + A containing the last child token of the . + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Creates a comment with the given value. + + The value. + A comment with the given value. + + + + Creates a string with the given value. + + The value. + A string with the given value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Indicates whether the current object is equal to another object of the same type. + + + true if the current object is equal to the parameter; otherwise, false. + + An object to compare with this object. + + + + Determines whether the specified is equal to the current . + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + + The parameter is null. + + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format. + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format provider. + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format. + The format provider. + + A that represents this instance. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. + + An object to compare with this instance. + + A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: + Value + Meaning + Less than zero + This instance is less than . + Zero + This instance is equal to . + Greater than zero + This instance is greater than . + + + is not the same type as this instance. + + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Gets the node type for this . + + The type. + + + + Gets or sets the underlying token value. + + The underlying token value. + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class. + + The raw json. + + + + Creates an instance of with the content of the reader's current token. + + The reader. + An instance of with the content of the reader's current token. + + + + Indicating whether a property is required. + + + + + The property is not required. The default state. + + + + + The property must be defined in JSON but can be a null value. + + + + + The property must be defined in JSON and cannot be a null value. + + + + + Contract details for a used by the . + + + + + Contract details for a used by the . + + + + + Gets the underlying type for the contract. + + The underlying type for the contract. + + + + Gets or sets the type created during deserialization. + + The type created during deserialization. + + + + Gets or sets whether this type contract is serialized as a reference. + + Whether this type contract is serialized as a reference. + + + + Gets or sets the default for this contract. + + The converter. + + + + Gets or sets the method called immediately after deserialization of the object. + + The method called immediately after deserialization of the object. + + + + Gets or sets the method called during deserialization of the object. + + The method called during deserialization of the object. + + + + Gets or sets the method called after serialization of the object graph. + + The method called after serialization of the object graph. + + + + Gets or sets the method called before serialization of the object. + + The method called before serialization of the object. + + + + Gets or sets the default creator method used to create the object. + + The default creator method used to create the object. + + + + Gets or sets a value indicating whether the default creator is non public. + + true if the default object creator is non-public; otherwise, false. + + + + Gets or sets the method called when an error is thrown during the serialization of the object. + + The method called when an error is thrown during the serialization of the object. + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets the object's properties. + + The object's properties. + + + + Gets or sets the property name resolver. + + The property name resolver. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the ISerializable object constructor. + + The ISerializable object constructor. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Get and set values for a using dynamic methods. + + + + + Provides methods to get and set values. + + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + Initializes a new instance of the class. + + The member info. + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + Provides data for the Error event. + + + + + Initializes a new instance of the class. + + The current object. + The error context. + + + + Gets the current object the error event is being raised against. + + The current object the error event is being raised against. + + + + Gets the error context. + + The error context. + + + + Represents a view of a . + + + + + Initializes a new instance of the class. + + The name. + Type of the property. + + + + When overridden in a derived class, returns whether resetting an object changes its value. + + + true if resetting the component changes its value; otherwise, false. + + The component to test for reset capability. + + + + + When overridden in a derived class, gets the current value of the property on a component. + + + The value of a property for a given component. + + The component with the property for which to retrieve the value. + + + + + When overridden in a derived class, resets the value for this property of the component to the default value. + + The component with the property value that is to be reset to the default value. + + + + + When overridden in a derived class, sets the value of the component to a different value. + + The component with the property value that is to be set. + The new value. + + + + + When overridden in a derived class, determines a value indicating whether the value of this property needs to be persisted. + + + true if the property should be persisted; otherwise, false. + + The component with the property to be examined for persistence. + + + + + When overridden in a derived class, gets the type of the component this property is bound to. + + + A that represents the type of component this property is bound to. When the or methods are invoked, the object specified might be an instance of this type. + + + + + When overridden in a derived class, gets a value indicating whether this property is read-only. + + + true if the property is read-only; otherwise, false. + + + + + When overridden in a derived class, gets the type of the property. + + + A that represents the type of the property. + + + + + Gets the hash code for the name of the member. + + + + The hash code for the name of the member. + + + + + Used to resolve references when serializing and deserializing JSON by the . + + + + + Resolves a reference to its object. + + The serialization context. + The reference to resolve. + The object that + + + + Gets the reference for the sepecified object. + + The serialization context. + The object to get a reference for. + The reference to the object. + + + + Determines whether the specified object is referenced. + + The serialization context. + The object to test for a reference. + + true if the specified object is referenced; otherwise, false. + + + + + Adds a reference to the specified object. + + The serialization context. + The reference. + The object to reference. + + + + Specifies reference handling options for the . + + + + + Do not preserve references when serializing types. + + + + + Preserve references when serializing into a JSON object structure. + + + + + Preserve references when serializing into a JSON array structure. + + + + + Preserve references when serializing. + + + + + Instructs the how to serialize the collection. + + + + + Instructs the how to serialize the object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets the id. + + The id. + + + + Gets or sets the title. + + The title. + + + + Gets or sets the description. + + The description. + + + + Gets or sets a value that indicates whether to preserve object reference data. + + + true to keep object reference; otherwise, false. The default is false. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a flag indicating whether the array can contain null items + + A flag indicating whether the array can contain null items. + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets a value indicating whether null items are allowed in the collection. + + true if null items are allowed in the collection; otherwise, false. + + + + Specifies default value handling options for the . + + + + + Include members where the member value is the same as the member's default value when serializing objects. + Included members are written to JSON. Has no effect when deserializing. + + + + + Ignore members where the member value is the same as the member's default value when serializing objects + so that is is not written to JSON, and ignores setting members when the JSON value equals the member's default value. + + + + + Members with a default value but no JSON will be set to their default value when deserializing. + + + + + Ignore members where the member value is the same as the member's default value when serializing objects + and sets members to their default value when deserializing. + + + + + Instructs the to use the specified when serializing the member or class. + + + + + Initializes a new instance of the class. + + Type of the converter. + + + + Gets the type of the converter. + + The type of the converter. + + + + Instructs the how to serialize the object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified member serialization. + + The member serialization. + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets the member serialization. + + The member serialization. + + + + Specifies the settings on a object. + + + + + Initializes a new instance of the class. + + + + + Gets or sets how reference loops (e.g. a class referencing itself) is handled. + + Reference loop handling. + + + + Gets or sets how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + Missing member handling. + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets or sets how null values are handled during serialization and deserialization. + + Null value handling. + + + + Gets or sets how null default are handled during serialization and deserialization. + + The default value handling. + + + + Gets or sets a collection that will be used during serialization. + + The converters. + + + + Gets or sets how object references are preserved by the serializer. + + The preserve references handling. + + + + Gets or sets how type name writing and reading is handled by the serializer. + + The type name handling. + + + + Gets or sets how a type name assembly is written and resolved by the serializer. + + The type name assembly format. + + + + Gets or sets how constructors are used during deserialization. + + The constructor handling. + + + + Gets or sets the contract resolver used by the serializer when + serializing .NET objects to JSON and vice versa. + + The contract resolver. + + + + Gets or sets the used by the serializer when resolving references. + + The reference resolver. + + + + Gets or sets the used by the serializer when resolving type names. + + The binder. + + + + Gets or sets the error handler called during serialization and deserialization. + + The error handler called during serialization and deserialization. + + + + Gets or sets the used by the serializer when invoking serialization callback methods. + + The context. + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling during serialization and deserialization. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Represents a reader that provides validation. + + + + + Initializes a new instance of the class that + validates the content returned from the given . + + The to read from while validating. + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. + + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Sets an event handler for receiving schema validation errors. + + + + + Gets the text value of the current Json token. + + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Gets the path of the current JSON token. + + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + + Gets the type of the current Json token. + + + + + + Gets the Common Language Runtime (CLR) type for the current Json token. + + + + + + Gets or sets the schema. + + The schema. + + + + Gets the used to construct this . + + The specified in the constructor. + + + + Compares tokens to determine whether they are equal. + + + + + Determines whether the specified objects are equal. + + The first object of type to compare. + The second object of type to compare. + + true if the specified objects are equal; otherwise, false. + + + + + Returns a hash code for the specified object. + + The for which a hash code is to be returned. + A hash code for the specified object. + The type of is a reference type and is null. + + + + Specifies the member serialization options for the . + + + + + All public members are serialized by default. Members can be excluded using or . + This is the default member serialization mode. + + + + + Only members must be marked with or are serialized. + This member serialization mode can also be set by marking the class with . + + + + + All public and private fields are serialized. Members can be excluded using or . + This member serialization mode can also be set by marking the class with . + + + + + Specifies how object creation is handled by the . + + + + + Reuse existing objects, create new objects when needed. + + + + + Only reuse existing objects. + + + + + Always create new objects. + + + + + Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Gets or sets the date time styles used when converting a date to and from JSON. + + The date time styles used when converting a date to and from JSON. + + + + Gets or sets the date time format used when converting a date to and from JSON. + + The date time format used when converting a date to and from JSON. + + + + Gets or sets the culture used when converting a date to and from JSON. + + The culture used when converting a date to and from JSON. + + + + Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing property value of the JSON that is being converted. + The calling serializer. + The object value. + + + + Converts XML to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The calling serializer. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Checks if the attributeName is a namespace attribute. + + Attribute name to test. + The attribute name prefix if it has one, otherwise an empty string. + True if attribute name is for a namespace attribute, otherwise false. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Gets or sets the name of the root element to insert when deserializing to XML if the JSON structure has produces multiple root elements. + + The name of the deserialize root element. + + + + Gets or sets a flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + true if the array attibute is written to the XML; otherwise, false. + + + + Gets or sets a value indicating whether to write the root JSON object. + + true if the JSON root object is omitted; otherwise, false. + + + + Represents a reader that provides fast, non-cached, forward-only access to JSON text data. + + + + + Initializes a new instance of the class with the specified . + + The TextReader containing the XML data to read. + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Changes the state to closed. + + + + + Gets a value indicating whether the class can return line information. + + + true if LineNumber and LinePosition can be provided; otherwise, false. + + + + + Gets the current line number. + + + The current line number or 0 if no line information is available (for example, HasLineInfo returns false). + + + + + Gets the current line position. + + + The current line position or 0 if no line information is available (for example, HasLineInfo returns false). + + + + + Instructs the to always serialize the member with the specified name. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified name. + + Name of the property. + + + + Gets or sets the null value handling used when serializing this property. + + The null value handling. + + + + Gets or sets the default value handling used when serializing this property. + + The default value handling. + + + + Gets or sets the reference loop handling used when serializing this property. + + The reference loop handling. + + + + Gets or sets the object creation handling used when deserializing this property. + + The object creation handling. + + + + Gets or sets the type name handling used when serializing this property. + + The type name handling. + + + + Gets or sets whether this property's value is serialized as a reference. + + Whether this property's value is serialized as a reference. + + + + Gets or sets the order of serialization and deserialization of a member. + + The numeric order of serialization or deserialization. + + + + Gets or sets the name of the property. + + The name of the property. + + + + Gets or sets a value indicating whether this property is required. + + + A value indicating whether this property is required. + + + + + Instructs the not to serialize the public field or public read/write property value. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Creates an instance of the JsonWriter class using the specified . + + The TextWriter to write to. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the specified end token. + + The end token to write. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + + + + + Gets or sets which character to use to quote attribute values. + + + + + Gets or sets which character to use for indenting when is set to Formatting.Indented. + + + + + Gets or sets a value indicating whether object names will be surrounded with quotes. + + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Gets the line number indicating where the error occurred. + + The line number indicating where the error occurred. + + + + Gets the line position indicating where the error occurred. + + The line position indicating where the error occurred. + + + + Gets the path to the JSON where the error occurred. + + The path to the JSON where the error occurred. + + + + Represents a collection of . + + + + + Provides methods for converting between common language runtime types and JSON types. + + + + + Represents JavaScript's boolean value true as a string. This field is read-only. + + + + + Represents JavaScript's boolean value false as a string. This field is read-only. + + + + + Represents JavaScript's null as a string. This field is read-only. + + + + + Represents JavaScript's undefined as a string. This field is read-only. + + + + + Represents JavaScript's positive infinity as a string. This field is read-only. + + + + + Represents JavaScript's negative infinity as a string. This field is read-only. + + + + + Represents JavaScript's NaN as a string. This field is read-only. + + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation using the specified. + + The value to convert. + The format the date will be converted to. + The time zone handling when the date is converted to a string. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation using the specified. + + The value to convert. + The format the date will be converted to. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + The string delimiter character. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Serializes the specified object to a JSON string. + + The object to serialize. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string. + + The object to serialize. + Indicates how the output is formatted. + + A JSON string representation of the object. + + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A JSON string representation of the object. + + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Deserializes the JSON to a .NET object. + + The JSON to deserialize. + The deserialized object from the Json string. + + + + Deserializes the JSON to a .NET object. + + The JSON to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The of object being deserialized. + The deserialized object from the Json string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + The deserialized object from the Json string. + + + + Deserializes the JSON to the given anonymous type. + + + The anonymous type to deserialize to. This can't be specified + traditionally and must be infered from the anonymous type passed + as a parameter. + + The JSON to deserialize. + The anonymous type object. + The deserialized anonymous type from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The object to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize to. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize to. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + + + Populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + + + Asynchronously populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous populate operation. + + + + + Serializes the XML node to a JSON string. + + The node to serialize. + A JSON string of the XmlNode. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + A JSON string of the XmlNode. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + Omits writing the root object. + A JSON string of the XmlNode. + + + + Deserializes the XmlNode from a JSON string. + + The JSON string. + The deserialized XmlNode + + + + Deserializes the XmlNode from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + The deserialized XmlNode + + + + Deserializes the XmlNode from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + + A flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + The deserialized XmlNode + + + + Serializes the to a JSON string. + + The node to convert to JSON. + A JSON string of the XNode. + + + + Serializes the to a JSON string. + + The node to convert to JSON. + Indicates how the output is formatted. + A JSON string of the XNode. + + + + Serializes the to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + Omits writing the root object. + A JSON string of the XNode. + + + + Deserializes the from a JSON string. + + The JSON string. + The deserialized XNode + + + + Deserializes the from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + The deserialized XNode + + + + Deserializes the from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + + A flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + The deserialized XNode + + + + The exception thrown when an error occurs during Json serialization or deserialization. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Serializes and deserializes objects into and from the JSON format. + The enables you to control how objects are encoded into JSON. + + + + + Initializes a new instance of the class. + + + + + Creates a new instance using the specified . + + The settings to be applied to the . + A new instance using the specified . + + + + Populates the JSON values onto the target object. + + The that contains the JSON structure to reader values from. + The target object to populate values onto. + + + + Populates the JSON values onto the target object. + + The that contains the JSON structure to reader values from. + The target object to populate values onto. + + + + Deserializes the Json structure contained by the specified . + + The that contains the JSON structure to deserialize. + The being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The type of the object to deserialize. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Occurs when the errors during serialization and deserialization. + + + + + Gets or sets the used by the serializer when resolving references. + + + + + Gets or sets the used by the serializer when resolving type names. + + + + + Gets or sets how type name writing and reading is handled by the serializer. + + + + + Gets or sets how a type name assembly is written and resolved by the serializer. + + The type name assembly format. + + + + Gets or sets how object references are preserved by the serializer. + + + + + Get or set how reference loops (e.g. a class referencing itself) is handled. + + + + + Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + + + + Get or set how null values are handled during serialization and deserialization. + + + + + Get or set how null default are handled during serialization and deserialization. + + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets or sets how constructors are used during deserialization. + + The constructor handling. + + + + Gets a collection that will be used during serialization. + + Collection that will be used during serialization. + + + + Gets or sets the contract resolver used by the serializer when + serializing .NET objects to JSON and vice versa. + + + + + Gets or sets the used by the serializer when invoking serialization callback methods. + + The context. + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling during serialization and deserialization. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Contains the LINQ to JSON extension methods. + + + + + Returns a collection of tokens that contains the ancestors of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the ancestors of every node in the source collection. + + + + Returns a collection of tokens that contains the descendants of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the descendants of every node in the source collection. + + + + Returns a collection of child properties of every object in the source collection. + + An of that contains the source collection. + An of that contains the properties of every object in the source collection. + + + + Returns a collection of child values of every object in the source collection with the given key. + + An of that contains the source collection. + The token key. + An of that contains the values of every node in the source collection with the given key. + + + + Returns a collection of child values of every object in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child values of every object in the source collection with the given key. + + The type to convert the values to. + An of that contains the source collection. + The token key. + An that contains the converted values of every node in the source collection with the given key. + + + + Returns a collection of converted child values of every object in the source collection. + + The type to convert the values to. + An of that contains the source collection. + An that contains the converted values of every node in the source collection. + + + + Converts the value. + + The type to convert the value to. + A cast as a of . + A converted value. + + + + Converts the value. + + The source collection type. + The type to convert the value to. + A cast as a of . + A converted value. + + + + Returns a collection of child tokens of every array in the source collection. + + The source collection type. + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child tokens of every array in the source collection. + + An of that contains the source collection. + The type to convert the values to. + The source collection type. + An that contains the converted values of every node in the source collection. + + + + Returns the input typed as . + + An of that contains the source collection. + The input typed as . + + + + Returns the input typed as . + + The source collection type. + An of that contains the source collection. + The input typed as . + + + + Represents a JSON constructor. + + + + + Represents a token that can contain other tokens. + + + + + Raises the event. + + The instance containing the event data. + + + + Raises the event. + + The instance containing the event data. + + + + Raises the event. + + The instance containing the event data. + + + + Returns a collection of the child tokens of this token, in document order. + + + An of containing the child tokens of this , in document order. + + + + + Returns a collection of the child values of this token, in document order. + + The type to convert the values to. + + A containing the child values of this , in document order. + + + + + Returns a collection of the descendant tokens for this token in document order. + + An containing the descendant tokens of the . + + + + Adds the specified content as children of this . + + The content to be added. + + + + Adds the specified content as the first children of this . + + The content to be added. + + + + Creates an that can be used to add tokens to the . + + An that is ready to have content written to it. + + + + Replaces the children nodes of this token with the specified content. + + The content. + + + + Removes the child nodes from this token. + + + + + Occurs when the list changes or an item in the list changes. + + + + + Occurs before an item is added to the collection. + + + + + Occurs when the items list of the collection has changed, or the collection is reset. + + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Get the first child token of this token. + + + A containing the first child token of the . + + + + + Get the last child token of this token. + + + A containing the last child token of the . + + + + + Gets the count of child JSON tokens. + + The count of child JSON tokens + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name. + + The constructor name. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets or sets the name of this constructor. + + The constructor name. + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a collection of objects. + + The type of token + + + + An empty collection of objects. + + + + + Initializes a new instance of the struct. + + The enumerable. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + + + + Determines whether the specified is equal to this instance. + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the with the specified key. + + + + + + Represents a JSON object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Gets an of this object's properties. + + An of this object's properties. + + + + Gets a the specified name. + + The property name. + A with the specified name or null. + + + + Gets an of this object's property values. + + An of this object's property values. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Creates a from an object. + + The object that will be used to create . + The that will be used to read the object. + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Adds the specified property name. + + Name of the property. + The value. + + + + Removes the property with the specified name. + + Name of the property. + true if item was successfully removed; otherwise, false. + + + + Tries the get value. + + Name of the property. + The value. + true if a value was successfully retrieved; otherwise, false. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Raises the event with the provided arguments. + + Name of the property. + + + + Raises the event with the provided arguments. + + Name of the property. + + + + Returns the properties for this instance of a component. + + + A that represents the properties for this component instance. + + + + + Returns the properties for this instance of a component using the attribute array as a filter. + + An array of type that is used as a filter. + + A that represents the filtered properties for this component instance. + + + + + Returns a collection of custom attributes for this instance of a component. + + + An containing the attributes for this object. + + + + + Returns the class name of this instance of a component. + + + The class name of the object, or null if the class does not have a name. + + + + + Returns the name of this instance of a component. + + + The name of the object, or null if the object does not have a name. + + + + + Returns a type converter for this instance of a component. + + + A that is the converter for this object, or null if there is no for this object. + + + + + Returns the default event for this instance of a component. + + + An that represents the default event for this object, or null if this object does not have events. + + + + + Returns the default property for this instance of a component. + + + A that represents the default property for this object, or null if this object does not have properties. + + + + + Returns an editor of the specified type for this instance of a component. + + A that represents the editor for this object. + + An of the specified type that is the editor for this object, or null if the editor cannot be found. + + + + + Returns the events for this instance of a component using the specified attribute array as a filter. + + An array of type that is used as a filter. + + An that represents the filtered events for this component instance. + + + + + Returns the events for this instance of a component. + + + An that represents the events for this component instance. + + + + + Returns an object that contains the property described by the specified property descriptor. + + A that represents the property whose owner is to be found. + + An that represents the owner of the specified property. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Occurs when a property value changes. + + + + + Occurs when a property value is changing. + + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets or sets the with the specified property name. + + + + + + Represents a JSON array. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Creates a from an object. + + The object that will be used to create . + The that will be used to read the object. + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Determines the index of a specific item in the . + + The object to locate in the . + + The index of if found in the list; otherwise, -1. + + + + + Inserts an item to the at the specified index. + + The zero-based index at which should be inserted. + The object to insert into the . + + is not a valid index in the . + The is read-only. + + + + Removes the item at the specified index. + + The zero-based index of the item to remove. + + is not a valid index in the . + The is read-only. + + + + Adds an item to the . + + The object to add to the . + The is read-only. + + + + Removes all items from the . + + The is read-only. + + + + Determines whether the contains a specific value. + + The object to locate in the . + + true if is found in the ; otherwise, false. + + + + + Removes the first occurrence of a specific object from the . + + The object to remove from the . + + true if was successfully removed from the ; otherwise, false. This method also returns false if is not found in the original . + + The is read-only. + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets or sets the at the specified index. + + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class. + + The token to read from. + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Initializes a new instance of the class writing to the given . + + The container being written to. + + + + Initializes a new instance of the class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end. + + The token. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Gets the token being writen. + + The token being writen. + + + + Represents a JSON property. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class. + + The property name. + The property content. + + + + Initializes a new instance of the class. + + The property name. + The property content. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets the property name. + + The property name. + + + + Gets or sets the property value. + + The property value. + + + + Gets the node type for this . + + The type. + + + + Specifies the type of token. + + + + + No token type has been set. + + + + + A JSON object. + + + + + A JSON array. + + + + + A JSON constructor. + + + + + A JSON object property. + + + + + A comment. + + + + + An integer value. + + + + + A float value. + + + + + A string value. + + + + + A boolean value. + + + + + A null value. + + + + + An undefined value. + + + + + A date value. + + + + + A raw JSON value. + + + + + A collection of bytes value. + + + + + A Guid value. + + + + + A Uri value. + + + + + A TimeSpan value. + + + + + Contains the JSON schema extension methods. + + + + + Determines whether the is valid. + + The source to test. + The schema to test with. + + true if the specified is valid; otherwise, false. + + + + + Determines whether the is valid. + + The source to test. + The schema to test with. + When this method returns, contains any error messages generated while validating. + + true if the specified is valid; otherwise, false. + + + + + Validates the specified . + + The source to test. + The schema to test with. + + + + Validates the specified . + + The source to test. + The schema to test with. + The validation event handler. + + + + Returns detailed information about the schema exception. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Gets the line number indicating where the error occurred. + + The line number indicating where the error occurred. + + + + Gets the line position indicating where the error occurred. + + The line position indicating where the error occurred. + + + + Gets the path to the JSON where the error occurred. + + The path to the JSON where the error occurred. + + + + Resolves from an id. + + + + + Initializes a new instance of the class. + + + + + Gets a for the specified id. + + The id. + A for the specified id. + + + + Gets or sets the loaded schemas. + + The loaded schemas. + + + + Specifies undefined schema Id handling options for the . + + + + + Do not infer a schema Id. + + + + + Use the .NET type name as the schema Id. + + + + + Use the assembly qualified .NET type name as the schema Id. + + + + + Returns detailed information related to the . + + + + + Gets the associated with the validation error. + + The JsonSchemaException associated with the validation error. + + + + Gets the path of the JSON location where the validation error occurred. + + The path of the JSON location where the validation error occurred. + + + + Gets the text description corresponding to the validation error. + + The text description. + + + + Represents the callback method that will handle JSON schema validation events and the . + + + + + Resolves member mappings for a type, camel casing property names. + + + + + Used by to resolves a for a given . + + + + + Used by to resolves a for a given . + + + + + Resolves the contract for a given type. + + The type to resolve a contract for. + The contract for a given type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + If set to true the will use a cached shared with other resolvers of the same type. + Sharing the cache will significantly performance because expensive reflection will only happen once but could cause unexpected + behavior if different instances of the resolver are suppose to produce different results. When set to false it is highly + recommended to reuse instances with the . + + + + + Resolves the contract for a given type. + + The type to resolve a contract for. + The contract for a given type. + + + + Gets the serializable members for the type. + + The type to get serializable members for. + The serializable members for the type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates the constructor parameters. + + The constructor to create properties for. + The type's member properties. + Properties for the given . + + + + Creates a for the given . + + The matching member property. + The constructor parameter. + A created for the given . + + + + Resolves the default for the contract. + + Type of the object. + + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Determines which contract type is created for the given type. + + Type of the object. + A for the given type. + + + + Creates properties for the given . + + The type to create properties for. + /// The member serialization mode for the type. + Properties for the given . + + + + Creates the used by the serializer to get and set values from a member. + + The member. + The used by the serializer to get and set values from a member. + + + + Creates a for the given . + + The member's parent . + The member to create a for. + A created for the given . + + + + Resolves the name of the property. + + Name of the property. + Name of the property. + + + + Gets a value indicating whether members are being get and set using dynamic code generation. + This value is determined by the runtime permissions available. + + + true if using dynamic code generation; otherwise, false. + + + + + Gets or sets the default members search flags. + + The default members search flags. + + + + Gets or sets a value indicating whether compiler generated members should be serialized. + + + true if serialized compiler generated members; otherwise, false. + + + + + Gets or sets a value indicating whether to ignore the interface when serializing and deserializing types. + + + true if the interface will be ignored when serializing and deserializing types; otherwise, false. + + + + + Gets or sets a value indicating whether to ignore the attribute when serializing and deserializing types. + + + true if the attribute will be ignored when serializing and deserializing types; otherwise, false. + + + + + Initializes a new instance of the class. + + + + + Resolves the name of the property. + + Name of the property. + The property name camel cased. + + + + The default serialization binder used when resolving and loading classes from type names. + + + + + When overridden in a derived class, controls the binding of a serialized object to a type. + + Specifies the name of the serialized object. + Specifies the name of the serialized object. + + The type of the object the formatter creates a new instance of. + + + + + When overridden in a derived class, controls the binding of a serialized object to a type. + + The type of the object the formatter creates a new instance of. + Specifies the name of the serialized object. + Specifies the name of the serialized object. + + + + Provides information surrounding an error. + + + + + Gets or sets the error. + + The error. + + + + Gets the original object that caused the error. + + The original object that caused the error. + + + + Gets the member that caused the error. + + The member that caused the error. + + + + Gets the path of the JSON location where the error occurred. + + The path of the JSON location where the error occurred. + + + + Gets or sets a value indicating whether this is handled. + + true if handled; otherwise, false. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets the of the collection items. + + The of the collection items. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the property name resolver. + + The property name resolver. + + + + Gets the of the dictionary keys. + + The of the dictionary keys. + + + + Gets the of the dictionary values. + + The of the dictionary values. + + + + Maps a JSON property to a .NET member or constructor parameter. + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Gets or sets the name of the property. + + The name of the property. + + + + Gets or sets the type that declared this property. + + The type that declared this property. + + + + Gets or sets the order of serialization and deserialization of a member. + + The numeric order of serialization or deserialization. + + + + Gets or sets the name of the underlying member or parameter. + + The name of the underlying member or parameter. + + + + Gets the that will get and set the during serialization. + + The that will get and set the during serialization. + + + + Gets or sets the type of the property. + + The type of the property. + + + + Gets or sets the for the property. + If set this converter takes presidence over the contract converter for the property type. + + The converter. + + + + Gets the member converter. + + The member converter. + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + + Gets a value indicating whether this is readable. + + true if readable; otherwise, false. + + + + Gets a value indicating whether this is writable. + + true if writable; otherwise, false. + + + + Gets the default value. + + The default value. + + + + Gets a value indicating whether this is required. + + A value indicating whether this is required. + + + + Gets a value indicating whether this property preserves object references. + + + true if this instance is reference; otherwise, false. + + + + + Gets the property null value handling. + + The null value handling. + + + + Gets the property default value handling. + + The default value handling. + + + + Gets the property reference loop handling. + + The reference loop handling. + + + + Gets the property object creation handling. + + The object creation handling. + + + + Gets or sets the type name handling. + + The type name handling. + + + + Gets or sets a predicate used to determine whether the property should be serialize. + + A predicate used to determine whether the property should be serialize. + + + + Gets or sets a predicate used to determine whether the property should be serialized. + + A predicate used to determine whether the property should be serialized. + + + + Gets or sets an action used to set whether the property has been deserialized. + + An action used to set whether the property has been deserialized. + + + + A collection of objects. + + + + + Initializes a new instance of the class. + + The type. + + + + When implemented in a derived class, extracts the key from the specified element. + + The element from which to extract the key. + The key for the specified element. + + + + Adds a object. + + The property to add to the collection. + + + + Gets the closest matching object. + First attempts to get an exact case match of propertyName and then + a case insensitive match. + + Name of the property. + A matching property if found. + + + + Gets a property by property name. + + The name of the property to get. + Type property name string comparison. + A matching property if found. + + + + Specifies missing member handling options for the . + + + + + Ignore a missing member and do not attempt to deserialize it. + + + + + Throw a when a missing member is encountered during deserialization. + + + + + Specifies null value handling options for the . + + + + + Include null values when serializing and deserializing objects. + + + + + Ignore null values when serializing and deserializing objects. + + + + + Specifies reference loop handling options for the . + + + + + Throw a when a loop is encountered. + + + + + Ignore loop references and do not serialize. + + + + + Serialize loop references. + + + + + An in-memory representation of a JSON Schema. + + + + + Initializes a new instance of the class. + + + + + Reads a from the specified . + + The containing the JSON Schema to read. + The object representing the JSON Schema. + + + + Reads a from the specified . + + The containing the JSON Schema to read. + The to use when resolving schema references. + The object representing the JSON Schema. + + + + Load a from a string that contains schema JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Parses the specified json. + + The json. + The resolver. + A populated from the string that contains JSON. + + + + Writes this schema to a . + + A into which this method will write. + + + + Writes this schema to a using the specified . + + A into which this method will write. + The resolver used. + + + + Returns a that represents the current . + + + A that represents the current . + + + + + Gets or sets the id. + + + + + Gets or sets the title. + + + + + Gets or sets whether the object is required. + + + + + Gets or sets whether the object is read only. + + + + + Gets or sets whether the object is visible to users. + + + + + Gets or sets whether the object is transient. + + + + + Gets or sets the description of the object. + + + + + Gets or sets the types of values allowed by the object. + + The type. + + + + Gets or sets the pattern. + + The pattern. + + + + Gets or sets the minimum length. + + The minimum length. + + + + Gets or sets the maximum length. + + The maximum length. + + + + Gets or sets a number that the value should be divisble by. + + A number that the value should be divisble by. + + + + Gets or sets the minimum. + + The minimum. + + + + Gets or sets the maximum. + + The maximum. + + + + Gets or sets a flag indicating whether the value can not equal the number defined by the "minimum" attribute. + + A flag indicating whether the value can not equal the number defined by the "minimum" attribute. + + + + Gets or sets a flag indicating whether the value can not equal the number defined by the "maximum" attribute. + + A flag indicating whether the value can not equal the number defined by the "maximum" attribute. + + + + Gets or sets the minimum number of items. + + The minimum number of items. + + + + Gets or sets the maximum number of items. + + The maximum number of items. + + + + Gets or sets the of items. + + The of items. + + + + Gets or sets the of properties. + + The of properties. + + + + Gets or sets the of additional properties. + + The of additional properties. + + + + Gets or sets the pattern properties. + + The pattern properties. + + + + Gets or sets a value indicating whether additional properties are allowed. + + + true if additional properties are allowed; otherwise, false. + + + + + Gets or sets the required property if this property is present. + + The required property if this property is present. + + + + Gets or sets the identity. + + The identity. + + + + Gets or sets the a collection of valid enum values allowed. + + A collection of valid enum values allowed. + + + + Gets or sets a collection of options. + + A collection of options. + + + + Gets or sets disallowed types. + + The disallow types. + + + + Gets or sets the default value. + + The default value. + + + + Gets or sets the extend . + + The extended . + + + + Gets or sets the format. + + The format. + + + + Generates a from a specified . + + + + + Generate a from the specified type. + + The type to generate a from. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + The used to resolve schema references. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + Specify whether the generated root will be nullable. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + The used to resolve schema references. + Specify whether the generated root will be nullable. + A generated from the specified type. + + + + Gets or sets how undefined schemas are handled by the serializer. + + + + + Gets or sets the contract resolver. + + The contract resolver. + + + + The value types allowed by the . + + + + + No type specified. + + + + + String type. + + + + + Float type. + + + + + Integer type. + + + + + Boolean type. + + + + + Object type. + + + + + Array type. + + + + + Null type. + + + + + Any type. + + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the object member serialization. + + The member object serialization. + + + + Gets the object's properties. + + The object's properties. + + + + Gets the constructor parameters required for any non-default constructor + + + + + Gets or sets the override constructor used to create the object. + This is set when a constructor is marked up using the + JsonConstructor attribute. + + The override constructor. + + + + Gets or sets the parametrized constructor used to create the object. + + The parametrized constructor. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Get and set values for a using reflection. + + + + + Initializes a new instance of the class. + + The member info. + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + When applied to a method, specifies that the method is called when an error occurs serializing an object. + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic that returns a result + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic, but uses one of the arguments for + the result. + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic, but uses one of the arguments for + the result. + + + + + Returns a Restrictions object which includes our current restrictions merged + with a restriction limiting our type + + + + + Represents a method that constructs an object. + + + + + Specifies type name handling options for the . + + + + + Do not include the .NET type name when serializing types. + + + + + Include the .NET type name when serializing into a JSON object structure. + + + + + Include the .NET type name when serializing into a JSON array structure. + + + + + Always include the .NET type name when serializing. + + + + + Include the .NET type name when the type of the object being serialized is not the same as its declared type. + + + + + Converts the value to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert the value to. + The converted type. + + + + Converts the value to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert the value to. + The converted value if the conversion was successful or the default value of T if it failed. + + true if initialValue was converted successfully; otherwise, false. + + + + + Converts the value to the specified type. If the value is unable to be converted, the + value is checked whether it assignable to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert or cast the value to. + + The converted type. If conversion was unsuccessful, the initial value + is returned if assignable to the target type. + + + + + Gets a dictionary of the names and values of an Enum type. + + + + + + Gets a dictionary of the names and values of an Enum type. + + The enum type to get names and values for. + + + + + Specifies the type of Json token. + + + + + This is returned by the if a method has not been called. + + + + + An object start token. + + + + + An array start token. + + + + + A constructor start token. + + + + + An object property name. + + + + + A comment. + + + + + Raw JSON. + + + + + An integer. + + + + + A float. + + + + + A string. + + + + + A boolean. + + + + + A null token. + + + + + An undefined token. + + + + + An object end token. + + + + + An array end token. + + + + + A constructor end token. + + + + + A Date. + + + + + Byte data. + + + + + Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Adds the elements of the specified collection to the specified generic IList. + + The list to add to. + The collection of elements to add. + + + + Returns the index of the first occurrence in a sequence by using a specified IEqualityComparer. + + The type of the elements of source. + A sequence in which to locate a value. + The object to locate in the sequence + An equality comparer to compare values. + The zero-based index of the first occurrence of value within the entire sequence, if found; otherwise, –1. + + + + Gets the type of the typed collection's items. + + The type. + The type of the typed collection's items. + + + + Gets the member's underlying type. + + The member. + The underlying type of the member. + + + + Determines whether the member is an indexed property. + + The member. + + true if the member is an indexed property; otherwise, false. + + + + + Determines whether the property is an indexed property. + + The property. + + true if the property is an indexed property; otherwise, false. + + + + + Gets the member's value on the object. + + The member. + The target object. + The member's value on the object. + + + + Sets the member's value on the target object. + + The member. + The target. + The value. + + + + Determines whether the specified MemberInfo can be read. + + The MemberInfo to determine whether can be read. + /// if set to true then allow the member to be gotten non-publicly. + + true if the specified MemberInfo can be read; otherwise, false. + + + + + Determines whether the specified MemberInfo can be set. + + The MemberInfo to determine whether can be set. + if set to true then allow the member to be set non-publicly. + if set to true then allow the member to be set if read-only. + + true if the specified MemberInfo can be set; otherwise, false. + + + + + Determines whether the string is all white space. Empty string will return false. + + The string to test whether it is all white space. + + true if the string is all white space; otherwise, false. + + + + + Nulls an empty string. + + The string. + Null if the string was null, otherwise the string unchanged. + + + + Specifies the state of the . + + + + + An exception has been thrown, which has left the in an invalid state. + You may call the method to put the in the Closed state. + Any other method calls results in an being thrown. + + + + + The method has been called. + + + + + An object is being written. + + + + + A array is being written. + + + + + A constructor is being written. + + + + + A property is being written. + + + + + A write method has not been called. + + + + diff --git a/Website/LOC.Website.Common/bin/Release/StructureMap.dll b/Website/LOC.Website.Common/bin/Release/StructureMap.dll new file mode 100644 index 000000000..28a17b021 Binary files /dev/null and b/Website/LOC.Website.Common/bin/Release/StructureMap.dll differ diff --git a/Website/LOC.Website.Common/bin/Release/StructureMap.pdb b/Website/LOC.Website.Common/bin/Release/StructureMap.pdb new file mode 100644 index 000000000..6c4dd1f78 Binary files /dev/null and b/Website/LOC.Website.Common/bin/Release/StructureMap.pdb differ diff --git a/Website/LOC.Website.Common/bin/Release/StructureMap.xml b/Website/LOC.Website.Common/bin/Release/StructureMap.xml new file mode 100644 index 000000000..6376709c4 --- /dev/null +++ b/Website/LOC.Website.Common/bin/Release/StructureMap.xml @@ -0,0 +1,3931 @@ + + + + StructureMap + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Get the object of type T that is valid for this build session. + + + + + + + Get the object of type T that is valid for this build session by name. + + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Register a default object for the given PluginType that will + be used throughout the rest of the current object request + + + + + + + Same as GetInstance, but can gracefully return null if + the Type does not already exist + + + + + + + Same as GetInstance(name), but can gracefully return null if + the Type and name does not already exist + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Gets all objects in the current object graph that can be cast + to T that have already been created + + + + + + + Creates/Resolves every configured instance of PlutinType T + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Gets a reference to the BuildStack for this build session + + + + + The concrete type of the immediate parent object in the object graph + + + + + Gets the root "frame" of the object request + + + + + The requested instance name of the object graph + + + + + Expression Builder that has grammars for defining policies at the + PluginType level. This expression is used for registering + open generic types + + + + + Convenience method that sets the default concrete type of the PluginType. The "concreteType" + can only accept types that do not have any primitive constructor arguments. + StructureMap has to know how to construct all of the constructor argument types. + + + + + + + Use this configured Instance as is + + + + + + Shorter way to call TheDefaultIsConcreteType + + + + + + + Shortcut to add a value by type + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Configure this type as the supplied value + + + + + + Sets the object creation of the instances of the PluginType. For example: PerRequest, + Singleton, ThreadLocal, HttpContext, or Hybrid + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Registers an IBuildInterceptor for this Plugin Type that executes before + any object of this PluginType is created. IBuildInterceptor's can be + used to create a custom scope + + + + + + + Convenience method to mark a PluginFamily as a Singleton + + + + + + Convenience method to mark a PluginFamily as a Hybrid lifecycle + + + + + + Convenience method to mark a PluginFamily as HttpContext scoped + + + + + + + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. You can also chain other declarations after + this method to add constructor and setter arguments + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type by a specified name. You can also chain other declarations after + this method to add constructor and setter arguments + + + + + + + + Specify the value of this explicit argument + + + + + + + Pass in additional arguments by type T + + + + + + + + Pass in additional arguments by type + + + + + + + + Pass in additional arguments by name + + + + + + + Gets the default instance of type T using the explicitly configured arguments from the "args" + + + + + + + Gets a named instance of type T using the explicitly configured arguments from teh "args" + + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + Gets all configured instances of type T using explicitly configured arguments + + + + + + + Returns the System.Reflection.ConstructorInfo for the PluggedType. Uses either + the "greediest" constructor with the most arguments or the constructor function + marked with the [DefaultConstructor] + + + + + + The InstanceKey of the default instance of the PluginFamily + + + + + The CLR Type that defines the "Plugin" interface for the PluginFamily + + + + + Add an Assembly to the scanning operation + + + + + + Add an Assembly by name to the scanning operation + + + + + + Add the currently executing Assembly to the scanning operation + + + + + Add the Assembly that contains type T to the scanning operation + + + + + + Add the Assembly that contains type to the scanning operation + + + + + + Sweep the designated path and add any Assembly's found in this folder to the + scanning operation + + + + + + Sweep the designated path and add any Assembly's found in this folder to the + scanning operation. The assemblyFilter can be used to filter or limit the + Assembly's that are picked up. + + + + + + + Sweep the application base directory of current app domain and add any Assembly's + found to the scanning operation. + + + + + Sweep the application base directory of current app domain and add any Assembly's + found to the scanning operation. The assemblyFilter can be used to filter or limit the + Assembly's that are picked up. + + + + + Adds an ITypeScanner object to the scanning operation + + + + + + Creates and adds a new ITypeScanner of type T to this scanning operation + + + + + + Directs the scanning operation to automatically detect and include any Registry + classes found in the Assembly's being scanned + + + + + Add all concrete types of the Plugin Type as Instances of Plugin Type + + + + + + Add all concrete types of the Plugin Type as Instances of Plugin Type + + + + + + Makes this scanning operation ignore all [PluginFamily] and [Pluggable] attributes + + + + + Exclude types that match the Predicate from being scanned + + + + + + Exclude all types in this nameSpace or its children from the scanning operation + + + + + + Exclude all types in this nameSpace or its children from the scanning operation + + + + + + Only include types matching the Predicate in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Only include types from this nameSpace or its children in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Only include types from this nameSpace or its children in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Exclude this specific type from the scanning operation + + + + + + Adds a registration convention to be applied to all the types in this + logical "scan" operation + + + + + + Adds a registration convention to be applied to all the types in this + logical "scan" operation + + + + + Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete + class named "Something" that implements "ISomething" will be automatically + added to PluginType "ISomething" + + + + + Scans for PluginType's and Concrete Types that close the given open generic type + + + + + + + + + Automatically registers all concrete types without primitive arguments + against its first interface, if any + + + + + Directs the scanning to automatically register any type that is the single + implementation of an interface against that interface. + The filters apply + + + + + Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete + class named "Something" that implements "ISomething" will be automatically + added to PluginType "ISomething" + + + + + Scans for PluginType's and Concrete Types that close the given open generic type + + + + + + + + + Automatically registers all concrete types without primitive arguments + against its first interface, if any + + + + + Directs the scanning to automatically register any type that is the single + implementation of an interface against that interface. + The filters apply + + + + + A TypeInterceptor that is only applied if the MatchesType() + method is true for a given Type + + + + + An InstanceInterceptor can be registered on a per-Instance basis + to act on, or even replace, the object that is created before + it is passed back to the caller. This is primarily a hook + for runtime AOP scenarios. + + + + + Does this TypeInterceptor apply to the given type? + + + + + + + Specify how objects matching the Type predicate + will be intercepted + + + + + + Specify how objects matching the Type predicate + will be intercepted + + + + + + Used for auto-mocking container. When the factory is missing, we can generate a mock for it + + + + + An Instance class that builds objects by calling a constructor function on a concrete type + and filling setter properties. ConfiguredInstance should only be used for open generic types. + Favor SmartInstance{T} for all other usages. + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE + + + + + + + Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE + + + + + + + Inline definition of a constructor or a setter property dependency + + + + + + + Starts the definition of a child instance specifying the argument name + in the case of a constructor function that consumes more than one argument + of type T + + + + + + + + Inline definition of a constructor dependency + + + + + + + + Inline definition of a setter dependency + + + + + + + + Start the definition of a primitive argument to a constructor argument + + + + + + + Configure a primitive constructor argument + + + + + + + Configures an array of Instance's for the array dependency + + + + + + + Part of the Fluent Interface, represents a nonprimitive argument to a + constructure function + + + + + Use a previously configured and named instance for the child + + + + + + + Start the definition of a child instance by defining the concrete type + + + + + + + Start the definition of a child instance by defining the concrete type + + + + + + + Registers a configured instance to use as the argument to the parent's + constructor + + + + + + + Directs StructureMap to fill this dependency with the Default Instance of the + constructor or property type + + + + + + Base class for many of the Instance subclasses to support + method chaining in the Registry DSL for common options + + + + + + Set the name of this Instance + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + + Register an InstanceInterceptor with this Instance + + + + + + + Used to override the constructor of a class to be used by StructureMap to create + a Pluggable object + + + + + Examines a System.Type object and determines the ConstructorInfo to use in creating + instances of the Type + + + + + + + Used to implicitly mark a class as a Plugin candidate for StructureMap + + + + + Determines whether a Type object is marked as Pluggable + + + + + + + The ConcreteKey alias of the Type + + + + + Declares a class, abstract class, or interface to be the target of a PluginFamily in the container + + + + + Determines if a Type object is marked as a PluginFamily + + + + + + + If set, determines the shared "scope" of the instance -- PerRequest, Singleton, ThreadLocal, + HttpContext, etc. + + + + + InstanceKey of the default instance. Used to implicitly define the default without + declaring the instance in StructureMap.config + + + + + Declares the target to be built by StructureMap as a Singleton. One object instance will + be created for each named instance + + + + + Marks a Property in a Pluggable class as filled by setter injection + + + + + Marks a method with no parameters as a method that validates an instance. StructureMap + uses this method to validate the configuration file. If the method does not throw an + exception, the object is assumed to be valid. + + + + + Returns an array of any MethodInfo's on a Type that are marked as ValidationMethod + + CLR Type to search for validation methods + + + + + Constants for the names of Xml nodes and attributes in the StructureMap.config + file + + + + + The name of the default configuration file. The value is always StructurMap.config + + + + + Returns the absolute path to the StructureMap.config file + + + + + + Expression Builder that has grammars for defining policies at the + PluginType level + + + + + Add multiple Instance's to this PluginType + + + + + + + Conditional binding of instances + + + + + + + Access to all of the uncommon Instance types + + + + + + + Access to all of the uncommon Instance types + + + + + + + Convenience method that sets the default concrete type of the PluginType. Type T + can only accept types that do not have any primitive constructor arguments. + StructureMap has to know how to construct all of the constructor argument types. + + + + + + + + Shorthand to say TheDefault.Is.ConstructedBy(func) + + + + + + + Shorthand to say TheDefault.Is.ConstructedBy(func) + + + + + + + Shorthand to say TheDefault.IsThis(@object) + + + + + + + Sets the object creation of the instances of the PluginType. For example: PerRequest, + Singleton, ThreadLocal, HttpContext, or Hybrid + + + + + + + Convenience method to mark a PluginFamily as a Singleton + + + + + + Convenience method to mark a PluginFamily as a Transient + + + + + + Convenience method to mark a PluginFamily as a Hybrid lifecycle + + + + + + Convenience method to mark a PluginFamily as HttpContext scoped + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Adds an Interceptor to only this PluginType + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Registers an ILifecycle for this Plugin Type that executes before + any object of this PluginType is created. ILifecycle's can be + used to create a custom scope + + + + + + + Largely deprecated and unnecessary with the ability to add Xml configuration files + + + + + + + Forces StructureMap to always use a unique instance to + stop the "BuildSession" caching + + + + + + Adds the object to to the PLUGINTYPE + + + + + + + Add an Instance to this type created by a Lambda + + + + + + + Define the Default Instance for this PluginType + + + + + Expression class to help define a runtime Profile + + + + + Starts the definition of the default instance for the containing Profile. This is + still valid, but Type() is recommended + + + + + + + Designate or define the Instance for a type within + this Profile + + + + + + + Use statement to define the Profile defaults for a Generic type + + + + + + + Expression Builder inside of a Profile creation for + open generic types + + + + + Use this concreteType for the Instance of this Profile for the PluginType + + + + + + + Use this concreteType for the Instance of this Profile for the PluginType + + + + + + + Use this Instance for the Profile Instance of this Plugin Type + + + + + + + Use the named Instance as the Profile Instance for this PluginType + + + + + + + Use the named Instance as the Profile Instance for this PluginType + + + + + + + For this type and profile, build the object with this Lambda + + + + + + + Expression Builder within defining a Profile + + + + + + Use a named, preconfigured instance as the default instance for this profile + + + + + + + Use a named, preconfigured instance as the default instance for this profile + + + + + + + Define the default instance of the PluginType for the containing Profile + + + + + + + For this Profile, use an Instance with this Func + + + + + + + For this Profile, use an Instance with this Func + + + + + + + For this Profile, use this object + + + + + + + Access to the uncommon types of Instance + + + + + + For this Profile, use the Concrete Type + + + + + + + For this profile, use this concrete type + + + + + + + A Registry class provides methods and grammars for configuring a Container or ObjectFactory. + Using a Registry subclass is the recommended way of configuring a StructureMap Container. + + + public class MyRegistry : Registry + { + public MyRegistry() + { + ForRequestedType(typeof(IService)).TheDefaultIsConcreteType(typeof(Service)); + } + } + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Imports the configuration from another registry into this registry. + + + + + + Imports the configuration from another registry into this registry. + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + This method is a shortcut for specifying the default constructor and + setter arguments for a ConcreteType. ForConcreteType is shorthand for: + ForRequestedType[T]().Use[T].************** + when the PluginType and ConcreteType are the same Type + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Convenience method. Equivalent of ForRequestedType[PluginType]().AsSingletons() + + + + + + + Uses the configuration expressions of this Registry to create a PluginGraph + object that could be used to initialize a Container. This method is + mostly for internal usage, but might be helpful for diagnostics + + + + + + Adds an additional, non-Default Instance to the PluginType T. + + + + + + + Adds an additional, non-Default Instance to the designated pluginType + This method is mostly meant for open generic types + + + + + + + Expression Builder to define the defaults for a named Profile. Each call + to CreateProfile is additive. + + + + + + + An alternative way to use CreateProfile that uses ProfileExpression + as a Nested Closure. This usage will result in cleaner code for + multiple declarations + + + + + + + Registers a new TypeInterceptor object with the Container + + + + + + Allows you to define a TypeInterceptor inline with Lambdas or anonymous delegates + + + + + IfTypeMatches( ... ).InterceptWith( o => new ObjectWrapper(o) ); + + + + + Designates a policy for scanning assemblies to auto + register types + + + + + + Directs StructureMap to always inject dependencies into any and all public Setter properties + of the type PLUGINTYPE. + + + + + + + Creates automatic "policies" for which public setters are considered mandatory + properties by StructureMap that will be "setter injected" as part of the + construction process. + + + + + + Use to programmatically select the constructor function of a concrete + class. Applies globally to all Containers in a single AppDomain. + + + + + + + All requests For the "TO" types will be filled by fetching the "FROM" + type and casting it to "TO" + GetInstance(typeof(TO)) basically becomes (TO)GetInstance(typeof(FROM)) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( @object ) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( instance ) + + + + + + + + Shorthand for ForRequestedType(pluginType) + + + + + + + + Advanced Usage Only! Skips the Registry and goes right to the inner + Semantic Model of StructureMap. Use with care + + + + + + Adds the concreteType as an Instance of the pluginType. Mostly useful + for conventions + + + + + + + Adds the concreteType as an Instance of the pluginType with a name. Mostly + useful for conventions + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType. + Mostly useful for conventions + + + + + + Imports the configuration from another registry into this registry. + + + + + + Imports the configuration from another registry into this registry. + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + This method is a shortcut for specifying the default constructor and + setter arguments for a ConcreteType. ForConcreteType is shorthand for: + For[T]().Use[T].************** + when the PluginType and ConcreteType are the same Type + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Convenience method. Equivalent of ForRequestedType[PluginType]().Singletons() + + + + + + + Uses the configuration expressions of this Registry to create a PluginGraph + object that could be used to initialize a Container. This method is + mostly for internal usage, but might be helpful for diagnostics + + + + + + Adds an additional, non-Default Instance to the PluginType T. + + + + + + + Adds an additional, non-Default Instance to the designated pluginType + This method is mostly meant for open generic types + + + + + + + Expression Builder to define the defaults for a named Profile. Each call + to CreateProfile is additive. + + + + + + + An alternative way to use CreateProfile that uses ProfileExpression + as a Nested Closure. This usage will result in cleaner code for + multiple declarations + + + + + + + Registers a new TypeInterceptor object with the Container + + + + + + Allows you to define a TypeInterceptor inline with Lambdas or anonymous delegates + + + + + IfTypeMatches( ... ).InterceptWith( o => new ObjectWrapper(o) ); + + + + + Designates a policy for scanning assemblies to auto + register types + + + + + + Directs StructureMap to always inject dependencies into any and all public Setter properties + of the type PLUGINTYPE. + + + + + + + Creates automatic "policies" for which public setters are considered mandatory + properties by StructureMap that will be "setter injected" as part of the + construction process. + + + + + + Use to programmatically select the constructor function of a concrete + class. Applies globally to all Containers in a single AppDomain. + + + + + + + All requests For the "TO" types will be filled by fetching the "FROM" + type and casting it to "TO" + GetInstance(typeof(TO)) basically becomes (TO)GetInstance(typeof(FROM)) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( @object ) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( instance ) + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + + Advanced Usage Only! Skips the Registry and goes right to the inner + Semantic Model of StructureMap. Use with care + + + + + + Define the constructor and setter arguments for the default T + + + + + + Thrown by IProperty classes when an invalid value is applied to + a property of an InstanceGraph + + + + + Main exception for StructureMap. Use the ErrorCode to aid in troubleshooting + StructureMap problems + + + + + Represents a concrete class that can be built by StructureMap as an instance of the parent + PluginFamily’s PluginType. The properties of a Plugin are the CLR Type of the concrete class, + and the human-friendly concrete key that StructureMap will use to identify the Type. + + + + + The ConcreteKey that identifies the Plugin within a PluginFamily + + + + + The concrete CLR Type represented by the Plugin + + + + + Property's that will be filled by setter injection + + + + + Conceptually speaking, a PluginFamily object represents a point of abstraction or variability in + the system. A PluginFamily defines a CLR Type that StructureMap can build, and all of the possible + Plugin’s implementing the CLR Type. + + + + + The CLR Type that defines the "Plugin" interface for the PluginFamily + + + + + The InstanceKey of the default instance of the PluginFamily + + + + + Custom collection class for PluginFamily's + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Models the runtime configuration of a StructureMap Container + + + + + Closes the PluginGraph for adding or removing members. Runs all the AssemblyScanner's + and attempts to attach concrete types to the proper plugin types. Calculates the Profile defaults. + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Adds an AssemblyScanner to the PluginGraph. Used for Testing. + + + + + + Add configuration to a PluginGraph with the Registry DSL + + + + + + Designates whether a PluginGraph has been "Sealed." + + + + + Represents a PropertyInfo of a Plugin.PluggedType that is filled by Setter Injection + + + + + Custom collection class for SetterProperty objects + + + + + Designates a CLR type that is loaded by name. + + + + + Interface for a "Factory" pattern class that creates object instances of the PluginType + + + + + The main "container" object that implements the Service Locator pattern + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates or finds the named instance of T + + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Gets all configured instances of type T using explicitly configured arguments from the "args" + + + + + + + + Gets the default instance of type T using the explicitly configured arguments from the "args" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + Gets the named instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + + Starts a "Nested" Container for atomic, isolated access + + + + + + Starts a new "Nested" Container for atomic, isolated service location. Opens + + + + + + + Provides queryable access to the configured PluginType's and Instances of this Container + + + + + The name of the container. By default this is set to + a random Guid. This is a convience property to + assist with debugging. Feel free to set to anything, + as this is not used in any logic. + + + + + Default implementation of IInstanceFactory + + + + + Constructor to use when troubleshooting possible configuration issues. + + + + + + Constructor to create an Container + + PluginGraph containing the instance and type definitions + for the Container + + + + Creates or finds the named instance of T + + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + Gets all configured instances of type T using explicitly configured arguments from the "args" + + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + + Starts a "Nested" Container for atomic, isolated access + + + + + + Starts a new "Nested" Container for atomic, isolated service location. Opens + + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Sets the default instance for the PluginType + + + + + + + Provides queryable access to the configured PluginType's and Instances of this Container + + + + + The name of the container. By default this is set to + a random Guid. This is a convience property to + assist with debugging. Feel free to set to anything, + as this is not used in any logic. + + + + + GoF Memento representing an Object Instance + + + + + Retrieves the named property value as a string + + + + + + + Template method for implementation specific retrieval of the named property + + + + + + + Returns the named child InstanceMemento + + + + + + + Template method for implementation specific retrieval of the named property + + + + + + + This method is made public for testing. It is not necessary for normal usage. + + + + + + Used to create a templated InstanceMemento + + + + + + + The named type of the object instance represented by the InstanceMemento. Translates to a concrete + type + + + + + The named key of the object instance represented by the InstanceMemento + + + + + Gets the referred template name + + + + + + Template pattern property specifying whether the InstanceMemento is simply a reference + to another named instance. Useful for child objects. + + + + + Template pattern property specifying the instance key that the InstanceMemento refers to + + + + + Is the InstanceMemento a reference to the default instance of the plugin type? + + + + + A TypeInterceptor that always applies to all Instances of a given Plugin Type + + + + + Abstract class that is the supertype of all storage and retrieval mechanisms of + InstanceMemento instances + + + + + Retrieves the named InstanceMemento + + The instanceKey of the requested InstanceMemento + + + + + Retrieves an array of all InstanceMemento's stored by this MementoSource + + + + + + Template pattern method. Determines if the MementoSource contains a definition for the + requested instanceKey. + + + + + + + Template pattern method. Retrieves an InstanceMemento for the instanceKey + + + + + + + The type of MementoSource + + + + + String description of the MementoSource. Used in the StructureMap-Client UI. + + + + + An in-memory implementation of InstanceMemento. + + + + + Creates an instance of MemoryInstanceMemento that represents a reference to another + instance. + + The referenced instance key to another instance + + + + + Creates a MemoryInstanceMemento that represents a reference to the default instance + of a plugin type. + + + + + + Constructs a MemoryInstanceMemento without properties + + The concrete key of the plugin type + The identifying instance key + + + + Constructs a MemoryInstanceMemento with properties + + The concrete key of the plugin type + The identifying instance key + NameValueCollection of instance properties + + + + Sets the value of the named property + + + + + + + Deletes a named property from the DefaultInstanceMemento + + + + + + Links a child InstanceMemento as a named property + + + + + + + Links an array of InstanceMemento's to a named array property + + + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + The main static Facade for the StructureMap container + + + + + Restarts ObjectFactory and blows away all Singleton's and cached instances. Use with caution. + + + + + Remove and dispose all objects scoped by HttpContext. Call this method at the *end* of an Http request to clean up resources + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the named instance of T + + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Provides queryable access to the configured PluginType's and Instances of the inner Container + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + Reads configuration XML documents and builds the structures necessary to initialize + the Container/IInstanceFactory/InstanceBuilder/ObjectInstanceActivator objects + + + + + Reads the configuration information and returns the PluginGraph definition of + plugin families and plugin's + + + + + + Generic implementation of an XmlMementoSource + + + + + Base class for all MementoSource classes that store InstanceMemento's as + node-normalized Xml + + + + + Implementation of MementoSource that stores and retrieves an XmlInstanceMemento per file in a named directory. + DirectoryXmlMementoSource is meant to simplify complicated object graph configurations by isolating each instance to a separate + editable file. + + + + + Stores an Xml InstanceMemento per file in a directory + + A ";" delimited list of directories to look for mementos. DirectoryXmlMementoSource + will use the FIRST directory it finds + The file extension of the InstanceMemento files without a dot. Typically "xml" + NodeNormalized or AttributeNormalized + + + + Implementation of MementoSource that stores and retrieves an XmlInstanceMemento per Embedded Resource file + in a named namespace. EmbeddedFolderXmlMementoSource is meant to simplify complicated object graph configurations + by isolating each instance to a separate + editable file. + + NodeNormalized or AttributeNormalized + The name of the Assembly with the embedded resources + The root namespace of all of the mementos. + The file extension of the memento files - "xml" + + + + An in-memory MementoSource + + + + + Retrieves Xml InstanceMemento's from an xml file stored as an embedded resource in an assembly. + + Designates the nodes that are memento nodes + NodeNormalized or AttributeNormalized + The name of the Assembly the file is embedded into + The path to the embedded resource within the file + + + + Default Constructor + + MementoSource that contains the Memento Templates + MementoSource that contains instances consisting of Template valuee + + + + Stores Attribute-normalized InstanceMemento's in an external file + + + + + Implementation of XmlMementoSource that reads InstanceMemento's from an external file. + Useful to break the StructureMap.config file into smaller pieces. + + + + + Default constructor + + Path to the xml file that contains the instance configuration + XPath expression to the parent node that contains the InstanceMemento nodes. + If empty, it defaults to the top node + The name of the nodes that are InstanceMemento nodes. Useful to store + different types of instances in the same file + + + + An implementation of InstanceMemento that stores properties as Xml attributes + Limited functionality + + + + + Implementation of InstanceMemento that stores information in a node-normalized + Xml format. + + + + + specify what type you'd like the service returned as + + + + + + + Specify the open generic type that should have a single generic parameter + + + + + + + Used as the argument in the Container.Configure() method to describe + configuration directives and specify the sources of configuration for + a Container + + + + + Creates and adds a Registry object of type T. + + The Registry Type + + + + Imports all the configuration from a Registry object + + + + + + Imports configuration from an Xml file. The fileName + must point to an Xml file with valid StructureMap + configuration + + + + + + Imports configuration directly from an XmlNode. This + method was intended for scenarios like Xml being embedded + into an assembly. The node must be a 'StructureMap' node + + + + + + If true, directs StructureMap to look for configuration in the App.config. + The default value is false. + + + + + Expression Builder to define an Instance + + + + + + Register a previously built Instance. This provides a "catch all" + method to attach custom Instance objects. Synonym for Instance() + + + + + + Inject this object directly. Synonym to Object() + + + + + + + Gives you full access to all the different ways to specify an "Instance" + + + + + An Expression Builder to define Instances of a PluginType. + This is mostly used for configuring open generic types + + + + + Shortcut to register a Concrete Type as an instance. This method supports + method chaining to allow you to add constructor and setter arguments for + the concrete type + + + + + + + Shortcut to simply use the Instance with the given name + + + + + + + An Expression Builder that is used throughout the Registry DSL to + add and define Instances + + + + + + Register a previously built Instance. This provides a "catch all" + method to attach custom Instance objects. Synonym for IsThis() + + + + + + Inject this object directly. Synonym to IsThis() + + + + + + + Build the Instance with the constructor function and setter arguments. Starts + the definition of a SmartInstance + + + + + + + Build the Instance with the constructor function and setter arguments. Starts + the definition of a SmartInstance + + + + + + + Build the Instance with the constructor function and setter arguments. Use this + method for open generic types, and favor the generic version of OfConcreteType + for all other types + + + + + + + Build the Instance with the constructor function and setter arguments. Use this + method for open generic types, and favor the generic version of OfConcreteType + for all other types + + + + + + + Create an Instance that builds an object by calling a Lambda or + an anonymous delegate with no arguments + + + + + + + Create an Instance that builds an object by calling a Lambda or + an anonymous delegate with the IContext representing + the current object graph. + + + + + + + Use the Instance of this PluginType with the specified name. This is + generally only used while configuring child dependencies within a deep + object graph + + + + + + + Use the default Instance of this PluginType. This is + generally only used while configuring child dependencies within a deep + object graph + + + + + + Creates an Instance that stores this object of type T, + and returns a cloned copy of the template. + + + + + + + Caches template as a serialized byte stream. Uses deserialization + to create copies when the Instance is built. + + + + + + + Creates an Instance that will load an ASCX user control from the url + + + + + + + Creates an Instance according to conditional rules + + + + + + + Used as an expression builder to specify setter injection policies + + + + + Directs StructureMap to treat all public setters of type T as + mandatory properties + + + + + + Directs StructureMap to tread all public setters with + a PropertyType that matches the predicate as a + mandatory setter + + + + + + Directs StructureMap to treat all public setters that match the + rule as mandatory properties + + + + + + Directs StructureMap to treat all public setters with a property + type in the specified namespace as mandatory properties + + + + + + Directs StructureMap to treat all public setters with a property + type in the specified namespace as mandatory properties + + + + + + Directs StructureMap to treat all public setters where to property name + matches the specified rule as a mandatory property + + + + + + Base class for creating an object instance from an InstanceMemento. SubClasses are + emitted for each concrete Plugin with constructor parameters. + + + + + Allows built-in registration conventions to be configurable through the assembly scanning DSL + + + Intended for StructureMap internal use only. + Custom registration convention instances can be directly configured + before being passed to IAssemblyScanner.With(IRegistrationConvention). + + + + + Simply query to see if there are any implementations registered + + + + + + Ejects any instances of this instance from the current container + and permanently removes the instance from the container configuration + + + + + + Eject all instances of this PluginType from the current container, + but leaves the lifecycle behavior + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Models the state of a Container or ObjectFactory. Can be used to query for the + existence of types registered with StructureMap + + + + + Can StructureMap fulfill a request to ObjectFactory.GetInstance(pluginType) from the + current configuration. This does not include concrete classes that could be auto-configured + upon demand + + + + + + + Can StructureMap fulfill a request to ObjectFactory.GetInstance<T>() from the + current configuration. This does not include concrete classes that could be auto-configured + upon demand + + + + + + + Queryable access to all of the InstanceRef for a given PluginType + + + + + + + Queryable access to all of the InstanceRef for a given PluginType + + + + + + Does the current container have existing configuration for the "pluginType" + + + + + + + Does the current container have existing configuration for the type T + + + + + + Find the concrete type for the default Instance of T. + In other words, when I call Container.GetInstance(Type), + what do I get? May be indeterminate + + + + + + + Find the concrete type for the default Instance of pluginType. + In other words, when I call Container.GetInstance(Type), + what do I get? May be indeterminate + + + + + + Retrieves the configuration for the given type + + + + + + + Retrieves the configuration for the given type + + + + + + + Eject all objects, configuration, and Plugin Types matching this filter + + + + + + Eject all objects and configuration for any Plugin Type that matches this filter + + + + + + Eject all objects and Instance configuration for this PluginType + + + + + + Get each and every configured instance that could possibly + be cast to T + + + + + + + Access to all the Plugin Type registrations + + + + + Makes sure that every request for this object returns a unique object + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + The actual concrete type of this Instance. Not every type of IInstance + can determine the ConcreteType + + + + + Ejects and removes all objects and the configuration for the named instance from the + container + + + + + + + Ejects and removes all objects and configuration for the instances that match the filter + + + + + + + Determines if the pluggedType can be upcast to the pluginType + + + + + + + + Determines if the PluggedType is a valid Plugin into the + PluginType + + + + + + + + Imports configuration from an Xml file. The fileName + must point to an Xml file with valid StructureMap + configuration + + + + + + Imports configuration directly from an XmlNode. This + method was intended for scenarios like Xml being embedded + into an assembly. The node must be a 'StructureMap' node + + + + + + Creates and adds a Registry object of type T. + + The Registry Type + + + + Imports all the configuration from a Registry object + + + + + + If true, makes the existence of the StructureMap.config mandatory. + The default is false. + + + + + If true, the StructureMap.config file will be ignored even if it exists. + The default is false. + + + + + If true, directs StructureMap to look for configuration in the App.config. + The default value is false. + + + + + Designate the Default Profile. This will be applied as soon as the + Container is initialized. + + + + + Retrieves the configuration for the given type + + + + + + + Retrieves the configuration for the given type + + + + + + + Eject all objects, configuration, and Plugin Types matching this filter + + + + + + Eject all objects and configuration for any Plugin Type that matches this filter + + + + + + Eject all objects and Instance configuration for this PluginType + + + + + + Get each and every configured instance that could possibly + be cast to T + + + + + + + The requested PluginType of the Instance being create + + + + + The Name of the Instance being created + + + + + The actual ConcreteType being created. This will not always + be available + + + + + Models the current place in an object graph during the construction of + an instance. Provides contextual information that can be used + to alter the desired construction of child objects + + + + + The requested PluginType of the Instance being create + + + + + The Name of the Instance being created + + + + + The actual ConcreteType being created. This will not always + be available + + + + + Provides metadata about the object graph being constructed. More or less a stack trace of the GetInstance() pipeline + that can be used for "contextual" object construction + + + + + The top level of the object graph. Describes the original requested instance + + + + + The current BuildFrame + + + + + The immediate parent BuildFrame + + + + + Defines the value of a primitive argument to a constructur argument + + + + + Sets the value of the constructor argument + + + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings + + The key in appSettings for the value to use. + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings when it exists. Otherwise uses the provided default value. + + The key in appSettings for the value to use. + The value to use if an entry for does not exist in the appSettings section. + + + + + Instance that builds objects with by calling constructor functions and using setter properties + + The concrete type constructed by SmartInstance + + + + Sets the name of this Instance + + + + + + + Sets the name of this Instance + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register an InstanceInterceptor with this Instance + + + + + + + Define a primitive constructor argument + + + + + + + Set simple setter properties + + + + + + + Define a primitive setter property by specifying the property name with + an expression + + + + + + + Define a primitive setter property by specifying the property name + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type. Do not + use this method if there is more than one constructor arguments of the same type + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type. Do not + use this method if there is more than one constructor arguments of the same type + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type and constructor name. + Use this method if there is more than one constructor arguments of the same type + + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type and constructor name. + Use this method if there is more than one constructor arguments of the same type + + + + + + + + Inline definition of a setter dependency. The property name is specified with an Expression + + + + + + + + Inline definition of a setter dependency. The property name is specified with an Expression + + + + + + + + Inline definition of a setter dependency. Only use this method if there + is only a single property of the SETTERTYPE + + + + + + + Inline definition of a setter dependency. Only use this method if there + is only a single property of the SETTERTYPE + + + + + + + Inline definition of a dependency on an Array of the CHILD type. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + Inline definition of a dependency on an Array of the CHILD type and the specified setter property or constructor argument name. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + + Inline definition of a dependency on an Array of the CHILD type. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + Inline definition of a dependency on an Array of the CHILD type and the specified setter property or constructor argument name. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + + Expression Builder to help define multiple Instances for an Array dependency + + + + + + Nested Closure that allows you to add an unlimited number of child Instances + + + + + + + Specify an array of Instance objects directly for an Array dependency + + + + + + + Expression Builder that helps to define child dependencies inline + + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings + + The key in appSettings for the value to use. + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings when it exists. Otherwise uses the provided default value. + + The key in appSettings for the value to use. + The value to use if an entry for does not exist in the appSettings section. + + + + + Nested Closure to define a child dependency inline + + + + + + + Shortcut to set an inline dependency to an Instance + + + + + + + Shortcut to set an inline dependency to a designated object + + + + + + + Shortcut to set an inline dependency to a designated object + + + + + + + Set an Inline dependency to the Default Instance of the Property type + Used mostly to force an optional Setter property to be filled by + StructureMap + + + + + + Shortcut method to define a child dependency inline + + + + + + + Shortcut method to define a child dependency inline and configure + the child dependency + + + + + + + Provides virtual methods that can be used by subclasses to parse an expression tree. + + + This class actually already exists in the System.Core assembly...as an internal class. + I can only speculate as to why it is internal, but it is obviously much too dangerous + for anyone outside of Microsoft to be using... + + + + diff --git a/Website/LOC.Website.Common/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Website/LOC.Website.Common/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 000000000..e79207a6d Binary files /dev/null and b/Website/LOC.Website.Common/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.Properties.Resources.resources b/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.Properties.Resources.resources new file mode 100644 index 000000000..6c05a9776 Binary files /dev/null and b/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.Properties.Resources.resources differ diff --git a/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.csproj.FileListAbsolute.txt b/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.csproj.FileListAbsolute.txt new file mode 100644 index 000000000..5b4da7871 --- /dev/null +++ b/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.csproj.FileListAbsolute.txt @@ -0,0 +1,18 @@ +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\obj\x86\Debug\LOC.Website.Common.csprojResolveAssemblyReference.cache +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\obj\x86\Debug\LOC.Website.Common.Properties.Resources.resources +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\obj\x86\Debug\LOC.Website.Common.csproj.GenerateResource.Cache +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Debug\LOC.Website.Common.dll.config +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Debug\LOC.Website.Common.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Debug\LOC.Website.Common.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Debug\EntityFramework.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Debug\LinqKit.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Debug\LOC.Core.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Debug\Newtonsoft.Json.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Debug\StructureMap.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Debug\LOC.Core.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Debug\EntityFramework.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Debug\Newtonsoft.Json.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Debug\StructureMap.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Debug\StructureMap.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\obj\x86\Debug\LOC.Website.Common.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\obj\x86\Debug\LOC.Website.Common.pdb diff --git a/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.csproj.GenerateResource.Cache b/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.csproj.GenerateResource.Cache new file mode 100644 index 000000000..542e2cd62 Binary files /dev/null and b/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.csproj.GenerateResource.Cache differ diff --git a/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.csprojResolveAssemblyReference.cache b/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.csprojResolveAssemblyReference.cache new file mode 100644 index 000000000..6bb5e2730 Binary files /dev/null and b/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.csprojResolveAssemblyReference.cache differ diff --git a/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.dll b/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.dll new file mode 100644 index 000000000..b9484e327 Binary files /dev/null and b/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.dll differ diff --git a/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.pdb b/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.pdb new file mode 100644 index 000000000..35277edd3 Binary files /dev/null and b/Website/LOC.Website.Common/obj/x86/Debug/LOC.Website.Common.pdb differ diff --git a/Website/LOC.Website.Common/obj/x86/Debug/TempPE/Properties.Resources.Designer.cs.dll b/Website/LOC.Website.Common/obj/x86/Debug/TempPE/Properties.Resources.Designer.cs.dll new file mode 100644 index 000000000..60706565a Binary files /dev/null and b/Website/LOC.Website.Common/obj/x86/Debug/TempPE/Properties.Resources.Designer.cs.dll differ diff --git a/Website/LOC.Website.Common/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache b/Website/LOC.Website.Common/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 000000000..435ea6c72 Binary files /dev/null and b/Website/LOC.Website.Common/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.Properties.Resources.resources b/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.Properties.Resources.resources new file mode 100644 index 000000000..6c05a9776 Binary files /dev/null and b/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.Properties.Resources.resources differ diff --git a/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.csproj.FileListAbsolute.txt b/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.csproj.FileListAbsolute.txt new file mode 100644 index 000000000..54ccab608 --- /dev/null +++ b/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.csproj.FileListAbsolute.txt @@ -0,0 +1,18 @@ +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Release\LOC.Website.Common.dll.config +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Release\LOC.Website.Common.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Release\LOC.Website.Common.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Release\EntityFramework.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Release\LinqKit.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Release\LOC.Core.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Release\Newtonsoft.Json.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Release\StructureMap.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Release\LOC.Core.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Release\EntityFramework.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Release\Newtonsoft.Json.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Release\StructureMap.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\bin\Release\StructureMap.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\obj\x86\Release\LOC.Website.Common.csprojResolveAssemblyReference.cache +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\obj\x86\Release\LOC.Website.Common.Properties.Resources.resources +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\obj\x86\Release\LOC.Website.Common.csproj.GenerateResource.Cache +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\obj\x86\Release\LOC.Website.Common.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Common\obj\x86\Release\LOC.Website.Common.pdb diff --git a/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.csproj.GenerateResource.Cache b/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.csproj.GenerateResource.Cache new file mode 100644 index 000000000..3a1f69366 Binary files /dev/null and b/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.csproj.GenerateResource.Cache differ diff --git a/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.csprojResolveAssemblyReference.cache b/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.csprojResolveAssemblyReference.cache new file mode 100644 index 000000000..412685ed5 Binary files /dev/null and b/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.csprojResolveAssemblyReference.cache differ diff --git a/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.dll b/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.dll new file mode 100644 index 000000000..17dfddfae Binary files /dev/null and b/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.dll differ diff --git a/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.pdb b/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.pdb new file mode 100644 index 000000000..8c5fdca7f Binary files /dev/null and b/Website/LOC.Website.Common/obj/x86/Release/LOC.Website.Common.pdb differ diff --git a/Website/LOC.Website.Common/obj/x86/Release/TempPE/Model1.Designer.cs.dll b/Website/LOC.Website.Common/obj/x86/Release/TempPE/Model1.Designer.cs.dll new file mode 100644 index 000000000..4ef9de678 Binary files /dev/null and b/Website/LOC.Website.Common/obj/x86/Release/TempPE/Model1.Designer.cs.dll differ diff --git a/Website/LOC.Website.Common/obj/x86/Release/TempPE/Nautilus.Designer.cs.dll b/Website/LOC.Website.Common/obj/x86/Release/TempPE/Nautilus.Designer.cs.dll new file mode 100644 index 000000000..5f9acbb93 Binary files /dev/null and b/Website/LOC.Website.Common/obj/x86/Release/TempPE/Nautilus.Designer.cs.dll differ diff --git a/Website/LOC.Website.Common/obj/x86/Release/TempPE/Properties.Resources.Designer.cs.dll b/Website/LOC.Website.Common/obj/x86/Release/TempPE/Properties.Resources.Designer.cs.dll new file mode 100644 index 000000000..74bd9cbba Binary files /dev/null and b/Website/LOC.Website.Common/obj/x86/Release/TempPE/Properties.Resources.Designer.cs.dll differ diff --git a/Website/LOC.Website.Common/obj/x86/Release/edmxResourcesToEmbed/Nautilus.csdl b/Website/LOC.Website.Common/obj/x86/Release/edmxResourcesToEmbed/Nautilus.csdl new file mode 100644 index 000000000..c638ddaa9 --- /dev/null +++ b/Website/LOC.Website.Common/obj/x86/Release/edmxResourcesToEmbed/Nautilus.csdl @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Website/LOC.Website.Common/obj/x86/Release/edmxResourcesToEmbed/Nautilus.msl b/Website/LOC.Website.Common/obj/x86/Release/edmxResourcesToEmbed/Nautilus.msl new file mode 100644 index 000000000..a47b6f44d --- /dev/null +++ b/Website/LOC.Website.Common/obj/x86/Release/edmxResourcesToEmbed/Nautilus.msl @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Website/LOC.Website.Common/obj/x86/Release/edmxResourcesToEmbed/Nautilus.ssdl b/Website/LOC.Website.Common/obj/x86/Release/edmxResourcesToEmbed/Nautilus.ssdl new file mode 100644 index 000000000..dca73f26e --- /dev/null +++ b/Website/LOC.Website.Common/obj/x86/Release/edmxResourcesToEmbed/Nautilus.ssdl @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Website/LOC.Website.Common/packages.config b/Website/LOC.Website.Common/packages.config new file mode 100644 index 000000000..9d663e1ab --- /dev/null +++ b/Website/LOC.Website.Common/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Website/LOC.Website.Tests/LOC.Website.Tests.csproj b/Website/LOC.Website.Tests/LOC.Website.Tests.csproj new file mode 100644 index 000000000..bed47677d --- /dev/null +++ b/Website/LOC.Website.Tests/LOC.Website.Tests.csproj @@ -0,0 +1,74 @@ + + + + Debug + AnyCPU + + + 2.0 + {5A4544F8-662F-4D5B-B3CB-B9B3994A0C0D} + Library + Properties + LOC.Website.Tests + LOC.Website.Tests + v4.0 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + ..\packages\Moq.4.0.10827\lib\NET40\Moq.dll + + + ..\packages\NUnit.2.6.0.12054\lib\nunit.framework.dll + + + + 3.5 + + + + + False + + + + + + + + {A994B28E-8AAA-4A53-BDFE-0E72F1B0F4AD} + LOC.Core + + + {B112BCCF-A0E9-497C-9821-FF408F1D0A76} + LOC.Website.Common + + + + + \ No newline at end of file diff --git a/Website/LOC.Website.Tests/Properties/AssemblyInfo.cs b/Website/LOC.Website.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..54a4b4591 --- /dev/null +++ b/Website/LOC.Website.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("LOC.Website.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Windows User")] +[assembly: AssemblyProduct("LOC.Website.Tests")] +[assembly: AssemblyCopyright("Copyright © Windows User 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("9100bfe9-76b4-45c1-b156-57998121c97e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Website/LOC.Website.Tests/bin/Debug/EntityFramework.dll b/Website/LOC.Website.Tests/bin/Debug/EntityFramework.dll new file mode 100644 index 000000000..8caef36ac Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Debug/EntityFramework.dll differ diff --git a/Website/LOC.Website.Tests/bin/Debug/EntityFramework.xml b/Website/LOC.Website.Tests/bin/Debug/EntityFramework.xml new file mode 100644 index 000000000..4057d68a4 --- /dev/null +++ b/Website/LOC.Website.Tests/bin/Debug/EntityFramework.xml @@ -0,0 +1,18061 @@ + + + + EntityFramework + + + + + Specifies the database column that a property is mapped to. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The name of the column the property is mapped to. + + + + The name of the column the property is mapped to. + + + + + The zero-based order of the column the property is mapped to. + + + + + The database provider specific data type of the column the property is mapped to. + + + + + Denotes that the class is a complex type. + Complex types are non-scalar properties of entity types that enable scalar properties to be organized within entities. + Complex types do not have keys and cannot be managed by the Entity Framework apart from the parent object. + + + + + Specifies how the database generates values for a property. + + + + + Initializes a new instance of the class. + + The pattern used to generate values for the property in the database. + + + + The pattern used to generate values for the property in the database. + + + + + The pattern used to generate values for a property in the database. + + + + + The database does not generate values. + + + + + The database generates a value when a row is inserted. + + + + + The database generates a value when a row is inserted or updated. + + + + + Denotes a property used as a foreign key in a relationship. + The annotation may be placed on the foreign key property and specify the associated navigation property name, + or placed on a navigation property and specify the associated foreign key name. + + + + + Initializes a new instance of the class. + + + If placed on a foreign key property, the name of the associated navigation property. + If placed on a navigation property, the name of the associated foreign key(s). + If a navigation property has multiple foreign keys, a comma separated list should be supplied. + + + + + If placed on a foreign key property, the name of the associated navigation property. + If placed on a navigation property, the name of the associated foreign key(s). + + + + + Specifies the inverse of a navigation property that represents the other end of the same relationship. + + + + + Initializes a new instance of the class. + + The navigation property representing the other end of the same relationship. + + + + The navigation property representing the other end of the same relationship. + + + + + Specifies the maximum length of array/string data allowed in a property. + + + + + Initializes a new instance of the class. + + + The maximum allowable length of array/string data. + Value must be greater than zero. + + + + + Initializes a new instance of the class. + The maximum allowable length supported by the database will be used. + + + + + Determines whether a specified object is valid. (Overrides ) + + + This method returns true if the is null. + It is assumed the is used if the value may not be null. + + The object to validate. + true if the value is null or less than or equal to the specified maximum length, otherwise false + Length is zero or less than negative one. + + + + Applies formatting to a specified error message. (Overrides ) + + The name to include in the formatted string. + A localized string to describe the maximum acceptable length. + + + + Checks that Length has a legal value. Throws InvalidOperationException if not. + + + + + Gets the maximum allowable length of the array/string data. + + + + + Specifies the minimum length of array/string data allowed in a property. + + + + + Initializes a new instance of the class. + + + The minimum allowable length of array/string data. + Value must be greater than or equal to zero. + + + + + Determines whether a specified object is valid. (Overrides ) + + + This method returns true if the is null. + It is assumed the is used if the value may not be null. + + The object to validate. + true if the value is null or greater than or equal to the specified minimum length, otherwise false + Length is less than zero. + + + + Applies formatting to a specified error message. (Overrides ) + + The name to include in the formatted string. + A localized string to describe the minimum acceptable length. + + + + Checks that Length has a legal value. Throws InvalidOperationException if not. + + + + + Gets the minimum allowable length of the array/string data. + + + + + Denotes that a property or class should be excluded from database mapping. + + + + + Specifies the database table that a class is mapped to. + + + + + Initializes a new instance of the class. + + The name of the table the class is mapped to. + + + + The name of the table the class is mapped to. + + + + + The schema of the table the class is mapped to. + + + + + The base for all all Entity Data Model (EDM) types that represent a type from the EDM type system. + + + + + Represents an item in an Entity Data Model (EDM) . + + + + + The base for all all Entity Data Model (EDM) item types that with a Name property that represents a qualified (can be dotted) name. + + + + + The base for all all Entity Data Model (EDM) item types that with a property. + + + + + The base for all all Entity Data Model (EDM) types that support annotation using . + + + + + EdmDataModelItem is the base for all types in the Entity Data Model (EDM) metadata construction and modification API. + + + + + DataModelItem is the base for all types in the EDM metadata reflection, construction and modification API. + + + + + Gets an value indicating which Entity Data Model (EDM) concept is represented by this item. + + + + + IAnnotatedDataModelItem is implemented by model-specific base types for all types with an property. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets or sets the currently assigned annotations. + + + + + Returns all EdmItem children directly contained by this EdmItem. + + + + + INamedDataModelItem is implemented by model-specific base types for all types with a property. + + + + + Gets or sets the currently assigned name. + + + + + Gets or sets the currently assigned name. + + + + + Gets a value indicating whether this type is abstract. + + + + + Gets the optional base type of this type. + + + + + EdmStructuralMember is the base for all types that represent members of structural items in the Entity Data Model (EDM) metadata construction and modification API. + + + + + Represents information about a database connection. + + + + + Creates a new instance of DbConnectionInfo representing a connection that is specified in the application configuration file. + + The name of the connection string in the application configuration. + + + + Creates a new instance of DbConnectionInfo based on a connection string. + + The connection string to use for the connection. + The name of the provider to use for the connection. Use 'System.Data.SqlClient' for SQL Server. + + + + Gets the connection information represented by this instance. + + Configuration to use if connection comes from the configuration file. + + + + Instances of this class are used to create DbConnection objects for + SQL Server LocalDb based on a given database name or connection string. + + + An instance of this class can be set on the class or in the + app.config/web.config for the application to cause all DbContexts created with no + connection information or just a database name to use SQL Server LocalDb by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Implementations of this interface are used to create DbConnection objects for + a type of database server based on a given database name. + An Instance is set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use a certain type of database server by default. + Two implementations of this interface are provided: + is used to create connections to Microsoft SQL Server, including EXPRESS editions. + is used to create connections to Microsoft SQL + Server Compact Editions. + Other implementations for other database servers can be added as needed. + Note that implementations should be thread safe or immutable since they may + be accessed by multiple threads at the same time. + + + + + Creates a connection based on the given database name or connection string. + + The database name or connection string. + An initialized DbConnection. + + + + Creates a new instance of the connection factory for the given version of LocalDb. + For SQL Server 2012 LocalDb use "v11.0". + + The LocalDb version to use. + + + + Creates a new instance of the connection factory for the given version of LocalDb. + For SQL Server 2012 LocalDb use "v11.0". + + + The LocalDb version to use. + + The connection string to use for options to the database other than the 'Initial Catalog', + 'Data Source', and 'AttachDbFilename'. + The 'Initial Catalog' and 'AttachDbFilename' will be prepended to this string based on the + database name when CreateConnection is called. + The 'Data Source' will be set based on the LocalDbVersion argument. + + + + + Creates a connection for SQL Server LocalDb based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + The connection string to use for options to the database other than the 'Initial Catalog', + 'Data Source', and 'AttachDbFilename'. + The 'Initial Catalog' and 'AttachDbFilename' will be prepended to this string based on the + database name when CreateConnection is called. + The 'Data Source' will be set based on the LocalDbVersion argument. + The default is 'Integrated Security=True; MultipleActiveResultSets=True;'. + + + + + Encapsulates a cloned and store . Note that these + objects are disposable and should be used in a using block to ensure both the cloned context and the + cloned connection are disposed. + + + + + For mocking. + + + + + Creates a clone of the given . The underlying of + the context is also cloned and the given connection string is used for the connection string of + the cloned connection. + + + + + Finds the assemblies that were used for loading o-space types in the source context + and loads those assemblies in the cloned context. + + + + + Disposes both the underlying ObjectContext and its store connection. + + + + + The cloned context. + + + + + This is always the store connection of the underlying ObjectContext. + + + + + Represents setting the database initializer for a specific context type + + + + + Represents a parameter to be passed to a method + + + + + Represents a series of parameters to pass to a method + + + + + Adds a new parameter to the collection + Used for unit testing + + + + + Represents the configuration for a series of contexts + + + + + Adds a new context to the collection + Used for unit testing + + + + + Represents the configuration for a specific context type + + + + + Represents setting the default connection factory + + + + + Represents all Entity Framework related configuration + + + + + Handles creating databases either using the core provider or the Migrations pipeline. + + + + + Creates a database using the core provider (i.e. ObjectContext.CreateDatabase) or + by using Code First Migrations to create an empty database + and the perform an automatic migration to the current model. + Migrations is used if Code First is being used and the EF provider is for SQL Server + or SQL Compact. The core is used for non-Code First models and for other providers even + when using Code First. + + + + + A DbContext instance represents a combination of the Unit Of Work and Repository patterns such that + it can be used to query from a database and group together changes that will then be written + back to the store as a unit. + DbContext is conceptually similar to ObjectContext. + + + DbContext is usually used with a derived type that contains properties for + the root entities of the model. These sets are automatically initialized when the + instance of the derived class is created. This behavior can be modified by applying the + attribute to either the entire derived context + class, or to individual properties on the class. + + The Entity Data Model backing the context can be specified in several ways. When using the Code First + approach, the properties on the derived context are used to build a model + by convention. The protected OnModelCreating method can be overridden to tweak this model. More + control over the model used for the Model First approach can be obtained by creating a + explicitly from a and passing this model to one of the DbContext constructors. + + When using the Database First or Model First approach the Entity Data Model can be created using the + Entity Designer (or manually through creation of an EDMX file) and then this model can be specified using + entity connection string or an object. + + The connection to the database (including the name of the database) can be specified in several ways. + If the parameterless DbContext constructor is called from a derived context, then the name of the derived context + is used to find a connection string in the app.config or web.config file. If no connection string is found, then + the name is passed to the DefaultConnectionFactory registered on the class. The connection + factory then uses the context name as the database name in a default connection string. (This default connection + string points to .\SQLEXPRESS on the local machine unless a different DefaultConnectionFactory is registered.) + + Instead of using the derived context name, the connection/database name can also be specified explicitly by + passing the name to one of the DbContext constructors that takes a string. The name can also be passed in + the form "name=myname", in which case the name must be found in the config file or an exception will be thrown. + + Note that the connection found in the app.config or web.config file can be a normal database connection + string (not a special Entity Framework connection string) in which case the DbContext will use Code First. + However, if the connection found in the config file is a special Entity Framework connection string, then the + DbContext will use Database/Model First and the model specified in the connection string will be used. + + An existing or explicitly created DbConnection can also be used instead of the database/connection name. + + A can be applied to a class derived from DbContext to set the + version of conventions used by the context when it creates a model. If no attribute is applied then the + latest version of conventions will be used. + + + + + Interface implemented by objects that can provide an instance. + The class implements this interface to provide access to the underlying + ObjectContext. + + + + + Gets the object context. + + The object context. + + + + Constructs a new context instance using conventions to create the name of the database to + which a connection will be made. The by-convention name is the full name (namespace + class name) + of the derived context class. + See the class remarks for how this is used to create a connection. + + + + + Constructs a new context instance using conventions to create the name of the database to + which a connection will be made, and initializes it from the given model. + The by-convention name is the full name (namespace + class name) of the derived context class. + See the class remarks for how this is used to create a connection. + + The model that will back this context. + + + + Constructs a new context instance using the given string as the name or connection string for the + database to which a connection will be made. + See the class remarks for how this is used to create a connection. + + Either the database name or a connection string. + + + + Constructs a new context instance using the given string as the name or connection string for the + database to which a connection will be made, and initializes it from the given model. + See the class remarks for how this is used to create a connection. + + Either the database name or a connection string. + The model that will back this context. + + + + Constructs a new context instance using the existing connection to connect to a database. + The connection will not be disposed when the context is disposed. + + An existing connection to use for the new context. + If set to true the connection is disposed when + the context is disposed, otherwise the caller must dispose the connection. + + + + Constructs a new context instance using the existing connection to connect to a database, + and initializes it from the given model. + The connection will not be disposed when the context is disposed. + An existing connection to use for the new context. + The model that will back this context. + If set to true the connection is disposed when + the context is disposed, otherwise the caller must dispose the connection. + + + + + Constructs a new context instance around an existing ObjectContext. + An existing ObjectContext to wrap with the new context. + If set to true the ObjectContext is disposed when + the DbContext is disposed, otherwise the caller must dispose the connection. + + + + + Initializes the internal context, discovers and initializes sets, and initializes from a model if one is provided. + + + + + Discovers DbSets and initializes them. + + + + + This method is called when the model for a derived context has been initialized, but + before the model has been locked down and used to initialize the context. The default + implementation of this method does nothing, but it can be overridden in a derived class + such that the model can be further configured before it is locked down. + + + Typically, this method is called only once when the first instance of a derived context + is created. The model for that context is then cached and is for all further instances of + the context in the app domain. This caching can be disabled by setting the ModelCaching + property on the given ModelBuidler, but note that this can seriously degrade performance. + More control over caching is provided through use of the DbModelBuilder and DbContextFactory + classes directly. + + The builder that defines the model for the context being created. + + + + Internal method used to make the call to the real OnModelCreating method. + + The model builder. + + + + Returns a DbSet instance for access to entities of the given type in the context, + the ObjectStateManager, and the underlying store. + + + See the DbSet class for more details. + + The type entity for which a set should be returned. + A set for the given entity type. + + + + Returns a non-generic DbSet instance for access to entities of the given type in the context, + the ObjectStateManager, and the underlying store. + + The type of entity for which a set should be returned. + A set for the given entity type. + + See the DbSet class for more details. + + + + + Saves all changes made in this context to the underlying database. + + The number of objects written to the underlying database. + Thrown if the context has been disposed. + + + + Validates tracked entities and returns a Collection of containing validation results. + + + Collection of validation results for invalid entities. The collection is never null and must not contain null + values or results for valid entities. + + + 1. This method calls DetectChanges() to determine states of the tracked entities unless + DbContextConfiguration.AutoDetectChangesEnabled is set to false. + 2. By default only Added on Modified entities are validated. The user is able to change this behavior + by overriding ShouldValidateEntity method. + + + + + Extension point allowing the user to override the default behavior of validating only + added and modified entities. + + DbEntityEntry instance that is supposed to be validated. + true to proceed with validation. false otherwise. + + + + Extension point allowing the user to customize validation of an entity or filter out validation results. + Called by . + + DbEntityEntry instance to be validated. + User defined dictionary containing additional info for custom validation. + It will be passed to + and will be exposed as . + This parameter is optional and can be null. + Entity validation result. Possibly null when overridden. + + + + Internal method that calls the protected ValidateEntity method. + + DbEntityEntry instance to be validated. + User defined dictionary containing additional info for custom validation. + It will be passed to + and will be exposed as . + This parameter is optional and can be null. + Entity validation result. Possibly null when ValidateEntity is overridden. + + + + Gets a object for the given entity providing access to + information about the entity and the ability to perform actions on the entity. + + The type of the entity. + The entity. + An entry for the entity. + + + + Gets a object for the given entity providing access to + information about the entity and the ability to perform actions on the entity. + + The entity. + An entry for the entity. + + + + Calls the protected Dispose method. + + + + + Disposes the context. The underlying is also disposed if it was created + is by this context or ownership was passed to this context when this context was created. + The connection to the database ( object) is also disposed if it was created + is by this context or ownership was passed to this context when this context was created. + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Creates a Database instance for this context that allows for creation/deletion/existence checks + for the underlying database. + + + + + Returns the Entity Framework ObjectContext that is underlying this context. + + Thrown if the context has been disposed. + + + + Provides access to features of the context that deal with change tracking of entities. + + An object used to access features that deal with change tracking. + + + + Provides access to configuration options for the context. + + An object used to access configuration options. + + + + Provides access to the underlying InternalContext for other parts of the internal design. + + + + + A simple representation of an app.config or web.config file. + + + + + Initializes a new instance of AppConfig based on supplied configuration + + Configuration to load settings from + + + + Initializes a new instance of AppConfig based on supplied connection strings + The default configuration for database initializers and default connection factory will be used + + Connection strings to be used + + + + Initializes a new instance of AppConfig based on the for the AppDomain + + + Use AppConfig.DefaultInstance instead of this constructor + + + + + Appies any database intializers specified in the configuration + + + + + Appies any database intializers specified in the configuration + + + Value indicating if initializers should be re-applied if they have already been applied in this AppDomain + + + + + Gets the specified connection string from the configuration + + Name of the connection string to get + The connection string, or null if there is no connection string with the specified name + + + + Gets the default connection factory based on the configuration + + + + + Gets a singleton instance of configuration based on the for the AppDomain + + + + + Acts as a proxy for that for the most part just passes calls + through to the real object but uses virtual methods/properties such that uses of the object + can be mocked. + + + + + Encapsulates information read from the application config file that specifies a database initializer + and allows that initializer to be dynamically applied. + + + + + Initializes a new instance of the class. + + The key from the entry in the config file. + The value from the enrty in the config file. + + + + Uses the context type and initializer type specified in the config to create an initializer instance + and set it with the DbDbatabase.SetInitializer method. + + + + + Reads all initializers from the application config file and sets them using the Database class. + + + + + Calculates the model hash values used the EdmMetadata table from EF 4.1/4.2. + + + + + Calculates an SHA256 hash of the EDMX from the given code first model. This is the hash stored in + the database in the EdmMetadata table in EF 4.1/4.2. The hash is always calculated using a v2 schema + as was generated by EF 4.1/4.2 and with the entity included in the model. + + + + + Acts as a proxy for that for the most part just passes calls + through to the real object but uses virtual methods/properties such that uses of the object + can be mocked. + + + + + An implementation of that will use Code First Migrations + to update the database to the latest version. + + + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + Initializes a new instance of the MigrateDatabaseToLatestVersion class. + + + + + Initializes a new instance of the MigrateDatabaseToLatestVersion class that will + use a specific connection string from the configuration file to connect to + the database to perform the migration. + + The name of the connection string to use for migration. + + + + + + + Helper class that is used to configure a column. + + + + + Creates a new column definition to store Binary data. + + Value indicating whether or not the column allows null values. + The maximum allowable length of the array data. + Value indicating whether or not all data should be padded to the maximum length. + Value indicating whether or not the maximum length supported by the database provider should be used. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + Value indicating whether or not this column should be configured as a timestamp. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Boolean data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Byte data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store DateTime data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Decimal data. + + Value indicating whether or not the column allows null values. + The numeric precision of the column. + The numeric scale of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + Value indicating whether or not the database will generate values for this column during insert. + The newly constructed column definition. + + + + Creates a new column definition to store Double data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store GUID data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Single data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Short data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Integer data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Long data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store String data. + + Value indicating whether or not the column allows null values. + The maximum allowable length of the string data. + Value indicating whether or not all data should be padded to the maximum length. + Value indicating whether or not the maximum length supported by the database provider should be used. + Value indicating whether or not the column supports Unicode content. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Time data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store DateTimeOffset data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Helper class that is used to further configure a table being created from a CreateTable call on . + + + + + Initializes a new instance of the TableBuilder class. + + The table creation operation to be further configured. + The migration the table is created in. + + + + Specifies a primary key for the table. + + + A lambda expression representing the property to be used as the primary key. + C#: t => t.Id + VB.Net: Function(t) t.Id + + If the primary key is made up of multiple properties then specify an anonymous type including the properties. + C#: t => new { t.Id1, t.Id2 } + VB.Net: Function(t) New With { t.Id1, t.Id2 } + + + The name of the primary key. + If null is supplied, a default name will be generated. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Specifies an index to be created on the table. + + + A lambda expression representing the property to be indexed. + C#: t => t.PropertyOne + VB.Net: Function(t) t.PropertyOne + + If multiple properties are to be indexed then specify an anonymous type including the properties. + C#: t => new { t.PropertyOne, t.PropertyTwo } + VB.Net: Function(t) New With { t.PropertyOne, t.PropertyTwo } + + A value indicating whether or not this is a unique index. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Specifies a foreign key constraint to be created on the table. + + Name of the table that the foreign key constraint targets. + + A lambda expression representing the properties of the foreign key. + C#: t => t.PropertyOne + VB.Net: Function(t) t.PropertyOne + + If multiple properties make up the foreign key then specify an anonymous type including the properties. + C#: t => new { t.PropertyOne, t.PropertyTwo } + VB.Net: Function(t) New With { t.PropertyOne, t.PropertyTwo } + + A value indicating whether or not cascade delete should be configured on the foreign key constraint. + + + The name of this foreign key constraint. + If no name is supplied, a default name will be calculated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Base class for code-based migrations. + + + + + Operations to be performed during the upgrade process. + + + + + Operations to be performed during the downgrade process. + + + + + Adds an operation to create a new table. + + + The columns in this create table operation. + You do not need to specify this type, it will be inferred from the columnsAction parameter you supply. + + The name of the table. Schema name is optional, if no schema is specified then dbo is assumed. + + An action that specifies the columns to be included in the table. + i.e. t => new { Id = t.Int(identity: true), Name = t.String() } + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + An object that allows further configuration of the table creation operation. + + + + Adds an operation to create a new foreign key constraint. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key column. + + The table that contains the column this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The column this foreign key references. + If no value is supplied the primary key of the principal table will be referenced. + + + A value indicating if cascade delete should be configured for the foreign key relationship. + If no value is supplied, cascade delete will be off. + + + The name of the foreign key constraint in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new foreign key constraint. + + + The table that contains the foreign key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key columns. + + The table that contains the columns this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The columns this foreign key references. + If no value is supplied the primary key of the principal table will be referenced. + + + A value indicating if cascade delete should be configured for the foreign key relationship. + If no value is supplied, cascade delete will be off. + + + The name of the foreign key constraint in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on its name. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the foreign key constraint in the database. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on the column it targets. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key column. + + The table that contains the column this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + The columns this foreign key references. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on the columns it targets. + + + The table that contains the foreign key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key columns. + + The table that contains the columns this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + The columns this foreign key references. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a table. + + + The name of the table to be dropped. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to move a table to a new schema. + + + The name of the table to be moved. + Schema name is optional, if no schema is specified then dbo is assumed. + + The schema the table is to be moved to. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to rename a table. To change the schema of a table use MoveTable + + + The name of the table to be renamed. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The new name for the table. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to rename a column. + + + The name of the table that contains the column to be renamed. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be renamed. + The new name for the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to add a column to an existing table. + + + The name of the table to add the column to. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The name of the column to be added. + + + An action that specifies the column to be added. + i.e. c => c.Int(nullable: false, defaultValue: 3) + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing column. + + + The name of the table to drop the column from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to alter the definition of an existing column. + + + The name of the table the column exists in. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be changed. + + An action that specifies the new definition for the column. + i.e. c => c.String(nullable: false, defaultValue: "none") + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new primary key. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The primary key column. + + The name of the primary key in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new primary key based on multiple columns. + + + The table that contains the primary key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The primary key columns. + + The name of the primary key in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing primary key that does not have the default name. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the primary key to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing primary key that was created with the default name. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create an index on a single column. + + + The name of the table to create the index on. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to create the index on. + + A value indicating if this is a unique index. + If no value is supplied a non-unique index will be created. + + + The name to use for the index in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create an index on multiple columns. + + + The name of the table to create the index on. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the columns to create the index on. + + A value indicating if this is a unique index. + If no value is supplied a non-unique index will be created. + + + The name to use for the index in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an index based on its name. + + + The name of the table to drop the index from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the index to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an index based on the columns it targets. + + + The name of the table to drop the index from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column(s) the index targets. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to execute a SQL command. + + The SQL to be executed. + + A value indicating if the SQL should be executed outside of the + transaction being used for the migration process. + If no value is supplied the SQL will be executed within the transaction. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Configuration relating to the use of migrations for a given model. + You will typically create a configuration class that derives + from rather than + using this class. + + + + + Initializes a new instance of the DbMigrationsConfiguration class. + + + + + Adds a new SQL generator to be used for a given database provider. + + Name of the database provider to set the SQL generator for. + The SQL generator to be used. + + + + Gets the SQL generator that is set to be used with a given database provider. + + Name of the database provider to get the SQL generator for. + The SQL generator that is set for the database provider. + + + + Gets or sets a value indicating if automatic migrations can be used when migration the database. + + + + + Gets or sets a value indicating if data loss is acceptable during automatic migration. + If set to false an exception will be thrown if data loss may occur as part of an automatic migration. + + + + + Gets or sets the derived DbContext representing the model to be migrated. + + + + + Gets or sets the namespace used for code-based migrations. + + + + + Gets or sets the sub-directory that code-based migrations are stored in. + + + + + Gets or sets the code generator to be used when scaffolding migrations. + + + + + Gets or sets the assembly containing code-based migrations. + + + + + Gets or sets a value to override the connection of the database to be migrated. + + + + + Gets or sets the timeout value used for the individual commands within a + migration. A null value indicates that the default value of the underlying + provider will be used. + + + + + Configuration relating to the use of migrations for a given model. + + The context representing the model that this configuration applies to. + + + + Initializes a new instance of the DbMigrationsConfiguration class. + + + + + Runs after upgrading to the latest migration to allow seed data to be updated. + + Context to be used for updating seed data. + + + + DbMigrator is used to apply existing migrations to a database. + DbMigrator can be used to upgrade and downgrade to any given migration. + To scaffold migrations based on changes to your model use + + + + + Base class for decorators that wrap the core + + + + + Initializes a new instance of the MigratorBase class. + + The migrator that this decorator is wrapping. + + + + Gets a list of the pending migrations that have not been applied to the database. + + List of migration Ids + + + + Updates the target database to the latest migration. + + + + + Updates the target database to a given migration. + + The migration to upgrade/downgrade to. + + + + Gets a list of the migrations that are defined in the assembly. + + List of migration Ids + + + + Gets a list of the migrations that have been applied to the database. + + List of migration Ids + + + + Gets the configuration being used for the migrations process. + + + + + Migration Id representing the state of the database before any migrations are applied. + + + + + Initializes a new instance of the DbMigrator class. + + Configuration to be used for the migration process. + + + + Gets all migrations that are defined in the configured migrations assembly. + + + + + Gets all migrations that have been applied to the target database. + + + + + Gets all migrations that are defined in the assembly but haven't been applied to the target database. + + + + + Updates the target database to a given migration. + + The migration to upgrade/downgrade to. + + + + Gets the configuration that is being used for the migration process. + + + + + A set of extension methods for + + + + + Adds or updates entities by key when SaveChanges is called. Equivalent to an "upsert" operation + from database terminology. + This method can useful when seeding data using Migrations. + + The entities to add or update. + + When the parameter is a custom or fake IDbSet implementation, this method will + attempt to locate and invoke a public, instance method with the same signature as this extension method. + + + + + Adds or updates entities by a custom identification expression when SaveChanges is called. + Equivalent to an "upsert" operation from database terminology. + This method can useful when seeding data using Migrations. + + + An expression specifying the properties that should be used when determining + whether an Add or Update operation should be performed. + + The entities to add or update. + + When the parameter is a custom or fake IDbSet implementation, this method will + attempt to locate and invoke a public, instance method with the same signature as this extension method. + + + + + Generates C# code for a code-based migration. + + + + + Base class for providers that generate code for code-based migrations. + + + + + Generates the code that should be added to the users project. + + Unique identifier of the migration. + Operations to be performed by the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Gets the namespaces that must be output as "using" or "Imports" directives to handle + the code generated by the given operations. + + The operations for which code is going to be generated. + An ordered list of namespace names. + + + + Gets the default namespaces that must be output as "using" or "Imports" directives for + any code generated. + + A value indicating if this class is being generated for a code-behind file. + An ordered list of namespace names. + + + + + + + Generates the primary code file that the user can view and edit. + + Operations to be performed by the migration. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates the code behind file with migration metadata. + + Unique identifier of the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates a property to return the source or target model in the code behind file. + + Name of the property. + Value to be returned. + Text writer to add the generated code to. + + + + Generates a namespace, using statements and class definition. + + Namespace that code should be generated in. + Name of the class that should be generated. + Text writer to add the generated code to. + Base class for the generated class. + A value indicating if this class is being generated for a code-behind file. + Namespaces for which using directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used. + + + + Generates the closing code for a class that was started with WriteClassStart. + + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify a set of column names using a lambda expression. + + The columns to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify the definition for a . + + The column definition to generate code for. + Text writer to add the generated code to. + A value indicating whether to include the column name in the definition. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column of unknown data type. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Removes any invalid characters from the name of an database artifact. + + The name to be scrubbed. + The scrubbed name. + + + + Gets the type name to use for a column of the given data type. + + The data type to translate. + The type name to use in the generated migration. + + + + Quotes an identifier using appropriate escaping to allow it to be stored in a string. + + The identifier to be quoted. + The quoted identifier. + + + + Scaffolds code-based migrations to apply pending model changes to the database. + + + + + Initializes a new instance of the MigrationScaffolder class. + + Configuration to be used for scaffolding. + + + + Scaffolds a code based migration to apply any pending model changes to the database. + + The name to use for the scaffolded migration. + The scaffolded migration. + + + + Scaffolds a code based migration to apply any pending model changes to the database. + + The name to use for the scaffolded migration. + Whether or not to include model changes. + The scaffolded migration. + + + + Scaffolds the initial code-based migration corresponding to a previously run database initializer. + + The scaffolded migration. + + + + Gets or sets the namespace used in the migration's generated code. + + By default, this is the same as MigrationsNamespace on the migrations + configuration object passed into the constructor. For VB.NET projects, this + will need to be updated to take into account the project's root namespace. + + + + + Represents a code-based migration that has been scaffolded and is ready to be written to a file. + + + + + Gets or sets the unique identifier for this migration. + Typically used for the file name of the generated code. + + + + + Gets or sets the scaffolded migration code that the user can edit. + + + + + Gets or sets the scaffolded migration code that should be stored in a code behind file. + + + + + Gets or sets the programming language used for this migration. + Typically used for the file extension of the generated code. + + + + + Gets or sets the subdirectory in the user's project that this migration should be saved in. + + + + + Gets a dictionary of string resources to add to the migration resource file. + + + + + Represents an exception that occurred while running an operation in another AppDomain in the . + + + + + Initializes a new instance of the ToolingException class. + + Error that explains the reason for the exception. + The type of the exception that was thrown. + The stack trace of the exception that was thrown. + + + + + + + + + + Gets the type of the exception that was thrown. + + + + + Gets the stack trace of the exception that was thrown. + + + + + Helper class that is used by design time tools to run migrations related + commands that need to interact with an application that is being edited + in Visual Studio. + + Because the application is being edited the assemblies need to + be loaded in a separate AppDomain to ensure the latest version + is always loaded. + + The App/Web.config file from the startup project is also copied + to ensure that any configuration is applied. + + + + + Initializes a new instance of the ToolingFacade class. + + + The name of the assembly that contains the migrations configuration to be used. + + + The namespace qualified name of migrations configuration to be used. + + + The working directory containing the compiled assemblies. + + + The path of the config file from the startup project. + + + The path of the application data directory from the startup project. + Typically the App_Data directory for web applications or the working directory for executables. + + + The connection to the database to be migrated. + If null is supplied, the default connection for the context will be used. + + + + + Releases all unmanaged resources used by the facade. + + + + + Gets the fully qualified name of all types deriving from . + + All context types found. + + + + Gets the fully qualified name of a type deriving from . + + The name of the context type. If null, the single context type found in the assembly will be returned. + The context type found. + + + + Gets a list of all migrations that have been applied to the database. + + Ids of applied migrations. + + + + Gets a list of all migrations that have not been applied to the database. + + Ids of pending migrations. + + + + Updates the database to the specified migration. + + + The Id of the migration to migrate to. + If null is supplied, the database will be updated to the latest migration. + + Value indicating if data loss during automatic migration is acceptable. + + + + Generates a SQL script to migrate between two migrations. + + + The migration to update from. + If null is supplied, a script to update the current database will be produced. + + + The migration to update to. + If null is supplied, a script to update to the latest migration will be produced. + + Value indicating if data loss during automatic migration is acceptable. + The generated SQL script. + + + + Scaffolds a code-based migration to apply any pending model changes. + + The name for the generated migration. + The programming language of the generated migration. + The root namespace of the project the migration will be added to. + Whether or not to include model changes. + The scaffolded migration. + + + + Scaffolds the initial code-based migration corresponding to a previously run database initializer. + + The programming language of the generated migration. + The root namespace of the project the migration will be added to. + The scaffolded migration. + + + + + + + Releases all resources used by the facade. + + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + + Gets or sets an action to be run to log information. + + + + + Gets or sets an action to be run to log warnings. + + + + + Gets or sets an action to be run to log verbose information. + + + + + Base class for loggers that can be used for the migrations process. + + + + + Logs an informational message. + + The message to be logged. + + + + Logs a warning that the user should be made aware of. + + The message to be logged. + + + + Logs some additional information that should only be presented to the user if they request verbose output. + + The message to be logged. + + + + Generates VB.Net code for a code-based migration. + + + + + + + + Generates the primary code file that the user can view and edit. + + Operations to be performed by the migration. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates the code behind file with migration metadata. + + Unique identifier of the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates a property to return the source or target model in the code behind file. + + Name of the property. + Value to be returned. + Text writer to add the generated code to. + + + + Generates a namespace, using statements and class definition. + + Namespace that code should be generated in. + Name of the class that should be generated. + Text writer to add the generated code to. + Base class for the generated class. + A value indicating if this class is being generated for a code-behind file. + Namespaces for which Imports directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used. + + + + Generates the closing code for a class that was started with WriteClassStart. + + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify a set of column names using a lambda expression. + + The columns to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify the definition for a . + + The column definition to generate code for. + Text writer to add the generated code to. + A value indicating whether to include the column name in the definition. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column of unknown data type. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Removes any invalid characters from the name of an database artifact. + + The name to be scrubbed. + The scrubbed name. + + + + Gets the type name to use for a column of the given data type. + + The data type to translate. + The type name to use in the generated migration. + + + + Quotes an identifier using appropriate escaping to allow it to be stored in a string. + + The identifier to be quoted. + The quoted identifier. + + + + This class is used by Code First Migrations to read and write migration history + from the database. It is not intended to be used by other code and is only public + so that it can be accessed by EF when running under partial trust. It may be + changed or removed in the future. + + + + + Gets or sets the Id of the migration this row represents. + + + + + Gets or sets the date and time that this migrations history entry was created. + + + + + Gets or sets the state of the model after this migration was applied. + + + + + Gets or sets the version of Entity Framework that created this entry. + + + + + This is a version of the HistoryContext that still includes CreatedOn in its model. + It is used when figuring out whether or not the CreatedOn column exists and so should + be dropped. + + + + + Represents an error that occurs when an automatic migration would result in data loss. + + + + + Represents errors that occur inside the Code First Migrations pipeline. + + + + + Initializes a new instance of the MigrationsException class. + + + + + Initializes a new instance of the MigrationsException class. + + The message that describes the error. + + + + Initializes a new instance of the MigrationsException class. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the MigrationsException class with serialized data. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + + + Initializes a new instance of the AutomaticDataLossException class. + + The message that describes the error. + + + + Represents an error that occurs when there are pending model changes after applying the last migration and automatic migration is disabled. + + + + + Initializes a new instance of the AutomaticMigrationsDisabledException class. + + The message that describes the error. + + + + Provides additional metadata about a code-based migration. + + + + + Gets the unique identifier for the migration. + + + + + Gets the state of the model before this migration is run. + + + + + Gets the state of the model after this migration is run. + + + + + Decorator to provide logging during migrations operations.. + + + + + Initializes a new instance of the MigratorLoggingDecorator class. + + The migrator that this decorator is wrapping. + The logger to write messages to. + + + + Decorator to produce a SQL script instead of applying changes to the database. + Using this decorator to wrap will prevent + from applying any changes to the target database. + + + + + Initializes a new instance of the MigratorScriptingDecorator class. + + The migrator that this decorator is wrapping. + + + + + Represents a column being added to a table. + + + + + Represents an operation to modify a database schema. + + + + + Initializes a new instance of the MigrationOperation class. + + + + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets additional arguments that may be processed by providers. + + + + + Gets an operation that will revert this operation. + + + + + Gets a value indicating if this operation may result in data loss. + + + + + Initializes a new instance of the AddColumnOperation class. + + The name of the table the column should be added to. + Details of the column being added. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column should be added to. + + + + + Gets the details of the column being added. + + + + + Gets an operation that represents dropping the added column. + + + + + + + + Represents a foreign key constraint being added to a table. + + + + + Base class for changes that affect foreign key constraints. + + + + + Initializes a new instance of the ForeignKeyOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the name of the table that the foreign key constraint targets. + + + + + Gets or sets the name of the table that the foreign key columns exist in. + + + + + The names of the foreign key column(s). + + + + + Gets a value indicating if a specific name has been supplied for this foreign key constraint. + + + + + Gets or sets the name of this foreign key constraint. + If no name is supplied, a default name will be calculated. + + + + + Initializes a new instance of the AddForeignKeyOperation class. + The PrincipalTable, PrincipalColumns, DependentTable and DependentColumns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to create an index on the foreign key column(s). + + An operation to add the index. + + + + The names of the column(s) that the foreign key constraint should target. + + + + + Gets or sets a value indicating if cascade delete should be configured on the foreign key constraint. + + + + + Gets an operation to drop the foreign key constraint. + + + + + + + + Represents adding a primary key to a table. + + + + + Common base class to represent operations affecting primary keys. + + + + + Initializes a new instance of the PrimaryKeyOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the name of the table that contains the primary key. + + + + + Gets the column(s) that make up the primary key. + + + + + Gets a value indicating if a specific name has been supplied for this primary key. + + + + + Gets or sets the name of this primary key. + If no name is supplied, a default name will be calculated. + + + + + + + + Initializes a new instance of the AddPrimaryKeyOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to drop the primary key. + + + + + Represents altering an existing column. + + + + + Initializes a new instance of the AlterColumnOperation class. + + The name of the table that the column belongs to. + Details of what the column should be altered to. + Value indicating if this change will result in data loss. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the AlterColumnOperation class. + + The name of the table that the column belongs to. + Details of what the column should be altered to. + Value indicating if this change will result in data loss. + An operation to revert this alteration of the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table that the column belongs to. + + + + + Gets the new definition for the column. + + + + + Gets an operation that represents reverting the alteration. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents information about a column. + + + + + Initializes a new instance of the class. + + The data type for this column. + + + + Initializes a new instance of the class. + + The data type for this column. + + Additional details about the data type. + This includes details such as maximum length, nullability etc. + + + + + Determines if this column is a narrower data type than another column. + Used to determine if altering the supplied column definition to this definition will result in data loss. + + The column to compare to. + Details of the database provider being used. + True if this column is of a narrower data type. + + + + Gets the data type for this column. + + + + + Gets the CLR type corresponding to the database type of this column. + + + + + Gets the default value for the CLR type corresponding to the database type of this column. + + + + + Gets additional details about the data type of this column. + This includes details such as maximum length, nullability etc. + + + + + Gets or sets the name of the column. + + + + + Gets or sets a provider specific data type to use for this column. + + + + + Gets or sets a value indicating if this column can store null values. + + + + + Gets or sets a value indicating if values for this column will be generated by the database using the identity pattern. + + + + + Gets or sets the maximum length for this column. + Only valid for array data types. + + + + + Gets or sets the precision for this column. + Only valid for decimal data types. + + + + + Gets or sets the scale for this column. + Only valid for decimal data types. + + + + + Gets or sets a constant value to use as the default value for this column. + + + + + Gets or sets a SQL expression used as the default value for this column. + + + + + Gets or sets a value indicating if this column is fixed length. + Only valid for array data types. + + + + + Gets or sets a value indicating if this column supports Unicode characters. + Only valid for textual data types. + + + + + Gets or sets a value indicating if this column should be configured as a timestamp. + + + + + Represents creating a database index. + + + + + Common base class for operations affecting indexes. + + + + + Initializes a new instance of the IndexOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the table the index belongs to. + + + + + Gets or sets the columns that are indexed. + + + + + Gets a value indicating if a specific name has been supplied for this index. + + + + + Gets or sets the name of this index. + If no name is supplied, a default name will be calculated. + + + + + Initializes a new instance of the CreateIndexOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets a value indicating if this is a unique index. + + + + + Gets an operation to drop this index. + + + + + + + + Represents creating a table. + + + + + Initializes a new instance of the CreateTableOperation class. + + Name of the table to be created. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be created. + + + + + Gets the columns to be included in the new table. + + + + + Gets or sets the primary key for the new table. + + + + + Gets an operation to drop the table. + + + + + + + + Represents deleting a new record from the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Common base class for operations that affect the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Initializes a new instance of the HistoryOperation class. + + Name of the migrations history table. + Name of the migration being affected. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the migrations history table. + + + + + Gets the name of the migration being affected. + + + + + + + + Initializes a new instance of the DeleteHistoryOperation class. + + Name of the migrations history table. + Id of the migration record to be deleted. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Represents a column being dropped from a table. + + + + + Initializes a new instance of the DropColumnOperation class. + + The name of the table the column should be dropped from. + The name of the column to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropColumnOperation class. + + The name of the table the column should be dropped from. + The name of the column to be dropped. + The operation that represents reverting the drop operation. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column should be dropped from. + + + + + Gets the name of the column to be dropped. + + + + + Gets an operation that represents reverting dropping the column. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents a foreign key constraint being dropped from a table. + + + + + Initializes a new instance of the DropForeignKeyOperation class. + The PrincipalTable, DependentTable and DependentColumns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropForeignKeyOperation class. + + The operation that represents reverting dropping the foreign key constraint. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to drop the associated index on the foreign key column(s). + + An operation to drop the index. + + + + Gets an operation that represents reverting dropping the foreign key constraint. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents dropping an existing index. + + + + + Initializes a new instance of the DropIndexOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropIndexOperation class. + + The operation that represents reverting dropping the index. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation that represents reverting dropping the index. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents dropping a primary key from a table. + + + + + Initializes a new instance of the DropPrimaryKeyOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to add the primary key. + + + + + Represents dropping an existing table. + + + + + Initializes a new instance of the DropTableOperation class. + + The name of the table to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropTableOperation class. + + The name of the table to be dropped. + An operation that represents reverting dropping the table. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be dropped. + + + + + Gets an operation that represents reverting dropping the table. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents inserting a new record into the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Initializes a new instance of the InsertHistoryOperation class. + + Name of the migrations history table. + Id of the migration record to be inserted. + Value to be stored in the model column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the value to store in the history table representing the target model of the migration. + + + + + Gets the value to store in the history table indicating the version of Entity Framework used to produce this migration. + + + + + + + + Represents moving a table from one schema to another. + + + + + Initializes a new instance of the MoveTableOperation class. + + Name of the table to be moved. + Name of the schema to move the table to. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be moved. + + + + + Gets the name of the schema to move the table to. + + + + + Gets an operation that moves the table back to its original schema. + + + + + + + + Represents renaming an existing column. + + + + + Initializes a new instance of the RenameColumnOperation class. + + Name of the table the column belongs to. + Name of the column to be renamed. + New name for the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column belongs to. + + + + + Gets the name of the column to be renamed. + + + + + Gets the new name for the column. + + + + + Gets an operation that reverts the rename. + + + + + + + + Represents renaming an existing table. + + + + + Initializes a new instance of the RenameTableOperation class. + + Name of the table to be renamed. + New name for the table. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be renamed. + + + + + Gets the new name for the table. + + + + + Gets an operation that reverts the rename. + + + + + + + + Represents a provider specific SQL statement to be executed directly against the target database. + + + + + Initializes a new instance of the SqlOperation class. + + The SQL to be executed. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the SQL to be executed. + + + + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + + + + Common base class for providers that convert provider agnostic migration + operations into database provider specific SQL commands. + + + + + Converts a set of migration operations into database provider specific SQL. + + The operations to be converted. + Token representing the version of the database being targeted. + A list of SQL statements to be executed to perform the migration operations. + + + + Represents a migration operation that has been translated into a SQL statement. + + + + + Gets or sets the SQL to be executed to perform this migration operation. + + + + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + Provider to convert provider agnostic migration operations into SQL commands + that can be run against Microsoft SQL Server Compact Edition. + + + + + Provider to convert provider agnostic migration operations into SQL commands + that can be run against a Microsoft SQL Server database. + + + + + Converts a set of migration operations into Microsoft SQL Server specific SQL. + + The operations to be converted. + Token representing the version of SQL Server being targeted (i.e. "2005", "2008"). + A list of SQL statements to be executed to perform the migration operations. + + + + Creates an empty connection for the current provider. + Allows derived providers to use connection other than . + + + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL to mark a table as a system table. + Generated SQL should be added using the Statement method. + + The table to mark as a system table. + + + + Generates SQL to create a database schema. + Generated SQL should be added using the Statement method. + + The name of the schema to create. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL to specify a constant byte[] default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant bool default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant DateTime default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant DateTimeOffset default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant Guid default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant string default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant TimeSpan default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify the data type of a column. + This method just generates the actual type, not the SQL to create the column. + + The definition of the column. + SQL representing the data type. + + + + Generates a quoted name. The supplied name may or may not contain the schema. + + The name to be quoted. + The quoted name. + + + + Quotes an identifier for SQL Server. + + The identifier to be quoted. + The quoted identifier. + + + + Adds a new Statement to be executed against the database. + + The statement to be executed. + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + Gets a new that can be used to build SQL. + + This is just a helper method to create a writer. Writing to the writer will + not cause SQL to be registered for execution. You must pass the generated + SQL to the Statement method. + + An empty text writer to use for SQL generation. + + + + Adds a new Statement to be executed against the database. + + The writer containing the SQL to be executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Utility class to prep the user's config file to run in an AppDomain + + + + + Updates a config file by adding binding redirects for EntityFramework.dll. + This ensures that the user's code can be ran in an AppDomain and the exact + same version of the assembly will be used for both domains. + + That path of the user's config file. Can also be null or a path to an non-existent file. + The path of the updated config file. It is the caller's responsibility to delete this. + + + + The same as but works in partial trust. + + + + + Specifies the default tab string. This field is constant. + + + + + Initializes a new instance of the IndentedTextWriter class using the specified text writer and default tab string. + + The to use for output. + + + + Initializes a new instance of the IndentedTextWriter class using the specified text writer and tab string. + + The to use for output. + The tab string to use for indentation. + + + + Closes the document being written to. + + + + + Flushes the stream. + + + + + Outputs the tab string once for each level of indentation according to the property. + + + + + Writes the specified string to the text stream. + + The string to write. + + + + Writes the text representation of a Boolean value to the text stream. + + The Boolean value to write. + + + + Writes a character to the text stream. + + The character to write. + + + + Writes a character array to the text stream. + + The character array to write. + + + + Writes a subarray of characters to the text stream. + + The character array to write data from. + Starting index in the buffer. + The number of characters to write. + + + + Writes the text representation of a Double to the text stream. + + The double to write. + + + + Writes the text representation of a Single to the text stream. + + The single to write. + + + + Writes the text representation of an integer to the text stream. + + The integer to write. + + + + Writes the text representation of an 8-byte integer to the text stream. + + The 8-byte integer to write. + + + + Writes the text representation of an object to the text stream. + + The object to write. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string. + The object to write into the formatted string. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string to use. + The first object to write into the formatted string. + The second object to write into the formatted string. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string to use. + The argument array to output. + + + + Writes the specified string to a line without tabs. + + The string to write. + + + + Writes the specified string, followed by a line terminator, to the text stream. + + The string to write. + + + + Writes a line terminator. + + + + + Writes the text representation of a Boolean, followed by a line terminator, to the text stream. + + The Boolean to write. + + + + Writes a character, followed by a line terminator, to the text stream. + + The character to write. + + + + Writes a character array, followed by a line terminator, to the text stream. + + The character array to write. + + + + Writes a subarray of characters, followed by a line terminator, to the text stream. + + The character array to write data from. + Starting index in the buffer. + The number of characters to write. + + + + Writes the text representation of a Double, followed by a line terminator, to the text stream. + + The double to write. + + + + Writes the text representation of a Single, followed by a line terminator, to the text stream. + + The single to write. + + + + Writes the text representation of an integer, followed by a line terminator, to the text stream. + + The integer to write. + + + + Writes the text representation of an 8-byte integer, followed by a line terminator, to the text stream. + + The 8-byte integer to write. + + + + Writes the text representation of an object, followed by a line terminator, to the text stream. + + The object to write. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string. + The object to write into the formatted string. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string to use. + The first object to write into the formatted string. + The second object to write into the formatted string. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string to use. + The argument array to output. + + + + Writes the text representation of a UInt32, followed by a line terminator, to the text stream. + + A UInt32 to output. + + + + Gets the encoding for the text writer to use. + + + An that indicates the encoding for the text writer to use. + + + + + Gets or sets the new line character to use. + + + The new line character to use. + + + + + Gets or sets the number of spaces to indent. + + + The number of spaces to indent. + + + + + Gets the to use. + + + The to use. + + + + + Used for generating values that are always in sequential + order for the calling thread. + + + + + Returns the value of unless this value would be the same as the + last value returned by this thread calling this method, in which case the thread pushes the value + a little bit into the future. The comparison is in terms of the form used to store migration ID + in the database--i.e. to the 1/10 second. + + + There should never be any pushing to the future involved for normal use of migrations, but when + this method is called in rapid succession while testing or otherwise calling the DbMigrator APIs + there may be occasional sleeping. + + + + + Same as UtcNow method bur returns the time in the timestamp format used in migration IDs. + + + + + Convention to apply column ordering specified via + or the API. This convention throws if a duplicate configured column order + is detected. + + + + + Convention to apply column ordering specified via + or the API. + + + + + Identifies conventions that can be removed from a instance. + + /// + Note that implementations of this interface must be immutable. + + + + + Strongly-typed and parameterized string resources. + + + + + A string like "Applying automatic migration: {0}." + + + + + A string like "Reverting automatic migration: {0}." + + + + + A string like "Applying code-based migration: {0}." + + + + + A string like "Reverting code-based migration: {0}." + + + + + A string like "Applying code-based migrations: [{1}]." + + + + + A string like "Reverting migrations: [{1}]." + + + + + A string like "Target database is already at version {0}." + + + + + A string like "Target database is: {0}." + + + + + A string like "'{1}' (DataSource: {0}, Provider: {2}, Origin: {3})" + + + + + A string like "The specified target migration '{0}' does not exist. Ensure that target migration refers to an existing migration id." + + + + + A string like "The Foreign Key on table '{0}' with columns '{1}' could not be created because the principal key columns could not be determined. Use the AddForeignKey fluent API to fully specify the Foreign Key." + + + + + A string like "'{0}' is not a valid target migration. When targeting a previously applied automatic migration, use the full migration id including timestamp." + + + + + A string like "'{0}' is not a valid migration. Code-based migrations must be used for both source and target when scripting the upgrade between them." + + + + + A string like "The target context '{0}' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory." + + + + + A string like "The specified migration name '{0}' is ambiguous. Specify the full migration id including timestamp instead." + + + + + A string like "The migrations configuration type '{0}' was not be found in the assembly '{1}'." + + + + + A string like "More than one migrations configuration type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the one to use." + + + + + A string like "No migrations configuration type was found in the assembly '{0}'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)." + + + + + A string like "More than one migrations configuration type was found in the assembly '{0}'. Specify the name of the one to use." + + + + + A string like "The type '{0}' is not a migrations configuration type." + + + + + A string like "The migrations configuration type '{0}' must have a public default constructor." + + + + + A string like "The migrations configuration type '{0}' must not be abstract." + + + + + A string like "The migrations configuration type '{0}' must not be generic." + + + + + A string like "In VB.NET projects, the migrations namespace '{0}' must be under the root namespace '{1}'. Update the migrations project's root namespace to allow classes under the migrations namespace to be added." + + + + + + A string like "No MigrationSqlGenerator found for provider '{0}'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators." + + + + + A string like "Could not load assembly '{0}'. (If you are using Code First Migrations inside Visual Studio this can happen if the startUp project for your solution does not reference the project that contains your migrations. You can either change the startUp project for your solution or use the -StartUpProjectName parameter.)" + + + + + A string like "No context type was found in the assembly '{0}'." + + + + + A string like "More than one context type was found in the assembly '{0}'." + + + + + A string like "To enable migrations for {0}, use Enable-Migrations -ContextTypeName {0}." + + + + + A string like "The context type '{0}' was not found in the assembly '{1}'." + + + + + A string like "More than one context type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the context." + + + + + A string like "The argument '{0}' cannot be null, empty or contain only white space." + + + + + A string like "The argument property '{0}' cannot be null." + + + + + A string like "The precondition '{0}' failed. {1}" + + + + + A string like "The type '{0}' has already been configured as a complex type. It cannot be reconfigured as an entity type." + + + + + A string like "The type '{0}' has already been configured as an entity type. It cannot be reconfigured as a complex type." + + + + + A string like "The key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + A string like "The foreign key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + A string like "The property '{0}' is not a declared property on type '{1}'. Verify that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property." + + + + + A string like "The navigation property '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property." + + + + + A string like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'." + + + + + A string like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. Use dotted paths for nested properties: C#: 't => t.MyProperty.MyProperty' VB.Net: 'Function(t) t.MyProperty.MyProperty'." + + + + + A string like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + A string like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + + A string like "Conflicting configuration settings were specified for property '{0}' on type '{1}': {2}" + + + + + A string like "Conflicting configuration settings were specified for column '{0}' on table '{1}': {2}" + + + + + A string like "{0} = {1} conflicts with {2} = {3}" + + + + + A string like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from ComplexObject." + + + + + A string like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject." + + + + + A string like "The navigation property '{0}' declared on type '{1}' cannot be the inverse of itself." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting foreign keys." + + + + + A string like "Values of incompatible types ('{1}' and '{2}') were assigned to the '{0}' discriminator column. Values of the same type must be specified. To explicitly specify the type of the discriminator column use the HasColumnType method." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting mapping information." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting cascade delete operations using 'WillCascadeOnDelete'." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting multiplicities." + + + + + A string like "The MaxLengthAttribute on property '{0}' on type '{1} is not valid. The Length value must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "The StringLengthAttribute on property '{0}' on type '{1}' is not valid. The maximum length must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "Unable to determine composite primary key ordering for type '{0}'. Use the ColumnAttribute or the HasKey method to specify an order for composite primary keys." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. Name must not be empty." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The foreign key name '{2}' was not found on the dependent type '{3}'. The Name value should be a comma separated list of foreign key property names." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The navigation property '{2}' was not found on the dependent type '{1}'. The Name value should be a valid navigation property name." + + + + + A string like "Unable to determine a composite foreign key ordering for foreign key on type {0}. When using the ForeignKey data annotation on composite foreign key properties ensure order is specified by using the Column data annotation or the fluent API." + + + + + A string like "The InversePropertyAttribute on property '{2}' on type '{3}' is not valid. The property '{0}' is not a valid navigation property on the related type '{1}'. Ensure that the property exists and is a valid reference or collection navigation property." + + + + + A string like "A relationship cannot be established from property '{0}' on type '{1}' to property '{0}' on type '{1}'. Check the values in the InversePropertyAttribute to ensure relationship definitions are unique and reference from one navigation property to its corresponding inverse navigation property." + + + + + A string like "\t{0}: {1}: {2}" + + + + + A string like "A key is registered for the derived type '{0}'. Keys can only be registered for the root type '{1}'." + + + + + A string like "The {0} value '{1}' already exists in the user-defined dictionary." + + + + + A string like "The type '{0}' has already been mapped to table '{1}'. Specify all mapping aspects of a table in a single Map call." + + + + + A string like "Map was called more than once for type '{0}' and at least one of the calls didn't specify the target table name." + + + + + A string like "The derived type '{0}' has already been mapped using the chaining syntax. A derived type can only be mapped once using the chaining syntax." + + + + + A string like "An "is not null" condition cannot be specified on property '{0}' on type '{1}' because this property is not included in the model. Check that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation." + + + + + A string like "Values of type '{0}' cannot be used as type discriminator values. Supported types include byte, signed byte, bool, int16, int32, int64, and string." + + + + + A string like "Unable to add the convention '{0}'. Could not find an existing convention of type '{1}' in the current convention set." + + + + + A string like "Not all properties for type '{0}' have been mapped. Either map those properties or explicitly excluded them from the model." + + + + + A string like "Unable to determine the provider name for connection of type '{0}'." + + + + + A string like "The qualified table name '{0}' contains an invalid schema name. Schema names must have a non-zero length." + + + + + A string like "The qualified table name '{0}' contains an invalid table name. Table names must have a non-zero length." + + + + + A string like "Properties for type '{0}' can only be mapped once. Ensure the MapInheritedProperties method is only used during one call to the Map method." + + + + + A string like "Properties for type '{0}' can only be mapped once. Ensure the Properties method is used and that repeated calls specify each non-key property only once." + + + + + A string like "Properties for type '{0}' can only be mapped once. The non-key property '{1}' is mapped more than once. Ensure the Properties method specifies each non-key property only once." + + + + + A string like "The property '{1}' on type '{0}' cannot be mapped because it has been explicitly excluded from the model or it is of a type not supported by the DbModelBuilderVersion being used." + + + + + A string like "The entity types '{0}' and '{1}' cannot share table '{2}' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them." + + + + + A string like "You cannot use Ignore method on the property '{0}' on type '{1}' because this type inherits from the type '{2}' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type." + + + + + A string like "The property '{0}' cannot be used as a key property on the entity '{1}' because the property type is not a valid key type. Only scalar types, string and byte[] are supported key types." + + + + + A string like "The specified table '{0}' was not found in the model. Ensure that the table name has been correctly specified." + + + + + A string like "The specified association foreign key columns '{0}' are invalid. The number of columns specified must match the number of primary key columns." + + + + + A string like "Unable to determine the principal end of an association between the types '{0}' and '{1}'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." + + + + + A string like "The abstract type '{0}' has no mapped descendents and so cannot be mapped. Either remove '{0}' from the model or add one or more types deriving from '{0}' to the model. " + + + + + A string like "The type '{0}' cannot be mapped as defined because it maps inherited properties from types that use entity splitting or another form of inheritance. Either choose a different inheritance mapping strategy so as to not map inherited properties, or change all types in the hierarchy to map inherited properties and to not use splitting. " + + + + + A string like "The table '{0}' was configured but is not used in any mappings. Verify the mapping configuration for '{0}' is correct." + + + + + A string like "The configured column orders for the table '{0}' contains duplicates. Ensure the specified column order values are distinct." + + + + + A string like "The enum or spatial property '{1}' on type '{0}' cannot be mapped. Use DbModelBuilderVersion 'V5_0' or later to map enum or spatial properties." + + + + + A string like "Multiple potential primary key properties named '{0}' but differing only by case were found on entity type '{1}'. Configure the primary key explicitly using the HasKey fluent API or the KeyAttribute data annotation." + + + + + A string like "Cannot get value for property '{0}' from entity of type '{1}' because the property has no get accessor." + + + + + A string like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor." + + + + + + A string like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor and is in the '{2}' state." + + + + + A string like "Member '{0}' cannot be called for property '{1}' on entity of type '{2}' because the property is not part of the Entity Data Model." + + + + + + A string like "Cannot call the {0} method for an entity of type '{1}' on a DbSet for entities of type '{2}'. Only entities of type '{2}' or derived from type '{2}' can be added, attached, or removed." + + + + + A string like "Cannot call the Create method for the type '{0}' on a DbSet for entities of type '{1}'. Only entities of type '{1}' or derived from type '{1}' can be created." + + + + + + + A string like "The property '{0}' on type '{1}' is a collection navigation property. The Collection method should be used instead of the Reference method." + + + + + A string like "The property '{0}' on type '{1}' is a reference navigation property. The Reference method should be used instead of the Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a navigation property. The Reference and Collection methods can only be used with navigation properties. Use the Property or ComplexProperty method." + + + + + A string like "The property '{0}' on type '{1}' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a complex property. The ComplexProperty method can only be used with complex properties. Use the Property, Reference or Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a primitive property, complex property, collection navigation property, or reference navigation property." + + + + + A string like ""The property '{0}' from the property path '{1}' is not a complex property on type '{2}'. Property paths must be composed of complex properties for all except the final property."" + + + + + A string like ""The property path '{0}' cannot be used for navigation properties. Property paths can only be used to access primitive or complex properties."" + + + + + A string like "The navigation property '{0}' on entity type '{1}' cannot be used for entities of type '{2}' because it refers to entities of type '{3}'." + + + + + A string like "The generic type argument '{0}' cannot be used with the Member method when accessing the collection navigation property '{1}' on entity type '{2}'. The generic type argument '{3}' must be used instead." + + + + + A string like "The property '{0}' on entity type '{1}' cannot be used for objects of type '{2}' because it is a property for objects of type '{3}'." + + + + + A string like "The expression passed to method {0} must represent a property defined on the type '{1}'." + + + + + A string like "{0} cannot be used for entities in the {1} state." + + + + + A string like "Cannot set non-nullable property '{0}' of type '{1}' to null on object of type '{2}'." + + + + + A string like "The property '{0}' in the entity of type '{1}' is null. Store values cannot be obtained for an entity with a null complex property." + + + + + A string like "Cannot assign value of type '{0}' to property '{1}' of type '{2}' in property values for type '{3}'." + + + + + A string like "The '{0}' property does not exist or is not mapped for the type '{1}'." + + + + + A string like "Cannot copy values from DbPropertyValues for type '{0}' into DbPropertyValues for type '{1}'." + + + + + A string like "Cannot copy from property values for object of type '{0}' into property values for object of type '{1}'." + + + + + A string like "The value of the complex property '{0}' on entity of type '{1}' is null. Complex properties cannot be set to null and values cannot be set for null complex properties." + + + + + A string like "The value of the nested property values property '{0}' on the values for entity of type '{1}' is null. Nested property values cannot be set to null and values cannot be set for null complex properties." + + + + + A string like "Cannot set the value of the nested property '{0}' because value of the complex property '{1}' to which it belongs is null." + + + + + A string like "Cannot set the original value of the nested property '{0}' because the original value of the complex property '{1}' to which it belongs is null." + + + + + A string like "The model backing the '{0}' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)." + + + + + A string like "Database '{0}' cannot be created because it already exists." + + + + + + + A string like "Failed to set database initializer of type '{0}' for DbContext type '{1}' specified in the application configuration. See inner exception for details." + + + + + A string like "Configuration for DbContext type '{0}' is specified multiple times in the application configuration. Each context can only be configured once." + + + + + A string like "Failed to set Database.DefaultConnectionFactory to an instance of the '{0}' type as specified in the application configuration. See inner exception for details." + + + + + A string like "The type '{0}' could not be found. The type name must be an assembly-qualified name." + + + + + A string like "The connection string '{0}' in the application's configuration file does not contain the required providerName attribute."" + + + + + A string like "The entity found was of type {0} when an entity of type {1} was requested." + + + + + A string like "The type '{0}' is mapped as a complex type. The Set method, DbSet objects, and DbEntityEntry objects can only be used with entity types, not complex types." + + + + + A string like "The type '{0}' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute." + + + + + A string like "The entity type {0} is not part of the model for the current context." + + + + + A string like "No connection string named '{0}' could be found in the application config file." + + + + + A string like "The collection navigation property '{0}' on the entity of type '{1}' cannot be set because the entity type does not define a navigation property with a set accessor." + + + + + A string like "Multiple object sets per type are not supported. The object sets '{0}' and '{1}' can both contain instances of type '{2}'." + + + + + A string like "The context type '{0}' must have a public constructor taking an EntityConnection." + + + + + A string like "An unexpected exception was thrown during validation of '{0}' when invoking {1}.IsValid. See the inner exception for details." + + + + + A string like "An unexpected exception was thrown during validation of '{0}' when invoking {1}.Validate. See the inner exception for details." + + + + + A string like "The database name '{0}' is not supported because it is an MDF file name. A full connection string must be provided to attach an MDF file." + + + + + A string like "The context factory type '{0}' must have a public default constructor." + + + + + A string like "The '{0}' property of EdmPrimitiveType is fixed and cannot be set." + + + + + A string like "The namespace '{0}' is a system namespace and cannot be used by other schemas. Choose another namespace name." + + + + + A string like "Role '{0}' in AssociationSets '{1}' and '{2}' refers to the same EntitySet '{3}' in EntityContainer '{4}'. Make sure that if two or more AssociationSets refer to the same AssociationType, the ends do not refer to the same EntitySet." + + + + + A string like "The referenced EntitySet '{0}' for End '{1}' could not be found in the containing EntityContainer." + + + + + A string like "Type '{0}' is derived from type '{1}' that is the type for EntitySet '{2}'. Type '{0}' defines new concurrency requirements that are not allowed for subtypes of base EntitySet types." + + + + + A string like "EntitySet '{0}' is based on type '{1}' that has no keys defined." + + + + + A string like "The end name '{0}' is already defined." + + + + + A string like "The key specified in EntityType '{0}' is not valid. Property '{1}' is referenced more than once in the Key element." + + + + + A string like "Property '{0}' has a CollectionKind specified but is not a collection property." + + + + + A string like "Property '{0}' has a CollectionKind specified. CollectionKind is only supported in version 1.1 EDM models." + + + + + A string like "ComplexType '{0}' is marked as abstract. Abstract ComplexTypes are only supported in version 1.1 EDM models." + + + + + A string like "ComplexType '{0}' has a BaseType specified. ComplexType inheritance is only supported in version 1.1 EDM models." + + + + + A string like "Key part '{0}' for type '{1}' is not valid. All parts of the key must be non-nullable." + + + + + A string like "The property '{0}' in EntityType '{1}' is not valid. All properties that are part of the EntityKey must be of PrimitiveType." + + + + + A string like "Key usage is not valid. The {0} class cannot define keys because one of its base classes ('{1}') defines keys." + + + + + A string like "EntityType '{0}' has no key defined. Define the key for this EntityType." + + + + + A string like "NavigationProperty is not valid. Role '{0}' or Role '{1}' is not defined in Relationship '{2}'." + + + + + A string like "End '{0}' on relationship '{1}' cannot have an operation specified because its multiplicity is '*'. Operations cannot be specified on ends with multiplicity '*'." + + + + + A string like "Each Name and PluralName in a relationship must be unique. '{0}' is already defined." + + + + + A string like "In relationship '{0}', the Principal and Dependent Role of the referential constraint refer to the same Role in the relationship type." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Valid values for multiplicity for the Principal Role are '0..1' or '1'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because all the properties in the Dependent Role are nullable, multiplicity of the Principal Role must be '0..1'." + + + + + A string like "Multiplicity conflicts with the referential constraint in Role '{0}' in relationship '{1}'. Because at least one of the properties in the Dependent Role is non-nullable, multiplicity of the Principal Role must be '1'." + + + + + A string like "Multiplicity conflicts with the referential constraint in Role '{0}' in relationship '{1}'. Because all of the properties in the Dependent Role are non-nullable, multiplicity of the Principal Role must be '1'." + + + + + A string like "Properties referred by the Dependent Role '{0}' must be a subset of the key of the EntityType '{1}' referred to by the Dependent Role in the referential constraint for relationship '{2}'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because the Dependent Role refers to the key properties, the upper bound of the multiplicity of the Dependent Role must be '1'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because the Dependent Role properties are not the key properties, the upper bound of the multiplicity of the Dependent Role must be '*'." + + + + + A string like "The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property '{0}' on entity '{1}' does not match the type of property '{2}' on entity '{3}' in the referential constraint '{4}'." + + + + + A string like "There is no property with name '{0}' defined in the type referred to by Role '{1}'." + + + + + A string like "A nullable ComplexType is not supported. Property '{0}' must not allow nulls." + + + + + A string like "A property cannot be of type '{0}'. The property type must be a ComplexType or a PrimitiveType." + + + + + A string like "Each member name in an EntityContainer must be unique. A member with name '{0}' is already defined." + + + + + A string like "Each type name in a schema must be unique. Type name '{0}' is already defined." + + + + + A string like "Name '{0}' cannot be used in type '{1}'. Member names cannot be the same as their enclosing type." + + + + + A string like "Each property name in a type must be unique. Property name '{0}' is already defined." + + + + + A string like "A cycle was detected in the type hierarchy of '{0}'." + + + + + A string like "A property cannot be of type '{0}'. The property type must be a ComplexType, a PrimitiveType, or a CollectionType." + + + + + A string like "A property cannot be of type {0}. The property type must be a ComplexType, a PrimitiveType or an EnumType." + + + + + A string like "The specified name must not be longer than 480 characters: '{0}'." + + + + + A string like "The specified name is not allowed: '{0}'." + + + + + A string like "The field {0} must be a string or array type with a maximum length of '{1}'." + + + + + A string like "The field {0} must be a string or array type with a minimum length of '{1}'." + + + + + A string like "No connection string named '{0}' could be found in the application config file." + + + + + A string like "AutomaticMigration" + + + + + A string like "BootstrapMigration" + + + + + A string like "InitialCreate" + + + + + A string like "Automatic migration was not applied because it would result in data loss." + + + + + A string like "[Inserting migration history record]" + + + + + A string like "[Deleting migration history record]" + + + + + A string like "[Updating EdmMetadata model hash]" + + + + + A string like "Running Seed method." + + + + + A string like "No pending code-based migrations." + + + + + A string like "Explicit" + + + + + A string like "Upgrading history table." + + + + + A string like "Cannot scaffold the next migration because the target database was created with a version of Code First earlier than EF 4.3 and does not contain the migrations history table. To start using migrations against this database, ensure the current model is compatible with the target database and execute the migrations Update process. (In Visual Studio you can use the Update-Database command from Package Manager Console to execute the migrations Update process)." + + + + + A string like "Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration." + + + + + A string like "Scripting the downgrade between two specified migrations is not supported." + + + + + A string like "Direct column renaming is not supported by SQL Server Compact. To rename a column in SQL Server Compact, you will need to recreate it." + + + + + A string like "One or more validation errors were detected during model generation:" + + + + + A string like "A circular ComplexType hierarchy was detected. Self-referencing ComplexTypes are not supported." + + + + + A string like "Connection to the database failed. The connection string is configured with an invalid LocalDB server name. This may have been set in 'global.asax' by a pre-release version of MVC4. The default connection factory is now set in web.config so the line in 'global.asax' starting with 'Database.DefaultConnectionFactory = ' should be removed. See http://go.microsoft.com/fwlink/?LinkId=243166 for details." + + + + + A string like "An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct." + + + + + A string like "Setting IsModified to false for a modified property is not supported." + + + + + A string like "An error occurred while saving entities that do not expose foreign key properties for their relationships. The EntityEntries property will return null because a single entity cannot be identified as the source of the exception. Handling of exceptions while saving can be made easier by exposing foreign key properties in your entity types. See the InnerException for details." + + + + + A string like "The set of property value names is read-only." + + + + + A string like "A property of a complex type must be set to an instance of the generic or non-generic DbPropertyValues class for that type." + + + + + A string like "Model compatibility cannot be checked because the DbContext instance was not created using Code First patterns. DbContext instances created from an ObjectContext or using an EDMX file cannot be checked for compatibility." + + + + + A string like "Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions." + + + + + A string like "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations." + + + + + A string like "The context cannot be used while the model is being created." + + + + + A string like "The DbContext class cannot be used with models that have multiple entity sets per type (MEST)." + + + + + A string like "The operation cannot be completed because the DbContext has been disposed." + + + + + A string like "The provider factory returned a null connection." + + + + + A string like "The DbConnectionFactory instance returned a null connection." + + + + + A string like "The number of primary key values passed must match number of primary key values defined on the entity." + + + + + A string like "The type of one of the primary key values did not match the type defined in the entity. See inner exception for details." + + + + + A string like "Multiple entities were found in the Added state that match the given primary key values." + + + + + A string like "Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList()." + + + + + A string like "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties." + + + + + A string like "Cannot initialize a DbContext from an entity connection string or an EntityConnection instance together with a DbCompiledModel. If an entity connection string or EntityConnection instance is used, then the model will be created from the metadata in the connection. If a DbCompiledModel is used, then the connection supplied should be a standard database connection (for example, a SqlConnection instance) rather than an entity connection." + + + + + A string like "Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used." + + + + + A string like "Validation failed for one or more entities. See 'EntityValidationErrors' property for more details." + + + + + A string like "An exception occurred while initializing the database. See the InnerException for details." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing ObjectContext is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing DbCompiledModel is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Code generated using the T4 templates for Database First and Model First development may not work correctly if used in Code First mode. To continue using Database First or Model First ensure that the Entity Framework connection string is specified in the config file of executing application. To use these classes, that were generated from Database First or Model First, with Code First add any additional configuration using attributes or the DbModelBuilder API and then remove the code that throws this exception." + + + + + A string like "The generic 'Set' method cannot be called with a proxy type. Either use the actual entity type or call the non-generic 'Set' method." + + + + + A string like "NavigationProperty is not valid. The FromRole and ToRole are the same." + + + + + A string like "OnDelete can be specified on only one End of an EdmAssociation." + + + + + A string like "The number of properties in the Dependent and Principal Roles in a relationship constraint must be identical." + + + + + A string like "The name is missing or not valid." + + + + + A string like "AssociationEnd must not be null." + + + + + A string like "DependentEnd must not be null." + + + + + A string like "DependentProperties must not be empty." + + + + + A string like "Association must not be null." + + + + + A string like "ResultEnd must not be null." + + + + + A string like "EntityType must not be null." + + + + + A string like "ElementType must not be null." + + + + + A string like "ElementType must not be null." + + + + + A string like "SourceSet must not be null." + + + + + A string like "TargetSet must not be null." + + + + + A string like "The type is not a valid EdmTypeReference." + + + + + A string like "Serializer can only serialize an EdmModel that has one EdmNamespace and one EdmEntityContainer." + + + + + A string like "MaxLengthAttribute must have a Length value that is greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "MinLengthAttribute must have a Length value that is zero or greater." + + + + + A string like "The connection can not be overridden because this context was created from an existing ObjectContext." + + + + + A string like "Can not override the connection for this context with a standard DbConnection because the original connection was an EntityConnection." + + + + + A string like "Can not override the connection for this context with an EntityConnection because the original connection was a standard DbConnection." + + + + + Strongly-typed and parameterized exception factory. + + + + + Migrations.Infrastructure.AutomaticDataLossException with message like "Automatic migration was not applied because it would result in data loss." + + + + + Migrations.Infrastructure.MigrationsException with message like "Cannot scaffold the next migration because the target database was created with a version of Code First earlier than EF 4.3 and does not contain the migrations history table. To start using migrations against this database, ensure the current model is compatible with the target database and execute the migrations Update process. (In Visual Studio you can use the Update-Database command from Package Manager Console to execute the migrations Update process)." + + + + + Migrations.Infrastructure.MigrationsException with message like "The specified target migration '{0}' does not exist. Ensure that target migration refers to an existing migration id." + + + + + Migrations.Infrastructure.MigrationsException with message like "The Foreign Key on table '{0}' with columns '{1}' could not be created because the principal key columns could not be determined. Use the AddForeignKey fluent API to fully specify the Foreign Key." + + + + + Migrations.Infrastructure.MigrationsException with message like "'{0}' is not a valid target migration. When targeting a previously applied automatic migration, use the full migration id including timestamp." + + + + + Migrations.Infrastructure.MigrationsException with message like "'{0}' is not a valid migration. Code-based migrations must be used for both source and target when scripting the upgrade between them." + + + + + Migrations.Infrastructure.MigrationsException with message like "The target context '{0}' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory." + + + + + Migrations.Infrastructure.MigrationsException with message like "The specified migration name '{0}' is ambiguous. Specify the full migration id including timestamp instead." + + + + + Migrations.Infrastructure.AutomaticMigrationsDisabledException with message like "Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration." + + + + + Migrations.Infrastructure.MigrationsException with message like "Scripting the downgrade between two specified migrations is not supported." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' was not be found in the assembly '{1}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one migrations configuration type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the one to use." + + + + + Migrations.Infrastructure.MigrationsException with message like "No migrations configuration type was found in the assembly '{0}'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one migrations configuration type was found in the assembly '{0}'. Specify the name of the one to use." + + + + + Migrations.Infrastructure.MigrationsException with message like "The type '{0}' is not a migrations configuration type." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must have a public default constructor." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must not be abstract." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must not be generic." + + + + + Migrations.Infrastructure.MigrationsException with message like "Direct column renaming is not supported by SQL Server Compact. To rename a column in SQL Server Compact, you will need to recreate it." + + + + + Migrations.Infrastructure.MigrationsException with message like "In VB.NET projects, the migrations namespace '{0}' must be under the root namespace '{1}'. Update the migrations project's root namespace to allow classes under the migrations namespace to be added." + + + + + + Migrations.Infrastructure.MigrationsException with message like "No MigrationSqlGenerator found for provider '{0}'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators." + + + + + Migrations.Infrastructure.MigrationsException with message like "No context type was found in the assembly '{0}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "The context type '{0}' was not found in the assembly '{1}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one context type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the context." + + + + + ArgumentException with message like "The argument '{0}' cannot be null, empty or contain only white space." + + + + + ArgumentException with message like "The argument property '{0}' cannot be null." + + + + + ArgumentException with message like "The precondition '{0}' failed. {1}" + + + + + InvalidOperationException with message like "The type '{0}' has already been configured as a complex type. It cannot be reconfigured as an entity type." + + + + + InvalidOperationException with message like "The type '{0}' has already been configured as an entity type. It cannot be reconfigured as a complex type." + + + + + InvalidOperationException with message like "The key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + InvalidOperationException with message like "The foreign key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + InvalidOperationException with message like "The property '{0}' is not a declared property on type '{1}'. Verify that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property." + + + + + InvalidOperationException with message like "The navigation property '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property." + + + + + InvalidOperationException with message like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'." + + + + + InvalidOperationException with message like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. Use dotted paths for nested properties: C#: 't => t.MyProperty.MyProperty' VB.Net: 'Function(t) t.MyProperty.MyProperty'." + + + + + InvalidOperationException with message like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + InvalidOperationException with message like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + + InvalidOperationException with message like "Conflicting configuration settings were specified for property '{0}' on type '{1}': {2}" + + + + + InvalidOperationException with message like "Conflicting configuration settings were specified for column '{0}' on table '{1}': {2}" + + + + + InvalidOperationException with message like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from ComplexObject." + + + + + InvalidOperationException with message like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' cannot be the inverse of itself." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting foreign keys." + + + + + MappingException with message like "Values of incompatible types ('{1}' and '{2}') were assigned to the '{0}' discriminator column. Values of the same type must be specified. To explicitly specify the type of the discriminator column use the HasColumnType method." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting mapping information." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting cascade delete operations using 'WillCascadeOnDelete'." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting multiplicities." + + + + + InvalidOperationException with message like "The MaxLengthAttribute on property '{0}' on type '{1} is not valid. The Length value must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "The StringLengthAttribute on property '{0}' on type '{1}' is not valid. The maximum length must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "Unable to determine composite primary key ordering for type '{0}'. Use the ColumnAttribute or the HasKey method to specify an order for composite primary keys." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. Name must not be empty." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The foreign key name '{2}' was not found on the dependent type '{3}'. The Name value should be a comma separated list of foreign key property names." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The navigation property '{2}' was not found on the dependent type '{1}'. The Name value should be a valid navigation property name." + + + + + InvalidOperationException with message like "Unable to determine a composite foreign key ordering for foreign key on type {0}. When using the ForeignKey data annotation on composite foreign key properties ensure order is specified by using the Column data annotation or the fluent API." + + + + + InvalidOperationException with message like "The InversePropertyAttribute on property '{2}' on type '{3}' is not valid. The property '{0}' is not a valid navigation property on the related type '{1}'. Ensure that the property exists and is a valid reference or collection navigation property." + + + + + InvalidOperationException with message like "A relationship cannot be established from property '{0}' on type '{1}' to property '{0}' on type '{1}'. Check the values in the InversePropertyAttribute to ensure relationship definitions are unique and reference from one navigation property to its corresponding inverse navigation property." + + + + + InvalidOperationException with message like "A key is registered for the derived type '{0}'. Keys can only be registered for the root type '{1}'." + + + + + InvalidOperationException with message like "The type '{0}' has already been mapped to table '{1}'. Specify all mapping aspects of a table in a single Map call." + + + + + InvalidOperationException with message like "Map was called more than once for type '{0}' and at least one of the calls didn't specify the target table name." + + + + + InvalidOperationException with message like "The derived type '{0}' has already been mapped using the chaining syntax. A derived type can only be mapped once using the chaining syntax." + + + + + InvalidOperationException with message like "An "is not null" condition cannot be specified on property '{0}' on type '{1}' because this property is not included in the model. Check that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation." + + + + + ArgumentException with message like "Values of type '{0}' cannot be used as type discriminator values. Supported types include byte, signed byte, bool, int16, int32, int64, and string." + + + + + InvalidOperationException with message like "Unable to add the convention '{0}'. Could not find an existing convention of type '{1}' in the current convention set." + + + + + InvalidOperationException with message like "Not all properties for type '{0}' have been mapped. Either map those properties or explicitly excluded them from the model." + + + + + NotSupportedException with message like "Unable to determine the provider name for connection of type '{0}'." + + + + + ArgumentException with message like "The qualified table name '{0}' contains an invalid schema name. Schema names must have a non-zero length." + + + + + ArgumentException with message like "The qualified table name '{0}' contains an invalid table name. Table names must have a non-zero length." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. Ensure the MapInheritedProperties method is only used during one call to the Map method." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. Ensure the Properties method is used and that repeated calls specify each non-key property only once." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. The non-key property '{1}' is mapped more than once. Ensure the Properties method specifies each non-key property only once." + + + + + InvalidOperationException with message like "The property '{1}' on type '{0}' cannot be mapped because it has been explicitly excluded from the model or it is of a type not supported by the DbModelBuilderVersion being used." + + + + + InvalidOperationException with message like "The entity types '{0}' and '{1}' cannot share table '{2}' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them." + + + + + InvalidOperationException with message like "You cannot use Ignore method on the property '{0}' on type '{1}' because this type inherits from the type '{2}' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type." + + + + + InvalidOperationException with message like "The property '{0}' cannot be used as a key property on the entity '{1}' because the property type is not a valid key type. Only scalar types, string and byte[] are supported key types." + + + + + InvalidOperationException with message like "The specified table '{0}' was not found in the model. Ensure that the table name has been correctly specified." + + + + + InvalidOperationException with message like "The specified association foreign key columns '{0}' are invalid. The number of columns specified must match the number of primary key columns." + + + + + InvalidOperationException with message like "A circular ComplexType hierarchy was detected. Self-referencing ComplexTypes are not supported." + + + + + InvalidOperationException with message like "Unable to determine the principal end of an association between the types '{0}' and '{1}'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." + + + + + InvalidOperationException with message like "The abstract type '{0}' has no mapped descendents and so cannot be mapped. Either remove '{0}' from the model or add one or more types deriving from '{0}' to the model. " + + + + + NotSupportedException with message like "The type '{0}' cannot be mapped as defined because it maps inherited properties from types that use entity splitting or another form of inheritance. Either choose a different inheritance mapping strategy so as to not map inherited properties, or change all types in the hierarchy to map inherited properties and to not use splitting. " + + + + + InvalidOperationException with message like "The table '{0}' was configured but is not used in any mappings. Verify the mapping configuration for '{0}' is correct." + + + + + InvalidOperationException with message like "The configured column orders for the table '{0}' contains duplicates. Ensure the specified column order values are distinct." + + + + + NotSupportedException with message like "The enum or spatial property '{1}' on type '{0}' cannot be mapped. Use DbModelBuilderVersion 'V5_0' or later to map enum or spatial properties." + + + + + InvalidOperationException with message like "Multiple potential primary key properties named '{0}' but differing only by case were found on entity type '{1}'. Configure the primary key explicitly using the HasKey fluent API or the KeyAttribute data annotation." + + + + + InvalidOperationException with message like "Cannot get value for property '{0}' from entity of type '{1}' because the property has no get accessor." + + + + + InvalidOperationException with message like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor." + + + + + + NotSupportedException with message like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor and is in the '{2}' state." + + + + + InvalidOperationException with message like "Member '{0}' cannot be called for property '{1}' on entity of type '{2}' because the property is not part of the Entity Data Model." + + + + + + ArgumentException with message like "Cannot call the {0} method for an entity of type '{1}' on a DbSet for entities of type '{2}'. Only entities of type '{2}' or derived from type '{2}' can be added, attached, or removed." + + + + + ArgumentException with message like "Cannot call the Create method for the type '{0}' on a DbSet for entities of type '{1}'. Only entities of type '{1}' or derived from type '{1}' can be created." + + + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is a collection navigation property. The Collection method should be used instead of the Reference method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is a reference navigation property. The Reference method should be used instead of the Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a navigation property. The Reference and Collection methods can only be used with navigation properties. Use the Property or ComplexProperty method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a complex property. The ComplexProperty method can only be used with complex properties. Use the Property, Reference or Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a primitive property, complex property, collection navigation property, or reference navigation property." + + + + + ArgumentException with message like ""The property '{0}' from the property path '{1}' is not a complex property on type '{2}'. Property paths must be composed of complex properties for all except the final property."" + + + + + NotSupportedException with message like "Setting IsModified to false for a modified property is not supported." + + + + + ArgumentException with message like ""The property path '{0}' cannot be used for navigation properties. Property paths can only be used to access primitive or complex properties."" + + + + + ArgumentException with message like "The navigation property '{0}' on entity type '{1}' cannot be used for entities of type '{2}' because it refers to entities of type '{3}'." + + + + + ArgumentException with message like "The generic type argument '{0}' cannot be used with the Member method when accessing the collection navigation property '{1}' on entity type '{2}'. The generic type argument '{3}' must be used instead." + + + + + ArgumentException with message like "The property '{0}' on entity type '{1}' cannot be used for objects of type '{2}' because it is a property for objects of type '{3}'." + + + + + ArgumentException with message like "The expression passed to method {0} must represent a property defined on the type '{1}'." + + + + + InvalidOperationException with message like "{0} cannot be used for entities in the {1} state." + + + + + InvalidOperationException with message like "Cannot set non-nullable property '{0}' of type '{1}' to null on object of type '{2}'." + + + + + InvalidOperationException with message like "The property '{0}' in the entity of type '{1}' is null. Store values cannot be obtained for an entity with a null complex property." + + + + + InvalidOperationException with message like "Cannot assign value of type '{0}' to property '{1}' of type '{2}' in property values for type '{3}'." + + + + + NotSupportedException with message like "The set of property value names is read-only." + + + + + ArgumentException with message like "The '{0}' property does not exist or is not mapped for the type '{1}'." + + + + + ArgumentException with message like "Cannot copy values from DbPropertyValues for type '{0}' into DbPropertyValues for type '{1}'." + + + + + ArgumentException with message like "Cannot copy from property values for object of type '{0}' into property values for object of type '{1}'." + + + + + ArgumentException with message like "A property of a complex type must be set to an instance of the generic or non-generic DbPropertyValues class for that type." + + + + + InvalidOperationException with message like "The value of the complex property '{0}' on entity of type '{1}' is null. Complex properties cannot be set to null and values cannot be set for null complex properties." + + + + + InvalidOperationException with message like "The value of the nested property values property '{0}' on the values for entity of type '{1}' is null. Nested property values cannot be set to null and values cannot be set for null complex properties." + + + + + InvalidOperationException with message like "Cannot set the value of the nested property '{0}' because value of the complex property '{1}' to which it belongs is null." + + + + + InvalidOperationException with message like "Cannot set the original value of the nested property '{0}' because the original value of the complex property '{1}' to which it belongs is null." + + + + + InvalidOperationException with message like "The model backing the '{0}' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)." + + + + + InvalidOperationException with message like "Database '{0}' cannot be created because it already exists." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the DbContext instance was not created using Code First patterns. DbContext instances created from an ObjectContext or using an EDMX file cannot be checked for compatibility." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations." + + + + + + + InvalidOperationException with message like "Failed to set database initializer of type '{0}' for DbContext type '{1}' specified in the application configuration. See inner exception for details." + + + + + InvalidOperationException with message like "Configuration for DbContext type '{0}' is specified multiple times in the application configuration. Each context can only be configured once." + + + + + InvalidOperationException with message like "Failed to set Database.DefaultConnectionFactory to an instance of the '{0}' type as specified in the application configuration. See inner exception for details." + + + + + InvalidOperationException with message like "The type '{0}' could not be found. The type name must be an assembly-qualified name." + + + + + InvalidOperationException with message like "The context cannot be used while the model is being created." + + + + + InvalidOperationException with message like "The DbContext class cannot be used with models that have multiple entity sets per type (MEST)." + + + + + InvalidOperationException with message like "The operation cannot be completed because the DbContext has been disposed." + + + + + InvalidOperationException with message like "The provider factory returned a null connection." + + + + + InvalidOperationException with message like "The connection string '{0}' in the application's configuration file does not contain the required providerName attribute."" + + + + + InvalidOperationException with message like "The DbConnectionFactory instance returned a null connection." + + + + + ArgumentException with message like "The number of primary key values passed must match number of primary key values defined on the entity." + + + + + ArgumentException with message like "The type of one of the primary key values did not match the type defined in the entity. See inner exception for details." + + + + + InvalidOperationException with message like "The entity found was of type {0} when an entity of type {1} was requested." + + + + + InvalidOperationException with message like "Multiple entities were found in the Added state that match the given primary key values." + + + + + InvalidOperationException with message like "The type '{0}' is mapped as a complex type. The Set method, DbSet objects, and DbEntityEntry objects can only be used with entity types, not complex types." + + + + + InvalidOperationException with message like "The type '{0}' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute." + + + + + InvalidOperationException with message like "The entity type {0} is not part of the model for the current context." + + + + + NotSupportedException with message like "Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList()." + + + + + ArgumentException with message like "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties." + + + + + InvalidOperationException with message like "No connection string named '{0}' could be found in the application config file." + + + + + InvalidOperationException with message like "Cannot initialize a DbContext from an entity connection string or an EntityConnection instance together with a DbCompiledModel. If an entity connection string or EntityConnection instance is used, then the model will be created from the metadata in the connection. If a DbCompiledModel is used, then the connection supplied should be a standard database connection (for example, a SqlConnection instance) rather than an entity connection." + + + + + NotSupportedException with message like "The collection navigation property '{0}' on the entity of type '{1}' cannot be set because the entity type does not define a navigation property with a set accessor." + + + + + NotSupportedException with message like "Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used." + + + + + InvalidOperationException with message like "Multiple object sets per type are not supported. The object sets '{0}' and '{1}' can both contain instances of type '{2}'." + + + + + InvalidOperationException with message like "The context type '{0}' must have a public constructor taking an EntityConnection." + + + + + NotSupportedException with message like "The database name '{0}' is not supported because it is an MDF file name. A full connection string must be provided to attach an MDF file." + + + + + DataException with message like "An exception occurred while initializing the database. See the InnerException for details." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing ObjectContext is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing DbCompiledModel is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + InvalidOperationException with message like "The context factory type '{0}' must have a public default constructor." + + + + + InvalidOperationException with message like "The generic 'Set' method cannot be called with a proxy type. Either use the actual entity type or call the non-generic 'Set' method." + + + + + InvalidOperationException with message like "MaxLengthAttribute must have a Length value that is greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "MinLengthAttribute must have a Length value that is zero or greater." + + + + + InvalidOperationException with message like "No connection string named '{0}' could be found in the application config file." + + + + + InvalidOperationException with message like "The connection can not be overridden because this context was created from an existing ObjectContext." + + + + + InvalidOperationException with message like "Can not override the connection for this context with a standard DbConnection because the original connection was an EntityConnection." + + + + + InvalidOperationException with message like "Can not override the connection for this context with an EntityConnection because the original connection was a standard DbConnection." + + + + + The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument. + + + + + The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method. + + + + + The exception that is thrown when the author has yet to implement the logic at this point in the program. This can act as an exception based TODO tag. + + + + + The exception that is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or write to a stream that does not support the invoked functionality. + + + + + AutoGenerated resource class. Usage: + + string s = EntityRes.GetString(EntityRes.MyIdenfitier); + + + + + Allows the construction and modification of a user-specified annotation (name-value pair) on a instance. + + + + + Gets or sets an optional namespace that can be used to distinguish the annotation from others with the same value. + + + + + Gets or sets the name of the annotation. + + + + + Gets or sets the value of the annotation. + + + + + + + + + DataModelEventArgs is the base argument type for all events raised by consumers of Entity Data Model (EDM) models. + + + + + Gets a value indicating the that caused the event to be raised. + + + + + Gets an optional value indicating which property of the source item caused the event to be raised. + + + + + Gets a value that identifies the specific error that is being raised. + + + + + Gets an optional descriptive message the describes the error that is being raised. + + + + + DbAliasedMetadataItem provides the base type for all Database Metadata types that can have an optional that should be used instead of the item's when referring to the item in the database. + + + + + NamedDbItem is the base for all types in the Database Metadata construction and modification API with a property. + + + + + The base for all all Database Metadata types that support annotation using . + + + + + DbDataModelItem is the base for all types in the Database Metadata construction and modification API. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets or sets the currently assigned name. + + + + + Gets an optional alternative identifier that should be used when referring to this item in the database. + + + + + When implemented in derived types, allows the construction and modification of a column in a Database Metadata table or row. + + + + + Gets or sets a string indicating the database-specific type of the column. + + + + + Gets or sets a value indicating whether the column is nullable. + + + + + Gets or sets an optional instance that applies additional constraints to the referenced database-specific type of the column. + + + + + Allows the construction and modification of a database in a Database Metadata model. + + + + + Gets or sets an optional value that indicates the database model version. + + + + + Gets or sets the collection of instances that specifies the schemas within the database. + + + + + Allows the construction and modification of a foreign key constraint sourced by a instance. + + + + + Gets or sets the to take when a delete operation is attempted. + + + + + Indicates which Database Metadata concept is represented by a given item. + + + + + Database Kind + + + + + Schema Kind + + + + + Foreign Key Constraint Kind + + + + + Function Kind + + + + + Function Parameter Kind + + + + + Function Return or Parameter Type Kind + + + + + Row Column Kind + + + + + Table Kind + + + + + Table Column Kind + + + + + Primitive Facets Kind + + + + + Specifies the action to take on a given operation. + + + + + Default behavior + + + + + Restrict the operation + + + + + Cascade the operation + + + + + Allows the construction and modification of additional constraints that can be applied to a specific use of a primitive type in a Database Metadata item. + + + + + Returns true if any facet value property currently has a non-null value; otherwise returns false . + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have a fixed or variable length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have its intrinsic maximum length, rather than a specific value. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to be Unicode or non-Unicode. + + + + + Gets or sets an optional value indicating the current constraint on the type's maximum length. + + + + + Gets or sets an optional value indicating the current constraint on the type's precision. + + + + + Gets or sets an optional value indicating the current constraint on the type's scale. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating whether the spatial type is to be type checked strictly. + + + + + Allows the construction and modification of a database schema in a database model. + + + + + Gets or sets the collection of instances that specifies the tables declared within the schema. + + + + + DbSchemaMetadataItem is the base for all types that can be contained in a schema. + + + + + Allows the construction and modification of a column in a table. + + + + + Gets or sets a value indicating whether the column is part of the table's primary key. + + + + + Gets or sets a value indicating if and how the value of the column is automatically generated. + + + + + Gets or sets an optional value indicating the collation specific to this table column. + + + + + Gets or sets an optional value that specifies the default value for the column. + + + + + Allows the construction and modification a table in a database schema. + + + + + Gets or sets the collection of instances that specifies the columns present within the table. + + + + + Gets or sets the collection of instances from the collection of the table that are part of the primary key. + + + + + Gets or sets the collection of instances that defines the foreign key constraints sourced from the table. + + + + + Represents a specific use of a type in a Database Metadata item. + + + + + Gets or sets an optional instance that applies additional constraints to a referenced primitive type. + + + Accessing this property forces the creation of a DbPrimitiveTypeFacets value if no value has previously been set. Use to determine whether or not this property currently has a value. + + + + + Gets or sets a value indicating whether the represented type is a collection type. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered nullable. + + + + + Gets a value indicating whether the type has been configured as a row type by the addition of one or more RowColumns. + + + + + Represents the mapping of an EDM association end ( ) as a collection of property mappings ( ). + + + + + DbMappingMetadataItem is the base for all types in the EDM-to-Database Mapping construction and modification API that support annotation using . + + + + + DbMappingModelItem is the base for all types in the EDM-to-Database Mapping construction and modification API. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets an value representing the association end that is being mapped. + + + + + Gets the collection of s that specifies how the association end key properties are mapped to the table. + + + + + Gets an value representing the association set that is being mapped. + + + + + Gets a value representing the table to which the entity type's properties are being mapped. + + + + + Gets the collection of s that specifies the constant or null values that columns in must have for this type mapping to apply. + + + + + Allows the construction and modification of a condition for a column in a database table. + + + + + Gets or sets a value representing the table column which must contain for this condition to hold. + + + + + Gets or sets the value that must contain for this condition to hold. + + + + + Gets or sets an value representing the model that is being mapped. + + + + + Gets or sets a value representing the database that is the target of the mapping. + + + + + Gets or sets the collection of s that specifies how the model's entity containers are mapped to the database. + + + + + Represents the mapping of an entity property to a column in a database table. + + + + + Gets or sets the collection of instances that defines the mapped property, beginning from a property declared by the mapped entity type and optionally proceeding through properties of complex property result types. + + + + + Gets or sets a value representing the table column to which the entity property is being mapped. + + + + + Allows the construction and modification of the mapping of an EDM entity container ( ) to a database ( ). + + + + + Gets or sets an value representing the entity container that is being mapped. + + + + + Gets or sets the collection of s that specifies how the container's entity sets are mapped to the database. + + + + + Gets the collection of s that specifies how the container's association sets are mapped to the database. + + + + + Allows the construction and modification of the mapping of an EDM entity set ( ) to a database ( ). + + + + + Gets or sets an value representing the entity set that is being mapped. + + + + + Gets or sets the collection of s that specifies how the set's entity types are mapped to the database. + + + + + Allows the construction and modification of a complete or partial mapping of an EDM entity type ( ) or type hierarchy to a specific database table ( ). + + + + + Gets or sets an value representing the entity type or hierarchy that is being mapped. + + + + + Gets or sets a value indicating whether this type mapping applies to and all its direct or indirect subtypes ( true ), or only to ( false ). + + + + + Gets a value representing the table to which the entity type's properties are being mapped. + + + + + Gets the collection of s that specifies how the type's properties are mapped to the table. + + + + + Gets the collection of s that specifies the constant or null values that columns in must have for this type mapping fragment to apply. + + + + + Indicates which EDM-to-Database Mapping concept is represented by a given item. + + + + + Database Mapping Kind + + + + + Entity Container Mapping Kind + + + + + Entity Set Mapping Kind + + + + + Association Set Mapping Kind + + + + + Entity Type Mapping Kind + + + + + Query View Mapping Kind + + + + + Entity Type Mapping Fragment Kind + + + + + Edm Property Mapping Kind + + + + + Association End Mapping Kind + + + + + Column Condition Kind + + + + + Property Condition Kind + + + + + Allows the construction and modification of a constraint applied to an Entity Data Model (EDM) association. + + + + + Gets or sets the that represents the 'dependent' end of the constraint; properties from this association end's entity type contribute to the collection. + + + + + Gets or sets the collection of instances from the of the constraint. The values of these properties are constrained against the primary key values of the remaining, 'principal' association end's entity type. + + + + + Allows the construction and modification of one end of an Entity Data Model (EDM) association. + + + + + Gets or sets the entity type referenced by this association end. + + + + + Gets or sets the of this association end, which indicates the multiplicity of the end and whether or not it is required. + + + + + Gets or sets the to take when a delete operation is attempted. + + + + + Indicates the multiplicity of an and whether or not it is required. + + + + + Allows the construction and modification of an association set in an Entity Data Model (EDM) ). + + + + + Represents an item in an Entity Data Model (EDM) . + + + + + Gets or sets the that specifies the association type for the set. + + + + + Gets or sets the that specifies the entity set corresponding to the association end for this association set. + + + + + Gets or sets the that specifies the entity set corresponding to the association end for this association set. + + + + + + The base for all all Entity Data Model (EDM) types that represent a structured type from the EDM type system. + + + + + Gets or sets the that defines the source end of the association. + + + + + Gets or sets the that defines the target end of the association. + + + + + Gets or sets the optional constraint that indicates whether the relationship is an independent association (no constraint present) or a foreign key relationship ( specified). + + + + + Collection semantics for properties. + + + + + The property does not have a collection type or does not specify explicit collection semantics. + + + + + The property is an unordered collection that may contain duplicates. + + + + + The property is an ordered collection that may contain duplicates. + + + + + Allows the construction and modification of a complex type in an Entity Data Model (EDM) . + + + + + Gets or sets the optional that indicates the base complex type of the complex type. + + + + + Gets or sets a value indicating whether the complex type is abstract. + + + + + Gets or sets the collection of instances that describe the (scalar or complex) properties of the complex type. + + + + + Concurrency mode for properties. + + + + + Default concurrency mode: the property is never validated at write time + + + + + Fixed concurrency mode: the property is always validated at write time + + + + + Allows the construction and modification of an entity container in an Entity Data Model (EDM) . + + + + + Gets all s declared within the namspace. Includes s and s. + + + + + Gets or sets the collection of s that specifies the association sets within the container. + + + + + Gets or sets the collection of s that specifies the entity sets within the container. + + + + + Allows the construction and modification of an entity set in an Entity Data Model (EDM) . + + + + + Gets or sets the that specifies the entity type for the set. + + + + + Allows the construction and modification of an entity type in an Entity Data Model (EDM) . + + + + + Gets or sets the optional that indicates the base entity type of the entity type. + + + + + Gets or sets a value indicating whether the entity type is abstract. + + + + + Gets or sets the collection of s that specifies the properties declared by the entity type. + + + + + Gets or sets the collection of s that indicates which properties from the collection are part of the entity key. + + + + + Gets or sets the optional collection of s that specifies the navigation properties declared by the entity type. + + + + + Indicates which Entity Data Model (EDM) concept is represented by a given item. + + + + + Association End Kind + + + + + Association Set Kind + + + + + Association Type Kind + + + + + Collection Type Kind + + + + + Complex Type Kind + + + + + Entity Container Kind + + + + + Entity Set Kind + + + + + Entity Type Kind + + + + + Function Group Kind + + + + + Function Overload Kind + + + + + Function Import Kind + + + + + Function Parameter Kind + + + + + Navigation Property Kind + + + + + EdmProperty Type Kind + + + + + Association Constraint Type Kind + + + + + Ref Type Kind + + + + + Row Column Kind + + + + + Row Type Kind + + + + + Type Reference Kind + + + + + Model Kind + + + + + Namespace Kind + + + + + Primitive Facets Kind + + + + + Primitive Type Kind + + + + + Enum Type Kind + + + + + Enum Type Member Kind + + + + + EdmModel is the top-level container for namespaces and entity containers belonging to the same logical Entity Data Model (EDM) model. + + + + + Gets or sets an optional value that indicates the entity model version. + + + + + Gets or sets the containers declared within the model. + + + + + Gets or sets the namespaces declared within the model. + + + + + Allows the construction and modification of a namespace in an . + + + + + Gets all s declared within the namspace. Includes s, s, s. + + + + + Gets or sets the s declared within the namespace. + + + + + Gets or sets the s declared within the namespace. + + + + + Gets or sets the s declared within the namespace. + + + + + Allows the construction and modification of an Entity Data Model (EDM) navigation property. + + + + + Gets or sets the that specifies the association over which navigation takes place. + + + + + Gets or sets the that specifies which association end is the 'destination' end of the navigation and produces the navigation property result. + + + + + Specifies the action to take on a given operation. + + + + + Default behavior + + + + + Restrict the operation + + + + + Cascade the operation + + + + + Represents one of the fixed set of Entity Data Model (EDM) primitive types. + + + + + The base for all all Entity Data Model (EDM) types that represent a scalar type from the EDM type system. + + + + + Retrieves the EdmPrimitiveType instance with the corresponding to the specified value, if any. + + The name of the primitive type instance to retrieve + The EdmPrimitiveType with the specified name, if successful; otherwise null . + true if the given name corresponds to an EDM primitive type name; otherwise false . + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets an value that indicates which Entity Data Model (EDM) primitive type this type represents. + + + + + Allows the construction and modification of additional constraints that can be applied to a specific use of a primitive type in an Entity Data Model (EDM) item. See . + + + + + Returns true if any facet value property currently has a non-null value; otherwise returns false . + + + + + Gets or sets an optional value indicating the current constraint on the type's maximum length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have its intrinsic maximum length, rather than a specific value. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have a fixed or variable length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to be Unicode or non-Unicode. + + + + + Gets or sets an optional value indicating the current constraint on the type's precision. + + + + + Gets or sets an optional value indicating the current constraint on the type's scale. + + + + + Gets or sets an optional value indicating that the current spatial type's SRID is unconstrained. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating whether the spatial type is to be type checked strictly. + + + + + Primitive Types as defined by the Entity Data Model (EDM). + + + + + Binary Type Kind + + + + + Boolean Type Kind + + + + + Byte Type Kind + + + + + DateTime Type Kind + + + + + Decimal Type Kind + + + + + Double Type Kind + + + + + Guid Type Kind + + + + + Single Type Kind + + + + + SByte Type Kind + + + + + Int16 Type Kind + + + + + Int32 Type Kind + + + + + Int64 Type Kind + + + + + String Type Kind + + + + + Time Type Kind + + + + + DateTimeOffset Type Kind + + + + + Geometry Type Kind + + + + + Geography Type Kind + + + + + Geometric point type kind + + + + + Geometric linestring type kind + + + + + Geometric polygon type kind + + + + + Geometric multi-point type kind + + + + + Geometric multi-linestring type kind + + + + + Geometric multi-polygon type kind + + + + + Geometric collection type kind + + + + + Geographic point type kind + + + + + Geographic linestring type kind + + + + + Geographic polygon type kind + + + + + Geographic multi-point type kind + + + + + Geographic multi-linestring type kind + + + + + Geographic multi-polygon type kind + + + + + Geographic collection type kind + + + + + Allows the construction and modification of a primitive- or complex-valued property of an Entity Data Model (EDM) entity or complex type. + + + + + Gets or sets an value that indicates which collection semantics - if any - apply to the property. + + + + + Gets or sets a value that indicates whether the property is used for concurrency validation. + + + + + Gets or sets on optional value that indicates an initial default value for the property. + + + + + Gets or sets an that specifies the result type of the property. + + + + + Enumerates all s declared or inherited by an . + + + + + Allows the construction and modification of a specific use of a type in an Entity Data Model (EDM) item. See for examples. + + + + + Gets or sets a value indicating the collection rank of the type reference. A collection rank greater than zero indicates that the type reference represents a collection of its referenced . + + + + + Gets or sets a value indicating the referenced by this type reference. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered nullable. + + + + + Gets or sets an optional instance that applies additional constraints to a referenced primitive type. + + + Accessing this property forces the creation of an EdmPrimitiveTypeFacets value if no value has previously been set. Use to determine whether or not this property currently has a value. + + + + + Gets a value indicating whether the property of this type reference has been assigned an value with at least one facet value specified. + + + + + Indicates whether this type reference represents a collection of its referenced (when is greater than zero) or not. + + + + + Indicates whether the property of this type reference currently refers to an , is not a collection type, and does not have primitive facet values specified. + + + + + Gets the currently referred to by this type reference, or null if the type reference is a collection type or does not refer to a complex type. + + + + + Indicates whether the property of this type reference currently refers to an and is not a collection type. + + + + + Gets the currently referred to by this type reference, or null if the type reference is a collection type or does not refer to a primitive type. + + + + + Contains constant values that apply to the EDM model, regardless of source (for CSDL specific constants see ). + + + + + Parsing code taken from System.dll's System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(string) method to avoid LinkDemand needed to call this method + + + + + + + + + + + Constants for CSDL XML. + + + + + Constants for C-S MSL XML. + + + + + Constants for SSDL XML. + + + + + The acceptable range for this enum is 0000 - 0999; the range 10,000-15,000 is reserved for tools. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Precision out of range + + + + + Scale out of range + + + + + + + + + + + + + One of the required facets is missing + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The facet isn't allow by the property type. + + + + + This facet value is constant and is specified in the schema + + + + + + + + + + + + + Multiplicity value was malformed + + + + + The value for the Action attribute is invalid or not allowed in the current context + + + + + An error occurred processing the On<Operation> elements + + + + + Ends were given for the Property element of a EntityContainer that is not a RelationshipSet + + + + + The extent name used in the EntittyContainerType End does not match the name of any of the EntityContainerProperties in the containing EntityContainer + + + + + An end element was not given, and cannot be inferred because too many EntityContainerEntitySet elements that are good possibilities. + + + + + An end element was not given, and cannot be inferred because there is no EntityContainerEntitySets that are the correct type to be used as an EntitySet. + + + + + Not a valid parameter direction for the parameter in a function + + + + + Unable to infer an optional schema part, to resolve this; be more explicit + + + + + Invalid facet attribute(s) specified in provider manifest + + + + + Invalid role value in the relationship constraint + + + + + Invalid Property in relationship constraint + + + + + Type mismatch between ToProperty and FromProperty in the relationship constraint + + + + + Invalid multiplicity in FromRole in the relationship constraint + + + + + The number of properties in the FromProperty and ToProperty in the relationship constraint must be identical + + + + + No Properties defined in either FromProperty or ToProperty in the relationship constraint + + + + + Missing constraint in relationship type in ssdl + + + + + Same role referred in the ToRole and FromRole of a referential constraint + + + + + Invalid value for attribute ParameterTypeSemantics + + + + + Invalid type used for a Relationship End Type + + + + + Invalid PrimitiveTypeKind + + + + + Invalid TypeConversion DestinationType + + + + + Expected a integer value between 0 - 255 + + + + + Invalid Type specified in function + + + + + Precision must not be greater than 28 + + + + + Properties that are part of entity key must be of scalar type + + + + + Binary type properties which are part of entity key are currently not supported + + + + + The primitive type kind does not have a preferred mapping + + + + + More than one PreferredMapping for a PrimitiveTypeKind + + + + + End with * multiplicity cannot have operations specified + + + + + EntitySet type has no keys + + + + + InvalidNumberOfParametersForAggregateFunction + + + + + InvalidParameterTypeForAggregateFunction + + + + + Composable functions must declare a return type. + + + + + Non-composable functions must not declare a return type. + + + + + Non-composable functions do not permit the aggregate; niladic; or built-in attributes. + + + + + Composable functions can not include command text attribute. + + + + + Functions should not declare both a store name and command text (only one or the other can be used). + + + + + SystemNamespace + + + + + Empty DefiningQuery text + + + + + Schema, Table and DefiningQuery are all specified, and are mutually exclusive + + + + + ConcurrencyMode value was malformed + + + + + Concurrency can't change for any sub types of an EntitySet type. + + + + + Function import return type must be either empty, a collection of entities, or a singleton scalar. + + + + + Function import specifies a non-existent entity set. + + + + + Function import specifies entity type return but no entity set. + + + + + Function import specifies entity type that does not derive from element type of entity set. + + + + + Function import specifies a binding to an entity set but does not return entities. + + + + + InternalError + + + + + Same Entity Set Taking part in the same role of the relationship set in two different relationship sets + + + + + Entity key refers to the same property twice + + + + + Function declares a ReturnType attribute and element + + + + + Nullable Complex Type not supported in Edm V1 + + + + + Only Complex Collections supported in Edm V1.1 + + + + + No Key defined on Entity Type + + + + + Invalid namespace specified in using element + + + + + Need not specify system namespace in using + + + + + Cannot use a reserved/system namespace as alias + + + + + Invalid qualification specified for type + + + + + Invalid Entity Container Name in extends attribute + + + + + Invalid CollectionKind value in property CollectionKind attribute + + + + + Must specify namespace or alias of the schema in which this type is defined + + + + + Entity Container cannot extend itself + + + + + Failed to retrieve provider manifest + + + + + Mismatched Provider Manifest token values in SSDL artifacts + + + + + Missing Provider Manifest token value in SSDL artifact(s) + + + + + Empty CommandText element + + + + + Inconsistent Provider values in SSDL artifacts + + + + + Inconsistent Provider Manifest token values in SSDL artifacts + + + + + Duplicated Function overloads + + + + + InvalidProvider + + + + + FunctionWithNonEdmTypeNotSupported + + + + + ComplexTypeAsReturnTypeAndDefinedEntitySet + + + + + ComplexTypeAsReturnTypeAndDefinedEntitySet + + + + unused 179, + unused 180, + unused 181, + + In model functions facet attribute is allowed only on ScalarTypes + + + + + Captures several conditions where facets are placed on element where it should not exist. + + + + + Return type has not been declared + + + + + Invalid value in the EnumTypeOption + + + + + The structural annotation cannot use codegen namespaces + + + + + Function and type cannot have the same fully qualified name + + + + + Cannot load different version of schema in the same ItemCollection + + + + + Expected bool value + + + + + End without Multiplicity specified + + + + + In SSDL, if composable function returns a collection of rows (TVF), all row properties must be of scalar types. + + + + + The name of NamedEdmItem must not be empty or white space only + + + + + EdmTypeReference is empty + + Unused 199; + + + + Serializes an that conforms to the restrictions of a single CSDL schema file to an XML writer. The model to be serialized must contain a single and a single . + + + + + Serialize the to the XmlWriter. + + The EdmModel to serialize, mut have only one and one + The XmlWriter to serialize to + + + + Serialize the to the XmlWriter + + The DbModel to serialize + The XmlWriter to serialize to + + + + Serialize the to the + + The DbDatabaseMetadata to serialize + Provider information on the Schema element + ProviderManifestToken information on the Schema element + The XmlWriter to serialize to + + + + + author/email + + + + + author/name + + + + + author/uri + + + + + published + + + + + rights + + + + + summary + + + + + title + + + + + contributor/email + + + + + contributor/name + + + + + contributor/uri + + + + + category/@label + + + + + Plaintext + + + + + HTML + + + + + XHTML + + + + + updated + + + + + link/@href + + + + + link/@rel + + + + + link/@type + + + + + link/@hreflang + + + + + link/@title + + + + + link/@length + + + + + category/@term + + + + + category/@scheme + + + + + Return role name pair + + + + + + + + The context for DataModel Validation + + + + + Returns true if the given two ends are similar - the relationship type that this ends belongs to is the same and the entity set refered by the ends are same and they are from the same role + + + + + + + + Return true if the Referential Constraint on the association is ready for further validation, otherwise return false. + + + + + + + Resolves the given property names to the property in the item Also checks whether the properties form the key for the given type and whether all the properties are nullable or not + + + + + + + + + + + Return true if the namespaceName is a Edm System Namespace + + + + + + + Return true if the entityType is a subtype of any entity type in the dictionary keys, and return the corresponding entry EntitySet value. Otherwise return false. + + + + + + + + + Return true if any of the properties in the EdmEntityType defines ConcurrencyMode. Otherwise return false. + + + + + + + Add member name to the Hash set, raise an error if the name exists already. + + + + + + + + + If the string is null, empty, or only whitespace, return false, otherwise return true + + + + + + + Determine if a cycle exists in the type hierarchy: use two pointers to walk the chain, if one catches up with the other, we have a cycle. + + true if a cycle exists in the type hierarchy, false otherwise + + + + RuleSet for DataModel Validation + + + + + Get the related rules given certain DataModelItem + + The to validate + A collection of + + + + Data Model Validator + + + + + Validate the and all of its properties given certain version. + + The root of the model to be validated + True to validate the syntax, otherwise false + + + + The RuleSet for EdmModel + + + + + Get based on version + + a double value of version + + + + + The context for EdmModel Validation + + + + + Visitor for EdmModel Validation + + + + + Edm Model Validator + + + + + validate the from the root with the context + + The root to validate from + The validation context + + + + An implementation of IDatabaseInitializer that will recreate and optionally re-seed the + database only if the database does not exist. + To seed the database, create a derived class and override the Seed method. + + The type of the context. + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + An instances of this class is obtained from an object and can be used + to manage the actual database backing a DbContext or connection. + This includes creating, deleting, and checking for the existence of a database. + Note that deletion and checking for existence of a database can be performed using just a + connection (i.e. without a full context) by using the static methods of this class. + + + + + Creates a Database backed by the given context. This object can be used to create a database, + check for database existence, and delete a database. + + The context that defines the database connection and model. + + + + Gets or sets the database initialization strategy. The database initialization strategy is called when instance + is initialized from a . The strategy can optionally check for database existence, create a new database, and + seed the database with data. + The default strategy is an instance of . + + The type of the context. + The strategy. + The database creation strategy. + + + + Internal version of SetInitializer that allows the strategy to be locked such that it cannot be replaced + by another call to SetInitializer. This allows strategies set in the app.config to win over strategies set + in code. + + The type of the context. + The strategy. + if set to true then the strategy is locked. + + + + Runs the the registered on this context. + + If "force" is set to true, then the initializer is run regardless of whether or not it + has been run before. This can be useful if a database is deleted while an app is running + and needs to be reinitialized. + + If "force" is set to false, then the initializer is only run if it has not already been + run for this context, model, and connection in this app domain. This method is typically + used when it is necessary to ensure that the database has been created and seeded + before starting some operation where doing so lazily will cause issues, such as when the + operation is part of a transaction. + + if set to true the initializer is run even if it has already been run. + + + + Checks whether or not the database is compatible with the the current Code First model. + + + Model compatibility currently uses the following rules. + + If the context was created using either the Model First or Database First approach then the + model is assumed to be compatible with the database and this method returns true. + + For Code First the model is considered compatible if the model is stored in the database + in the Migrations history table and that model has no differences from the current model as + determined by Migrations model differ. + + If the model is not stored in the database but an EF 4.1/4.2 model hash is found instead, + then this is used to check for compatibility. + + + If set to true then an exception will be thrown if no model metadata is found in + the database. If set to false then this method will return true if metadata + is not found. + + True if the model hash in the context and the database match; false otherwise. + + + + + Creates a new database on the database server for the model defined in the backing context. + Note that calling this method before the database initialization strategy has run will disable + executing that strategy. + + + + + Creates a new database on the database server for the model defined in the backing context, but only + if a database with the same name does not already exist on the server. + + True if the database did not exist and was created; false otherwise. + + + + Checks whether or not the database exists on the server. + + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + Calling this method from outside of an initializer will mark the database as having + not been initialized. This means that if an attempt is made to use the database again + after it has been deleted, then any initializer set will run again and, usually, will + try to create the database again automatically. + + True if the database did exist and was deleted; false otherwise. + + + + Checks whether or not the database exists on the server. + The connection to the database is created using the given database name or connection string + in the same way as is described in the documentation for the class. + + The database name or a connection string to the database. + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + The connection to the database is created using the given database name or connection string + in the same way as is described in the documentation for the class. + + The database name or a connection string to the database. + True if the database did exist and was deleted; false otherwise. + + + + Checks whether or not the database exists on the server. + + An existing connection to the database. + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + + An existing connection to the database. + True if the database did exist and was deleted; false otherwise. + + + + Resets the DefaultConnectionFactory to its initial value. + Currently, this method is only used by test code. + + + + + Performs the operation defined by the given delegate using the given lazy connection, ensuring + that the lazy connection is disposed after use. + + Information used to create a DbConnection. + The operation to perform. + The return value of the operation. + + + + Performs the operation defined by the given delegate against a connection. The connection + is either the connection accessed from the context backing this object, or is obtained from + the connection information passed to one of the static methods. + + The connection to use. + The operation to perform. + The return value of the operation. + + + + Returns an empty ObjectContext that can be used to perform delete/exists operations. + + The connection for which to create an ObjectContext + The empty context. + + + + Creates a raw SQL query that will return elements of the given generic type. + The type can be any type that has properties that match the names of the columns returned + from the query, or can be a simple primitive type. The type does not have to be an + entity type. The results of this query are never tracked by the context even if the + type of object returned is an entity type. Use the + method to return entities that are tracked by the context. + + The type of object returned by the query. + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Creates a raw SQL query that will return elements of the given type. + The type can be any type that has properties that match the names of the columns returned + from the query, or can be a simple primitive type. The type does not have to be an + entity type. The results of this query are never tracked by the context even if the + type of object returned is an entity type. Use the + method to return entities that are tracked by the context. + + The type of object returned by the query. + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Executes the given DDL/DML command against the database. + + The command string. + The parameters to apply to the command string. + The result returned by the database after executing the command. + + + + Returns the connection being used by this context. This may cause the + connection to be created if it does not already exist. + + Thrown if the context has been disposed. + + + + Returns the as a delegate that can be called with + an instance of the that owns this Database object, or returns null if + there is no initializer set for this context type. + + The initializer delegate or null. + + + + The connection factory to use when creating a from just + a database name or a connection string. + + + This is used when just a database name or connection string is given to or when + the no database name or connection is given to DbContext in which case the name of + the context class is passed to this factory in order to generate a DbConnection. + By default, the instance to use is read from the applications .config + file from the "EntityFramework DefaultConnectionFactory" entry in appSettings. If no entry is found in + the config file then is used. Setting this property in code + always overrides whatever value is found in the config file. + + + + + Checks wether or not the DefaultConnectionFactory has been set to something other than its default value. + + + + + + + Common code for generic and non-generic string Include. + + + + + + Returns a new query where the entities returned will not be cached in the + or . This method works by calling the AsNoTracking method of the + underlying query object. If the underlying query object does not have a AsNoTracking method, + then calling this method will have no affect. + + The element type. + The source query. + A new query with NoTracking applied, or the source query if NoTracking is not supported. + + + + Returns a new query where the entities returned will not be cached in the + or . This method works by calling the AsNoTracking method of the + underlying query object. If the underlying query object does not have a AsNoTracking method, + then calling this method will have no affect. + + The source query. + A new query with NoTracking applied, or the source query if NoTracking is not supported. + + + + Common code for generic and non-generic AsNoTracking. + + + + + Enumerates the query such that for server queries such as those of , , + , and others the results of the query will be loaded into the associated , + or other cache on the client. + This is equivalent to calling ToList and then throwing away the list without the overhead of actually creating the list. + + The source query. + + + + Returns an implementation that stays in sync with the given . + + The element type. + The collection that the binding list will stay in sync with. + The binding list. + + + + DbModelBuilder is used to map CLR classes to a database schema. + This code centric approach to building an Entity Data Model (EDM) model is known as 'Code First'. + + + DbModelBuilder is typically used to configure a model by overriding . + You can also use DbModelBuilder independently of DbContext to build a model and then construct a + or . + The recommended approach, however, is to use OnModelCreating in as + the workflow is more intuitive and takes care of common tasks, such as caching the created model. + + Types that form your model are registered with DbModelBuilder and optional configuration can be + performed by applying data annotations to your classes and/or using the fluent style DbModelBuilder + API. + + When the Build method is called a set of conventions are run to discover the initial model. + These conventions will automatically discover aspects of the model, such as primary keys, and + will also process any data annotations that were specified on your classes. Finally + any configuration that was performed using the DbModelBuilder API is applied. + + Configuration done via the DbModelBuilder API takes precedence over data annotations which + in turn take precedence over the default conventions. + + + + + Initializes a new instance of the class. + + The process of discovering the initial model will use the set of conventions included + in the most recent version of the Entity Framework installed on your machine. + + + Upgrading to newer versions of the Entity Framework may cause breaking changes + in your application because new conventions may cause the initial model to be + configured differently. There is an alternate constructor that allows a specific + version of conventions to be specified. + + + + + Initializes a new instance of the class that will use + a specific set of conventions to discover the initial model. + + The version of conventions to be used. + + + + Excludes a type from the model. This is used to remove types from the model that were added + by convention during initial model discovery. + + The type to be excluded. + The same DbModelBuilder instance so that multiple calls can be chained. + + + + Excludes a type(s) from the model. This is used to remove types from the model that were added + by convention during initial model discovery. + + The types to be excluded from the model. + The same DbModelBuilder instance so that multiple calls can be chained. + + + + Registers an entity type as part of the model and returns an object that can be used to + configure the entity. This method can be called multiple times for the same entity to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified entity type. + + + + Registers a type as an entity in the model and returns an object that can be used to + configure the entity. This method can be called multiple times for the same type to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified entity type. + + + + Registers a type as a complex type in the model and returns an object that can be used to + configure the complex type. This method can be called multiple times for the same type to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified complex type. + + + + Creates a based on the configuration performed using this builder. + The connection is used to determine the database provider being used as this + affects the database layer of the generated model. + + Connection to use to determine provider information. + The model that was built. + + + + Creates a based on the configuration performed using this builder. + Provider information must be specified because this affects the database layer of the generated model. + For SqlClient the invariant name is 'System.Data.SqlClient' and the manifest token is the version year (i.e. '2005', '2008' etc.) + + The database provider that the model will be used with. + The model that was built. + + + + Provides access to the settings of this DbModelBuilder that deal with conventions. + + + + + Gets the for this DbModelBuilder. + The registrar allows derived entity and complex type configurations to be registered with this builder. + + + + + A value from this enumeration can be provided directly to the + class or can be used in the applied to + a class derived from . The value used defines which version of + the DbContext and DbModelBuilder conventions should be used when building a model from + code--also know as "Code First". + + + Using DbModelBuilderVersion.Latest ensures that all the latest functionality is available + when upgrading to a new release of the Entity Framework. However, it may result in an + application behaving differently with the new release than it did with a previous release. + This can be avoided by using a specific version of the conventions, but if a version + other than the latest is set then not all the latest functionality will be available. + + + + + Indicates that the latest version of the and + conventions should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 4.1 + through 4.3 should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 5.0 + when targeting .NET 4 should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 5.0 + when targeting .NET 4.5 should be used. + + + + + This attribute can be applied to a class derived from to set which + version of the DbContext and conventions should be used when building + a model from code--also know as "Code First". See the + enumeration for details about DbModelBuilder versions. + + + If the attribute is missing from DbContextthen DbContext will always use the latest + version of the conventions. This is equivalent to using DbModelBuilderVersion.Latest. + + + + + Initializes a new instance of the class. + + The conventions version to use. + + + + Gets the conventions version. + + The conventions version. + + + + A non-generic version of which can be used when the type of entity + is not known at build time. + + + + + Represents a non-generic LINQ to Entities query against a DbContext. + + + + + An internal interface implemented by and that allows access to + the internal query without using reflection. + + + + + The underlying internal set. + + + + + Internal constructor prevents external classes deriving from DbQuery. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + Instead populate a DbSet with data, for example by using the Load extension method, and + then bind to local data. For WPF bind to DbSet.Local. For Windows Forms bind to + DbSet.Local.ToBindingList(). + + + Never returns; always throws. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Returns the equivalent generic object. + + The type of element for which the query was created. + The generic set object. + + + + Returns a representation of the underlying query. + + + The query string. + + + + + Returns false. + + false. + + + + The IQueryable element type. + + + + + The IQueryable LINQ Expression. + + + + + The IQueryable provider. + + + + + Gets the underlying internal query object. + + The internal query. + + + + The internal query object that is backing this DbQuery + + + + + An internal interface implemented by and that allows access to + the internal set without using reflection. + + + + + The underlying internal set. + + + + + Internal constructor prevents external classes deriving from DbSet. + + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Returns the equivalent generic object. + + The type of entity for which the set was created. + The generic set object. + + + + Creates a raw SQL query that will return entities in this set. By default, the + entities returned are tracked by the context; this can be changed by calling + AsNoTracking on the returned. + Note that the entities returned are always of the type for this set and never of + a derived type. If the table or tables queried may contain data for other entity + types, then the SQL query must be written appropriately to ensure that only entities of + the correct type are returned. + + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + The internal IQueryable that is backing this DbQuery + + + + + Gets the underlying internal set. + + The internal set. + + + + A DbSet represents the collection of all entities in the context, or that can be queried from the + database, of a given type. DbSet objects are created from a DbContext using the DbContext.Set method. + + + Note that DbSet does not support MEST (Multiple Entity Sets per Type) meaning that there is always a + one-to-one correlation between a type and a set. + + The type that defines the set. + + + + Represents a LINQ to Entities query against a DbContext. + + The type of entity to query for. + + + + Creates a new query that will be backed by the given internal query object. + + The backing query. + + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Throws an exception indicating that binding directly to a store query is not supported. + Instead populate a DbSet with data, for example by using the Load extension method, and + then bind to local data. For WPF bind to DbSet.Local. For Windows Forms bind to + DbSet.Local.ToBindingList(). + + + Never returns; always throws. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Returns a representation of the underlying query. + + + The query string. + + + + + Returns a new instance of the non-generic class for this query. + + A non-generic version. + + + + Returns false. + + false. + + + + The IQueryable element type. + + + + + The IQueryable LINQ Expression. + + + + + The IQueryable provider. + + + + + The internal query object that is backing this DbQuery + + + + + The internal query object that is backing this DbQuery + + + + + An IDbSet represents the collection of all entities in the context, or that can be queried from the + database, of a given type. DbSet is a concrete implementation of IDbSet. + + The type that defines the set. + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + Creates a new set that will be backed by the given . + + The internal set. + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Returns the equivalent non-generic object. + + The non-generic set object. + + + + Creates a raw SQL query that will return entities in this set. By default, the + entities returned are tracked by the context; this can be changed by calling + AsNoTracking on the returned. + Note that the entities returned are always of the type for this set and never of + a derived type. If the table or tables queried may contain data for other entity + types, then the SQL query must be written appropriately to ensure that only entities of + the correct type are returned. + + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + The internal IQueryable that is backing this DbQuery + + + + + An implementation of IDatabaseInitializer that will always recreate and optionally re-seed the + database the first time that a context is used in the app domain. + To seed the database, create a derived class and override the Seed method. + + The type of the context. + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + An implementation of IDatabaseInitializer that will DELETE, recreate, and optionally re-seed the + database only if the model has changed since the database was created. + + + Whether or not the model has changed is determined by the + method. + To seed the database create a derived class and override the Seed method. + + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + Returned by the ChangeTracker method of to provide access to features of + the context that are related to change tracking of entities. + + + + + Initializes a new instance of the class. + + The internal context. + + + + Gets objects for all the entities tracked by this context. + + The entries. + + + + Gets objects for all the entities of the given type + tracked by this context. + + The type of the entity. + The entries. + + + + Detects changes made to the properties and relationships of POCO entities. Note that some types of + entity (such as change tracking proxies and entities that derive from ) + report changes automatically and a call to DetectChanges is not normally needed for these types of entities. + Also note that normally DetectChanges is called automatically by many of the methods of + and its related classes such that it is rare that this method will need to be called explicitly. + However, it may be desirable, usually for performance reasons, to turn off this automatic calling of + DetectChanges using the AutoDetectChangesEnabled flag from . + + + + + A non-generic version of the class. + + + + + This is an abstract base class use to represent a scalar or complex property, or a navigation property + of an entity. Scalar and complex properties use the derived class , + reference navigation properties use the derived class , and collection + navigation properties use the derived class . + + + + + Creates a from information in the given . + This method will create an instance of the appropriate subclass depending on the metadata contained + in the InternalMemberEntry instance. + + The internal member entry. + The new entry. + + + + Validates this property. + + + Collection of objects. Never null. If the entity is valid the collection will be empty. + + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the name of the property. + + The property name. + + + + Gets or sets the current value of this property. + + The current value. + + + + The to which this member belongs. + + An entry for the entity that owns this member. + + + + Gets the backing this object. + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal collection entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the collection of entities from the database. + Note that entities that already exist in the context are not overwritten with values from the database. + + + + + Returns the query that would be used to load this collection from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database, such + as counting the number of entities in the collection in the database without actually loading them. + + A query for the collection. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the collection element. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the collection of entities has been loaded from the database. + + true if the collection is loaded; otherwise, false. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Gets the backing this object as an . + + The internal member entry. + + + + Instances of this class are returned from the Collection method of + and allow operations such as loading to + be performed on the an entity's collection navigation properties. + + The type of the entity to which this property belongs. + The type of the element in the collection of entities. + + + + This is an abstract base class use to represent a scalar or complex property, or a navigation property + of an entity. Scalar and complex properties use the derived class , + reference navigation properties use the derived class , and collection + navigation properties use the derived class . + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + This method will create an instance of the appropriate subclass depending on the metadata contained + in the InternalMemberEntry instance. + + The internal member entry. + The new entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Validates this property. + + + Collection of objects. Never null. If the entity is valid the collection will be empty. + + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets the underlying . + + The internal member entry. + + + + The to which this member belongs. + + An entry for the entity that owns this member. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal collection entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the collection of entities from the database. + Note that entities that already exist in the context are not overwritten with values from the database. + + + + + Returns the query that would be used to load this collection from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database, such + as counting the number of entities in the collection in the database without actually loading them. + + A query for the collection. + + + + Returns a new instance of the non-generic class for + the navigation property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the collection of entities has been loaded from the database. + + true if the collection is loaded; otherwise, false. + + + + Gets the underlying as an . + + The internal member entry. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + An immutable representation of an Entity Data Model (EDM) model that can be used to create an + or can be passed to the constructor of a . + For increased performance, instances of this type should be cached and re-used to construct contexts. + + + + + For mocking. + + + + + Creates a model for the given EDM metadata model. + + The EDM metadata model. + + + + Creates an instance of ObjectContext or class derived from ObjectContext. Note that an instance + of DbContext can be created instead by using the appropriate DbContext constructor. + If a derived ObjectContext is used, then it must have a public constructor with a single + EntityConnection parameter. + The connection passed is used by the ObjectContext created, but is not owned by the context. The caller + must dispose of the connection once the context has been disposed. + + The type of context to create. + An existing connection to a database for use by the context. + + + + + Gets a cached delegate (or creates a new one) used to call the constructor for the given derived ObjectContext type. + + + + + A snapshot of the that was used to create this compiled model. + + + + + The provider info (provider name and manifest token) that was used to create this model. + + + + + A non-generic version of the class. + + + + + A non-generic version of the class. + + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the original value of this property. + + The original value. + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets or sets a value indicating whether the value of this property has been modified since + it was loaded from the database. + + + true if this instance is modified; otherwise, false. + + + + + The to which this property belongs. + + An entry for the entity that owns this property. + + + + The of the property for which this is a nested property. + This method will only return a non-null entry for properties of complex objects; it will + return null for properties of the entity itself. + + An entry for the parent complex property, or null if this is an entity property. + + + + Gets the backing this object. + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The name of the nested property. + An object representing the nested property. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the complex property. + The equivalent generic object. + + + + Instances of this class are returned from the ComplexProperty method of + and allow access to the state of a complex property. + + The type of the entity to which this property belongs. + The type of the property. + + + + Instances of this class are returned from the Property method of + and allow access to the state of the scalar + or complex property. + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the original value of this property. + + The original value. + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets or sets a value indicating whether the value of this property has been modified since + it was loaded from the database. + + + true if this instance is modified; otherwise, false. + + + + + The to which this property belongs. + + An entry for the entity that owns this property. + + + + The of the property for which this is a nested property. + This method will only return a non-null entry for properties of complex objects; it will + return null for properties of the entity itself. + + An entry for the parent complex property, or null if this is an entity property. + + + + Gets the underlying as an . + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The type of the nested property. + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The type of the nested property. + An expression representing the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The type of the nested property. + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The type of the nested property. + An expression representing the nested property. + An object representing the nested property. + + + + Describes the origin of the database connection string associated with a . + + + + + The connection string was created by convention. + + + + + The connection string was read from external configuration. + + + + + The connection string was explicitly specified at runtime. + + + + + The connection string was overriden by connection information supplied to DbContextInfo. + + + + + Returned by the Configuration method of to provide access to configuration + options for the context. + + + + + Initializes a new instance of the class. + + The internal context. + + + + Gets or sets a value indicating whether lazy loading of relationships exposed as + navigation properties is enabled. Lazy loading is enabled by default. + + true if lazy loading is enabled; otherwise, false. + + + + Gets or sets a value indicating whether or not the framework will create instances of + dynamically generated proxy classes whenever it creates an instance of an entity type. + Note that even if proxy creation is enabled with this flag, proxy instances will only + be created for entity types that meet the requirements for being proxied. + Proxy creation is enabled by default. + + true if proxy creation is enabled; otherwise, false. + + + + + Gets or sets a value indicating whether tracked entities should be validated automatically when + is invoked. + The default value is true. + + + + + Provides runtime information about a given type. + + + + + Creates a new instance representing a given type. + + The type deriving from . + + + + Creates a new instance representing a given targeting a specific database. + + The type deriving from . + Connection information for the database to be used. + + + + Creates a new instance representing a given type. An external list of + connection strings can be supplied and will be used during connection string resolution in place + of any connection strings specified in external configuration files. + + + It is preferable to use the constructor that accepts the entire config document instead of using this + constructor. Providing the entire config document allows DefaultConnectionFactroy entries in the config + to be found in addition to explicitly specified connection strings. + + The type deriving from . + A collection of connection strings. + + + + Creates a new instance representing a given type. An external config + object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + + The type deriving from . + An object representing the config file. + + + + Creates a new instance representing a given , targeting a specific database. + An external config object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + + The type deriving from . + An object representing the config file. + Connection information for the database to be used. + + + + Creates a new instance representing a given type. A + can be supplied in order to override the default determined provider used when constructing + the underlying EDM model. + + The type deriving from . + A specifying the underlying ADO.NET provider to target. + + + + Creates a new instance representing a given type. An external config + object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + A can be supplied in order to override the default determined + provider used when constructing the underlying EDM model. This can be useful to prevent EF from + connecting to discover a manifest token. + + The type deriving from . + An object representing the config file. + A specifying the underlying ADO.NET provider to target. + + + + Called internally when a context info is needed for an existing context, which may not be constructable. + + The context instance to get info from. + + + + If instances of the underlying type can be created, returns + a new instance; otherwise returns null. + + A instance. + + + + The concrete type. + + + + + Whether or not instances of the underlying type can be created. + + + + + The connection string used by the underlying type. + + + + + The connection string name used by the underlying type. + + + + + The ADO.NET provider name of the connection used by the underlying type. + + + + + The origin of the connection string used by the underlying type. + + + + + An action to be run on the DbModelBuilder after OnModelCreating has been run on the context. + + + + + A non-generic version of the class. + + + + + Initializes a new instance of the class. + + The internal entry. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + Note that changing the values in the returned dictionary will not update the values in the database. + If the entity is not found in the database then null is returned. + + The store values. + + + + Reloads the entity from the database overwriting any property values with values from the database. + The entity will be in the Unchanged state after calling this method. + + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The name of the property. + An object representing the property. + + + + Gets an object that represents a complex property of this entity. + + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The name of the member. + An object representing the member. + + + + Returns a new instance of the generic class for the given + generic type for the tracked entity represented by this object. + Note that the type of the tracked entity must be compatible with the generic type or + an exception will be thrown. + + The type of the entity. + A generic version. + + + + Validates this instance and returns validation result. + + + Entity validation result. Possibly null if + method is overridden. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the entity. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + + The original values. + + + + Gets InternalEntityEntry object for this DbEntityEntry instance. + + + + + Instances of this class provide access to information about and control of entities that + are being tracked by the . Use the Entity or Entities methods of + the context to obtain objects of this type. + + The type of the entity. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + Note that changing the values in the returned dictionary will not update the values in the database. + If the entity is not found in the database then null is returned. + + The store values. + + + + Reloads the entity from the database overwriting any property values with values from the database. + The entity will be in the Unchanged state after calling this method. + + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The type of the property. + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The type of the property. + An expression representing the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The type of elements in the collection. + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The type of elements in the collection. + An expression representing the navigation property. + An object representing the navigation property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The name of the property. + An object representing the property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The type of the property. + The name of the property. + An object representing the property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The type of the property. + An expression representing the property. + An object representing the property. + + + + Gets an object that represents a complex property of this entity. + + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a complex property of this entity. + + The type of the complex property. + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a complex property of this entity. + + The type of the complex property. + An expression representing the complex property. + An object representing the complex property. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The name of the member. + An object representing the member. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The type of the member. + The name of the member. + An object representing the member. + + + + Returns a new instance of the non-generic class for + the tracked entity represented by this object. + + A non-generic version. + + + + Validates this instance and returns validation result. + + + Entity validation result. Possibly null if + method is overridden. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the entity. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + + The original values. + + + + Represents an Entity Data Model (EDM) created by the . + The Compile method can be used to go from this EDM representation to a + which is a compiled snapshot of the model suitable for caching and creation of + or instances. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + Creates a for this mode which is a compiled snapshot + suitable for caching and creation of instances. + + The compiled model. + + + + A snapshot of the that was used to create this compiled model. + + + + + A collection of all the properties for an underlying entity or complex object. + + + An instance of this class can be converted to an instance of the generic class + using the Cast method. + Complex properties in the underlying entity or complex object are represented in + the property values as nested instances of this class. + + + + + Initializes a new instance of the class. + + The internal dictionary. + + + + Creates an object of the underlying type for this dictionary and hydrates it with property + values from this dictionary. + + The properties of this dictionary copied into a new object. + + + + Sets the values of this dictionary by reading values out of the given object. + The given object can be of any type. Any property on the object with a name that + matches a property name in the dictionary and can be read will be read. Other + properties will be ignored. This allows, for example, copying of properties from + simple Data Transfer Objects (DTOs). + + The object to read values from. + + + + Creates a new dictionary containing copies of all the properties in this dictionary. + Changes made to the new dictionary will not be reflected in this dictionary and vice versa. + + A clone of this dictionary. + + + + Sets the values of this dictionary by reading values from another dictionary. + The other dictionary must be based on the same type as this dictionary, or a type derived + from the type for this dictionary. + + The dictionary to read values from. + + + + Gets the value of the property just like using the indexed property getter but + typed to the type of the generic parameter. This is useful especially with + nested dictionaries to avoid writing expressions with lots of casts. + + The type of the property. + Name of the property. + The value of the property. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + Gets or sets the value of the property with the specified property name. + The value may be a nested instance of this class. + + The property name. + The value of the property. + + + + Gets the internal dictionary. + + The internal dictionary. + + + + A non-generic version of the class. + + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal reference entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the entity from the database. + Note that if the entity already exists in the context, then it will not overwritten with values from the database. + + + + + Returns the query that would be used to load this entity from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database. + + A query for the entity. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the entity has been loaded from the database. + + true if the entity is loaded; otherwise, false. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Gets the backing this object as an . + + The internal member entry. + + + + Instances of this class are returned from the Reference method of + and allow operations such as loading to + be performed on the an entity's reference navigation properties. + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal reference entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the entity from the database. + Note that if the entity already exists in the context, then it will not overwritten with values from the database. + + + + + Returns the query that would be used to load this entity from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database. + + A query for the entity. + + + + Returns a new instance of the non-generic class for + the navigation property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the entity has been loaded from the database. + + true if the entity is loaded; otherwise, false. + + + + Gets the underlying as an . + + The internal member entry. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Represents a SQL query for entities that is created from a + and is executed using the connection from that context. + Instances of this class are obtained from the instance for the + entity type. The query is not executed when this object is created; it is executed + each time it is enumerated, for example by using foreach. + SQL queries for non-entities are created using the . + See for a generic version of this class. + + + + + Initializes a new instance of the class. + + The internal query. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a new query where the results of the query will not be tracked by the associated + . + + A new query with no-tracking applied. + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Gets the internal query. + + The internal query. + + + + Returns false. + + false. + + + + Represents a SQL query for entities that is created from a + and is executed using the connection from that context. + Instances of this class are obtained from the instance for the + entity type. The query is not executed when this object is created; it is executed + each time it is enumerated, for example by using foreach. + SQL queries for non-entities are created using the . + See for a non-generic version of this class. + + + + + Executes the query and returns an enumerator for the elements. + + An + + object that can be used to iterate through the elements. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a new query where the results of the query will not be tracked by the associated + . + + A new query with no-tracking applied. + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Gets the internal query. + + The internal query. + + + + Returns false. + + false. + + + + Exception thrown by when it was expected that SaveChanges for an entity would + result in a database update but in fact no rows in the database were affected. This usually indicates + that the database has been concurrently updated such that a concurrency token that was expected to match + did not actually match. + Note that state entries referenced by this exception are not serialized due to security and accesses to + the state entries after serialization will return null. + + + + + + Initializes a new instance of the class. + + The internal context. + The inner exception. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Subscribes the SerializeObjectState event. + + + + + Gets objects that represents the entities that could not + be saved to the database. + + The entries representing the entities that could not be saved. + + + + Holds exception state that will be serialized when the exception is serialized. + + + + + Completes the deserialization. + + The deserialized object. + + + + Gets or sets a value indicating whether the exception involved independent associations. + + + + + Initializes a new instance of the class. + + The context. + The inner exception. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Represents an entity used to store metadata about an EDM in the database. + + + + + Attempts to get the model hash calculated by Code First for the given context. + This method will return null if the context is not being used in Code First mode. + + The context. + The hash string. + + + + Gets or sets the ID of the metadata entity, which is currently always 1. + + The id. + + + + Gets or sets the model hash which is used to check whether the model has + changed since the database was created from it. + + The model hash. + + + + Contains methods used to access the Entity Data Model created by Code First in the EDMX form. + These methods are typically used for debugging when there is a need to look at the model that + Code First creates internally. + + + + + Uses Code First with the given context and writes the resulting Entity Data Model to the given + writer in EDMX form. This method can only be used with context instances that use Code First + and create the model internally. The method cannot be used for contexts created using Database + First or Model First, for contexts created using a pre-existing , or + for contexts created using a pre-existing . + + The context. + The writer. + + + + Writes the Entity Data Model represented by the given to the + given writer in EDMX form. + + An object representing the EDM. + The writer. + + + + A factory for creating derived instances. Implement this + interface to enable design-time services for context types that do not have a + public default constructor. + + At design-time, derived instances can be created in order to enable specific + design-time experiences such as model rendering, DDL generation etc. To enable design-time instantiation + for derived types that do not have a public, default constructor, implement + this interface. Design-time services will auto-discover implementations of this interface that are in the + same assembly as the derived type. + + + + + + Creates a new instance of a derived type. + + An instance of TContext + + + + This convention causes DbModelBuilder to include metadata about the model + when it builds the model. When creates a model by convention it will + add this convention to the list of those used by the DbModelBuilder. This will then result in + model metadata being written to the database if the DbContext is used to create the database. + This can then be used as a quick check to see if the model has changed since the last time it was + used against the database. + This convention can be removed from the conventions by overriding + the OnModelCreating method on a derived DbContext class. + + + + + Adds metadata to the given model configuration. + + The model configuration. + + + + This convention uses the name of the derived + class as the container for the conceptual model built by + Code First. + + + + + Initializes a new instance of the class. + + The model container name. + + + + Applies the convention to the given model. + + The model. + + + + This convention uses the namespace of the derived + class as the namespace of the conceptual model built by + Code First. + + + + + Initializes a new instance of the class. + + The model namespace. + + + + Applies the convention to the given model. + + The model. + + + + Instances of this class are used internally to create constant expressions for + that are inserted into the expression tree to replace references to + and . + + The type of the element. + + + + Private constructor called by the Create factory method. + + The query. + + + + Factory method called by CreateDelegate to create an instance of this class. + + The query, which must be a generic object of the expected type. + A new instance. + + + + The public property expected in the LINQ expression tree. + + The query. + + + + Instances of this class are used to create DbConnection objects for + SQL Server Compact Edition based on a given database name or connection string. + + + It is necessary to provide the provider invariant name of the SQL Server Compact + Edition to use when creating an instance of this class. This is because different + versions of SQL Server Compact Editions use different invariant names. + An instance of this class can be set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use SQL Server Compact Edition by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Creates a new connection factory with empty (default) DatabaseDirectory and BaseConnectionString + properties. + + The provider invariant name that specifies the version of SQL Server Compact Edition that should be used. + + + + Creates a new connection factory with the given DatabaseDirectory and BaseConnectionString properties. + + + The provider invariant name that specifies the version of SQL Server Compact Edition that should be used. + + + The path to prepend to the database name that will form the file name used by SQL Server Compact Edition + when it creates or reads the database file. An empty string means that SQL Server Compact Edition will use + its default for the database file location. + + + The connection string to use for options to the database other than the 'Data Source'. The Data Source will + be prepended to this string based on the database name when CreateConnection is called. + + + + + Creates a connection for SQL Server Compact Edition based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + The path to prepend to the database name that will form the file name used by + SQL Server Compact Edition when it creates or reads the database file. + The default value is "|DataDirectory|", which means the file will be placed + in the designated data directory. + + + + + The connection string to use for options to the database other than the 'Data Source'. + The Data Source will be prepended to this string based on the database name when + CreateConnection is called. + The default is the empty string, which means no other options will be used. + + + + + The provider invariant name that specifies the version of SQL Server Compact Edition + that should be used. + + + + + Instances of this class are used to create DbConnection objects for + SQL Server based on a given database name or connection string. By default, the connection is + made to '.\SQLEXPRESS'. This can be changed by changing the base connection + string when constructing a factory instance. + + + An instance of this class can be set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use SQL Server by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Creates a new connection factory with a default BaseConnectionString property of + 'Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True'. + + + + + Creates a new connection factory with the given BaseConnectionString property. + + + The connection string to use for options to the database other than the 'Initial Catalog'. The 'Initial Catalog' will + be prepended to this string based on the database name when CreateConnection is called. + + + + + Creates a connection for SQL Server based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + Remove hard dependency on DbProviderFactories. + + + + + The connection string to use for options to the database other than the 'Initial Catalog'. + The 'Initial Catalog' will be prepended to this string based on the database name when + CreateConnection is called. + The default is 'Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True'. + + + + + This attribute can be applied to either an entire derived class or to + individual or properties on that class. When applied + any discovered or properties will still be included + in the model but will not be automatically initialized. + + + + + Thrown when a context is generated from the templates in Database First or Model + First mode and is then used in Code First mode. + + + Code generated using the T4 templates provided for Database First and Model First use may not work + correctly if used in Code First mode. To use these classes with Code First please add any additional + configuration using attributes or the DbModelBuilder API and then remove the code that throws this + exception. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The object that holds the serialized object data. + The contextual information about the source or destination. + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Implements ICachedMetadataWorkspace for a Code First model. + + + + + Represents an object that holds a cached copy of a MetadataWorkspace and optionally the + assemblies containing entity types to use with that workspace. + + + + + Gets the MetadataWorkspace, potentially lazily creating it if it does not already exist. + If the workspace is not compatible with the provider manifest obtained from the given + connection then an exception is thrown. + + The connection to use to create or check SSDL provider info. + The workspace. + + + + The list of assemblies that contain entity types for this workspace, which may be empty, but + will never be null. + + + + + The default container name for code first is the container name that is set from the DbModelBuilder + + + + + The provider info used to construct the workspace. + + + + + Builds and stores the workspace based on the given code first configuration. + + The code first EDM model. + + + + Gets the . + If the workspace is not compatible with the provider manifest obtained from the given + connection then an exception is thrown. + + The connection to use to create or check SSDL provider info. + The workspace. + + + + The default container name for code first is the container name that is set from the DbModelBuilder + + + + + The list of assemblies that contain entity types for this workspace, which may be empty, but + will never be null. + + + + + The provider info used to construct the workspace. + + + + + The methods here are called from multiple places with an ObjectContext that may have + been created in a variety of ways and ensure that the same code is run regardless of + how the context was created. + + + + + Used a delegate to do the actual creation once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + Note however that a context obtained from only a connection will have no model and so + will result in an empty database. + + + + + Used a delegate to do the actual existence check once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + + + + + Used a delegate to do the actual check/delete once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given set of entity types and DbSet initializer delegate. + + + + + The entity types part of the pair. + + + + + The DbSet properties initializer part of the pair. + + + + + Static helper methods only. + + + + + Checks whether the given value is null and throws ArgumentNullException if it is. + This method should only be used in places where Code Contracts are compiled out in the + release build but we still need public surface null-checking, such as where a public + abstract class is implemented by an internal concrete class. + + + + + Checks whether the given string is null, empty, or just whitespace, and throws appropriately + if the check fails. + This method should only be used in places where Code Contracts are compiled out in the + release build but we still need public surface checking, such as where a public + abstract class is implemented by an internal concrete class. + + + + + Given two key values that may or may not be byte arrays, this method determines + whether or not they are equal. For non-binary key values, this is equivalent + to Object.Equals. For binary keys, it is by comparison of every byte in the + arrays. + + + + + Provides a standard helper method for quoting identifiers + + Identifier to be quoted. Does not validate that this identifier is valid. + Quoted string + + + + Checks the given string which might be a database name or a connection string and determines + whether it should be treated as a name or connection string. Currently, the test is simply + whether or not the string contains an '=' character--if it does, then it should be treated + as a connection string. + + The name or connection string. + true if the string should be treated as a connection string; false if it should be treated as a name. + + + + Determines whether the given string should be treated as a database name directly (it contains no '='), + is in the form name=foo, or is some other connection string. If it is a direct name or has name=, then + the name is extracted and the method returns true. + + The name or connection string. + The name. + True if a name is found; false otherwise. + + + + Determines whether the given string is a full EF connection string with provider, provider connection string, + and metadata parts, or is is instead some other form of connection string. + + The name or connection string. + true if the given string is an EF connection string; otherwise, false. + + + + + Parses a property selector expression used for the expression-based versions of the Property, Collection, Reference, + etc methods on and + classes. + + The type of the entity. + The type of the property. + The property. + Name of the method. + Name of the param. + The property name. + + + + Called recursively to parse an expression tree representing a property path such + as can be passed to Include or the Reference/Collection/Property methods of . + This involves parsing simple property accesses like o => o.Products as well as calls to Select like + o => o.Products.Select(p => p.OrderLines). + + The expression to parse. + The expression parsed into an include path, or null if the expression did not match. + True if matching succeeded; false if the expression could not be parsed. + + + + Gets a cached dictionary mapping property names to property types for all the properties + in the given type. + + + + + Gets a dictionary of compiled property setter delegates for the underlying types. + The dictionary is cached for the type in the app domain. + + + + + Used by the property setter delegates to throw for attempts to set null onto + non-nullable properties or otherwise go ahead and set the property. + + + + + Gets a dictionary of compiled property getter delegates for the underlying types. + The dictionary is cached for the type in the app domain. + + + + + Creates a new with the NoTracking merge option applied. + The query object passed in is not changed. + + The query. + A new query with NoTracking applied. + + + + Converts to + + + Name of the property being validated with ValidationAttributes. Null for type-level validation. + + + ValidationResults instances to be converted to instances. + + + An created based on the + . + + + class contains a property with names of properties the error applies to. + On the other hand each applies at most to a single property. As a result for + each name in ValidationResult.MemberNames one will be created (with some + exceptions for special cases like null or empty .MemberNames or null names in the .MemberNames). + + + + + Calculates a "path" to a property. For primitive properties on an entity type it is just the + name of the property. Otherwise it is a dot separated list of names of the property and all + its ancestor properties starting from the entity. + + Property for which to calculate the path. + Dot separated path to the property. + + + + Gets names of the property and its ancestor properties as enumerable walking "bottom-up". + + Property for which to get the segments. + Names of the property and its ancestor properties. + + + + Gets an type for the given element type. + + Type of the element. + The collection type. + + + + Creates a database name given a type derived from DbContext. This handles nested and + generic classes. No attempt is made to ensure that the name is not too long since this + is provider specific. If a too long name is generated then the provider will throw and + the user must correct by specifying their own name in the DbContext constructor. + + Type of the context. + The database name to use. + + + + A local (in-memory) view of the entities in a DbSet. + This view contains Added entities and does not contain Deleted entities. The view extends + from and hooks up events between the collection and the + state manager to keep the view in sync. + + The type of the entity. + + + + Initializes a new instance of the class for entities + of the given generic type in the given internal context. + + The internal context. + + + + Called by the base class when the collection changes. + This method looks at the change made to the collection and reflects those changes in the + state manager. + + The instance containing the event data. + + + + Handles events from the state manager for entities entering, leaving, or being marked as deleted. + The local view is kept in sync with these changes. + + The sender. + The instance containing the event data. + + + + Clears the items by calling remove on each item such that we get Remove events that + can be tracked back to the state manager, rather than a single Reset event that we + cannot deal with. + + + + + Adds a contains check to the base implementation of InsertItem since we can't support + duplicate entities in the set. + + The index at which to insert. + The item to insert. + + + + Returns a cached binding list implementation backed by this ObservableCollection. + + The binding list. + + + + Service used to search for instance properties on a DbContext class that can + be assigned a DbSet instance. Also, if the the property has a public setter, + then a delegate is compiled to set the property to a new instance of DbSet. + All of this information is cached per app domain. + + + + + Creates a set discovery service for the given derived context. + + + + + Processes the given context type to determine the DbSet or IDbSet + properties and collect root entity types from those properties. Also, delegates are + created to initialize any of these properties that have public setters. + If the type has been processed previously in the app domain, then all this information + is returned from a cache. + + A dictionary of potential entity type to the list of the names of the properties that used the type. + + + + Calls the public setter on any property found to initialize it to a new instance of DbSet. + + + + + Registers the entities and their entity set name hints with the given . + + The model builder. + + + + Returns false if SuppressDbSetInitializationAttribute is found on the property or the class, otherwise + returns true. + + + + + Determines whether or not an instance of DbSet/ObjectSet can be assigned to a property of the given type. + + The type to check. + The entity type of the DbSet/ObjectSet that can be assigned, or null if no set type can be assigned. + + + + + A EagerInternalConnection object wraps an already existing DbConnection object. + + + + + InternalConnection objects manage DbConnections. + Two concrete base classes of this abstract interface exist: + and . + + + + + IInternalConnection objects manage DbConnections. + Two concrete implementations of this interface exist--LazyInternalConnection and EagerInternalConnection. + + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Returns the underlying DbConnection. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if the connection contains model info; otherwise, false. + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strins. + + + + + Gets or sets the provider to be used when creating the underlying connection. + + + + + Gets the name of the underlying connection string. + + + + + Gets the original connection string. + + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Called after the connection is initialized for the first time. + + + + + Adds a tracking cookie to the connection string for SqlConnections. Returns the + possibly modified store connection string. + + + + + Returns the underlying DbConnection. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if the connection contains model info; otherwise, false. + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strins. + + + + + Gets or sets the provider to be used when creating the underlying connection. + + + + + Gets the name of the underlying connection string. + + + + + Gets the original connection string. + + + + + Gets or sets the underlying object. No initialization is done when the + connection is obtained, and it can also be set to null. + + The underlying connection. + + + + Creates a new EagerInternalConnection that wraps an existing DbConnection. + + An existing connection. + If set to true then the underlying connection should be disposed when this object is disposed. + + + + Dispose the existing connection is the original caller has specified that it should be disposed + by the framework. + + + + + Returns the origin of the underlying connection string. + + + + + An is an where the + instance that it wraps is set immediately at construction time rather than being created lazily. In this case + the internal context may or may not own the instance but will only dispose it + if it does own it. + + + + + An underlies every instance of and wraps an + instance. + The also acts to expose necessary information to other parts of the design in a + controlled manner without adding a lot of internal methods and properties to the + class itself. + Two concrete classes derive from this abstract class - and + . + + + + + Initializes the object with its owner. + + The owner . + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Creates a new temporary based on the same metadata and connection as the real + and sets it as the context to use DisposeTempObjectContext is called. + This allows this internal context and its DbContext to be used for transient operations + such as initializing and seeding the database, after which it can be thrown away. + This isolates the real from any changes made and and saves performed. + + + + + If a temporary ObjectContext was set with UseTempObjectContext, then this method disposes that context + and returns this internal context and its DbContext to using the real ObjectContext. + + + + + Called by methods of to create a database either using the Migrations pipeline + if possible and the core provider otherwise. + + The context to use for core provider calls. + + + + Internal implementation of . + + True if the model hash in the context and the database match; false otherwise. + + + + Checks whether the given model (an EDMX document) matches the current model. + + + + + Queries the database for a model hash and returns it if found or returns null if the table + or the row doesn't exist in the database. + + The model hash, or null if not found. + + + + Queries the database for a model stored in the MigrationHistory table and returns it as an EDMX, or returns + null if the database does not contain a model. + + + + + Saves the model hash from the context to the database. + + + + + Performs the initialization action that may result in a and + handle the exception to provide more meaning to the user. + + The action. + + + + Registers for the ObjectStateManagerChanged event on the underlying ObjectStateManager. + This is a virtual method on this class so that it can be mocked. + + The event handler. + + + + Checks whether or not the given object is in the context in any state other than Deleted. + This is a virtual method on this class so that it can be mocked. + + The entity. + true if the entity is in the context and not deleted; otherwise false. + + + + Saves all changes made in this context to the underlying database. + + The number of objects written to the underlying database. + + + + Initializes this instance, which means both the context is initialized and the underlying + database is initialized. + + + + + Initializes the underlying ObjectContext but does not cause the database to be initialized. + + + + + Marks the database as having not been initialized. This is called when the app calls Database.Delete so + that the database if the app attempts to then use the database again it will be re-initialized automatically. + + + + + Runs the unless it has already been run or there + is no initializer for this context type in which case this method does nothing. + + + + + Marks the database as having been initialized without actually running the . + + + + + Runs the if one has been set for this context type. + Calling this method will always cause the initializer to run even if the database is marked + as initialized. + + + + + Disposes the context. Override the DisposeContext method to perform + additional work when disposing. + + + + + Performs additional work to dispose a context. + + + + + Calls DetectChanges on the underlying if AutoDetectChangesEnabled is + true or if force is set to true. + + if set to true then DetectChanges is called regardless of the value of AutoDetectChangesEnabled. + + + + Returns the DbSet instance for the given entity type. + This property is virtual and returns to that it can be mocked. + + The entity type for which a set should be returned. + A set for the given entity type. + + + + Returns the non-generic instance for the given entity type. + This property is virtual and returns to that it can be mocked. + + The entity type for which a set should be returned. + A set for the given entity type. + + + + Creates an internal set using an app domain cached delegate. + + Type of the entity. + The set. + + + + Returns the entity set and the base type for that entity set for the given type. + This method does o-space loading if required and throws if the type is not in the model. + + The entity type to lookup. + The entity set and base type pair. + + + + Returns the entity set and the base type for that entity set for the given type if that + type is mapped in the model, otherwise returns null. + This method does o-space loading if required. + + The entity type to lookup. + The entity set and base type pair, or null if not found. + + + + Checks whether or not the given entity type is mapped in the model. + + The entity type to lookup. + True if the type is mapped as an entity; false otherwise. + + + + Gets the local entities of the type specified from the state manager. That is, all + Added, Modified, and Unchanged entities of the given type. + + The type of entity to get. + The entities. + + + + Executes the given SQL query against the database backing this context. The results are not materialized as + entities or tracked. + + The type of the element. + The SQL. + The parameters. + The query results. + + + + Executes the given SQL query against the database backing this context. The results are not materialized as + entities or tracked. + + Type of the element. + The SQL. + The parameters. + The query results. + + + + Calls the generic ExecuteSqlQuery but with a non-generic return type so that it + has the correct signature to be used with CreateDelegate above. + + + + + Executes the given SQL command against the database backing this context. + + The SQL. + The parameters. + The return value from the database. + + + + Gets the underlying for the given entity, or returns null if the entity isn't tracked by this context. + This method is virtual so that it can be mocked. + + The entity. + The state entry or null. + + + + Gets the underlying objects for all entities tracked by + this context. + This method is virtual so that it can be mocked. + + State entries for all tracked entities. + + + + Gets the underlying objects for all entities of the given + type tracked by this context. + This method is virtual so that it can be mocked. + + The type of the entity. + State entries for all tracked entities of the given type. + + + + Helper method that gets the underlying objects for all entities that + match the given predicate. + + + + + Wraps the given in either a or + a depending on the actual exception type and the state + entries involved. + + The update exception. + A new exception wrapping the given exception. + + + + Uses the underlying context to create an entity such that if the context is configured + to create proxies and the entity is suitable then a proxy instance will be returned. + This method is virtual so that it can be mocked. + + The type of the entity. + The new entity instance. + + + + Uses the underlying context to create an entity such that if the context is configured + to create proxies and the entity is suitable then a proxy instance will be returned. + This method is virtual so that it can be mocked. + + The type of entity to create. + The new entity instance. + + + + This method is used by CreateDelegate to transform the CreateObject method with return type TEntity + into a method with return type object which matches the required type of the delegate. + + + + + Replaces the connection that will be used by this context. + The connection can only be changed before the context is initialized. + + The new connection. + + + + Throws if the context has been disposed. + + + + + Checks whether or not the internal cache of types to entity sets has been initialized, + and initializes it if necessary. + + + + + Forces all DbSets to be initialized, which in turn causes o-space loading to happen + for any entity type for which we have a DbSet. This includes all DbSets that were + discovered on the user's DbContext type. + + + + + Performs o-space loading for the type and returns false if the type is not in the model. + + + + + Performs o-space loading for the type and throws if the type is not in the model. + + Type of the entity. + + + + Returns true if the given entity type does not have EdmEntityTypeAttribute but is in + an assembly that has EdmSchemaAttribute. This indicates mixing of POCO and EOCO in the + same assembly, which is something that we don't support. + + + + + Determines whether or not the given clrType is mapped to a complex type. Assumes o-space loading has happened. + + + + + Updates the cache of types to entity sets either for the first time or after potentially + doing some o-space loading. + + + + + The public context instance that owns this internal context. + + + + + Returns the underlying . + + + + + Gets the temp object context, or null if none has been set. + + The temp object context. + + + + The compiled model created from the Code First pipeline, or null if Code First was + not used to create this context. + Causes the Code First pipeline to be run to create the model if it has not already been + created. + + + + + Set to true when a database initializer is performing some actions, such as creating or deleting + a database, or seeding the database. + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + Gets or sets a value indicating whether lazy loading is enabled. + + + + + Gets or sets a value indicating whether proxy creation is enabled. + + + + + Gets or sets a value indicating whether DetectChanges is called automatically in the API. + + + + + Gets or sets a value indicating whether to validate entities when is called. + + + + + True if the context has been disposed. + + + + + The connection underlying this context. Accessing this property does not cause the context + to be initialized, only its connection. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries, + database intializers and connection strings. + + + + + Gets or sets the provider details to be used when building the EDM model. + + + + + Gets the name of the underlying connection string. + + + + + Gets the provider name bsing used either using a cached value or getting it from + the DbConnection in use. + + + + + Gets or sets a custom OnModelCreating action. + + + + + Gets the DatabaseOperations instance to use to perform Create/Delete/Exists operations + against the database. + Note that this virtual property can be mocked to help with unit testing. + + + + + Gets instance used to create validators and validation contexts. + This property is virtual to allow mocking. + + + + + For mocking. + + + + + Constructs an for an already existing . + + The owner . + The existing . + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Does nothing, since the already exists. + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Disposes the context. The underlying is also disposed if it is owned. + + + + + + + + Returns the underlying . + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + The connection underlying this context. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets a value indicating whether lazy loading is enabled. This is just a wrapper + over the same flag in the underlying . + + + + + Gets or sets a value indicating whether proxy creation is enabled. This is just a wrapper + over the same flag in the underlying ObjectContext. + + + + + An implementation of that represents a clone of another + dictionary. That is, all the property values have been been copied into this dictionary. + + + + + The internal class used to implement . + This internal class allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal context with which the entity of complex object is associated. + The type of the entity or complex object. + If set to true this is a dictionary for an entity, otherwise it is a dictionary for a complex object. + + + + Implemented by subclasses to get the dictionary item for a given property name. + Checking that the name is valid should happen before this method is called such + that subclasses do not need to perform the check. + + Name of the property. + An item for the given name. + + + + Creates an object of the underlying type for this dictionary and hydrates it with property + values from this dictionary. + + The properties of this dictionary copied into a new object. + + + + Creates an instance of the underlying type for this dictionary, which may either be an entity type (in which + case CreateObject on the context is used) or a non-entity type (in which case the empty constructor is used.) + In either case, app domain cached compiled delegates are used to do the creation. + + + + + Sets the values of this dictionary by reading values out of the given object. + The given object must be of the type that this dictionary is based on. + + The object to read values from. + + + + Creates a new dictionary containing copies of all the properties in this dictionary. + Changes made to the new dictionary will not be reflected in this dictionary and vice versa. + + A clone of this dictionary. + + + + Sets the values of this dictionary by reading values from another dictionary. + The other dictionary must be based on the same type as this dictionary, or a type derived + from the type for this dictionary. + + The dictionary to read values from. + + + + Gets the dictionary item for the property with the given name. + This method checks that the given name is valid. + + The property name. + The item. + + + + Sets the value of the property only if it is different from the current value and is not + an invalid attempt to set a complex property. + + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + Gets or sets the value of the property with the specified property name. + The value may be a nested instance of this class. + + The property name. + The value of the property. + + + + Gets the entity type of complex type that this dictionary is based on. + + The type of the object underlying this dictionary. + + + + Gets the internal context with which the underlying entity or complex type is associated. + + The internal context. + + + + Gets a value indicating whether the object for this dictionary is an entity or a complex object. + + true if this this is a dictionary for an entity; false if it is a dictionary for a complex object. + + + + Initializes a new instance of the class by copying + values from the given dictionary. + + The dictionary to clone. + If non-null, then the values for the new dictionary are taken from this record rather than from the original dictionary. + + + + Gets the dictionary item for a given property name. + + Name of the property. + An item for the given name. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + An implementation of for an item in a . + + + + + Represents an item in an representing a property name/value. + + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + true If this instance represents a complex property; otherwise, false. + + + + Gets the type of the underlying property. + + The property type. + + + + Initializes a new instance of the class. + + The name. + The value. + The type. + If set to true this item represents a complex property. + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + + true If this instance represents a complex property; otherwise, false. + + + + + Gets the type of the underlying property. + + The property type. + + + + An implementation of that is based on an existing + instance. + + + + + Initializes a new instance of the class. + + The internal context. + The type. + The data record. + If set to true this is a dictionary for an entity, otherwise it is a dictionary for a complex object. + + + + Gets the dictionary item for a given property name. + + Name of the property. + An item for the given name. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + An implementation of for an item in a . + + + + + Initializes a new instance of the class. + + The data record. + The ordinal. + The value. + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + + true If this instance represents a complex property; otherwise, false. + + + + + Gets the type of the underlying property. + + The property type. + + + + This is version of an internal interface that already exists in System.Data.Entity that + is implemented by . Using this interface allows state + entries to be mocked for unit testing. The plan is to remove this version of the + interface and use the one in System.Data.Entity once we roll into the framework. + Note that some members may need to be added to the interface in the framework when + we combine the two. + + + + + The internal class used to implement and + . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Base class for and + containing common code for collection and reference navigation property entries. + + + + + Base class for all internal entries that represent different kinds of properties. + + + + + Initializes a new instance of the class. + + The internal entity entry. + The member metadata. + + + + Validates this property. + + A sequence of validation errors for this property. Empty if no errors. Never null. + + + + Creates a new non-generic backed by this internal entry. + The actual subtype of the DbMemberEntry created depends on the metadata of this internal entry. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The actual subtype of the DbMemberEntry created depends on the metadata of this internal entry. + + The type of the entity. + The type of the property. + The new entry. + + + + Gets the property name. + The property is virtual to allow mocking. + + The property name. + + + + Gets or sets the current value of the navigation property. + + The current value. + + + + Gets the internal entity entry property belongs to. + This property is virtual to allow mocking. + + The internal entity entry. + + + + Gets the entry metadata. + + The entry metadata. + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Calls Load on the underlying . + + + + + Uses CreateSourceQuery on the underlying to create a query for this + navigation property. + + + + + Gets the navigation property value from the object. + + The entity. + The navigation property value. + + + + Validates that the owning entity entry is associated with an underlying and + is not just wrapping a non-attached entity. + If the entity is not detached, then the RelatedEnd for this navigation property is obtained. + + + + + Calls IsLoaded on the underlying . + + + + + Gets the related end, which will be null if the entity is not being tracked. + + The related end. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + This property is virtual so that it can be mocked. + + The current value. + + + + Gets a delegate that can be used to get the value of the property directly from the entity. + Returns null if the property does not have an accessible getter. + + The getter delegate, or null. + + + + Gets a delegate that can be used to set the value of the property directly on the entity. + Returns null if the property does not have an accessible setter. + + The setter delegate, or null. + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Gets the navigation property value from the object. + Since for a collection the related end is an , it means + that the internal representation of the navigation property is just the related end. + + The entity. + The navigation property value. + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Creates a new generic backed by this internal entry. + The actual subtype of the DbCollectionEntry created depends on the metadata of this internal entry. + + The type of the entity. + The type of the element. + The new entry. + + + + Creates a object for the given entity type + and collection element type. + + The type of the entity. + The type of the property. + Type of the element. + The set. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + + The current value. + + + + The internal class used to implement + and . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal context. + The state entry. + + + + Initializes a new instance of the class for an + entity which may or may not be attached to the context. + + The internal context. + The entity. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + + The store values. + + + + Appends a query for the properties in the entity to the given string builder that is being used to + build the eSQL query. This method may be called recursively to query for all the sub-properties of + a complex property. + + The query builder. + The qualifier with which to prefix each property name. + The dictionary that acts as a template for the properties to query. + + + + Validates that a dictionary can be obtained for the state of the entity represented by this entry. + + The method name being used to request a dictionary. + The state that is invalid for the request being processed. + + + + Calls Refresh with StoreWins on the underlying state entry. + + + + + Gets an internal object representing a reference navigation property. + This method is virtual to allow mocking. + + The navigation property. + The type of entity requested, which may be 'object' or null if any type can be accepted. + The entry. + + + + Gets an internal object representing a collection navigation property. + This method is virtual to allow mocking. + + The navigation property. + The type of entity requested, which may be 'object' or null f any type can be accepted. + The entry. + + + + Gets an internal object representing a navigation, scalar, or complex property. + This method is virtual to allow mocking. + + Name of the property. + The type of entity requested, which may be 'object' if any type can be accepted. + The entry. + + + + Gets an internal object representing a scalar or complex property. + This method is virtual to allow mocking. + + The property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Gets an internal object representing a scalar or complex property. + The property may be a nested property on the given . + + The parent property entry, or null if this is a property directly on the entity. + Name of the property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Gets an internal object representing a scalar or complex property. + The property may be a nested property on the given . + + The parent property entry, or null if this is a property directly on the entity. + Name of the property. + The property split out into its parts. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Checks that the given property name is a navigation property and is either a reference property or + collection property according to the value of requireCollection. + + + + + Gets metadata for the given property if that property is a navigation property or returns null + if it is not a navigation property. + + Name of the property. + Navigation property metadata or null. + + + + Gets the type of entity or entities at the target end of the given navigation property. + + The navigation property. + The CLR type of the entity or entities at the other end. + + + + Gets the related end for the navigation property with the given name. + + The navigation property. + + + + + Uses EDM metadata to validate that the property name exists in the model and represents a scalar or + complex property or exists in the CLR type. + This method is public and virtual so that it can be mocked. + + The property name. + The type on which the property is declared. + The type of object requested, which may be 'object' if any type can be accepted. + Metadata for the property. + + + + Splits the given property name into parts delimited by dots. + + Name of the property. + The parts of the name. + + + + Validates that this entry is associated with an underlying and + is not just wrapping a non-attached entity. + + + + + Validates entity represented by this entity entry. + This method is virtual to allow mocking. + + User defined dictionary containing additional info for custom validation. This parameter is optional and can be null. + containing validation result. Never null. + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the tracked entity. + This property is virtual to allow mocking. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + This property is virtual to allow mocking. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + This property is virtual to allow mocking. + + The original values. + + + + Checks whether or not this entry is associated with an underlying or + is just wrapping a non-attached entity. + + + + + Gets the type of the entity being tracked. + + The type of the entity. + + + + Gets the c-space entity type for this entity from the EDM. + + + + + Gets the underlying object state entry. + + + + + Gets the internal context. + + The internal context. + + + + A concrete implementation of used for properties of entities. + + + + + The internal class used to implement and + . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal entry. + The property info. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. If this is a property of an entity, then this method returns + true if the property is modified. If this is a property of a complex object, then + this method returns true if the top-level complex property on the entity is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + If this is a property of an entity, then this method marks it as modified. + If this is a property of a complex object, then this method marks the top-level + complex property as modified. + + + + + Throws if the user attempts to set a complex property to null. + + The value. + + + + Sets the given value directly onto the underlying entity object. + + The value. + True if the property had a setter that we could attempt to call; false if no setter was available. + + + + Sets the property value, potentially by setting individual nested values for a complex + property. + + The value. + + + + Gets an internal object representing a scalar or complex property of this property, + which must be a mapped complex property. + This method is virtual to allow mocking. + + The property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Validates that the owning entity entry is associated with an underlying and + is not just wrapping a non-attached entity. + + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent entity or complex property. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent entity or complex property. + That is, the original values that contains the value for this property. + + The parent original values. + + + + A delegate that reads the value of this property. + May be null if there is no way to set the value due to missing accessors on the type. + + + + + A delegate that sets the value of this property. + May be null if there is no way to set the value due to missing accessors on the type. + + + + + Gets or sets the original value. + Note that complex properties are returned as objects, not property values. + + + + + Gets or sets the current value. + Note that complex properties are returned as objects, not property values. + Also, for complex properties, the object returned is the actual complex object from the entity + and setting the complex object causes the actual object passed to be set onto the entity. + + The current value. + + + + Gets or sets a value indicating whether this property is modified. + + + + + Gets the property metadata. + + The property metadata. + + + + Initializes a new instance of the class. + + The internal entry. + The property info. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. Since this is a property of an entity this method returns + true if the property is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + Since this is a property of an entity this method marks it as modified. + + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent entity. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent entity. + That is, the original values that contains the value for this property. + + The parent original values. + + + + A concrete implementation of used for properties of complex objects. + + + + + Initializes a new instance of the class. + + The parent property entry. + The property metadata. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. Since this is a property of a complex object + this method returns true if the top-level complex property on the entity is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + Since this is a property of a complex object this method marks the top-level + complex property as modified. + + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent complex property. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent complex property. + That is, the original values that contains the value for this property. + + The parent original values. + + + + The internal class used to implement , + and . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Gets the navigation property value from the object. + For reference navigation properties, this means getting the value from the + object. + + The entity. + The navigation property value. + + + + Sets the navigation property value onto the object. + For reference navigation properties, this means setting the value onto the + object. + + The entity. + The value. + + + + Sets the given value on the given which must be an + . + This method is setup in such a way that it can easily be used by CreateDelegate without any + dynamic code generation needed. + + The type of the related entity. + The entity reference. + The value. + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + + The current value. + + + + Contains metadata about a member of an entity type or complex type. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry if the new entry is nested, otherwise null. + The new entry. + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets the name of the property. + + The name. + + + + Gets the type of the entity or complex object that on which the member is declared. + + The type that the member is declared on. + + + + Gets the type of element for the property, which for non-collection properties + is the same as the MemberType and which for collection properties is the type + of element contained in the collection. + + The type of the element. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + The types of member entries supported. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + if set to true this is a collection nav prop. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry which will always be null for navigation entries. + The new entry. + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + Contains metadata for a property of a complex object or entity. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + if set to true the property is mapped in the EDM. + if set to true the property is a complex property. + + + + Validates that the given name is a property of the declaring type (either on the CLR type or in the EDM) + and that it is a complex or scalar property rather than a nav property and then returns metadata about + the property. + + The internal context. + The type that the property is declared on. + The type of property requested, which may be 'object' if any type can be accepted. + Name of the property. + Metadata about the property, or null if the property does not exist or is a navigation property. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry if the new entry is nested, otherwise null. + The new entry. + + + + Gets a value indicating whether this is a complex property. + That is, not whether or not this is a property on a complex object, but rather if the + property itself is a complex property. + + + true if this instance is complex; otherwise, false. + + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets a value indicating whether this instance is mapped in the EDM. + + true if this instance is mapped; otherwise, false. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + An implementation of that wraps an existing set but makes + it read-only. + + + + + + Initializes a new instance of the class wrapped around + another existing set. + + The existing set. + + + + This is a temporary adapter class that wraps an and + presents it as an . This class will be removed once + we roll into the System.Data.Entity assembly. See + for more details. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given EntitySet and BaseType. + + + + + The EntitySet part of the pair. + + + + + The BaseType part of the pair. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given database initializer delegate and a flag + indicating whether or not it is locked. + + + + + The initializer delegate. + + + + + A flag indicating whether or not the initializer is locked and should not be changed. + + + + + Represents a raw SQL query against the context for any type where the results are never + associated with an entity set and are never tracked. + + + + + Represents a raw SQL query against the context that may be for entities in an entity set + or for some other non-entity element type. + + + + + Initializes a new instance of the class. + + The SQL. + The parameters. + + + + If the query is would track entities, then this method returns a new query that will + not track entities. + + A no-tracking query. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Gets the SQL query string, + + The SQL query. + + + + Gets the parameters. + + The parameters. + + + + Returns false. + + false. + + + + Initializes a new instance of the class. + + The internal context. + Type of the element. + The SQL. + The parameters. + + + + Returns this query since it can never be a tracking query. + + This instance. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Generic wrapper around to allow results to be + returned as generic + + The type of the element. + + + + Executes the query and returns an enumerator for the elements. + + An + + object that can be used to iterate through the elements. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Returns false. + + false. + + + + Represents a raw SQL query against the context for entities in an entity set. + + + + + Initializes a new instance of the class. + + The set. + The SQL. + if set to true then the entities will not be tracked. + The parameters. + + + + If the query is would track entities, then this method returns a new query that will + not track entities. + + A no-tracking query. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Gets a value indicating whether this instance is set to track entities or not. + + + true if this instance is no-tracking; otherwise, false. + + + + + A LazyInternalConnection object manages information that can be used to create a DbConnection object and + is responsible for creating that object and disposing it. + + + + + Creates a new LazyInternalConnection using convention to calculate the connection. + The DbConnection object will be created lazily on demand and will be disposed when the LazyInternalConnection is disposed. + + Either the database name or a connection string. + + + + Creates a new LazyInternalConnection targeting a specific database. + The DbConnection object will be created lazily on demand and will be disposed when the LazyInternalConnection is disposed. + + The connection to target. + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Disposes the underlying DbConnection. + Note that dispose actually puts the LazyInternalConnection back to its initial state such that + it can be used again. + + + + + + Searches the app.config/web.config file for a connection that matches the given name. + The connection might be a store connection or an EF connection. + + The connection name. + + True if a connection from the app.config file was found and used. + + + + Attempts to locate a connection entry in the configuration based on the supplied context name. + + The name to search for. + The configuration to search in. + Connection string if found, otherwise null. + + + + Initializes the connection based on a connection string. + + The settings to initialize from. + + + + Returns the underlying DbConnection, creating it first if it does not already exist. + + + + + Returns the origin of the underlying connection string. + + + + + Gets the name of the underlying connection string. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if connection contain model info; otherwise, false. + + + + Gets a value indicating if the lazy connection has been initialized. + + + + + A is a concrete type that will lazily create the + underlying when needed. The created is owned by the + internal context and will be disposed when the internal context is disposed. + + + + + Constructs a for the given owner that will be initialized + on first use. + + The owner . + Responsible for creating a connection lazily when the context is used for the first time. + The model, or null if it will be created by convention + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Saves all changes made in this context to the underlying database, but only if the + context has been initialized. If the context has not been initialized, then this + method does nothing because there is nothing to do; in particular, it does not + cause the context to be initialized. + + The number of objects written to the underlying database. + + + + Disposes the context. The underlying is also disposed. + The connection to the database ( object) is also disposed if it was created by + the context, otherwise it is not disposed. + + + + + + + + Initializes the underlying . + + + + + Creates an immutable, cacheable representation of the model defined by this builder. + This model can be used to create an or can be passed to a + constructor to create a for this model. + + + + + + Creates and configures the instance that will be used to build the + . + + The builder. + + + + Marks the database as having not been initialized. This is called when the app calls Database.Delete so + that the database if the app attempts to then use the database again it will be re-initialized automatically. + + + + + Marks the database as having been initialized without actually running the . + + + + + Runs the unless it has already been run or there + is no initializer for this context type in which case this method does nothing. + + + + + Performs some action (which may do nothing) in such a way that it is guaranteed only to be run + once for the model and connection in this app domain, unless it fails by throwing an exception, + in which case it will be re-tried next time the context is initialized. + + The action. + + + + Returns the underlying . + + + + + The compiled model created from the Code First pipeline, or null if Code First was + not used to create this context. + Causes the Code First pipeline to be run to create the model if it has not already been + created. + + + + + The actually being used, which may be the + temp context for initialization or the real context. + + + + + The connection underlying this context. Accessing this property does not cause the context + to be initialized, only its connection. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strings. + + + + + Gets the name of the underlying connection string. + + + + + Gets or sets the provider details to be used when building the EDM model. + + + + + + + + Gets or sets a custom OnModelCreating action. + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + Gets or sets a value indicating whether lazy loading is enabled. + If the exists, then this property acts as a wrapper over the flag stored there. + If the has not been created yet, then we store the value given so we can later + use it when we create the . This allows the flag to be changed, for example in + a DbContext constructor, without it causing the to be created. + + + + + Gets or sets a value indicating whether proxy creation is enabled. + If the ObjectContext exists, then this property acts as a wrapper over the flag stored there. + If the ObjectContext has not been created yet, then we store the value given so we can later + use it when we create the ObjectContext. This allows the flag to be changed, for example in + a DbContext constructor, without it causing the ObjectContext to be created. + + + + + A wrapping query provider that performs expression transformation and then delegates + to the provider. The objects returned are always instances + of . This provider is associated with generic objects. + + + + + Creates a provider that wraps the given provider. + + The provider to wrap. + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a . + + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a where T is determined + from the element type of the ObjectQuery. + + + + + By default, calls the same method on the wrapped provider. + + + + + By default, calls the same method on the wrapped provider. + + + + + Creates an appropriate generic IQueryable using Reflection and the underlying ElementType of + the given ObjectQuery. + + + + + Performs expression replacement and then delegates to the wrapped provider to create an + . + + + + + Wraps the given as a where T is determined + from the element type of the ObjectQuery. + + + + + Gets the internal context. + + The internal context. + + + + A LINQ expression visitor that finds uses with equivalent + instances. + + + + + Replaces calls to DbContext.Set() with an expression for the equivalent . + + The node to replace. + A new node, which may have had the replacement made. + + + + Replaces a or property with a constant expression + for the underlying . + + The node to replace. + A new node, which may have had the replacement made. + + + + Processes the fields in each constant expression and replaces instances with + the underlying ObjectQuery instance. This handles cases where the query has a closure + containing values. + + + + + Gets a value from the given member, or returns null + if the member doesn't contain a DbContext instance. + + The expression for the object for the member, which may be null for a static member. + The member. + The context or null. + + + + Gets the instance from the given instance or static member, returning null + if the member does not contain a DbContext instance. + + The member. + The value of the object to get the instance from, or null if the member is static. + The context instance or null. + + + + Takes a or and creates an expression + for the underlying . + + + + + Takes a or and extracts the underlying . + + + + + A non-generic interface implemented by that allows operations on + any query object without knowing the type to which it applies. + + + + + An interface implemented by . + + The type of the element. + + + + A non-generic interface implemented by that allows operations on + any set object without knowing the type to which it applies. + + + + + An interface implemented by . + + + + + An instance of this internal class is created whenever an instance of the public + class is needed. This allows the public surface to be non-generic, while the runtime type created + still implements . + + The type of the element. + + + + Creates a new query that will be backed by the given internal query object. + + The backing query. + + + + See comments in . + + + + + See comments in . + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the underlying internal query object. + + The internal query. + + + + An instance of this internal class is created whenever an instance of the public + class is needed. This allows the public surface to be non-generic, while the runtime type created + still implements . + + The type of the entity. + + + + Creates a new set that will be backed by the given internal set. + + The internal set. + + + + Creates an instance of this class. This method is used with CreateDelegate to cache a delegate + that can create a generic instance without calling MakeGenericType every time. + + + The internal set to wrap, or null if a new internal set should be created. + The set. + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the underlying internal query object. + + The internal query. + + + + Gets the underlying internal set. + + The internal set. + + + + See comments in . + + + + + An InternalQuery underlies every instance of DbSet and DbQuery. It acts to lazily initialize a InternalContext as well + as an ObjectQuery and EntitySet the first time that it is used. The InternalQuery also acts to expose necessary + information to other parts of the design in a controlled manner without adding a lot of internal methods and + properties to the DbSet and DbQuery classes themselves. + + The type of entity to query for. + + + + Creates a new query that will be backed by the given InternalContext. + + The backing context. + + + + Creates a new internal query based on the information in an existing query together with + a new underlying ObjectQuery. + + + + + Resets the query to its uninitialized state so that it will be re-lazy initialized the next + time it is used. This allows the ObjectContext backing a DbContext to be switched out. + + + + + Updates the underlying ObjectQuery with the given include path. + + The include path. + A new query containing the defined include path. + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Performs lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that the query can be used. + + + + + Returns a representation of the underlying query, equivalent + to ToTraceString on ObjectQuery. + + + The query string. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + The underlying InternalContext. + + + + + The underlying ObjectQuery. + + + + + The underlying ObjectQuery. + + + + + The LINQ query expression. + + + + + The LINQ query provider for the underlying . + + + + + The IQueryable element type. + + + + + Creates a new query that will be backed by the given InternalContext. + + The backing context. + + + + Resets the set to its uninitialized state so that it will be re-lazy initialized the next + time it is used. This allows the ObjectContext backing a DbContext to be switched out. + + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Finds an entity in the state manager with the given primary key values, or returns null + if no such entity can be found. This includes looking for Added entities with the given + key values. + + + + + Finds an entity in the store with the given primary key values, or returns null + if no such entity can be found. This code is adapted from TryGetObjectByKey to + include type checking in the query. + + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + This method is virtual so that it can be mocked. + + The entity to attach. + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + This method is virtual so that it can be mocked. + + The entity to add. + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + This method is virtual so that it can be mocked. + + The entity to remove. + + + + This method checks whether an entity is already in the context. If it is, then the state + is changed to the new state given. If it isn't, then the action delegate is executed to + either Add or Attach the entity. + + A delegate to Add or Attach the entity. + The new state to give the entity if it is already in the context. + The entity. + Name of the method. + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Performs lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that the query can be used. + This method is virtual so that it can be mocked. + + + + + Attempts to perform lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that o-space loading has happened and the query can be used. This method doesn't throw if the type + for the set is not mapped. + + + + + Creates an underlying for this set. + + if set to true then the query is set to be no-tracking. + The query. + + + + Returns a representation of the underlying query, equivalent + to ToTraceString on ObjectQuery. + + + The query string. + + + + + Updates the underlying ObjectQuery with the given include path. + + The include path. + A new query containing the defined include path. + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Executes the given SQL query against the database materializing entities into the entity set that + backs this set. + + The SQL quey. + if true then the entities are not tracked, otherwise they are. + The parameters. + The query results. + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the ObservableCollection representing the local view for the set based on this query. + + + + + The underlying ObjectQuery. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet name. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet name, quoted for ESQL. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet. Accessing this property will trigger lazy initialization of the query. + + + + + The base type for the underlying entity set. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying InternalContext. Accessing this property will trigger lazy initialization of the query. + + + + + The LINQ query expression. + + + + + The LINQ query provider for the underlying . + + + + + A wrapping query provider that performs expression transformation and then delegates + to the provider. The objects returned + are always instances of when the generic CreateQuery method is + used and are instances of when the non-generic CreateQuery method + is used. This provider is associated with non-generic objects. + + + + + Creates a provider that wraps the given provider. + + The provider to wrap. + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a . + + + + + Delegates to the wrapped provider except returns instances of . + + + + + Creates an appropriate generic IQueryable using Reflection and the underlying ElementType of + the given ObjectQuery. + + + + + Extends to create a sortable binding list that stays in + sync with an underlying . That is, when items are added + or removed from the binding list, they are added or removed from the ObservableCollecion, and + vice-versa. + + The list element type. + + + + An extended BindingList implementation that implements sorting. + This class was adapted from the LINQ to SQL class of the same name. + + The element type. + + + + Initializes a new instance of the class with the + the given underlying list. Note that sorting is dependent on having an actual + rather than some other ICollection implementation. + + The list. + + + + Applies sorting to the list. + + The property to sort by. + The sort direction. + + + + Stops sorting. + + + + + Gets a value indicating whether this list is sorted. + + + true if this instance is sorted; otherwise, false. + + + + + Gets the sort direction. + + The sort direction. + + + + Gets the sort property being used to sort. + + The sort property. + + + + Returns true indicating that this list supports sorting. + + true. + + + + Implements comparing for the implementation. + + + + + Initializes a new instance of the class + for sorting the list. + + The property to sort by. + The sort direction. + + + + Compares two instances of items in the list. + + The left item to compare. + The right item to compare. + + + + + Determines whether this instance can sort for the specified type. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Determines whether this instance can sort for the specified type using IComparable. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Determines whether this instance can sort for the specified type using ToString. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Initializes a new instance of a binding list backed by the given + + The obervable collection. + + + + Creates a new item to be added to the binding list. + + The new item. + + + + Cancels adding of a new item that was started with AddNew. + + Index of the item. + + + + Removes all items from the binding list and underlying ObservableCollection. + + + + + Ends the process of adding a new item that was started with AddNew. + + Index of the item. + + + + Inserts the item into the binding list at the given index. + + The index. + The item. + + + + Removes the item at the specified index. + + The index. + + + + Sets the item into the list at the given position. + + The index to insert at. + The item. + + + + Event handler to update the binding list when the underlying observable collection changes. + + The sender. + Data indicating how the collection has changed. + + + + Adds the item to the underlying observable collection. + + The item. + + + + Removes the item from the underlying from observable collection. + + The item. + + + + Adapted from to allow the initializer to take an input object and + to do one-time initialization that only has side-effects and doesn't return a value. + + The type of the input. + + + + Initializes a new instance of the class. + + The action. + + + + Performs the action unless it has already been successfully performed before. + + The input to the action; ignored if the action has already succeeded. + + + + Adapted from to allow the initializer to take an input object and + to retry initialization if it has previously failed. + + + This class can only be used to initialize reference types that will not be null when + initialized. + + The type of the input. + The type of the result. + + + + Initializes a new instance of the class. + + The value factory. + + + + Gets the value, possibly by running the initializer if it has not been run before or + if all previous times it ran resulted in exceptions. + + The input to the initializer; ignored if initialization has already succeeded. + The initialized object. + + + + Validates a property of a given EDM complex type. + + + This is a composite validator for a complex property of an entity. + + + + + Validates a property of a given EDM property type. + + + This is a composite validator for a property of an entity or a complex type. + + + + + Simple validators for the corresponding property. + + + + + Name of the property the validator was created for. + + + + + Creates an instance of for a given EDM property. + + The EDM property name. + Validators used to validate the given property. + + + + Validates a property. + + Validation context. Never null. + Property to validate. Never null. + Validation errors as . Empty if no errors. Never null. + + + + + Simple validators for the corresponding property. + + + + + Gets the name of the property the validator was created for. + + + + + The complex type validator. + + + + + Creates an instance of for a given complex property. + + The complex property name. + Validators used to validate the given property. + Complex type validator. + + + + Validates a complex property. + + Validation context. Never null. + Property to validate. Never null. + Validation errors as . Empty if no errors. Never null. + + + + + Validator used to validate a property of a given EDM ComplexType. + + + This is a composite validator. + + + + + Validator used to validate an entity of a given EDM Type. + + + This is a composite validator for an EDM Type. + + + + + Creates an instance for a given EDM type. + + Property validators. + Type level validators. + + + + Validates an instance. + + Entity validation context. Must not be null. + The entry for the complex property. Null if validating an entity. + instance. Never null. + + Protected so it doesn't appear on EntityValidator. + + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Returns a validator for a child property. + + Name of the child property for which to return a validator. + + Validator for a child property. Possibly null if there are no validators for requested property. + + + + + Creates an instance for a given EDM complex type. + + Property validators. + Type level validators. + + + + Validates an instance. + + Entity validation context. Must not be null. + The entry for the complex property. Null if validating an entity. + instance. Never null. + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Contains information needed to validate an entity or its properties. + + + + + The entity being validated or the entity that owns the property being validated. + + + + + Initializes a new instance of EntityValidationContext class. + + + The entity being validated or the entity that owns the property being validated. + + + External contexts needed for validation. + + + + + External context needed for validation. + + + + + Gets the entity being validated or the entity that owns the property being validated. + + + + + Validator used to validate an entity of a given EDM EntityType. + + + This is a top level, composite validator. This is also an entry point to getting an entity + validated as validation of an entity is always started by calling Validate method on this type. + + + + + Creates an instance for a given EDM entity type. + + Property validators. + Entity type level validators. + + + + Validates an entity. + + Entity validation context. Must not be null. + instance. Never null. + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Builds validators based on s specified on entity CLR types and properties + as well as based on presence of implementation on entity and complex + type CLR types. It's not sealed and not static for mocking purposes. + + + + + Builds an for the given . + + The entity entry to build the validator for. + Whether the currently processed type is the target type or one of the ancestor types. + + + for the given . Possibly null + if no validation has been specified for this entity type. + + + + + Builds the validator for a given and the corresponding + . + + The CLR type that corresponds to the EDM complex type. + The EDM complex type that type level validation is built for. + A for the given complex type. May be null if no validation specified. + + + + Extracted method from BuildEntityValidator and BuildComplexTypeValidator + + + + + Build validators for the and the corresponding + or . + + Properties to build validators for. + Non-navigation EDM properties. + Navigation EDM properties. + A list of validators. Possibly empty, never null. + + + + Builds a for the given and the corresponding + . If the property is a complex type, type level validators will be built here as + well. + + The CLR property to build the validator for. + The EDM property to build the validator for. + + for the given . Possibly null + if no validation has been specified for this property. + + + + + Builds a for the given transient . + + The CLR property to build the validator for. + + for the given . Possibly null + if no validation has been specified for this property. + + + + + Builds s for given that derive from + . + + Attributes used to build validators. + + A list of s built from . + Possibly empty, never null. + + + + + Returns all non-static non-indexed CLR properties from the . + + The CLR to get the properties from. + + A collection of CLR properties. Possibly empty, never null. + + + + + Builds validators based on the facets of : + * If .Nullable facet set to false adds a validator equivalent to the RequiredAttribute + * If the .MaxLength facet is specified adds a validator equivalent to the MaxLengthAttribute. + However the validator isn't added if .IsMaxLength has been set to true. + + The CLR property to build the facet validators for. + The property for which facet validators will be created + A collection of validators. + + + + Abstracts simple validators used to validate entities and properties. + + + + + Validates an entity or a property. + + Validation context. Never null. + Property to validate. Can be null for type level validation. + Validation error as. Empty if no errors. Never null. + + + + + Contract for IValidator.Validate method. + + Validation context. + Property. + Nothing - always throws. + + + + Validates entities or complex types implementing IValidatableObject interface. + + + + + Display attribute used to specify the display name for an entity or complex property. + + + + + Validates an entity or a complex type implementing IValidatableObject interface. + This method is virtual to allow mocking. + + Validation context. Never null. + + Property to validate. Null if this is the entity that will be validated. Never null if this + is the complex type that will be validated. + + Validation error as . Empty if no errors. Never null. + + + Note that is used to figure out what needs to be validated. If it not null the complex + type will be validated otherwise the entity will be validated. + Also if this is an IValidatableObject complex type but the instance (.CurrentValue) is null we won't validate + anything and will not return any errors. The reason for this is that Validation is supposed to validate using + information the user provided and not some additional implicit rules. (ObjectContext will throw for operations + that involve null complex properties). + + + + + Validates a property, complex property or an entity using validation attributes the property + or the complex/entity type is decorated with. + + + Note that this class is used for validating primitive properties using attributes declared on the property + (property level validation) and complex properties and entities using attributes declared on the type + (type level validation). + + + + + Display attribute used to specify the display name for a property or entity. + + + + + Validation attribute used to validate a property or an entity. + + + + + Creates an instance of class. + + + Validation attribute used to validate a property or an entity. + + + + + Validates a property or an entity. + + Validation context. Never null. + Property to validate. Null for entity validation. Not null for property validation. + + + Validation errors as . Empty if no errors, never null. + + + + + Used to cache and retrieve generated validators and to create context for validating entities or properties. + + + + + Collection of validators keyed by the entity CLR type. Note that if there's no validation for a given type + it will be associated with a null validator. + + + + + Initializes a new instance of class. + + + + + Returns a validator to validate . + + Entity the validator is requested for. + + to validate . Possibly null if no validation + has been specified for the entity. + + + + + Returns a validator to validate . + + Navigation property the validator is requested for. + + Validator to validate . Possibly null if no validation + has been specified for the requested property. + + + + + Gets a validator for the . + + Entity validator. + Property to get a validator for. + + Validator to validate . Possibly null if there is no validation for the + . + + + For complex properties this method walks up the type hierarchy to get to the entity level and then goes down + and gets a validator for the child property that is an ancestor of the property to validate. If a validator + returned for an ancestor is null it means that there is no validation defined beneath and the method just + propagates (and eventually returns) null. + + + + + Creates for . + + Entity entry for which a validation context needs to be created. + User defined dictionary containing additional info for custom validation. This parameter is optional and can be null. + An instance of class. + + + + + A wrapper around EntityKey that allows key/values pairs that have null values to + be used. This allows Added entities with null key values to be searched for in + the ObjectStateManager. + + + + The key name/key value pairs, where some key values may be null + + + + Creates a new WrappedEntityKey instance. + + The entity set that the key belongs to. + The fully qualified name of the given entity set. + The key values, which may be null or contain null values. + The name of the parameter passed for keyValue by the user, which is used when throwing exceptions. + + + + True if any of the key values are null, which means that the EntityKey will also be null. + + + + + An actual EntityKey, or null if any of the key values are null. + + + + + The key name/key value pairs of the key, in which some of the key values may be null. + + + + + Allows configuration to be performed for an complex type in a model. + + A ComplexTypeConfiguration can be obtained via the ComplexType method on + or a custom type derived from ComplexTypeConfiguration + can be registered via the Configurations property on . + + The complex type to be configured. + + + + Allows configuration to be performed for a type in a model. + + The type to be configured. + + + + Configures a property that is defined on this type. + + The type of the property being configured. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + The type of the property being configured. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Excludes a property from the model so that it will not be mapped to the database. + + The type of the property to be ignored. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + + + + Initializes a new instance of ComplexTypeConfiguration + + + + + Allows derived configuration classes for entities and complex types to be registered with a . + + + Derived configuration classes are created by deriving from + or and using a type to be included in the model as the generic + parameter. + + Configuration can be performed without creating derived configuration classes via the Entity and ComplexType + methods on . + + + + + Adds an to the . + Only one can be added for each type in a model. + + The entity type being configured. + The entity type configuration to be added. + The same ConfigurationRegistrar instance so that multiple calls can be chained. + + + + Adds an to the . + Only one can be added for each type in a model. + + The complex type being configured. + The complex type configuration to be added + The same ConfigurationRegistrar instance so that multiple calls can be chained. + + + + Allows the conventions used by a instance to be customized. + Currently removal of one or more default conventions is the only supported operation. + The default conventions can be found in the System.Data.Entity.ModelConfiguration.Conventions namespace. + + + + + Disables a convention for the . + The default conventions that are available for removal can be found in the System.Data.Entity.ModelConfiguration.Conventions namespace. + + The type of the convention to be disabled. + + + + Configures the table and column mapping for an entity type or a sub-set of properties from an entity type. + This configuration functionality is available via the Code First Fluent API, see . + + The entity type to be mapped. + + + + Configures the properties that will be included in this mapping fragment. + If this method is not called then all properties that have not yet been + included in a mapping fragment will be configured. + + An anonymous type including the properties to be mapped. + + A lambda expression to an anonymous type that contains the properties to be mapped. + C#: t => new { t.Id, t.Property1, t.Property2 } + VB.Net: Function(t) New With { p.Id, t.Property1, t.Property2 } + + + + + Re-maps all properties inherited from base types. + + When configuring a derived type to be mapped to a separate table this will cause all properties to + be included in the table rather than just the non-inherited properties. This is known as + Table per Concrete Type (TPC) mapping. + + + + + Configures the table name to be mapped to. + + Name of the table. + + + + Configures the table name and schema to be mapped to. + + Name of the table. + Schema of the table. + + + + Configures the discriminator column used to differentiate between types in an inheritance hierarchy. + + The name of the discriminator column. + A configuration object to further configure the discriminator column and values. + + + + Configures the discriminator condition used to differentiate between types in an inheritance hierarchy. + + The type of the property being used to discriminate between types. + + A lambda expression representing the property being used to discriminate between types. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object to further configure the discriminator condition. + + + + Moves a foreign key constraint from oldTable to newTable and updates column references + + + + + Move any FK constraints that are now completely in newTable and used to refer to oldColumn + + + + + Configures a condition used to discriminate between types in an inheritance hierarchy based on the values assigned to a property. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the condition to require a value in the property. + + Rows that do not have a value assigned to column that this property is stored in are + assumed to be of the base type of this entity type. + + + + + Populate the table mapping structure + + + + + Sets nullability for association set mappings' foreign keys for 1:* and 1:0..1 associations + when no base types share the the association set mapping's table + + + + + Makes sure only the required property mappings are present + + + + + Determines if the table and entity type need mapping, and if not, removes the existing entity type mapping + + + + + Configures a database column used to store a string values. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the column to allow the maximum length supported by the database provider. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + + Configures the column to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be variable length. + Columns are variable length by default. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be optional. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be required. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column. + + Name of the database provider specific data type. + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column. + + The order that this column should appear in the database table. + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to support Unicode string content. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the column supports Unicode string content. + + + Value indicating if the column supports Unicode string content or not. + Specifying 'null' will remove the Unicode facet from the column. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures a discriminator column used to differentiate between types in an inheritance hierarchy. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + Type of the discriminator value. + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + Type of the discriminator value. + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Initializes configurations in the ModelConfiguration so that configuration data + is in a single place + + + + + Configures a many relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be many:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:required with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:required without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:optional with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:optional without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures an optional relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be optional:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:required with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:required without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + + A lambda expression representing the navigation property on the other end of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + A configuration object that can be used to further configure the relationship. + + + + Configures an required relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be required:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:optional with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:optional without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required with a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required without a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required with a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required without a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + A configuration object that can be used to further configure the relationship. + + + + Base class for configuring a property on an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + True if the NavigationProperty's declaring type is the principal end, false if it is not, null if it is not known + + + + + Base class for performing configuration of a relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures a relationship that can support cascade on delete functionality. + + + + + Configures cascade delete to be on for the relationship. + + + + + Configures whether or not cascade delete is on for the relationship. + + Value indicating if cascade delete is on or not. + + + + Configures a relationship that can support foreign key properties that are exposed in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + The dependent entity type. + + + + Configures a relationship that can only support foreign key properties that are not exposed in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the relationship to use foreign key property(s) that are not exposed in the object model. + The column(s) and table can be customized by specifying a configuration action. + If an empty configuration action is specified then column name(s) will be generated by convention. + If foreign key properties are exposed in the object model then use the HasForeignKey method. + Not all relationships support exposing foreign key properties in the object model. + + Action that configures the foreign key column(s) and table. + + A configuration object that can be used to further configure the relationship. + + + + + Configures the relationship to use foreign key property(s) that are exposed in the object model. + If the foreign key property(s) are not exposed in the object model then use the Map method. + + The type of the key. + + A lambda expression representing the property to be used as the foreign key. + If the foreign key is made up of multiple properties then specify an anonymous type including the properties. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the principal entity type. + + A configuration object that can be used to further configure the relationship. + + + + Configures the table and column mapping of a relationship that does not expose foreign key properties in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the name of the column(s) for the foreign key. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table name that the foreign key column(s) reside in. + The table that is specified must already be mapped for the entity type. + + If you want the foreign key(s) to reside in their own table then use the Map method + on to perform + entity splitting to create the table with just the primary key property. Foreign keys can + then be added to the table via this method. + + Name of the table. + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table name and schema that the foreign key column(s) reside in. + The table that is specified must already be mapped for the entity type. + + If you want the foreign key(s) to reside in their own table then use the Map method + on to perform + entity splitting to create the table with just the primary key property. Foreign keys can + then be added to the table via this method. + + Name of the table. + Schema of the table. + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table and column mapping of a many:many relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the join table name for the relationship. + + Name of the table. + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the join table name and schema for the relationship. + + Name of the table. + Schema of the table. + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the column(s) for the left foreign key. + The left foreign key represents the navigation property specified in the HasMany call. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the column(s) for the right foreign key. + The right foreign key represents the navigation property specified in the WithMany call. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures a many:many relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the foreign key column(s) and table used to store the relationship. + + Action that configures the foreign key column(s) and table. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Used to configure a property with length facets for an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Used to configure a primitive property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to allow the maximum length supported by the database provider. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property and a default length will be used for the database column. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + Properties are variable length by default. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to allow the maximum length supported by the database provider. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + properties are variable length by default. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + properties are optional by default. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be a row version in the database. + The actual data type will vary depending on the database provider being used. + Setting the property to be a row version will automatically configure it to be an + optimistic concurrency token. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + properties are required by default. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the precision of the property. + If the database provider does not support precision for the data type of the column then the value is ignored. + + Precision of the property. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + properties are required by default. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the precision and scale of the property. + + The precision of the property. + The scale of the property. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to allow the maximum length supported by the database provider. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property and a default length will be used for the database column.. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + properties are variable length by default. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + properties are optional by default. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to support Unicode string content. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property supports Unicode string content. + + + Value indicating if the property supports Unicode string content or not. + Specifying 'null' will remove the Unicode facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Indicates what parts of a configuration are overridable. + + + + + Nothing in the configuration is overridable. + + + + + The configuration values related to C-Space are overridable. + + + + + The configuration values only related to S-Space are overridable. + + + + + True if this configuration can be replaced in the model configuration, false otherwise + This is only set to true for configurations that are registered automatically via the DbContext + + + + + Base class for conventions that process CLR attributes found in the model. + + The type of member to look for. + The type of the configuration to look for. + The type of the attribute to look for. + + + + Convention to process instances of found on properties in the model + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on foreign key properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on navigation properties in the model. + + + + + Convention to process instances of found on primitive properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to detect navigation properties to be inverses of each other when only one pair + of navigation properties exists between the related types. + + + + + Convention to configure a type as a complex type if it has no primary key, no mapped base type and no navigation properties. + + + + + Convention to convert any data types that were explicitly specified, via data annotations or API, + to be lower case. The default SqlClient provider is case sensitive and requires data types to be lower case. This convention + allows the and API to be case insensitive. + + + + + Convention to add a cascade delete to the join table from both tables involved in a many to many relationship. + + + + + Convention to ensure an invalid/unsupported mapping is not created when mapping inherited properties + + + + + Convention to set the table name to be a pluralized version of the entity type name. + + + + + Convention to set precision to 18 and scale to 2 for decimal properties. + + + + + Convention to move primary key properties to appear first. + + + + + Convention to distinguish between optional and required relationships based on CLR nullability of the foreign key property. + + + + + Convention to process instances of found on navigation properties in the model. + + + + + Convention to detect primary key properties. + Recognized naming patterns in order of precedence are: + 1. 'Id' + 2. [type name]Id + Primary key detection is case insensitive. + + + + + Convention to discover foreign key properties whose names are a combination + of the dependent navigation property name and the principal type primary key property name(s). + + + + + Convention to enable cascade delete for any required relationships. + + + + + Convention to configure the primary key(s) of the dependent entity type as foreign key(s) in a one:one relationship. + + + + + Convention to set the entity set name to be a pluralized version of the entity type name. + + + + + Convention to discover foreign key properties whose names match the principal type primary key property name(s). + + + + + Convention to set a default maximum length of 128 for properties whose type supports length facets. + + + + + Convention to set a default maximum length of 4000 for properties whose type supports length facets when SqlCe is the provider. + + + + + Convention to configure integer primary keys to be identity. + + + + + Checks for the PK property being an FK in a different table. A PK which is also an FK but + in the same table is used for table splitting and can still be an identity column because + the update pipeline is only inserting into one column of one table. + + + + + Convention to discover foreign key properties whose names are a combination + of the principal type name and the principal type primary key property name(s). + + + + + This class provide service for both the singularization and pluralization, it takes the word pairs + in the ctor following the rules that the first one is singular and the second one is plural. + + + + + Factory method for PluralizationService. Only support english pluralization. + Please set the PluralizationService on the System.Data.Entity.Design.EntityModelSchemaGenerator + to extend the service to other locales. + + CultureInfo + PluralizationService + + + + captalize the return word if the parameter is capitalized + if word is "Table", then return "Tables" + + + + + + + + separate one combine word in to two parts, prefix word and the last word(suffix word) + + + + + + + + return true when the word is "[\s]*" or leading or tailing with spaces + or contains non alphabetical characters + + + + + + + This method allow you to add word to internal PluralizationService of English. + If the singluar or the plural value was already added by this method, then an ArgumentException will be thrown. + + + + + + + Attempt to determine the principal and dependent ends of this association. + + The following table illustrates the solution space. + + Source | Target || Prin | Dep | + -------|--------||-------|-------| + 1 | 1 || - | - | + 1 | 0..1 || Sr | Ta | + 1 | * || Sr | Ta | + 0..1 | 1 || Ta | Sr | + 0..1 | 0..1 || - | - | + 0..1 | * || Sr | Ta | + * | 1 || Ta | Sr | + * | 0..1 || Ta | Sr | + * | * || - | - | + + + + + Allows configuration to be performed for an entity type in a model. + + An EntityTypeConfiguration can be obtained via the Entity method on + or a custom type derived from EntityTypeConfiguration + can be registered via the Configurations property on . + + + + + Initializes a new instance of EntityTypeConfiguration + + + + + Configures the primary key property(s) for this entity type. + + The type of the key. + + A lambda expression representing the property to be used as the primary key. + C#: t => t.Id + VB.Net: Function(t) t.Id + + If the primary key is made up of multiple properties then specify an anonymous type including the properties. + C#: t => new { t.Id1, t.Id2 } + VB.Net: Function(t) New With { t.Id1, t.Id2 } + + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures the entity set name to be used for this entity type. + The entity set name can only be configured for the base type in each set. + + The name of the entity set. + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures the table name that this entity type is mapped to. + + The name of the table. + + + + Configures the table name that this entity type is mapped to. + + The name of the table. + The database schema of the table. + + + + Allows advanced configuration related to how this entity type is mapped to the database schema. + By default, any configuration will also apply to any type derived from this entity type. + + Derived types can be configured via the overload of Map that configures a derived type or + by using an EntityTypeConfiguration for the derived type. + + The properties of an entity can be split between multiple tables using multiple Map calls. + + Calls to Map are additive, subsequent calls will not override configuration already preformed via Map. + + An action that performs configuration against an . + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Allows advanced configuration related to how a derived entity type is mapped to the database schema. + Calls to Map are additive, subsequent calls will not override configuration already preformed via Map. + + The derived entity type to be configured. + An action that performs configuration against an . + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures an optional relationship from this entity type. + Instances of the entity type will be able to be saved to the database without this relationship being specified. + The foreign key in the database will be nullable. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures a required relationship from this entity type. + Instances of the entity type will not be able to be saved to the database unless this relationship is specified. + The foreign key in the database will be non-nullable. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures a many relationship from this entity type. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Handles mapping from a CLR property to an EDM assocation and nav. prop. + + + + + Exception thrown by during model creation when an invalid model is generated. + + + + + Initializes a new instance of ModelValidationException + + + + + Initializes a new instance of ModelValidationException + + The exception message. + + + + Initializes a new instance of ModelValidationException + + The exception message. + The inner exception. + + + + Code Contracts hook methods - Called when contracts fail. Here we detect the most common preconditions + so we can throw the correct exceptions. It also means that we can write preconditions using the + simplest Contract.Requires() form. + + + + + Returns true if a variable of this type can be assigned a null value + + + + True if a reference type or a nullable value type, + false otherwise + + + + + Exception thrown from when validating entities fails. + + + + + Initializes a new instance of DbEntityValidationException + + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + Validation results. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + The inner exception. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + Validation results. + The inner exception. + + + + Subscribes the SerializeObjectState event. + + + + + Validation results. + + + + + Holds exception state that will be serialized when the exception is serialized. + + + + + Validation results. + + + + + Completes the deserialization. + + The deserialized object. + + + + Validation results. + + + + + Represents validation results for single entity. + + + + + Entity entry the results applies to. Never null. + + + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Creates an instance of class. + + + Entity entry the results applies to. Never null. + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Creates an instance of class. + + + Entity entry the results applies to. Never null. + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Gets an instance of the results applies to. + + + + + Gets validation errors. Never null. + + + + + Gets an indicator if the entity is valid. + + + + + Exception thrown from when an exception is thrown from the validation + code. + + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + The inner exception. + + + + Initializes a new instance of DbUnexpectedValidationException with the specified serialization info and + context. + + The serialization info. + The streaming context. + + + + Validation error. Can be either entity or property level validation error. + + + + + Name of the invalid property. Can be null (e.g. for entity level validations) + + + + + Validation error message. + + + + + Creates an instance of . + + Name of the invalid property. Can be null. + Validation error message. Can be null. + + + + Gets name of the invalid property. + + + + + Gets validation error message. + + + + diff --git a/Website/LOC.Website.Tests/bin/Debug/LOC.Core.dll b/Website/LOC.Website.Tests/bin/Debug/LOC.Core.dll new file mode 100644 index 000000000..b75de43c2 Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Debug/LOC.Core.dll differ diff --git a/Website/LOC.Website.Tests/bin/Debug/LOC.Core.pdb b/Website/LOC.Website.Tests/bin/Debug/LOC.Core.pdb new file mode 100644 index 000000000..6cb8b88dc Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Debug/LOC.Core.pdb differ diff --git a/Website/LOC.Website.Tests/bin/Debug/LOC.Website.Common.dll b/Website/LOC.Website.Tests/bin/Debug/LOC.Website.Common.dll new file mode 100644 index 000000000..0f6765d60 Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Debug/LOC.Website.Common.dll differ diff --git a/Website/LOC.Website.Tests/bin/Debug/LOC.Website.Common.pdb b/Website/LOC.Website.Tests/bin/Debug/LOC.Website.Common.pdb new file mode 100644 index 000000000..3d5dc69ac Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Debug/LOC.Website.Common.pdb differ diff --git a/Website/LOC.Website.Tests/bin/Debug/LOC.Website.Tests.dll b/Website/LOC.Website.Tests/bin/Debug/LOC.Website.Tests.dll new file mode 100644 index 000000000..5922c2c16 Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Debug/LOC.Website.Tests.dll differ diff --git a/Website/LOC.Website.Tests/bin/Debug/LOC.Website.Tests.pdb b/Website/LOC.Website.Tests/bin/Debug/LOC.Website.Tests.pdb new file mode 100644 index 000000000..03c9555af Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Debug/LOC.Website.Tests.pdb differ diff --git a/Website/LOC.Website.Tests/bin/Debug/Moq.dll b/Website/LOC.Website.Tests/bin/Debug/Moq.dll new file mode 100644 index 000000000..3a3e653aa Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Debug/Moq.dll differ diff --git a/Website/LOC.Website.Tests/bin/Debug/Moq.xml b/Website/LOC.Website.Tests/bin/Debug/Moq.xml new file mode 100644 index 000000000..13b8804b5 --- /dev/null +++ b/Website/LOC.Website.Tests/bin/Debug/Moq.xml @@ -0,0 +1,5120 @@ + + + + Moq + + + + + Implements the fluent API. + + + + + The expectation will be considered only in the former condition. + + + + + + + The expectation will be considered only in the former condition. + + + + + + + + Setups the get. + + The type of the property. + The expression. + + + + + Setups the set. + + The type of the property. + The setter expression. + + + + + Setups the set. + + The setter expression. + + + + + Defines the Callback verb and overloads. + + + + + Helper interface used to hide the base + members from the fluent API to make it much cleaner + in Visual Studio intellisense. + + + + + + + + + + + + + + + + + Specifies a callback to invoke when the method is called. + + The callback method to invoke. + + The following example specifies a callback to set a boolean + value that can be used later: + + var called = false; + mock.Setup(x => x.Execute()) + .Callback(() => called = true); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The argument type of the invoked method. + The callback method to invoke. + + Invokes the given callback with the concrete invocation argument value. + + Notice how the specific string argument is retrieved by simply declaring + it as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute(It.IsAny<string>())) + .Callback((string command) => Console.WriteLine(command)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2) => Console.WriteLine(arg1 + arg2)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3) => Console.WriteLine(arg1 + arg2 + arg3)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The type of the fifteenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The type of the fifteenth argument of the invoked method. + The type of the sixteenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15, string arg16) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16)); + + + + + + Defines the Callback verb and overloads for callbacks on + setups that return a value. + + Mocked type. + Type of the return value of the setup. + + + + Specifies a callback to invoke when the method is called. + + The callback method to invoke. + + The following example specifies a callback to set a boolean value that can be used later: + + var called = false; + mock.Setup(x => x.Execute()) + .Callback(() => called = true) + .Returns(true); + + Note that in the case of value-returning methods, after the Callback + call you can still specify the return value. + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the argument of the invoked method. + Callback method to invoke. + + Invokes the given callback with the concrete invocation argument value. + + Notice how the specific string argument is retrieved by simply declaring + it as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute(It.IsAny<string>())) + .Callback(command => Console.WriteLine(command)) + .Returns(true); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2) => Console.WriteLine(arg1 + arg2)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3) => Console.WriteLine(arg1 + arg2 + arg3)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The type of the fifteenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The type of the fifteenth argument of the invoked method. + The type of the sixteenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16)); + + + + + + Defines the Raises verb. + + + + + Specifies the event that will be raised + when the setup is met. + + An expression that represents an event attach or detach action. + The event arguments to pass for the raised event. + + The following example shows how to raise an event when + the setup is met: + + var mock = new Mock<IContainer>(); + + mock.Setup(add => add.Add(It.IsAny<string>(), It.IsAny<object>())) + .Raises(add => add.Added += null, EventArgs.Empty); + + + + + + Specifies the event that will be raised + when the setup is matched. + + An expression that represents an event attach or detach action. + A function that will build the + to pass when raising the event. + + + + + Specifies the custom event that will be raised + when the setup is matched. + + An expression that represents an event attach or detach action. + The arguments to pass to the custom delegate (non EventHandler-compatible). + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + The type of the nineth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + The type of the nineth argument received by the expected invocation. + The type of the tenth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + The type of the nineth argument received by the expected invocation. + The type of the tenth argument received by the expected invocation. + The type of the eleventh argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + The type of the nineth argument received by the expected invocation. + The type of the tenth argument received by the expected invocation. + The type of the eleventh argument received by the expected invocation. + The type of the twelfth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + The type of the nineth argument received by the expected invocation. + The type of the tenth argument received by the expected invocation. + The type of the eleventh argument received by the expected invocation. + The type of the twelfth argument received by the expected invocation. + The type of the thirteenth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + The type of the nineth argument received by the expected invocation. + The type of the tenth argument received by the expected invocation. + The type of the eleventh argument received by the expected invocation. + The type of the twelfth argument received by the expected invocation. + The type of the thirteenth argument received by the expected invocation. + The type of the fourteenth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + The type of the nineth argument received by the expected invocation. + The type of the tenth argument received by the expected invocation. + The type of the eleventh argument received by the expected invocation. + The type of the twelfth argument received by the expected invocation. + The type of the thirteenth argument received by the expected invocation. + The type of the fourteenth argument received by the expected invocation. + The type of the fifteenth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + The type of the nineth argument received by the expected invocation. + The type of the tenth argument received by the expected invocation. + The type of the eleventh argument received by the expected invocation. + The type of the twelfth argument received by the expected invocation. + The type of the thirteenth argument received by the expected invocation. + The type of the fourteenth argument received by the expected invocation. + The type of the fifteenth argument received by the expected invocation. + The type of the sixteenth argument received by the expected invocation. + + + + + Defines the Returns verb. + + Mocked type. + Type of the return value from the expression. + + + + Specifies the value to return. + + The value to return, or . + + Return a true value from the method call: + + mock.Setup(x => x.Execute("ping")) + .Returns(true); + + + + + + Specifies a function that will calculate the value to return from the method. + + The function that will calculate the return value. + + Return a calculated value when the method is called: + + mock.Setup(x => x.Execute("ping")) + .Returns(() => returnValues[0]); + + The lambda expression to retrieve the return value is lazy-executed, + meaning that its value may change depending on the moment the method + is executed and the value the returnValues array has at + that moment. + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the argument of the invoked method. + The function that will calculate the return value. + + Return a calculated value which is evaluated lazily at the time of the invocation. + + The lookup list can change between invocations and the setup + will return different values accordingly. Also, notice how the specific + string argument is retrieved by simply declaring it as part of the lambda + expression: + + + mock.Setup(x => x.Execute(It.IsAny<string>())) + .Returns((string command) => returnValues[command]); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2) => arg1 + arg2); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3) => arg1 + arg2 + arg3); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4) => arg1 + arg2 + arg3 + arg4); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5) => arg1 + arg2 + arg3 + arg4 + arg5); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The type of the fifteenth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The type of the fifteenth argument of the invoked method. + The type of the sixteenth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15, string arg16) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16); + + + + + + Language for ReturnSequence + + + + + Returns value + + + + + Throws an exception + + + + + Throws an exception + + + + + The first method call or member access will be the + last segment of the expression (depth-first traversal), + which is the one we have to Setup rather than FluentMock. + And the last one is the one we have to Mock.Get rather + than FluentMock. + + + + + Base class for mocks and static helper class with methods that + apply to mocked objects, such as to + retrieve a from an object instance. + + + + + Creates an mock object of the indicated type. + + The type of the mocked object. + The mocked object created. + + + + Creates an mock object of the indicated type. + + The predicate with the specification of how the mocked object should behave. + The type of the mocked object. + The mocked object created. + + + + Initializes a new instance of the class. + + + + + Retrieves the mock object for the given object instance. + + Type of the mock to retrieve. Can be omitted as it's inferred + from the object instance passed in as the instance. + The instance of the mocked object.The mock associated with the mocked object. + The received instance + was not created by Moq. + + The following example shows how to add a new setup to an object + instance which is not the original but rather + the object associated with it: + + // Typed instance, not the mock, is retrieved from some test API. + HttpContextBase context = GetMockContext(); + + // context.Request is the typed object from the "real" API + // so in order to add a setup to it, we need to get + // the mock that "owns" it + Mock<HttpRequestBase> request = Mock.Get(context.Request); + mock.Setup(req => req.AppRelativeCurrentExecutionFilePath) + .Returns(tempUrl); + + + + + + Returns the mocked object value. + + + + + Verifies that all verifiable expectations have been met. + + This example sets up an expectation and marks it as verifiable. After + the mock is used, a Verify() call is issued on the mock + to ensure the method in the setup was invoked: + + var mock = new Mock<IWarehouse>(); + this.Setup(x => x.HasInventory(TALISKER, 50)).Verifiable().Returns(true); + ... + // other test code + ... + // Will throw if the test code has didn't call HasInventory. + this.Verify(); + + Not all verifiable expectations were met. + + + + Verifies all expectations regardless of whether they have + been flagged as verifiable. + + This example sets up an expectation without marking it as verifiable. After + the mock is used, a call is issued on the mock + to ensure that all expectations are met: + + var mock = new Mock<IWarehouse>(); + this.Setup(x => x.HasInventory(TALISKER, 50)).Returns(true); + ... + // other test code + ... + // Will throw if the test code has didn't call HasInventory, even + // that expectation was not marked as verifiable. + this.VerifyAll(); + + At least one expectation was not met. + + + + Gets the interceptor target for the given expression and root mock, + building the intermediate hierarchy of mock objects if necessary. + + + + + Raises the associated event with the given + event argument data. + + + + + Raises the associated event with the given + event argument data. + + + + + Adds an interface implementation to the mock, + allowing setups to be specified for it. + + This method can only be called before the first use + of the mock property, at which + point the runtime type has already been generated + and no more interfaces can be added to it. + + Also, must be an + interface and not a class, which must be specified + when creating the mock instead. + + + The mock type + has already been generated by accessing the property. + + The specified + is not an interface. + + The following example creates a mock for the main interface + and later adds to it to verify + it's called by the consumer code: + + var mock = new Mock<IProcessor>(); + mock.Setup(x => x.Execute("ping")); + + // add IDisposable interface + var disposable = mock.As<IDisposable>(); + disposable.Setup(d => d.Dispose()).Verifiable(); + + Type of interface to cast the mock to. + + + + + + + Behavior of the mock, according to the value set in the constructor. + + + + + Whether the base member virtual implementation will be called + for mocked classes if no setup is matched. Defaults to . + + + + + Specifies the behavior to use when returning default values for + unexpected invocations on loose mocks. + + + + + Gets the mocked object instance. + + + + + Retrieves the type of the mocked object, its generic type argument. + This is used in the auto-mocking of hierarchy access. + + + + + Specifies the class that will determine the default + value to return when invocations are made that + have no setups and need to return a default + value (for loose mocks). + + + + + Exposes the list of extra interfaces implemented by the mock. + + + + + Utility repository class to use to construct multiple + mocks when consistent verification is + desired for all of them. + + + If multiple mocks will be created during a test, passing + the desired (if different than the + or the one + passed to the repository constructor) and later verifying each + mock can become repetitive and tedious. + + This repository class helps in that scenario by providing a + simplified creation of multiple mocks with a default + (unless overriden by calling + ) and posterior verification. + + + + The following is a straightforward example on how to + create and automatically verify strict mocks using a : + + var repository = new MockRepository(MockBehavior.Strict); + + var foo = repository.Create<IFoo>(); + var bar = repository.Create<IBar>(); + + // no need to call Verifiable() on the setup + // as we'll be validating all of them anyway. + foo.Setup(f => f.Do()); + bar.Setup(b => b.Redo()); + + // exercise the mocks here + + repository.VerifyAll(); + // At this point all setups are already checked + // and an optional MockException might be thrown. + // Note also that because the mocks are strict, any invocation + // that doesn't have a matching setup will also throw a MockException. + + The following examples shows how to setup the repository + to create loose mocks and later verify only verifiable setups: + + var repository = new MockRepository(MockBehavior.Loose); + + var foo = repository.Create<IFoo>(); + var bar = repository.Create<IBar>(); + + // this setup will be verified when we verify the repository + foo.Setup(f => f.Do()).Verifiable(); + + // this setup will NOT be verified + foo.Setup(f => f.Calculate()); + + // this setup will be verified when we verify the repository + bar.Setup(b => b.Redo()).Verifiable(); + + // exercise the mocks here + // note that because the mocks are Loose, members + // called in the interfaces for which no matching + // setups exist will NOT throw exceptions, + // and will rather return default values. + + repository.Verify(); + // At this point verifiable setups are already checked + // and an optional MockException might be thrown. + + The following examples shows how to setup the repository with a + default strict behavior, overriding that default for a + specific mock: + + var repository = new MockRepository(MockBehavior.Strict); + + // this particular one we want loose + var foo = repository.Create<IFoo>(MockBehavior.Loose); + var bar = repository.Create<IBar>(); + + // specify setups + + // exercise the mocks here + + repository.Verify(); + + + + + + + Utility factory class to use to construct multiple + mocks when consistent verification is + desired for all of them. + + + If multiple mocks will be created during a test, passing + the desired (if different than the + or the one + passed to the factory constructor) and later verifying each + mock can become repetitive and tedious. + + This factory class helps in that scenario by providing a + simplified creation of multiple mocks with a default + (unless overriden by calling + ) and posterior verification. + + + + The following is a straightforward example on how to + create and automatically verify strict mocks using a : + + var factory = new MockFactory(MockBehavior.Strict); + + var foo = factory.Create<IFoo>(); + var bar = factory.Create<IBar>(); + + // no need to call Verifiable() on the setup + // as we'll be validating all of them anyway. + foo.Setup(f => f.Do()); + bar.Setup(b => b.Redo()); + + // exercise the mocks here + + factory.VerifyAll(); + // At this point all setups are already checked + // and an optional MockException might be thrown. + // Note also that because the mocks are strict, any invocation + // that doesn't have a matching setup will also throw a MockException. + + The following examples shows how to setup the factory + to create loose mocks and later verify only verifiable setups: + + var factory = new MockFactory(MockBehavior.Loose); + + var foo = factory.Create<IFoo>(); + var bar = factory.Create<IBar>(); + + // this setup will be verified when we verify the factory + foo.Setup(f => f.Do()).Verifiable(); + + // this setup will NOT be verified + foo.Setup(f => f.Calculate()); + + // this setup will be verified when we verify the factory + bar.Setup(b => b.Redo()).Verifiable(); + + // exercise the mocks here + // note that because the mocks are Loose, members + // called in the interfaces for which no matching + // setups exist will NOT throw exceptions, + // and will rather return default values. + + factory.Verify(); + // At this point verifiable setups are already checked + // and an optional MockException might be thrown. + + The following examples shows how to setup the factory with a + default strict behavior, overriding that default for a + specific mock: + + var factory = new MockFactory(MockBehavior.Strict); + + // this particular one we want loose + var foo = factory.Create<IFoo>(MockBehavior.Loose); + var bar = factory.Create<IBar>(); + + // specify setups + + // exercise the mocks here + + factory.Verify(); + + + + + + + Initializes the factory with the given + for newly created mocks from the factory. + + The behavior to use for mocks created + using the factory method if not overriden + by using the overload. + + + + Creates a new mock with the default + specified at factory construction time. + + Type to mock. + A new . + + + var factory = new MockFactory(MockBehavior.Strict); + + var foo = factory.Create<IFoo>(); + // use mock on tests + + factory.VerifyAll(); + + + + + + Creates a new mock with the default + specified at factory construction time and with the + the given constructor arguments for the class. + + + The mock will try to find the best match constructor given the + constructor arguments, and invoke that to initialize the instance. + This applies only to classes, not interfaces. + + Type to mock. + Constructor arguments for mocked classes. + A new . + + + var factory = new MockFactory(MockBehavior.Default); + + var mock = factory.Create<MyBase>("Foo", 25, true); + // use mock on tests + + factory.Verify(); + + + + + + Creates a new mock with the given . + + Type to mock. + Behavior to use for the mock, which overrides + the default behavior specified at factory construction time. + A new . + + The following example shows how to create a mock with a different + behavior to that specified as the default for the factory: + + var factory = new MockFactory(MockBehavior.Strict); + + var foo = factory.Create<IFoo>(MockBehavior.Loose); + + + + + + Creates a new mock with the given + and with the the given constructor arguments for the class. + + + The mock will try to find the best match constructor given the + constructor arguments, and invoke that to initialize the instance. + This applies only to classes, not interfaces. + + Type to mock. + Behavior to use for the mock, which overrides + the default behavior specified at factory construction time. + Constructor arguments for mocked classes. + A new . + + The following example shows how to create a mock with a different + behavior to that specified as the default for the factory, passing + constructor arguments: + + var factory = new MockFactory(MockBehavior.Default); + + var mock = factory.Create<MyBase>(MockBehavior.Strict, "Foo", 25, true); + + + + + + Implements creation of a new mock within the factory. + + Type to mock. + The behavior for the new mock. + Optional arguments for the construction of the mock. + + + + Verifies all verifiable expectations on all mocks created + by this factory. + + + One or more mocks had expectations that were not satisfied. + + + + Verifies all verifiable expectations on all mocks created + by this factory. + + + One or more mocks had expectations that were not satisfied. + + + + Invokes for each mock + in , and accumulates the resulting + that might be + thrown from the action. + + The action to execute against + each mock. + + + + Whether the base member virtual implementation will be called + for mocked classes if no setup is matched. Defaults to . + + + + + Specifies the behavior to use when returning default values for + unexpected invocations on loose mocks. + + + + + Gets the mocks that have been created by this factory and + that will get verified together. + + + + + Access the universe of mocks of the given type, to retrieve those + that behave according to the LINQ query specification. + + The type of the mocked object to query. + + + + Access the universe of mocks of the given type, to retrieve those + that behave according to the LINQ query specification. + + The predicate with the setup expressions. + The type of the mocked object to query. + + + + Creates an mock object of the indicated type. + + The type of the mocked object. + The mocked object created. + + + + Creates an mock object of the indicated type. + + The predicate with the setup expressions. + The type of the mocked object. + The mocked object created. + + + + Creates the mock query with the underlying queriable implementation. + + + + + Wraps the enumerator inside a queryable. + + + + + Method that is turned into the actual call from .Query{T}, to + transform the queryable query into a normal enumerable query. + This method is never used directly by consumers. + + + + + Initializes the repository with the given + for newly created mocks from the repository. + + The behavior to use for mocks created + using the repository method if not overriden + by using the overload. + + + + A that returns an empty default value + for invocations that do not have setups or return values, with loose mocks. + This is the default behavior for a mock. + + + + + Interface to be implemented by classes that determine the + default value of non-expected invocations. + + + + + Defines the default value to return in all the methods returning . + The type of the return value.The value to set as default. + + + + Provides a value for the given member and arguments. + + The member to provide a default value for. + + + + + The intention of is to create a more readable + string representation for the failure message. + + + + + Implements the fluent API. + + + + + Defines the Throws verb. + + + + + Specifies the exception to throw when the method is invoked. + + Exception instance to throw. + + This example shows how to throw an exception when the method is + invoked with an empty string argument: + + mock.Setup(x => x.Execute("")) + .Throws(new ArgumentException()); + + + + + + Specifies the type of exception to throw when the method is invoked. + + Type of exception to instantiate and throw when the setup is matched. + + This example shows how to throw an exception when the method is + invoked with an empty string argument: + + mock.Setup(x => x.Execute("")) + .Throws<ArgumentException>(); + + + + + + Implements the fluent API. + + + + + Defines occurrence members to constraint setups. + + + + + The expected invocation can happen at most once. + + + + var mock = new Mock<ICommand>(); + mock.Setup(foo => foo.Execute("ping")) + .AtMostOnce(); + + + + + + The expected invocation can happen at most specified number of times. + + The number of times to accept calls. + + + var mock = new Mock<ICommand>(); + mock.Setup(foo => foo.Execute("ping")) + .AtMost( 5 ); + + + + + + Defines the Verifiable verb. + + + + + Marks the expectation as verifiable, meaning that a call + to will check if this particular + expectation was met. + + + The following example marks the expectation as verifiable: + + mock.Expect(x => x.Execute("ping")) + .Returns(true) + .Verifiable(); + + + + + + Marks the expectation as verifiable, meaning that a call + to will check if this particular + expectation was met, and specifies a message for failures. + + + The following example marks the expectation as verifiable: + + mock.Expect(x => x.Execute("ping")) + .Returns(true) + .Verifiable("Ping should be executed always!"); + + + + + + Implements the fluent API. + + + + + We need this non-generics base class so that + we can use from + generic code. + + + + + Implements the fluent API. + + + + + Implements the fluent API. + + + + + Implements the fluent API. + + + + + Defines the Callback verb for property getter setups. + + + Mocked type. + Type of the property. + + + + Specifies a callback to invoke when the property is retrieved. + + Callback method to invoke. + + Invokes the given callback with the property value being set. + + mock.SetupGet(x => x.Suspended) + .Callback(() => called = true) + .Returns(true); + + + + + + Implements the fluent API. + + + + + Defines the Returns verb for property get setups. + + Mocked type. + Type of the property. + + + + Specifies the value to return. + + The value to return, or . + + Return a true value from the property getter call: + + mock.SetupGet(x => x.Suspended) + .Returns(true); + + + + + + Specifies a function that will calculate the value to return for the property. + + The function that will calculate the return value. + + Return a calculated value when the property is retrieved: + + mock.SetupGet(x => x.Suspended) + .Returns(() => returnValues[0]); + + The lambda expression to retrieve the return value is lazy-executed, + meaning that its value may change depending on the moment the property + is retrieved and the value the returnValues array has at + that moment. + + + + + Implements the fluent API. + + + + + Helper class to setup a full trace between many mocks + + + + + Initialize a trace setup + + + + + Allow sequence to be repeated + + + + + define nice api + + + + + Perform an expectation in the trace. + + + + + Marks a method as a matcher, which allows complete replacement + of the built-in class with your own argument + matching rules. + + + This feature has been deprecated in favor of the new + and simpler . + + + The argument matching is used to determine whether a concrete + invocation in the mock matches a given setup. This + matching mechanism is fully extensible. + + + There are two parts of a matcher: the compiler matcher + and the runtime matcher. + + + Compiler matcher + Used to satisfy the compiler requirements for the + argument. Needs to be a method optionally receiving any arguments + you might need for the matching, but with a return type that + matches that of the argument. + + Let's say I want to match a lists of orders that contains + a particular one. I might create a compiler matcher like the following: + + + public static class Orders + { + [Matcher] + public static IEnumerable<Order> Contains(Order order) + { + return null; + } + } + + Now we can invoke this static method instead of an argument in an + invocation: + + var order = new Order { ... }; + var mock = new Mock<IRepository<Order>>(); + + mock.Setup(x => x.Save(Orders.Contains(order))) + .Throws<ArgumentException>(); + + Note that the return value from the compiler matcher is irrelevant. + This method will never be called, and is just used to satisfy the + compiler and to signal Moq that this is not a method that we want + to be invoked at runtime. + + + + Runtime matcher + + The runtime matcher is the one that will actually perform evaluation + when the test is run, and is defined by convention to have the + same signature as the compiler matcher, but where the return + value is the first argument to the call, which contains the + object received by the actual invocation at runtime: + + public static bool Contains(IEnumerable<Order> orders, Order order) + { + return orders.Contains(order); + } + + At runtime, the mocked method will be invoked with a specific + list of orders. This value will be passed to this runtime + matcher as the first argument, while the second argument is the + one specified in the setup (x.Save(Orders.Contains(order))). + + The boolean returned determines whether the given argument has been + matched. If all arguments to the expected method are matched, then + the setup matches and is evaluated. + + + + + + Using this extensible infrastructure, you can easily replace the entire + set of matchers with your own. You can also avoid the + typical (and annoying) lengthy expressions that result when you have + multiple arguments that use generics. + + + The following is the complete example explained above: + + public static class Orders + { + [Matcher] + public static IEnumerable<Order> Contains(Order order) + { + return null; + } + + public static bool Contains(IEnumerable<Order> orders, Order order) + { + return orders.Contains(order); + } + } + + And the concrete test using this matcher: + + var order = new Order { ... }; + var mock = new Mock<IRepository<Order>>(); + + mock.Setup(x => x.Save(Orders.Contains(order))) + .Throws<ArgumentException>(); + + // use mock, invoke Save, and have the matcher filter. + + + + + + Provides a mock implementation of . + + Any interface type can be used for mocking, but for classes, only abstract and virtual members can be mocked. + + The behavior of the mock with regards to the setups and the actual calls is determined + by the optional that can be passed to the + constructor. + + Type to mock, which can be an interface or a class. + The following example shows establishing setups with specific values + for method invocations: + + // Arrange + var order = new Order(TALISKER, 50); + var mock = new Mock<IWarehouse>(); + + mock.Setup(x => x.HasInventory(TALISKER, 50)).Returns(true); + + // Act + order.Fill(mock.Object); + + // Assert + Assert.True(order.IsFilled); + + The following example shows how to use the class + to specify conditions for arguments instead of specific values: + + // Arrange + var order = new Order(TALISKER, 50); + var mock = new Mock<IWarehouse>(); + + // shows how to expect a value within a range + mock.Setup(x => x.HasInventory( + It.IsAny<string>(), + It.IsInRange(0, 100, Range.Inclusive))) + .Returns(false); + + // shows how to throw for unexpected calls. + mock.Setup(x => x.Remove( + It.IsAny<string>(), + It.IsAny<int>())) + .Throws(new InvalidOperationException()); + + // Act + order.Fill(mock.Object); + + // Assert + Assert.False(order.IsFilled); + + + + + + Obsolete. + + + + + Obsolete. + + + + + Obsolete. + + + + + Obsolete. + + + + + Obsolete. + + + + + Ctor invoked by AsTInterface exclusively. + + + + + Initializes an instance of the mock with default behavior. + + var mock = new Mock<IFormatProvider>(); + + + + + Initializes an instance of the mock with default behavior and with + the given constructor arguments for the class. (Only valid when is a class) + + The mock will try to find the best match constructor given the constructor arguments, and invoke that + to initialize the instance. This applies only for classes, not interfaces. + + var mock = new Mock<MyProvider>(someArgument, 25); + Optional constructor arguments if the mocked type is a class. + + + + Initializes an instance of the mock with the specified behavior. + + var mock = new Mock<IFormatProvider>(MockBehavior.Relaxed); + Behavior of the mock. + + + + Initializes an instance of the mock with a specific behavior with + the given constructor arguments for the class. + + The mock will try to find the best match constructor given the constructor arguments, and invoke that + to initialize the instance. This applies only to classes, not interfaces. + + var mock = new Mock<MyProvider>(someArgument, 25); + Behavior of the mock.Optional constructor arguments if the mocked type is a class. + + + + Returns the mocked object value. + + + + + Specifies a setup on the mocked type for a call to + to a void method. + + If more than one setup is specified for the same method or property, + the latest one wins and is the one that will be executed. + Lambda expression that specifies the expected method invocation. + + var mock = new Mock<IProcessor>(); + mock.Setup(x => x.Execute("ping")); + + + + + + Specifies a setup on the mocked type for a call to + to a value returning method. + Type of the return value. Typically omitted as it can be inferred from the expression. + If more than one setup is specified for the same method or property, + the latest one wins and is the one that will be executed. + Lambda expression that specifies the method invocation. + + mock.Setup(x => x.HasInventory("Talisker", 50)).Returns(true); + + + + + + Specifies a setup on the mocked type for a call to + to a property getter. + + If more than one setup is set for the same property getter, + the latest one wins and is the one that will be executed. + Type of the property. Typically omitted as it can be inferred from the expression.Lambda expression that specifies the property getter. + + mock.SetupGet(x => x.Suspended) + .Returns(true); + + + + + + Specifies a setup on the mocked type for a call to + to a property setter. + + If more than one setup is set for the same property setter, + the latest one wins and is the one that will be executed. + + This overloads allows the use of a callback already + typed for the property type. + + Type of the property. Typically omitted as it can be inferred from the expression.The Lambda expression that sets a property to a value. + + mock.SetupSet(x => x.Suspended = true); + + + + + + Specifies a setup on the mocked type for a call to + to a property setter. + + If more than one setup is set for the same property setter, + the latest one wins and is the one that will be executed. + Lambda expression that sets a property to a value. + + mock.SetupSet(x => x.Suspended = true); + + + + + + Specifies that the given property should have "property behavior", + meaning that setting its value will cause it to be saved and + later returned when the property is requested. (this is also + known as "stubbing"). + + Type of the property, inferred from the property + expression (does not need to be specified). + Property expression to stub. + If you have an interface with an int property Value, you might + stub it using the following straightforward call: + + var mock = new Mock<IHaveValue>(); + mock.Stub(v => v.Value); + + After the Stub call has been issued, setting and + retrieving the object value will behave as expected: + + IHaveValue v = mock.Object; + + v.Value = 5; + Assert.Equal(5, v.Value); + + + + + + Specifies that the given property should have "property behavior", + meaning that setting its value will cause it to be saved and + later returned when the property is requested. This overload + allows setting the initial value for the property. (this is also + known as "stubbing"). + + Type of the property, inferred from the property + expression (does not need to be specified). + Property expression to stub.Initial value for the property. + If you have an interface with an int property Value, you might + stub it using the following straightforward call: + + var mock = new Mock<IHaveValue>(); + mock.SetupProperty(v => v.Value, 5); + + After the SetupProperty call has been issued, setting and + retrieving the object value will behave as expected: + + IHaveValue v = mock.Object; + // Initial value was stored + Assert.Equal(5, v.Value); + + // New value set which changes the initial value + v.Value = 6; + Assert.Equal(6, v.Value); + + + + + + Specifies that the all properties on the mock should have "property behavior", + meaning that setting its value will cause it to be saved and + later returned when the property is requested. (this is also + known as "stubbing"). The default value for each property will be the + one generated as specified by the property for the mock. + + If the mock is set to , + the mocked default values will also get all properties setup recursively. + + + + + + + + Verifies that a specific invocation matching the given expression was performed on the mock. Use + in conjuntion with the default . + + This example assumes that the mock has been used, and later we want to verify that a given + invocation with specific parameters was performed: + + var mock = new Mock<IProcessor>(); + // exercise mock + //... + // Will throw if the test code didn't call Execute with a "ping" string argument. + mock.Verify(proc => proc.Execute("ping")); + + The invocation was not performed on the mock.Expression to verify. + + + + Verifies that a specific invocation matching the given expression was performed on the mock. Use + in conjuntion with the default . + + The invocation was not call the times specified by + . + Expression to verify.The number of times a method is allowed to be called. + + + + Verifies that a specific invocation matching the given expression was performed on the mock, + specifying a failure error message. Use in conjuntion with the default + . + + This example assumes that the mock has been used, and later we want to verify that a given + invocation with specific parameters was performed: + + var mock = new Mock<IProcessor>(); + // exercise mock + //... + // Will throw if the test code didn't call Execute with a "ping" string argument. + mock.Verify(proc => proc.Execute("ping")); + + The invocation was not performed on the mock.Expression to verify.Message to show if verification fails. + + + + Verifies that a specific invocation matching the given expression was performed on the mock, + specifying a failure error message. Use in conjuntion with the default + . + + The invocation was not call the times specified by + . + Expression to verify.The number of times a method is allowed to be called.Message to show if verification fails. + + + + Verifies that a specific invocation matching the given expression was performed on the mock. Use + in conjuntion with the default . + + This example assumes that the mock has been used, and later we want to verify that a given + invocation with specific parameters was performed: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't call HasInventory. + mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50)); + + The invocation was not performed on the mock.Expression to verify.Type of return value from the expression. + + + + Verifies that a specific invocation matching the given + expression was performed on the mock. Use in conjuntion + with the default . + + The invocation was not call the times specified by + . + Expression to verify.The number of times a method is allowed to be called.Type of return value from the expression. + + + + Verifies that a specific invocation matching the given + expression was performed on the mock, specifying a failure + error message. + + This example assumes that the mock has been used, + and later we want to verify that a given invocation + with specific parameters was performed: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't call HasInventory. + mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50), "When filling orders, inventory has to be checked"); + + The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.Type of return value from the expression. + + + + Verifies that a specific invocation matching the given + expression was performed on the mock, specifying a failure + error message. + + The invocation was not call the times specified by + . + Expression to verify.The number of times a method is allowed to be called.Message to show if verification fails.Type of return value from the expression. + + + + Verifies that a property was read on the mock. + + This example assumes that the mock has been used, + and later we want to verify that a given property + was retrieved from it: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't retrieve the IsClosed property. + mock.VerifyGet(warehouse => warehouse.IsClosed); + + The invocation was not performed on the mock.Expression to verify. + Type of the property to verify. Typically omitted as it can + be inferred from the expression's return type. + + + + + Verifies that a property was read on the mock. + + The invocation was not call the times specified by + . + The number of times a method is allowed to be called.Expression to verify. + Type of the property to verify. Typically omitted as it can + be inferred from the expression's return type. + + + + + Verifies that a property was read on the mock, specifying a failure + error message. + + This example assumes that the mock has been used, + and later we want to verify that a given property + was retrieved from it: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't retrieve the IsClosed property. + mock.VerifyGet(warehouse => warehouse.IsClosed); + + The invocation was not performed on the mock.Expression to verify.Message to show if verification fails. + Type of the property to verify. Typically omitted as it can + be inferred from the expression's return type. + + + + + Verifies that a property was read on the mock, specifying a failure + error message. + + The invocation was not call the times specified by + . + The number of times a method is allowed to be called.Expression to verify.Message to show if verification fails. + Type of the property to verify. Typically omitted as it can + be inferred from the expression's return type. + + + + + Verifies that a property was set on the mock. + + This example assumes that the mock has been used, + and later we want to verify that a given property + was set on it: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't set the IsClosed property. + mock.VerifySet(warehouse => warehouse.IsClosed = true); + + The invocation was not performed on the mock.Expression to verify. + + + + Verifies that a property was set on the mock. + + The invocation was not call the times specified by + . + The number of times a method is allowed to be called.Expression to verify. + + + + Verifies that a property was set on the mock, specifying + a failure message. + + This example assumes that the mock has been used, + and later we want to verify that a given property + was set on it: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't set the IsClosed property. + mock.VerifySet(warehouse => warehouse.IsClosed = true, "Warehouse should always be closed after the action"); + + The invocation was not performed on the mock.Expression to verify.Message to show if verification fails. + + + + Verifies that a property was set on the mock, specifying + a failure message. + + The invocation was not call the times specified by + . + The number of times a method is allowed to be called.Expression to verify.Message to show if verification fails. + + + + Raises the event referenced in using + the given argument. + + The argument is + invalid for the target event invocation, or the is + not an event attach or detach expression. + + The following example shows how to raise a event: + + var mock = new Mock<IViewModel>(); + + mock.Raise(x => x.PropertyChanged -= null, new PropertyChangedEventArgs("Name")); + + + This example shows how to invoke an event with a custom event arguments + class in a view that will cause its corresponding presenter to + react by changing its state: + + var mockView = new Mock<IOrdersView>(); + var presenter = new OrdersPresenter(mockView.Object); + + // Check that the presenter has no selection by default + Assert.Null(presenter.SelectedOrder); + + // Raise the event with a specific arguments data + mockView.Raise(v => v.SelectionChanged += null, new OrderEventArgs { Order = new Order("moq", 500) }); + + // Now the presenter reacted to the event, and we have a selected order + Assert.NotNull(presenter.SelectedOrder); + Assert.Equal("moq", presenter.SelectedOrder.ProductName); + + + + + + Raises the event referenced in using + the given argument for a non-EventHandler typed event. + + The arguments are + invalid for the target event invocation, or the is + not an event attach or detach expression. + + The following example shows how to raise a custom event that does not adhere to + the standard EventHandler: + + var mock = new Mock<IViewModel>(); + + mock.Raise(x => x.MyEvent -= null, "Name", bool, 25); + + + + + + Exposes the mocked object instance. + + + + + Provides legacy API members as extensions so that + existing code continues to compile, but new code + doesn't see then. + + + + + Obsolete. + + + + + Obsolete. + + + + + Obsolete. + + + + + Provides additional methods on mocks. + + + Provided as extension methods as they confuse the compiler + with the overloads taking Action. + + + + + Specifies a setup on the mocked type for a call to + to a property setter, regardless of its value. + + + If more than one setup is set for the same property setter, + the latest one wins and is the one that will be executed. + + Type of the property. Typically omitted as it can be inferred from the expression. + Type of the mock. + The target mock for the setup. + Lambda expression that specifies the property setter. + + + mock.SetupSet(x => x.Suspended); + + + + This method is not legacy, but must be on an extension method to avoid + confusing the compiler with the new Action syntax. + + + + + Verifies that a property has been set on the mock, regarless of its value. + + + This example assumes that the mock has been used, + and later we want to verify that a given invocation + with specific parameters was performed: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't set the IsClosed property. + mock.VerifySet(warehouse => warehouse.IsClosed); + + + The invocation was not performed on the mock. + Expression to verify. + The mock instance. + Mocked type. + Type of the property to verify. Typically omitted as it can + be inferred from the expression's return type. + + + + Verifies that a property has been set on the mock, specifying a failure + error message. + + + This example assumes that the mock has been used, + and later we want to verify that a given invocation + with specific parameters was performed: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't set the IsClosed property. + mock.VerifySet(warehouse => warehouse.IsClosed); + + + The invocation was not performed on the mock. + Expression to verify. + Message to show if verification fails. + The mock instance. + Mocked type. + Type of the property to verify. Typically omitted as it can + be inferred from the expression's return type. + + + + Verifies that a property has been set on the mock, regardless + of the value but only the specified number of times. + + + This example assumes that the mock has been used, + and later we want to verify that a given invocation + with specific parameters was performed: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't set the IsClosed property. + mock.VerifySet(warehouse => warehouse.IsClosed); + + + The invocation was not performed on the mock. + The invocation was not call the times specified by + . + The mock instance. + Mocked type. + The number of times a method is allowed to be called. + Expression to verify. + Type of the property to verify. Typically omitted as it can + be inferred from the expression's return type. + + + + Verifies that a property has been set on the mock, regardless + of the value but only the specified number of times, and specifying a failure + error message. + + + This example assumes that the mock has been used, + and later we want to verify that a given invocation + with specific parameters was performed: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't set the IsClosed property. + mock.VerifySet(warehouse => warehouse.IsClosed); + + + The invocation was not performed on the mock. + The invocation was not call the times specified by + . + The mock instance. + Mocked type. + The number of times a method is allowed to be called. + Message to show if verification fails. + Expression to verify. + Type of the property to verify. Typically omitted as it can + be inferred from the expression's return type. + + + + Helper for sequencing return values in the same method. + + + + + Return a sequence of values, once per call. + + + + + Casts the expression to a lambda expression, removing + a cast if there's any. + + + + + Casts the body of the lambda expression to a . + + If the body is not a method call. + + + + Converts the body of the lambda expression into the referenced by it. + + + + + Checks whether the body of the lambda expression is a property access. + + + + + Checks whether the expression is a property access. + + + + + Checks whether the body of the lambda expression is a property indexer, which is true + when the expression is an whose + has + equal to . + + + + + Checks whether the expression is a property indexer, which is true + when the expression is an whose + has + equal to . + + + + + Creates an expression that casts the given expression to the + type. + + + + + TODO: remove this code when https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=331583 + is fixed. + + + + + Provides partial evaluation of subtrees, whenever they can be evaluated locally. + + Matt Warren: http://blogs.msdn.com/mattwar + Documented by InSTEDD: http://www.instedd.org + + + + Performs evaluation and replacement of independent sub-trees + + The root of the expression tree. + A function that decides whether a given expression + node can be part of the local function. + A new tree with sub-trees evaluated and replaced. + + + + Performs evaluation and replacement of independent sub-trees + + The root of the expression tree. + A new tree with sub-trees evaluated and replaced. + + + + Evaluates and replaces sub-trees when first candidate is reached (top-down) + + + + + Performs bottom-up analysis to determine which nodes can possibly + be part of an evaluated sub-tree. + + + + + Ensures the given is not null. + Throws otherwise. + + + + + Ensures the given string is not null or empty. + Throws in the first case, or + in the latter. + + + + + Checks an argument to ensure it is in the specified range including the edges. + + Type of the argument to check, it must be an type. + + The expression containing the name of the argument. + The argument value to check. + The minimun allowed value for the argument. + The maximun allowed value for the argument. + + + + Checks an argument to ensure it is in the specified range excluding the edges. + + Type of the argument to check, it must be an type. + + The expression containing the name of the argument. + The argument value to check. + The minimun allowed value for the argument. + The maximun allowed value for the argument. + + + + Implemented by all generated mock object instances. + + + + + Implemented by all generated mock object instances. + + + + + Reference the Mock that contains this as the mock.Object value. + + + + + Reference the Mock that contains this as the mock.Object value. + + + + + Implements the actual interception and method invocation for + all mocks. + + + + + Get an eventInfo for a given event name. Search type ancestors depth first if necessary. + + Name of the event, with the set_ or get_ prefix already removed + + + + Given a type return all of its ancestors, both types and interfaces. + + The type to find immediate ancestors of + + + + Implements the fluent API. + + + + + Defines the Callback verb for property setter setups. + + Type of the property. + + + + Specifies a callback to invoke when the property is set that receives the + property value being set. + + Callback method to invoke. + + Invokes the given callback with the property value being set. + + mock.SetupSet(x => x.Suspended) + .Callback((bool state) => Console.WriteLine(state)); + + + + + + Allows the specification of a matching condition for an + argument in a method invocation, rather than a specific + argument value. "It" refers to the argument being matched. + + This class allows the setup to match a method invocation + with an arbitrary value, with a value in a specified range, or + even one that matches a given predicate. + + + + + Matches any value of the given type. + + Typically used when the actual argument value for a method + call is not relevant. + + + // Throws an exception for a call to Remove with any string value. + mock.Setup(x => x.Remove(It.IsAny<string>())).Throws(new InvalidOperationException()); + + Type of the value. + + + + Matches any value that satisfies the given predicate. + Type of the argument to check.The predicate used to match the method argument. + Allows the specification of a predicate to perform matching + of method call arguments. + + This example shows how to return the value 1 whenever the argument to the + Do method is an even number. + + mock.Setup(x => x.Do(It.Is<int>(i => i % 2 == 0))) + .Returns(1); + + This example shows how to throw an exception if the argument to the + method is a negative number: + + mock.Setup(x => x.GetUser(It.Is<int>(i => i < 0))) + .Throws(new ArgumentException()); + + + + + + Matches any value that is in the range specified. + Type of the argument to check.The lower bound of the range.The upper bound of the range. + The kind of range. See . + + The following example shows how to expect a method call + with an integer argument within the 0..100 range. + + mock.Setup(x => x.HasInventory( + It.IsAny<string>(), + It.IsInRange(0, 100, Range.Inclusive))) + .Returns(false); + + + + + + Matches a string argument if it matches the given regular expression pattern. + The pattern to use to match the string argument value. + The following example shows how to expect a call to a method where the + string argument matches the given regular expression: + + mock.Setup(x => x.Check(It.IsRegex("[a-z]+"))).Returns(1); + + + + + + Matches a string argument if it matches the given regular expression pattern. + The pattern to use to match the string argument value.The options used to interpret the pattern. + The following example shows how to expect a call to a method where the + string argument matches the given regular expression, in a case insensitive way: + + mock.Setup(x => x.Check(It.IsRegex("[a-z]+", RegexOptions.IgnoreCase))).Returns(1); + + + + + + Matcher to treat static functions as matchers. + + mock.Setup(x => x.StringMethod(A.MagicString())); + + public static class A + { + [Matcher] + public static string MagicString() { return null; } + public static bool MagicString(string arg) + { + return arg == "magic"; + } + } + + Will succeed if: mock.Object.StringMethod("magic"); + and fail with any other call. + + + + + Options to customize the behavior of the mock. + + + + + Causes the mock to always throw + an exception for invocations that don't have a + corresponding setup. + + + + + Will never throw exceptions, returning default + values when necessary (null for reference types, + zero for value types or empty enumerables and arrays). + + + + + Default mock behavior, which equals . + + + + + Exception thrown by mocks when setups are not matched, + the mock is not properly setup, etc. + + + A distinct exception type is provided so that exceptions + thrown by the mock can be differentiated in tests that + expect other exceptions to be thrown (i.e. ArgumentException). + + Richer exception hierarchy/types are not provided as + tests typically should not catch or expect exceptions + from the mocks. These are typically the result of changes + in the tested class or its collaborators implementation, and + result in fixes in the mock setup so that they dissapear and + allow the test to pass. + + + + + + Supports the serialization infrastructure. + + Serialization information. + Streaming context. + + + + Supports the serialization infrastructure. + + Serialization information. + Streaming context. + + + + Made internal as it's of no use for + consumers, but it's important for + our own tests. + + + + + Used by the mock factory to accumulate verification + failures. + + + + + Supports the serialization infrastructure. + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to Mock type has already been initialized by accessing its Object property. Adding interfaces must be done before that.. + + + + + Looks up a localized string similar to Value cannot be an empty string.. + + + + + Looks up a localized string similar to Can only add interfaces to the mock.. + + + + + Looks up a localized string similar to Can't set return value for void method {0}.. + + + + + Looks up a localized string similar to Constructor arguments cannot be passed for interface mocks.. + + + + + Looks up a localized string similar to A matching constructor for the given arguments was not found on the mocked type.. + + + + + Looks up a localized string similar to Could not locate event for attach or detach method {0}.. + + + + + Looks up a localized string similar to Expression {0} involves a field access, which is not supported. Use properties instead.. + + + + + Looks up a localized string similar to Type to mock must be an interface or an abstract or non-sealed class. . + + + + + Looks up a localized string similar to Cannot retrieve a mock with the given object type {0} as it's not the main type of the mock or any of its additional interfaces. + Please cast the argument to one of the supported types: {1}. + Remember that there's no generics covariance in the CLR, so your object must be one of these types in order for the call to succeed.. + + + + + Looks up a localized string similar to The equals ("==" or "=" in VB) and the conditional 'and' ("&&" or "AndAlso" in VB) operators are the only ones supported in the query specification expression. Unsupported expression: {0}. + + + + + Looks up a localized string similar to LINQ method '{0}' not supported.. + + + + + Looks up a localized string similar to Expression contains a call to a method which is not virtual (overridable in VB) or abstract. Unsupported expression: {0}. + + + + + Looks up a localized string similar to Member {0}.{1} does not exist.. + + + + + Looks up a localized string similar to Method {0}.{1} is public. Use strong-typed Expect overload instead: + mock.Setup(x => x.{1}()); + . + + + + + Looks up a localized string similar to {0} invocation failed with mock behavior {1}. + {2}. + + + + + Looks up a localized string similar to Expected only {0} calls to {1}.. + + + + + Looks up a localized string similar to Expected only one call to {0}.. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock at least {2} times, but was {4} times: {1}. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock at least once, but was never performed: {1}. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock at most {3} times, but was {4} times: {1}. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock at most once, but was {4} times: {1}. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock between {2} and {3} times (Exclusive), but was {4} times: {1}. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock between {2} and {3} times (Inclusive), but was {4} times: {1}. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock exactly {2} times, but was {4} times: {1}. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock should never have been performed, but was {4} times: {1}. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock once, but was {4} times: {1}. + + + + + Looks up a localized string similar to All invocations on the mock must have a corresponding setup.. + + + + + Looks up a localized string similar to Object instance was not created by Moq.. + + + + + Looks up a localized string similar to Out expression must evaluate to a constant value.. + + + + + Looks up a localized string similar to Property {0}.{1} does not have a getter.. + + + + + Looks up a localized string similar to Property {0}.{1} does not exist.. + + + + + Looks up a localized string similar to Property {0}.{1} is write-only.. + + + + + Looks up a localized string similar to Property {0}.{1} is read-only.. + + + + + Looks up a localized string similar to Property {0}.{1} does not have a setter.. + + + + + Looks up a localized string similar to Cannot raise a mocked event unless it has been associated (attached) to a concrete event in a mocked object.. + + + + + Looks up a localized string similar to Ref expression must evaluate to a constant value.. + + + + + Looks up a localized string similar to Invocation needs to return a value and therefore must have a corresponding setup that provides it.. + + + + + Looks up a localized string similar to A lambda expression is expected as the argument to It.Is<T>.. + + + + + Looks up a localized string similar to Invocation {0} should not have been made.. + + + + + Looks up a localized string similar to Expression is not a method invocation: {0}. + + + + + Looks up a localized string similar to Expression is not a property access: {0}. + + + + + Looks up a localized string similar to Expression is not a property setter invocation.. + + + + + Looks up a localized string similar to Expression references a method that does not belong to the mocked object: {0}. + + + + + Looks up a localized string similar to Invalid setup on a non-virtual (overridable in VB) member: {0}. + + + + + Looks up a localized string similar to Type {0} does not implement required interface {1}. + + + + + Looks up a localized string similar to Type {0} does not from required type {1}. + + + + + Looks up a localized string similar to To specify a setup for public property {0}.{1}, use the typed overloads, such as: + mock.Setup(x => x.{1}).Returns(value); + mock.SetupGet(x => x.{1}).Returns(value); //equivalent to previous one + mock.SetupSet(x => x.{1}).Callback(callbackDelegate); + . + + + + + Looks up a localized string similar to Unsupported expression: {0}. + + + + + Looks up a localized string similar to Only property accesses are supported in intermediate invocations on a setup. Unsupported expression {0}.. + + + + + Looks up a localized string similar to Expression contains intermediate property access {0}.{1} which is of type {2} and cannot be mocked. Unsupported expression {3}.. + + + + + Looks up a localized string similar to Setter expression cannot use argument matchers that receive parameters.. + + + + + Looks up a localized string similar to Member {0} is not supported for protected mocking.. + + + + + Looks up a localized string similar to Setter expression can only use static custom matchers.. + + + + + Looks up a localized string similar to The following setups were not matched: + {0}. + + + + + Looks up a localized string similar to Invalid verify on a non-virtual (overridable in VB) member: {0}. + + + + + Allows setups to be specified for protected members by using their + name as a string, rather than strong-typing them which is not possible + due to their visibility. + + + + + Specifies a setup for a void method invocation with the given + , optionally specifying arguments for the method call. + + The name of the void method to be invoked. + The optional arguments for the invocation. If argument matchers are used, + remember to use rather than . + + + + Specifies a setup for an invocation on a property or a non void method with the given + , optionally specifying arguments for the method call. + + The name of the method or property to be invoked. + The optional arguments for the invocation. If argument matchers are used, + remember to use rather than . + The return type of the method or property. + + + + Specifies a setup for an invocation on a property getter with the given + . + + The name of the property. + The type of the property. + + + + Specifies a setup for an invocation on a property setter with the given + . + + The name of the property. + The property value. If argument matchers are used, + remember to use rather than . + The type of the property. + + + + Specifies a verify for a void method with the given , + optionally specifying arguments for the method call. Use in conjuntion with the default + . + + The invocation was not call the times specified by + . + The name of the void method to be verified. + The number of times a method is allowed to be called. + The optional arguments for the invocation. If argument matchers are used, + remember to use rather than . + + + + Specifies a verify for an invocation on a property or a non void method with the given + , optionally specifying arguments for the method call. + + The invocation was not call the times specified by + . + The name of the method or property to be invoked. + The optional arguments for the invocation. If argument matchers are used, + remember to use rather than . + The number of times a method is allowed to be called. + The type of return value from the expression. + + + + Specifies a verify for an invocation on a property getter with the given + . + The invocation was not call the times specified by + . + + The name of the property. + The number of times a method is allowed to be called. + The type of the property. + + + + Specifies a setup for an invocation on a property setter with the given + . + + The invocation was not call the times specified by + . + The name of the property. + The number of times a method is allowed to be called. + The property value. + The type of the property. If argument matchers are used, + remember to use rather than . + + + + Allows the specification of a matching condition for an + argument in a protected member setup, rather than a specific + argument value. "ItExpr" refers to the argument being matched. + + + Use this variant of argument matching instead of + for protected setups. + This class allows the setup to match a method invocation + with an arbitrary value, with a value in a specified range, or + even one that matches a given predicate, or null. + + + + + Matches a null value of the given type. + + + Required for protected mocks as the null value cannot be used + directly as it prevents proper method overload selection. + + + + // Throws an exception for a call to Remove with a null string value. + mock.Protected() + .Setup("Remove", ItExpr.IsNull<string>()) + .Throws(new InvalidOperationException()); + + + Type of the value. + + + + Matches any value of the given type. + + + Typically used when the actual argument value for a method + call is not relevant. + + + + // Throws an exception for a call to Remove with any string value. + mock.Protected() + .Setup("Remove", ItExpr.IsAny<string>()) + .Throws(new InvalidOperationException()); + + + Type of the value. + + + + Matches any value that satisfies the given predicate. + + Type of the argument to check. + The predicate used to match the method argument. + + Allows the specification of a predicate to perform matching + of method call arguments. + + + This example shows how to return the value 1 whenever the argument to the + Do method is an even number. + + mock.Protected() + .Setup("Do", ItExpr.Is<int>(i => i % 2 == 0)) + .Returns(1); + + This example shows how to throw an exception if the argument to the + method is a negative number: + + mock.Protected() + .Setup("GetUser", ItExpr.Is<int>(i => i < 0)) + .Throws(new ArgumentException()); + + + + + + Matches any value that is in the range specified. + + Type of the argument to check. + The lower bound of the range. + The upper bound of the range. + The kind of range. See . + + The following example shows how to expect a method call + with an integer argument within the 0..100 range. + + mock.Protected() + .Setup("HasInventory", + ItExpr.IsAny<string>(), + ItExpr.IsInRange(0, 100, Range.Inclusive)) + .Returns(false); + + + + + + Matches a string argument if it matches the given regular expression pattern. + + The pattern to use to match the string argument value. + + The following example shows how to expect a call to a method where the + string argument matches the given regular expression: + + mock.Protected() + .Setup("Check", ItExpr.IsRegex("[a-z]+")) + .Returns(1); + + + + + + Matches a string argument if it matches the given regular expression pattern. + + The pattern to use to match the string argument value. + The options used to interpret the pattern. + + The following example shows how to expect a call to a method where the + string argument matches the given regular expression, in a case insensitive way: + + mock.Protected() + .Setup("Check", ItExpr.IsRegex("[a-z]+", RegexOptions.IgnoreCase)) + .Returns(1); + + + + + + Enables the Protected() method on , + allowing setups to be set for protected members by using their + name as a string, rather than strong-typing them which is not possible + due to their visibility. + + + + + Enable protected setups for the mock. + + Mocked object type. Typically omitted as it can be inferred from the mock instance. + The mock to set the protected setups on. + + + + + + + + + + + + Kind of range to use in a filter specified through + . + + + + + The range includes the to and + from values. + + + + + The range does not include the to and + from values. + + + + + Determines the way default values are generated + calculated for loose mocks. + + + + + Default behavior, which generates empty values for + value types (i.e. default(int)), empty array and + enumerables, and nulls for all other reference types. + + + + + Whenever the default value generated by + is null, replaces this value with a mock (if the type + can be mocked). + + + For sealed classes, a null value will be generated. + + + + + A default implementation of IQueryable for use with QueryProvider + + + + + The is a + static method that returns an IQueryable of Mocks of T which is used to + apply the linq specification to. + + + + + Allows creation custom value matchers that can be used on setups and verification, + completely replacing the built-in class with your own argument + matching rules. + + See also . + + + + + Provided for the sole purpose of rendering the delegate passed to the + matcher constructor if no friendly render lambda is provided. + + + + + Initializes the match with the condition that + will be checked in order to match invocation + values. + The condition to match against actual values. + + + + + + + + + This method is used to set an expression as the last matcher invoked, + which is used in the SetupSet to allow matchers in the prop = value + delegate expression. This delegate is executed in "fluent" mode in + order to capture the value being set, and construct the corresponding + methodcall. + This is also used in the MatcherFactory for each argument expression. + This method ensures that when we execute the delegate, we + also track the matcher that was invoked, so that when we create the + methodcall we build the expression using it, rather than the null/default + value returned from the actual invocation. + + + + + Allows creation custom value matchers that can be used on setups and verification, + completely replacing the built-in class with your own argument + matching rules. + Type of the value to match. + The argument matching is used to determine whether a concrete + invocation in the mock matches a given setup. This + matching mechanism is fully extensible. + + Creating a custom matcher is straightforward. You just need to create a method + that returns a value from a call to with + your matching condition and optional friendly render expression: + + [Matcher] + public Order IsBigOrder() + { + return Match<Order>.Create( + o => o.GrandTotal >= 5000, + /* a friendly expression to render on failures */ + () => IsBigOrder()); + } + + This method can be used in any mock setup invocation: + + mock.Setup(m => m.Submit(IsBigOrder()).Throws<UnauthorizedAccessException>(); + + At runtime, Moq knows that the return value was a matcher (note that the method MUST be + annotated with the [Matcher] attribute in order to determine this) and + evaluates your predicate with the actual value passed into your predicate. + + Another example might be a case where you want to match a lists of orders + that contains a particular one. You might create matcher like the following: + + + public static class Orders + { + [Matcher] + public static IEnumerable<Order> Contains(Order order) + { + return Match<IEnumerable<Order>>.Create(orders => orders.Contains(order)); + } + } + + Now we can invoke this static method instead of an argument in an + invocation: + + var order = new Order { ... }; + var mock = new Mock<IRepository<Order>>(); + + mock.Setup(x => x.Save(Orders.Contains(order))) + .Throws<ArgumentException>(); + + + + + + Tracks the current mock and interception context. + + + + + Having an active fluent mock context means that the invocation + is being performed in "trial" mode, just to gather the + target method and arguments that need to be matched later + when the actual invocation is made. + + + + + A that returns an empty default value + for non-mockeable types, and mocks for all other types (interfaces and + non-sealed classes) that can be mocked. + + + + + Allows querying the universe of mocks for those that behave + according to the LINQ query specification. + + + This entry-point into Linq to Mocks is the only one in the root Moq + namespace to ease discovery. But to get all the mocking extension + methods on Object, a using of Moq.Linq must be done, so that the + polluting of the intellisense for all objects is an explicit opt-in. + + + + + Access the universe of mocks of the given type, to retrieve those + that behave according to the LINQ query specification. + + The type of the mocked object to query. + + + + Access the universe of mocks of the given type, to retrieve those + that behave according to the LINQ query specification. + + The predicate with the setup expressions. + The type of the mocked object to query. + + + + Creates an mock object of the indicated type. + + The type of the mocked object. + The mocked object created. + + + + Creates an mock object of the indicated type. + + The predicate with the setup expressions. + The type of the mocked object. + The mocked object created. + + + + Creates the mock query with the underlying queriable implementation. + + + + + Wraps the enumerator inside a queryable. + + + + + Method that is turned into the actual call from .Query{T}, to + transform the queryable query into a normal enumerable query. + This method is never used directly by consumers. + + + + + Extension method used to support Linq-like setup properties that are not virtual but do have + a getter and a setter, thereby allowing the use of Linq to Mocks to quickly initialize Dtos too :) + + + + + Helper extensions that are used by the query translator. + + + + + Retrieves a fluent mock from the given setup expression. + + + + + Defines the number of invocations allowed by a mocked method. + + + + + Specifies that a mocked method should be invoked times as minimum. + The minimun number of times.An object defining the allowed number of invocations. + + + + Specifies that a mocked method should be invoked one time as minimum. + An object defining the allowed number of invocations. + + + + Specifies that a mocked method should be invoked time as maximun. + The maximun number of times.An object defining the allowed number of invocations. + + + + Specifies that a mocked method should be invoked one time as maximun. + An object defining the allowed number of invocations. + + + + Specifies that a mocked method should be invoked between and + times. + The minimun number of times.The maximun number of times. + The kind of range. See . + An object defining the allowed number of invocations. + + + + Specifies that a mocked method should be invoked exactly times. + The times that a method or property can be called.An object defining the allowed number of invocations. + + + + Specifies that a mocked method should not be invoked. + An object defining the allowed number of invocations. + + + + Specifies that a mocked method should be invoked exactly one time. + An object defining the allowed number of invocations. + + + + Determines whether the specified is equal to this instance. + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Determines whether two specified objects have the same value. + + The first . + + The second . + + true if the value of left is the same as the value of right; otherwise, false. + + + + + Determines whether two specified objects have different values. + + The first . + + The second . + + true if the value of left is different from the value of right; otherwise, false. + + + + diff --git a/Website/LOC.Website.Tests/bin/Debug/Newtonsoft.Json.dll b/Website/LOC.Website.Tests/bin/Debug/Newtonsoft.Json.dll new file mode 100644 index 000000000..dc9283f4c Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Debug/Newtonsoft.Json.dll differ diff --git a/Website/LOC.Website.Tests/bin/Debug/Newtonsoft.Json.xml b/Website/LOC.Website.Tests/bin/Debug/Newtonsoft.Json.xml new file mode 100644 index 000000000..ee891563c --- /dev/null +++ b/Website/LOC.Website.Tests/bin/Debug/Newtonsoft.Json.xml @@ -0,0 +1,7343 @@ + + + + Newtonsoft.Json + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class with the specified . + + + + + Reads the next JSON token from the stream. + + true if the next token was read successfully; false if there are no more tokens to read. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Skips the children of the current token. + + + + + Sets the current token. + + The new token. + + + + Sets the current token and value. + + The new token. + The value. + + + + Sets the state based on current token type. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Releases unmanaged and - optionally - managed resources + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Changes the to Closed. + + + + + Gets the current reader state. + + The current reader state. + + + + Gets or sets a value indicating whether the underlying stream or + should be closed when the reader is closed. + + + true to close the underlying stream or when + the reader is closed; otherwise false. The default is true. + + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + Get or set how time zones are handling when reading JSON. + + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Gets the type of the current JSON token. + + + + + Gets the text value of the current JSON token. + + + + + Gets The Common Language Runtime (CLR) type for the current JSON token. + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Gets the path of the current JSON token. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Specifies the state of the reader. + + + + + The Read method has not been called. + + + + + The end of the file has been reached successfully. + + + + + Reader is at a property. + + + + + Reader is at the start of an object. + + + + + Reader is in an object. + + + + + Reader is at the start of an array. + + + + + Reader is in an array. + + + + + The Close method has been called. + + + + + Reader has just read a value. + + + + + Reader is at the start of a constructor. + + + + + Reader in a constructor. + + + + + An error occurred that prevents the read operation from continuing. + + + + + The end of the file has been reached successfully. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The reader. + + + + Initializes a new instance of the class. + + The stream. + if set to true the root object will be read as a JSON array. + The used when reading values from BSON. + + + + Initializes a new instance of the class. + + The reader. + if set to true the root object will be read as a JSON array. + The used when reading values from BSON. + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + + A . This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Changes the to Closed. + + + + + Gets or sets a value indicating whether binary data reading should compatible with incorrect Json.NET 3.5 written binary. + + + true if binary data reading will be compatible with incorrect Json.NET 3.5 written binary; otherwise, false. + + + + + Gets or sets a value indicating whether the root object will be read as a JSON array. + + + true if the root object will be read as a JSON array; otherwise, false. + + + + + Gets or sets the used when reading values from BSON. + + The used when reading values from BSON. + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Creates an instance of the JsonWriter class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the end of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the end of an array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end constructor. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes the end of the current Json object or array. + + + + + Writes the current token. + + The to read the token from. + + + + Writes the specified end token. + + The end token to write. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON without changing the writer's state. + + The raw JSON to write. + + + + Writes raw JSON where a value is expected and updates the writer's state. + + The raw JSON to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + An error will raised if the value cannot be written as a single JSON token. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Gets or sets a value indicating whether the underlying stream or + should be closed when the writer is closed. + + + true to close the underlying stream or when + the writer is closed; otherwise false. The default is true. + + + + + Gets the top. + + The top. + + + + Gets the state of the writer. + + + + + Gets the path of the writer. + + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling when writing JSON. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The writer. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Writes the end. + + The token. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes raw JSON where a value is expected and updates the writer's state. + + The raw JSON to write. + + + + Writes the beginning of a Json array. + + + + + Writes the beginning of a Json object. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Closes this stream and the underlying stream. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value that represents a BSON object id. + + + + + + Writes a BSON regex. + + The regex pattern. + The regex options. + + + + Gets or sets the used when writing values to BSON. + When set to no conversion will occur. + + The used when writing values to BSON. + + + + Represents a BSON Oid (object id). + + + + + Initializes a new instance of the class. + + The Oid value. + + + + Gets or sets the value of the Oid. + + The value of the Oid. + + + + Converts a binary value to and from a base 64 string value. + + + + + Converts an object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets the of the JSON produced by the JsonConverter. + + The of the JSON produced by the JsonConverter. + + + + Gets a value indicating whether this can read JSON. + + true if this can read JSON; otherwise, false. + + + + Gets a value indicating whether this can write JSON. + + true if this can write JSON; otherwise, false. + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Create a custom object + + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Creates an object which will then be populated by the serializer. + + Type of the object. + + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets a value indicating whether this can write JSON. + + + true if this can write JSON; otherwise, false. + + + + + Provides a base class for converting a to and from JSON. + + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an Entity Framework EntityKey to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an ExpandoObject to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets a value indicating whether this can write JSON. + + + true if this can write JSON; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON and BSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON and BSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an to and from its name string value. + + + Converts an to and from its name string value. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + A cached representation of the Enum string representation to respect per Enum field name. + + The type of the Enum. + A map of enum field name to either the field name, or the configured enum member name (). + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets or sets a value indicating whether the written enum text should be camel case. + + true if the written enum text will be camel case; otherwise, false. + + + + Specifies how constructors are used when initializing objects during deserialization by the . + + + + + First attempt to use the public default constructor, then fall back to single paramatized constructor, then the non-public default constructor. + + + + + Json.NET will use a non-public default constructor before falling back to a paramatized constructor. + + + + + Converts a to and from a string (e.g. "1.2.3.4"). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing property value of the JSON that is being converted. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Specifies how dates are formatted when writing JSON text. + + + + + Dates are written in the ISO 8601 format, e.g. "2012-03-21T05:40Z". + + + + + Dates are written in the Microsoft JSON format, e.g. "\/Date(1198908717056)\/". + + + + + Specifies how to treat the time value when converting between string and . + + + + + Treat as local time. If the object represents a Coordinated Universal Time (UTC), it is converted to the local time. + + + + + Treat as a UTC. If the object represents a local time, it is converted to a UTC. + + + + + Treat as a local time if a is being converted to a string. + If a string is being converted to , convert to a local time if a time zone is specified. + + + + + Time zone information should be preserved when converting. + + + + + Specifies formatting options for the . + + + + + No special formatting is applied. This is the default. + + + + + Causes child objects to be indented according to the and settings. + + + + + Instructs the to use the specified constructor when deserializing that object. + + + + + Represents a raw JSON string. + + + + + Represents a value in JSON (string, integer, date, etc). + + + + + Represents an abstract JSON token. + + + + + Represents a collection of objects. + + The type of token + + + + Gets the with the specified key. + + + + + + Provides an interface to enable a class to return line and position information. + + + + + Gets a value indicating whether the class can return line information. + + + true if LineNumber and LinePosition can be provided; otherwise, false. + + + + + Gets the current line number. + + The current line number or 0 if no line information is available (for example, HasLineInfo returns false). + + + + Gets the current line position. + + The current line position or 0 if no line information is available (for example, HasLineInfo returns false). + + + + Compares the values of two tokens, including the values of all descendant tokens. + + The first to compare. + The second to compare. + true if the tokens are equal; otherwise false. + + + + Adds the specified content immediately after this token. + + A content object that contains simple content or a collection of content objects to be added after this token. + + + + Adds the specified content immediately before this token. + + A content object that contains simple content or a collection of content objects to be added before this token. + + + + Returns a collection of the ancestor tokens of this token. + + A collection of the ancestor tokens of this token. + + + + Returns a collection of the sibling tokens after this token, in document order. + + A collection of the sibling tokens after this tokens, in document order. + + + + Returns a collection of the sibling tokens before this token, in document order. + + A collection of the sibling tokens before this token, in document order. + + + + Gets the with the specified key converted to the specified type. + + The type to convert the token to. + The token key. + The converted token value. + + + + Returns a collection of the child tokens of this token, in document order. + + An of containing the child tokens of this , in document order. + + + + Returns a collection of the child tokens of this token, in document order, filtered by the specified type. + + The type to filter the child tokens on. + A containing the child tokens of this , in document order. + + + + Returns a collection of the child values of this token, in document order. + + The type to convert the values to. + A containing the child values of this , in document order. + + + + Removes this token from its parent. + + + + + Replaces this token with the specified token. + + The value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Returns the indented JSON for this token. + + + The indented JSON for this token. + + + + + Returns the JSON for this token using the given formatting and converters. + + Indicates how the output is formatted. + A collection of which will be used when writing the token. + The JSON for this token using the given formatting and converters. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Creates an for this token. + + An that can be used to read this token and its descendants. + + + + Creates a from an object. + + The object that will be used to create . + A with the value of the specified object + + + + Creates a from an object using the specified . + + The object that will be used to create . + The that will be used when reading the object. + A with the value of the specified object + + + + Creates the specified .NET type from the . + + The new object created from the JSON value. + + + + Creates the specified .NET type from the using the specified . + + The that will be used when creating the object. + The new object created from the JSON value. + + + + Creates a from a . + + An positioned at the token to read into this . + + An that contains the token and its descendant tokens + that were read from the reader. The runtime type of the token is determined + by the token type of the first token encountered in the reader. + + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from a . + + An positioned at the token to read into this . + + An that contains the token and its descendant tokens + that were read from the reader. The runtime type of the token is determined + by the token type of the first token encountered in the reader. + + + + + Selects the token that matches the object path. + + + The object path from the current to the + to be returned. This must be a string of property names or array indexes separated + by periods, such as Tables[0].DefaultView[0].Price in C# or + Tables(0).DefaultView(0).Price in Visual Basic. + + The that matches the object path or a null reference if no matching token is found. + + + + Selects the token that matches the object path. + + + The object path from the current to the + to be returned. This must be a string of property names or array indexes separated + by periods, such as Tables[0].DefaultView[0].Price in C# or + Tables(0).DefaultView(0).Price in Visual Basic. + + A flag to indicate whether an error should be thrown if no token is found. + The that matches the object path. + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Creates a new instance of the . All child tokens are recursively cloned. + + A new instance of the . + + + + Gets a comparer that can compare two tokens for value equality. + + A that can compare two nodes for value equality. + + + + Gets or sets the parent. + + The parent. + + + + Gets the root of this . + + The root of this . + + + + Gets the node type for this . + + The type. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Gets the next sibling token of this node. + + The that contains the next sibling token. + + + + Gets the previous sibling token of this node. + + The that contains the previous sibling token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Get the first child token of this token. + + A containing the first child token of the . + + + + Get the last child token of this token. + + A containing the last child token of the . + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Creates a comment with the given value. + + The value. + A comment with the given value. + + + + Creates a string with the given value. + + The value. + A string with the given value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Indicates whether the current object is equal to another object of the same type. + + + true if the current object is equal to the parameter; otherwise, false. + + An object to compare with this object. + + + + Determines whether the specified is equal to the current . + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + + The parameter is null. + + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format. + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format provider. + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format. + The format provider. + + A that represents this instance. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. + + An object to compare with this instance. + + A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: + Value + Meaning + Less than zero + This instance is less than . + Zero + This instance is equal to . + Greater than zero + This instance is greater than . + + + is not the same type as this instance. + + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Gets the node type for this . + + The type. + + + + Gets or sets the underlying token value. + + The underlying token value. + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class. + + The raw json. + + + + Creates an instance of with the content of the reader's current token. + + The reader. + An instance of with the content of the reader's current token. + + + + Indicating whether a property is required. + + + + + The property is not required. The default state. + + + + + The property must be defined in JSON but can be a null value. + + + + + The property must be defined in JSON and cannot be a null value. + + + + + Contract details for a used by the . + + + + + Contract details for a used by the . + + + + + Gets the underlying type for the contract. + + The underlying type for the contract. + + + + Gets or sets the type created during deserialization. + + The type created during deserialization. + + + + Gets or sets whether this type contract is serialized as a reference. + + Whether this type contract is serialized as a reference. + + + + Gets or sets the default for this contract. + + The converter. + + + + Gets or sets the method called immediately after deserialization of the object. + + The method called immediately after deserialization of the object. + + + + Gets or sets the method called during deserialization of the object. + + The method called during deserialization of the object. + + + + Gets or sets the method called after serialization of the object graph. + + The method called after serialization of the object graph. + + + + Gets or sets the method called before serialization of the object. + + The method called before serialization of the object. + + + + Gets or sets the default creator method used to create the object. + + The default creator method used to create the object. + + + + Gets or sets a value indicating whether the default creator is non public. + + true if the default object creator is non-public; otherwise, false. + + + + Gets or sets the method called when an error is thrown during the serialization of the object. + + The method called when an error is thrown during the serialization of the object. + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets the object's properties. + + The object's properties. + + + + Gets or sets the property name resolver. + + The property name resolver. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the ISerializable object constructor. + + The ISerializable object constructor. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Get and set values for a using dynamic methods. + + + + + Provides methods to get and set values. + + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + Initializes a new instance of the class. + + The member info. + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + Provides data for the Error event. + + + + + Initializes a new instance of the class. + + The current object. + The error context. + + + + Gets the current object the error event is being raised against. + + The current object the error event is being raised against. + + + + Gets the error context. + + The error context. + + + + Represents a view of a . + + + + + Initializes a new instance of the class. + + The name. + Type of the property. + + + + When overridden in a derived class, returns whether resetting an object changes its value. + + + true if resetting the component changes its value; otherwise, false. + + The component to test for reset capability. + + + + + When overridden in a derived class, gets the current value of the property on a component. + + + The value of a property for a given component. + + The component with the property for which to retrieve the value. + + + + + When overridden in a derived class, resets the value for this property of the component to the default value. + + The component with the property value that is to be reset to the default value. + + + + + When overridden in a derived class, sets the value of the component to a different value. + + The component with the property value that is to be set. + The new value. + + + + + When overridden in a derived class, determines a value indicating whether the value of this property needs to be persisted. + + + true if the property should be persisted; otherwise, false. + + The component with the property to be examined for persistence. + + + + + When overridden in a derived class, gets the type of the component this property is bound to. + + + A that represents the type of component this property is bound to. When the or methods are invoked, the object specified might be an instance of this type. + + + + + When overridden in a derived class, gets a value indicating whether this property is read-only. + + + true if the property is read-only; otherwise, false. + + + + + When overridden in a derived class, gets the type of the property. + + + A that represents the type of the property. + + + + + Gets the hash code for the name of the member. + + + + The hash code for the name of the member. + + + + + Used to resolve references when serializing and deserializing JSON by the . + + + + + Resolves a reference to its object. + + The serialization context. + The reference to resolve. + The object that + + + + Gets the reference for the sepecified object. + + The serialization context. + The object to get a reference for. + The reference to the object. + + + + Determines whether the specified object is referenced. + + The serialization context. + The object to test for a reference. + + true if the specified object is referenced; otherwise, false. + + + + + Adds a reference to the specified object. + + The serialization context. + The reference. + The object to reference. + + + + Specifies reference handling options for the . + + + + + Do not preserve references when serializing types. + + + + + Preserve references when serializing into a JSON object structure. + + + + + Preserve references when serializing into a JSON array structure. + + + + + Preserve references when serializing. + + + + + Instructs the how to serialize the collection. + + + + + Instructs the how to serialize the object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets the id. + + The id. + + + + Gets or sets the title. + + The title. + + + + Gets or sets the description. + + The description. + + + + Gets or sets a value that indicates whether to preserve object reference data. + + + true to keep object reference; otherwise, false. The default is false. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a flag indicating whether the array can contain null items + + A flag indicating whether the array can contain null items. + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets a value indicating whether null items are allowed in the collection. + + true if null items are allowed in the collection; otherwise, false. + + + + Specifies default value handling options for the . + + + + + Include members where the member value is the same as the member's default value when serializing objects. + Included members are written to JSON. Has no effect when deserializing. + + + + + Ignore members where the member value is the same as the member's default value when serializing objects + so that is is not written to JSON, and ignores setting members when the JSON value equals the member's default value. + + + + + Members with a default value but no JSON will be set to their default value when deserializing. + + + + + Ignore members where the member value is the same as the member's default value when serializing objects + and sets members to their default value when deserializing. + + + + + Instructs the to use the specified when serializing the member or class. + + + + + Initializes a new instance of the class. + + Type of the converter. + + + + Gets the type of the converter. + + The type of the converter. + + + + Instructs the how to serialize the object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified member serialization. + + The member serialization. + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets the member serialization. + + The member serialization. + + + + Specifies the settings on a object. + + + + + Initializes a new instance of the class. + + + + + Gets or sets how reference loops (e.g. a class referencing itself) is handled. + + Reference loop handling. + + + + Gets or sets how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + Missing member handling. + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets or sets how null values are handled during serialization and deserialization. + + Null value handling. + + + + Gets or sets how null default are handled during serialization and deserialization. + + The default value handling. + + + + Gets or sets a collection that will be used during serialization. + + The converters. + + + + Gets or sets how object references are preserved by the serializer. + + The preserve references handling. + + + + Gets or sets how type name writing and reading is handled by the serializer. + + The type name handling. + + + + Gets or sets how a type name assembly is written and resolved by the serializer. + + The type name assembly format. + + + + Gets or sets how constructors are used during deserialization. + + The constructor handling. + + + + Gets or sets the contract resolver used by the serializer when + serializing .NET objects to JSON and vice versa. + + The contract resolver. + + + + Gets or sets the used by the serializer when resolving references. + + The reference resolver. + + + + Gets or sets the used by the serializer when resolving type names. + + The binder. + + + + Gets or sets the error handler called during serialization and deserialization. + + The error handler called during serialization and deserialization. + + + + Gets or sets the used by the serializer when invoking serialization callback methods. + + The context. + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling during serialization and deserialization. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Represents a reader that provides validation. + + + + + Initializes a new instance of the class that + validates the content returned from the given . + + The to read from while validating. + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. + + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Sets an event handler for receiving schema validation errors. + + + + + Gets the text value of the current Json token. + + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Gets the path of the current JSON token. + + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + + Gets the type of the current Json token. + + + + + + Gets the Common Language Runtime (CLR) type for the current Json token. + + + + + + Gets or sets the schema. + + The schema. + + + + Gets the used to construct this . + + The specified in the constructor. + + + + Compares tokens to determine whether they are equal. + + + + + Determines whether the specified objects are equal. + + The first object of type to compare. + The second object of type to compare. + + true if the specified objects are equal; otherwise, false. + + + + + Returns a hash code for the specified object. + + The for which a hash code is to be returned. + A hash code for the specified object. + The type of is a reference type and is null. + + + + Specifies the member serialization options for the . + + + + + All public members are serialized by default. Members can be excluded using or . + This is the default member serialization mode. + + + + + Only members must be marked with or are serialized. + This member serialization mode can also be set by marking the class with . + + + + + All public and private fields are serialized. Members can be excluded using or . + This member serialization mode can also be set by marking the class with . + + + + + Specifies how object creation is handled by the . + + + + + Reuse existing objects, create new objects when needed. + + + + + Only reuse existing objects. + + + + + Always create new objects. + + + + + Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Gets or sets the date time styles used when converting a date to and from JSON. + + The date time styles used when converting a date to and from JSON. + + + + Gets or sets the date time format used when converting a date to and from JSON. + + The date time format used when converting a date to and from JSON. + + + + Gets or sets the culture used when converting a date to and from JSON. + + The culture used when converting a date to and from JSON. + + + + Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing property value of the JSON that is being converted. + The calling serializer. + The object value. + + + + Converts XML to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The calling serializer. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Checks if the attributeName is a namespace attribute. + + Attribute name to test. + The attribute name prefix if it has one, otherwise an empty string. + True if attribute name is for a namespace attribute, otherwise false. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Gets or sets the name of the root element to insert when deserializing to XML if the JSON structure has produces multiple root elements. + + The name of the deserialize root element. + + + + Gets or sets a flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + true if the array attibute is written to the XML; otherwise, false. + + + + Gets or sets a value indicating whether to write the root JSON object. + + true if the JSON root object is omitted; otherwise, false. + + + + Represents a reader that provides fast, non-cached, forward-only access to JSON text data. + + + + + Initializes a new instance of the class with the specified . + + The TextReader containing the XML data to read. + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Changes the state to closed. + + + + + Gets a value indicating whether the class can return line information. + + + true if LineNumber and LinePosition can be provided; otherwise, false. + + + + + Gets the current line number. + + + The current line number or 0 if no line information is available (for example, HasLineInfo returns false). + + + + + Gets the current line position. + + + The current line position or 0 if no line information is available (for example, HasLineInfo returns false). + + + + + Instructs the to always serialize the member with the specified name. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified name. + + Name of the property. + + + + Gets or sets the null value handling used when serializing this property. + + The null value handling. + + + + Gets or sets the default value handling used when serializing this property. + + The default value handling. + + + + Gets or sets the reference loop handling used when serializing this property. + + The reference loop handling. + + + + Gets or sets the object creation handling used when deserializing this property. + + The object creation handling. + + + + Gets or sets the type name handling used when serializing this property. + + The type name handling. + + + + Gets or sets whether this property's value is serialized as a reference. + + Whether this property's value is serialized as a reference. + + + + Gets or sets the order of serialization and deserialization of a member. + + The numeric order of serialization or deserialization. + + + + Gets or sets the name of the property. + + The name of the property. + + + + Gets or sets a value indicating whether this property is required. + + + A value indicating whether this property is required. + + + + + Instructs the not to serialize the public field or public read/write property value. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Creates an instance of the JsonWriter class using the specified . + + The TextWriter to write to. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the specified end token. + + The end token to write. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + + + + + Gets or sets which character to use to quote attribute values. + + + + + Gets or sets which character to use for indenting when is set to Formatting.Indented. + + + + + Gets or sets a value indicating whether object names will be surrounded with quotes. + + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Gets the line number indicating where the error occurred. + + The line number indicating where the error occurred. + + + + Gets the line position indicating where the error occurred. + + The line position indicating where the error occurred. + + + + Gets the path to the JSON where the error occurred. + + The path to the JSON where the error occurred. + + + + Represents a collection of . + + + + + Provides methods for converting between common language runtime types and JSON types. + + + + + Represents JavaScript's boolean value true as a string. This field is read-only. + + + + + Represents JavaScript's boolean value false as a string. This field is read-only. + + + + + Represents JavaScript's null as a string. This field is read-only. + + + + + Represents JavaScript's undefined as a string. This field is read-only. + + + + + Represents JavaScript's positive infinity as a string. This field is read-only. + + + + + Represents JavaScript's negative infinity as a string. This field is read-only. + + + + + Represents JavaScript's NaN as a string. This field is read-only. + + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation using the specified. + + The value to convert. + The format the date will be converted to. + The time zone handling when the date is converted to a string. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation using the specified. + + The value to convert. + The format the date will be converted to. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + The string delimiter character. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Serializes the specified object to a JSON string. + + The object to serialize. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string. + + The object to serialize. + Indicates how the output is formatted. + + A JSON string representation of the object. + + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A JSON string representation of the object. + + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Deserializes the JSON to a .NET object. + + The JSON to deserialize. + The deserialized object from the Json string. + + + + Deserializes the JSON to a .NET object. + + The JSON to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The of object being deserialized. + The deserialized object from the Json string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + The deserialized object from the Json string. + + + + Deserializes the JSON to the given anonymous type. + + + The anonymous type to deserialize to. This can't be specified + traditionally and must be infered from the anonymous type passed + as a parameter. + + The JSON to deserialize. + The anonymous type object. + The deserialized anonymous type from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The object to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize to. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize to. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + + + Populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + + + Asynchronously populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous populate operation. + + + + + Serializes the XML node to a JSON string. + + The node to serialize. + A JSON string of the XmlNode. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + A JSON string of the XmlNode. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + Omits writing the root object. + A JSON string of the XmlNode. + + + + Deserializes the XmlNode from a JSON string. + + The JSON string. + The deserialized XmlNode + + + + Deserializes the XmlNode from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + The deserialized XmlNode + + + + Deserializes the XmlNode from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + + A flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + The deserialized XmlNode + + + + Serializes the to a JSON string. + + The node to convert to JSON. + A JSON string of the XNode. + + + + Serializes the to a JSON string. + + The node to convert to JSON. + Indicates how the output is formatted. + A JSON string of the XNode. + + + + Serializes the to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + Omits writing the root object. + A JSON string of the XNode. + + + + Deserializes the from a JSON string. + + The JSON string. + The deserialized XNode + + + + Deserializes the from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + The deserialized XNode + + + + Deserializes the from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + + A flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + The deserialized XNode + + + + The exception thrown when an error occurs during Json serialization or deserialization. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Serializes and deserializes objects into and from the JSON format. + The enables you to control how objects are encoded into JSON. + + + + + Initializes a new instance of the class. + + + + + Creates a new instance using the specified . + + The settings to be applied to the . + A new instance using the specified . + + + + Populates the JSON values onto the target object. + + The that contains the JSON structure to reader values from. + The target object to populate values onto. + + + + Populates the JSON values onto the target object. + + The that contains the JSON structure to reader values from. + The target object to populate values onto. + + + + Deserializes the Json structure contained by the specified . + + The that contains the JSON structure to deserialize. + The being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The type of the object to deserialize. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Occurs when the errors during serialization and deserialization. + + + + + Gets or sets the used by the serializer when resolving references. + + + + + Gets or sets the used by the serializer when resolving type names. + + + + + Gets or sets how type name writing and reading is handled by the serializer. + + + + + Gets or sets how a type name assembly is written and resolved by the serializer. + + The type name assembly format. + + + + Gets or sets how object references are preserved by the serializer. + + + + + Get or set how reference loops (e.g. a class referencing itself) is handled. + + + + + Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + + + + Get or set how null values are handled during serialization and deserialization. + + + + + Get or set how null default are handled during serialization and deserialization. + + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets or sets how constructors are used during deserialization. + + The constructor handling. + + + + Gets a collection that will be used during serialization. + + Collection that will be used during serialization. + + + + Gets or sets the contract resolver used by the serializer when + serializing .NET objects to JSON and vice versa. + + + + + Gets or sets the used by the serializer when invoking serialization callback methods. + + The context. + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling during serialization and deserialization. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Contains the LINQ to JSON extension methods. + + + + + Returns a collection of tokens that contains the ancestors of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the ancestors of every node in the source collection. + + + + Returns a collection of tokens that contains the descendants of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the descendants of every node in the source collection. + + + + Returns a collection of child properties of every object in the source collection. + + An of that contains the source collection. + An of that contains the properties of every object in the source collection. + + + + Returns a collection of child values of every object in the source collection with the given key. + + An of that contains the source collection. + The token key. + An of that contains the values of every node in the source collection with the given key. + + + + Returns a collection of child values of every object in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child values of every object in the source collection with the given key. + + The type to convert the values to. + An of that contains the source collection. + The token key. + An that contains the converted values of every node in the source collection with the given key. + + + + Returns a collection of converted child values of every object in the source collection. + + The type to convert the values to. + An of that contains the source collection. + An that contains the converted values of every node in the source collection. + + + + Converts the value. + + The type to convert the value to. + A cast as a of . + A converted value. + + + + Converts the value. + + The source collection type. + The type to convert the value to. + A cast as a of . + A converted value. + + + + Returns a collection of child tokens of every array in the source collection. + + The source collection type. + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child tokens of every array in the source collection. + + An of that contains the source collection. + The type to convert the values to. + The source collection type. + An that contains the converted values of every node in the source collection. + + + + Returns the input typed as . + + An of that contains the source collection. + The input typed as . + + + + Returns the input typed as . + + The source collection type. + An of that contains the source collection. + The input typed as . + + + + Represents a JSON constructor. + + + + + Represents a token that can contain other tokens. + + + + + Raises the event. + + The instance containing the event data. + + + + Raises the event. + + The instance containing the event data. + + + + Raises the event. + + The instance containing the event data. + + + + Returns a collection of the child tokens of this token, in document order. + + + An of containing the child tokens of this , in document order. + + + + + Returns a collection of the child values of this token, in document order. + + The type to convert the values to. + + A containing the child values of this , in document order. + + + + + Returns a collection of the descendant tokens for this token in document order. + + An containing the descendant tokens of the . + + + + Adds the specified content as children of this . + + The content to be added. + + + + Adds the specified content as the first children of this . + + The content to be added. + + + + Creates an that can be used to add tokens to the . + + An that is ready to have content written to it. + + + + Replaces the children nodes of this token with the specified content. + + The content. + + + + Removes the child nodes from this token. + + + + + Occurs when the list changes or an item in the list changes. + + + + + Occurs before an item is added to the collection. + + + + + Occurs when the items list of the collection has changed, or the collection is reset. + + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Get the first child token of this token. + + + A containing the first child token of the . + + + + + Get the last child token of this token. + + + A containing the last child token of the . + + + + + Gets the count of child JSON tokens. + + The count of child JSON tokens + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name. + + The constructor name. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets or sets the name of this constructor. + + The constructor name. + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a collection of objects. + + The type of token + + + + An empty collection of objects. + + + + + Initializes a new instance of the struct. + + The enumerable. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + + + + Determines whether the specified is equal to this instance. + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the with the specified key. + + + + + + Represents a JSON object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Gets an of this object's properties. + + An of this object's properties. + + + + Gets a the specified name. + + The property name. + A with the specified name or null. + + + + Gets an of this object's property values. + + An of this object's property values. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Creates a from an object. + + The object that will be used to create . + The that will be used to read the object. + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Adds the specified property name. + + Name of the property. + The value. + + + + Removes the property with the specified name. + + Name of the property. + true if item was successfully removed; otherwise, false. + + + + Tries the get value. + + Name of the property. + The value. + true if a value was successfully retrieved; otherwise, false. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Raises the event with the provided arguments. + + Name of the property. + + + + Raises the event with the provided arguments. + + Name of the property. + + + + Returns the properties for this instance of a component. + + + A that represents the properties for this component instance. + + + + + Returns the properties for this instance of a component using the attribute array as a filter. + + An array of type that is used as a filter. + + A that represents the filtered properties for this component instance. + + + + + Returns a collection of custom attributes for this instance of a component. + + + An containing the attributes for this object. + + + + + Returns the class name of this instance of a component. + + + The class name of the object, or null if the class does not have a name. + + + + + Returns the name of this instance of a component. + + + The name of the object, or null if the object does not have a name. + + + + + Returns a type converter for this instance of a component. + + + A that is the converter for this object, or null if there is no for this object. + + + + + Returns the default event for this instance of a component. + + + An that represents the default event for this object, or null if this object does not have events. + + + + + Returns the default property for this instance of a component. + + + A that represents the default property for this object, or null if this object does not have properties. + + + + + Returns an editor of the specified type for this instance of a component. + + A that represents the editor for this object. + + An of the specified type that is the editor for this object, or null if the editor cannot be found. + + + + + Returns the events for this instance of a component using the specified attribute array as a filter. + + An array of type that is used as a filter. + + An that represents the filtered events for this component instance. + + + + + Returns the events for this instance of a component. + + + An that represents the events for this component instance. + + + + + Returns an object that contains the property described by the specified property descriptor. + + A that represents the property whose owner is to be found. + + An that represents the owner of the specified property. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Occurs when a property value changes. + + + + + Occurs when a property value is changing. + + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets or sets the with the specified property name. + + + + + + Represents a JSON array. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Creates a from an object. + + The object that will be used to create . + The that will be used to read the object. + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Determines the index of a specific item in the . + + The object to locate in the . + + The index of if found in the list; otherwise, -1. + + + + + Inserts an item to the at the specified index. + + The zero-based index at which should be inserted. + The object to insert into the . + + is not a valid index in the . + The is read-only. + + + + Removes the item at the specified index. + + The zero-based index of the item to remove. + + is not a valid index in the . + The is read-only. + + + + Adds an item to the . + + The object to add to the . + The is read-only. + + + + Removes all items from the . + + The is read-only. + + + + Determines whether the contains a specific value. + + The object to locate in the . + + true if is found in the ; otherwise, false. + + + + + Removes the first occurrence of a specific object from the . + + The object to remove from the . + + true if was successfully removed from the ; otherwise, false. This method also returns false if is not found in the original . + + The is read-only. + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets or sets the at the specified index. + + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class. + + The token to read from. + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Initializes a new instance of the class writing to the given . + + The container being written to. + + + + Initializes a new instance of the class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end. + + The token. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Gets the token being writen. + + The token being writen. + + + + Represents a JSON property. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class. + + The property name. + The property content. + + + + Initializes a new instance of the class. + + The property name. + The property content. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets the property name. + + The property name. + + + + Gets or sets the property value. + + The property value. + + + + Gets the node type for this . + + The type. + + + + Specifies the type of token. + + + + + No token type has been set. + + + + + A JSON object. + + + + + A JSON array. + + + + + A JSON constructor. + + + + + A JSON object property. + + + + + A comment. + + + + + An integer value. + + + + + A float value. + + + + + A string value. + + + + + A boolean value. + + + + + A null value. + + + + + An undefined value. + + + + + A date value. + + + + + A raw JSON value. + + + + + A collection of bytes value. + + + + + A Guid value. + + + + + A Uri value. + + + + + A TimeSpan value. + + + + + Contains the JSON schema extension methods. + + + + + Determines whether the is valid. + + The source to test. + The schema to test with. + + true if the specified is valid; otherwise, false. + + + + + Determines whether the is valid. + + The source to test. + The schema to test with. + When this method returns, contains any error messages generated while validating. + + true if the specified is valid; otherwise, false. + + + + + Validates the specified . + + The source to test. + The schema to test with. + + + + Validates the specified . + + The source to test. + The schema to test with. + The validation event handler. + + + + Returns detailed information about the schema exception. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Gets the line number indicating where the error occurred. + + The line number indicating where the error occurred. + + + + Gets the line position indicating where the error occurred. + + The line position indicating where the error occurred. + + + + Gets the path to the JSON where the error occurred. + + The path to the JSON where the error occurred. + + + + Resolves from an id. + + + + + Initializes a new instance of the class. + + + + + Gets a for the specified id. + + The id. + A for the specified id. + + + + Gets or sets the loaded schemas. + + The loaded schemas. + + + + Specifies undefined schema Id handling options for the . + + + + + Do not infer a schema Id. + + + + + Use the .NET type name as the schema Id. + + + + + Use the assembly qualified .NET type name as the schema Id. + + + + + Returns detailed information related to the . + + + + + Gets the associated with the validation error. + + The JsonSchemaException associated with the validation error. + + + + Gets the path of the JSON location where the validation error occurred. + + The path of the JSON location where the validation error occurred. + + + + Gets the text description corresponding to the validation error. + + The text description. + + + + Represents the callback method that will handle JSON schema validation events and the . + + + + + Resolves member mappings for a type, camel casing property names. + + + + + Used by to resolves a for a given . + + + + + Used by to resolves a for a given . + + + + + Resolves the contract for a given type. + + The type to resolve a contract for. + The contract for a given type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + If set to true the will use a cached shared with other resolvers of the same type. + Sharing the cache will significantly performance because expensive reflection will only happen once but could cause unexpected + behavior if different instances of the resolver are suppose to produce different results. When set to false it is highly + recommended to reuse instances with the . + + + + + Resolves the contract for a given type. + + The type to resolve a contract for. + The contract for a given type. + + + + Gets the serializable members for the type. + + The type to get serializable members for. + The serializable members for the type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates the constructor parameters. + + The constructor to create properties for. + The type's member properties. + Properties for the given . + + + + Creates a for the given . + + The matching member property. + The constructor parameter. + A created for the given . + + + + Resolves the default for the contract. + + Type of the object. + + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Determines which contract type is created for the given type. + + Type of the object. + A for the given type. + + + + Creates properties for the given . + + The type to create properties for. + /// The member serialization mode for the type. + Properties for the given . + + + + Creates the used by the serializer to get and set values from a member. + + The member. + The used by the serializer to get and set values from a member. + + + + Creates a for the given . + + The member's parent . + The member to create a for. + A created for the given . + + + + Resolves the name of the property. + + Name of the property. + Name of the property. + + + + Gets a value indicating whether members are being get and set using dynamic code generation. + This value is determined by the runtime permissions available. + + + true if using dynamic code generation; otherwise, false. + + + + + Gets or sets the default members search flags. + + The default members search flags. + + + + Gets or sets a value indicating whether compiler generated members should be serialized. + + + true if serialized compiler generated members; otherwise, false. + + + + + Gets or sets a value indicating whether to ignore the interface when serializing and deserializing types. + + + true if the interface will be ignored when serializing and deserializing types; otherwise, false. + + + + + Gets or sets a value indicating whether to ignore the attribute when serializing and deserializing types. + + + true if the attribute will be ignored when serializing and deserializing types; otherwise, false. + + + + + Initializes a new instance of the class. + + + + + Resolves the name of the property. + + Name of the property. + The property name camel cased. + + + + The default serialization binder used when resolving and loading classes from type names. + + + + + When overridden in a derived class, controls the binding of a serialized object to a type. + + Specifies the name of the serialized object. + Specifies the name of the serialized object. + + The type of the object the formatter creates a new instance of. + + + + + When overridden in a derived class, controls the binding of a serialized object to a type. + + The type of the object the formatter creates a new instance of. + Specifies the name of the serialized object. + Specifies the name of the serialized object. + + + + Provides information surrounding an error. + + + + + Gets or sets the error. + + The error. + + + + Gets the original object that caused the error. + + The original object that caused the error. + + + + Gets the member that caused the error. + + The member that caused the error. + + + + Gets the path of the JSON location where the error occurred. + + The path of the JSON location where the error occurred. + + + + Gets or sets a value indicating whether this is handled. + + true if handled; otherwise, false. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets the of the collection items. + + The of the collection items. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the property name resolver. + + The property name resolver. + + + + Gets the of the dictionary keys. + + The of the dictionary keys. + + + + Gets the of the dictionary values. + + The of the dictionary values. + + + + Maps a JSON property to a .NET member or constructor parameter. + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Gets or sets the name of the property. + + The name of the property. + + + + Gets or sets the type that declared this property. + + The type that declared this property. + + + + Gets or sets the order of serialization and deserialization of a member. + + The numeric order of serialization or deserialization. + + + + Gets or sets the name of the underlying member or parameter. + + The name of the underlying member or parameter. + + + + Gets the that will get and set the during serialization. + + The that will get and set the during serialization. + + + + Gets or sets the type of the property. + + The type of the property. + + + + Gets or sets the for the property. + If set this converter takes presidence over the contract converter for the property type. + + The converter. + + + + Gets the member converter. + + The member converter. + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + + Gets a value indicating whether this is readable. + + true if readable; otherwise, false. + + + + Gets a value indicating whether this is writable. + + true if writable; otherwise, false. + + + + Gets the default value. + + The default value. + + + + Gets a value indicating whether this is required. + + A value indicating whether this is required. + + + + Gets a value indicating whether this property preserves object references. + + + true if this instance is reference; otherwise, false. + + + + + Gets the property null value handling. + + The null value handling. + + + + Gets the property default value handling. + + The default value handling. + + + + Gets the property reference loop handling. + + The reference loop handling. + + + + Gets the property object creation handling. + + The object creation handling. + + + + Gets or sets the type name handling. + + The type name handling. + + + + Gets or sets a predicate used to determine whether the property should be serialize. + + A predicate used to determine whether the property should be serialize. + + + + Gets or sets a predicate used to determine whether the property should be serialized. + + A predicate used to determine whether the property should be serialized. + + + + Gets or sets an action used to set whether the property has been deserialized. + + An action used to set whether the property has been deserialized. + + + + A collection of objects. + + + + + Initializes a new instance of the class. + + The type. + + + + When implemented in a derived class, extracts the key from the specified element. + + The element from which to extract the key. + The key for the specified element. + + + + Adds a object. + + The property to add to the collection. + + + + Gets the closest matching object. + First attempts to get an exact case match of propertyName and then + a case insensitive match. + + Name of the property. + A matching property if found. + + + + Gets a property by property name. + + The name of the property to get. + Type property name string comparison. + A matching property if found. + + + + Specifies missing member handling options for the . + + + + + Ignore a missing member and do not attempt to deserialize it. + + + + + Throw a when a missing member is encountered during deserialization. + + + + + Specifies null value handling options for the . + + + + + Include null values when serializing and deserializing objects. + + + + + Ignore null values when serializing and deserializing objects. + + + + + Specifies reference loop handling options for the . + + + + + Throw a when a loop is encountered. + + + + + Ignore loop references and do not serialize. + + + + + Serialize loop references. + + + + + An in-memory representation of a JSON Schema. + + + + + Initializes a new instance of the class. + + + + + Reads a from the specified . + + The containing the JSON Schema to read. + The object representing the JSON Schema. + + + + Reads a from the specified . + + The containing the JSON Schema to read. + The to use when resolving schema references. + The object representing the JSON Schema. + + + + Load a from a string that contains schema JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Parses the specified json. + + The json. + The resolver. + A populated from the string that contains JSON. + + + + Writes this schema to a . + + A into which this method will write. + + + + Writes this schema to a using the specified . + + A into which this method will write. + The resolver used. + + + + Returns a that represents the current . + + + A that represents the current . + + + + + Gets or sets the id. + + + + + Gets or sets the title. + + + + + Gets or sets whether the object is required. + + + + + Gets or sets whether the object is read only. + + + + + Gets or sets whether the object is visible to users. + + + + + Gets or sets whether the object is transient. + + + + + Gets or sets the description of the object. + + + + + Gets or sets the types of values allowed by the object. + + The type. + + + + Gets or sets the pattern. + + The pattern. + + + + Gets or sets the minimum length. + + The minimum length. + + + + Gets or sets the maximum length. + + The maximum length. + + + + Gets or sets a number that the value should be divisble by. + + A number that the value should be divisble by. + + + + Gets or sets the minimum. + + The minimum. + + + + Gets or sets the maximum. + + The maximum. + + + + Gets or sets a flag indicating whether the value can not equal the number defined by the "minimum" attribute. + + A flag indicating whether the value can not equal the number defined by the "minimum" attribute. + + + + Gets or sets a flag indicating whether the value can not equal the number defined by the "maximum" attribute. + + A flag indicating whether the value can not equal the number defined by the "maximum" attribute. + + + + Gets or sets the minimum number of items. + + The minimum number of items. + + + + Gets or sets the maximum number of items. + + The maximum number of items. + + + + Gets or sets the of items. + + The of items. + + + + Gets or sets the of properties. + + The of properties. + + + + Gets or sets the of additional properties. + + The of additional properties. + + + + Gets or sets the pattern properties. + + The pattern properties. + + + + Gets or sets a value indicating whether additional properties are allowed. + + + true if additional properties are allowed; otherwise, false. + + + + + Gets or sets the required property if this property is present. + + The required property if this property is present. + + + + Gets or sets the identity. + + The identity. + + + + Gets or sets the a collection of valid enum values allowed. + + A collection of valid enum values allowed. + + + + Gets or sets a collection of options. + + A collection of options. + + + + Gets or sets disallowed types. + + The disallow types. + + + + Gets or sets the default value. + + The default value. + + + + Gets or sets the extend . + + The extended . + + + + Gets or sets the format. + + The format. + + + + Generates a from a specified . + + + + + Generate a from the specified type. + + The type to generate a from. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + The used to resolve schema references. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + Specify whether the generated root will be nullable. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + The used to resolve schema references. + Specify whether the generated root will be nullable. + A generated from the specified type. + + + + Gets or sets how undefined schemas are handled by the serializer. + + + + + Gets or sets the contract resolver. + + The contract resolver. + + + + The value types allowed by the . + + + + + No type specified. + + + + + String type. + + + + + Float type. + + + + + Integer type. + + + + + Boolean type. + + + + + Object type. + + + + + Array type. + + + + + Null type. + + + + + Any type. + + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the object member serialization. + + The member object serialization. + + + + Gets the object's properties. + + The object's properties. + + + + Gets the constructor parameters required for any non-default constructor + + + + + Gets or sets the override constructor used to create the object. + This is set when a constructor is marked up using the + JsonConstructor attribute. + + The override constructor. + + + + Gets or sets the parametrized constructor used to create the object. + + The parametrized constructor. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Get and set values for a using reflection. + + + + + Initializes a new instance of the class. + + The member info. + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + When applied to a method, specifies that the method is called when an error occurs serializing an object. + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic that returns a result + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic, but uses one of the arguments for + the result. + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic, but uses one of the arguments for + the result. + + + + + Returns a Restrictions object which includes our current restrictions merged + with a restriction limiting our type + + + + + Represents a method that constructs an object. + + + + + Specifies type name handling options for the . + + + + + Do not include the .NET type name when serializing types. + + + + + Include the .NET type name when serializing into a JSON object structure. + + + + + Include the .NET type name when serializing into a JSON array structure. + + + + + Always include the .NET type name when serializing. + + + + + Include the .NET type name when the type of the object being serialized is not the same as its declared type. + + + + + Converts the value to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert the value to. + The converted type. + + + + Converts the value to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert the value to. + The converted value if the conversion was successful or the default value of T if it failed. + + true if initialValue was converted successfully; otherwise, false. + + + + + Converts the value to the specified type. If the value is unable to be converted, the + value is checked whether it assignable to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert or cast the value to. + + The converted type. If conversion was unsuccessful, the initial value + is returned if assignable to the target type. + + + + + Gets a dictionary of the names and values of an Enum type. + + + + + + Gets a dictionary of the names and values of an Enum type. + + The enum type to get names and values for. + + + + + Specifies the type of Json token. + + + + + This is returned by the if a method has not been called. + + + + + An object start token. + + + + + An array start token. + + + + + A constructor start token. + + + + + An object property name. + + + + + A comment. + + + + + Raw JSON. + + + + + An integer. + + + + + A float. + + + + + A string. + + + + + A boolean. + + + + + A null token. + + + + + An undefined token. + + + + + An object end token. + + + + + An array end token. + + + + + A constructor end token. + + + + + A Date. + + + + + Byte data. + + + + + Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Adds the elements of the specified collection to the specified generic IList. + + The list to add to. + The collection of elements to add. + + + + Returns the index of the first occurrence in a sequence by using a specified IEqualityComparer. + + The type of the elements of source. + A sequence in which to locate a value. + The object to locate in the sequence + An equality comparer to compare values. + The zero-based index of the first occurrence of value within the entire sequence, if found; otherwise, –1. + + + + Gets the type of the typed collection's items. + + The type. + The type of the typed collection's items. + + + + Gets the member's underlying type. + + The member. + The underlying type of the member. + + + + Determines whether the member is an indexed property. + + The member. + + true if the member is an indexed property; otherwise, false. + + + + + Determines whether the property is an indexed property. + + The property. + + true if the property is an indexed property; otherwise, false. + + + + + Gets the member's value on the object. + + The member. + The target object. + The member's value on the object. + + + + Sets the member's value on the target object. + + The member. + The target. + The value. + + + + Determines whether the specified MemberInfo can be read. + + The MemberInfo to determine whether can be read. + /// if set to true then allow the member to be gotten non-publicly. + + true if the specified MemberInfo can be read; otherwise, false. + + + + + Determines whether the specified MemberInfo can be set. + + The MemberInfo to determine whether can be set. + if set to true then allow the member to be set non-publicly. + if set to true then allow the member to be set if read-only. + + true if the specified MemberInfo can be set; otherwise, false. + + + + + Determines whether the string is all white space. Empty string will return false. + + The string to test whether it is all white space. + + true if the string is all white space; otherwise, false. + + + + + Nulls an empty string. + + The string. + Null if the string was null, otherwise the string unchanged. + + + + Specifies the state of the . + + + + + An exception has been thrown, which has left the in an invalid state. + You may call the method to put the in the Closed state. + Any other method calls results in an being thrown. + + + + + The method has been called. + + + + + An object is being written. + + + + + A array is being written. + + + + + A constructor is being written. + + + + + A property is being written. + + + + + A write method has not been called. + + + + diff --git a/Website/LOC.Website.Tests/bin/Debug/StructureMap.dll b/Website/LOC.Website.Tests/bin/Debug/StructureMap.dll new file mode 100644 index 000000000..28a17b021 Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Debug/StructureMap.dll differ diff --git a/Website/LOC.Website.Tests/bin/Debug/StructureMap.pdb b/Website/LOC.Website.Tests/bin/Debug/StructureMap.pdb new file mode 100644 index 000000000..6c4dd1f78 Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Debug/StructureMap.pdb differ diff --git a/Website/LOC.Website.Tests/bin/Debug/StructureMap.xml b/Website/LOC.Website.Tests/bin/Debug/StructureMap.xml new file mode 100644 index 000000000..6376709c4 --- /dev/null +++ b/Website/LOC.Website.Tests/bin/Debug/StructureMap.xml @@ -0,0 +1,3931 @@ + + + + StructureMap + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Get the object of type T that is valid for this build session. + + + + + + + Get the object of type T that is valid for this build session by name. + + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Register a default object for the given PluginType that will + be used throughout the rest of the current object request + + + + + + + Same as GetInstance, but can gracefully return null if + the Type does not already exist + + + + + + + Same as GetInstance(name), but can gracefully return null if + the Type and name does not already exist + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Gets all objects in the current object graph that can be cast + to T that have already been created + + + + + + + Creates/Resolves every configured instance of PlutinType T + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Gets a reference to the BuildStack for this build session + + + + + The concrete type of the immediate parent object in the object graph + + + + + Gets the root "frame" of the object request + + + + + The requested instance name of the object graph + + + + + Expression Builder that has grammars for defining policies at the + PluginType level. This expression is used for registering + open generic types + + + + + Convenience method that sets the default concrete type of the PluginType. The "concreteType" + can only accept types that do not have any primitive constructor arguments. + StructureMap has to know how to construct all of the constructor argument types. + + + + + + + Use this configured Instance as is + + + + + + Shorter way to call TheDefaultIsConcreteType + + + + + + + Shortcut to add a value by type + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Configure this type as the supplied value + + + + + + Sets the object creation of the instances of the PluginType. For example: PerRequest, + Singleton, ThreadLocal, HttpContext, or Hybrid + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Registers an IBuildInterceptor for this Plugin Type that executes before + any object of this PluginType is created. IBuildInterceptor's can be + used to create a custom scope + + + + + + + Convenience method to mark a PluginFamily as a Singleton + + + + + + Convenience method to mark a PluginFamily as a Hybrid lifecycle + + + + + + Convenience method to mark a PluginFamily as HttpContext scoped + + + + + + + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. You can also chain other declarations after + this method to add constructor and setter arguments + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type by a specified name. You can also chain other declarations after + this method to add constructor and setter arguments + + + + + + + + Specify the value of this explicit argument + + + + + + + Pass in additional arguments by type T + + + + + + + + Pass in additional arguments by type + + + + + + + + Pass in additional arguments by name + + + + + + + Gets the default instance of type T using the explicitly configured arguments from the "args" + + + + + + + Gets a named instance of type T using the explicitly configured arguments from teh "args" + + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + Gets all configured instances of type T using explicitly configured arguments + + + + + + + Returns the System.Reflection.ConstructorInfo for the PluggedType. Uses either + the "greediest" constructor with the most arguments or the constructor function + marked with the [DefaultConstructor] + + + + + + The InstanceKey of the default instance of the PluginFamily + + + + + The CLR Type that defines the "Plugin" interface for the PluginFamily + + + + + Add an Assembly to the scanning operation + + + + + + Add an Assembly by name to the scanning operation + + + + + + Add the currently executing Assembly to the scanning operation + + + + + Add the Assembly that contains type T to the scanning operation + + + + + + Add the Assembly that contains type to the scanning operation + + + + + + Sweep the designated path and add any Assembly's found in this folder to the + scanning operation + + + + + + Sweep the designated path and add any Assembly's found in this folder to the + scanning operation. The assemblyFilter can be used to filter or limit the + Assembly's that are picked up. + + + + + + + Sweep the application base directory of current app domain and add any Assembly's + found to the scanning operation. + + + + + Sweep the application base directory of current app domain and add any Assembly's + found to the scanning operation. The assemblyFilter can be used to filter or limit the + Assembly's that are picked up. + + + + + Adds an ITypeScanner object to the scanning operation + + + + + + Creates and adds a new ITypeScanner of type T to this scanning operation + + + + + + Directs the scanning operation to automatically detect and include any Registry + classes found in the Assembly's being scanned + + + + + Add all concrete types of the Plugin Type as Instances of Plugin Type + + + + + + Add all concrete types of the Plugin Type as Instances of Plugin Type + + + + + + Makes this scanning operation ignore all [PluginFamily] and [Pluggable] attributes + + + + + Exclude types that match the Predicate from being scanned + + + + + + Exclude all types in this nameSpace or its children from the scanning operation + + + + + + Exclude all types in this nameSpace or its children from the scanning operation + + + + + + Only include types matching the Predicate in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Only include types from this nameSpace or its children in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Only include types from this nameSpace or its children in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Exclude this specific type from the scanning operation + + + + + + Adds a registration convention to be applied to all the types in this + logical "scan" operation + + + + + + Adds a registration convention to be applied to all the types in this + logical "scan" operation + + + + + Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete + class named "Something" that implements "ISomething" will be automatically + added to PluginType "ISomething" + + + + + Scans for PluginType's and Concrete Types that close the given open generic type + + + + + + + + + Automatically registers all concrete types without primitive arguments + against its first interface, if any + + + + + Directs the scanning to automatically register any type that is the single + implementation of an interface against that interface. + The filters apply + + + + + Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete + class named "Something" that implements "ISomething" will be automatically + added to PluginType "ISomething" + + + + + Scans for PluginType's and Concrete Types that close the given open generic type + + + + + + + + + Automatically registers all concrete types without primitive arguments + against its first interface, if any + + + + + Directs the scanning to automatically register any type that is the single + implementation of an interface against that interface. + The filters apply + + + + + A TypeInterceptor that is only applied if the MatchesType() + method is true for a given Type + + + + + An InstanceInterceptor can be registered on a per-Instance basis + to act on, or even replace, the object that is created before + it is passed back to the caller. This is primarily a hook + for runtime AOP scenarios. + + + + + Does this TypeInterceptor apply to the given type? + + + + + + + Specify how objects matching the Type predicate + will be intercepted + + + + + + Specify how objects matching the Type predicate + will be intercepted + + + + + + Used for auto-mocking container. When the factory is missing, we can generate a mock for it + + + + + An Instance class that builds objects by calling a constructor function on a concrete type + and filling setter properties. ConfiguredInstance should only be used for open generic types. + Favor SmartInstance{T} for all other usages. + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE + + + + + + + Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE + + + + + + + Inline definition of a constructor or a setter property dependency + + + + + + + Starts the definition of a child instance specifying the argument name + in the case of a constructor function that consumes more than one argument + of type T + + + + + + + + Inline definition of a constructor dependency + + + + + + + + Inline definition of a setter dependency + + + + + + + + Start the definition of a primitive argument to a constructor argument + + + + + + + Configure a primitive constructor argument + + + + + + + Configures an array of Instance's for the array dependency + + + + + + + Part of the Fluent Interface, represents a nonprimitive argument to a + constructure function + + + + + Use a previously configured and named instance for the child + + + + + + + Start the definition of a child instance by defining the concrete type + + + + + + + Start the definition of a child instance by defining the concrete type + + + + + + + Registers a configured instance to use as the argument to the parent's + constructor + + + + + + + Directs StructureMap to fill this dependency with the Default Instance of the + constructor or property type + + + + + + Base class for many of the Instance subclasses to support + method chaining in the Registry DSL for common options + + + + + + Set the name of this Instance + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + + Register an InstanceInterceptor with this Instance + + + + + + + Used to override the constructor of a class to be used by StructureMap to create + a Pluggable object + + + + + Examines a System.Type object and determines the ConstructorInfo to use in creating + instances of the Type + + + + + + + Used to implicitly mark a class as a Plugin candidate for StructureMap + + + + + Determines whether a Type object is marked as Pluggable + + + + + + + The ConcreteKey alias of the Type + + + + + Declares a class, abstract class, or interface to be the target of a PluginFamily in the container + + + + + Determines if a Type object is marked as a PluginFamily + + + + + + + If set, determines the shared "scope" of the instance -- PerRequest, Singleton, ThreadLocal, + HttpContext, etc. + + + + + InstanceKey of the default instance. Used to implicitly define the default without + declaring the instance in StructureMap.config + + + + + Declares the target to be built by StructureMap as a Singleton. One object instance will + be created for each named instance + + + + + Marks a Property in a Pluggable class as filled by setter injection + + + + + Marks a method with no parameters as a method that validates an instance. StructureMap + uses this method to validate the configuration file. If the method does not throw an + exception, the object is assumed to be valid. + + + + + Returns an array of any MethodInfo's on a Type that are marked as ValidationMethod + + CLR Type to search for validation methods + + + + + Constants for the names of Xml nodes and attributes in the StructureMap.config + file + + + + + The name of the default configuration file. The value is always StructurMap.config + + + + + Returns the absolute path to the StructureMap.config file + + + + + + Expression Builder that has grammars for defining policies at the + PluginType level + + + + + Add multiple Instance's to this PluginType + + + + + + + Conditional binding of instances + + + + + + + Access to all of the uncommon Instance types + + + + + + + Access to all of the uncommon Instance types + + + + + + + Convenience method that sets the default concrete type of the PluginType. Type T + can only accept types that do not have any primitive constructor arguments. + StructureMap has to know how to construct all of the constructor argument types. + + + + + + + + Shorthand to say TheDefault.Is.ConstructedBy(func) + + + + + + + Shorthand to say TheDefault.Is.ConstructedBy(func) + + + + + + + Shorthand to say TheDefault.IsThis(@object) + + + + + + + Sets the object creation of the instances of the PluginType. For example: PerRequest, + Singleton, ThreadLocal, HttpContext, or Hybrid + + + + + + + Convenience method to mark a PluginFamily as a Singleton + + + + + + Convenience method to mark a PluginFamily as a Transient + + + + + + Convenience method to mark a PluginFamily as a Hybrid lifecycle + + + + + + Convenience method to mark a PluginFamily as HttpContext scoped + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Adds an Interceptor to only this PluginType + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Registers an ILifecycle for this Plugin Type that executes before + any object of this PluginType is created. ILifecycle's can be + used to create a custom scope + + + + + + + Largely deprecated and unnecessary with the ability to add Xml configuration files + + + + + + + Forces StructureMap to always use a unique instance to + stop the "BuildSession" caching + + + + + + Adds the object to to the PLUGINTYPE + + + + + + + Add an Instance to this type created by a Lambda + + + + + + + Define the Default Instance for this PluginType + + + + + Expression class to help define a runtime Profile + + + + + Starts the definition of the default instance for the containing Profile. This is + still valid, but Type() is recommended + + + + + + + Designate or define the Instance for a type within + this Profile + + + + + + + Use statement to define the Profile defaults for a Generic type + + + + + + + Expression Builder inside of a Profile creation for + open generic types + + + + + Use this concreteType for the Instance of this Profile for the PluginType + + + + + + + Use this concreteType for the Instance of this Profile for the PluginType + + + + + + + Use this Instance for the Profile Instance of this Plugin Type + + + + + + + Use the named Instance as the Profile Instance for this PluginType + + + + + + + Use the named Instance as the Profile Instance for this PluginType + + + + + + + For this type and profile, build the object with this Lambda + + + + + + + Expression Builder within defining a Profile + + + + + + Use a named, preconfigured instance as the default instance for this profile + + + + + + + Use a named, preconfigured instance as the default instance for this profile + + + + + + + Define the default instance of the PluginType for the containing Profile + + + + + + + For this Profile, use an Instance with this Func + + + + + + + For this Profile, use an Instance with this Func + + + + + + + For this Profile, use this object + + + + + + + Access to the uncommon types of Instance + + + + + + For this Profile, use the Concrete Type + + + + + + + For this profile, use this concrete type + + + + + + + A Registry class provides methods and grammars for configuring a Container or ObjectFactory. + Using a Registry subclass is the recommended way of configuring a StructureMap Container. + + + public class MyRegistry : Registry + { + public MyRegistry() + { + ForRequestedType(typeof(IService)).TheDefaultIsConcreteType(typeof(Service)); + } + } + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Imports the configuration from another registry into this registry. + + + + + + Imports the configuration from another registry into this registry. + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + This method is a shortcut for specifying the default constructor and + setter arguments for a ConcreteType. ForConcreteType is shorthand for: + ForRequestedType[T]().Use[T].************** + when the PluginType and ConcreteType are the same Type + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Convenience method. Equivalent of ForRequestedType[PluginType]().AsSingletons() + + + + + + + Uses the configuration expressions of this Registry to create a PluginGraph + object that could be used to initialize a Container. This method is + mostly for internal usage, but might be helpful for diagnostics + + + + + + Adds an additional, non-Default Instance to the PluginType T. + + + + + + + Adds an additional, non-Default Instance to the designated pluginType + This method is mostly meant for open generic types + + + + + + + Expression Builder to define the defaults for a named Profile. Each call + to CreateProfile is additive. + + + + + + + An alternative way to use CreateProfile that uses ProfileExpression + as a Nested Closure. This usage will result in cleaner code for + multiple declarations + + + + + + + Registers a new TypeInterceptor object with the Container + + + + + + Allows you to define a TypeInterceptor inline with Lambdas or anonymous delegates + + + + + IfTypeMatches( ... ).InterceptWith( o => new ObjectWrapper(o) ); + + + + + Designates a policy for scanning assemblies to auto + register types + + + + + + Directs StructureMap to always inject dependencies into any and all public Setter properties + of the type PLUGINTYPE. + + + + + + + Creates automatic "policies" for which public setters are considered mandatory + properties by StructureMap that will be "setter injected" as part of the + construction process. + + + + + + Use to programmatically select the constructor function of a concrete + class. Applies globally to all Containers in a single AppDomain. + + + + + + + All requests For the "TO" types will be filled by fetching the "FROM" + type and casting it to "TO" + GetInstance(typeof(TO)) basically becomes (TO)GetInstance(typeof(FROM)) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( @object ) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( instance ) + + + + + + + + Shorthand for ForRequestedType(pluginType) + + + + + + + + Advanced Usage Only! Skips the Registry and goes right to the inner + Semantic Model of StructureMap. Use with care + + + + + + Adds the concreteType as an Instance of the pluginType. Mostly useful + for conventions + + + + + + + Adds the concreteType as an Instance of the pluginType with a name. Mostly + useful for conventions + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType. + Mostly useful for conventions + + + + + + Imports the configuration from another registry into this registry. + + + + + + Imports the configuration from another registry into this registry. + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + This method is a shortcut for specifying the default constructor and + setter arguments for a ConcreteType. ForConcreteType is shorthand for: + For[T]().Use[T].************** + when the PluginType and ConcreteType are the same Type + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Convenience method. Equivalent of ForRequestedType[PluginType]().Singletons() + + + + + + + Uses the configuration expressions of this Registry to create a PluginGraph + object that could be used to initialize a Container. This method is + mostly for internal usage, but might be helpful for diagnostics + + + + + + Adds an additional, non-Default Instance to the PluginType T. + + + + + + + Adds an additional, non-Default Instance to the designated pluginType + This method is mostly meant for open generic types + + + + + + + Expression Builder to define the defaults for a named Profile. Each call + to CreateProfile is additive. + + + + + + + An alternative way to use CreateProfile that uses ProfileExpression + as a Nested Closure. This usage will result in cleaner code for + multiple declarations + + + + + + + Registers a new TypeInterceptor object with the Container + + + + + + Allows you to define a TypeInterceptor inline with Lambdas or anonymous delegates + + + + + IfTypeMatches( ... ).InterceptWith( o => new ObjectWrapper(o) ); + + + + + Designates a policy for scanning assemblies to auto + register types + + + + + + Directs StructureMap to always inject dependencies into any and all public Setter properties + of the type PLUGINTYPE. + + + + + + + Creates automatic "policies" for which public setters are considered mandatory + properties by StructureMap that will be "setter injected" as part of the + construction process. + + + + + + Use to programmatically select the constructor function of a concrete + class. Applies globally to all Containers in a single AppDomain. + + + + + + + All requests For the "TO" types will be filled by fetching the "FROM" + type and casting it to "TO" + GetInstance(typeof(TO)) basically becomes (TO)GetInstance(typeof(FROM)) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( @object ) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( instance ) + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + + Advanced Usage Only! Skips the Registry and goes right to the inner + Semantic Model of StructureMap. Use with care + + + + + + Define the constructor and setter arguments for the default T + + + + + + Thrown by IProperty classes when an invalid value is applied to + a property of an InstanceGraph + + + + + Main exception for StructureMap. Use the ErrorCode to aid in troubleshooting + StructureMap problems + + + + + Represents a concrete class that can be built by StructureMap as an instance of the parent + PluginFamily’s PluginType. The properties of a Plugin are the CLR Type of the concrete class, + and the human-friendly concrete key that StructureMap will use to identify the Type. + + + + + The ConcreteKey that identifies the Plugin within a PluginFamily + + + + + The concrete CLR Type represented by the Plugin + + + + + Property's that will be filled by setter injection + + + + + Conceptually speaking, a PluginFamily object represents a point of abstraction or variability in + the system. A PluginFamily defines a CLR Type that StructureMap can build, and all of the possible + Plugin’s implementing the CLR Type. + + + + + The CLR Type that defines the "Plugin" interface for the PluginFamily + + + + + The InstanceKey of the default instance of the PluginFamily + + + + + Custom collection class for PluginFamily's + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Models the runtime configuration of a StructureMap Container + + + + + Closes the PluginGraph for adding or removing members. Runs all the AssemblyScanner's + and attempts to attach concrete types to the proper plugin types. Calculates the Profile defaults. + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Adds an AssemblyScanner to the PluginGraph. Used for Testing. + + + + + + Add configuration to a PluginGraph with the Registry DSL + + + + + + Designates whether a PluginGraph has been "Sealed." + + + + + Represents a PropertyInfo of a Plugin.PluggedType that is filled by Setter Injection + + + + + Custom collection class for SetterProperty objects + + + + + Designates a CLR type that is loaded by name. + + + + + Interface for a "Factory" pattern class that creates object instances of the PluginType + + + + + The main "container" object that implements the Service Locator pattern + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates or finds the named instance of T + + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Gets all configured instances of type T using explicitly configured arguments from the "args" + + + + + + + + Gets the default instance of type T using the explicitly configured arguments from the "args" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + Gets the named instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + + Starts a "Nested" Container for atomic, isolated access + + + + + + Starts a new "Nested" Container for atomic, isolated service location. Opens + + + + + + + Provides queryable access to the configured PluginType's and Instances of this Container + + + + + The name of the container. By default this is set to + a random Guid. This is a convience property to + assist with debugging. Feel free to set to anything, + as this is not used in any logic. + + + + + Default implementation of IInstanceFactory + + + + + Constructor to use when troubleshooting possible configuration issues. + + + + + + Constructor to create an Container + + PluginGraph containing the instance and type definitions + for the Container + + + + Creates or finds the named instance of T + + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + Gets all configured instances of type T using explicitly configured arguments from the "args" + + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + + Starts a "Nested" Container for atomic, isolated access + + + + + + Starts a new "Nested" Container for atomic, isolated service location. Opens + + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Sets the default instance for the PluginType + + + + + + + Provides queryable access to the configured PluginType's and Instances of this Container + + + + + The name of the container. By default this is set to + a random Guid. This is a convience property to + assist with debugging. Feel free to set to anything, + as this is not used in any logic. + + + + + GoF Memento representing an Object Instance + + + + + Retrieves the named property value as a string + + + + + + + Template method for implementation specific retrieval of the named property + + + + + + + Returns the named child InstanceMemento + + + + + + + Template method for implementation specific retrieval of the named property + + + + + + + This method is made public for testing. It is not necessary for normal usage. + + + + + + Used to create a templated InstanceMemento + + + + + + + The named type of the object instance represented by the InstanceMemento. Translates to a concrete + type + + + + + The named key of the object instance represented by the InstanceMemento + + + + + Gets the referred template name + + + + + + Template pattern property specifying whether the InstanceMemento is simply a reference + to another named instance. Useful for child objects. + + + + + Template pattern property specifying the instance key that the InstanceMemento refers to + + + + + Is the InstanceMemento a reference to the default instance of the plugin type? + + + + + A TypeInterceptor that always applies to all Instances of a given Plugin Type + + + + + Abstract class that is the supertype of all storage and retrieval mechanisms of + InstanceMemento instances + + + + + Retrieves the named InstanceMemento + + The instanceKey of the requested InstanceMemento + + + + + Retrieves an array of all InstanceMemento's stored by this MementoSource + + + + + + Template pattern method. Determines if the MementoSource contains a definition for the + requested instanceKey. + + + + + + + Template pattern method. Retrieves an InstanceMemento for the instanceKey + + + + + + + The type of MementoSource + + + + + String description of the MementoSource. Used in the StructureMap-Client UI. + + + + + An in-memory implementation of InstanceMemento. + + + + + Creates an instance of MemoryInstanceMemento that represents a reference to another + instance. + + The referenced instance key to another instance + + + + + Creates a MemoryInstanceMemento that represents a reference to the default instance + of a plugin type. + + + + + + Constructs a MemoryInstanceMemento without properties + + The concrete key of the plugin type + The identifying instance key + + + + Constructs a MemoryInstanceMemento with properties + + The concrete key of the plugin type + The identifying instance key + NameValueCollection of instance properties + + + + Sets the value of the named property + + + + + + + Deletes a named property from the DefaultInstanceMemento + + + + + + Links a child InstanceMemento as a named property + + + + + + + Links an array of InstanceMemento's to a named array property + + + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + The main static Facade for the StructureMap container + + + + + Restarts ObjectFactory and blows away all Singleton's and cached instances. Use with caution. + + + + + Remove and dispose all objects scoped by HttpContext. Call this method at the *end* of an Http request to clean up resources + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the named instance of T + + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Provides queryable access to the configured PluginType's and Instances of the inner Container + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + Reads configuration XML documents and builds the structures necessary to initialize + the Container/IInstanceFactory/InstanceBuilder/ObjectInstanceActivator objects + + + + + Reads the configuration information and returns the PluginGraph definition of + plugin families and plugin's + + + + + + Generic implementation of an XmlMementoSource + + + + + Base class for all MementoSource classes that store InstanceMemento's as + node-normalized Xml + + + + + Implementation of MementoSource that stores and retrieves an XmlInstanceMemento per file in a named directory. + DirectoryXmlMementoSource is meant to simplify complicated object graph configurations by isolating each instance to a separate + editable file. + + + + + Stores an Xml InstanceMemento per file in a directory + + A ";" delimited list of directories to look for mementos. DirectoryXmlMementoSource + will use the FIRST directory it finds + The file extension of the InstanceMemento files without a dot. Typically "xml" + NodeNormalized or AttributeNormalized + + + + Implementation of MementoSource that stores and retrieves an XmlInstanceMemento per Embedded Resource file + in a named namespace. EmbeddedFolderXmlMementoSource is meant to simplify complicated object graph configurations + by isolating each instance to a separate + editable file. + + NodeNormalized or AttributeNormalized + The name of the Assembly with the embedded resources + The root namespace of all of the mementos. + The file extension of the memento files - "xml" + + + + An in-memory MementoSource + + + + + Retrieves Xml InstanceMemento's from an xml file stored as an embedded resource in an assembly. + + Designates the nodes that are memento nodes + NodeNormalized or AttributeNormalized + The name of the Assembly the file is embedded into + The path to the embedded resource within the file + + + + Default Constructor + + MementoSource that contains the Memento Templates + MementoSource that contains instances consisting of Template valuee + + + + Stores Attribute-normalized InstanceMemento's in an external file + + + + + Implementation of XmlMementoSource that reads InstanceMemento's from an external file. + Useful to break the StructureMap.config file into smaller pieces. + + + + + Default constructor + + Path to the xml file that contains the instance configuration + XPath expression to the parent node that contains the InstanceMemento nodes. + If empty, it defaults to the top node + The name of the nodes that are InstanceMemento nodes. Useful to store + different types of instances in the same file + + + + An implementation of InstanceMemento that stores properties as Xml attributes + Limited functionality + + + + + Implementation of InstanceMemento that stores information in a node-normalized + Xml format. + + + + + specify what type you'd like the service returned as + + + + + + + Specify the open generic type that should have a single generic parameter + + + + + + + Used as the argument in the Container.Configure() method to describe + configuration directives and specify the sources of configuration for + a Container + + + + + Creates and adds a Registry object of type T. + + The Registry Type + + + + Imports all the configuration from a Registry object + + + + + + Imports configuration from an Xml file. The fileName + must point to an Xml file with valid StructureMap + configuration + + + + + + Imports configuration directly from an XmlNode. This + method was intended for scenarios like Xml being embedded + into an assembly. The node must be a 'StructureMap' node + + + + + + If true, directs StructureMap to look for configuration in the App.config. + The default value is false. + + + + + Expression Builder to define an Instance + + + + + + Register a previously built Instance. This provides a "catch all" + method to attach custom Instance objects. Synonym for Instance() + + + + + + Inject this object directly. Synonym to Object() + + + + + + + Gives you full access to all the different ways to specify an "Instance" + + + + + An Expression Builder to define Instances of a PluginType. + This is mostly used for configuring open generic types + + + + + Shortcut to register a Concrete Type as an instance. This method supports + method chaining to allow you to add constructor and setter arguments for + the concrete type + + + + + + + Shortcut to simply use the Instance with the given name + + + + + + + An Expression Builder that is used throughout the Registry DSL to + add and define Instances + + + + + + Register a previously built Instance. This provides a "catch all" + method to attach custom Instance objects. Synonym for IsThis() + + + + + + Inject this object directly. Synonym to IsThis() + + + + + + + Build the Instance with the constructor function and setter arguments. Starts + the definition of a SmartInstance + + + + + + + Build the Instance with the constructor function and setter arguments. Starts + the definition of a SmartInstance + + + + + + + Build the Instance with the constructor function and setter arguments. Use this + method for open generic types, and favor the generic version of OfConcreteType + for all other types + + + + + + + Build the Instance with the constructor function and setter arguments. Use this + method for open generic types, and favor the generic version of OfConcreteType + for all other types + + + + + + + Create an Instance that builds an object by calling a Lambda or + an anonymous delegate with no arguments + + + + + + + Create an Instance that builds an object by calling a Lambda or + an anonymous delegate with the IContext representing + the current object graph. + + + + + + + Use the Instance of this PluginType with the specified name. This is + generally only used while configuring child dependencies within a deep + object graph + + + + + + + Use the default Instance of this PluginType. This is + generally only used while configuring child dependencies within a deep + object graph + + + + + + Creates an Instance that stores this object of type T, + and returns a cloned copy of the template. + + + + + + + Caches template as a serialized byte stream. Uses deserialization + to create copies when the Instance is built. + + + + + + + Creates an Instance that will load an ASCX user control from the url + + + + + + + Creates an Instance according to conditional rules + + + + + + + Used as an expression builder to specify setter injection policies + + + + + Directs StructureMap to treat all public setters of type T as + mandatory properties + + + + + + Directs StructureMap to tread all public setters with + a PropertyType that matches the predicate as a + mandatory setter + + + + + + Directs StructureMap to treat all public setters that match the + rule as mandatory properties + + + + + + Directs StructureMap to treat all public setters with a property + type in the specified namespace as mandatory properties + + + + + + Directs StructureMap to treat all public setters with a property + type in the specified namespace as mandatory properties + + + + + + Directs StructureMap to treat all public setters where to property name + matches the specified rule as a mandatory property + + + + + + Base class for creating an object instance from an InstanceMemento. SubClasses are + emitted for each concrete Plugin with constructor parameters. + + + + + Allows built-in registration conventions to be configurable through the assembly scanning DSL + + + Intended for StructureMap internal use only. + Custom registration convention instances can be directly configured + before being passed to IAssemblyScanner.With(IRegistrationConvention). + + + + + Simply query to see if there are any implementations registered + + + + + + Ejects any instances of this instance from the current container + and permanently removes the instance from the container configuration + + + + + + Eject all instances of this PluginType from the current container, + but leaves the lifecycle behavior + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Models the state of a Container or ObjectFactory. Can be used to query for the + existence of types registered with StructureMap + + + + + Can StructureMap fulfill a request to ObjectFactory.GetInstance(pluginType) from the + current configuration. This does not include concrete classes that could be auto-configured + upon demand + + + + + + + Can StructureMap fulfill a request to ObjectFactory.GetInstance<T>() from the + current configuration. This does not include concrete classes that could be auto-configured + upon demand + + + + + + + Queryable access to all of the InstanceRef for a given PluginType + + + + + + + Queryable access to all of the InstanceRef for a given PluginType + + + + + + Does the current container have existing configuration for the "pluginType" + + + + + + + Does the current container have existing configuration for the type T + + + + + + Find the concrete type for the default Instance of T. + In other words, when I call Container.GetInstance(Type), + what do I get? May be indeterminate + + + + + + + Find the concrete type for the default Instance of pluginType. + In other words, when I call Container.GetInstance(Type), + what do I get? May be indeterminate + + + + + + Retrieves the configuration for the given type + + + + + + + Retrieves the configuration for the given type + + + + + + + Eject all objects, configuration, and Plugin Types matching this filter + + + + + + Eject all objects and configuration for any Plugin Type that matches this filter + + + + + + Eject all objects and Instance configuration for this PluginType + + + + + + Get each and every configured instance that could possibly + be cast to T + + + + + + + Access to all the Plugin Type registrations + + + + + Makes sure that every request for this object returns a unique object + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + The actual concrete type of this Instance. Not every type of IInstance + can determine the ConcreteType + + + + + Ejects and removes all objects and the configuration for the named instance from the + container + + + + + + + Ejects and removes all objects and configuration for the instances that match the filter + + + + + + + Determines if the pluggedType can be upcast to the pluginType + + + + + + + + Determines if the PluggedType is a valid Plugin into the + PluginType + + + + + + + + Imports configuration from an Xml file. The fileName + must point to an Xml file with valid StructureMap + configuration + + + + + + Imports configuration directly from an XmlNode. This + method was intended for scenarios like Xml being embedded + into an assembly. The node must be a 'StructureMap' node + + + + + + Creates and adds a Registry object of type T. + + The Registry Type + + + + Imports all the configuration from a Registry object + + + + + + If true, makes the existence of the StructureMap.config mandatory. + The default is false. + + + + + If true, the StructureMap.config file will be ignored even if it exists. + The default is false. + + + + + If true, directs StructureMap to look for configuration in the App.config. + The default value is false. + + + + + Designate the Default Profile. This will be applied as soon as the + Container is initialized. + + + + + Retrieves the configuration for the given type + + + + + + + Retrieves the configuration for the given type + + + + + + + Eject all objects, configuration, and Plugin Types matching this filter + + + + + + Eject all objects and configuration for any Plugin Type that matches this filter + + + + + + Eject all objects and Instance configuration for this PluginType + + + + + + Get each and every configured instance that could possibly + be cast to T + + + + + + + The requested PluginType of the Instance being create + + + + + The Name of the Instance being created + + + + + The actual ConcreteType being created. This will not always + be available + + + + + Models the current place in an object graph during the construction of + an instance. Provides contextual information that can be used + to alter the desired construction of child objects + + + + + The requested PluginType of the Instance being create + + + + + The Name of the Instance being created + + + + + The actual ConcreteType being created. This will not always + be available + + + + + Provides metadata about the object graph being constructed. More or less a stack trace of the GetInstance() pipeline + that can be used for "contextual" object construction + + + + + The top level of the object graph. Describes the original requested instance + + + + + The current BuildFrame + + + + + The immediate parent BuildFrame + + + + + Defines the value of a primitive argument to a constructur argument + + + + + Sets the value of the constructor argument + + + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings + + The key in appSettings for the value to use. + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings when it exists. Otherwise uses the provided default value. + + The key in appSettings for the value to use. + The value to use if an entry for does not exist in the appSettings section. + + + + + Instance that builds objects with by calling constructor functions and using setter properties + + The concrete type constructed by SmartInstance + + + + Sets the name of this Instance + + + + + + + Sets the name of this Instance + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register an InstanceInterceptor with this Instance + + + + + + + Define a primitive constructor argument + + + + + + + Set simple setter properties + + + + + + + Define a primitive setter property by specifying the property name with + an expression + + + + + + + Define a primitive setter property by specifying the property name + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type. Do not + use this method if there is more than one constructor arguments of the same type + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type. Do not + use this method if there is more than one constructor arguments of the same type + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type and constructor name. + Use this method if there is more than one constructor arguments of the same type + + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type and constructor name. + Use this method if there is more than one constructor arguments of the same type + + + + + + + + Inline definition of a setter dependency. The property name is specified with an Expression + + + + + + + + Inline definition of a setter dependency. The property name is specified with an Expression + + + + + + + + Inline definition of a setter dependency. Only use this method if there + is only a single property of the SETTERTYPE + + + + + + + Inline definition of a setter dependency. Only use this method if there + is only a single property of the SETTERTYPE + + + + + + + Inline definition of a dependency on an Array of the CHILD type. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + Inline definition of a dependency on an Array of the CHILD type and the specified setter property or constructor argument name. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + + Inline definition of a dependency on an Array of the CHILD type. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + Inline definition of a dependency on an Array of the CHILD type and the specified setter property or constructor argument name. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + + Expression Builder to help define multiple Instances for an Array dependency + + + + + + Nested Closure that allows you to add an unlimited number of child Instances + + + + + + + Specify an array of Instance objects directly for an Array dependency + + + + + + + Expression Builder that helps to define child dependencies inline + + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings + + The key in appSettings for the value to use. + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings when it exists. Otherwise uses the provided default value. + + The key in appSettings for the value to use. + The value to use if an entry for does not exist in the appSettings section. + + + + + Nested Closure to define a child dependency inline + + + + + + + Shortcut to set an inline dependency to an Instance + + + + + + + Shortcut to set an inline dependency to a designated object + + + + + + + Shortcut to set an inline dependency to a designated object + + + + + + + Set an Inline dependency to the Default Instance of the Property type + Used mostly to force an optional Setter property to be filled by + StructureMap + + + + + + Shortcut method to define a child dependency inline + + + + + + + Shortcut method to define a child dependency inline and configure + the child dependency + + + + + + + Provides virtual methods that can be used by subclasses to parse an expression tree. + + + This class actually already exists in the System.Core assembly...as an internal class. + I can only speculate as to why it is internal, but it is obviously much too dangerous + for anyone outside of Microsoft to be using... + + + + diff --git a/Website/LOC.Website.Tests/bin/Debug/nunit.framework.dll b/Website/LOC.Website.Tests/bin/Debug/nunit.framework.dll new file mode 100644 index 000000000..eaea9eedf Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Debug/nunit.framework.dll differ diff --git a/Website/LOC.Website.Tests/bin/Debug/nunit.framework.xml b/Website/LOC.Website.Tests/bin/Debug/nunit.framework.xml new file mode 100644 index 000000000..47fadb6bf --- /dev/null +++ b/Website/LOC.Website.Tests/bin/Debug/nunit.framework.xml @@ -0,0 +1,10845 @@ + + + + nunit.framework + + + + + Attribute used to apply a category to a test + + + + + The name of the category + + + + + Construct attribute for a given category based on + a name. The name may not contain the characters ',', + '+', '-' or '!'. However, this is not checked in the + constructor since it would cause an error to arise at + as the test was loaded without giving a clear indication + of where the problem is located. The error is handled + in NUnitFramework.cs by marking the test as not + runnable. + + The name of the category + + + + Protected constructor uses the Type name as the name + of the category. + + + + + The name of the category + + + + + Used to mark a field for use as a datapoint when executing a theory + within the same fixture that requires an argument of the field's Type. + + + + + Used to mark an array as containing a set of datapoints to be used + executing a theory within the same fixture that requires an argument + of the Type of the array elements. + + + + + Attribute used to provide descriptive text about a + test case or fixture. + + + + + Construct the attribute + + Text describing the test + + + + Gets the test description + + + + + Enumeration indicating how the expected message parameter is to be used + + + + Expect an exact match + + + Expect a message containing the parameter string + + + Match the regular expression provided as a parameter + + + Expect a message that starts with the parameter string + + + + ExpectedExceptionAttribute + + + + + + Constructor for a non-specific exception + + + + + Constructor for a given type of exception + + The type of the expected exception + + + + Constructor for a given exception name + + The full name of the expected exception + + + + Gets or sets the expected exception type + + + + + Gets or sets the full Type name of the expected exception + + + + + Gets or sets the expected message text + + + + + Gets or sets the user message displayed in case of failure + + + + + Gets or sets the type of match to be performed on the expected message + + + + + Gets the name of a method to be used as an exception handler + + + + + ExplicitAttribute marks a test or test fixture so that it will + only be run if explicitly executed from the gui or command line + or if it is included by use of a filter. The test will not be + run simply because an enclosing suite is run. + + + + + Default constructor + + + + + Constructor with a reason + + The reason test is marked explicit + + + + The reason test is marked explicit + + + + + Attribute used to mark a test that is to be ignored. + Ignored tests result in a warning message when the + tests are run. + + + + + Constructs the attribute without giving a reason + for ignoring the test. + + + + + Constructs the attribute giving a reason for ignoring the test + + The reason for ignoring the test + + + + The reason for ignoring a test + + + + + Abstract base for Attributes that are used to include tests + in the test run based on environmental settings. + + + + + Constructor with no included items specified, for use + with named property syntax. + + + + + Constructor taking one or more included items + + Comma-delimited list of included items + + + + Name of the item that is needed in order for + a test to run. Multiple itemss may be given, + separated by a comma. + + + + + Name of the item to be excluded. Multiple items + may be given, separated by a comma. + + + + + The reason for including or excluding the test + + + + + PlatformAttribute is used to mark a test fixture or an + individual method as applying to a particular platform only. + + + + + Constructor with no platforms specified, for use + with named property syntax. + + + + + Constructor taking one or more platforms + + Comma-deliminted list of platforms + + + + CultureAttribute is used to mark a test fixture or an + individual method as applying to a particular Culture only. + + + + + Constructor with no cultures specified, for use + with named property syntax. + + + + + Constructor taking one or more cultures + + Comma-deliminted list of cultures + + + + Marks a test to use a combinatorial join of any argument data + provided. NUnit will create a test case for every combination of + the arguments provided. This can result in a large number of test + cases and so should be used judiciously. This is the default join + type, so the attribute need not be used except as documentation. + + + + + PropertyAttribute is used to attach information to a test as a name/value pair.. + + + + + Construct a PropertyAttribute with a name and string value + + The name of the property + The property value + + + + Construct a PropertyAttribute with a name and int value + + The name of the property + The property value + + + + Construct a PropertyAttribute with a name and double value + + The name of the property + The property value + + + + Constructor for derived classes that set the + property dictionary directly. + + + + + Constructor for use by derived classes that use the + name of the type as the property name. Derived classes + must ensure that the Type of the property value is + a standard type supported by the BCL. Any custom + types will cause a serialization Exception when + in the client. + + + + + Gets the property dictionary for this attribute + + + + + Default constructor + + + + + Marks a test to use pairwise join of any argument data provided. + NUnit will attempt too excercise every pair of argument values at + least once, using as small a number of test cases as it can. With + only two arguments, this is the same as a combinatorial join. + + + + + Default constructor + + + + + Marks a test to use a sequential join of any argument data + provided. NUnit will use arguements for each parameter in + sequence, generating test cases up to the largest number + of argument values provided and using null for any arguments + for which it runs out of values. Normally, this should be + used with the same number of arguments for each parameter. + + + + + Default constructor + + + + + Summary description for MaxTimeAttribute. + + + + + Construct a MaxTimeAttribute, given a time in milliseconds. + + The maximum elapsed time in milliseconds + + + + RandomAttribute is used to supply a set of random values + to a single parameter of a parameterized test. + + + + + ValuesAttribute is used to provide literal arguments for + an individual parameter of a test. + + + + + Abstract base class for attributes that apply to parameters + and supply data for the parameter. + + + + + Gets the data to be provided to the specified parameter + + + + + The collection of data to be returned. Must + be set by any derived attribute classes. + We use an object[] so that the individual + elements may have their type changed in GetData + if necessary. + + + + + Construct with one argument + + + + + + Construct with two arguments + + + + + + + Construct with three arguments + + + + + + + + Construct with an array of arguments + + + + + + Get the collection of values to be used as arguments + + + + + Construct a set of doubles from 0.0 to 1.0, + specifying only the count. + + + + + + Construct a set of doubles from min to max + + + + + + + + Construct a set of ints from min to max + + + + + + + + Get the collection of values to be used as arguments + + + + + RangeAttribute is used to supply a range of values to an + individual parameter of a parameterized test. + + + + + Construct a range of ints using default step of 1 + + + + + + + Construct a range of ints specifying the step size + + + + + + + + Construct a range of longs + + + + + + + + Construct a range of doubles + + + + + + + + Construct a range of floats + + + + + + + + RepeatAttribute may be applied to test case in order + to run it multiple times. + + + + + Construct a RepeatAttribute + + The number of times to run the test + + + + RequiredAddinAttribute may be used to indicate the names of any addins + that must be present in order to run some or all of the tests in an + assembly. If the addin is not loaded, the entire assembly is marked + as NotRunnable. + + + + + Initializes a new instance of the class. + + The required addin. + + + + Gets the name of required addin. + + The required addin name. + + + + Summary description for SetCultureAttribute. + + + + + Construct given the name of a culture + + + + + + Summary description for SetUICultureAttribute. + + + + + Construct given the name of a culture + + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + SetUpFixtureAttribute is used to identify a SetUpFixture + + + + + Attribute used to mark a static (shared in VB) property + that returns a list of tests. + + + + + Attribute used to identify a method that is called + immediately after each test is run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Provide actions to execute before and after tests. + + + + + When implemented by an attribute, this interface implemented to provide actions to execute before and after tests. + + + + + Executed before each test is run + + Provides details about the test that is going to be run. + + + + Executed after each test is run + + Provides details about the test that has just been run. + + + + Provides the target for the action attribute + + The target for the action attribute + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + + [Test(Description = "more detailed description")] + publc void TestDescriptionMethod() + {} + } + + + + + + Descriptive text for this test + + + + + TestCaseAttribute is used to mark parameterized test cases + and provide them with their arguments. + + + + + The ITestCaseData interface is implemented by a class + that is able to return complete testcases for use by + a parameterized test method. + + NOTE: This interface is used in both the framework + and the core, even though that results in two different + types. However, sharing the source code guarantees that + the various implementations will be compatible and that + the core is able to reflect successfully over the + framework implementations of ITestCaseData. + + + + + Gets the argument list to be provided to the test + + + + + Gets the expected result + + + + + Indicates whether a result has been specified. + This is necessary because the result may be + null, so it's value cannot be checked. + + + + + Gets the expected exception Type + + + + + Gets the FullName of the expected exception + + + + + Gets the name to be used for the test + + + + + Gets the description of the test + + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + + Gets a value indicating whether this is explicit. + + true if explicit; otherwise, false. + + + + Gets the ignore reason. + + The ignore reason. + + + + Construct a TestCaseAttribute with a list of arguments. + This constructor is not CLS-Compliant + + + + + + Construct a TestCaseAttribute with a single argument + + + + + + Construct a TestCaseAttribute with a two arguments + + + + + + + Construct a TestCaseAttribute with a three arguments + + + + + + + + Gets the list of arguments to a test case + + + + + Gets or sets the expected result. + + The result. + + + + Gets the expected result. + + The result. + + + + Gets a flag indicating whether an expected + result has been set. + + + + + Gets a list of categories associated with this test; + + + + + Gets or sets the category associated with this test. + May be a single category or a comma-separated list. + + + + + Gets or sets the expected exception. + + The expected exception. + + + + Gets or sets the name the expected exception. + + The expected name of the exception. + + + + Gets or sets the expected message of the expected exception + + The expected message of the exception. + + + + Gets or sets the type of match to be performed on the expected message + + + + + Gets or sets the description. + + The description. + + + + Gets or sets the name of the test. + + The name of the test. + + + + Gets or sets the ignored status of the test + + + + + Gets or sets the ignored status of the test + + + + + Gets or sets the explicit status of the test + + + + + Gets or sets the reason for not running the test + + + + + Gets or sets the reason for not running the test. + Set has the side effect of marking the test as ignored. + + The ignore reason. + + + + FactoryAttribute indicates the source to be used to + provide test cases for a test method. + + + + + Construct with the name of the factory - for use with languages + that don't support params arrays. + + An array of the names of the factories that will provide data + + + + Construct with a Type and name - for use with languages + that don't support params arrays. + + The Type that will provide data + The name of the method, property or field that will provide data + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets or sets the category associated with this test. + May be a single category or a comma-separated list. + + + + + [TestFixture] + public class ExampleClass + {} + + + + + Default constructor + + + + + Construct with a object[] representing a set of arguments. + In .NET 2.0, the arguments may later be separated into + type arguments and constructor arguments. + + + + + + Descriptive text for this fixture + + + + + Gets and sets the category for this fixture. + May be a comma-separated list of categories. + + + + + Gets a list of categories for this fixture + + + + + The arguments originally provided to the attribute + + + + + Gets or sets a value indicating whether this should be ignored. + + true if ignore; otherwise, false. + + + + Gets or sets the ignore reason. May set Ignored as a side effect. + + The ignore reason. + + + + Get or set the type arguments. If not set + explicitly, any leading arguments that are + Types are taken as type arguments. + + + + + Attribute used to identify a method that is + called before any tests in a fixture are run. + + + + + Attribute used to identify a method that is called after + all the tests in a fixture have run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + + [Test(Description = "more detailed description")] + publc void TestDescriptionMethod() + {} + } + + + + + + Used on a method, marks the test with a timeout value in milliseconds. + The test will be run in a separate thread and is cancelled if the timeout + is exceeded. Used on a method or assembly, sets the default timeout + for all contained test methods. + + + + + Construct a TimeoutAttribute given a time in milliseconds + + The timeout value in milliseconds + + + + Marks a test that must run in the STA, causing it + to run in a separate thread if necessary. + + On methods, you may also use STAThreadAttribute + to serve the same purpose. + + + + + Construct a RequiresSTAAttribute + + + + + Marks a test that must run in the MTA, causing it + to run in a separate thread if necessary. + + On methods, you may also use MTAThreadAttribute + to serve the same purpose. + + + + + Construct a RequiresMTAAttribute + + + + + Marks a test that must run on a separate thread. + + + + + Construct a RequiresThreadAttribute + + + + + Construct a RequiresThreadAttribute, specifying the apartment + + + + + ValueSourceAttribute indicates the source to be used to + provide data for one parameter of a test method. + + + + + Construct with the name of the factory - for use with languages + that don't support params arrays. + + The name of the data source to be used + + + + Construct with a Type and name - for use with languages + that don't support params arrays. + + The Type that will provide data + The name of the method, property or field that will provide data + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + AttributeExistsConstraint tests for the presence of a + specified attribute on a Type. + + + + + The Constraint class is the base of all built-in constraints + within NUnit. It provides the operator overloads used to combine + constraints. + + + + + The IConstraintExpression interface is implemented by all + complete and resolvable constraints and expressions. + + + + + Return the top-level constraint for this expression + + + + + + Static UnsetObject used to detect derived constraints + failing to set the actual value. + + + + + The actual value being tested against a constraint + + + + + The display name of this Constraint for use by ToString() + + + + + Argument fields used by ToString(); + + + + + The builder holding this constraint + + + + + Construct a constraint with no arguments + + + + + Construct a constraint with one argument + + + + + Construct a constraint with two arguments + + + + + Sets the ConstraintBuilder holding this constraint + + + + + Write the failure message to the MessageWriter provided + as an argument. The default implementation simply passes + the constraint and the actual value to the writer, which + then displays the constraint description and the value. + + Constraints that need to provide additional details, + such as where the error occured can override this. + + The MessageWriter on which to display the message + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Test whether the constraint is satisfied by an + ActualValueDelegate that returns the value to be tested. + The default implementation simply evaluates the delegate + but derived classes may override it to provide for delayed + processing. + + An ActualValueDelegate + True for success, false for failure + + + + Test whether the constraint is satisfied by a given reference. + The default implementation simply dereferences the value but + derived classes may override it to provide for delayed processing. + + A reference to the value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + Default override of ToString returns the constraint DisplayName + followed by any arguments within angle brackets. + + + + + + Returns the string representation of this constraint + + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + + This operator creates a constraint that is satisfied if the + argument constraint is not satisfied. + + + + + Returns a DelayedConstraint with the specified delay time. + + The delay in milliseconds. + + + + + Returns a DelayedConstraint with the specified delay time + and polling interval. + + The delay in milliseconds. + The interval at which to test the constraint. + + + + + The display name of this Constraint for use by ToString(). + The default value is the name of the constraint with + trailing "Constraint" removed. Derived classes may set + this to another name in their constructors. + + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + + Returns a ConstraintExpression by appending Or + to the current constraint. + + + + + Class used to detect any derived constraints + that fail to set the actual value in their + Matches override. + + + + + Constructs an AttributeExistsConstraint for a specific attribute Type + + + + + + Tests whether the object provides the expected attribute. + + A Type, MethodInfo, or other ICustomAttributeProvider + True if the expected attribute is present, otherwise false + + + + Writes the description of the constraint to the specified writer + + + + + AttributeConstraint tests that a specified attribute is present + on a Type or other provider and that the value of the attribute + satisfies some other constraint. + + + + + Abstract base class used for prefixes + + + + + The base constraint + + + + + Construct given a base constraint + + + + + + Constructs an AttributeConstraint for a specified attriute + Type and base constraint. + + + + + + + Determines whether the Type or other provider has the + expected attribute and if its value matches the + additional constraint specified. + + + + + Writes a description of the attribute to the specified writer. + + + + + Writes the actual value supplied to the specified writer. + + + + + Returns a string representation of the constraint. + + + + + BasicConstraint is the abstract base for constraints that + perform a simple comparison to a constant value. + + + + + Initializes a new instance of the class. + + The expected. + The description. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + NullConstraint tests that the actual value is null + + + + + Initializes a new instance of the class. + + + + + TrueConstraint tests that the actual value is true + + + + + Initializes a new instance of the class. + + + + + FalseConstraint tests that the actual value is false + + + + + Initializes a new instance of the class. + + + + + NaNConstraint tests that the actual value is a double or float NaN + + + + + Test that the actual value is an NaN + + + + + + + Write the constraint description to a specified writer + + + + + + BinaryConstraint is the abstract base of all constraints + that combine two other constraints in some fashion. + + + + + The first constraint being combined + + + + + The second constraint being combined + + + + + Construct a BinaryConstraint from two other constraints + + The first constraint + The second constraint + + + + AndConstraint succeeds only if both members succeed. + + + + + Create an AndConstraint from two other constraints + + The first constraint + The second constraint + + + + Apply both member constraints to an actual value, succeeding + succeeding only if both of them succeed. + + The actual value + True if the constraints both succeeded + + + + Write a description for this contraint to a MessageWriter + + The MessageWriter to receive the description + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + OrConstraint succeeds if either member succeeds + + + + + Create an OrConstraint from two other constraints + + The first constraint + The second constraint + + + + Apply the member constraints to an actual value, succeeding + succeeding as soon as one of them succeeds. + + The actual value + True if either constraint succeeded + + + + Write a description for this contraint to a MessageWriter + + The MessageWriter to receive the description + + + + CollectionConstraint is the abstract base class for + constraints that operate on collections. + + + + + Construct an empty CollectionConstraint + + + + + Construct a CollectionConstraint + + + + + + Determines whether the specified enumerable is empty. + + The enumerable. + + true if the specified enumerable is empty; otherwise, false. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Protected method to be implemented by derived classes + + + + + + + CollectionItemsEqualConstraint is the abstract base class for all + collection constraints that apply some notion of item equality + as a part of their operation. + + + + + Construct an empty CollectionConstraint + + + + + Construct a CollectionConstraint + + + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Compares two collection members for equality + + + + + Return a new CollectionTally for use in making tests + + The collection to be included in the tally + + + + Flag the constraint to ignore case and return self. + + + + + EmptyCollectionConstraint tests whether a collection is empty. + + + + + Check that the collection is empty + + + + + + + Write the constraint description to a MessageWriter + + + + + + UniqueItemsConstraint tests whether all the items in a + collection are unique. + + + + + Check that all items are unique. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + CollectionContainsConstraint is used to test whether a collection + contains an expected object as a member. + + + + + Construct a CollectionContainsConstraint + + + + + + Test whether the expected item is contained in the collection + + + + + + + Write a descripton of the constraint to a MessageWriter + + + + + + CollectionEquivalentCOnstraint is used to determine whether two + collections are equivalent. + + + + + Construct a CollectionEquivalentConstraint + + + + + + Test whether two collections are equivalent + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + CollectionSubsetConstraint is used to determine whether + one collection is a subset of another + + + + + Construct a CollectionSubsetConstraint + + The collection that the actual value is expected to be a subset of + + + + Test whether the actual collection is a subset of + the expected collection provided. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + CollectionOrderedConstraint is used to test whether a collection is ordered. + + + + + Construct a CollectionOrderedConstraint + + + + + Modifies the constraint to use an IComparer and returns self. + + + + + Modifies the constraint to use an IComparer<T> and returns self. + + + + + Modifies the constraint to use a Comparison<T> and returns self. + + + + + Modifies the constraint to test ordering by the value of + a specified property and returns self. + + + + + Test whether the collection is ordered + + + + + + + Write a description of the constraint to a MessageWriter + + + + + + Returns the string representation of the constraint. + + + + + + If used performs a reverse comparison + + + + + CollectionTally counts (tallies) the number of + occurences of each object in one or more enumerations. + + + + + Construct a CollectionTally object from a comparer and a collection + + + + + Try to remove an object from the tally + + The object to remove + True if successful, false if the object was not found + + + + Try to remove a set of objects from the tally + + The objects to remove + True if successful, false if any object was not found + + + + The number of objects remaining in the tally + + + + + ComparisonAdapter class centralizes all comparisons of + values in NUnit, adapting to the use of any provided + IComparer, IComparer<T> or Comparison<T> + + + + + Returns a ComparisonAdapter that wraps an IComparer + + + + + Returns a ComparisonAdapter that wraps an IComparer<T> + + + + + Returns a ComparisonAdapter that wraps a Comparison<T> + + + + + Compares two objects + + + + + Gets the default ComparisonAdapter, which wraps an + NUnitComparer object. + + + + + Construct a ComparisonAdapter for an IComparer + + + + + Compares two objects + + + + + + + + Construct a default ComparisonAdapter + + + + + ComparisonAdapter<T> extends ComparisonAdapter and + allows use of an IComparer<T> or Comparison<T> + to actually perform the comparison. + + + + + Construct a ComparisonAdapter for an IComparer<T> + + + + + Compare a Type T to an object + + + + + Construct a ComparisonAdapter for a Comparison<T> + + + + + Compare a Type T to an object + + + + + Abstract base class for constraints that compare values to + determine if one is greater than, equal to or less than + the other. This class supplies the Using modifiers. + + + + + ComparisonAdapter to be used in making the comparison + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + Modifies the constraint to use an IComparer and returns self + + + + + Modifies the constraint to use an IComparer<T> and returns self + + + + + Modifies the constraint to use a Comparison<T> and returns self + + + + + Delegate used to delay evaluation of the actual value + to be used in evaluating a constraint + + + + + ConstraintBuilder maintains the stacks that are used in + processing a ConstraintExpression. An OperatorStack + is used to hold operators that are waiting for their + operands to be reognized. a ConstraintStack holds + input constraints as well as the results of each + operator applied. + + + + + Initializes a new instance of the class. + + + + + Appends the specified operator to the expression by first + reducing the operator stack and then pushing the new + operator on the stack. + + The operator to push. + + + + Appends the specified constraint to the expresson by pushing + it on the constraint stack. + + The constraint to push. + + + + Sets the top operator right context. + + The right context. + + + + Reduces the operator stack until the topmost item + precedence is greater than or equal to the target precedence. + + The target precedence. + + + + Resolves this instance, returning a Constraint. If the builder + is not currently in a resolvable state, an exception is thrown. + + The resolved constraint + + + + Gets a value indicating whether this instance is resolvable. + + + true if this instance is resolvable; otherwise, false. + + + + + OperatorStack is a type-safe stack for holding ConstraintOperators + + + + + Initializes a new instance of the class. + + The builder. + + + + Pushes the specified operator onto the stack. + + The op. + + + + Pops the topmost operator from the stack. + + + + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + + Gets the topmost operator without modifying the stack. + + The top. + + + + ConstraintStack is a type-safe stack for holding Constraints + + + + + Initializes a new instance of the class. + + The builder. + + + + Pushes the specified constraint. As a side effect, + the constraint's builder field is set to the + ConstraintBuilder owning this stack. + + The constraint. + + + + Pops this topmost constrait from the stack. + As a side effect, the constraint's builder + field is set to null. + + + + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + + Gets the topmost constraint without modifying the stack. + + The topmost constraint + + + + ConstraintExpression represents a compound constraint in the + process of being constructed from a series of syntactic elements. + + Individual elements are appended to the expression as they are + reognized. Once an actual Constraint is appended, the expression + returns a resolvable Constraint. + + + + + ConstraintExpressionBase is the abstract base class for the + ConstraintExpression class, which represents a + compound constraint in the process of being constructed + from a series of syntactic elements. + + NOTE: ConstraintExpressionBase is separate because the + ConstraintExpression class was generated in earlier + versions of NUnit. The two classes may be combined + in a future version. + + + + + The ConstraintBuilder holding the elements recognized so far + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the + class passing in a ConstraintBuilder, which may be pre-populated. + + The builder. + + + + Returns a string representation of the expression as it + currently stands. This should only be used for testing, + since it has the side-effect of resolving the expression. + + + + + + Appends an operator to the expression and returns the + resulting expression itself. + + + + + Appends a self-resolving operator to the expression and + returns a new ResolvableConstraintExpression. + + + + + Appends a constraint to the expression and returns that + constraint, which is associated with the current state + of the expression being built. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the + class passing in a ConstraintBuilder, which may be pre-populated. + + The builder. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + With is currently a NOP - reserved for future use. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + + Returns a constraint that fails if the actual + value matches the pattern supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + The ConstraintOperator class is used internally by a + ConstraintBuilder to represent an operator that + modifies or combines constraints. + + Constraint operators use left and right precedence + values to determine whether the top operator on the + stack should be reduced before pushing a new operator. + + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + + The precedence value used when the operator + is on the top of the stack. + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + The syntax element preceding this operator + + + + + The syntax element folowing this operator + + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + + The precedence value used when the operator + is on the top of the stack. + + + + + PrefixOperator takes a single constraint and modifies + it's action in some way. + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Returns the constraint created by applying this + prefix to another constraint. + + + + + + + Negates the test of the constraint it wraps. + + + + + Constructs a new NotOperator + + + + + Returns a NotConstraint applied to its argument. + + + + + Abstract base for operators that indicate how to + apply a constraint to items in a collection. + + + + + Constructs a CollectionOperator + + + + + Represents a constraint that succeeds if all the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + they all succeed. + + + + + Represents a constraint that succeeds if any of the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + any of them succeed. + + + + + Represents a constraint that succeeds if none of the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + + Represents a constraint that succeeds if the specified + count of members of a collection match a base constraint. + + + + + Construct an ExactCountOperator for a specified count + + The expected count + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + + Represents a constraint that simply wraps the + constraint provided as an argument, without any + further functionality, but which modifes the + order of evaluation because of its precedence. + + + + + Constructor for the WithOperator + + + + + Returns a constraint that wraps its argument + + + + + Abstract base class for operators that are able to reduce to a + constraint whether or not another syntactic element follows. + + + + + Operator used to test for the presence of a named Property + on an object and optionally apply further tests to the + value of that property. + + + + + Constructs a PropOperator for a particular named property + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Gets the name of the property to which the operator applies + + + + + Operator that tests for the presence of a particular attribute + on a type and optionally applies further tests to the attribute. + + + + + Construct an AttributeOperator for a particular Type + + The Type of attribute tested + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Operator that tests that an exception is thrown and + optionally applies further tests to the exception. + + + + + Construct a ThrowsOperator + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Abstract base class for all binary operators + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Abstract method that produces a constraint by applying + the operator to its left and right constraint arguments. + + + + + Gets the left precedence of the operator + + + + + Gets the right precedence of the operator + + + + + Operator that requires both it's arguments to succeed + + + + + Construct an AndOperator + + + + + Apply the operator to produce an AndConstraint + + + + + Operator that requires at least one of it's arguments to succeed + + + + + Construct an OrOperator + + + + + Apply the operator to produce an OrConstraint + + + + + ContainsConstraint tests a whether a string contains a substring + or a collection contains an object. It postpones the decision of + which test to use until the type of the actual argument is known. + This allows testing whether a string is contained in a collection + or as a substring of another string using the same syntax. + + + + + Initializes a new instance of the class. + + The expected. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to ignore case and return self. + + + + + Applies a delay to the match so that a match can be evaluated in the future. + + + + + Creates a new DelayedConstraint + + The inner constraint two decorate + The time interval after which the match is performed + If the value of is less than 0 + + + + Creates a new DelayedConstraint + + The inner constraint two decorate + The time interval after which the match is performed + The time interval used for polling + If the value of is less than 0 + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + + Test whether the constraint is satisfied by a delegate + + The delegate whose value is to be tested + True for if the base constraint fails, false if it succeeds + + + + Test whether the constraint is satisfied by a given reference. + Overridden to wait for the specified delay period before + calling the base constraint with the dereferenced value. + + A reference to the value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a MessageWriter. + + The writer on which the actual value is displayed + + + + Returns the string representation of the constraint. + + + + + EmptyDirectoryConstraint is used to test that a directory is empty + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + EmptyConstraint tests a whether a string or collection is empty, + postponing the decision about which test is applied until the + type of the actual argument is known. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + EqualConstraint is able to compare an actual value with the + expected value provided in its constructor. Two objects are + considered equal if both are null, or if both have the same + value. NUnit has special semantics for some object types. + + + + + If true, strings in error messages will be clipped + + + + + NUnitEqualityComparer used to test equality. + + + + + Initializes a new instance of the class. + + The expected value. + + + + Flag the constraint to use a tolerance when determining equality. + + Tolerance value to be used + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write a failure message. Overridden to provide custom + failure messages for EqualConstraint. + + The MessageWriter to write to + + + + Write description of this constraint + + The MessageWriter to write to + + + + Display the failure information for two collections that did not match. + + The MessageWriter on which to display + The expected collection. + The actual collection + The depth of this failure in a set of nested collections + + + + Displays a single line showing the types and sizes of the expected + and actual enumerations, collections or arrays. If both are identical, + the value is only shown once. + + The MessageWriter on which to display + The expected collection or array + The actual collection or array + The indentation level for the message line + + + + Displays a single line showing the point in the expected and actual + arrays at which the comparison failed. If the arrays have different + structures or dimensions, both values are shown. + + The MessageWriter on which to display + The expected array + The actual array + Index of the failure point in the underlying collections + The indentation level for the message line + + + + Display the failure information for two IEnumerables that did not match. + + The MessageWriter on which to display + The expected enumeration. + The actual enumeration + The depth of this failure in a set of nested collections + + + + Flag the constraint to ignore case and return self. + + + + + Flag the constraint to suppress string clipping + and return self. + + + + + Flag the constraint to compare arrays as collections + and return self. + + + + + Switches the .Within() modifier to interpret its tolerance as + a distance in representable values (see remarks). + + Self. + + Ulp stands for "unit in the last place" and describes the minimum + amount a given value can change. For any integers, an ulp is 1 whole + digit. For floating point values, the accuracy of which is better + for smaller numbers and worse for larger numbers, an ulp depends + on the size of the number. Using ulps for comparison of floating + point results instead of fixed tolerances is safer because it will + automatically compensate for the added inaccuracy of larger numbers. + + + + + Switches the .Within() modifier to interpret its tolerance as + a percentage that the actual values is allowed to deviate from + the expected value. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in days. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in hours. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in minutes. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in seconds. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in milliseconds. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in clock ticks. + + Self + + + + EqualityAdapter class handles all equality comparisons + that use an IEqualityComparer, IEqualityComparer<T> + or a ComparisonAdapter. + + + + + Compares two objects, returning true if they are equal + + + + + Returns true if the two objects can be compared by this adapter. + The base adapter cannot handle IEnumerables except for strings. + + + + + Returns an EqualityAdapter that wraps an IComparer. + + + + + Returns an EqualityAdapter that wraps an IEqualityComparer. + + + + + Returns an EqualityAdapter that wraps an IEqualityComparer<T>. + + + + + Returns an EqualityAdapter that wraps an IComparer<T>. + + + + + Returns an EqualityAdapter that wraps a Comparison<T>. + + + + + EqualityAdapter that wraps an IComparer. + + + + + Returns true if the two objects can be compared by this adapter. + Generic adapter requires objects of the specified type. + + + + + EqualityAdapter that wraps an IComparer. + + + + Helper routines for working with floating point numbers + + + The floating point comparison code is based on this excellent article: + http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm + + + "ULP" means Unit in the Last Place and in the context of this library refers to + the distance between two adjacent floating point numbers. IEEE floating point + numbers can only represent a finite subset of natural numbers, with greater + accuracy for smaller numbers and lower accuracy for very large numbers. + + + If a comparison is allowed "2 ulps" of deviation, that means the values are + allowed to deviate by up to 2 adjacent floating point values, which might be + as low as 0.0000001 for small numbers or as high as 10.0 for large numbers. + + + + + Compares two floating point values for equality + First floating point value to be compared + Second floating point value t be compared + + Maximum number of representable floating point values that are allowed to + be between the left and the right floating point values + + True if both numbers are equal or close to being equal + + + Floating point values can only represent a finite subset of natural numbers. + For example, the values 2.00000000 and 2.00000024 can be stored in a float, + but nothing inbetween them. + + + This comparison will count how many possible floating point values are between + the left and the right number. If the number of possible values between both + numbers is less than or equal to maxUlps, then the numbers are considered as + being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + Compares two double precision floating point values for equality + First double precision floating point value to be compared + Second double precision floating point value t be compared + + Maximum number of representable double precision floating point values that are + allowed to be between the left and the right double precision floating point values + + True if both numbers are equal or close to being equal + + + Double precision floating point values can only represent a limited series of + natural numbers. For example, the values 2.0000000000000000 and 2.0000000000000004 + can be stored in a double, but nothing inbetween them. + + + This comparison will count how many possible double precision floating point + values are between the left and the right number. If the number of possible + values between both numbers is less than or equal to maxUlps, then the numbers + are considered as being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + + Reinterprets the memory contents of a floating point value as an integer value + + + Floating point value whose memory contents to reinterpret + + + The memory contents of the floating point value interpreted as an integer + + + + + Reinterprets the memory contents of a double precision floating point + value as an integer value + + + Double precision floating point value whose memory contents to reinterpret + + + The memory contents of the double precision floating point value + interpreted as an integer + + + + + Reinterprets the memory contents of an integer as a floating point value + + Integer value whose memory contents to reinterpret + + The memory contents of the integer value interpreted as a floating point value + + + + + Reinterprets the memory contents of an integer value as a double precision + floating point value + + Integer whose memory contents to reinterpret + + The memory contents of the integer interpreted as a double precision + floating point value + + + + Union of a floating point variable and an integer + + + The union's value as a floating point variable + + + The union's value as an integer + + + The union's value as an unsigned integer + + + Union of a double precision floating point variable and a long + + + The union's value as a double precision floating point variable + + + The union's value as a long + + + The union's value as an unsigned long + + + + Tests whether a value is greater than the value supplied to its constructor + + + + + The value against which a comparison is to be made + + + + + Initializes a new instance of the class. + + The expected value. + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Tests whether a value is greater than or equal to the value supplied to its constructor + + + + + The value against which a comparison is to be made + + + + + Initializes a new instance of the class. + + The expected value. + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Tests whether a value is less than the value supplied to its constructor + + + + + The value against which a comparison is to be made + + + + + Initializes a new instance of the class. + + The expected value. + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Tests whether a value is less than or equal to the value supplied to its constructor + + + + + The value against which a comparison is to be made + + + + + Initializes a new instance of the class. + + The expected value. + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + MessageWriter is the abstract base for classes that write + constraint descriptions and messages in some form. The + class has separate methods for writing various components + of a message, allowing implementations to tailor the + presentation as needed. + + + + + Construct a MessageWriter given a culture + + + + + Method to write single line message with optional args, usually + written to precede the general failure message. + + The message to be written + Any arguments used in formatting the message + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a givel + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The constraint that failed + + + + Display Expected and Actual lines for given values. This + method may be called by constraints that need more control over + the display of actual and expected values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + + Display Expected and Actual lines for given values, including + a tolerance value on the Expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + + Display the expected and actual string values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in locating the point where the strings differ + If true, the strings should be clipped to fit the line + + + + Writes the text for a connector. + + The connector. + + + + Writes the text for a predicate. + + The predicate. + + + + Writes the text for an expected value. + + The expected value. + + + + Writes the text for a modifier + + The modifier. + + + + Writes the text for an actual value. + + The actual value. + + + + Writes the text for a generalized value. + + The value. + + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Abstract method to get the max line length + + + + + Static methods used in creating messages + + + + + Static string used when strings are clipped + + + + + Returns the representation of a type as used in NUnitLite. + This is the same as Type.ToString() except for arrays, + which are displayed with their declared sizes. + + + + + + + Converts any control characters in a string + to their escaped representation. + + The string to be converted + The converted string + + + + Return the a string representation for a set of indices into an array + + Array of indices for which a string is needed + + + + Get an array of indices representing the point in a enumerable, + collection or array corresponding to a single int index into the + collection. + + The collection to which the indices apply + Index in the collection + Array of indices + + + + Clip a string to a given length, starting at a particular offset, returning the clipped + string with ellipses representing the removed parts + + The string to be clipped + The maximum permitted length of the result string + The point at which to start clipping + The clipped string + + + + Clip the expected and actual strings in a coordinated fashion, + so that they may be displayed together. + + + + + + + + + Shows the position two strings start to differ. Comparison + starts at the start index. + + The expected string + The actual string + The index in the strings at which comparison should start + Boolean indicating whether case should be ignored + -1 if no mismatch found, or the index where mismatch found + + + + The Numerics class contains common operations on numeric values. + + + + + Checks the type of the object, returning true if + the object is a numeric type. + + The object to check + true if the object is a numeric type + + + + Checks the type of the object, returning true if + the object is a floating point numeric type. + + The object to check + true if the object is a floating point numeric type + + + + Checks the type of the object, returning true if + the object is a fixed point numeric type. + + The object to check + true if the object is a fixed point numeric type + + + + Test two numeric values for equality, performing the usual numeric + conversions and using a provided or default tolerance. If the tolerance + provided is Empty, this method may set it to a default tolerance. + + The expected value + The actual value + A reference to the tolerance in effect + True if the values are equal + + + + Compare two numeric values, performing the usual numeric conversions. + + The expected value + The actual value + The relationship of the values to each other + + + + NUnitComparer encapsulates NUnit's default behavior + in comparing two objects. + + + + + Compares two objects + + + + + + + + Returns the default NUnitComparer. + + + + + Generic version of NUnitComparer + + + + + + Compare two objects of the same type + + + + + NUnitEqualityComparer encapsulates NUnit's handling of + equality tests between objects. + + + + + + + + + + Compares two objects for equality within a tolerance + + The first object to compare + The second object to compare + The tolerance to use in the comparison + + + + + If true, all string comparisons will ignore case + + + + + If true, arrays will be treated as collections, allowing + those of different dimensions to be compared + + + + + Comparison objects used in comparisons for some constraints. + + + + + Compares two objects for equality within a tolerance. + + + + + Helper method to compare two arrays + + + + + Method to compare two DirectoryInfo objects + + first directory to compare + second directory to compare + true if equivalent, false if not + + + + Returns the default NUnitEqualityComparer + + + + + Gets and sets a flag indicating whether case should + be ignored in determining equality. + + + + + Gets and sets a flag indicating that arrays should be + compared as collections, without regard to their shape. + + + + + Gets and sets an external comparer to be used to + test for equality. It is applied to members of + collections, in place of NUnit's own logic. + + + + + Gets the list of failure points for the last Match performed. + + + + + FailurePoint class represents one point of failure + in an equality test. + + + + + The location of the failure + + + + + The expected value + + + + + The actual value + + + + + Indicates whether the expected value is valid + + + + + Indicates whether the actual value is valid + + + + + PathConstraint serves as the abstract base of constraints + that operate on paths and provides several helper methods. + + + + + The expected path used in the constraint + + + + + The actual path being tested + + + + + Flag indicating whether a caseInsensitive comparison should be made + + + + + Construct a PathConstraint for a give expected path + + The expected path + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Returns true if the expected path and actual path match + + + + + Returns the string representation of this constraint + + + + + Canonicalize the provided path + + + The path in standardized form + + + + Test whether two paths are the same + + The first path + The second path + Indicates whether case should be ignored + + + + + Test whether one path is under another path + + The first path - supposed to be the parent path + The second path - supposed to be the child path + Indicates whether case should be ignored + + + + + Test whether one path is the same as or under another path + + The first path - supposed to be the parent path + The second path - supposed to be the child path + + + + + Modifies the current instance to be case-insensitve + and returns it. + + + + + Modifies the current instance to be case-sensitve + and returns it. + + + + + Summary description for SamePathConstraint. + + + + + Initializes a new instance of the class. + + The expected path + + + + Test whether the constraint is satisfied by a given value + + The expected path + The actual path + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + SubPathConstraint tests that the actual path is under the expected path + + + + + Initializes a new instance of the class. + + The expected path + + + + Test whether the constraint is satisfied by a given value + + The expected path + The actual path + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + SamePathOrUnderConstraint tests that one path is under another + + + + + Initializes a new instance of the class. + + The expected path + + + + Test whether the constraint is satisfied by a given value + + The expected path + The actual path + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Predicate constraint wraps a Predicate in a constraint, + returning success if the predicate is true. + + + + + Construct a PredicateConstraint from a predicate + + + + + Determines whether the predicate succeeds when applied + to the actual value. + + + + + Writes the description to a MessageWriter + + + + + NotConstraint negates the effect of some other constraint + + + + + Initializes a new instance of the class. + + The base constraint to be negated. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a MessageWriter. + + The writer on which the actual value is displayed + + + + AllItemsConstraint applies another constraint to each + item in a collection, succeeding if they all succeed. + + + + + Construct an AllItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + SomeItemsConstraint applies another constraint to each + item in a collection, succeeding if any of them succeeds. + + + + + Construct a SomeItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + succeeding if any item succeeds. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + NoItemConstraint applies another constraint to each + item in a collection, failing if any of them succeeds. + + + + + Construct a SomeItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + ExactCoutConstraint applies another constraint to each + item in a collection, succeeding only if a specified + number of items succeed. + + + + + Construct an ExactCountConstraint on top of an existing constraint + + + + + + + Apply the item constraint to each item in the collection, + succeeding only if the expected number of items pass. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + PropertyExistsConstraint tests that a named property + exists on the object provided through Match. + + Originally, PropertyConstraint provided this feature + in addition to making optional tests on the vaue + of the property. The two constraints are now separate. + + + + + Initializes a new instance of the class. + + The name of the property. + + + + Test whether the property exists for a given object + + The object to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. + + The writer on which the actual value is displayed + + + + Returns the string representation of the constraint. + + + + + + PropertyConstraint extracts a named property and uses + its value as the actual value for a chained constraint. + + + + + Initializes a new instance of the class. + + The name. + The constraint to apply to the property. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + Returns the string representation of the constraint. + + + + + + RangeConstraint tests whethe two values are within a + specified range. + + + + + Initializes a new instance of the class. + + From. + To. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + ResolvableConstraintExpression is used to represent a compound + constraint being constructed at a point where the last operator + may either terminate the expression or may have additional + qualifying constraints added to it. + + It is used, for example, for a Property element or for + an Exception element, either of which may be optionally + followed by constraints that apply to the property or + exception. + + + + + Create a new instance of ResolvableConstraintExpression + + + + + Create a new instance of ResolvableConstraintExpression, + passing in a pre-populated ConstraintBuilder. + + + + + Resolve the current expression to a Constraint + + + + + Appends an And Operator to the expression + + + + + Appends an Or operator to the expression. + + + + + ReusableConstraint wraps a resolved constraint so that it + may be saved and reused as needed. + + + + + Construct a ReusableConstraint + + The constraint or expression to be reused + + + + Conversion operator from a normal constraint to a ReusableConstraint. + + The original constraint to be wrapped as a ReusableConstraint + + + + + Returns the string representation of the constraint. + + A string representing the constraint + + + + Resolves the ReusableConstraint by returning the constraint + that it originally wrapped. + + A resolved constraint + + + + SameAsConstraint tests whether an object is identical to + the object passed to its constructor + + + + + Initializes a new instance of the class. + + The expected object. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + BinarySerializableConstraint tests whether + an object is serializable in binary format. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + Returns the string representation + + + + + BinarySerializableConstraint tests whether + an object is serializable in binary format. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + Returns the string representation of this constraint + + + + + StringConstraint is the abstract base for constraints + that operate on strings. It supports the IgnoreCase + modifier for string operations. + + + + + The expected value + + + + + Indicates whether tests should be case-insensitive + + + + + Constructs a StringConstraint given an expected value + + The expected value + + + + Modify the constraint to ignore case in matching. + + + + + EmptyStringConstraint tests whether a string is empty. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + NullEmptyStringConstraint tests whether a string is either null or empty. + + + + + Constructs a new NullOrEmptyStringConstraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + SubstringConstraint can test whether a string contains + the expected substring. + + + + + Initializes a new instance of the class. + + The expected. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + StartsWithConstraint can test whether a string starts + with an expected substring. + + + + + Initializes a new instance of the class. + + The expected string + + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + EndsWithConstraint can test whether a string ends + with an expected substring. + + + + + Initializes a new instance of the class. + + The expected string + + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + RegexConstraint can test whether a string matches + the pattern provided. + + + + + Initializes a new instance of the class. + + The pattern. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + ThrowsConstraint is used to test the exception thrown by + a delegate by applying a constraint to it. + + + + + Initializes a new instance of the class, + using a constraint to be applied to the exception. + + A constraint to apply to the caught exception. + + + + Executes the code of the delegate and captures any exception. + If a non-null base constraint was provided, it applies that + constraint to the exception. + + A delegate representing the code to be tested + True if an exception is thrown and the constraint succeeds, otherwise false + + + + Converts an ActualValueDelegate to a TestDelegate + before calling the primary overload. + + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + Returns the string representation of this constraint + + + + + Get the actual exception thrown - used by Assert.Throws. + + + + + ThrowsNothingConstraint tests that a delegate does not + throw an exception. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True if no exception is thrown, otherwise false + + + + Converts an ActualValueDelegate to a TestDelegate + before calling the primary overload. + + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + Modes in which the tolerance value for a comparison can + be interpreted. + + + + + The tolerance was created with a value, without specifying + how the value would be used. This is used to prevent setting + the mode more than once and is generally changed to Linear + upon execution of the test. + + + + + The tolerance is used as a numeric range within which + two compared values are considered to be equal. + + + + + Interprets the tolerance as the percentage by which + the two compared values my deviate from each other. + + + + + Compares two values based in their distance in + representable numbers. + + + + + The Tolerance class generalizes the notion of a tolerance + within which an equality test succeeds. Normally, it is + used with numeric types, but it can be used with any + type that supports taking a difference between two + objects and comparing that difference to a value. + + + + + Constructs a linear tolerance of a specdified amount + + + + + Constructs a tolerance given an amount and ToleranceMode + + + + + Tests that the current Tolerance is linear with a + numeric value, throwing an exception if it is not. + + + + + Returns an empty Tolerance object, equivalent to + specifying no tolerance. In most cases, it results + in an exact match but for floats and doubles a + default tolerance may be used. + + + + + Returns a zero Tolerance object, equivalent to + specifying an exact match. + + + + + Gets the ToleranceMode for the current Tolerance + + + + + Gets the value of the current Tolerance instance. + + + + + Returns a new tolerance, using the current amount as a percentage. + + + + + Returns a new tolerance, using the current amount in Ulps. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of days. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of hours. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of minutes. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of seconds. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of milliseconds. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of clock ticks. + + + + + Returns true if the current tolerance is empty. + + + + + TypeConstraint is the abstract base for constraints + that take a Type as their expected value. + + + + + The expected Type used by the constraint + + + + + Construct a TypeConstraint for a given Type + + + + + + Write the actual value for a failing constraint test to a + MessageWriter. TypeConstraints override this method to write + the name of the type. + + The writer on which the actual value is displayed + + + + ExactTypeConstraint is used to test that an object + is of the exact type provided in the constructor + + + + + Construct an ExactTypeConstraint for a given Type + + The expected Type. + + + + Test that an object is of the exact type specified + + The actual value. + True if the tested object is of the exact type provided, otherwise false. + + + + Write the description of this constraint to a MessageWriter + + The MessageWriter to use + + + + ExceptionTypeConstraint is a special version of ExactTypeConstraint + used to provided detailed info about the exception thrown in + an error message. + + + + + Constructs an ExceptionTypeConstraint + + + + + Write the actual value for a failing constraint test to a + MessageWriter. Overriden to write additional information + in the case of an Exception. + + The MessageWriter to use + + + + InstanceOfTypeConstraint is used to test that an object + is of the same type provided or derived from it. + + + + + Construct an InstanceOfTypeConstraint for the type provided + + The expected Type + + + + Test whether an object is of the specified type or a derived type + + The object to be tested + True if the object is of the provided type or derives from it, otherwise false. + + + + Write a description of this constraint to a MessageWriter + + The MessageWriter to use + + + + AssignableFromConstraint is used to test that an object + can be assigned from a given Type. + + + + + Construct an AssignableFromConstraint for the type provided + + + + + + Test whether an object can be assigned from the specified type + + The object to be tested + True if the object can be assigned a value of the expected Type, otherwise false. + + + + Write a description of this constraint to a MessageWriter + + The MessageWriter to use + + + + AssignableToConstraint is used to test that an object + can be assigned to a given Type. + + + + + Construct an AssignableToConstraint for the type provided + + + + + + Test whether an object can be assigned to the specified type + + The object to be tested + True if the object can be assigned a value of the expected Type, otherwise false. + + + + Write a description of this constraint to a MessageWriter + + The MessageWriter to use + + + + Thrown when an assertion failed. + + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Thrown when an assertion failed. + + + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Thrown when a test executes inconclusively. + + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Thrown when an assertion failed. + + + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + + + + + + + Compares two objects of a given Type for equality within a tolerance + + The first object to compare + The second object to compare + The tolerance to use in the comparison + + + + + The different targets a test action attribute can be applied to + + + + + Default target, which is determined by where the action attribute is attached + + + + + Target a individual test case + + + + + Target a suite of test cases + + + + + Delegate used by tests that execute code and + capture any thrown exception. + + + + + The Assert class contains a collection of static methods that + implement the most common assertions used in NUnit. + + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Helper for Assert.AreEqual(double expected, double actual, ...) + allowing code generation to work consistently. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + + + + Throws an with the message and arguments + that are passed in. This is used by the other Assert functions. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This is used by the other Assert functions. + + The message to initialize the with. + + + + Throws an . + This is used by the other Assert functions. + + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + + + + Throws an . + This causes the test to be reported as ignored. + + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + + + + Throws an . + This causes the test to be reported as Inconclusive. + + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + + This method is provided for use by VB developers needing to test + the value of properties with private setters. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + The message that will be displayed on failure + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestSnippet delegate + The message that will be displayed on failure + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestSnippet delegate + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestSnippet delegate + The message that will be displayed on failure + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestSnippet delegate + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + + Verifies that a delegate does not throw an exception + + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate does not throw an exception. + + A TestSnippet delegate + The message that will be displayed on failure + + + + Verifies that a delegate does not throw an exception. + + A TestSnippet delegate + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + The message to display in case of failure + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + The message to display in case of failure + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + + + + Assert that a string is either null or equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is either null or equal to string.Empty + + The string to be tested + The message to display in case of failure + + + + Assert that a string is either null or equal to string.Empty + + The string to be tested + + + + Assert that a string is not null or empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is not null or empty + + The string to be tested + The message to display in case of failure + + + + Assert that a string is not null or empty + + The string to be tested + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + The message to display in case of failure + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + + + + Gets the number of assertions executed so far and + resets the counter to zero. + + + + + AssertionHelper is an optional base class for user tests, + allowing the use of shorter names for constraints and + asserts and avoiding conflict with the definition of + , from which it inherits much of its + behavior, in certain mock object frameworks. + + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. Works + identically to Assert.That + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. Works + identically to Assert.That. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. Works + identically to Assert.That + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to Assert.That. + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to Assert.That. + + The evaluated condition + The message to display if the condition is false + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically Assert.That. + + The evaluated condition + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Returns a ListMapper based on a collection. + + The original collection + + + + + Provides static methods to express the assumptions + that must be met for a test to give a meaningful + result. If an assumption is not met, the test + should produce an inconclusive result. + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + + + + Asserts that a condition is true. If the condition is false the + method throws an . + + The evaluated condition + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + A set of Assert methods operationg on one or more collections + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + The message that will be displayed on failure + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable containing objects to be considered + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable containing objects to be considered + The message that will be displayed on failure + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + The message that will be displayed on failure + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + The message that will be displayed on failure + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + The message that will be displayed on failure + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that superset is not a subject of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + + Asserts that superset is not a subject of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + + + + Asserts that superset is not a subject of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that superset is a subset of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + + Asserts that superset is a subset of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + + + + Asserts that superset is a subset of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + The message to be displayed on failure + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + + + + Static helper class used in the constraint-based syntax + + + + + Creates a new SubstringConstraint + + The value of the substring + A SubstringConstraint + + + + Creates a new CollectionContainsConstraint. + + The item that should be found. + A new CollectionContainsConstraint + + + + Summary description for DirectoryAssert + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are not equal + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are equal + Arguments to be used in formatting the message + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are equal + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + + Summary description for FileAssert. + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + The message to display if objects are not equal + + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if objects are not equal + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if objects are not equal + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + The message to be displayed when the two Stream are the same. + Arguments to be used in formatting the message + + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + The message to be displayed when the Streams are the same. + + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if objects are not equal + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if objects are not equal + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + + + + GlobalSettings is a place for setting default values used + by the framework in performing asserts. + + + + + Default tolerance for floating point equality + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Interface implemented by a user fixture in order to + validate any expected exceptions. It is only called + for test methods marked with the ExpectedException + attribute. + + + + + Method to handle an expected exception + + The exception to be handled + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + The Iz class is a synonym for Is intended for use in VB, + which regards Is as a keyword. + + + + + The List class is a helper class with properties and methods + that supply a number of constraints used with lists and collections. + + + + + List.Map returns a ListMapper, which can be used to map + the original collection to another collection. + + + + + + + ListMapper is used to transform a collection used as an actual argument + producing another collection to be used in the assertion. + + + + + Construct a ListMapper based on a collection + + The collection to be transformed + + + + Produces a collection containing all the values of a property + + The collection of property values + + + + + Randomizer returns a set of random values in a repeatable + way, to allow re-running of tests if necessary. + + + + + Get a randomizer for a particular member, returning + one that has already been created if it exists. + This ensures that the same values are generated + each time the tests are reloaded. + + + + + Get a randomizer for a particular parameter, returning + one that has already been created if it exists. + This ensures that the same values are generated + each time the tests are reloaded. + + + + + Construct a randomizer using a random seed + + + + + Construct a randomizer using a specified seed + + + + + Return an array of random doubles between 0.0 and 1.0. + + + + + + + Return an array of random doubles with values in a specified range. + + + + + Return an array of random ints with values in a specified range. + + + + + Get a random seed for use in creating a randomizer. + + + + + The SpecialValue enum is used to represent TestCase arguments + that cannot be used as arguments to an Attribute. + + + + + Null represents a null value, which cannot be used as an + argument to an attriute under .NET 1.x + + + + + Basic Asserts on strings. + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + + Asserts that a string is not found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that two strings are Notequal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + The message to display in case of failure + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + The message to display in case of failure + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + + + + The TestCaseData class represents a set of arguments + and other parameter info to be used for a parameterized + test case. It provides a number of instance modifiers + for use in initializing the test case. + + Note: Instance modifiers are getters that return + the same instance after modifying it's state. + + + + + The argument list to be provided to the test + + + + + The expected result to be returned + + + + + Set to true if this has an expected result + + + + + The expected exception Type + + + + + The FullName of the expected exception + + + + + The name to be used for the test + + + + + The description of the test + + + + + A dictionary of properties, used to add information + to tests without requiring the class to change. + + + + + If true, indicates that the test case is to be ignored + + + + + If true, indicates that the test case is marked explicit + + + + + The reason for ignoring a test case + + + + + Initializes a new instance of the class. + + The arguments. + + + + Initializes a new instance of the class. + + The argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + The third argument. + + + + Sets the expected result for the test + + The expected result + A modified TestCaseData + + + + Sets the expected exception type for the test + + Type of the expected exception. + The modified TestCaseData instance + + + + Sets the expected exception type for the test + + FullName of the expected exception. + The modified TestCaseData instance + + + + Sets the name of the test case + + The modified TestCaseData instance + + + + Sets the description for the test case + being constructed. + + The description. + The modified TestCaseData instance. + + + + Applies a category to the test + + + + + + + Applies a named property to the test + + + + + + + + Applies a named property to the test + + + + + + + + Applies a named property to the test + + + + + + + + Ignores this TestCase. + + + + + + Ignores this TestCase, specifying the reason. + + The reason. + + + + + Marks this TestCase as Explicit + + + + + + Marks this TestCase as Explicit, specifying the reason. + + The reason. + + + + + Gets the argument list to be provided to the test + + + + + Gets the expected result + + + + + Returns true if the result has been set + + + + + Gets the expected exception Type + + + + + Gets the FullName of the expected exception + + + + + Gets the name to be used for the test + + + + + Gets the description of the test + + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + + Gets a value indicating whether this is explicit. + + true if explicit; otherwise, false. + + + + Gets the ignore reason. + + The ignore reason. + + + + Gets a list of categories associated with this test. + + + + + Gets the property dictionary for this test + + + + + Provide the context information of the current test + + + + + Constructs a TestContext using the provided context dictionary + + A context dictionary + + + + Get the current test context. This is created + as needed. The user may save the context for + use within a test, but it should not be used + outside the test for which it is created. + + + + + Gets a TestAdapter representing the currently executing test in this context. + + + + + Gets a ResultAdapter representing the current result for the test + executing in this context. + + + + + Gets the directory containing the current test assembly. + + + + + Gets the directory to be used for outputing files created + by this test run. + + + + + TestAdapter adapts a Test for consumption by + the user test code. + + + + + Constructs a TestAdapter for this context + + The context dictionary + + + + The name of the test. + + + + + The FullName of the test + + + + + The properties of the test. + + + + + ResultAdapter adapts a TestResult for consumption by + the user test code. + + + + + Construct a ResultAdapter for a context + + The context holding the result + + + + The TestState of current test. This maps to the ResultState + used in nunit.core and is subject to change in the future. + + + + + The TestStatus of current test. This enum will be used + in future versions of NUnit and so is to be preferred + to the TestState value. + + + + + Provides details about a test + + + + + Creates an instance of TestDetails + + The fixture that the test is a member of, if available. + The method that implements the test, if available. + The full name of the test. + A string representing the type of test, e.g. "Test Case". + Indicates if the test represents a suite of tests. + + + + The fixture that the test is a member of, if available. + + + + + The method that implements the test, if available. + + + + + The full name of the test. + + + + + A string representing the type of test, e.g. "Test Case". + + + + + Indicates if the test represents a suite of tests. + + + + + The ResultState enum indicates the result of running a test + + + + + The result is inconclusive + + + + + The test was not runnable. + + + + + The test has been skipped. + + + + + The test has been ignored. + + + + + The test succeeded + + + + + The test failed + + + + + The test encountered an unexpected exception + + + + + The test was cancelled by the user + + + + + The TestStatus enum indicates the result of running a test + + + + + The test was inconclusive + + + + + The test has skipped + + + + + The test succeeded + + + + + The test failed + + + + + Helper class with static methods used to supply constraints + that operate on strings. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + + Returns a constraint that fails if the actual + value matches the pattern supplied as an argument. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + TextMessageWriter writes constraint descriptions and messages + in displayable form as a text stream. It tailors the display + of individual message components to form the standard message + format of NUnit assertion failure messages. + + + + + Prefix used for the expected value line of a message + + + + + Prefix used for the actual value line of a message + + + + + Length of a message prefix + + + + + Construct a TextMessageWriter + + + + + Construct a TextMessageWriter, specifying a user message + and optional formatting arguments. + + + + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a givel + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The constraint that failed + + + + Display Expected and Actual lines for given values. This + method may be called by constraints that need more control over + the display of actual and expected values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + + Display Expected and Actual lines for given values, including + a tolerance value on the expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + + Display the expected and actual string values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in string comparisons + If true, clip the strings to fit the max line length + + + + Writes the text for a connector. + + The connector. + + + + Writes the text for a predicate. + + The predicate. + + + + Write the text for a modifier. + + The modifier. + + + + Writes the text for an expected value. + + The expected value. + + + + Writes the text for an actual value. + + The actual value. + + + + Writes the text for a generalized value. + + The value. + + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Write the generic 'Expected' line for a constraint + + The constraint that failed + + + + Write the generic 'Expected' line for a given value + + The expected value + + + + Write the generic 'Expected' line for a given value + and tolerance. + + The expected value + The tolerance within which the test was made + + + + Write the generic 'Actual' line for a constraint + + The constraint for which the actual value is to be written + + + + Write the generic 'Actual' line for a given value + + The actual value causing a failure + + + + Gets or sets the maximum line length for this writer + + + + + Helper class with properties and methods that supply + constraints that operate on exceptions. + + + + + Creates a constraint specifying the exact type of exception expected + + + + + Creates a constraint specifying the exact type of exception expected + + + + + Creates a constraint specifying the type of exception expected + + + + + Creates a constraint specifying the type of exception expected + + + + + Creates a constraint specifying an expected exception + + + + + Creates a constraint specifying an exception with a given InnerException + + + + + Creates a constraint specifying an expected TargetInvocationException + + + + + Creates a constraint specifying an expected TargetInvocationException + + + + + Creates a constraint specifying an expected TargetInvocationException + + + + + Creates a constraint specifying that no exception is thrown + + + + diff --git a/Website/LOC.Website.Tests/bin/Release/EntityFramework.dll b/Website/LOC.Website.Tests/bin/Release/EntityFramework.dll new file mode 100644 index 000000000..8caef36ac Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Release/EntityFramework.dll differ diff --git a/Website/LOC.Website.Tests/bin/Release/EntityFramework.xml b/Website/LOC.Website.Tests/bin/Release/EntityFramework.xml new file mode 100644 index 000000000..4057d68a4 --- /dev/null +++ b/Website/LOC.Website.Tests/bin/Release/EntityFramework.xml @@ -0,0 +1,18061 @@ + + + + EntityFramework + + + + + Specifies the database column that a property is mapped to. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The name of the column the property is mapped to. + + + + The name of the column the property is mapped to. + + + + + The zero-based order of the column the property is mapped to. + + + + + The database provider specific data type of the column the property is mapped to. + + + + + Denotes that the class is a complex type. + Complex types are non-scalar properties of entity types that enable scalar properties to be organized within entities. + Complex types do not have keys and cannot be managed by the Entity Framework apart from the parent object. + + + + + Specifies how the database generates values for a property. + + + + + Initializes a new instance of the class. + + The pattern used to generate values for the property in the database. + + + + The pattern used to generate values for the property in the database. + + + + + The pattern used to generate values for a property in the database. + + + + + The database does not generate values. + + + + + The database generates a value when a row is inserted. + + + + + The database generates a value when a row is inserted or updated. + + + + + Denotes a property used as a foreign key in a relationship. + The annotation may be placed on the foreign key property and specify the associated navigation property name, + or placed on a navigation property and specify the associated foreign key name. + + + + + Initializes a new instance of the class. + + + If placed on a foreign key property, the name of the associated navigation property. + If placed on a navigation property, the name of the associated foreign key(s). + If a navigation property has multiple foreign keys, a comma separated list should be supplied. + + + + + If placed on a foreign key property, the name of the associated navigation property. + If placed on a navigation property, the name of the associated foreign key(s). + + + + + Specifies the inverse of a navigation property that represents the other end of the same relationship. + + + + + Initializes a new instance of the class. + + The navigation property representing the other end of the same relationship. + + + + The navigation property representing the other end of the same relationship. + + + + + Specifies the maximum length of array/string data allowed in a property. + + + + + Initializes a new instance of the class. + + + The maximum allowable length of array/string data. + Value must be greater than zero. + + + + + Initializes a new instance of the class. + The maximum allowable length supported by the database will be used. + + + + + Determines whether a specified object is valid. (Overrides ) + + + This method returns true if the is null. + It is assumed the is used if the value may not be null. + + The object to validate. + true if the value is null or less than or equal to the specified maximum length, otherwise false + Length is zero or less than negative one. + + + + Applies formatting to a specified error message. (Overrides ) + + The name to include in the formatted string. + A localized string to describe the maximum acceptable length. + + + + Checks that Length has a legal value. Throws InvalidOperationException if not. + + + + + Gets the maximum allowable length of the array/string data. + + + + + Specifies the minimum length of array/string data allowed in a property. + + + + + Initializes a new instance of the class. + + + The minimum allowable length of array/string data. + Value must be greater than or equal to zero. + + + + + Determines whether a specified object is valid. (Overrides ) + + + This method returns true if the is null. + It is assumed the is used if the value may not be null. + + The object to validate. + true if the value is null or greater than or equal to the specified minimum length, otherwise false + Length is less than zero. + + + + Applies formatting to a specified error message. (Overrides ) + + The name to include in the formatted string. + A localized string to describe the minimum acceptable length. + + + + Checks that Length has a legal value. Throws InvalidOperationException if not. + + + + + Gets the minimum allowable length of the array/string data. + + + + + Denotes that a property or class should be excluded from database mapping. + + + + + Specifies the database table that a class is mapped to. + + + + + Initializes a new instance of the class. + + The name of the table the class is mapped to. + + + + The name of the table the class is mapped to. + + + + + The schema of the table the class is mapped to. + + + + + The base for all all Entity Data Model (EDM) types that represent a type from the EDM type system. + + + + + Represents an item in an Entity Data Model (EDM) . + + + + + The base for all all Entity Data Model (EDM) item types that with a Name property that represents a qualified (can be dotted) name. + + + + + The base for all all Entity Data Model (EDM) item types that with a property. + + + + + The base for all all Entity Data Model (EDM) types that support annotation using . + + + + + EdmDataModelItem is the base for all types in the Entity Data Model (EDM) metadata construction and modification API. + + + + + DataModelItem is the base for all types in the EDM metadata reflection, construction and modification API. + + + + + Gets an value indicating which Entity Data Model (EDM) concept is represented by this item. + + + + + IAnnotatedDataModelItem is implemented by model-specific base types for all types with an property. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets or sets the currently assigned annotations. + + + + + Returns all EdmItem children directly contained by this EdmItem. + + + + + INamedDataModelItem is implemented by model-specific base types for all types with a property. + + + + + Gets or sets the currently assigned name. + + + + + Gets or sets the currently assigned name. + + + + + Gets a value indicating whether this type is abstract. + + + + + Gets the optional base type of this type. + + + + + EdmStructuralMember is the base for all types that represent members of structural items in the Entity Data Model (EDM) metadata construction and modification API. + + + + + Represents information about a database connection. + + + + + Creates a new instance of DbConnectionInfo representing a connection that is specified in the application configuration file. + + The name of the connection string in the application configuration. + + + + Creates a new instance of DbConnectionInfo based on a connection string. + + The connection string to use for the connection. + The name of the provider to use for the connection. Use 'System.Data.SqlClient' for SQL Server. + + + + Gets the connection information represented by this instance. + + Configuration to use if connection comes from the configuration file. + + + + Instances of this class are used to create DbConnection objects for + SQL Server LocalDb based on a given database name or connection string. + + + An instance of this class can be set on the class or in the + app.config/web.config for the application to cause all DbContexts created with no + connection information or just a database name to use SQL Server LocalDb by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Implementations of this interface are used to create DbConnection objects for + a type of database server based on a given database name. + An Instance is set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use a certain type of database server by default. + Two implementations of this interface are provided: + is used to create connections to Microsoft SQL Server, including EXPRESS editions. + is used to create connections to Microsoft SQL + Server Compact Editions. + Other implementations for other database servers can be added as needed. + Note that implementations should be thread safe or immutable since they may + be accessed by multiple threads at the same time. + + + + + Creates a connection based on the given database name or connection string. + + The database name or connection string. + An initialized DbConnection. + + + + Creates a new instance of the connection factory for the given version of LocalDb. + For SQL Server 2012 LocalDb use "v11.0". + + The LocalDb version to use. + + + + Creates a new instance of the connection factory for the given version of LocalDb. + For SQL Server 2012 LocalDb use "v11.0". + + + The LocalDb version to use. + + The connection string to use for options to the database other than the 'Initial Catalog', + 'Data Source', and 'AttachDbFilename'. + The 'Initial Catalog' and 'AttachDbFilename' will be prepended to this string based on the + database name when CreateConnection is called. + The 'Data Source' will be set based on the LocalDbVersion argument. + + + + + Creates a connection for SQL Server LocalDb based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + The connection string to use for options to the database other than the 'Initial Catalog', + 'Data Source', and 'AttachDbFilename'. + The 'Initial Catalog' and 'AttachDbFilename' will be prepended to this string based on the + database name when CreateConnection is called. + The 'Data Source' will be set based on the LocalDbVersion argument. + The default is 'Integrated Security=True; MultipleActiveResultSets=True;'. + + + + + Encapsulates a cloned and store . Note that these + objects are disposable and should be used in a using block to ensure both the cloned context and the + cloned connection are disposed. + + + + + For mocking. + + + + + Creates a clone of the given . The underlying of + the context is also cloned and the given connection string is used for the connection string of + the cloned connection. + + + + + Finds the assemblies that were used for loading o-space types in the source context + and loads those assemblies in the cloned context. + + + + + Disposes both the underlying ObjectContext and its store connection. + + + + + The cloned context. + + + + + This is always the store connection of the underlying ObjectContext. + + + + + Represents setting the database initializer for a specific context type + + + + + Represents a parameter to be passed to a method + + + + + Represents a series of parameters to pass to a method + + + + + Adds a new parameter to the collection + Used for unit testing + + + + + Represents the configuration for a series of contexts + + + + + Adds a new context to the collection + Used for unit testing + + + + + Represents the configuration for a specific context type + + + + + Represents setting the default connection factory + + + + + Represents all Entity Framework related configuration + + + + + Handles creating databases either using the core provider or the Migrations pipeline. + + + + + Creates a database using the core provider (i.e. ObjectContext.CreateDatabase) or + by using Code First Migrations to create an empty database + and the perform an automatic migration to the current model. + Migrations is used if Code First is being used and the EF provider is for SQL Server + or SQL Compact. The core is used for non-Code First models and for other providers even + when using Code First. + + + + + A DbContext instance represents a combination of the Unit Of Work and Repository patterns such that + it can be used to query from a database and group together changes that will then be written + back to the store as a unit. + DbContext is conceptually similar to ObjectContext. + + + DbContext is usually used with a derived type that contains properties for + the root entities of the model. These sets are automatically initialized when the + instance of the derived class is created. This behavior can be modified by applying the + attribute to either the entire derived context + class, or to individual properties on the class. + + The Entity Data Model backing the context can be specified in several ways. When using the Code First + approach, the properties on the derived context are used to build a model + by convention. The protected OnModelCreating method can be overridden to tweak this model. More + control over the model used for the Model First approach can be obtained by creating a + explicitly from a and passing this model to one of the DbContext constructors. + + When using the Database First or Model First approach the Entity Data Model can be created using the + Entity Designer (or manually through creation of an EDMX file) and then this model can be specified using + entity connection string or an object. + + The connection to the database (including the name of the database) can be specified in several ways. + If the parameterless DbContext constructor is called from a derived context, then the name of the derived context + is used to find a connection string in the app.config or web.config file. If no connection string is found, then + the name is passed to the DefaultConnectionFactory registered on the class. The connection + factory then uses the context name as the database name in a default connection string. (This default connection + string points to .\SQLEXPRESS on the local machine unless a different DefaultConnectionFactory is registered.) + + Instead of using the derived context name, the connection/database name can also be specified explicitly by + passing the name to one of the DbContext constructors that takes a string. The name can also be passed in + the form "name=myname", in which case the name must be found in the config file or an exception will be thrown. + + Note that the connection found in the app.config or web.config file can be a normal database connection + string (not a special Entity Framework connection string) in which case the DbContext will use Code First. + However, if the connection found in the config file is a special Entity Framework connection string, then the + DbContext will use Database/Model First and the model specified in the connection string will be used. + + An existing or explicitly created DbConnection can also be used instead of the database/connection name. + + A can be applied to a class derived from DbContext to set the + version of conventions used by the context when it creates a model. If no attribute is applied then the + latest version of conventions will be used. + + + + + Interface implemented by objects that can provide an instance. + The class implements this interface to provide access to the underlying + ObjectContext. + + + + + Gets the object context. + + The object context. + + + + Constructs a new context instance using conventions to create the name of the database to + which a connection will be made. The by-convention name is the full name (namespace + class name) + of the derived context class. + See the class remarks for how this is used to create a connection. + + + + + Constructs a new context instance using conventions to create the name of the database to + which a connection will be made, and initializes it from the given model. + The by-convention name is the full name (namespace + class name) of the derived context class. + See the class remarks for how this is used to create a connection. + + The model that will back this context. + + + + Constructs a new context instance using the given string as the name or connection string for the + database to which a connection will be made. + See the class remarks for how this is used to create a connection. + + Either the database name or a connection string. + + + + Constructs a new context instance using the given string as the name or connection string for the + database to which a connection will be made, and initializes it from the given model. + See the class remarks for how this is used to create a connection. + + Either the database name or a connection string. + The model that will back this context. + + + + Constructs a new context instance using the existing connection to connect to a database. + The connection will not be disposed when the context is disposed. + + An existing connection to use for the new context. + If set to true the connection is disposed when + the context is disposed, otherwise the caller must dispose the connection. + + + + Constructs a new context instance using the existing connection to connect to a database, + and initializes it from the given model. + The connection will not be disposed when the context is disposed. + An existing connection to use for the new context. + The model that will back this context. + If set to true the connection is disposed when + the context is disposed, otherwise the caller must dispose the connection. + + + + + Constructs a new context instance around an existing ObjectContext. + An existing ObjectContext to wrap with the new context. + If set to true the ObjectContext is disposed when + the DbContext is disposed, otherwise the caller must dispose the connection. + + + + + Initializes the internal context, discovers and initializes sets, and initializes from a model if one is provided. + + + + + Discovers DbSets and initializes them. + + + + + This method is called when the model for a derived context has been initialized, but + before the model has been locked down and used to initialize the context. The default + implementation of this method does nothing, but it can be overridden in a derived class + such that the model can be further configured before it is locked down. + + + Typically, this method is called only once when the first instance of a derived context + is created. The model for that context is then cached and is for all further instances of + the context in the app domain. This caching can be disabled by setting the ModelCaching + property on the given ModelBuidler, but note that this can seriously degrade performance. + More control over caching is provided through use of the DbModelBuilder and DbContextFactory + classes directly. + + The builder that defines the model for the context being created. + + + + Internal method used to make the call to the real OnModelCreating method. + + The model builder. + + + + Returns a DbSet instance for access to entities of the given type in the context, + the ObjectStateManager, and the underlying store. + + + See the DbSet class for more details. + + The type entity for which a set should be returned. + A set for the given entity type. + + + + Returns a non-generic DbSet instance for access to entities of the given type in the context, + the ObjectStateManager, and the underlying store. + + The type of entity for which a set should be returned. + A set for the given entity type. + + See the DbSet class for more details. + + + + + Saves all changes made in this context to the underlying database. + + The number of objects written to the underlying database. + Thrown if the context has been disposed. + + + + Validates tracked entities and returns a Collection of containing validation results. + + + Collection of validation results for invalid entities. The collection is never null and must not contain null + values or results for valid entities. + + + 1. This method calls DetectChanges() to determine states of the tracked entities unless + DbContextConfiguration.AutoDetectChangesEnabled is set to false. + 2. By default only Added on Modified entities are validated. The user is able to change this behavior + by overriding ShouldValidateEntity method. + + + + + Extension point allowing the user to override the default behavior of validating only + added and modified entities. + + DbEntityEntry instance that is supposed to be validated. + true to proceed with validation. false otherwise. + + + + Extension point allowing the user to customize validation of an entity or filter out validation results. + Called by . + + DbEntityEntry instance to be validated. + User defined dictionary containing additional info for custom validation. + It will be passed to + and will be exposed as . + This parameter is optional and can be null. + Entity validation result. Possibly null when overridden. + + + + Internal method that calls the protected ValidateEntity method. + + DbEntityEntry instance to be validated. + User defined dictionary containing additional info for custom validation. + It will be passed to + and will be exposed as . + This parameter is optional and can be null. + Entity validation result. Possibly null when ValidateEntity is overridden. + + + + Gets a object for the given entity providing access to + information about the entity and the ability to perform actions on the entity. + + The type of the entity. + The entity. + An entry for the entity. + + + + Gets a object for the given entity providing access to + information about the entity and the ability to perform actions on the entity. + + The entity. + An entry for the entity. + + + + Calls the protected Dispose method. + + + + + Disposes the context. The underlying is also disposed if it was created + is by this context or ownership was passed to this context when this context was created. + The connection to the database ( object) is also disposed if it was created + is by this context or ownership was passed to this context when this context was created. + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Creates a Database instance for this context that allows for creation/deletion/existence checks + for the underlying database. + + + + + Returns the Entity Framework ObjectContext that is underlying this context. + + Thrown if the context has been disposed. + + + + Provides access to features of the context that deal with change tracking of entities. + + An object used to access features that deal with change tracking. + + + + Provides access to configuration options for the context. + + An object used to access configuration options. + + + + Provides access to the underlying InternalContext for other parts of the internal design. + + + + + A simple representation of an app.config or web.config file. + + + + + Initializes a new instance of AppConfig based on supplied configuration + + Configuration to load settings from + + + + Initializes a new instance of AppConfig based on supplied connection strings + The default configuration for database initializers and default connection factory will be used + + Connection strings to be used + + + + Initializes a new instance of AppConfig based on the for the AppDomain + + + Use AppConfig.DefaultInstance instead of this constructor + + + + + Appies any database intializers specified in the configuration + + + + + Appies any database intializers specified in the configuration + + + Value indicating if initializers should be re-applied if they have already been applied in this AppDomain + + + + + Gets the specified connection string from the configuration + + Name of the connection string to get + The connection string, or null if there is no connection string with the specified name + + + + Gets the default connection factory based on the configuration + + + + + Gets a singleton instance of configuration based on the for the AppDomain + + + + + Acts as a proxy for that for the most part just passes calls + through to the real object but uses virtual methods/properties such that uses of the object + can be mocked. + + + + + Encapsulates information read from the application config file that specifies a database initializer + and allows that initializer to be dynamically applied. + + + + + Initializes a new instance of the class. + + The key from the entry in the config file. + The value from the enrty in the config file. + + + + Uses the context type and initializer type specified in the config to create an initializer instance + and set it with the DbDbatabase.SetInitializer method. + + + + + Reads all initializers from the application config file and sets them using the Database class. + + + + + Calculates the model hash values used the EdmMetadata table from EF 4.1/4.2. + + + + + Calculates an SHA256 hash of the EDMX from the given code first model. This is the hash stored in + the database in the EdmMetadata table in EF 4.1/4.2. The hash is always calculated using a v2 schema + as was generated by EF 4.1/4.2 and with the entity included in the model. + + + + + Acts as a proxy for that for the most part just passes calls + through to the real object but uses virtual methods/properties such that uses of the object + can be mocked. + + + + + An implementation of that will use Code First Migrations + to update the database to the latest version. + + + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + Initializes a new instance of the MigrateDatabaseToLatestVersion class. + + + + + Initializes a new instance of the MigrateDatabaseToLatestVersion class that will + use a specific connection string from the configuration file to connect to + the database to perform the migration. + + The name of the connection string to use for migration. + + + + + + + Helper class that is used to configure a column. + + + + + Creates a new column definition to store Binary data. + + Value indicating whether or not the column allows null values. + The maximum allowable length of the array data. + Value indicating whether or not all data should be padded to the maximum length. + Value indicating whether or not the maximum length supported by the database provider should be used. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + Value indicating whether or not this column should be configured as a timestamp. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Boolean data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Byte data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store DateTime data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Decimal data. + + Value indicating whether or not the column allows null values. + The numeric precision of the column. + The numeric scale of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + Value indicating whether or not the database will generate values for this column during insert. + The newly constructed column definition. + + + + Creates a new column definition to store Double data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store GUID data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Single data. + + Value indicating whether or not the column allows null values. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Short data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Integer data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Long data. + + Value indicating whether or not the column allows null values. + Value indicating whether or not the database will generate values for this column during insert. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store String data. + + Value indicating whether or not the column allows null values. + The maximum allowable length of the string data. + Value indicating whether or not all data should be padded to the maximum length. + Value indicating whether or not the maximum length supported by the database provider should be used. + Value indicating whether or not the column supports Unicode content. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store Time data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Creates a new column definition to store DateTimeOffset data. + + Value indicating whether or not the column allows null values. + The precision of the column. + Constant value to use as the default value for this column. + SQL expression used as the default value for this column. + The name of the column. + Provider specific data type to use for this column. + The newly constructed column definition. + + + + Helper class that is used to further configure a table being created from a CreateTable call on . + + + + + Initializes a new instance of the TableBuilder class. + + The table creation operation to be further configured. + The migration the table is created in. + + + + Specifies a primary key for the table. + + + A lambda expression representing the property to be used as the primary key. + C#: t => t.Id + VB.Net: Function(t) t.Id + + If the primary key is made up of multiple properties then specify an anonymous type including the properties. + C#: t => new { t.Id1, t.Id2 } + VB.Net: Function(t) New With { t.Id1, t.Id2 } + + + The name of the primary key. + If null is supplied, a default name will be generated. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Specifies an index to be created on the table. + + + A lambda expression representing the property to be indexed. + C#: t => t.PropertyOne + VB.Net: Function(t) t.PropertyOne + + If multiple properties are to be indexed then specify an anonymous type including the properties. + C#: t => new { t.PropertyOne, t.PropertyTwo } + VB.Net: Function(t) New With { t.PropertyOne, t.PropertyTwo } + + A value indicating whether or not this is a unique index. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Specifies a foreign key constraint to be created on the table. + + Name of the table that the foreign key constraint targets. + + A lambda expression representing the properties of the foreign key. + C#: t => t.PropertyOne + VB.Net: Function(t) t.PropertyOne + + If multiple properties make up the foreign key then specify an anonymous type including the properties. + C#: t => new { t.PropertyOne, t.PropertyTwo } + VB.Net: Function(t) New With { t.PropertyOne, t.PropertyTwo } + + A value indicating whether or not cascade delete should be configured on the foreign key constraint. + + + The name of this foreign key constraint. + If no name is supplied, a default name will be calculated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + Itself, so that multiple calls can be chained. + + + + Base class for code-based migrations. + + + + + Operations to be performed during the upgrade process. + + + + + Operations to be performed during the downgrade process. + + + + + Adds an operation to create a new table. + + + The columns in this create table operation. + You do not need to specify this type, it will be inferred from the columnsAction parameter you supply. + + The name of the table. Schema name is optional, if no schema is specified then dbo is assumed. + + An action that specifies the columns to be included in the table. + i.e. t => new { Id = t.Int(identity: true), Name = t.String() } + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + An object that allows further configuration of the table creation operation. + + + + Adds an operation to create a new foreign key constraint. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key column. + + The table that contains the column this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The column this foreign key references. + If no value is supplied the primary key of the principal table will be referenced. + + + A value indicating if cascade delete should be configured for the foreign key relationship. + If no value is supplied, cascade delete will be off. + + + The name of the foreign key constraint in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new foreign key constraint. + + + The table that contains the foreign key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key columns. + + The table that contains the columns this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The columns this foreign key references. + If no value is supplied the primary key of the principal table will be referenced. + + + A value indicating if cascade delete should be configured for the foreign key relationship. + If no value is supplied, cascade delete will be off. + + + The name of the foreign key constraint in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on its name. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the foreign key constraint in the database. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on the column it targets. + + + The table that contains the foreign key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key column. + + The table that contains the column this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + The columns this foreign key references. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a foreign key constraint based on the columns it targets. + + + The table that contains the foreign key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The foreign key columns. + + The table that contains the columns this foreign key references. + Schema name is optional, if no schema is specified then dbo is assumed. + + The columns this foreign key references. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop a table. + + + The name of the table to be dropped. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to move a table to a new schema. + + + The name of the table to be moved. + Schema name is optional, if no schema is specified then dbo is assumed. + + The schema the table is to be moved to. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to rename a table. To change the schema of a table use MoveTable + + + The name of the table to be renamed. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The new name for the table. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to rename a column. + + + The name of the table that contains the column to be renamed. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be renamed. + The new name for the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to add a column to an existing table. + + + The name of the table to add the column to. + Schema name is optional, if no schema is specified then dbo is assumed. + + + The name of the column to be added. + + + An action that specifies the column to be added. + i.e. c => c.Int(nullable: false, defaultValue: 3) + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing column. + + + The name of the table to drop the column from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to alter the definition of an existing column. + + + The name of the table the column exists in. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to be changed. + + An action that specifies the new definition for the column. + i.e. c => c.String(nullable: false, defaultValue: "none") + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new primary key. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The primary key column. + + The name of the primary key in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create a new primary key based on multiple columns. + + + The table that contains the primary key columns. + Schema name is optional, if no schema is specified then dbo is assumed. + + The primary key columns. + + The name of the primary key in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing primary key that does not have the default name. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the primary key to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an existing primary key that was created with the default name. + + + The table that contains the primary key column. + Schema name is optional, if no schema is specified then dbo is assumed. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create an index on a single column. + + + The name of the table to create the index on. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column to create the index on. + + A value indicating if this is a unique index. + If no value is supplied a non-unique index will be created. + + + The name to use for the index in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to create an index on multiple columns. + + + The name of the table to create the index on. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the columns to create the index on. + + A value indicating if this is a unique index. + If no value is supplied a non-unique index will be created. + + + The name to use for the index in the database. + If no value is supplied a unique name will be generated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an index based on its name. + + + The name of the table to drop the index from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the index to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to drop an index based on the columns it targets. + + + The name of the table to drop the index from. + Schema name is optional, if no schema is specified then dbo is assumed. + + The name of the column(s) the index targets. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Adds an operation to execute a SQL command. + + The SQL to be executed. + + A value indicating if the SQL should be executed outside of the + transaction being used for the migration process. + If no value is supplied the SQL will be executed within the transaction. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Configuration relating to the use of migrations for a given model. + You will typically create a configuration class that derives + from rather than + using this class. + + + + + Initializes a new instance of the DbMigrationsConfiguration class. + + + + + Adds a new SQL generator to be used for a given database provider. + + Name of the database provider to set the SQL generator for. + The SQL generator to be used. + + + + Gets the SQL generator that is set to be used with a given database provider. + + Name of the database provider to get the SQL generator for. + The SQL generator that is set for the database provider. + + + + Gets or sets a value indicating if automatic migrations can be used when migration the database. + + + + + Gets or sets a value indicating if data loss is acceptable during automatic migration. + If set to false an exception will be thrown if data loss may occur as part of an automatic migration. + + + + + Gets or sets the derived DbContext representing the model to be migrated. + + + + + Gets or sets the namespace used for code-based migrations. + + + + + Gets or sets the sub-directory that code-based migrations are stored in. + + + + + Gets or sets the code generator to be used when scaffolding migrations. + + + + + Gets or sets the assembly containing code-based migrations. + + + + + Gets or sets a value to override the connection of the database to be migrated. + + + + + Gets or sets the timeout value used for the individual commands within a + migration. A null value indicates that the default value of the underlying + provider will be used. + + + + + Configuration relating to the use of migrations for a given model. + + The context representing the model that this configuration applies to. + + + + Initializes a new instance of the DbMigrationsConfiguration class. + + + + + Runs after upgrading to the latest migration to allow seed data to be updated. + + Context to be used for updating seed data. + + + + DbMigrator is used to apply existing migrations to a database. + DbMigrator can be used to upgrade and downgrade to any given migration. + To scaffold migrations based on changes to your model use + + + + + Base class for decorators that wrap the core + + + + + Initializes a new instance of the MigratorBase class. + + The migrator that this decorator is wrapping. + + + + Gets a list of the pending migrations that have not been applied to the database. + + List of migration Ids + + + + Updates the target database to the latest migration. + + + + + Updates the target database to a given migration. + + The migration to upgrade/downgrade to. + + + + Gets a list of the migrations that are defined in the assembly. + + List of migration Ids + + + + Gets a list of the migrations that have been applied to the database. + + List of migration Ids + + + + Gets the configuration being used for the migrations process. + + + + + Migration Id representing the state of the database before any migrations are applied. + + + + + Initializes a new instance of the DbMigrator class. + + Configuration to be used for the migration process. + + + + Gets all migrations that are defined in the configured migrations assembly. + + + + + Gets all migrations that have been applied to the target database. + + + + + Gets all migrations that are defined in the assembly but haven't been applied to the target database. + + + + + Updates the target database to a given migration. + + The migration to upgrade/downgrade to. + + + + Gets the configuration that is being used for the migration process. + + + + + A set of extension methods for + + + + + Adds or updates entities by key when SaveChanges is called. Equivalent to an "upsert" operation + from database terminology. + This method can useful when seeding data using Migrations. + + The entities to add or update. + + When the parameter is a custom or fake IDbSet implementation, this method will + attempt to locate and invoke a public, instance method with the same signature as this extension method. + + + + + Adds or updates entities by a custom identification expression when SaveChanges is called. + Equivalent to an "upsert" operation from database terminology. + This method can useful when seeding data using Migrations. + + + An expression specifying the properties that should be used when determining + whether an Add or Update operation should be performed. + + The entities to add or update. + + When the parameter is a custom or fake IDbSet implementation, this method will + attempt to locate and invoke a public, instance method with the same signature as this extension method. + + + + + Generates C# code for a code-based migration. + + + + + Base class for providers that generate code for code-based migrations. + + + + + Generates the code that should be added to the users project. + + Unique identifier of the migration. + Operations to be performed by the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Gets the namespaces that must be output as "using" or "Imports" directives to handle + the code generated by the given operations. + + The operations for which code is going to be generated. + An ordered list of namespace names. + + + + Gets the default namespaces that must be output as "using" or "Imports" directives for + any code generated. + + A value indicating if this class is being generated for a code-behind file. + An ordered list of namespace names. + + + + + + + Generates the primary code file that the user can view and edit. + + Operations to be performed by the migration. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates the code behind file with migration metadata. + + Unique identifier of the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates a property to return the source or target model in the code behind file. + + Name of the property. + Value to be returned. + Text writer to add the generated code to. + + + + Generates a namespace, using statements and class definition. + + Namespace that code should be generated in. + Name of the class that should be generated. + Text writer to add the generated code to. + Base class for the generated class. + A value indicating if this class is being generated for a code-behind file. + Namespaces for which using directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used. + + + + Generates the closing code for a class that was started with WriteClassStart. + + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify a set of column names using a lambda expression. + + The columns to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify the definition for a . + + The column definition to generate code for. + Text writer to add the generated code to. + A value indicating whether to include the column name in the definition. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column of unknown data type. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Removes any invalid characters from the name of an database artifact. + + The name to be scrubbed. + The scrubbed name. + + + + Gets the type name to use for a column of the given data type. + + The data type to translate. + The type name to use in the generated migration. + + + + Quotes an identifier using appropriate escaping to allow it to be stored in a string. + + The identifier to be quoted. + The quoted identifier. + + + + Scaffolds code-based migrations to apply pending model changes to the database. + + + + + Initializes a new instance of the MigrationScaffolder class. + + Configuration to be used for scaffolding. + + + + Scaffolds a code based migration to apply any pending model changes to the database. + + The name to use for the scaffolded migration. + The scaffolded migration. + + + + Scaffolds a code based migration to apply any pending model changes to the database. + + The name to use for the scaffolded migration. + Whether or not to include model changes. + The scaffolded migration. + + + + Scaffolds the initial code-based migration corresponding to a previously run database initializer. + + The scaffolded migration. + + + + Gets or sets the namespace used in the migration's generated code. + + By default, this is the same as MigrationsNamespace on the migrations + configuration object passed into the constructor. For VB.NET projects, this + will need to be updated to take into account the project's root namespace. + + + + + Represents a code-based migration that has been scaffolded and is ready to be written to a file. + + + + + Gets or sets the unique identifier for this migration. + Typically used for the file name of the generated code. + + + + + Gets or sets the scaffolded migration code that the user can edit. + + + + + Gets or sets the scaffolded migration code that should be stored in a code behind file. + + + + + Gets or sets the programming language used for this migration. + Typically used for the file extension of the generated code. + + + + + Gets or sets the subdirectory in the user's project that this migration should be saved in. + + + + + Gets a dictionary of string resources to add to the migration resource file. + + + + + Represents an exception that occurred while running an operation in another AppDomain in the . + + + + + Initializes a new instance of the ToolingException class. + + Error that explains the reason for the exception. + The type of the exception that was thrown. + The stack trace of the exception that was thrown. + + + + + + + + + + Gets the type of the exception that was thrown. + + + + + Gets the stack trace of the exception that was thrown. + + + + + Helper class that is used by design time tools to run migrations related + commands that need to interact with an application that is being edited + in Visual Studio. + + Because the application is being edited the assemblies need to + be loaded in a separate AppDomain to ensure the latest version + is always loaded. + + The App/Web.config file from the startup project is also copied + to ensure that any configuration is applied. + + + + + Initializes a new instance of the ToolingFacade class. + + + The name of the assembly that contains the migrations configuration to be used. + + + The namespace qualified name of migrations configuration to be used. + + + The working directory containing the compiled assemblies. + + + The path of the config file from the startup project. + + + The path of the application data directory from the startup project. + Typically the App_Data directory for web applications or the working directory for executables. + + + The connection to the database to be migrated. + If null is supplied, the default connection for the context will be used. + + + + + Releases all unmanaged resources used by the facade. + + + + + Gets the fully qualified name of all types deriving from . + + All context types found. + + + + Gets the fully qualified name of a type deriving from . + + The name of the context type. If null, the single context type found in the assembly will be returned. + The context type found. + + + + Gets a list of all migrations that have been applied to the database. + + Ids of applied migrations. + + + + Gets a list of all migrations that have not been applied to the database. + + Ids of pending migrations. + + + + Updates the database to the specified migration. + + + The Id of the migration to migrate to. + If null is supplied, the database will be updated to the latest migration. + + Value indicating if data loss during automatic migration is acceptable. + + + + Generates a SQL script to migrate between two migrations. + + + The migration to update from. + If null is supplied, a script to update the current database will be produced. + + + The migration to update to. + If null is supplied, a script to update to the latest migration will be produced. + + Value indicating if data loss during automatic migration is acceptable. + The generated SQL script. + + + + Scaffolds a code-based migration to apply any pending model changes. + + The name for the generated migration. + The programming language of the generated migration. + The root namespace of the project the migration will be added to. + Whether or not to include model changes. + The scaffolded migration. + + + + Scaffolds the initial code-based migration corresponding to a previously run database initializer. + + The programming language of the generated migration. + The root namespace of the project the migration will be added to. + The scaffolded migration. + + + + + + + Releases all resources used by the facade. + + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + + Gets or sets an action to be run to log information. + + + + + Gets or sets an action to be run to log warnings. + + + + + Gets or sets an action to be run to log verbose information. + + + + + Base class for loggers that can be used for the migrations process. + + + + + Logs an informational message. + + The message to be logged. + + + + Logs a warning that the user should be made aware of. + + The message to be logged. + + + + Logs some additional information that should only be presented to the user if they request verbose output. + + The message to be logged. + + + + Generates VB.Net code for a code-based migration. + + + + + + + + Generates the primary code file that the user can view and edit. + + Operations to be performed by the migration. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates the code behind file with migration metadata. + + Unique identifier of the migration. + Source model to be stored in the migration metadata. + Target model to be stored in the migration metadata. + Namespace that code should be generated in. + Name of the class that should be generated. + The generated code. + + + + Generates a property to return the source or target model in the code behind file. + + Name of the property. + Value to be returned. + Text writer to add the generated code to. + + + + Generates a namespace, using statements and class definition. + + Namespace that code should be generated in. + Name of the class that should be generated. + Text writer to add the generated code to. + Base class for the generated class. + A value indicating if this class is being generated for a code-behind file. + Namespaces for which Imports directives will be added. If null, then the namespaces returned from GetDefaultNamespaces will be used. + + + + Generates the closing code for a class that was started with WriteClassStart. + + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a as part of a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify a set of column names using a lambda expression. + + The columns to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform an . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to specify the definition for a . + + The column definition to generate code for. + Text writer to add the generated code to. + A value indicating whether to include the column name in the definition. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to specify the default value for a column of unknown data type. + + The value to be used as the default. + Code representing the default value. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Generates code to perform a . + + The operation to generate code for. + Text writer to add the generated code to. + + + + Removes any invalid characters from the name of an database artifact. + + The name to be scrubbed. + The scrubbed name. + + + + Gets the type name to use for a column of the given data type. + + The data type to translate. + The type name to use in the generated migration. + + + + Quotes an identifier using appropriate escaping to allow it to be stored in a string. + + The identifier to be quoted. + The quoted identifier. + + + + This class is used by Code First Migrations to read and write migration history + from the database. It is not intended to be used by other code and is only public + so that it can be accessed by EF when running under partial trust. It may be + changed or removed in the future. + + + + + Gets or sets the Id of the migration this row represents. + + + + + Gets or sets the date and time that this migrations history entry was created. + + + + + Gets or sets the state of the model after this migration was applied. + + + + + Gets or sets the version of Entity Framework that created this entry. + + + + + This is a version of the HistoryContext that still includes CreatedOn in its model. + It is used when figuring out whether or not the CreatedOn column exists and so should + be dropped. + + + + + Represents an error that occurs when an automatic migration would result in data loss. + + + + + Represents errors that occur inside the Code First Migrations pipeline. + + + + + Initializes a new instance of the MigrationsException class. + + + + + Initializes a new instance of the MigrationsException class. + + The message that describes the error. + + + + Initializes a new instance of the MigrationsException class. + + The message that describes the error. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the MigrationsException class with serialized data. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + + + Initializes a new instance of the AutomaticDataLossException class. + + The message that describes the error. + + + + Represents an error that occurs when there are pending model changes after applying the last migration and automatic migration is disabled. + + + + + Initializes a new instance of the AutomaticMigrationsDisabledException class. + + The message that describes the error. + + + + Provides additional metadata about a code-based migration. + + + + + Gets the unique identifier for the migration. + + + + + Gets the state of the model before this migration is run. + + + + + Gets the state of the model after this migration is run. + + + + + Decorator to provide logging during migrations operations.. + + + + + Initializes a new instance of the MigratorLoggingDecorator class. + + The migrator that this decorator is wrapping. + The logger to write messages to. + + + + Decorator to produce a SQL script instead of applying changes to the database. + Using this decorator to wrap will prevent + from applying any changes to the target database. + + + + + Initializes a new instance of the MigratorScriptingDecorator class. + + The migrator that this decorator is wrapping. + + + + + Represents a column being added to a table. + + + + + Represents an operation to modify a database schema. + + + + + Initializes a new instance of the MigrationOperation class. + + + + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets additional arguments that may be processed by providers. + + + + + Gets an operation that will revert this operation. + + + + + Gets a value indicating if this operation may result in data loss. + + + + + Initializes a new instance of the AddColumnOperation class. + + The name of the table the column should be added to. + Details of the column being added. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column should be added to. + + + + + Gets the details of the column being added. + + + + + Gets an operation that represents dropping the added column. + + + + + + + + Represents a foreign key constraint being added to a table. + + + + + Base class for changes that affect foreign key constraints. + + + + + Initializes a new instance of the ForeignKeyOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the name of the table that the foreign key constraint targets. + + + + + Gets or sets the name of the table that the foreign key columns exist in. + + + + + The names of the foreign key column(s). + + + + + Gets a value indicating if a specific name has been supplied for this foreign key constraint. + + + + + Gets or sets the name of this foreign key constraint. + If no name is supplied, a default name will be calculated. + + + + + Initializes a new instance of the AddForeignKeyOperation class. + The PrincipalTable, PrincipalColumns, DependentTable and DependentColumns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to create an index on the foreign key column(s). + + An operation to add the index. + + + + The names of the column(s) that the foreign key constraint should target. + + + + + Gets or sets a value indicating if cascade delete should be configured on the foreign key constraint. + + + + + Gets an operation to drop the foreign key constraint. + + + + + + + + Represents adding a primary key to a table. + + + + + Common base class to represent operations affecting primary keys. + + + + + Initializes a new instance of the PrimaryKeyOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the name of the table that contains the primary key. + + + + + Gets the column(s) that make up the primary key. + + + + + Gets a value indicating if a specific name has been supplied for this primary key. + + + + + Gets or sets the name of this primary key. + If no name is supplied, a default name will be calculated. + + + + + + + + Initializes a new instance of the AddPrimaryKeyOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to drop the primary key. + + + + + Represents altering an existing column. + + + + + Initializes a new instance of the AlterColumnOperation class. + + The name of the table that the column belongs to. + Details of what the column should be altered to. + Value indicating if this change will result in data loss. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the AlterColumnOperation class. + + The name of the table that the column belongs to. + Details of what the column should be altered to. + Value indicating if this change will result in data loss. + An operation to revert this alteration of the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table that the column belongs to. + + + + + Gets the new definition for the column. + + + + + Gets an operation that represents reverting the alteration. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents information about a column. + + + + + Initializes a new instance of the class. + + The data type for this column. + + + + Initializes a new instance of the class. + + The data type for this column. + + Additional details about the data type. + This includes details such as maximum length, nullability etc. + + + + + Determines if this column is a narrower data type than another column. + Used to determine if altering the supplied column definition to this definition will result in data loss. + + The column to compare to. + Details of the database provider being used. + True if this column is of a narrower data type. + + + + Gets the data type for this column. + + + + + Gets the CLR type corresponding to the database type of this column. + + + + + Gets the default value for the CLR type corresponding to the database type of this column. + + + + + Gets additional details about the data type of this column. + This includes details such as maximum length, nullability etc. + + + + + Gets or sets the name of the column. + + + + + Gets or sets a provider specific data type to use for this column. + + + + + Gets or sets a value indicating if this column can store null values. + + + + + Gets or sets a value indicating if values for this column will be generated by the database using the identity pattern. + + + + + Gets or sets the maximum length for this column. + Only valid for array data types. + + + + + Gets or sets the precision for this column. + Only valid for decimal data types. + + + + + Gets or sets the scale for this column. + Only valid for decimal data types. + + + + + Gets or sets a constant value to use as the default value for this column. + + + + + Gets or sets a SQL expression used as the default value for this column. + + + + + Gets or sets a value indicating if this column is fixed length. + Only valid for array data types. + + + + + Gets or sets a value indicating if this column supports Unicode characters. + Only valid for textual data types. + + + + + Gets or sets a value indicating if this column should be configured as a timestamp. + + + + + Represents creating a database index. + + + + + Common base class for operations affecting indexes. + + + + + Initializes a new instance of the IndexOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets the table the index belongs to. + + + + + Gets or sets the columns that are indexed. + + + + + Gets a value indicating if a specific name has been supplied for this index. + + + + + Gets or sets the name of this index. + If no name is supplied, a default name will be calculated. + + + + + Initializes a new instance of the CreateIndexOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets or sets a value indicating if this is a unique index. + + + + + Gets an operation to drop this index. + + + + + + + + Represents creating a table. + + + + + Initializes a new instance of the CreateTableOperation class. + + Name of the table to be created. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be created. + + + + + Gets the columns to be included in the new table. + + + + + Gets or sets the primary key for the new table. + + + + + Gets an operation to drop the table. + + + + + + + + Represents deleting a new record from the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Common base class for operations that affect the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Initializes a new instance of the HistoryOperation class. + + Name of the migrations history table. + Name of the migration being affected. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the migrations history table. + + + + + Gets the name of the migration being affected. + + + + + + + + Initializes a new instance of the DeleteHistoryOperation class. + + Name of the migrations history table. + Id of the migration record to be deleted. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Represents a column being dropped from a table. + + + + + Initializes a new instance of the DropColumnOperation class. + + The name of the table the column should be dropped from. + The name of the column to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropColumnOperation class. + + The name of the table the column should be dropped from. + The name of the column to be dropped. + The operation that represents reverting the drop operation. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column should be dropped from. + + + + + Gets the name of the column to be dropped. + + + + + Gets an operation that represents reverting dropping the column. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents a foreign key constraint being dropped from a table. + + + + + Initializes a new instance of the DropForeignKeyOperation class. + The PrincipalTable, DependentTable and DependentColumns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropForeignKeyOperation class. + + The operation that represents reverting dropping the foreign key constraint. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to drop the associated index on the foreign key column(s). + + An operation to drop the index. + + + + Gets an operation that represents reverting dropping the foreign key constraint. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents dropping an existing index. + + + + + Initializes a new instance of the DropIndexOperation class. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropIndexOperation class. + + The operation that represents reverting dropping the index. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation that represents reverting dropping the index. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents dropping a primary key from a table. + + + + + Initializes a new instance of the DropPrimaryKeyOperation class. + The Table and Columns properties should also be populated. + + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets an operation to add the primary key. + + + + + Represents dropping an existing table. + + + + + Initializes a new instance of the DropTableOperation class. + + The name of the table to be dropped. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Initializes a new instance of the DropTableOperation class. + + The name of the table to be dropped. + An operation that represents reverting dropping the table. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be dropped. + + + + + Gets an operation that represents reverting dropping the table. + The inverse cannot be automatically calculated, + if it was not supplied to the constructor this property will return null. + + + + + + + + Represents inserting a new record into the migrations history table. + The migrations history table is used to store a log of the migrations that have been applied to the database. + + + + + Initializes a new instance of the InsertHistoryOperation class. + + Name of the migrations history table. + Id of the migration record to be inserted. + Value to be stored in the model column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the value to store in the history table representing the target model of the migration. + + + + + Gets the value to store in the history table indicating the version of Entity Framework used to produce this migration. + + + + + + + + Represents moving a table from one schema to another. + + + + + Initializes a new instance of the MoveTableOperation class. + + Name of the table to be moved. + Name of the schema to move the table to. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be moved. + + + + + Gets the name of the schema to move the table to. + + + + + Gets an operation that moves the table back to its original schema. + + + + + + + + Represents renaming an existing column. + + + + + Initializes a new instance of the RenameColumnOperation class. + + Name of the table the column belongs to. + Name of the column to be renamed. + New name for the column. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table the column belongs to. + + + + + Gets the name of the column to be renamed. + + + + + Gets the new name for the column. + + + + + Gets an operation that reverts the rename. + + + + + + + + Represents renaming an existing table. + + + + + Initializes a new instance of the RenameTableOperation class. + + Name of the table to be renamed. + New name for the table. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the name of the table to be renamed. + + + + + Gets the new name for the table. + + + + + Gets an operation that reverts the rename. + + + + + + + + Represents a provider specific SQL statement to be executed directly against the target database. + + + + + Initializes a new instance of the SqlOperation class. + + The SQL to be executed. + + Additional arguments that may be processed by providers. + Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. + + + + + Gets the SQL to be executed. + + + + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + + + + Common base class for providers that convert provider agnostic migration + operations into database provider specific SQL commands. + + + + + Converts a set of migration operations into database provider specific SQL. + + The operations to be converted. + Token representing the version of the database being targeted. + A list of SQL statements to be executed to perform the migration operations. + + + + Represents a migration operation that has been translated into a SQL statement. + + + + + Gets or sets the SQL to be executed to perform this migration operation. + + + + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + Provider to convert provider agnostic migration operations into SQL commands + that can be run against Microsoft SQL Server Compact Edition. + + + + + Provider to convert provider agnostic migration operations into SQL commands + that can be run against a Microsoft SQL Server database. + + + + + Converts a set of migration operations into Microsoft SQL Server specific SQL. + + The operations to be converted. + Token representing the version of SQL Server being targeted (i.e. "2005", "2008"). + A list of SQL statements to be executed to perform the migration operations. + + + + Creates an empty connection for the current provider. + Allows derived providers to use connection other than . + + + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL to mark a table as a system table. + Generated SQL should be added using the Statement method. + + The table to mark as a system table. + + + + Generates SQL to create a database schema. + Generated SQL should be added using the Statement method. + + The name of the schema to create. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL for a . + Generated SQL should be added using the Statement method. + + The operation to produce SQL for. + + + + Generates SQL to specify a constant byte[] default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant bool default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant DateTime default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant DateTimeOffset default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant Guid default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant string default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant TimeSpan default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify a constant default value being set on a column. + This method just generates the actual value, not the SQL to set the default value. + + The value to be set. + SQL representing the default value. + + + + Generates SQL to specify the data type of a column. + This method just generates the actual type, not the SQL to create the column. + + The definition of the column. + SQL representing the data type. + + + + Generates a quoted name. The supplied name may or may not contain the schema. + + The name to be quoted. + The quoted name. + + + + Quotes an identifier for SQL Server. + + The identifier to be quoted. + The quoted identifier. + + + + Adds a new Statement to be executed against the database. + + The statement to be executed. + + Gets or sets a value indicating whether this statement should be performed outside of + the transaction scope that is used to make the migration process transactional. + If set to true, this operation will not be rolled back if the migration process fails. + + + + + Gets a new that can be used to build SQL. + + This is just a helper method to create a writer. Writing to the writer will + not cause SQL to be registered for execution. You must pass the generated + SQL to the Statement method. + + An empty text writer to use for SQL generation. + + + + Adds a new Statement to be executed against the database. + + The writer containing the SQL to be executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Utility class to prep the user's config file to run in an AppDomain + + + + + Updates a config file by adding binding redirects for EntityFramework.dll. + This ensures that the user's code can be ran in an AppDomain and the exact + same version of the assembly will be used for both domains. + + That path of the user's config file. Can also be null or a path to an non-existent file. + The path of the updated config file. It is the caller's responsibility to delete this. + + + + The same as but works in partial trust. + + + + + Specifies the default tab string. This field is constant. + + + + + Initializes a new instance of the IndentedTextWriter class using the specified text writer and default tab string. + + The to use for output. + + + + Initializes a new instance of the IndentedTextWriter class using the specified text writer and tab string. + + The to use for output. + The tab string to use for indentation. + + + + Closes the document being written to. + + + + + Flushes the stream. + + + + + Outputs the tab string once for each level of indentation according to the property. + + + + + Writes the specified string to the text stream. + + The string to write. + + + + Writes the text representation of a Boolean value to the text stream. + + The Boolean value to write. + + + + Writes a character to the text stream. + + The character to write. + + + + Writes a character array to the text stream. + + The character array to write. + + + + Writes a subarray of characters to the text stream. + + The character array to write data from. + Starting index in the buffer. + The number of characters to write. + + + + Writes the text representation of a Double to the text stream. + + The double to write. + + + + Writes the text representation of a Single to the text stream. + + The single to write. + + + + Writes the text representation of an integer to the text stream. + + The integer to write. + + + + Writes the text representation of an 8-byte integer to the text stream. + + The 8-byte integer to write. + + + + Writes the text representation of an object to the text stream. + + The object to write. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string. + The object to write into the formatted string. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string to use. + The first object to write into the formatted string. + The second object to write into the formatted string. + + + + Writes out a formatted string, using the same semantics as specified. + + The formatting string to use. + The argument array to output. + + + + Writes the specified string to a line without tabs. + + The string to write. + + + + Writes the specified string, followed by a line terminator, to the text stream. + + The string to write. + + + + Writes a line terminator. + + + + + Writes the text representation of a Boolean, followed by a line terminator, to the text stream. + + The Boolean to write. + + + + Writes a character, followed by a line terminator, to the text stream. + + The character to write. + + + + Writes a character array, followed by a line terminator, to the text stream. + + The character array to write. + + + + Writes a subarray of characters, followed by a line terminator, to the text stream. + + The character array to write data from. + Starting index in the buffer. + The number of characters to write. + + + + Writes the text representation of a Double, followed by a line terminator, to the text stream. + + The double to write. + + + + Writes the text representation of a Single, followed by a line terminator, to the text stream. + + The single to write. + + + + Writes the text representation of an integer, followed by a line terminator, to the text stream. + + The integer to write. + + + + Writes the text representation of an 8-byte integer, followed by a line terminator, to the text stream. + + The 8-byte integer to write. + + + + Writes the text representation of an object, followed by a line terminator, to the text stream. + + The object to write. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string. + The object to write into the formatted string. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string to use. + The first object to write into the formatted string. + The second object to write into the formatted string. + + + + Writes out a formatted string, followed by a line terminator, using the same semantics as specified. + + The formatting string to use. + The argument array to output. + + + + Writes the text representation of a UInt32, followed by a line terminator, to the text stream. + + A UInt32 to output. + + + + Gets the encoding for the text writer to use. + + + An that indicates the encoding for the text writer to use. + + + + + Gets or sets the new line character to use. + + + The new line character to use. + + + + + Gets or sets the number of spaces to indent. + + + The number of spaces to indent. + + + + + Gets the to use. + + + The to use. + + + + + Used for generating values that are always in sequential + order for the calling thread. + + + + + Returns the value of unless this value would be the same as the + last value returned by this thread calling this method, in which case the thread pushes the value + a little bit into the future. The comparison is in terms of the form used to store migration ID + in the database--i.e. to the 1/10 second. + + + There should never be any pushing to the future involved for normal use of migrations, but when + this method is called in rapid succession while testing or otherwise calling the DbMigrator APIs + there may be occasional sleeping. + + + + + Same as UtcNow method bur returns the time in the timestamp format used in migration IDs. + + + + + Convention to apply column ordering specified via + or the API. This convention throws if a duplicate configured column order + is detected. + + + + + Convention to apply column ordering specified via + or the API. + + + + + Identifies conventions that can be removed from a instance. + + /// + Note that implementations of this interface must be immutable. + + + + + Strongly-typed and parameterized string resources. + + + + + A string like "Applying automatic migration: {0}." + + + + + A string like "Reverting automatic migration: {0}." + + + + + A string like "Applying code-based migration: {0}." + + + + + A string like "Reverting code-based migration: {0}." + + + + + A string like "Applying code-based migrations: [{1}]." + + + + + A string like "Reverting migrations: [{1}]." + + + + + A string like "Target database is already at version {0}." + + + + + A string like "Target database is: {0}." + + + + + A string like "'{1}' (DataSource: {0}, Provider: {2}, Origin: {3})" + + + + + A string like "The specified target migration '{0}' does not exist. Ensure that target migration refers to an existing migration id." + + + + + A string like "The Foreign Key on table '{0}' with columns '{1}' could not be created because the principal key columns could not be determined. Use the AddForeignKey fluent API to fully specify the Foreign Key." + + + + + A string like "'{0}' is not a valid target migration. When targeting a previously applied automatic migration, use the full migration id including timestamp." + + + + + A string like "'{0}' is not a valid migration. Code-based migrations must be used for both source and target when scripting the upgrade between them." + + + + + A string like "The target context '{0}' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory." + + + + + A string like "The specified migration name '{0}' is ambiguous. Specify the full migration id including timestamp instead." + + + + + A string like "The migrations configuration type '{0}' was not be found in the assembly '{1}'." + + + + + A string like "More than one migrations configuration type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the one to use." + + + + + A string like "No migrations configuration type was found in the assembly '{0}'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)." + + + + + A string like "More than one migrations configuration type was found in the assembly '{0}'. Specify the name of the one to use." + + + + + A string like "The type '{0}' is not a migrations configuration type." + + + + + A string like "The migrations configuration type '{0}' must have a public default constructor." + + + + + A string like "The migrations configuration type '{0}' must not be abstract." + + + + + A string like "The migrations configuration type '{0}' must not be generic." + + + + + A string like "In VB.NET projects, the migrations namespace '{0}' must be under the root namespace '{1}'. Update the migrations project's root namespace to allow classes under the migrations namespace to be added." + + + + + + A string like "No MigrationSqlGenerator found for provider '{0}'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators." + + + + + A string like "Could not load assembly '{0}'. (If you are using Code First Migrations inside Visual Studio this can happen if the startUp project for your solution does not reference the project that contains your migrations. You can either change the startUp project for your solution or use the -StartUpProjectName parameter.)" + + + + + A string like "No context type was found in the assembly '{0}'." + + + + + A string like "More than one context type was found in the assembly '{0}'." + + + + + A string like "To enable migrations for {0}, use Enable-Migrations -ContextTypeName {0}." + + + + + A string like "The context type '{0}' was not found in the assembly '{1}'." + + + + + A string like "More than one context type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the context." + + + + + A string like "The argument '{0}' cannot be null, empty or contain only white space." + + + + + A string like "The argument property '{0}' cannot be null." + + + + + A string like "The precondition '{0}' failed. {1}" + + + + + A string like "The type '{0}' has already been configured as a complex type. It cannot be reconfigured as an entity type." + + + + + A string like "The type '{0}' has already been configured as an entity type. It cannot be reconfigured as a complex type." + + + + + A string like "The key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + A string like "The foreign key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + A string like "The property '{0}' is not a declared property on type '{1}'. Verify that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property." + + + + + A string like "The navigation property '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property." + + + + + A string like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'." + + + + + A string like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. Use dotted paths for nested properties: C#: 't => t.MyProperty.MyProperty' VB.Net: 'Function(t) t.MyProperty.MyProperty'." + + + + + A string like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + A string like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + + A string like "Conflicting configuration settings were specified for property '{0}' on type '{1}': {2}" + + + + + A string like "Conflicting configuration settings were specified for column '{0}' on table '{1}': {2}" + + + + + A string like "{0} = {1} conflicts with {2} = {3}" + + + + + A string like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from ComplexObject." + + + + + A string like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject." + + + + + A string like "The navigation property '{0}' declared on type '{1}' cannot be the inverse of itself." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting foreign keys." + + + + + A string like "Values of incompatible types ('{1}' and '{2}') were assigned to the '{0}' discriminator column. Values of the same type must be specified. To explicitly specify the type of the discriminator column use the HasColumnType method." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting mapping information." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting cascade delete operations using 'WillCascadeOnDelete'." + + + + + A string like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting multiplicities." + + + + + A string like "The MaxLengthAttribute on property '{0}' on type '{1} is not valid. The Length value must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "The StringLengthAttribute on property '{0}' on type '{1}' is not valid. The maximum length must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "Unable to determine composite primary key ordering for type '{0}'. Use the ColumnAttribute or the HasKey method to specify an order for composite primary keys." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. Name must not be empty." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The foreign key name '{2}' was not found on the dependent type '{3}'. The Name value should be a comma separated list of foreign key property names." + + + + + A string like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The navigation property '{2}' was not found on the dependent type '{1}'. The Name value should be a valid navigation property name." + + + + + A string like "Unable to determine a composite foreign key ordering for foreign key on type {0}. When using the ForeignKey data annotation on composite foreign key properties ensure order is specified by using the Column data annotation or the fluent API." + + + + + A string like "The InversePropertyAttribute on property '{2}' on type '{3}' is not valid. The property '{0}' is not a valid navigation property on the related type '{1}'. Ensure that the property exists and is a valid reference or collection navigation property." + + + + + A string like "A relationship cannot be established from property '{0}' on type '{1}' to property '{0}' on type '{1}'. Check the values in the InversePropertyAttribute to ensure relationship definitions are unique and reference from one navigation property to its corresponding inverse navigation property." + + + + + A string like "\t{0}: {1}: {2}" + + + + + A string like "A key is registered for the derived type '{0}'. Keys can only be registered for the root type '{1}'." + + + + + A string like "The {0} value '{1}' already exists in the user-defined dictionary." + + + + + A string like "The type '{0}' has already been mapped to table '{1}'. Specify all mapping aspects of a table in a single Map call." + + + + + A string like "Map was called more than once for type '{0}' and at least one of the calls didn't specify the target table name." + + + + + A string like "The derived type '{0}' has already been mapped using the chaining syntax. A derived type can only be mapped once using the chaining syntax." + + + + + A string like "An "is not null" condition cannot be specified on property '{0}' on type '{1}' because this property is not included in the model. Check that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation." + + + + + A string like "Values of type '{0}' cannot be used as type discriminator values. Supported types include byte, signed byte, bool, int16, int32, int64, and string." + + + + + A string like "Unable to add the convention '{0}'. Could not find an existing convention of type '{1}' in the current convention set." + + + + + A string like "Not all properties for type '{0}' have been mapped. Either map those properties or explicitly excluded them from the model." + + + + + A string like "Unable to determine the provider name for connection of type '{0}'." + + + + + A string like "The qualified table name '{0}' contains an invalid schema name. Schema names must have a non-zero length." + + + + + A string like "The qualified table name '{0}' contains an invalid table name. Table names must have a non-zero length." + + + + + A string like "Properties for type '{0}' can only be mapped once. Ensure the MapInheritedProperties method is only used during one call to the Map method." + + + + + A string like "Properties for type '{0}' can only be mapped once. Ensure the Properties method is used and that repeated calls specify each non-key property only once." + + + + + A string like "Properties for type '{0}' can only be mapped once. The non-key property '{1}' is mapped more than once. Ensure the Properties method specifies each non-key property only once." + + + + + A string like "The property '{1}' on type '{0}' cannot be mapped because it has been explicitly excluded from the model or it is of a type not supported by the DbModelBuilderVersion being used." + + + + + A string like "The entity types '{0}' and '{1}' cannot share table '{2}' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them." + + + + + A string like "You cannot use Ignore method on the property '{0}' on type '{1}' because this type inherits from the type '{2}' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type." + + + + + A string like "The property '{0}' cannot be used as a key property on the entity '{1}' because the property type is not a valid key type. Only scalar types, string and byte[] are supported key types." + + + + + A string like "The specified table '{0}' was not found in the model. Ensure that the table name has been correctly specified." + + + + + A string like "The specified association foreign key columns '{0}' are invalid. The number of columns specified must match the number of primary key columns." + + + + + A string like "Unable to determine the principal end of an association between the types '{0}' and '{1}'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." + + + + + A string like "The abstract type '{0}' has no mapped descendents and so cannot be mapped. Either remove '{0}' from the model or add one or more types deriving from '{0}' to the model. " + + + + + A string like "The type '{0}' cannot be mapped as defined because it maps inherited properties from types that use entity splitting or another form of inheritance. Either choose a different inheritance mapping strategy so as to not map inherited properties, or change all types in the hierarchy to map inherited properties and to not use splitting. " + + + + + A string like "The table '{0}' was configured but is not used in any mappings. Verify the mapping configuration for '{0}' is correct." + + + + + A string like "The configured column orders for the table '{0}' contains duplicates. Ensure the specified column order values are distinct." + + + + + A string like "The enum or spatial property '{1}' on type '{0}' cannot be mapped. Use DbModelBuilderVersion 'V5_0' or later to map enum or spatial properties." + + + + + A string like "Multiple potential primary key properties named '{0}' but differing only by case were found on entity type '{1}'. Configure the primary key explicitly using the HasKey fluent API or the KeyAttribute data annotation." + + + + + A string like "Cannot get value for property '{0}' from entity of type '{1}' because the property has no get accessor." + + + + + A string like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor." + + + + + + A string like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor and is in the '{2}' state." + + + + + A string like "Member '{0}' cannot be called for property '{1}' on entity of type '{2}' because the property is not part of the Entity Data Model." + + + + + + A string like "Cannot call the {0} method for an entity of type '{1}' on a DbSet for entities of type '{2}'. Only entities of type '{2}' or derived from type '{2}' can be added, attached, or removed." + + + + + A string like "Cannot call the Create method for the type '{0}' on a DbSet for entities of type '{1}'. Only entities of type '{1}' or derived from type '{1}' can be created." + + + + + + + A string like "The property '{0}' on type '{1}' is a collection navigation property. The Collection method should be used instead of the Reference method." + + + + + A string like "The property '{0}' on type '{1}' is a reference navigation property. The Reference method should be used instead of the Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a navigation property. The Reference and Collection methods can only be used with navigation properties. Use the Property or ComplexProperty method." + + + + + A string like "The property '{0}' on type '{1}' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a complex property. The ComplexProperty method can only be used with complex properties. Use the Property, Reference or Collection method." + + + + + A string like "The property '{0}' on type '{1}' is not a primitive property, complex property, collection navigation property, or reference navigation property." + + + + + A string like ""The property '{0}' from the property path '{1}' is not a complex property on type '{2}'. Property paths must be composed of complex properties for all except the final property."" + + + + + A string like ""The property path '{0}' cannot be used for navigation properties. Property paths can only be used to access primitive or complex properties."" + + + + + A string like "The navigation property '{0}' on entity type '{1}' cannot be used for entities of type '{2}' because it refers to entities of type '{3}'." + + + + + A string like "The generic type argument '{0}' cannot be used with the Member method when accessing the collection navigation property '{1}' on entity type '{2}'. The generic type argument '{3}' must be used instead." + + + + + A string like "The property '{0}' on entity type '{1}' cannot be used for objects of type '{2}' because it is a property for objects of type '{3}'." + + + + + A string like "The expression passed to method {0} must represent a property defined on the type '{1}'." + + + + + A string like "{0} cannot be used for entities in the {1} state." + + + + + A string like "Cannot set non-nullable property '{0}' of type '{1}' to null on object of type '{2}'." + + + + + A string like "The property '{0}' in the entity of type '{1}' is null. Store values cannot be obtained for an entity with a null complex property." + + + + + A string like "Cannot assign value of type '{0}' to property '{1}' of type '{2}' in property values for type '{3}'." + + + + + A string like "The '{0}' property does not exist or is not mapped for the type '{1}'." + + + + + A string like "Cannot copy values from DbPropertyValues for type '{0}' into DbPropertyValues for type '{1}'." + + + + + A string like "Cannot copy from property values for object of type '{0}' into property values for object of type '{1}'." + + + + + A string like "The value of the complex property '{0}' on entity of type '{1}' is null. Complex properties cannot be set to null and values cannot be set for null complex properties." + + + + + A string like "The value of the nested property values property '{0}' on the values for entity of type '{1}' is null. Nested property values cannot be set to null and values cannot be set for null complex properties." + + + + + A string like "Cannot set the value of the nested property '{0}' because value of the complex property '{1}' to which it belongs is null." + + + + + A string like "Cannot set the original value of the nested property '{0}' because the original value of the complex property '{1}' to which it belongs is null." + + + + + A string like "The model backing the '{0}' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)." + + + + + A string like "Database '{0}' cannot be created because it already exists." + + + + + + + A string like "Failed to set database initializer of type '{0}' for DbContext type '{1}' specified in the application configuration. See inner exception for details." + + + + + A string like "Configuration for DbContext type '{0}' is specified multiple times in the application configuration. Each context can only be configured once." + + + + + A string like "Failed to set Database.DefaultConnectionFactory to an instance of the '{0}' type as specified in the application configuration. See inner exception for details." + + + + + A string like "The type '{0}' could not be found. The type name must be an assembly-qualified name." + + + + + A string like "The connection string '{0}' in the application's configuration file does not contain the required providerName attribute."" + + + + + A string like "The entity found was of type {0} when an entity of type {1} was requested." + + + + + A string like "The type '{0}' is mapped as a complex type. The Set method, DbSet objects, and DbEntityEntry objects can only be used with entity types, not complex types." + + + + + A string like "The type '{0}' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute." + + + + + A string like "The entity type {0} is not part of the model for the current context." + + + + + A string like "No connection string named '{0}' could be found in the application config file." + + + + + A string like "The collection navigation property '{0}' on the entity of type '{1}' cannot be set because the entity type does not define a navigation property with a set accessor." + + + + + A string like "Multiple object sets per type are not supported. The object sets '{0}' and '{1}' can both contain instances of type '{2}'." + + + + + A string like "The context type '{0}' must have a public constructor taking an EntityConnection." + + + + + A string like "An unexpected exception was thrown during validation of '{0}' when invoking {1}.IsValid. See the inner exception for details." + + + + + A string like "An unexpected exception was thrown during validation of '{0}' when invoking {1}.Validate. See the inner exception for details." + + + + + A string like "The database name '{0}' is not supported because it is an MDF file name. A full connection string must be provided to attach an MDF file." + + + + + A string like "The context factory type '{0}' must have a public default constructor." + + + + + A string like "The '{0}' property of EdmPrimitiveType is fixed and cannot be set." + + + + + A string like "The namespace '{0}' is a system namespace and cannot be used by other schemas. Choose another namespace name." + + + + + A string like "Role '{0}' in AssociationSets '{1}' and '{2}' refers to the same EntitySet '{3}' in EntityContainer '{4}'. Make sure that if two or more AssociationSets refer to the same AssociationType, the ends do not refer to the same EntitySet." + + + + + A string like "The referenced EntitySet '{0}' for End '{1}' could not be found in the containing EntityContainer." + + + + + A string like "Type '{0}' is derived from type '{1}' that is the type for EntitySet '{2}'. Type '{0}' defines new concurrency requirements that are not allowed for subtypes of base EntitySet types." + + + + + A string like "EntitySet '{0}' is based on type '{1}' that has no keys defined." + + + + + A string like "The end name '{0}' is already defined." + + + + + A string like "The key specified in EntityType '{0}' is not valid. Property '{1}' is referenced more than once in the Key element." + + + + + A string like "Property '{0}' has a CollectionKind specified but is not a collection property." + + + + + A string like "Property '{0}' has a CollectionKind specified. CollectionKind is only supported in version 1.1 EDM models." + + + + + A string like "ComplexType '{0}' is marked as abstract. Abstract ComplexTypes are only supported in version 1.1 EDM models." + + + + + A string like "ComplexType '{0}' has a BaseType specified. ComplexType inheritance is only supported in version 1.1 EDM models." + + + + + A string like "Key part '{0}' for type '{1}' is not valid. All parts of the key must be non-nullable." + + + + + A string like "The property '{0}' in EntityType '{1}' is not valid. All properties that are part of the EntityKey must be of PrimitiveType." + + + + + A string like "Key usage is not valid. The {0} class cannot define keys because one of its base classes ('{1}') defines keys." + + + + + A string like "EntityType '{0}' has no key defined. Define the key for this EntityType." + + + + + A string like "NavigationProperty is not valid. Role '{0}' or Role '{1}' is not defined in Relationship '{2}'." + + + + + A string like "End '{0}' on relationship '{1}' cannot have an operation specified because its multiplicity is '*'. Operations cannot be specified on ends with multiplicity '*'." + + + + + A string like "Each Name and PluralName in a relationship must be unique. '{0}' is already defined." + + + + + A string like "In relationship '{0}', the Principal and Dependent Role of the referential constraint refer to the same Role in the relationship type." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Valid values for multiplicity for the Principal Role are '0..1' or '1'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because all the properties in the Dependent Role are nullable, multiplicity of the Principal Role must be '0..1'." + + + + + A string like "Multiplicity conflicts with the referential constraint in Role '{0}' in relationship '{1}'. Because at least one of the properties in the Dependent Role is non-nullable, multiplicity of the Principal Role must be '1'." + + + + + A string like "Multiplicity conflicts with the referential constraint in Role '{0}' in relationship '{1}'. Because all of the properties in the Dependent Role are non-nullable, multiplicity of the Principal Role must be '1'." + + + + + A string like "Properties referred by the Dependent Role '{0}' must be a subset of the key of the EntityType '{1}' referred to by the Dependent Role in the referential constraint for relationship '{2}'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because the Dependent Role refers to the key properties, the upper bound of the multiplicity of the Dependent Role must be '1'." + + + + + A string like "Multiplicity is not valid in Role '{0}' in relationship '{1}'. Because the Dependent Role properties are not the key properties, the upper bound of the multiplicity of the Dependent Role must be '*'." + + + + + A string like "The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property '{0}' on entity '{1}' does not match the type of property '{2}' on entity '{3}' in the referential constraint '{4}'." + + + + + A string like "There is no property with name '{0}' defined in the type referred to by Role '{1}'." + + + + + A string like "A nullable ComplexType is not supported. Property '{0}' must not allow nulls." + + + + + A string like "A property cannot be of type '{0}'. The property type must be a ComplexType or a PrimitiveType." + + + + + A string like "Each member name in an EntityContainer must be unique. A member with name '{0}' is already defined." + + + + + A string like "Each type name in a schema must be unique. Type name '{0}' is already defined." + + + + + A string like "Name '{0}' cannot be used in type '{1}'. Member names cannot be the same as their enclosing type." + + + + + A string like "Each property name in a type must be unique. Property name '{0}' is already defined." + + + + + A string like "A cycle was detected in the type hierarchy of '{0}'." + + + + + A string like "A property cannot be of type '{0}'. The property type must be a ComplexType, a PrimitiveType, or a CollectionType." + + + + + A string like "A property cannot be of type {0}. The property type must be a ComplexType, a PrimitiveType or an EnumType." + + + + + A string like "The specified name must not be longer than 480 characters: '{0}'." + + + + + A string like "The specified name is not allowed: '{0}'." + + + + + A string like "The field {0} must be a string or array type with a maximum length of '{1}'." + + + + + A string like "The field {0} must be a string or array type with a minimum length of '{1}'." + + + + + A string like "No connection string named '{0}' could be found in the application config file." + + + + + A string like "AutomaticMigration" + + + + + A string like "BootstrapMigration" + + + + + A string like "InitialCreate" + + + + + A string like "Automatic migration was not applied because it would result in data loss." + + + + + A string like "[Inserting migration history record]" + + + + + A string like "[Deleting migration history record]" + + + + + A string like "[Updating EdmMetadata model hash]" + + + + + A string like "Running Seed method." + + + + + A string like "No pending code-based migrations." + + + + + A string like "Explicit" + + + + + A string like "Upgrading history table." + + + + + A string like "Cannot scaffold the next migration because the target database was created with a version of Code First earlier than EF 4.3 and does not contain the migrations history table. To start using migrations against this database, ensure the current model is compatible with the target database and execute the migrations Update process. (In Visual Studio you can use the Update-Database command from Package Manager Console to execute the migrations Update process)." + + + + + A string like "Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration." + + + + + A string like "Scripting the downgrade between two specified migrations is not supported." + + + + + A string like "Direct column renaming is not supported by SQL Server Compact. To rename a column in SQL Server Compact, you will need to recreate it." + + + + + A string like "One or more validation errors were detected during model generation:" + + + + + A string like "A circular ComplexType hierarchy was detected. Self-referencing ComplexTypes are not supported." + + + + + A string like "Connection to the database failed. The connection string is configured with an invalid LocalDB server name. This may have been set in 'global.asax' by a pre-release version of MVC4. The default connection factory is now set in web.config so the line in 'global.asax' starting with 'Database.DefaultConnectionFactory = ' should be removed. See http://go.microsoft.com/fwlink/?LinkId=243166 for details." + + + + + A string like "An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct." + + + + + A string like "Setting IsModified to false for a modified property is not supported." + + + + + A string like "An error occurred while saving entities that do not expose foreign key properties for their relationships. The EntityEntries property will return null because a single entity cannot be identified as the source of the exception. Handling of exceptions while saving can be made easier by exposing foreign key properties in your entity types. See the InnerException for details." + + + + + A string like "The set of property value names is read-only." + + + + + A string like "A property of a complex type must be set to an instance of the generic or non-generic DbPropertyValues class for that type." + + + + + A string like "Model compatibility cannot be checked because the DbContext instance was not created using Code First patterns. DbContext instances created from an ObjectContext or using an EDMX file cannot be checked for compatibility." + + + + + A string like "Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions." + + + + + A string like "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations." + + + + + A string like "The context cannot be used while the model is being created." + + + + + A string like "The DbContext class cannot be used with models that have multiple entity sets per type (MEST)." + + + + + A string like "The operation cannot be completed because the DbContext has been disposed." + + + + + A string like "The provider factory returned a null connection." + + + + + A string like "The DbConnectionFactory instance returned a null connection." + + + + + A string like "The number of primary key values passed must match number of primary key values defined on the entity." + + + + + A string like "The type of one of the primary key values did not match the type defined in the entity. See inner exception for details." + + + + + A string like "Multiple entities were found in the Added state that match the given primary key values." + + + + + A string like "Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList()." + + + + + A string like "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties." + + + + + A string like "Cannot initialize a DbContext from an entity connection string or an EntityConnection instance together with a DbCompiledModel. If an entity connection string or EntityConnection instance is used, then the model will be created from the metadata in the connection. If a DbCompiledModel is used, then the connection supplied should be a standard database connection (for example, a SqlConnection instance) rather than an entity connection." + + + + + A string like "Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used." + + + + + A string like "Validation failed for one or more entities. See 'EntityValidationErrors' property for more details." + + + + + A string like "An exception occurred while initializing the database. See the InnerException for details." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing ObjectContext is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing DbCompiledModel is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + A string like "Code generated using the T4 templates for Database First and Model First development may not work correctly if used in Code First mode. To continue using Database First or Model First ensure that the Entity Framework connection string is specified in the config file of executing application. To use these classes, that were generated from Database First or Model First, with Code First add any additional configuration using attributes or the DbModelBuilder API and then remove the code that throws this exception." + + + + + A string like "The generic 'Set' method cannot be called with a proxy type. Either use the actual entity type or call the non-generic 'Set' method." + + + + + A string like "NavigationProperty is not valid. The FromRole and ToRole are the same." + + + + + A string like "OnDelete can be specified on only one End of an EdmAssociation." + + + + + A string like "The number of properties in the Dependent and Principal Roles in a relationship constraint must be identical." + + + + + A string like "The name is missing or not valid." + + + + + A string like "AssociationEnd must not be null." + + + + + A string like "DependentEnd must not be null." + + + + + A string like "DependentProperties must not be empty." + + + + + A string like "Association must not be null." + + + + + A string like "ResultEnd must not be null." + + + + + A string like "EntityType must not be null." + + + + + A string like "ElementType must not be null." + + + + + A string like "ElementType must not be null." + + + + + A string like "SourceSet must not be null." + + + + + A string like "TargetSet must not be null." + + + + + A string like "The type is not a valid EdmTypeReference." + + + + + A string like "Serializer can only serialize an EdmModel that has one EdmNamespace and one EdmEntityContainer." + + + + + A string like "MaxLengthAttribute must have a Length value that is greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + A string like "MinLengthAttribute must have a Length value that is zero or greater." + + + + + A string like "The connection can not be overridden because this context was created from an existing ObjectContext." + + + + + A string like "Can not override the connection for this context with a standard DbConnection because the original connection was an EntityConnection." + + + + + A string like "Can not override the connection for this context with an EntityConnection because the original connection was a standard DbConnection." + + + + + Strongly-typed and parameterized exception factory. + + + + + Migrations.Infrastructure.AutomaticDataLossException with message like "Automatic migration was not applied because it would result in data loss." + + + + + Migrations.Infrastructure.MigrationsException with message like "Cannot scaffold the next migration because the target database was created with a version of Code First earlier than EF 4.3 and does not contain the migrations history table. To start using migrations against this database, ensure the current model is compatible with the target database and execute the migrations Update process. (In Visual Studio you can use the Update-Database command from Package Manager Console to execute the migrations Update process)." + + + + + Migrations.Infrastructure.MigrationsException with message like "The specified target migration '{0}' does not exist. Ensure that target migration refers to an existing migration id." + + + + + Migrations.Infrastructure.MigrationsException with message like "The Foreign Key on table '{0}' with columns '{1}' could not be created because the principal key columns could not be determined. Use the AddForeignKey fluent API to fully specify the Foreign Key." + + + + + Migrations.Infrastructure.MigrationsException with message like "'{0}' is not a valid target migration. When targeting a previously applied automatic migration, use the full migration id including timestamp." + + + + + Migrations.Infrastructure.MigrationsException with message like "'{0}' is not a valid migration. Code-based migrations must be used for both source and target when scripting the upgrade between them." + + + + + Migrations.Infrastructure.MigrationsException with message like "The target context '{0}' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory." + + + + + Migrations.Infrastructure.MigrationsException with message like "The specified migration name '{0}' is ambiguous. Specify the full migration id including timestamp instead." + + + + + Migrations.Infrastructure.AutomaticMigrationsDisabledException with message like "Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration." + + + + + Migrations.Infrastructure.MigrationsException with message like "Scripting the downgrade between two specified migrations is not supported." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' was not be found in the assembly '{1}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one migrations configuration type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the one to use." + + + + + Migrations.Infrastructure.MigrationsException with message like "No migrations configuration type was found in the assembly '{0}'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one migrations configuration type was found in the assembly '{0}'. Specify the name of the one to use." + + + + + Migrations.Infrastructure.MigrationsException with message like "The type '{0}' is not a migrations configuration type." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must have a public default constructor." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must not be abstract." + + + + + Migrations.Infrastructure.MigrationsException with message like "The migrations configuration type '{0}' must not be generic." + + + + + Migrations.Infrastructure.MigrationsException with message like "Direct column renaming is not supported by SQL Server Compact. To rename a column in SQL Server Compact, you will need to recreate it." + + + + + Migrations.Infrastructure.MigrationsException with message like "In VB.NET projects, the migrations namespace '{0}' must be under the root namespace '{1}'. Update the migrations project's root namespace to allow classes under the migrations namespace to be added." + + + + + + Migrations.Infrastructure.MigrationsException with message like "No MigrationSqlGenerator found for provider '{0}'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators." + + + + + Migrations.Infrastructure.MigrationsException with message like "No context type was found in the assembly '{0}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "The context type '{0}' was not found in the assembly '{1}'." + + + + + Migrations.Infrastructure.MigrationsException with message like "More than one context type '{0}' was found in the assembly '{1}'. Specify the fully qualified name of the context." + + + + + ArgumentException with message like "The argument '{0}' cannot be null, empty or contain only white space." + + + + + ArgumentException with message like "The argument property '{0}' cannot be null." + + + + + ArgumentException with message like "The precondition '{0}' failed. {1}" + + + + + InvalidOperationException with message like "The type '{0}' has already been configured as a complex type. It cannot be reconfigured as an entity type." + + + + + InvalidOperationException with message like "The type '{0}' has already been configured as an entity type. It cannot be reconfigured as a complex type." + + + + + InvalidOperationException with message like "The key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + InvalidOperationException with message like "The foreign key component '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property." + + + + + InvalidOperationException with message like "The property '{0}' is not a declared property on type '{1}'. Verify that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property." + + + + + InvalidOperationException with message like "The navigation property '{0}' is not a declared property on type '{1}'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property." + + + + + InvalidOperationException with message like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'." + + + + + InvalidOperationException with message like "The expression '{0}' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. Use dotted paths for nested properties: C#: 't => t.MyProperty.MyProperty' VB.Net: 'Function(t) t.MyProperty.MyProperty'." + + + + + InvalidOperationException with message like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + InvalidOperationException with message like "The properties expression '{0}' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new {{ t.MyProperty1, t.MyProperty2 }}' VB.Net: 'Function(t) New With {{ t.MyProperty1, t.MyProperty2 }}'." + + + + + + InvalidOperationException with message like "Conflicting configuration settings were specified for property '{0}' on type '{1}': {2}" + + + + + InvalidOperationException with message like "Conflicting configuration settings were specified for column '{0}' on table '{1}': {2}" + + + + + InvalidOperationException with message like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from ComplexObject." + + + + + InvalidOperationException with message like "The type '{0}' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' cannot be the inverse of itself." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting foreign keys." + + + + + MappingException with message like "Values of incompatible types ('{1}' and '{2}') were assigned to the '{0}' discriminator column. Values of the same type must be specified. To explicitly specify the type of the discriminator column use the HasColumnType method." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting mapping information." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting cascade delete operations using 'WillCascadeOnDelete'." + + + + + InvalidOperationException with message like "The navigation property '{0}' declared on type '{1}' has been configured with conflicting multiplicities." + + + + + InvalidOperationException with message like "The MaxLengthAttribute on property '{0}' on type '{1} is not valid. The Length value must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "The StringLengthAttribute on property '{0}' on type '{1}' is not valid. The maximum length must be greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "Unable to determine composite primary key ordering for type '{0}'. Use the ColumnAttribute or the HasKey method to specify an order for composite primary keys." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. Name must not be empty." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The foreign key name '{2}' was not found on the dependent type '{3}'. The Name value should be a comma separated list of foreign key property names." + + + + + InvalidOperationException with message like "The ForeignKeyAttribute on property '{0}' on type '{1}' is not valid. The navigation property '{2}' was not found on the dependent type '{1}'. The Name value should be a valid navigation property name." + + + + + InvalidOperationException with message like "Unable to determine a composite foreign key ordering for foreign key on type {0}. When using the ForeignKey data annotation on composite foreign key properties ensure order is specified by using the Column data annotation or the fluent API." + + + + + InvalidOperationException with message like "The InversePropertyAttribute on property '{2}' on type '{3}' is not valid. The property '{0}' is not a valid navigation property on the related type '{1}'. Ensure that the property exists and is a valid reference or collection navigation property." + + + + + InvalidOperationException with message like "A relationship cannot be established from property '{0}' on type '{1}' to property '{0}' on type '{1}'. Check the values in the InversePropertyAttribute to ensure relationship definitions are unique and reference from one navigation property to its corresponding inverse navigation property." + + + + + InvalidOperationException with message like "A key is registered for the derived type '{0}'. Keys can only be registered for the root type '{1}'." + + + + + InvalidOperationException with message like "The type '{0}' has already been mapped to table '{1}'. Specify all mapping aspects of a table in a single Map call." + + + + + InvalidOperationException with message like "Map was called more than once for type '{0}' and at least one of the calls didn't specify the target table name." + + + + + InvalidOperationException with message like "The derived type '{0}' has already been mapped using the chaining syntax. A derived type can only be mapped once using the chaining syntax." + + + + + InvalidOperationException with message like "An "is not null" condition cannot be specified on property '{0}' on type '{1}' because this property is not included in the model. Check that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation." + + + + + ArgumentException with message like "Values of type '{0}' cannot be used as type discriminator values. Supported types include byte, signed byte, bool, int16, int32, int64, and string." + + + + + InvalidOperationException with message like "Unable to add the convention '{0}'. Could not find an existing convention of type '{1}' in the current convention set." + + + + + InvalidOperationException with message like "Not all properties for type '{0}' have been mapped. Either map those properties or explicitly excluded them from the model." + + + + + NotSupportedException with message like "Unable to determine the provider name for connection of type '{0}'." + + + + + ArgumentException with message like "The qualified table name '{0}' contains an invalid schema name. Schema names must have a non-zero length." + + + + + ArgumentException with message like "The qualified table name '{0}' contains an invalid table name. Table names must have a non-zero length." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. Ensure the MapInheritedProperties method is only used during one call to the Map method." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. Ensure the Properties method is used and that repeated calls specify each non-key property only once." + + + + + InvalidOperationException with message like "Properties for type '{0}' can only be mapped once. The non-key property '{1}' is mapped more than once. Ensure the Properties method specifies each non-key property only once." + + + + + InvalidOperationException with message like "The property '{1}' on type '{0}' cannot be mapped because it has been explicitly excluded from the model or it is of a type not supported by the DbModelBuilderVersion being used." + + + + + InvalidOperationException with message like "The entity types '{0}' and '{1}' cannot share table '{2}' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them." + + + + + InvalidOperationException with message like "You cannot use Ignore method on the property '{0}' on type '{1}' because this type inherits from the type '{2}' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type." + + + + + InvalidOperationException with message like "The property '{0}' cannot be used as a key property on the entity '{1}' because the property type is not a valid key type. Only scalar types, string and byte[] are supported key types." + + + + + InvalidOperationException with message like "The specified table '{0}' was not found in the model. Ensure that the table name has been correctly specified." + + + + + InvalidOperationException with message like "The specified association foreign key columns '{0}' are invalid. The number of columns specified must match the number of primary key columns." + + + + + InvalidOperationException with message like "A circular ComplexType hierarchy was detected. Self-referencing ComplexTypes are not supported." + + + + + InvalidOperationException with message like "Unable to determine the principal end of an association between the types '{0}' and '{1}'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." + + + + + InvalidOperationException with message like "The abstract type '{0}' has no mapped descendents and so cannot be mapped. Either remove '{0}' from the model or add one or more types deriving from '{0}' to the model. " + + + + + NotSupportedException with message like "The type '{0}' cannot be mapped as defined because it maps inherited properties from types that use entity splitting or another form of inheritance. Either choose a different inheritance mapping strategy so as to not map inherited properties, or change all types in the hierarchy to map inherited properties and to not use splitting. " + + + + + InvalidOperationException with message like "The table '{0}' was configured but is not used in any mappings. Verify the mapping configuration for '{0}' is correct." + + + + + InvalidOperationException with message like "The configured column orders for the table '{0}' contains duplicates. Ensure the specified column order values are distinct." + + + + + NotSupportedException with message like "The enum or spatial property '{1}' on type '{0}' cannot be mapped. Use DbModelBuilderVersion 'V5_0' or later to map enum or spatial properties." + + + + + InvalidOperationException with message like "Multiple potential primary key properties named '{0}' but differing only by case were found on entity type '{1}'. Configure the primary key explicitly using the HasKey fluent API or the KeyAttribute data annotation." + + + + + InvalidOperationException with message like "Cannot get value for property '{0}' from entity of type '{1}' because the property has no get accessor." + + + + + InvalidOperationException with message like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor." + + + + + + NotSupportedException with message like "Cannot set value for property '{0}' on entity of type '{1}' because the property has no set accessor and is in the '{2}' state." + + + + + InvalidOperationException with message like "Member '{0}' cannot be called for property '{1}' on entity of type '{2}' because the property is not part of the Entity Data Model." + + + + + + ArgumentException with message like "Cannot call the {0} method for an entity of type '{1}' on a DbSet for entities of type '{2}'. Only entities of type '{2}' or derived from type '{2}' can be added, attached, or removed." + + + + + ArgumentException with message like "Cannot call the Create method for the type '{0}' on a DbSet for entities of type '{1}'. Only entities of type '{1}' or derived from type '{1}' can be created." + + + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is a collection navigation property. The Collection method should be used instead of the Reference method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is a reference navigation property. The Reference method should be used instead of the Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a navigation property. The Reference and Collection methods can only be used with navigation properties. Use the Property or ComplexProperty method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a complex property. The ComplexProperty method can only be used with complex properties. Use the Property, Reference or Collection method." + + + + + ArgumentException with message like "The property '{0}' on type '{1}' is not a primitive property, complex property, collection navigation property, or reference navigation property." + + + + + ArgumentException with message like ""The property '{0}' from the property path '{1}' is not a complex property on type '{2}'. Property paths must be composed of complex properties for all except the final property."" + + + + + NotSupportedException with message like "Setting IsModified to false for a modified property is not supported." + + + + + ArgumentException with message like ""The property path '{0}' cannot be used for navigation properties. Property paths can only be used to access primitive or complex properties."" + + + + + ArgumentException with message like "The navigation property '{0}' on entity type '{1}' cannot be used for entities of type '{2}' because it refers to entities of type '{3}'." + + + + + ArgumentException with message like "The generic type argument '{0}' cannot be used with the Member method when accessing the collection navigation property '{1}' on entity type '{2}'. The generic type argument '{3}' must be used instead." + + + + + ArgumentException with message like "The property '{0}' on entity type '{1}' cannot be used for objects of type '{2}' because it is a property for objects of type '{3}'." + + + + + ArgumentException with message like "The expression passed to method {0} must represent a property defined on the type '{1}'." + + + + + InvalidOperationException with message like "{0} cannot be used for entities in the {1} state." + + + + + InvalidOperationException with message like "Cannot set non-nullable property '{0}' of type '{1}' to null on object of type '{2}'." + + + + + InvalidOperationException with message like "The property '{0}' in the entity of type '{1}' is null. Store values cannot be obtained for an entity with a null complex property." + + + + + InvalidOperationException with message like "Cannot assign value of type '{0}' to property '{1}' of type '{2}' in property values for type '{3}'." + + + + + NotSupportedException with message like "The set of property value names is read-only." + + + + + ArgumentException with message like "The '{0}' property does not exist or is not mapped for the type '{1}'." + + + + + ArgumentException with message like "Cannot copy values from DbPropertyValues for type '{0}' into DbPropertyValues for type '{1}'." + + + + + ArgumentException with message like "Cannot copy from property values for object of type '{0}' into property values for object of type '{1}'." + + + + + ArgumentException with message like "A property of a complex type must be set to an instance of the generic or non-generic DbPropertyValues class for that type." + + + + + InvalidOperationException with message like "The value of the complex property '{0}' on entity of type '{1}' is null. Complex properties cannot be set to null and values cannot be set for null complex properties." + + + + + InvalidOperationException with message like "The value of the nested property values property '{0}' on the values for entity of type '{1}' is null. Nested property values cannot be set to null and values cannot be set for null complex properties." + + + + + InvalidOperationException with message like "Cannot set the value of the nested property '{0}' because value of the complex property '{1}' to which it belongs is null." + + + + + InvalidOperationException with message like "Cannot set the original value of the nested property '{0}' because the original value of the complex property '{1}' to which it belongs is null." + + + + + InvalidOperationException with message like "The model backing the '{0}' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)." + + + + + InvalidOperationException with message like "Database '{0}' cannot be created because it already exists." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the DbContext instance was not created using Code First patterns. DbContext instances created from an ObjectContext or using an EDMX file cannot be checked for compatibility." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions." + + + + + NotSupportedException with message like "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations." + + + + + + + InvalidOperationException with message like "Failed to set database initializer of type '{0}' for DbContext type '{1}' specified in the application configuration. See inner exception for details." + + + + + InvalidOperationException with message like "Configuration for DbContext type '{0}' is specified multiple times in the application configuration. Each context can only be configured once." + + + + + InvalidOperationException with message like "Failed to set Database.DefaultConnectionFactory to an instance of the '{0}' type as specified in the application configuration. See inner exception for details." + + + + + InvalidOperationException with message like "The type '{0}' could not be found. The type name must be an assembly-qualified name." + + + + + InvalidOperationException with message like "The context cannot be used while the model is being created." + + + + + InvalidOperationException with message like "The DbContext class cannot be used with models that have multiple entity sets per type (MEST)." + + + + + InvalidOperationException with message like "The operation cannot be completed because the DbContext has been disposed." + + + + + InvalidOperationException with message like "The provider factory returned a null connection." + + + + + InvalidOperationException with message like "The connection string '{0}' in the application's configuration file does not contain the required providerName attribute."" + + + + + InvalidOperationException with message like "The DbConnectionFactory instance returned a null connection." + + + + + ArgumentException with message like "The number of primary key values passed must match number of primary key values defined on the entity." + + + + + ArgumentException with message like "The type of one of the primary key values did not match the type defined in the entity. See inner exception for details." + + + + + InvalidOperationException with message like "The entity found was of type {0} when an entity of type {1} was requested." + + + + + InvalidOperationException with message like "Multiple entities were found in the Added state that match the given primary key values." + + + + + InvalidOperationException with message like "The type '{0}' is mapped as a complex type. The Set method, DbSet objects, and DbEntityEntry objects can only be used with entity types, not complex types." + + + + + InvalidOperationException with message like "The type '{0}' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute." + + + + + InvalidOperationException with message like "The entity type {0} is not part of the model for the current context." + + + + + NotSupportedException with message like "Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList()." + + + + + ArgumentException with message like "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties." + + + + + InvalidOperationException with message like "No connection string named '{0}' could be found in the application config file." + + + + + InvalidOperationException with message like "Cannot initialize a DbContext from an entity connection string or an EntityConnection instance together with a DbCompiledModel. If an entity connection string or EntityConnection instance is used, then the model will be created from the metadata in the connection. If a DbCompiledModel is used, then the connection supplied should be a standard database connection (for example, a SqlConnection instance) rather than an entity connection." + + + + + NotSupportedException with message like "The collection navigation property '{0}' on the entity of type '{1}' cannot be set because the entity type does not define a navigation property with a set accessor." + + + + + NotSupportedException with message like "Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used." + + + + + InvalidOperationException with message like "Multiple object sets per type are not supported. The object sets '{0}' and '{1}' can both contain instances of type '{2}'." + + + + + InvalidOperationException with message like "The context type '{0}' must have a public constructor taking an EntityConnection." + + + + + NotSupportedException with message like "The database name '{0}' is not supported because it is an MDF file name. A full connection string must be provided to attach an MDF file." + + + + + DataException with message like "An exception occurred while initializing the database. See the InnerException for details." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing ObjectContext is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using an existing DbCompiledModel is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + NotSupportedException with message like "Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel." + + + + + InvalidOperationException with message like "The context factory type '{0}' must have a public default constructor." + + + + + InvalidOperationException with message like "The generic 'Set' method cannot be called with a proxy type. Either use the actual entity type or call the non-generic 'Set' method." + + + + + InvalidOperationException with message like "MaxLengthAttribute must have a Length value that is greater than zero. Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length." + + + + + InvalidOperationException with message like "MinLengthAttribute must have a Length value that is zero or greater." + + + + + InvalidOperationException with message like "No connection string named '{0}' could be found in the application config file." + + + + + InvalidOperationException with message like "The connection can not be overridden because this context was created from an existing ObjectContext." + + + + + InvalidOperationException with message like "Can not override the connection for this context with a standard DbConnection because the original connection was an EntityConnection." + + + + + InvalidOperationException with message like "Can not override the connection for this context with an EntityConnection because the original connection was a standard DbConnection." + + + + + The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument. + + + + + The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method. + + + + + The exception that is thrown when the author has yet to implement the logic at this point in the program. This can act as an exception based TODO tag. + + + + + The exception that is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or write to a stream that does not support the invoked functionality. + + + + + AutoGenerated resource class. Usage: + + string s = EntityRes.GetString(EntityRes.MyIdenfitier); + + + + + Allows the construction and modification of a user-specified annotation (name-value pair) on a instance. + + + + + Gets or sets an optional namespace that can be used to distinguish the annotation from others with the same value. + + + + + Gets or sets the name of the annotation. + + + + + Gets or sets the value of the annotation. + + + + + + + + + DataModelEventArgs is the base argument type for all events raised by consumers of Entity Data Model (EDM) models. + + + + + Gets a value indicating the that caused the event to be raised. + + + + + Gets an optional value indicating which property of the source item caused the event to be raised. + + + + + Gets a value that identifies the specific error that is being raised. + + + + + Gets an optional descriptive message the describes the error that is being raised. + + + + + DbAliasedMetadataItem provides the base type for all Database Metadata types that can have an optional that should be used instead of the item's when referring to the item in the database. + + + + + NamedDbItem is the base for all types in the Database Metadata construction and modification API with a property. + + + + + The base for all all Database Metadata types that support annotation using . + + + + + DbDataModelItem is the base for all types in the Database Metadata construction and modification API. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets or sets the currently assigned name. + + + + + Gets an optional alternative identifier that should be used when referring to this item in the database. + + + + + When implemented in derived types, allows the construction and modification of a column in a Database Metadata table or row. + + + + + Gets or sets a string indicating the database-specific type of the column. + + + + + Gets or sets a value indicating whether the column is nullable. + + + + + Gets or sets an optional instance that applies additional constraints to the referenced database-specific type of the column. + + + + + Allows the construction and modification of a database in a Database Metadata model. + + + + + Gets or sets an optional value that indicates the database model version. + + + + + Gets or sets the collection of instances that specifies the schemas within the database. + + + + + Allows the construction and modification of a foreign key constraint sourced by a instance. + + + + + Gets or sets the to take when a delete operation is attempted. + + + + + Indicates which Database Metadata concept is represented by a given item. + + + + + Database Kind + + + + + Schema Kind + + + + + Foreign Key Constraint Kind + + + + + Function Kind + + + + + Function Parameter Kind + + + + + Function Return or Parameter Type Kind + + + + + Row Column Kind + + + + + Table Kind + + + + + Table Column Kind + + + + + Primitive Facets Kind + + + + + Specifies the action to take on a given operation. + + + + + Default behavior + + + + + Restrict the operation + + + + + Cascade the operation + + + + + Allows the construction and modification of additional constraints that can be applied to a specific use of a primitive type in a Database Metadata item. + + + + + Returns true if any facet value property currently has a non-null value; otherwise returns false . + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have a fixed or variable length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have its intrinsic maximum length, rather than a specific value. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to be Unicode or non-Unicode. + + + + + Gets or sets an optional value indicating the current constraint on the type's maximum length. + + + + + Gets or sets an optional value indicating the current constraint on the type's precision. + + + + + Gets or sets an optional value indicating the current constraint on the type's scale. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating whether the spatial type is to be type checked strictly. + + + + + Allows the construction and modification of a database schema in a database model. + + + + + Gets or sets the collection of instances that specifies the tables declared within the schema. + + + + + DbSchemaMetadataItem is the base for all types that can be contained in a schema. + + + + + Allows the construction and modification of a column in a table. + + + + + Gets or sets a value indicating whether the column is part of the table's primary key. + + + + + Gets or sets a value indicating if and how the value of the column is automatically generated. + + + + + Gets or sets an optional value indicating the collation specific to this table column. + + + + + Gets or sets an optional value that specifies the default value for the column. + + + + + Allows the construction and modification a table in a database schema. + + + + + Gets or sets the collection of instances that specifies the columns present within the table. + + + + + Gets or sets the collection of instances from the collection of the table that are part of the primary key. + + + + + Gets or sets the collection of instances that defines the foreign key constraints sourced from the table. + + + + + Represents a specific use of a type in a Database Metadata item. + + + + + Gets or sets an optional instance that applies additional constraints to a referenced primitive type. + + + Accessing this property forces the creation of a DbPrimitiveTypeFacets value if no value has previously been set. Use to determine whether or not this property currently has a value. + + + + + Gets or sets a value indicating whether the represented type is a collection type. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered nullable. + + + + + Gets a value indicating whether the type has been configured as a row type by the addition of one or more RowColumns. + + + + + Represents the mapping of an EDM association end ( ) as a collection of property mappings ( ). + + + + + DbMappingMetadataItem is the base for all types in the EDM-to-Database Mapping construction and modification API that support annotation using . + + + + + DbMappingModelItem is the base for all types in the EDM-to-Database Mapping construction and modification API. + + + + + Gets or sets the currently assigned annotations. + + + + + Gets an value representing the association end that is being mapped. + + + + + Gets the collection of s that specifies how the association end key properties are mapped to the table. + + + + + Gets an value representing the association set that is being mapped. + + + + + Gets a value representing the table to which the entity type's properties are being mapped. + + + + + Gets the collection of s that specifies the constant or null values that columns in must have for this type mapping to apply. + + + + + Allows the construction and modification of a condition for a column in a database table. + + + + + Gets or sets a value representing the table column which must contain for this condition to hold. + + + + + Gets or sets the value that must contain for this condition to hold. + + + + + Gets or sets an value representing the model that is being mapped. + + + + + Gets or sets a value representing the database that is the target of the mapping. + + + + + Gets or sets the collection of s that specifies how the model's entity containers are mapped to the database. + + + + + Represents the mapping of an entity property to a column in a database table. + + + + + Gets or sets the collection of instances that defines the mapped property, beginning from a property declared by the mapped entity type and optionally proceeding through properties of complex property result types. + + + + + Gets or sets a value representing the table column to which the entity property is being mapped. + + + + + Allows the construction and modification of the mapping of an EDM entity container ( ) to a database ( ). + + + + + Gets or sets an value representing the entity container that is being mapped. + + + + + Gets or sets the collection of s that specifies how the container's entity sets are mapped to the database. + + + + + Gets the collection of s that specifies how the container's association sets are mapped to the database. + + + + + Allows the construction and modification of the mapping of an EDM entity set ( ) to a database ( ). + + + + + Gets or sets an value representing the entity set that is being mapped. + + + + + Gets or sets the collection of s that specifies how the set's entity types are mapped to the database. + + + + + Allows the construction and modification of a complete or partial mapping of an EDM entity type ( ) or type hierarchy to a specific database table ( ). + + + + + Gets or sets an value representing the entity type or hierarchy that is being mapped. + + + + + Gets or sets a value indicating whether this type mapping applies to and all its direct or indirect subtypes ( true ), or only to ( false ). + + + + + Gets a value representing the table to which the entity type's properties are being mapped. + + + + + Gets the collection of s that specifies how the type's properties are mapped to the table. + + + + + Gets the collection of s that specifies the constant or null values that columns in must have for this type mapping fragment to apply. + + + + + Indicates which EDM-to-Database Mapping concept is represented by a given item. + + + + + Database Mapping Kind + + + + + Entity Container Mapping Kind + + + + + Entity Set Mapping Kind + + + + + Association Set Mapping Kind + + + + + Entity Type Mapping Kind + + + + + Query View Mapping Kind + + + + + Entity Type Mapping Fragment Kind + + + + + Edm Property Mapping Kind + + + + + Association End Mapping Kind + + + + + Column Condition Kind + + + + + Property Condition Kind + + + + + Allows the construction and modification of a constraint applied to an Entity Data Model (EDM) association. + + + + + Gets or sets the that represents the 'dependent' end of the constraint; properties from this association end's entity type contribute to the collection. + + + + + Gets or sets the collection of instances from the of the constraint. The values of these properties are constrained against the primary key values of the remaining, 'principal' association end's entity type. + + + + + Allows the construction and modification of one end of an Entity Data Model (EDM) association. + + + + + Gets or sets the entity type referenced by this association end. + + + + + Gets or sets the of this association end, which indicates the multiplicity of the end and whether or not it is required. + + + + + Gets or sets the to take when a delete operation is attempted. + + + + + Indicates the multiplicity of an and whether or not it is required. + + + + + Allows the construction and modification of an association set in an Entity Data Model (EDM) ). + + + + + Represents an item in an Entity Data Model (EDM) . + + + + + Gets or sets the that specifies the association type for the set. + + + + + Gets or sets the that specifies the entity set corresponding to the association end for this association set. + + + + + Gets or sets the that specifies the entity set corresponding to the association end for this association set. + + + + + + The base for all all Entity Data Model (EDM) types that represent a structured type from the EDM type system. + + + + + Gets or sets the that defines the source end of the association. + + + + + Gets or sets the that defines the target end of the association. + + + + + Gets or sets the optional constraint that indicates whether the relationship is an independent association (no constraint present) or a foreign key relationship ( specified). + + + + + Collection semantics for properties. + + + + + The property does not have a collection type or does not specify explicit collection semantics. + + + + + The property is an unordered collection that may contain duplicates. + + + + + The property is an ordered collection that may contain duplicates. + + + + + Allows the construction and modification of a complex type in an Entity Data Model (EDM) . + + + + + Gets or sets the optional that indicates the base complex type of the complex type. + + + + + Gets or sets a value indicating whether the complex type is abstract. + + + + + Gets or sets the collection of instances that describe the (scalar or complex) properties of the complex type. + + + + + Concurrency mode for properties. + + + + + Default concurrency mode: the property is never validated at write time + + + + + Fixed concurrency mode: the property is always validated at write time + + + + + Allows the construction and modification of an entity container in an Entity Data Model (EDM) . + + + + + Gets all s declared within the namspace. Includes s and s. + + + + + Gets or sets the collection of s that specifies the association sets within the container. + + + + + Gets or sets the collection of s that specifies the entity sets within the container. + + + + + Allows the construction and modification of an entity set in an Entity Data Model (EDM) . + + + + + Gets or sets the that specifies the entity type for the set. + + + + + Allows the construction and modification of an entity type in an Entity Data Model (EDM) . + + + + + Gets or sets the optional that indicates the base entity type of the entity type. + + + + + Gets or sets a value indicating whether the entity type is abstract. + + + + + Gets or sets the collection of s that specifies the properties declared by the entity type. + + + + + Gets or sets the collection of s that indicates which properties from the collection are part of the entity key. + + + + + Gets or sets the optional collection of s that specifies the navigation properties declared by the entity type. + + + + + Indicates which Entity Data Model (EDM) concept is represented by a given item. + + + + + Association End Kind + + + + + Association Set Kind + + + + + Association Type Kind + + + + + Collection Type Kind + + + + + Complex Type Kind + + + + + Entity Container Kind + + + + + Entity Set Kind + + + + + Entity Type Kind + + + + + Function Group Kind + + + + + Function Overload Kind + + + + + Function Import Kind + + + + + Function Parameter Kind + + + + + Navigation Property Kind + + + + + EdmProperty Type Kind + + + + + Association Constraint Type Kind + + + + + Ref Type Kind + + + + + Row Column Kind + + + + + Row Type Kind + + + + + Type Reference Kind + + + + + Model Kind + + + + + Namespace Kind + + + + + Primitive Facets Kind + + + + + Primitive Type Kind + + + + + Enum Type Kind + + + + + Enum Type Member Kind + + + + + EdmModel is the top-level container for namespaces and entity containers belonging to the same logical Entity Data Model (EDM) model. + + + + + Gets or sets an optional value that indicates the entity model version. + + + + + Gets or sets the containers declared within the model. + + + + + Gets or sets the namespaces declared within the model. + + + + + Allows the construction and modification of a namespace in an . + + + + + Gets all s declared within the namspace. Includes s, s, s. + + + + + Gets or sets the s declared within the namespace. + + + + + Gets or sets the s declared within the namespace. + + + + + Gets or sets the s declared within the namespace. + + + + + Allows the construction and modification of an Entity Data Model (EDM) navigation property. + + + + + Gets or sets the that specifies the association over which navigation takes place. + + + + + Gets or sets the that specifies which association end is the 'destination' end of the navigation and produces the navigation property result. + + + + + Specifies the action to take on a given operation. + + + + + Default behavior + + + + + Restrict the operation + + + + + Cascade the operation + + + + + Represents one of the fixed set of Entity Data Model (EDM) primitive types. + + + + + The base for all all Entity Data Model (EDM) types that represent a scalar type from the EDM type system. + + + + + Retrieves the EdmPrimitiveType instance with the corresponding to the specified value, if any. + + The name of the primitive type instance to retrieve + The EdmPrimitiveType with the specified name, if successful; otherwise null . + true if the given name corresponds to an EDM primitive type name; otherwise false . + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets the EdmPrimitiveType instance that represents the primitive type. + + + + + Gets an value that indicates which Entity Data Model (EDM) primitive type this type represents. + + + + + Allows the construction and modification of additional constraints that can be applied to a specific use of a primitive type in an Entity Data Model (EDM) item. See . + + + + + Returns true if any facet value property currently has a non-null value; otherwise returns false . + + + + + Gets or sets an optional value indicating the current constraint on the type's maximum length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have its intrinsic maximum length, rather than a specific value. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to have a fixed or variable length. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered to be Unicode or non-Unicode. + + + + + Gets or sets an optional value indicating the current constraint on the type's precision. + + + + + Gets or sets an optional value indicating the current constraint on the type's scale. + + + + + Gets or sets an optional value indicating that the current spatial type's SRID is unconstrained. + + + + + Gets or sets an optional value indicating the current spatial type's SRID. + + + + + Gets or sets an optional value indicating whether the spatial type is to be type checked strictly. + + + + + Primitive Types as defined by the Entity Data Model (EDM). + + + + + Binary Type Kind + + + + + Boolean Type Kind + + + + + Byte Type Kind + + + + + DateTime Type Kind + + + + + Decimal Type Kind + + + + + Double Type Kind + + + + + Guid Type Kind + + + + + Single Type Kind + + + + + SByte Type Kind + + + + + Int16 Type Kind + + + + + Int32 Type Kind + + + + + Int64 Type Kind + + + + + String Type Kind + + + + + Time Type Kind + + + + + DateTimeOffset Type Kind + + + + + Geometry Type Kind + + + + + Geography Type Kind + + + + + Geometric point type kind + + + + + Geometric linestring type kind + + + + + Geometric polygon type kind + + + + + Geometric multi-point type kind + + + + + Geometric multi-linestring type kind + + + + + Geometric multi-polygon type kind + + + + + Geometric collection type kind + + + + + Geographic point type kind + + + + + Geographic linestring type kind + + + + + Geographic polygon type kind + + + + + Geographic multi-point type kind + + + + + Geographic multi-linestring type kind + + + + + Geographic multi-polygon type kind + + + + + Geographic collection type kind + + + + + Allows the construction and modification of a primitive- or complex-valued property of an Entity Data Model (EDM) entity or complex type. + + + + + Gets or sets an value that indicates which collection semantics - if any - apply to the property. + + + + + Gets or sets a value that indicates whether the property is used for concurrency validation. + + + + + Gets or sets on optional value that indicates an initial default value for the property. + + + + + Gets or sets an that specifies the result type of the property. + + + + + Enumerates all s declared or inherited by an . + + + + + Allows the construction and modification of a specific use of a type in an Entity Data Model (EDM) item. See for examples. + + + + + Gets or sets a value indicating the collection rank of the type reference. A collection rank greater than zero indicates that the type reference represents a collection of its referenced . + + + + + Gets or sets a value indicating the referenced by this type reference. + + + + + Gets or sets an optional value indicating whether the referenced type should be considered nullable. + + + + + Gets or sets an optional instance that applies additional constraints to a referenced primitive type. + + + Accessing this property forces the creation of an EdmPrimitiveTypeFacets value if no value has previously been set. Use to determine whether or not this property currently has a value. + + + + + Gets a value indicating whether the property of this type reference has been assigned an value with at least one facet value specified. + + + + + Indicates whether this type reference represents a collection of its referenced (when is greater than zero) or not. + + + + + Indicates whether the property of this type reference currently refers to an , is not a collection type, and does not have primitive facet values specified. + + + + + Gets the currently referred to by this type reference, or null if the type reference is a collection type or does not refer to a complex type. + + + + + Indicates whether the property of this type reference currently refers to an and is not a collection type. + + + + + Gets the currently referred to by this type reference, or null if the type reference is a collection type or does not refer to a primitive type. + + + + + Contains constant values that apply to the EDM model, regardless of source (for CSDL specific constants see ). + + + + + Parsing code taken from System.dll's System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(string) method to avoid LinkDemand needed to call this method + + + + + + + + + + + Constants for CSDL XML. + + + + + Constants for C-S MSL XML. + + + + + Constants for SSDL XML. + + + + + The acceptable range for this enum is 0000 - 0999; the range 10,000-15,000 is reserved for tools. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Precision out of range + + + + + Scale out of range + + + + + + + + + + + + + One of the required facets is missing + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The facet isn't allow by the property type. + + + + + This facet value is constant and is specified in the schema + + + + + + + + + + + + + Multiplicity value was malformed + + + + + The value for the Action attribute is invalid or not allowed in the current context + + + + + An error occurred processing the On<Operation> elements + + + + + Ends were given for the Property element of a EntityContainer that is not a RelationshipSet + + + + + The extent name used in the EntittyContainerType End does not match the name of any of the EntityContainerProperties in the containing EntityContainer + + + + + An end element was not given, and cannot be inferred because too many EntityContainerEntitySet elements that are good possibilities. + + + + + An end element was not given, and cannot be inferred because there is no EntityContainerEntitySets that are the correct type to be used as an EntitySet. + + + + + Not a valid parameter direction for the parameter in a function + + + + + Unable to infer an optional schema part, to resolve this; be more explicit + + + + + Invalid facet attribute(s) specified in provider manifest + + + + + Invalid role value in the relationship constraint + + + + + Invalid Property in relationship constraint + + + + + Type mismatch between ToProperty and FromProperty in the relationship constraint + + + + + Invalid multiplicity in FromRole in the relationship constraint + + + + + The number of properties in the FromProperty and ToProperty in the relationship constraint must be identical + + + + + No Properties defined in either FromProperty or ToProperty in the relationship constraint + + + + + Missing constraint in relationship type in ssdl + + + + + Same role referred in the ToRole and FromRole of a referential constraint + + + + + Invalid value for attribute ParameterTypeSemantics + + + + + Invalid type used for a Relationship End Type + + + + + Invalid PrimitiveTypeKind + + + + + Invalid TypeConversion DestinationType + + + + + Expected a integer value between 0 - 255 + + + + + Invalid Type specified in function + + + + + Precision must not be greater than 28 + + + + + Properties that are part of entity key must be of scalar type + + + + + Binary type properties which are part of entity key are currently not supported + + + + + The primitive type kind does not have a preferred mapping + + + + + More than one PreferredMapping for a PrimitiveTypeKind + + + + + End with * multiplicity cannot have operations specified + + + + + EntitySet type has no keys + + + + + InvalidNumberOfParametersForAggregateFunction + + + + + InvalidParameterTypeForAggregateFunction + + + + + Composable functions must declare a return type. + + + + + Non-composable functions must not declare a return type. + + + + + Non-composable functions do not permit the aggregate; niladic; or built-in attributes. + + + + + Composable functions can not include command text attribute. + + + + + Functions should not declare both a store name and command text (only one or the other can be used). + + + + + SystemNamespace + + + + + Empty DefiningQuery text + + + + + Schema, Table and DefiningQuery are all specified, and are mutually exclusive + + + + + ConcurrencyMode value was malformed + + + + + Concurrency can't change for any sub types of an EntitySet type. + + + + + Function import return type must be either empty, a collection of entities, or a singleton scalar. + + + + + Function import specifies a non-existent entity set. + + + + + Function import specifies entity type return but no entity set. + + + + + Function import specifies entity type that does not derive from element type of entity set. + + + + + Function import specifies a binding to an entity set but does not return entities. + + + + + InternalError + + + + + Same Entity Set Taking part in the same role of the relationship set in two different relationship sets + + + + + Entity key refers to the same property twice + + + + + Function declares a ReturnType attribute and element + + + + + Nullable Complex Type not supported in Edm V1 + + + + + Only Complex Collections supported in Edm V1.1 + + + + + No Key defined on Entity Type + + + + + Invalid namespace specified in using element + + + + + Need not specify system namespace in using + + + + + Cannot use a reserved/system namespace as alias + + + + + Invalid qualification specified for type + + + + + Invalid Entity Container Name in extends attribute + + + + + Invalid CollectionKind value in property CollectionKind attribute + + + + + Must specify namespace or alias of the schema in which this type is defined + + + + + Entity Container cannot extend itself + + + + + Failed to retrieve provider manifest + + + + + Mismatched Provider Manifest token values in SSDL artifacts + + + + + Missing Provider Manifest token value in SSDL artifact(s) + + + + + Empty CommandText element + + + + + Inconsistent Provider values in SSDL artifacts + + + + + Inconsistent Provider Manifest token values in SSDL artifacts + + + + + Duplicated Function overloads + + + + + InvalidProvider + + + + + FunctionWithNonEdmTypeNotSupported + + + + + ComplexTypeAsReturnTypeAndDefinedEntitySet + + + + + ComplexTypeAsReturnTypeAndDefinedEntitySet + + + + unused 179, + unused 180, + unused 181, + + In model functions facet attribute is allowed only on ScalarTypes + + + + + Captures several conditions where facets are placed on element where it should not exist. + + + + + Return type has not been declared + + + + + Invalid value in the EnumTypeOption + + + + + The structural annotation cannot use codegen namespaces + + + + + Function and type cannot have the same fully qualified name + + + + + Cannot load different version of schema in the same ItemCollection + + + + + Expected bool value + + + + + End without Multiplicity specified + + + + + In SSDL, if composable function returns a collection of rows (TVF), all row properties must be of scalar types. + + + + + The name of NamedEdmItem must not be empty or white space only + + + + + EdmTypeReference is empty + + Unused 199; + + + + Serializes an that conforms to the restrictions of a single CSDL schema file to an XML writer. The model to be serialized must contain a single and a single . + + + + + Serialize the to the XmlWriter. + + The EdmModel to serialize, mut have only one and one + The XmlWriter to serialize to + + + + Serialize the to the XmlWriter + + The DbModel to serialize + The XmlWriter to serialize to + + + + Serialize the to the + + The DbDatabaseMetadata to serialize + Provider information on the Schema element + ProviderManifestToken information on the Schema element + The XmlWriter to serialize to + + + + + author/email + + + + + author/name + + + + + author/uri + + + + + published + + + + + rights + + + + + summary + + + + + title + + + + + contributor/email + + + + + contributor/name + + + + + contributor/uri + + + + + category/@label + + + + + Plaintext + + + + + HTML + + + + + XHTML + + + + + updated + + + + + link/@href + + + + + link/@rel + + + + + link/@type + + + + + link/@hreflang + + + + + link/@title + + + + + link/@length + + + + + category/@term + + + + + category/@scheme + + + + + Return role name pair + + + + + + + + The context for DataModel Validation + + + + + Returns true if the given two ends are similar - the relationship type that this ends belongs to is the same and the entity set refered by the ends are same and they are from the same role + + + + + + + + Return true if the Referential Constraint on the association is ready for further validation, otherwise return false. + + + + + + + Resolves the given property names to the property in the item Also checks whether the properties form the key for the given type and whether all the properties are nullable or not + + + + + + + + + + + Return true if the namespaceName is a Edm System Namespace + + + + + + + Return true if the entityType is a subtype of any entity type in the dictionary keys, and return the corresponding entry EntitySet value. Otherwise return false. + + + + + + + + + Return true if any of the properties in the EdmEntityType defines ConcurrencyMode. Otherwise return false. + + + + + + + Add member name to the Hash set, raise an error if the name exists already. + + + + + + + + + If the string is null, empty, or only whitespace, return false, otherwise return true + + + + + + + Determine if a cycle exists in the type hierarchy: use two pointers to walk the chain, if one catches up with the other, we have a cycle. + + true if a cycle exists in the type hierarchy, false otherwise + + + + RuleSet for DataModel Validation + + + + + Get the related rules given certain DataModelItem + + The to validate + A collection of + + + + Data Model Validator + + + + + Validate the and all of its properties given certain version. + + The root of the model to be validated + True to validate the syntax, otherwise false + + + + The RuleSet for EdmModel + + + + + Get based on version + + a double value of version + + + + + The context for EdmModel Validation + + + + + Visitor for EdmModel Validation + + + + + Edm Model Validator + + + + + validate the from the root with the context + + The root to validate from + The validation context + + + + An implementation of IDatabaseInitializer that will recreate and optionally re-seed the + database only if the database does not exist. + To seed the database, create a derived class and override the Seed method. + + The type of the context. + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + An instances of this class is obtained from an object and can be used + to manage the actual database backing a DbContext or connection. + This includes creating, deleting, and checking for the existence of a database. + Note that deletion and checking for existence of a database can be performed using just a + connection (i.e. without a full context) by using the static methods of this class. + + + + + Creates a Database backed by the given context. This object can be used to create a database, + check for database existence, and delete a database. + + The context that defines the database connection and model. + + + + Gets or sets the database initialization strategy. The database initialization strategy is called when instance + is initialized from a . The strategy can optionally check for database existence, create a new database, and + seed the database with data. + The default strategy is an instance of . + + The type of the context. + The strategy. + The database creation strategy. + + + + Internal version of SetInitializer that allows the strategy to be locked such that it cannot be replaced + by another call to SetInitializer. This allows strategies set in the app.config to win over strategies set + in code. + + The type of the context. + The strategy. + if set to true then the strategy is locked. + + + + Runs the the registered on this context. + + If "force" is set to true, then the initializer is run regardless of whether or not it + has been run before. This can be useful if a database is deleted while an app is running + and needs to be reinitialized. + + If "force" is set to false, then the initializer is only run if it has not already been + run for this context, model, and connection in this app domain. This method is typically + used when it is necessary to ensure that the database has been created and seeded + before starting some operation where doing so lazily will cause issues, such as when the + operation is part of a transaction. + + if set to true the initializer is run even if it has already been run. + + + + Checks whether or not the database is compatible with the the current Code First model. + + + Model compatibility currently uses the following rules. + + If the context was created using either the Model First or Database First approach then the + model is assumed to be compatible with the database and this method returns true. + + For Code First the model is considered compatible if the model is stored in the database + in the Migrations history table and that model has no differences from the current model as + determined by Migrations model differ. + + If the model is not stored in the database but an EF 4.1/4.2 model hash is found instead, + then this is used to check for compatibility. + + + If set to true then an exception will be thrown if no model metadata is found in + the database. If set to false then this method will return true if metadata + is not found. + + True if the model hash in the context and the database match; false otherwise. + + + + + Creates a new database on the database server for the model defined in the backing context. + Note that calling this method before the database initialization strategy has run will disable + executing that strategy. + + + + + Creates a new database on the database server for the model defined in the backing context, but only + if a database with the same name does not already exist on the server. + + True if the database did not exist and was created; false otherwise. + + + + Checks whether or not the database exists on the server. + + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + Calling this method from outside of an initializer will mark the database as having + not been initialized. This means that if an attempt is made to use the database again + after it has been deleted, then any initializer set will run again and, usually, will + try to create the database again automatically. + + True if the database did exist and was deleted; false otherwise. + + + + Checks whether or not the database exists on the server. + The connection to the database is created using the given database name or connection string + in the same way as is described in the documentation for the class. + + The database name or a connection string to the database. + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + The connection to the database is created using the given database name or connection string + in the same way as is described in the documentation for the class. + + The database name or a connection string to the database. + True if the database did exist and was deleted; false otherwise. + + + + Checks whether or not the database exists on the server. + + An existing connection to the database. + True if the database exists; false otherwise. + + + + Deletes the database on the database server if it exists, otherwise does nothing. + + An existing connection to the database. + True if the database did exist and was deleted; false otherwise. + + + + Resets the DefaultConnectionFactory to its initial value. + Currently, this method is only used by test code. + + + + + Performs the operation defined by the given delegate using the given lazy connection, ensuring + that the lazy connection is disposed after use. + + Information used to create a DbConnection. + The operation to perform. + The return value of the operation. + + + + Performs the operation defined by the given delegate against a connection. The connection + is either the connection accessed from the context backing this object, or is obtained from + the connection information passed to one of the static methods. + + The connection to use. + The operation to perform. + The return value of the operation. + + + + Returns an empty ObjectContext that can be used to perform delete/exists operations. + + The connection for which to create an ObjectContext + The empty context. + + + + Creates a raw SQL query that will return elements of the given generic type. + The type can be any type that has properties that match the names of the columns returned + from the query, or can be a simple primitive type. The type does not have to be an + entity type. The results of this query are never tracked by the context even if the + type of object returned is an entity type. Use the + method to return entities that are tracked by the context. + + The type of object returned by the query. + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Creates a raw SQL query that will return elements of the given type. + The type can be any type that has properties that match the names of the columns returned + from the query, or can be a simple primitive type. The type does not have to be an + entity type. The results of this query are never tracked by the context even if the + type of object returned is an entity type. Use the + method to return entities that are tracked by the context. + + The type of object returned by the query. + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Executes the given DDL/DML command against the database. + + The command string. + The parameters to apply to the command string. + The result returned by the database after executing the command. + + + + Returns the connection being used by this context. This may cause the + connection to be created if it does not already exist. + + Thrown if the context has been disposed. + + + + Returns the as a delegate that can be called with + an instance of the that owns this Database object, or returns null if + there is no initializer set for this context type. + + The initializer delegate or null. + + + + The connection factory to use when creating a from just + a database name or a connection string. + + + This is used when just a database name or connection string is given to or when + the no database name or connection is given to DbContext in which case the name of + the context class is passed to this factory in order to generate a DbConnection. + By default, the instance to use is read from the applications .config + file from the "EntityFramework DefaultConnectionFactory" entry in appSettings. If no entry is found in + the config file then is used. Setting this property in code + always overrides whatever value is found in the config file. + + + + + Checks wether or not the DefaultConnectionFactory has been set to something other than its default value. + + + + + + + Common code for generic and non-generic string Include. + + + + + + Returns a new query where the entities returned will not be cached in the + or . This method works by calling the AsNoTracking method of the + underlying query object. If the underlying query object does not have a AsNoTracking method, + then calling this method will have no affect. + + The element type. + The source query. + A new query with NoTracking applied, or the source query if NoTracking is not supported. + + + + Returns a new query where the entities returned will not be cached in the + or . This method works by calling the AsNoTracking method of the + underlying query object. If the underlying query object does not have a AsNoTracking method, + then calling this method will have no affect. + + The source query. + A new query with NoTracking applied, or the source query if NoTracking is not supported. + + + + Common code for generic and non-generic AsNoTracking. + + + + + Enumerates the query such that for server queries such as those of , , + , and others the results of the query will be loaded into the associated , + or other cache on the client. + This is equivalent to calling ToList and then throwing away the list without the overhead of actually creating the list. + + The source query. + + + + Returns an implementation that stays in sync with the given . + + The element type. + The collection that the binding list will stay in sync with. + The binding list. + + + + DbModelBuilder is used to map CLR classes to a database schema. + This code centric approach to building an Entity Data Model (EDM) model is known as 'Code First'. + + + DbModelBuilder is typically used to configure a model by overriding . + You can also use DbModelBuilder independently of DbContext to build a model and then construct a + or . + The recommended approach, however, is to use OnModelCreating in as + the workflow is more intuitive and takes care of common tasks, such as caching the created model. + + Types that form your model are registered with DbModelBuilder and optional configuration can be + performed by applying data annotations to your classes and/or using the fluent style DbModelBuilder + API. + + When the Build method is called a set of conventions are run to discover the initial model. + These conventions will automatically discover aspects of the model, such as primary keys, and + will also process any data annotations that were specified on your classes. Finally + any configuration that was performed using the DbModelBuilder API is applied. + + Configuration done via the DbModelBuilder API takes precedence over data annotations which + in turn take precedence over the default conventions. + + + + + Initializes a new instance of the class. + + The process of discovering the initial model will use the set of conventions included + in the most recent version of the Entity Framework installed on your machine. + + + Upgrading to newer versions of the Entity Framework may cause breaking changes + in your application because new conventions may cause the initial model to be + configured differently. There is an alternate constructor that allows a specific + version of conventions to be specified. + + + + + Initializes a new instance of the class that will use + a specific set of conventions to discover the initial model. + + The version of conventions to be used. + + + + Excludes a type from the model. This is used to remove types from the model that were added + by convention during initial model discovery. + + The type to be excluded. + The same DbModelBuilder instance so that multiple calls can be chained. + + + + Excludes a type(s) from the model. This is used to remove types from the model that were added + by convention during initial model discovery. + + The types to be excluded from the model. + The same DbModelBuilder instance so that multiple calls can be chained. + + + + Registers an entity type as part of the model and returns an object that can be used to + configure the entity. This method can be called multiple times for the same entity to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified entity type. + + + + Registers a type as an entity in the model and returns an object that can be used to + configure the entity. This method can be called multiple times for the same type to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified entity type. + + + + Registers a type as a complex type in the model and returns an object that can be used to + configure the complex type. This method can be called multiple times for the same type to + perform multiple lines of configuration. + + The type to be registered or configured. + The configuration object for the specified complex type. + + + + Creates a based on the configuration performed using this builder. + The connection is used to determine the database provider being used as this + affects the database layer of the generated model. + + Connection to use to determine provider information. + The model that was built. + + + + Creates a based on the configuration performed using this builder. + Provider information must be specified because this affects the database layer of the generated model. + For SqlClient the invariant name is 'System.Data.SqlClient' and the manifest token is the version year (i.e. '2005', '2008' etc.) + + The database provider that the model will be used with. + The model that was built. + + + + Provides access to the settings of this DbModelBuilder that deal with conventions. + + + + + Gets the for this DbModelBuilder. + The registrar allows derived entity and complex type configurations to be registered with this builder. + + + + + A value from this enumeration can be provided directly to the + class or can be used in the applied to + a class derived from . The value used defines which version of + the DbContext and DbModelBuilder conventions should be used when building a model from + code--also know as "Code First". + + + Using DbModelBuilderVersion.Latest ensures that all the latest functionality is available + when upgrading to a new release of the Entity Framework. However, it may result in an + application behaving differently with the new release than it did with a previous release. + This can be avoided by using a specific version of the conventions, but if a version + other than the latest is set then not all the latest functionality will be available. + + + + + Indicates that the latest version of the and + conventions should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 4.1 + through 4.3 should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 5.0 + when targeting .NET 4 should be used. + + + + + Indicates that the version of the and + conventions shipped with Entity Framework 5.0 + when targeting .NET 4.5 should be used. + + + + + This attribute can be applied to a class derived from to set which + version of the DbContext and conventions should be used when building + a model from code--also know as "Code First". See the + enumeration for details about DbModelBuilder versions. + + + If the attribute is missing from DbContextthen DbContext will always use the latest + version of the conventions. This is equivalent to using DbModelBuilderVersion.Latest. + + + + + Initializes a new instance of the class. + + The conventions version to use. + + + + Gets the conventions version. + + The conventions version. + + + + A non-generic version of which can be used when the type of entity + is not known at build time. + + + + + Represents a non-generic LINQ to Entities query against a DbContext. + + + + + An internal interface implemented by and that allows access to + the internal query without using reflection. + + + + + The underlying internal set. + + + + + Internal constructor prevents external classes deriving from DbQuery. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + Instead populate a DbSet with data, for example by using the Load extension method, and + then bind to local data. For WPF bind to DbSet.Local. For Windows Forms bind to + DbSet.Local.ToBindingList(). + + + Never returns; always throws. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Returns the equivalent generic object. + + The type of element for which the query was created. + The generic set object. + + + + Returns a representation of the underlying query. + + + The query string. + + + + + Returns false. + + false. + + + + The IQueryable element type. + + + + + The IQueryable LINQ Expression. + + + + + The IQueryable provider. + + + + + Gets the underlying internal query object. + + The internal query. + + + + The internal query object that is backing this DbQuery + + + + + An internal interface implemented by and that allows access to + the internal set without using reflection. + + + + + The underlying internal set. + + + + + Internal constructor prevents external classes deriving from DbSet. + + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Returns the equivalent generic object. + + The type of entity for which the set was created. + The generic set object. + + + + Creates a raw SQL query that will return entities in this set. By default, the + entities returned are tracked by the context; this can be changed by calling + AsNoTracking on the returned. + Note that the entities returned are always of the type for this set and never of + a derived type. If the table or tables queried may contain data for other entity + types, then the SQL query must be written appropriately to ensure that only entities of + the correct type are returned. + + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + The internal IQueryable that is backing this DbQuery + + + + + Gets the underlying internal set. + + The internal set. + + + + A DbSet represents the collection of all entities in the context, or that can be queried from the + database, of a given type. DbSet objects are created from a DbContext using the DbContext.Set method. + + + Note that DbSet does not support MEST (Multiple Entity Sets per Type) meaning that there is always a + one-to-one correlation between a type and a set. + + The type that defines the set. + + + + Represents a LINQ to Entities query against a DbContext. + + The type of entity to query for. + + + + Creates a new query that will be backed by the given internal query object. + + The backing query. + + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Throws an exception indicating that binding directly to a store query is not supported. + Instead populate a DbSet with data, for example by using the Load extension method, and + then bind to local data. For WPF bind to DbSet.Local. For Windows Forms bind to + DbSet.Local.ToBindingList(). + + + Never returns; always throws. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Returns a representation of the underlying query. + + + The query string. + + + + + Returns a new instance of the non-generic class for this query. + + A non-generic version. + + + + Returns false. + + false. + + + + The IQueryable element type. + + + + + The IQueryable LINQ Expression. + + + + + The IQueryable provider. + + + + + The internal query object that is backing this DbQuery + + + + + The internal query object that is backing this DbQuery + + + + + An IDbSet represents the collection of all entities in the context, or that can be queried from the + database, of a given type. DbSet is a concrete implementation of IDbSet. + + The type that defines the set. + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + Creates a new set that will be backed by the given . + + The internal set. + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + The entity to attach. + The entity. + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + The entity to add. + The entity. + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + The entity to remove. + The entity. + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Returns the equivalent non-generic object. + + The non-generic set object. + + + + Creates a raw SQL query that will return entities in this set. By default, the + entities returned are tracked by the context; this can be changed by calling + AsNoTracking on the returned. + Note that the entities returned are always of the type for this set and never of + a derived type. If the table or tables queried may contain data for other entity + types, then the SQL query must be written appropriately to ensure that only entities of + the correct type are returned. + + The SQL query string. + The parameters to apply to the SQL query string. + A object that will execute the query when it is enumerated. + + + + Gets an that represents a local view of all Added, Unchanged, + and Modified entities in this set. This local view will stay in sync as entities are added or + removed from the context. Likewise, entities added to or removed from the local view will automatically + be added to or removed from the context. + + + This property can be used for data binding by populating the set with data, for example by using the Load + extension method, and then binding to the local data through this property. For WPF bind to this property + directly. For Windows Forms bind to the result of calling ToBindingList on this property + + The local view. + + + + The internal IQueryable that is backing this DbQuery + + + + + An implementation of IDatabaseInitializer that will always recreate and optionally re-seed the + database the first time that a context is used in the app domain. + To seed the database, create a derived class and override the Seed method. + + The type of the context. + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + An implementation of IDatabaseInitializer that will DELETE, recreate, and optionally re-seed the + database only if the model has changed since the database was created. + + + Whether or not the model has changed is determined by the + method. + To seed the database create a derived class and override the Seed method. + + + + + Executes the strategy to initialize the database for the given context. + + The context. + + + + A that should be overridden to actually add data to the context for seeding. + The default implementation does nothing. + + The context to seed. + + + + Returned by the ChangeTracker method of to provide access to features of + the context that are related to change tracking of entities. + + + + + Initializes a new instance of the class. + + The internal context. + + + + Gets objects for all the entities tracked by this context. + + The entries. + + + + Gets objects for all the entities of the given type + tracked by this context. + + The type of the entity. + The entries. + + + + Detects changes made to the properties and relationships of POCO entities. Note that some types of + entity (such as change tracking proxies and entities that derive from ) + report changes automatically and a call to DetectChanges is not normally needed for these types of entities. + Also note that normally DetectChanges is called automatically by many of the methods of + and its related classes such that it is rare that this method will need to be called explicitly. + However, it may be desirable, usually for performance reasons, to turn off this automatic calling of + DetectChanges using the AutoDetectChangesEnabled flag from . + + + + + A non-generic version of the class. + + + + + This is an abstract base class use to represent a scalar or complex property, or a navigation property + of an entity. Scalar and complex properties use the derived class , + reference navigation properties use the derived class , and collection + navigation properties use the derived class . + + + + + Creates a from information in the given . + This method will create an instance of the appropriate subclass depending on the metadata contained + in the InternalMemberEntry instance. + + The internal member entry. + The new entry. + + + + Validates this property. + + + Collection of objects. Never null. If the entity is valid the collection will be empty. + + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the name of the property. + + The property name. + + + + Gets or sets the current value of this property. + + The current value. + + + + The to which this member belongs. + + An entry for the entity that owns this member. + + + + Gets the backing this object. + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal collection entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the collection of entities from the database. + Note that entities that already exist in the context are not overwritten with values from the database. + + + + + Returns the query that would be used to load this collection from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database, such + as counting the number of entities in the collection in the database without actually loading them. + + A query for the collection. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the collection element. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the collection of entities has been loaded from the database. + + true if the collection is loaded; otherwise, false. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Gets the backing this object as an . + + The internal member entry. + + + + Instances of this class are returned from the Collection method of + and allow operations such as loading to + be performed on the an entity's collection navigation properties. + + The type of the entity to which this property belongs. + The type of the element in the collection of entities. + + + + This is an abstract base class use to represent a scalar or complex property, or a navigation property + of an entity. Scalar and complex properties use the derived class , + reference navigation properties use the derived class , and collection + navigation properties use the derived class . + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + This method will create an instance of the appropriate subclass depending on the metadata contained + in the InternalMemberEntry instance. + + The internal member entry. + The new entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Validates this property. + + + Collection of objects. Never null. If the entity is valid the collection will be empty. + + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets the underlying . + + The internal member entry. + + + + The to which this member belongs. + + An entry for the entity that owns this member. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal collection entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the collection of entities from the database. + Note that entities that already exist in the context are not overwritten with values from the database. + + + + + Returns the query that would be used to load this collection from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database, such + as counting the number of entities in the collection in the database without actually loading them. + + A query for the collection. + + + + Returns a new instance of the non-generic class for + the navigation property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the collection of entities has been loaded from the database. + + true if the collection is loaded; otherwise, false. + + + + Gets the underlying as an . + + The internal member entry. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + An immutable representation of an Entity Data Model (EDM) model that can be used to create an + or can be passed to the constructor of a . + For increased performance, instances of this type should be cached and re-used to construct contexts. + + + + + For mocking. + + + + + Creates a model for the given EDM metadata model. + + The EDM metadata model. + + + + Creates an instance of ObjectContext or class derived from ObjectContext. Note that an instance + of DbContext can be created instead by using the appropriate DbContext constructor. + If a derived ObjectContext is used, then it must have a public constructor with a single + EntityConnection parameter. + The connection passed is used by the ObjectContext created, but is not owned by the context. The caller + must dispose of the connection once the context has been disposed. + + The type of context to create. + An existing connection to a database for use by the context. + + + + + Gets a cached delegate (or creates a new one) used to call the constructor for the given derived ObjectContext type. + + + + + A snapshot of the that was used to create this compiled model. + + + + + The provider info (provider name and manifest token) that was used to create this model. + + + + + A non-generic version of the class. + + + + + A non-generic version of the class. + + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the original value of this property. + + The original value. + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets or sets a value indicating whether the value of this property has been modified since + it was loaded from the database. + + + true if this instance is modified; otherwise, false. + + + + + The to which this property belongs. + + An entry for the entity that owns this property. + + + + The of the property for which this is a nested property. + This method will only return a non-null entry for properties of complex objects; it will + return null for properties of the entity itself. + + An entry for the parent complex property, or null if this is an entity property. + + + + Gets the backing this object. + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The name of the nested property. + An object representing the nested property. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the complex property. + The equivalent generic object. + + + + Instances of this class are returned from the ComplexProperty method of + and allow access to the state of a complex property. + + The type of the entity to which this property belongs. + The type of the property. + + + + Instances of this class are returned from the Property method of + and allow access to the state of the scalar + or complex property. + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the original value of this property. + + The original value. + + + + Gets or sets the current value of this property. + + The current value. + + + + Gets or sets a value indicating whether the value of this property has been modified since + it was loaded from the database. + + + true if this instance is modified; otherwise, false. + + + + + The to which this property belongs. + + An entry for the entity that owns this property. + + + + The of the property for which this is a nested property. + This method will only return a non-null entry for properties of complex objects; it will + return null for properties of the entity itself. + + An entry for the parent complex property, or null if this is an entity property. + + + + Gets the underlying as an . + + The internal member entry. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal property entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Returns a new instance of the non-generic class for + the property represented by this object. + + A non-generic version. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The type of the nested property. + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested property of this property. + This method can be used for both scalar or complex properties. + + The type of the nested property. + An expression representing the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The type of the nested property. + The name of the nested property. + An object representing the nested property. + + + + Gets an object that represents a nested complex property of this property. + + The type of the nested property. + An expression representing the nested property. + An object representing the nested property. + + + + Describes the origin of the database connection string associated with a . + + + + + The connection string was created by convention. + + + + + The connection string was read from external configuration. + + + + + The connection string was explicitly specified at runtime. + + + + + The connection string was overriden by connection information supplied to DbContextInfo. + + + + + Returned by the Configuration method of to provide access to configuration + options for the context. + + + + + Initializes a new instance of the class. + + The internal context. + + + + Gets or sets a value indicating whether lazy loading of relationships exposed as + navigation properties is enabled. Lazy loading is enabled by default. + + true if lazy loading is enabled; otherwise, false. + + + + Gets or sets a value indicating whether or not the framework will create instances of + dynamically generated proxy classes whenever it creates an instance of an entity type. + Note that even if proxy creation is enabled with this flag, proxy instances will only + be created for entity types that meet the requirements for being proxied. + Proxy creation is enabled by default. + + true if proxy creation is enabled; otherwise, false. + + + + + Gets or sets a value indicating whether tracked entities should be validated automatically when + is invoked. + The default value is true. + + + + + Provides runtime information about a given type. + + + + + Creates a new instance representing a given type. + + The type deriving from . + + + + Creates a new instance representing a given targeting a specific database. + + The type deriving from . + Connection information for the database to be used. + + + + Creates a new instance representing a given type. An external list of + connection strings can be supplied and will be used during connection string resolution in place + of any connection strings specified in external configuration files. + + + It is preferable to use the constructor that accepts the entire config document instead of using this + constructor. Providing the entire config document allows DefaultConnectionFactroy entries in the config + to be found in addition to explicitly specified connection strings. + + The type deriving from . + A collection of connection strings. + + + + Creates a new instance representing a given type. An external config + object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + + The type deriving from . + An object representing the config file. + + + + Creates a new instance representing a given , targeting a specific database. + An external config object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + + The type deriving from . + An object representing the config file. + Connection information for the database to be used. + + + + Creates a new instance representing a given type. A + can be supplied in order to override the default determined provider used when constructing + the underlying EDM model. + + The type deriving from . + A specifying the underlying ADO.NET provider to target. + + + + Creates a new instance representing a given type. An external config + object (e.g. app.config or web.config) can be supplied and will be used during connection string + resolution. This includes looking for connection strings and DefaultConnectionFactory entries. + A can be supplied in order to override the default determined + provider used when constructing the underlying EDM model. This can be useful to prevent EF from + connecting to discover a manifest token. + + The type deriving from . + An object representing the config file. + A specifying the underlying ADO.NET provider to target. + + + + Called internally when a context info is needed for an existing context, which may not be constructable. + + The context instance to get info from. + + + + If instances of the underlying type can be created, returns + a new instance; otherwise returns null. + + A instance. + + + + The concrete type. + + + + + Whether or not instances of the underlying type can be created. + + + + + The connection string used by the underlying type. + + + + + The connection string name used by the underlying type. + + + + + The ADO.NET provider name of the connection used by the underlying type. + + + + + The origin of the connection string used by the underlying type. + + + + + An action to be run on the DbModelBuilder after OnModelCreating has been run on the context. + + + + + A non-generic version of the class. + + + + + Initializes a new instance of the class. + + The internal entry. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + Note that changing the values in the returned dictionary will not update the values in the database. + If the entity is not found in the database then null is returned. + + The store values. + + + + Reloads the entity from the database overwriting any property values with values from the database. + The entity will be in the Unchanged state after calling this method. + + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The name of the property. + An object representing the property. + + + + Gets an object that represents a complex property of this entity. + + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The name of the member. + An object representing the member. + + + + Returns a new instance of the generic class for the given + generic type for the tracked entity represented by this object. + Note that the type of the tracked entity must be compatible with the generic type or + an exception will be thrown. + + The type of the entity. + A generic version. + + + + Validates this instance and returns validation result. + + + Entity validation result. Possibly null if + method is overridden. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the entity. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + + The original values. + + + + Gets InternalEntityEntry object for this DbEntityEntry instance. + + + + + Instances of this class provide access to information about and control of entities that + are being tracked by the . Use the Entity or Entities methods of + the context to obtain objects of this type. + + The type of the entity. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + Note that changing the values in the returned dictionary will not update the values in the database. + If the entity is not found in the database then null is returned. + + The store values. + + + + Reloads the entity from the database overwriting any property values with values from the database. + The entity will be in the Unchanged state after calling this method. + + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The type of the property. + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the reference (i.e. non-collection) navigation property from this + entity to another entity. + + The type of the property. + An expression representing the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The type of elements in the collection. + The name of the navigation property. + An object representing the navigation property. + + + + Gets an object that represents the collection navigation property from this + entity to a collection of related entities. + + The type of elements in the collection. + An expression representing the navigation property. + An object representing the navigation property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The name of the property. + An object representing the property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The type of the property. + The name of the property. + An object representing the property. + + + + Gets an object that represents a scalar or complex property of this entity. + + The type of the property. + An expression representing the property. + An object representing the property. + + + + Gets an object that represents a complex property of this entity. + + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a complex property of this entity. + + The type of the complex property. + The name of the complex property. + An object representing the complex property. + + + + Gets an object that represents a complex property of this entity. + + The type of the complex property. + An expression representing the complex property. + An object representing the complex property. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The name of the member. + An object representing the member. + + + + Gets an object that represents a member of the entity. The runtime type of the returned object will + vary depending on what kind of member is asked for. The currently supported member types and their return + types are: + Reference navigation property: . + Collection navigation property: . + Primitive/scalar property: . + Complex property: . + + The type of the member. + The name of the member. + An object representing the member. + + + + Returns a new instance of the non-generic class for + the tracked entity represented by this object. + + A non-generic version. + + + + Validates this instance and returns validation result. + + + Entity validation result. Possibly null if + method is overridden. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the entity. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + + The original values. + + + + Represents an Entity Data Model (EDM) created by the . + The Compile method can be used to go from this EDM representation to a + which is a compiled snapshot of the model suitable for caching and creation of + or instances. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + Creates a for this mode which is a compiled snapshot + suitable for caching and creation of instances. + + The compiled model. + + + + A snapshot of the that was used to create this compiled model. + + + + + A collection of all the properties for an underlying entity or complex object. + + + An instance of this class can be converted to an instance of the generic class + using the Cast method. + Complex properties in the underlying entity or complex object are represented in + the property values as nested instances of this class. + + + + + Initializes a new instance of the class. + + The internal dictionary. + + + + Creates an object of the underlying type for this dictionary and hydrates it with property + values from this dictionary. + + The properties of this dictionary copied into a new object. + + + + Sets the values of this dictionary by reading values out of the given object. + The given object can be of any type. Any property on the object with a name that + matches a property name in the dictionary and can be read will be read. Other + properties will be ignored. This allows, for example, copying of properties from + simple Data Transfer Objects (DTOs). + + The object to read values from. + + + + Creates a new dictionary containing copies of all the properties in this dictionary. + Changes made to the new dictionary will not be reflected in this dictionary and vice versa. + + A clone of this dictionary. + + + + Sets the values of this dictionary by reading values from another dictionary. + The other dictionary must be based on the same type as this dictionary, or a type derived + from the type for this dictionary. + + The dictionary to read values from. + + + + Gets the value of the property just like using the indexed property getter but + typed to the type of the generic parameter. This is useful especially with + nested dictionaries to avoid writing expressions with lots of casts. + + The type of the property. + Name of the property. + The value of the property. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + Gets or sets the value of the property with the specified property name. + The value may be a nested instance of this class. + + The property name. + The value of the property. + + + + Gets the internal dictionary. + + The internal dictionary. + + + + A non-generic version of the class. + + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal reference entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the entity from the database. + Note that if the entity already exists in the context, then it will not overwritten with values from the database. + + + + + Returns the query that would be used to load this entity from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database. + + A query for the entity. + + + + Returns the equivalent generic object. + + The type of entity on which the member is declared. + The type of the property. + The equivalent generic object. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the entity has been loaded from the database. + + true if the entity is loaded; otherwise, false. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Gets the backing this object as an . + + The internal member entry. + + + + Instances of this class are returned from the Reference method of + and allow operations such as loading to + be performed on the an entity's reference navigation properties. + + The type of the entity to which this property belongs. + The type of the property. + + + + Creates a from information in the given . + Use this method in preference to the constructor since it may potentially create a subclass depending on + the type of member represented by the InternalCollectionEntry instance. + + The internal reference entry. + The new entry. + + + + Initializes a new instance of the class. + + The internal entry. + + + + Loads the entity from the database. + Note that if the entity already exists in the context, then it will not overwritten with values from the database. + + + + + Returns the query that would be used to load this entity from the database. + The returned query can be modified using LINQ to perform filtering or operations in the database. + + A query for the entity. + + + + Returns a new instance of the non-generic class for + the navigation property represented by this object. + + A non-generic version. + + + + Gets the property name. + + The property name. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references. + + The current value. + + + + Gets a value indicating whether the entity has been loaded from the database. + + true if the entity is loaded; otherwise, false. + + + + Gets the underlying as an . + + The internal member entry. + + + + The to which this navigation property belongs. + + An entry for the entity that owns this navigation property. + + + + Represents a SQL query for entities that is created from a + and is executed using the connection from that context. + Instances of this class are obtained from the instance for the + entity type. The query is not executed when this object is created; it is executed + each time it is enumerated, for example by using foreach. + SQL queries for non-entities are created using the . + See for a generic version of this class. + + + + + Initializes a new instance of the class. + + The internal query. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a new query where the results of the query will not be tracked by the associated + . + + A new query with no-tracking applied. + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Gets the internal query. + + The internal query. + + + + Returns false. + + false. + + + + Represents a SQL query for entities that is created from a + and is executed using the connection from that context. + Instances of this class are obtained from the instance for the + entity type. The query is not executed when this object is created; it is executed + each time it is enumerated, for example by using foreach. + SQL queries for non-entities are created using the . + See for a non-generic version of this class. + + + + + Executes the query and returns an enumerator for the elements. + + An + + object that can be used to iterate through the elements. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a new query where the results of the query will not be tracked by the associated + . + + A new query with no-tracking applied. + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Gets the internal query. + + The internal query. + + + + Returns false. + + false. + + + + Exception thrown by when it was expected that SaveChanges for an entity would + result in a database update but in fact no rows in the database were affected. This usually indicates + that the database has been concurrently updated such that a concurrency token that was expected to match + did not actually match. + Note that state entries referenced by this exception are not serialized due to security and accesses to + the state entries after serialization will return null. + + + + + + Initializes a new instance of the class. + + The internal context. + The inner exception. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Subscribes the SerializeObjectState event. + + + + + Gets objects that represents the entities that could not + be saved to the database. + + The entries representing the entities that could not be saved. + + + + Holds exception state that will be serialized when the exception is serialized. + + + + + Completes the deserialization. + + The deserialized object. + + + + Gets or sets a value indicating whether the exception involved independent associations. + + + + + Initializes a new instance of the class. + + The context. + The inner exception. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Represents an entity used to store metadata about an EDM in the database. + + + + + Attempts to get the model hash calculated by Code First for the given context. + This method will return null if the context is not being used in Code First mode. + + The context. + The hash string. + + + + Gets or sets the ID of the metadata entity, which is currently always 1. + + The id. + + + + Gets or sets the model hash which is used to check whether the model has + changed since the database was created from it. + + The model hash. + + + + Contains methods used to access the Entity Data Model created by Code First in the EDMX form. + These methods are typically used for debugging when there is a need to look at the model that + Code First creates internally. + + + + + Uses Code First with the given context and writes the resulting Entity Data Model to the given + writer in EDMX form. This method can only be used with context instances that use Code First + and create the model internally. The method cannot be used for contexts created using Database + First or Model First, for contexts created using a pre-existing , or + for contexts created using a pre-existing . + + The context. + The writer. + + + + Writes the Entity Data Model represented by the given to the + given writer in EDMX form. + + An object representing the EDM. + The writer. + + + + A factory for creating derived instances. Implement this + interface to enable design-time services for context types that do not have a + public default constructor. + + At design-time, derived instances can be created in order to enable specific + design-time experiences such as model rendering, DDL generation etc. To enable design-time instantiation + for derived types that do not have a public, default constructor, implement + this interface. Design-time services will auto-discover implementations of this interface that are in the + same assembly as the derived type. + + + + + + Creates a new instance of a derived type. + + An instance of TContext + + + + This convention causes DbModelBuilder to include metadata about the model + when it builds the model. When creates a model by convention it will + add this convention to the list of those used by the DbModelBuilder. This will then result in + model metadata being written to the database if the DbContext is used to create the database. + This can then be used as a quick check to see if the model has changed since the last time it was + used against the database. + This convention can be removed from the conventions by overriding + the OnModelCreating method on a derived DbContext class. + + + + + Adds metadata to the given model configuration. + + The model configuration. + + + + This convention uses the name of the derived + class as the container for the conceptual model built by + Code First. + + + + + Initializes a new instance of the class. + + The model container name. + + + + Applies the convention to the given model. + + The model. + + + + This convention uses the namespace of the derived + class as the namespace of the conceptual model built by + Code First. + + + + + Initializes a new instance of the class. + + The model namespace. + + + + Applies the convention to the given model. + + The model. + + + + Instances of this class are used internally to create constant expressions for + that are inserted into the expression tree to replace references to + and . + + The type of the element. + + + + Private constructor called by the Create factory method. + + The query. + + + + Factory method called by CreateDelegate to create an instance of this class. + + The query, which must be a generic object of the expected type. + A new instance. + + + + The public property expected in the LINQ expression tree. + + The query. + + + + Instances of this class are used to create DbConnection objects for + SQL Server Compact Edition based on a given database name or connection string. + + + It is necessary to provide the provider invariant name of the SQL Server Compact + Edition to use when creating an instance of this class. This is because different + versions of SQL Server Compact Editions use different invariant names. + An instance of this class can be set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use SQL Server Compact Edition by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Creates a new connection factory with empty (default) DatabaseDirectory and BaseConnectionString + properties. + + The provider invariant name that specifies the version of SQL Server Compact Edition that should be used. + + + + Creates a new connection factory with the given DatabaseDirectory and BaseConnectionString properties. + + + The provider invariant name that specifies the version of SQL Server Compact Edition that should be used. + + + The path to prepend to the database name that will form the file name used by SQL Server Compact Edition + when it creates or reads the database file. An empty string means that SQL Server Compact Edition will use + its default for the database file location. + + + The connection string to use for options to the database other than the 'Data Source'. The Data Source will + be prepended to this string based on the database name when CreateConnection is called. + + + + + Creates a connection for SQL Server Compact Edition based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + The path to prepend to the database name that will form the file name used by + SQL Server Compact Edition when it creates or reads the database file. + The default value is "|DataDirectory|", which means the file will be placed + in the designated data directory. + + + + + The connection string to use for options to the database other than the 'Data Source'. + The Data Source will be prepended to this string based on the database name when + CreateConnection is called. + The default is the empty string, which means no other options will be used. + + + + + The provider invariant name that specifies the version of SQL Server Compact Edition + that should be used. + + + + + Instances of this class are used to create DbConnection objects for + SQL Server based on a given database name or connection string. By default, the connection is + made to '.\SQLEXPRESS'. This can be changed by changing the base connection + string when constructing a factory instance. + + + An instance of this class can be set on the class to + cause all DbContexts created with no connection information or just a database + name or connection string to use SQL Server by default. + This class is immutable since multiple threads may access instances simultaneously + when creating connections. + + + + + Creates a new connection factory with a default BaseConnectionString property of + 'Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True'. + + + + + Creates a new connection factory with the given BaseConnectionString property. + + + The connection string to use for options to the database other than the 'Initial Catalog'. The 'Initial Catalog' will + be prepended to this string based on the database name when CreateConnection is called. + + + + + Creates a connection for SQL Server based on the given database name or connection string. + If the given string contains an '=' character then it is treated as a full connection string, + otherwise it is treated as a database name only. + + The database name or connection string. + An initialized DbConnection. + + + + Remove hard dependency on DbProviderFactories. + + + + + The connection string to use for options to the database other than the 'Initial Catalog'. + The 'Initial Catalog' will be prepended to this string based on the database name when + CreateConnection is called. + The default is 'Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True'. + + + + + This attribute can be applied to either an entire derived class or to + individual or properties on that class. When applied + any discovered or properties will still be included + in the model but will not be automatically initialized. + + + + + Thrown when a context is generated from the templates in Database First or Model + First mode and is then used in Code First mode. + + + Code generated using the T4 templates provided for Database First and Model First use may not work + correctly if used in Code First mode. To use these classes with Code First please add any additional + configuration using attributes or the DbModelBuilder API and then remove the code that throws this + exception. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The object that holds the serialized object data. + The contextual information about the source or destination. + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Implements ICachedMetadataWorkspace for a Code First model. + + + + + Represents an object that holds a cached copy of a MetadataWorkspace and optionally the + assemblies containing entity types to use with that workspace. + + + + + Gets the MetadataWorkspace, potentially lazily creating it if it does not already exist. + If the workspace is not compatible with the provider manifest obtained from the given + connection then an exception is thrown. + + The connection to use to create or check SSDL provider info. + The workspace. + + + + The list of assemblies that contain entity types for this workspace, which may be empty, but + will never be null. + + + + + The default container name for code first is the container name that is set from the DbModelBuilder + + + + + The provider info used to construct the workspace. + + + + + Builds and stores the workspace based on the given code first configuration. + + The code first EDM model. + + + + Gets the . + If the workspace is not compatible with the provider manifest obtained from the given + connection then an exception is thrown. + + The connection to use to create or check SSDL provider info. + The workspace. + + + + The default container name for code first is the container name that is set from the DbModelBuilder + + + + + The list of assemblies that contain entity types for this workspace, which may be empty, but + will never be null. + + + + + The provider info used to construct the workspace. + + + + + The methods here are called from multiple places with an ObjectContext that may have + been created in a variety of ways and ensure that the same code is run regardless of + how the context was created. + + + + + Used a delegate to do the actual creation once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + Note however that a context obtained from only a connection will have no model and so + will result in an empty database. + + + + + Used a delegate to do the actual existence check once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + + + + + Used a delegate to do the actual check/delete once an ObjectContext has been obtained. + This is factored in this way so that we do the same thing regardless of how we get to + having an ObjectContext. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given set of entity types and DbSet initializer delegate. + + + + + The entity types part of the pair. + + + + + The DbSet properties initializer part of the pair. + + + + + Static helper methods only. + + + + + Checks whether the given value is null and throws ArgumentNullException if it is. + This method should only be used in places where Code Contracts are compiled out in the + release build but we still need public surface null-checking, such as where a public + abstract class is implemented by an internal concrete class. + + + + + Checks whether the given string is null, empty, or just whitespace, and throws appropriately + if the check fails. + This method should only be used in places where Code Contracts are compiled out in the + release build but we still need public surface checking, such as where a public + abstract class is implemented by an internal concrete class. + + + + + Given two key values that may or may not be byte arrays, this method determines + whether or not they are equal. For non-binary key values, this is equivalent + to Object.Equals. For binary keys, it is by comparison of every byte in the + arrays. + + + + + Provides a standard helper method for quoting identifiers + + Identifier to be quoted. Does not validate that this identifier is valid. + Quoted string + + + + Checks the given string which might be a database name or a connection string and determines + whether it should be treated as a name or connection string. Currently, the test is simply + whether or not the string contains an '=' character--if it does, then it should be treated + as a connection string. + + The name or connection string. + true if the string should be treated as a connection string; false if it should be treated as a name. + + + + Determines whether the given string should be treated as a database name directly (it contains no '='), + is in the form name=foo, or is some other connection string. If it is a direct name or has name=, then + the name is extracted and the method returns true. + + The name or connection string. + The name. + True if a name is found; false otherwise. + + + + Determines whether the given string is a full EF connection string with provider, provider connection string, + and metadata parts, or is is instead some other form of connection string. + + The name or connection string. + true if the given string is an EF connection string; otherwise, false. + + + + + Parses a property selector expression used for the expression-based versions of the Property, Collection, Reference, + etc methods on and + classes. + + The type of the entity. + The type of the property. + The property. + Name of the method. + Name of the param. + The property name. + + + + Called recursively to parse an expression tree representing a property path such + as can be passed to Include or the Reference/Collection/Property methods of . + This involves parsing simple property accesses like o => o.Products as well as calls to Select like + o => o.Products.Select(p => p.OrderLines). + + The expression to parse. + The expression parsed into an include path, or null if the expression did not match. + True if matching succeeded; false if the expression could not be parsed. + + + + Gets a cached dictionary mapping property names to property types for all the properties + in the given type. + + + + + Gets a dictionary of compiled property setter delegates for the underlying types. + The dictionary is cached for the type in the app domain. + + + + + Used by the property setter delegates to throw for attempts to set null onto + non-nullable properties or otherwise go ahead and set the property. + + + + + Gets a dictionary of compiled property getter delegates for the underlying types. + The dictionary is cached for the type in the app domain. + + + + + Creates a new with the NoTracking merge option applied. + The query object passed in is not changed. + + The query. + A new query with NoTracking applied. + + + + Converts to + + + Name of the property being validated with ValidationAttributes. Null for type-level validation. + + + ValidationResults instances to be converted to instances. + + + An created based on the + . + + + class contains a property with names of properties the error applies to. + On the other hand each applies at most to a single property. As a result for + each name in ValidationResult.MemberNames one will be created (with some + exceptions for special cases like null or empty .MemberNames or null names in the .MemberNames). + + + + + Calculates a "path" to a property. For primitive properties on an entity type it is just the + name of the property. Otherwise it is a dot separated list of names of the property and all + its ancestor properties starting from the entity. + + Property for which to calculate the path. + Dot separated path to the property. + + + + Gets names of the property and its ancestor properties as enumerable walking "bottom-up". + + Property for which to get the segments. + Names of the property and its ancestor properties. + + + + Gets an type for the given element type. + + Type of the element. + The collection type. + + + + Creates a database name given a type derived from DbContext. This handles nested and + generic classes. No attempt is made to ensure that the name is not too long since this + is provider specific. If a too long name is generated then the provider will throw and + the user must correct by specifying their own name in the DbContext constructor. + + Type of the context. + The database name to use. + + + + A local (in-memory) view of the entities in a DbSet. + This view contains Added entities and does not contain Deleted entities. The view extends + from and hooks up events between the collection and the + state manager to keep the view in sync. + + The type of the entity. + + + + Initializes a new instance of the class for entities + of the given generic type in the given internal context. + + The internal context. + + + + Called by the base class when the collection changes. + This method looks at the change made to the collection and reflects those changes in the + state manager. + + The instance containing the event data. + + + + Handles events from the state manager for entities entering, leaving, or being marked as deleted. + The local view is kept in sync with these changes. + + The sender. + The instance containing the event data. + + + + Clears the items by calling remove on each item such that we get Remove events that + can be tracked back to the state manager, rather than a single Reset event that we + cannot deal with. + + + + + Adds a contains check to the base implementation of InsertItem since we can't support + duplicate entities in the set. + + The index at which to insert. + The item to insert. + + + + Returns a cached binding list implementation backed by this ObservableCollection. + + The binding list. + + + + Service used to search for instance properties on a DbContext class that can + be assigned a DbSet instance. Also, if the the property has a public setter, + then a delegate is compiled to set the property to a new instance of DbSet. + All of this information is cached per app domain. + + + + + Creates a set discovery service for the given derived context. + + + + + Processes the given context type to determine the DbSet or IDbSet + properties and collect root entity types from those properties. Also, delegates are + created to initialize any of these properties that have public setters. + If the type has been processed previously in the app domain, then all this information + is returned from a cache. + + A dictionary of potential entity type to the list of the names of the properties that used the type. + + + + Calls the public setter on any property found to initialize it to a new instance of DbSet. + + + + + Registers the entities and their entity set name hints with the given . + + The model builder. + + + + Returns false if SuppressDbSetInitializationAttribute is found on the property or the class, otherwise + returns true. + + + + + Determines whether or not an instance of DbSet/ObjectSet can be assigned to a property of the given type. + + The type to check. + The entity type of the DbSet/ObjectSet that can be assigned, or null if no set type can be assigned. + + + + + A EagerInternalConnection object wraps an already existing DbConnection object. + + + + + InternalConnection objects manage DbConnections. + Two concrete base classes of this abstract interface exist: + and . + + + + + IInternalConnection objects manage DbConnections. + Two concrete implementations of this interface exist--LazyInternalConnection and EagerInternalConnection. + + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Returns the underlying DbConnection. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if the connection contains model info; otherwise, false. + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strins. + + + + + Gets or sets the provider to be used when creating the underlying connection. + + + + + Gets the name of the underlying connection string. + + + + + Gets the original connection string. + + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Called after the connection is initialized for the first time. + + + + + Adds a tracking cookie to the connection string for SqlConnections. Returns the + possibly modified store connection string. + + + + + Returns the underlying DbConnection. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if the connection contains model info; otherwise, false. + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strins. + + + + + Gets or sets the provider to be used when creating the underlying connection. + + + + + Gets the name of the underlying connection string. + + + + + Gets the original connection string. + + + + + Gets or sets the underlying object. No initialization is done when the + connection is obtained, and it can also be set to null. + + The underlying connection. + + + + Creates a new EagerInternalConnection that wraps an existing DbConnection. + + An existing connection. + If set to true then the underlying connection should be disposed when this object is disposed. + + + + Dispose the existing connection is the original caller has specified that it should be disposed + by the framework. + + + + + Returns the origin of the underlying connection string. + + + + + An is an where the + instance that it wraps is set immediately at construction time rather than being created lazily. In this case + the internal context may or may not own the instance but will only dispose it + if it does own it. + + + + + An underlies every instance of and wraps an + instance. + The also acts to expose necessary information to other parts of the design in a + controlled manner without adding a lot of internal methods and properties to the + class itself. + Two concrete classes derive from this abstract class - and + . + + + + + Initializes the object with its owner. + + The owner . + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Creates a new temporary based on the same metadata and connection as the real + and sets it as the context to use DisposeTempObjectContext is called. + This allows this internal context and its DbContext to be used for transient operations + such as initializing and seeding the database, after which it can be thrown away. + This isolates the real from any changes made and and saves performed. + + + + + If a temporary ObjectContext was set with UseTempObjectContext, then this method disposes that context + and returns this internal context and its DbContext to using the real ObjectContext. + + + + + Called by methods of to create a database either using the Migrations pipeline + if possible and the core provider otherwise. + + The context to use for core provider calls. + + + + Internal implementation of . + + True if the model hash in the context and the database match; false otherwise. + + + + Checks whether the given model (an EDMX document) matches the current model. + + + + + Queries the database for a model hash and returns it if found or returns null if the table + or the row doesn't exist in the database. + + The model hash, or null if not found. + + + + Queries the database for a model stored in the MigrationHistory table and returns it as an EDMX, or returns + null if the database does not contain a model. + + + + + Saves the model hash from the context to the database. + + + + + Performs the initialization action that may result in a and + handle the exception to provide more meaning to the user. + + The action. + + + + Registers for the ObjectStateManagerChanged event on the underlying ObjectStateManager. + This is a virtual method on this class so that it can be mocked. + + The event handler. + + + + Checks whether or not the given object is in the context in any state other than Deleted. + This is a virtual method on this class so that it can be mocked. + + The entity. + true if the entity is in the context and not deleted; otherwise false. + + + + Saves all changes made in this context to the underlying database. + + The number of objects written to the underlying database. + + + + Initializes this instance, which means both the context is initialized and the underlying + database is initialized. + + + + + Initializes the underlying ObjectContext but does not cause the database to be initialized. + + + + + Marks the database as having not been initialized. This is called when the app calls Database.Delete so + that the database if the app attempts to then use the database again it will be re-initialized automatically. + + + + + Runs the unless it has already been run or there + is no initializer for this context type in which case this method does nothing. + + + + + Marks the database as having been initialized without actually running the . + + + + + Runs the if one has been set for this context type. + Calling this method will always cause the initializer to run even if the database is marked + as initialized. + + + + + Disposes the context. Override the DisposeContext method to perform + additional work when disposing. + + + + + Performs additional work to dispose a context. + + + + + Calls DetectChanges on the underlying if AutoDetectChangesEnabled is + true or if force is set to true. + + if set to true then DetectChanges is called regardless of the value of AutoDetectChangesEnabled. + + + + Returns the DbSet instance for the given entity type. + This property is virtual and returns to that it can be mocked. + + The entity type for which a set should be returned. + A set for the given entity type. + + + + Returns the non-generic instance for the given entity type. + This property is virtual and returns to that it can be mocked. + + The entity type for which a set should be returned. + A set for the given entity type. + + + + Creates an internal set using an app domain cached delegate. + + Type of the entity. + The set. + + + + Returns the entity set and the base type for that entity set for the given type. + This method does o-space loading if required and throws if the type is not in the model. + + The entity type to lookup. + The entity set and base type pair. + + + + Returns the entity set and the base type for that entity set for the given type if that + type is mapped in the model, otherwise returns null. + This method does o-space loading if required. + + The entity type to lookup. + The entity set and base type pair, or null if not found. + + + + Checks whether or not the given entity type is mapped in the model. + + The entity type to lookup. + True if the type is mapped as an entity; false otherwise. + + + + Gets the local entities of the type specified from the state manager. That is, all + Added, Modified, and Unchanged entities of the given type. + + The type of entity to get. + The entities. + + + + Executes the given SQL query against the database backing this context. The results are not materialized as + entities or tracked. + + The type of the element. + The SQL. + The parameters. + The query results. + + + + Executes the given SQL query against the database backing this context. The results are not materialized as + entities or tracked. + + Type of the element. + The SQL. + The parameters. + The query results. + + + + Calls the generic ExecuteSqlQuery but with a non-generic return type so that it + has the correct signature to be used with CreateDelegate above. + + + + + Executes the given SQL command against the database backing this context. + + The SQL. + The parameters. + The return value from the database. + + + + Gets the underlying for the given entity, or returns null if the entity isn't tracked by this context. + This method is virtual so that it can be mocked. + + The entity. + The state entry or null. + + + + Gets the underlying objects for all entities tracked by + this context. + This method is virtual so that it can be mocked. + + State entries for all tracked entities. + + + + Gets the underlying objects for all entities of the given + type tracked by this context. + This method is virtual so that it can be mocked. + + The type of the entity. + State entries for all tracked entities of the given type. + + + + Helper method that gets the underlying objects for all entities that + match the given predicate. + + + + + Wraps the given in either a or + a depending on the actual exception type and the state + entries involved. + + The update exception. + A new exception wrapping the given exception. + + + + Uses the underlying context to create an entity such that if the context is configured + to create proxies and the entity is suitable then a proxy instance will be returned. + This method is virtual so that it can be mocked. + + The type of the entity. + The new entity instance. + + + + Uses the underlying context to create an entity such that if the context is configured + to create proxies and the entity is suitable then a proxy instance will be returned. + This method is virtual so that it can be mocked. + + The type of entity to create. + The new entity instance. + + + + This method is used by CreateDelegate to transform the CreateObject method with return type TEntity + into a method with return type object which matches the required type of the delegate. + + + + + Replaces the connection that will be used by this context. + The connection can only be changed before the context is initialized. + + The new connection. + + + + Throws if the context has been disposed. + + + + + Checks whether or not the internal cache of types to entity sets has been initialized, + and initializes it if necessary. + + + + + Forces all DbSets to be initialized, which in turn causes o-space loading to happen + for any entity type for which we have a DbSet. This includes all DbSets that were + discovered on the user's DbContext type. + + + + + Performs o-space loading for the type and returns false if the type is not in the model. + + + + + Performs o-space loading for the type and throws if the type is not in the model. + + Type of the entity. + + + + Returns true if the given entity type does not have EdmEntityTypeAttribute but is in + an assembly that has EdmSchemaAttribute. This indicates mixing of POCO and EOCO in the + same assembly, which is something that we don't support. + + + + + Determines whether or not the given clrType is mapped to a complex type. Assumes o-space loading has happened. + + + + + Updates the cache of types to entity sets either for the first time or after potentially + doing some o-space loading. + + + + + The public context instance that owns this internal context. + + + + + Returns the underlying . + + + + + Gets the temp object context, or null if none has been set. + + The temp object context. + + + + The compiled model created from the Code First pipeline, or null if Code First was + not used to create this context. + Causes the Code First pipeline to be run to create the model if it has not already been + created. + + + + + Set to true when a database initializer is performing some actions, such as creating or deleting + a database, or seeding the database. + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + Gets or sets a value indicating whether lazy loading is enabled. + + + + + Gets or sets a value indicating whether proxy creation is enabled. + + + + + Gets or sets a value indicating whether DetectChanges is called automatically in the API. + + + + + Gets or sets a value indicating whether to validate entities when is called. + + + + + True if the context has been disposed. + + + + + The connection underlying this context. Accessing this property does not cause the context + to be initialized, only its connection. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries, + database intializers and connection strings. + + + + + Gets or sets the provider details to be used when building the EDM model. + + + + + Gets the name of the underlying connection string. + + + + + Gets the provider name bsing used either using a cached value or getting it from + the DbConnection in use. + + + + + Gets or sets a custom OnModelCreating action. + + + + + Gets the DatabaseOperations instance to use to perform Create/Delete/Exists operations + against the database. + Note that this virtual property can be mocked to help with unit testing. + + + + + Gets instance used to create validators and validation contexts. + This property is virtual to allow mocking. + + + + + For mocking. + + + + + Constructs an for an already existing . + + The owner . + The existing . + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Does nothing, since the already exists. + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Does nothing since the database is always considered initialized if the was created + from an existing . + + + + + Disposes the context. The underlying is also disposed if it is owned. + + + + + + + + Returns the underlying . + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + The connection underlying this context. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets a value indicating whether lazy loading is enabled. This is just a wrapper + over the same flag in the underlying . + + + + + Gets or sets a value indicating whether proxy creation is enabled. This is just a wrapper + over the same flag in the underlying ObjectContext. + + + + + An implementation of that represents a clone of another + dictionary. That is, all the property values have been been copied into this dictionary. + + + + + The internal class used to implement . + This internal class allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal context with which the entity of complex object is associated. + The type of the entity or complex object. + If set to true this is a dictionary for an entity, otherwise it is a dictionary for a complex object. + + + + Implemented by subclasses to get the dictionary item for a given property name. + Checking that the name is valid should happen before this method is called such + that subclasses do not need to perform the check. + + Name of the property. + An item for the given name. + + + + Creates an object of the underlying type for this dictionary and hydrates it with property + values from this dictionary. + + The properties of this dictionary copied into a new object. + + + + Creates an instance of the underlying type for this dictionary, which may either be an entity type (in which + case CreateObject on the context is used) or a non-entity type (in which case the empty constructor is used.) + In either case, app domain cached compiled delegates are used to do the creation. + + + + + Sets the values of this dictionary by reading values out of the given object. + The given object must be of the type that this dictionary is based on. + + The object to read values from. + + + + Creates a new dictionary containing copies of all the properties in this dictionary. + Changes made to the new dictionary will not be reflected in this dictionary and vice versa. + + A clone of this dictionary. + + + + Sets the values of this dictionary by reading values from another dictionary. + The other dictionary must be based on the same type as this dictionary, or a type derived + from the type for this dictionary. + + The dictionary to read values from. + + + + Gets the dictionary item for the property with the given name. + This method checks that the given name is valid. + + The property name. + The item. + + + + Sets the value of the property only if it is different from the current value and is not + an invalid attempt to set a complex property. + + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + Gets or sets the value of the property with the specified property name. + The value may be a nested instance of this class. + + The property name. + The value of the property. + + + + Gets the entity type of complex type that this dictionary is based on. + + The type of the object underlying this dictionary. + + + + Gets the internal context with which the underlying entity or complex type is associated. + + The internal context. + + + + Gets a value indicating whether the object for this dictionary is an entity or a complex object. + + true if this this is a dictionary for an entity; false if it is a dictionary for a complex object. + + + + Initializes a new instance of the class by copying + values from the given dictionary. + + The dictionary to clone. + If non-null, then the values for the new dictionary are taken from this record rather than from the original dictionary. + + + + Gets the dictionary item for a given property name. + + Name of the property. + An item for the given name. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + An implementation of for an item in a . + + + + + Represents an item in an representing a property name/value. + + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + true If this instance represents a complex property; otherwise, false. + + + + Gets the type of the underlying property. + + The property type. + + + + Initializes a new instance of the class. + + The name. + The value. + The type. + If set to true this item represents a complex property. + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + + true If this instance represents a complex property; otherwise, false. + + + + + Gets the type of the underlying property. + + The property type. + + + + An implementation of that is based on an existing + instance. + + + + + Initializes a new instance of the class. + + The internal context. + The type. + The data record. + If set to true this is a dictionary for an entity, otherwise it is a dictionary for a complex object. + + + + Gets the dictionary item for a given property name. + + Name of the property. + An item for the given name. + + + + Gets the set of names of all properties in this dictionary as a read-only set. + + The property names. + + + + An implementation of for an item in a . + + + + + Initializes a new instance of the class. + + The data record. + The ordinal. + The value. + + + + Gets or sets the value of the property represented by this item. + + The value. + + + + Gets the name of the property. + + The name. + + + + Gets a value indicating whether this item represents a complex property. + + + true If this instance represents a complex property; otherwise, false. + + + + + Gets the type of the underlying property. + + The property type. + + + + This is version of an internal interface that already exists in System.Data.Entity that + is implemented by . Using this interface allows state + entries to be mocked for unit testing. The plan is to remove this version of the + interface and use the one in System.Data.Entity once we roll into the framework. + Note that some members may need to be added to the interface in the framework when + we combine the two. + + + + + The internal class used to implement and + . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Base class for and + containing common code for collection and reference navigation property entries. + + + + + Base class for all internal entries that represent different kinds of properties. + + + + + Initializes a new instance of the class. + + The internal entity entry. + The member metadata. + + + + Validates this property. + + A sequence of validation errors for this property. Empty if no errors. Never null. + + + + Creates a new non-generic backed by this internal entry. + The actual subtype of the DbMemberEntry created depends on the metadata of this internal entry. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The actual subtype of the DbMemberEntry created depends on the metadata of this internal entry. + + The type of the entity. + The type of the property. + The new entry. + + + + Gets the property name. + The property is virtual to allow mocking. + + The property name. + + + + Gets or sets the current value of the navigation property. + + The current value. + + + + Gets the internal entity entry property belongs to. + This property is virtual to allow mocking. + + The internal entity entry. + + + + Gets the entry metadata. + + The entry metadata. + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Calls Load on the underlying . + + + + + Uses CreateSourceQuery on the underlying to create a query for this + navigation property. + + + + + Gets the navigation property value from the object. + + The entity. + The navigation property value. + + + + Validates that the owning entity entry is associated with an underlying and + is not just wrapping a non-attached entity. + If the entity is not detached, then the RelatedEnd for this navigation property is obtained. + + + + + Calls IsLoaded on the underlying . + + + + + Gets the related end, which will be null if the entity is not being tracked. + + The related end. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + This property is virtual so that it can be mocked. + + The current value. + + + + Gets a delegate that can be used to get the value of the property directly from the entity. + Returns null if the property does not have an accessible getter. + + The getter delegate, or null. + + + + Gets a delegate that can be used to set the value of the property directly on the entity. + Returns null if the property does not have an accessible setter. + + The setter delegate, or null. + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Gets the navigation property value from the object. + Since for a collection the related end is an , it means + that the internal representation of the navigation property is just the related end. + + The entity. + The navigation property value. + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Creates a new generic backed by this internal entry. + The actual subtype of the DbCollectionEntry created depends on the metadata of this internal entry. + + The type of the entity. + The type of the element. + The new entry. + + + + Creates a object for the given entity type + and collection element type. + + The type of the entity. + The type of the property. + Type of the element. + The set. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + + The current value. + + + + The internal class used to implement + and . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal context. + The state entry. + + + + Initializes a new instance of the class for an + entity which may or may not be attached to the context. + + The internal context. + The entity. + + + + Queries the database for copies of the values of the tracked entity as they currently exist in the database. + + The store values. + + + + Appends a query for the properties in the entity to the given string builder that is being used to + build the eSQL query. This method may be called recursively to query for all the sub-properties of + a complex property. + + The query builder. + The qualifier with which to prefix each property name. + The dictionary that acts as a template for the properties to query. + + + + Validates that a dictionary can be obtained for the state of the entity represented by this entry. + + The method name being used to request a dictionary. + The state that is invalid for the request being processed. + + + + Calls Refresh with StoreWins on the underlying state entry. + + + + + Gets an internal object representing a reference navigation property. + This method is virtual to allow mocking. + + The navigation property. + The type of entity requested, which may be 'object' or null if any type can be accepted. + The entry. + + + + Gets an internal object representing a collection navigation property. + This method is virtual to allow mocking. + + The navigation property. + The type of entity requested, which may be 'object' or null f any type can be accepted. + The entry. + + + + Gets an internal object representing a navigation, scalar, or complex property. + This method is virtual to allow mocking. + + Name of the property. + The type of entity requested, which may be 'object' if any type can be accepted. + The entry. + + + + Gets an internal object representing a scalar or complex property. + This method is virtual to allow mocking. + + The property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Gets an internal object representing a scalar or complex property. + The property may be a nested property on the given . + + The parent property entry, or null if this is a property directly on the entity. + Name of the property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Gets an internal object representing a scalar or complex property. + The property may be a nested property on the given . + + The parent property entry, or null if this is a property directly on the entity. + Name of the property. + The property split out into its parts. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Checks that the given property name is a navigation property and is either a reference property or + collection property according to the value of requireCollection. + + + + + Gets metadata for the given property if that property is a navigation property or returns null + if it is not a navigation property. + + Name of the property. + Navigation property metadata or null. + + + + Gets the type of entity or entities at the target end of the given navigation property. + + The navigation property. + The CLR type of the entity or entities at the other end. + + + + Gets the related end for the navigation property with the given name. + + The navigation property. + + + + + Uses EDM metadata to validate that the property name exists in the model and represents a scalar or + complex property or exists in the CLR type. + This method is public and virtual so that it can be mocked. + + The property name. + The type on which the property is declared. + The type of object requested, which may be 'object' if any type can be accepted. + Metadata for the property. + + + + Splits the given property name into parts delimited by dots. + + Name of the property. + The parts of the name. + + + + Validates that this entry is associated with an underlying and + is not just wrapping a non-attached entity. + + + + + Validates entity represented by this entity entry. + This method is virtual to allow mocking. + + User defined dictionary containing additional info for custom validation. This parameter is optional and can be null. + containing validation result. Never null. + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Determines whether the specified is equal to this instance. + Two instances are considered equal if they are both entries for + the same entity on the same . + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the tracked entity. + This property is virtual to allow mocking. + + The entity. + + + + Gets or sets the state of the entity. + + The state. + + + + Gets the current property values for the tracked entity represented by this object. + This property is virtual to allow mocking. + + The current values. + + + + Gets the original property values for the tracked entity represented by this object. + The original values are usually the entity's property values as they were when last queried from + the database. + This property is virtual to allow mocking. + + The original values. + + + + Checks whether or not this entry is associated with an underlying or + is just wrapping a non-attached entity. + + + + + Gets the type of the entity being tracked. + + The type of the entity. + + + + Gets the c-space entity type for this entity from the EDM. + + + + + Gets the underlying object state entry. + + + + + Gets the internal context. + + The internal context. + + + + A concrete implementation of used for properties of entities. + + + + + The internal class used to implement and + . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal entry. + The property info. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. If this is a property of an entity, then this method returns + true if the property is modified. If this is a property of a complex object, then + this method returns true if the top-level complex property on the entity is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + If this is a property of an entity, then this method marks it as modified. + If this is a property of a complex object, then this method marks the top-level + complex property as modified. + + + + + Throws if the user attempts to set a complex property to null. + + The value. + + + + Sets the given value directly onto the underlying entity object. + + The value. + True if the property had a setter that we could attempt to call; false if no setter was available. + + + + Sets the property value, potentially by setting individual nested values for a complex + property. + + The value. + + + + Gets an internal object representing a scalar or complex property of this property, + which must be a mapped complex property. + This method is virtual to allow mocking. + + The property. + The type of object requested, which may be null or 'object' if any type can be accepted. + if set to true then the found property must be a complex property. + The entry. + + + + Validates that the owning entity entry is associated with an underlying and + is not just wrapping a non-attached entity. + + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent entity or complex property. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent entity or complex property. + That is, the original values that contains the value for this property. + + The parent original values. + + + + A delegate that reads the value of this property. + May be null if there is no way to set the value due to missing accessors on the type. + + + + + A delegate that sets the value of this property. + May be null if there is no way to set the value due to missing accessors on the type. + + + + + Gets or sets the original value. + Note that complex properties are returned as objects, not property values. + + + + + Gets or sets the current value. + Note that complex properties are returned as objects, not property values. + Also, for complex properties, the object returned is the actual complex object from the entity + and setting the complex object causes the actual object passed to be set onto the entity. + + The current value. + + + + Gets or sets a value indicating whether this property is modified. + + + + + Gets the property metadata. + + The property metadata. + + + + Initializes a new instance of the class. + + The internal entry. + The property info. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. Since this is a property of an entity this method returns + true if the property is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + Since this is a property of an entity this method marks it as modified. + + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent entity. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent entity. + That is, the original values that contains the value for this property. + + The parent original values. + + + + A concrete implementation of used for properties of complex objects. + + + + + Initializes a new instance of the class. + + The parent property entry. + The property metadata. + + + + Creates a delegate that will get the value of this property. + + The delegate. + + + + Creates a delegate that will set the value of this property. + + The delegate. + + + + Returns true if the property of the entity that this property is ultimately part + of is set as modified. Since this is a property of a complex object + this method returns true if the top-level complex property on the entity is modified. + + True if the entity property is modified. + + + + Sets the property of the entity that this property is ultimately part of to modified. + Since this is a property of a complex object this method marks the top-level + complex property as modified. + + + + + Returns parent property, or null if this is a property on the top-level entity. + + + + + Gets the current values of the parent complex property. + That is, the current values that contains the value for this property. + + The parent current values. + + + + Gets the original values of the parent complex property. + That is, the original values that contains the value for this property. + + The parent original values. + + + + The internal class used to implement , + and . + This internal class contains all the common implementation between the generic and non-generic + entry classes and also allows for a clean internal factoring without compromising the public API. + + + + + Initializes a new instance of the class. + + The internal entity entry. + The navigation metadata. + + + + Gets the navigation property value from the object. + For reference navigation properties, this means getting the value from the + object. + + The entity. + The navigation property value. + + + + Sets the navigation property value onto the object. + For reference navigation properties, this means setting the value onto the + object. + + The entity. + The value. + + + + Sets the given value on the given which must be an + . + This method is setup in such a way that it can easily be used by CreateDelegate without any + dynamic code generation needed. + + The type of the related entity. + The entity reference. + The value. + + + + Creates a new non-generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The new entry. + + + + Creates a new generic backed by this internal entry. + The runtime type of the DbMemberEntry created will be or a subtype of it. + + The type of the entity. + The type of the property. + The new entry. + + + + Gets or sets the current value of the navigation property. The current value is + the entity that the navigation property references or the collection of references + for a collection property. + + The current value. + + + + Contains metadata about a member of an entity type or complex type. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry if the new entry is nested, otherwise null. + The new entry. + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets the name of the property. + + The name. + + + + Gets the type of the entity or complex object that on which the member is declared. + + The type that the member is declared on. + + + + Gets the type of element for the property, which for non-collection properties + is the same as the MemberType and which for collection properties is the type + of element contained in the collection. + + The type of the element. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + The types of member entries supported. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + if set to true this is a collection nav prop. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry which will always be null for navigation entries. + The new entry. + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + Contains metadata for a property of a complex object or entity. + + + + + Initializes a new instance of the class. + + The type that the property is declared on. + Type of the property. + The property name. + if set to true the property is mapped in the EDM. + if set to true the property is a complex property. + + + + Validates that the given name is a property of the declaring type (either on the CLR type or in the EDM) + and that it is a complex or scalar property rather than a nav property and then returns metadata about + the property. + + The internal context. + The type that the property is declared on. + The type of property requested, which may be 'object' if any type can be accepted. + Name of the property. + Metadata about the property, or null if the property does not exist or is a navigation property. + + + + Creates a new the runtime type of which will be + determined by the metadata. + + The entity entry to which the member belongs. + The parent property entry if the new entry is nested, otherwise null. + The new entry. + + + + Gets a value indicating whether this is a complex property. + That is, not whether or not this is a property on a complex object, but rather if the + property itself is a complex property. + + + true if this instance is complex; otherwise, false. + + + + + Gets the type of the member for which this is metadata. + + The type of the member entry. + + + + Gets a value indicating whether this instance is mapped in the EDM. + + true if this instance is mapped; otherwise, false. + + + + Gets the type of the member, which for collection properties is the type + of the collection rather than the type in the collection. + + The type of the member. + + + + An implementation of that wraps an existing set but makes + it read-only. + + + + + + Initializes a new instance of the class wrapped around + another existing set. + + The existing set. + + + + This is a temporary adapter class that wraps an and + presents it as an . This class will be removed once + we roll into the System.Data.Entity assembly. See + for more details. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given EntitySet and BaseType. + + + + + The EntitySet part of the pair. + + + + + The BaseType part of the pair. + + + + + Helper class that extends Tuple to give the Item1 and Item2 properties more meaningful names. + + + + + Creates a new pair of the given database initializer delegate and a flag + indicating whether or not it is locked. + + + + + The initializer delegate. + + + + + A flag indicating whether or not the initializer is locked and should not be changed. + + + + + Represents a raw SQL query against the context for any type where the results are never + associated with an entity set and are never tracked. + + + + + Represents a raw SQL query against the context that may be for entities in an entity set + or for some other non-entity element type. + + + + + Initializes a new instance of the class. + + The SQL. + The parameters. + + + + If the query is would track entities, then this method returns a new query that will + not track entities. + + A no-tracking query. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Gets the SQL query string, + + The SQL query. + + + + Gets the parameters. + + The parameters. + + + + Returns false. + + false. + + + + Initializes a new instance of the class. + + The internal context. + Type of the element. + The SQL. + The parameters. + + + + Returns this query since it can never be a tracking query. + + This instance. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Generic wrapper around to allow results to be + returned as generic + + The type of the element. + + + + Executes the query and returns an enumerator for the elements. + + An + + object that can be used to iterate through the elements. + + + + Executes the query and returns an enumerator for the elements. + + + An object that can be used to iterate through the elements. + + + + + Returns a that contains the SQL string that was set + when the query was created. The parameters are not included. + + + A that represents this instance. + + + + + Throws an exception indicating that binding directly to a store query is not supported. + + + Never returns; always throws. + + + + + Returns false. + + false. + + + + Represents a raw SQL query against the context for entities in an entity set. + + + + + Initializes a new instance of the class. + + The set. + The SQL. + if set to true then the entities will not be tracked. + The parameters. + + + + If the query is would track entities, then this method returns a new query that will + not track entities. + + A no-tracking query. + + + + Executes the query and returns an enumerator for the results. + + The query results. + + + + Gets a value indicating whether this instance is set to track entities or not. + + + true if this instance is no-tracking; otherwise, false. + + + + + A LazyInternalConnection object manages information that can be used to create a DbConnection object and + is responsible for creating that object and disposing it. + + + + + Creates a new LazyInternalConnection using convention to calculate the connection. + The DbConnection object will be created lazily on demand and will be disposed when the LazyInternalConnection is disposed. + + Either the database name or a connection string. + + + + Creates a new LazyInternalConnection targeting a specific database. + The DbConnection object will be created lazily on demand and will be disposed when the LazyInternalConnection is disposed. + + The connection to target. + + + + Creates an from metadata in the connection. This method must + only be called if ConnectionHasModel returns true. + + The newly created context. + + + + Disposes the underlying DbConnection. + Note that dispose actually puts the LazyInternalConnection back to its initial state such that + it can be used again. + + + + + + Searches the app.config/web.config file for a connection that matches the given name. + The connection might be a store connection or an EF connection. + + The connection name. + + True if a connection from the app.config file was found and used. + + + + Attempts to locate a connection entry in the configuration based on the supplied context name. + + The name to search for. + The configuration to search in. + Connection string if found, otherwise null. + + + + Initializes the connection based on a connection string. + + The settings to initialize from. + + + + Returns the underlying DbConnection, creating it first if it does not already exist. + + + + + Returns the origin of the underlying connection string. + + + + + Gets the name of the underlying connection string. + + + + + Returns a key consisting of the connection type and connection string. + If this is an EntityConnection then the metadata path is included in the key returned. + + + + + + + + + Gets a value indicating whether the connection is an EF connection which therefore contains + metadata specifying the model, or instead is a store connection, in which case it contains no + model info. + + true if connection contain model info; otherwise, false. + + + + Gets a value indicating if the lazy connection has been initialized. + + + + + A is a concrete type that will lazily create the + underlying when needed. The created is owned by the + internal context and will be disposed when the internal context is disposed. + + + + + Constructs a for the given owner that will be initialized + on first use. + + The owner . + Responsible for creating a connection lazily when the context is used for the first time. + The model, or null if it will be created by convention + + + + Returns the underlying without causing the underlying database to be created + or the database initialization strategy to be executed. + This is used to get a context that can then be used for database creation/initialization. + + + + + Saves all changes made in this context to the underlying database, but only if the + context has been initialized. If the context has not been initialized, then this + method does nothing because there is nothing to do; in particular, it does not + cause the context to be initialized. + + The number of objects written to the underlying database. + + + + Disposes the context. The underlying is also disposed. + The connection to the database ( object) is also disposed if it was created by + the context, otherwise it is not disposed. + + + + + + + + Initializes the underlying . + + + + + Creates an immutable, cacheable representation of the model defined by this builder. + This model can be used to create an or can be passed to a + constructor to create a for this model. + + + + + + Creates and configures the instance that will be used to build the + . + + The builder. + + + + Marks the database as having not been initialized. This is called when the app calls Database.Delete so + that the database if the app attempts to then use the database again it will be re-initialized automatically. + + + + + Marks the database as having been initialized without actually running the . + + + + + Runs the unless it has already been run or there + is no initializer for this context type in which case this method does nothing. + + + + + Performs some action (which may do nothing) in such a way that it is guaranteed only to be run + once for the model and connection in this app domain, unless it fails by throwing an exception, + in which case it will be re-tried next time the context is initialized. + + The action. + + + + Returns the underlying . + + + + + The compiled model created from the Code First pipeline, or null if Code First was + not used to create this context. + Causes the Code First pipeline to be run to create the model if it has not already been + created. + + + + + The actually being used, which may be the + temp context for initialization or the real context. + + + + + The connection underlying this context. Accessing this property does not cause the context + to be initialized, only its connection. + + + + + The connection string as originally applied to the context. This is used to perform operations + that need the connection string in a non-mutated form, such as with security info still intact. + + + + + Returns the origin of the underlying connection string. + + + + + Gets or sets an object representing a config file used for looking for DefaultConnectionFactory entries + and connection strings. + + + + + Gets the name of the underlying connection string. + + + + + Gets or sets the provider details to be used when building the EDM model. + + + + + + + + Gets or sets a custom OnModelCreating action. + + + + + Gets the default database initializer to use for this context if no other has been registered. + For code first this property returns a instance. + For database/model first, this property returns null. + + The default initializer. + + + + Gets or sets a value indicating whether lazy loading is enabled. + If the exists, then this property acts as a wrapper over the flag stored there. + If the has not been created yet, then we store the value given so we can later + use it when we create the . This allows the flag to be changed, for example in + a DbContext constructor, without it causing the to be created. + + + + + Gets or sets a value indicating whether proxy creation is enabled. + If the ObjectContext exists, then this property acts as a wrapper over the flag stored there. + If the ObjectContext has not been created yet, then we store the value given so we can later + use it when we create the ObjectContext. This allows the flag to be changed, for example in + a DbContext constructor, without it causing the ObjectContext to be created. + + + + + A wrapping query provider that performs expression transformation and then delegates + to the provider. The objects returned are always instances + of . This provider is associated with generic objects. + + + + + Creates a provider that wraps the given provider. + + The provider to wrap. + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a . + + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a where T is determined + from the element type of the ObjectQuery. + + + + + By default, calls the same method on the wrapped provider. + + + + + By default, calls the same method on the wrapped provider. + + + + + Creates an appropriate generic IQueryable using Reflection and the underlying ElementType of + the given ObjectQuery. + + + + + Performs expression replacement and then delegates to the wrapped provider to create an + . + + + + + Wraps the given as a where T is determined + from the element type of the ObjectQuery. + + + + + Gets the internal context. + + The internal context. + + + + A LINQ expression visitor that finds uses with equivalent + instances. + + + + + Replaces calls to DbContext.Set() with an expression for the equivalent . + + The node to replace. + A new node, which may have had the replacement made. + + + + Replaces a or property with a constant expression + for the underlying . + + The node to replace. + A new node, which may have had the replacement made. + + + + Processes the fields in each constant expression and replaces instances with + the underlying ObjectQuery instance. This handles cases where the query has a closure + containing values. + + + + + Gets a value from the given member, or returns null + if the member doesn't contain a DbContext instance. + + The expression for the object for the member, which may be null for a static member. + The member. + The context or null. + + + + Gets the instance from the given instance or static member, returning null + if the member does not contain a DbContext instance. + + The member. + The value of the object to get the instance from, or null if the member is static. + The context instance or null. + + + + Takes a or and creates an expression + for the underlying . + + + + + Takes a or and extracts the underlying . + + + + + A non-generic interface implemented by that allows operations on + any query object without knowing the type to which it applies. + + + + + An interface implemented by . + + The type of the element. + + + + A non-generic interface implemented by that allows operations on + any set object without knowing the type to which it applies. + + + + + An interface implemented by . + + + + + An instance of this internal class is created whenever an instance of the public + class is needed. This allows the public surface to be non-generic, while the runtime type created + still implements . + + The type of the element. + + + + Creates a new query that will be backed by the given internal query object. + + The backing query. + + + + See comments in . + + + + + See comments in . + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the underlying internal query object. + + The internal query. + + + + An instance of this internal class is created whenever an instance of the public + class is needed. This allows the public surface to be non-generic, while the runtime type created + still implements . + + The type of the entity. + + + + Creates a new set that will be backed by the given internal set. + + The internal set. + + + + Creates an instance of this class. This method is used with CreateDelegate to cache a delegate + that can create a generic instance without calling MakeGenericType every time. + + + The internal set to wrap, or null if a new internal set should be created. + The set. + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + See comments in . + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the underlying internal query object. + + The internal query. + + + + Gets the underlying internal set. + + The internal set. + + + + See comments in . + + + + + An InternalQuery underlies every instance of DbSet and DbQuery. It acts to lazily initialize a InternalContext as well + as an ObjectQuery and EntitySet the first time that it is used. The InternalQuery also acts to expose necessary + information to other parts of the design in a controlled manner without adding a lot of internal methods and + properties to the DbSet and DbQuery classes themselves. + + The type of entity to query for. + + + + Creates a new query that will be backed by the given InternalContext. + + The backing context. + + + + Creates a new internal query based on the information in an existing query together with + a new underlying ObjectQuery. + + + + + Resets the query to its uninitialized state so that it will be re-lazy initialized the next + time it is used. This allows the ObjectContext backing a DbContext to be switched out. + + + + + Updates the underlying ObjectQuery with the given include path. + + The include path. + A new query containing the defined include path. + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Performs lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that the query can be used. + + + + + Returns a representation of the underlying query, equivalent + to ToTraceString on ObjectQuery. + + + The query string. + + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + The underlying InternalContext. + + + + + The underlying ObjectQuery. + + + + + The underlying ObjectQuery. + + + + + The LINQ query expression. + + + + + The LINQ query provider for the underlying . + + + + + The IQueryable element type. + + + + + Creates a new query that will be backed by the given InternalContext. + + The backing context. + + + + Resets the set to its uninitialized state so that it will be re-lazy initialized the next + time it is used. This allows the ObjectContext backing a DbContext to be switched out. + + + + + Finds an entity with the given primary key values. + If an entity with the given primary key values exists in the context, then it is + returned immediately without making a request to the store. Otherwise, a request + is made to the store for an entity with the given primary key values and this entity, + if found, is attached to the context and returned. If no entity is found in the + context or the store, then null is returned. + + + The ordering of composite key values is as defined in the EDM, which is in turn as defined in + the designer, by the Code First fluent API, or by the DataMember attribute. + + The values of the primary key for the entity to be found. + The entity found, or null. + Thrown if multiple entities exist in the context with the primary key values given. + Thrown if the type of entity is not part of the data model for this context. + Thrown if the types of the key values do not match the types of the key values for the entity type to be found. + Thrown if the context has been disposed. + + + + Finds an entity in the state manager with the given primary key values, or returns null + if no such entity can be found. This includes looking for Added entities with the given + key values. + + + + + Finds an entity in the store with the given primary key values, or returns null + if no such entity can be found. This code is adapted from TryGetObjectByKey to + include type checking in the query. + + + + + Attaches the given entity to the context underlying the set. That is, the entity is placed + into the context in the Unchanged state, just as if it had been read from the database. + + + Attach is used to repopulate a context with an entity that is known to already exist in the database. + SaveChanges will therefore not attempt to insert an attached entity into the database because + it is assumed to already be there. + Note that entities that are already in the context in some other state will have their state set + to Unchanged. Attach is a no-op if the entity is already in the context in the Unchanged state. + This method is virtual so that it can be mocked. + + The entity to attach. + + + + Adds the given entity to the context underlying the set in the Added state such that it will + be inserted into the database when SaveChanges is called. + + + Note that entities that are already in the context in some other state will have their state set + to Added. Add is a no-op if the entity is already in the context in the Added state. + This method is virtual so that it can be mocked. + + The entity to add. + + + + Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges + is called. Note that the entity must exist in the context in some other state before this method + is called. + + + Note that if the entity exists in the context in the Added state, then this method + will cause it to be detached from the context. This is because an Added entity is assumed not to + exist in the database such that trying to delete it does not make sense. + This method is virtual so that it can be mocked. + + The entity to remove. + + + + This method checks whether an entity is already in the context. If it is, then the state + is changed to the new state given. If it isn't, then the action delegate is executed to + either Add or Attach the entity. + + A delegate to Add or Attach the entity. + The new state to give the entity if it is already in the context. + The entity. + Name of the method. + + + + Creates a new instance of an entity for the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The entity instance, which may be a proxy. + + + + Creates a new instance of an entity for the type of this set or for a type derived + from the type of this set. + Note that this instance is NOT added or attached to the set. + The instance returned will be a proxy if the underlying context is configured to create + proxies and the entity type meets the requirements for creating a proxy. + + The type of entity to create. + The entity instance, which may be a proxy. + + + + Performs lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that the query can be used. + This method is virtual so that it can be mocked. + + + + + Attempts to perform lazy initialization of the underlying ObjectContext, ObjectQuery, and EntitySet objects + so that o-space loading has happened and the query can be used. This method doesn't throw if the type + for the set is not mapped. + + + + + Creates an underlying for this set. + + if set to true then the query is set to be no-tracking. + The query. + + + + Returns a representation of the underlying query, equivalent + to ToTraceString on ObjectQuery. + + + The query string. + + + + + Updates the underlying ObjectQuery with the given include path. + + The include path. + A new query containing the defined include path. + + + + Returns a new query where the entities returned will not be cached in the . + + A new query with NoTracking applied. + + + + Executes the given SQL query against the database materializing entities into the entity set that + backs this set. + + The SQL quey. + if true then the entities are not tracked, otherwise they are. + The parameters. + The query results. + + + + Gets the enumeration of this query causing it to be executed against the store. + + An enumerator for the query + + + + Gets the ObservableCollection representing the local view for the set based on this query. + + + + + The underlying ObjectQuery. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet name. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet name, quoted for ESQL. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying EntitySet. Accessing this property will trigger lazy initialization of the query. + + + + + The base type for the underlying entity set. Accessing this property will trigger lazy initialization of the query. + + + + + The underlying InternalContext. Accessing this property will trigger lazy initialization of the query. + + + + + The LINQ query expression. + + + + + The LINQ query provider for the underlying . + + + + + A wrapping query provider that performs expression transformation and then delegates + to the provider. The objects returned + are always instances of when the generic CreateQuery method is + used and are instances of when the non-generic CreateQuery method + is used. This provider is associated with non-generic objects. + + + + + Creates a provider that wraps the given provider. + + The provider to wrap. + + + + Performs expression replacement and then delegates to the wrapped provider before wrapping + the returned as a . + + + + + Delegates to the wrapped provider except returns instances of . + + + + + Creates an appropriate generic IQueryable using Reflection and the underlying ElementType of + the given ObjectQuery. + + + + + Extends to create a sortable binding list that stays in + sync with an underlying . That is, when items are added + or removed from the binding list, they are added or removed from the ObservableCollecion, and + vice-versa. + + The list element type. + + + + An extended BindingList implementation that implements sorting. + This class was adapted from the LINQ to SQL class of the same name. + + The element type. + + + + Initializes a new instance of the class with the + the given underlying list. Note that sorting is dependent on having an actual + rather than some other ICollection implementation. + + The list. + + + + Applies sorting to the list. + + The property to sort by. + The sort direction. + + + + Stops sorting. + + + + + Gets a value indicating whether this list is sorted. + + + true if this instance is sorted; otherwise, false. + + + + + Gets the sort direction. + + The sort direction. + + + + Gets the sort property being used to sort. + + The sort property. + + + + Returns true indicating that this list supports sorting. + + true. + + + + Implements comparing for the implementation. + + + + + Initializes a new instance of the class + for sorting the list. + + The property to sort by. + The sort direction. + + + + Compares two instances of items in the list. + + The left item to compare. + The right item to compare. + + + + + Determines whether this instance can sort for the specified type. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Determines whether this instance can sort for the specified type using IComparable. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Determines whether this instance can sort for the specified type using ToString. + + The type. + + true if this instance can sort for the specified type; otherwise, false. + + + + + Initializes a new instance of a binding list backed by the given + + The obervable collection. + + + + Creates a new item to be added to the binding list. + + The new item. + + + + Cancels adding of a new item that was started with AddNew. + + Index of the item. + + + + Removes all items from the binding list and underlying ObservableCollection. + + + + + Ends the process of adding a new item that was started with AddNew. + + Index of the item. + + + + Inserts the item into the binding list at the given index. + + The index. + The item. + + + + Removes the item at the specified index. + + The index. + + + + Sets the item into the list at the given position. + + The index to insert at. + The item. + + + + Event handler to update the binding list when the underlying observable collection changes. + + The sender. + Data indicating how the collection has changed. + + + + Adds the item to the underlying observable collection. + + The item. + + + + Removes the item from the underlying from observable collection. + + The item. + + + + Adapted from to allow the initializer to take an input object and + to do one-time initialization that only has side-effects and doesn't return a value. + + The type of the input. + + + + Initializes a new instance of the class. + + The action. + + + + Performs the action unless it has already been successfully performed before. + + The input to the action; ignored if the action has already succeeded. + + + + Adapted from to allow the initializer to take an input object and + to retry initialization if it has previously failed. + + + This class can only be used to initialize reference types that will not be null when + initialized. + + The type of the input. + The type of the result. + + + + Initializes a new instance of the class. + + The value factory. + + + + Gets the value, possibly by running the initializer if it has not been run before or + if all previous times it ran resulted in exceptions. + + The input to the initializer; ignored if initialization has already succeeded. + The initialized object. + + + + Validates a property of a given EDM complex type. + + + This is a composite validator for a complex property of an entity. + + + + + Validates a property of a given EDM property type. + + + This is a composite validator for a property of an entity or a complex type. + + + + + Simple validators for the corresponding property. + + + + + Name of the property the validator was created for. + + + + + Creates an instance of for a given EDM property. + + The EDM property name. + Validators used to validate the given property. + + + + Validates a property. + + Validation context. Never null. + Property to validate. Never null. + Validation errors as . Empty if no errors. Never null. + + + + + Simple validators for the corresponding property. + + + + + Gets the name of the property the validator was created for. + + + + + The complex type validator. + + + + + Creates an instance of for a given complex property. + + The complex property name. + Validators used to validate the given property. + Complex type validator. + + + + Validates a complex property. + + Validation context. Never null. + Property to validate. Never null. + Validation errors as . Empty if no errors. Never null. + + + + + Validator used to validate a property of a given EDM ComplexType. + + + This is a composite validator. + + + + + Validator used to validate an entity of a given EDM Type. + + + This is a composite validator for an EDM Type. + + + + + Creates an instance for a given EDM type. + + Property validators. + Type level validators. + + + + Validates an instance. + + Entity validation context. Must not be null. + The entry for the complex property. Null if validating an entity. + instance. Never null. + + Protected so it doesn't appear on EntityValidator. + + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Returns a validator for a child property. + + Name of the child property for which to return a validator. + + Validator for a child property. Possibly null if there are no validators for requested property. + + + + + Creates an instance for a given EDM complex type. + + Property validators. + Type level validators. + + + + Validates an instance. + + Entity validation context. Must not be null. + The entry for the complex property. Null if validating an entity. + instance. Never null. + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Contains information needed to validate an entity or its properties. + + + + + The entity being validated or the entity that owns the property being validated. + + + + + Initializes a new instance of EntityValidationContext class. + + + The entity being validated or the entity that owns the property being validated. + + + External contexts needed for validation. + + + + + External context needed for validation. + + + + + Gets the entity being validated or the entity that owns the property being validated. + + + + + Validator used to validate an entity of a given EDM EntityType. + + + This is a top level, composite validator. This is also an entry point to getting an entity + validated as validation of an entity is always started by calling Validate method on this type. + + + + + Creates an instance for a given EDM entity type. + + Property validators. + Entity type level validators. + + + + Validates an entity. + + Entity validation context. Must not be null. + instance. Never null. + + + + Validates type properties. Any validation errors will be added to + collection. + + + Validation context. Must not be null. + + + Collection of validation errors. Any validation errors will be added to it. + + The entry for the complex property. Null if validating an entity. + + Note that will be modified by this method. Errors should be only added, + never removed or changed. Taking a collection as a modifiable parameter saves a couple of memory allocations + and a merge of validation error lists per entity. + + + + + Builds validators based on s specified on entity CLR types and properties + as well as based on presence of implementation on entity and complex + type CLR types. It's not sealed and not static for mocking purposes. + + + + + Builds an for the given . + + The entity entry to build the validator for. + Whether the currently processed type is the target type or one of the ancestor types. + + + for the given . Possibly null + if no validation has been specified for this entity type. + + + + + Builds the validator for a given and the corresponding + . + + The CLR type that corresponds to the EDM complex type. + The EDM complex type that type level validation is built for. + A for the given complex type. May be null if no validation specified. + + + + Extracted method from BuildEntityValidator and BuildComplexTypeValidator + + + + + Build validators for the and the corresponding + or . + + Properties to build validators for. + Non-navigation EDM properties. + Navigation EDM properties. + A list of validators. Possibly empty, never null. + + + + Builds a for the given and the corresponding + . If the property is a complex type, type level validators will be built here as + well. + + The CLR property to build the validator for. + The EDM property to build the validator for. + + for the given . Possibly null + if no validation has been specified for this property. + + + + + Builds a for the given transient . + + The CLR property to build the validator for. + + for the given . Possibly null + if no validation has been specified for this property. + + + + + Builds s for given that derive from + . + + Attributes used to build validators. + + A list of s built from . + Possibly empty, never null. + + + + + Returns all non-static non-indexed CLR properties from the . + + The CLR to get the properties from. + + A collection of CLR properties. Possibly empty, never null. + + + + + Builds validators based on the facets of : + * If .Nullable facet set to false adds a validator equivalent to the RequiredAttribute + * If the .MaxLength facet is specified adds a validator equivalent to the MaxLengthAttribute. + However the validator isn't added if .IsMaxLength has been set to true. + + The CLR property to build the facet validators for. + The property for which facet validators will be created + A collection of validators. + + + + Abstracts simple validators used to validate entities and properties. + + + + + Validates an entity or a property. + + Validation context. Never null. + Property to validate. Can be null for type level validation. + Validation error as. Empty if no errors. Never null. + + + + + Contract for IValidator.Validate method. + + Validation context. + Property. + Nothing - always throws. + + + + Validates entities or complex types implementing IValidatableObject interface. + + + + + Display attribute used to specify the display name for an entity or complex property. + + + + + Validates an entity or a complex type implementing IValidatableObject interface. + This method is virtual to allow mocking. + + Validation context. Never null. + + Property to validate. Null if this is the entity that will be validated. Never null if this + is the complex type that will be validated. + + Validation error as . Empty if no errors. Never null. + + + Note that is used to figure out what needs to be validated. If it not null the complex + type will be validated otherwise the entity will be validated. + Also if this is an IValidatableObject complex type but the instance (.CurrentValue) is null we won't validate + anything and will not return any errors. The reason for this is that Validation is supposed to validate using + information the user provided and not some additional implicit rules. (ObjectContext will throw for operations + that involve null complex properties). + + + + + Validates a property, complex property or an entity using validation attributes the property + or the complex/entity type is decorated with. + + + Note that this class is used for validating primitive properties using attributes declared on the property + (property level validation) and complex properties and entities using attributes declared on the type + (type level validation). + + + + + Display attribute used to specify the display name for a property or entity. + + + + + Validation attribute used to validate a property or an entity. + + + + + Creates an instance of class. + + + Validation attribute used to validate a property or an entity. + + + + + Validates a property or an entity. + + Validation context. Never null. + Property to validate. Null for entity validation. Not null for property validation. + + + Validation errors as . Empty if no errors, never null. + + + + + Used to cache and retrieve generated validators and to create context for validating entities or properties. + + + + + Collection of validators keyed by the entity CLR type. Note that if there's no validation for a given type + it will be associated with a null validator. + + + + + Initializes a new instance of class. + + + + + Returns a validator to validate . + + Entity the validator is requested for. + + to validate . Possibly null if no validation + has been specified for the entity. + + + + + Returns a validator to validate . + + Navigation property the validator is requested for. + + Validator to validate . Possibly null if no validation + has been specified for the requested property. + + + + + Gets a validator for the . + + Entity validator. + Property to get a validator for. + + Validator to validate . Possibly null if there is no validation for the + . + + + For complex properties this method walks up the type hierarchy to get to the entity level and then goes down + and gets a validator for the child property that is an ancestor of the property to validate. If a validator + returned for an ancestor is null it means that there is no validation defined beneath and the method just + propagates (and eventually returns) null. + + + + + Creates for . + + Entity entry for which a validation context needs to be created. + User defined dictionary containing additional info for custom validation. This parameter is optional and can be null. + An instance of class. + + + + + A wrapper around EntityKey that allows key/values pairs that have null values to + be used. This allows Added entities with null key values to be searched for in + the ObjectStateManager. + + + + The key name/key value pairs, where some key values may be null + + + + Creates a new WrappedEntityKey instance. + + The entity set that the key belongs to. + The fully qualified name of the given entity set. + The key values, which may be null or contain null values. + The name of the parameter passed for keyValue by the user, which is used when throwing exceptions. + + + + True if any of the key values are null, which means that the EntityKey will also be null. + + + + + An actual EntityKey, or null if any of the key values are null. + + + + + The key name/key value pairs of the key, in which some of the key values may be null. + + + + + Allows configuration to be performed for an complex type in a model. + + A ComplexTypeConfiguration can be obtained via the ComplexType method on + or a custom type derived from ComplexTypeConfiguration + can be registered via the Configurations property on . + + The complex type to be configured. + + + + Allows configuration to be performed for a type in a model. + + The type to be configured. + + + + Configures a property that is defined on this type. + + The type of the property being configured. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + The type of the property being configured. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Configures a property that is defined on this type. + + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to configure the property. + + + + Excludes a property from the model so that it will not be mapped to the database. + + The type of the property to be ignored. + + A lambda expression representing the property to be configured. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + + + + Initializes a new instance of ComplexTypeConfiguration + + + + + Allows derived configuration classes for entities and complex types to be registered with a . + + + Derived configuration classes are created by deriving from + or and using a type to be included in the model as the generic + parameter. + + Configuration can be performed without creating derived configuration classes via the Entity and ComplexType + methods on . + + + + + Adds an to the . + Only one can be added for each type in a model. + + The entity type being configured. + The entity type configuration to be added. + The same ConfigurationRegistrar instance so that multiple calls can be chained. + + + + Adds an to the . + Only one can be added for each type in a model. + + The complex type being configured. + The complex type configuration to be added + The same ConfigurationRegistrar instance so that multiple calls can be chained. + + + + Allows the conventions used by a instance to be customized. + Currently removal of one or more default conventions is the only supported operation. + The default conventions can be found in the System.Data.Entity.ModelConfiguration.Conventions namespace. + + + + + Disables a convention for the . + The default conventions that are available for removal can be found in the System.Data.Entity.ModelConfiguration.Conventions namespace. + + The type of the convention to be disabled. + + + + Configures the table and column mapping for an entity type or a sub-set of properties from an entity type. + This configuration functionality is available via the Code First Fluent API, see . + + The entity type to be mapped. + + + + Configures the properties that will be included in this mapping fragment. + If this method is not called then all properties that have not yet been + included in a mapping fragment will be configured. + + An anonymous type including the properties to be mapped. + + A lambda expression to an anonymous type that contains the properties to be mapped. + C#: t => new { t.Id, t.Property1, t.Property2 } + VB.Net: Function(t) New With { p.Id, t.Property1, t.Property2 } + + + + + Re-maps all properties inherited from base types. + + When configuring a derived type to be mapped to a separate table this will cause all properties to + be included in the table rather than just the non-inherited properties. This is known as + Table per Concrete Type (TPC) mapping. + + + + + Configures the table name to be mapped to. + + Name of the table. + + + + Configures the table name and schema to be mapped to. + + Name of the table. + Schema of the table. + + + + Configures the discriminator column used to differentiate between types in an inheritance hierarchy. + + The name of the discriminator column. + A configuration object to further configure the discriminator column and values. + + + + Configures the discriminator condition used to differentiate between types in an inheritance hierarchy. + + The type of the property being used to discriminate between types. + + A lambda expression representing the property being used to discriminate between types. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object to further configure the discriminator condition. + + + + Moves a foreign key constraint from oldTable to newTable and updates column references + + + + + Move any FK constraints that are now completely in newTable and used to refer to oldColumn + + + + + Configures a condition used to discriminate between types in an inheritance hierarchy based on the values assigned to a property. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the condition to require a value in the property. + + Rows that do not have a value assigned to column that this property is stored in are + assumed to be of the base type of this entity type. + + + + + Populate the table mapping structure + + + + + Sets nullability for association set mappings' foreign keys for 1:* and 1:0..1 associations + when no base types share the the association set mapping's table + + + + + Makes sure only the required property mappings are present + + + + + Determines if the table and entity type need mapping, and if not, removes the existing entity type mapping + + + + + Configures a database column used to store a string values. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the column to allow the maximum length supported by the database provider. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + + Configures the column to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be variable length. + Columns are variable length by default. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be optional. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to be required. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column. + + Name of the database provider specific data type. + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column. + + The order that this column should appear in the database table. + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures the column to support Unicode string content. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the column supports Unicode string content. + + + Value indicating if the column supports Unicode string content or not. + Specifying 'null' will remove the Unicode facet from the column. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringColumnConfiguration instance so that multiple calls can be chained. + + + + Configures a discriminator column used to differentiate between types in an inheritance hierarchy. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + Type of the discriminator value. + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + Type of the discriminator value. + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Configures the discriminator value used to identify the entity type being + configured from other types in the inheritance hierarchy. + + The value to be used to identify the entity type. + A configuration object to configure the column used to store discriminator values. + + + + Initializes configurations in the ModelConfiguration so that configuration data + is in a single place + + + + + Configures a many relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be many:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:required with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:required without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:optional with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be many:optional without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures an optional relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be optional:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:required with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:required without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + + A lambda expression representing the navigation property on the other end of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + A configuration object that can be used to further configure the relationship. + + + + Configures an required relationship from an entity type. + + The entity type that the relationship originates from. + The entity type that the relationship targets. + + + + Configures the relationship to be required:many with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:many without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:optional with a navigation property on the other side of the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:optional without a navigation property on the other side of the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required with a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required without a navigation property on the other side of the relationship. + The entity type being configured will be the dependent and contain a foreign key to the principal. + The entity type that the relationship targets will be the principal in the relationship. + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required with a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + + An lambda expression representing the navigation property on the other end of the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures the relationship to be required:required without a navigation property on the other side of the relationship. + The entity type being configured will be the principal in the relationship. + The entity type that the relationship targets will be the dependent and contain a foreign key to the principal. + + A configuration object that can be used to further configure the relationship. + + + + Base class for configuring a property on an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + True if the NavigationProperty's declaring type is the principal end, false if it is not, null if it is not known + + + + + Base class for performing configuration of a relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures a relationship that can support cascade on delete functionality. + + + + + Configures cascade delete to be on for the relationship. + + + + + Configures whether or not cascade delete is on for the relationship. + + Value indicating if cascade delete is on or not. + + + + Configures a relationship that can support foreign key properties that are exposed in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + The dependent entity type. + + + + Configures a relationship that can only support foreign key properties that are not exposed in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the relationship to use foreign key property(s) that are not exposed in the object model. + The column(s) and table can be customized by specifying a configuration action. + If an empty configuration action is specified then column name(s) will be generated by convention. + If foreign key properties are exposed in the object model then use the HasForeignKey method. + Not all relationships support exposing foreign key properties in the object model. + + Action that configures the foreign key column(s) and table. + + A configuration object that can be used to further configure the relationship. + + + + + Configures the relationship to use foreign key property(s) that are exposed in the object model. + If the foreign key property(s) are not exposed in the object model then use the Map method. + + The type of the key. + + A lambda expression representing the property to be used as the foreign key. + If the foreign key is made up of multiple properties then specify an anonymous type including the properties. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the principal entity type. + + A configuration object that can be used to further configure the relationship. + + + + Configures the table and column mapping of a relationship that does not expose foreign key properties in the object model. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the name of the column(s) for the foreign key. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table name that the foreign key column(s) reside in. + The table that is specified must already be mapped for the entity type. + + If you want the foreign key(s) to reside in their own table then use the Map method + on to perform + entity splitting to create the table with just the primary key property. Foreign keys can + then be added to the table via this method. + + Name of the table. + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table name and schema that the foreign key column(s) reside in. + The table that is specified must already be mapped for the entity type. + + If you want the foreign key(s) to reside in their own table then use the Map method + on to perform + entity splitting to create the table with just the primary key property. Foreign keys can + then be added to the table via this method. + + Name of the table. + Schema of the table. + The same ForeignKeyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the table and column mapping of a many:many relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the join table name for the relationship. + + Name of the table. + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the join table name and schema for the relationship. + + Name of the table. + Schema of the table. + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the column(s) for the left foreign key. + The left foreign key represents the navigation property specified in the HasMany call. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the column(s) for the right foreign key. + The right foreign key represents the navigation property specified in the WithMany call. + + + The foreign key column names. + When using multiple foreign key properties, the properties must be specified in the same order that the + the primary key properties were configured for the target entity type. + + The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained. + + + + Configures a many:many relationship. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the foreign key column(s) and table used to store the relationship. + + Action that configures the foreign key column(s) and table. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Used to configure a property with length facets for an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Used to configure a primitive property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same PrimitivePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to allow the maximum length supported by the database provider. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property and a default length will be used for the database column. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + Properties are variable length by default. + + The same LengthPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to allow the maximum length supported by the database provider. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + properties are variable length by default. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + properties are optional by default. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be a row version in the database. + The actual data type will vary depending on the database provider being used. + Setting the property to be a row version will automatically configure it to be an + optimistic concurrency token. + + The same BinaryPropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + properties are required by default. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the precision of the property. + If the database provider does not support precision for the data type of the column then the value is ignored. + + Precision of the property. + The same DateTimePropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + properties are required by default. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the precision and scale of the property. + + The precision of the property. + The scale of the property. + The same DecimalPropertyConfiguration instance so that multiple calls can be chained. + + + + Used to configure a property of an entity type or complex type. + This configuration functionality is available via the Code First Fluent API, see . + + + + + Configures the property to allow the maximum length supported by the database provider. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to have the specified maximum length. + + + The maximum length for the property. + Setting 'null' will remove any maximum length restriction from the property and a default length will be used for the database column.. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be fixed length. + Use HasMaxLength to set the length that the property is fixed to. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be variable length. + properties are variable length by default. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be optional. + The database column used to store this property will be nullable. + properties are optional by default. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be required. + The database column used to store this property will be non-nullable. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures how values for the property are generated by the database. + + + The pattern used to generate values for the property in the database. + Setting 'null' will remove the database generated pattern facet from the property. + Setting 'null' will cause the same runtime behavior as specifying 'None'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to be used as an optimistic concurrency token. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property is to be used as an optimistic concurrency token. + + + Value indicating if the property is a concurrency token or not. + Specifying 'null' will remove the concurrency token facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the name of the database column used to store the property. + + The name of the column. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the data type of the database column used to store the property. + + Name of the database provider specific data type. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the order of the database column used to store the property. + This method is also used to specify key ordering when an entity type has a composite key. + + The order that this column should appear in the database table. + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures the property to support Unicode string content. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Configures whether or not the property supports Unicode string content. + + + Value indicating if the property supports Unicode string content or not. + Specifying 'null' will remove the Unicode facet from the property. + Specifying 'null' will cause the same runtime behavior as specifying 'false'. + + The same StringPropertyConfiguration instance so that multiple calls can be chained. + + + + Indicates what parts of a configuration are overridable. + + + + + Nothing in the configuration is overridable. + + + + + The configuration values related to C-Space are overridable. + + + + + The configuration values only related to S-Space are overridable. + + + + + True if this configuration can be replaced in the model configuration, false otherwise + This is only set to true for configurations that are registered automatically via the DbContext + + + + + Base class for conventions that process CLR attributes found in the model. + + The type of member to look for. + The type of the configuration to look for. + The type of the attribute to look for. + + + + Convention to process instances of found on properties in the model + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on foreign key properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on navigation properties in the model. + + + + + Convention to process instances of found on primitive properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on properties in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to process instances of found on types in the model. + + + + + Convention to detect navigation properties to be inverses of each other when only one pair + of navigation properties exists between the related types. + + + + + Convention to configure a type as a complex type if it has no primary key, no mapped base type and no navigation properties. + + + + + Convention to convert any data types that were explicitly specified, via data annotations or API, + to be lower case. The default SqlClient provider is case sensitive and requires data types to be lower case. This convention + allows the and API to be case insensitive. + + + + + Convention to add a cascade delete to the join table from both tables involved in a many to many relationship. + + + + + Convention to ensure an invalid/unsupported mapping is not created when mapping inherited properties + + + + + Convention to set the table name to be a pluralized version of the entity type name. + + + + + Convention to set precision to 18 and scale to 2 for decimal properties. + + + + + Convention to move primary key properties to appear first. + + + + + Convention to distinguish between optional and required relationships based on CLR nullability of the foreign key property. + + + + + Convention to process instances of found on navigation properties in the model. + + + + + Convention to detect primary key properties. + Recognized naming patterns in order of precedence are: + 1. 'Id' + 2. [type name]Id + Primary key detection is case insensitive. + + + + + Convention to discover foreign key properties whose names are a combination + of the dependent navigation property name and the principal type primary key property name(s). + + + + + Convention to enable cascade delete for any required relationships. + + + + + Convention to configure the primary key(s) of the dependent entity type as foreign key(s) in a one:one relationship. + + + + + Convention to set the entity set name to be a pluralized version of the entity type name. + + + + + Convention to discover foreign key properties whose names match the principal type primary key property name(s). + + + + + Convention to set a default maximum length of 128 for properties whose type supports length facets. + + + + + Convention to set a default maximum length of 4000 for properties whose type supports length facets when SqlCe is the provider. + + + + + Convention to configure integer primary keys to be identity. + + + + + Checks for the PK property being an FK in a different table. A PK which is also an FK but + in the same table is used for table splitting and can still be an identity column because + the update pipeline is only inserting into one column of one table. + + + + + Convention to discover foreign key properties whose names are a combination + of the principal type name and the principal type primary key property name(s). + + + + + This class provide service for both the singularization and pluralization, it takes the word pairs + in the ctor following the rules that the first one is singular and the second one is plural. + + + + + Factory method for PluralizationService. Only support english pluralization. + Please set the PluralizationService on the System.Data.Entity.Design.EntityModelSchemaGenerator + to extend the service to other locales. + + CultureInfo + PluralizationService + + + + captalize the return word if the parameter is capitalized + if word is "Table", then return "Tables" + + + + + + + + separate one combine word in to two parts, prefix word and the last word(suffix word) + + + + + + + + return true when the word is "[\s]*" or leading or tailing with spaces + or contains non alphabetical characters + + + + + + + This method allow you to add word to internal PluralizationService of English. + If the singluar or the plural value was already added by this method, then an ArgumentException will be thrown. + + + + + + + Attempt to determine the principal and dependent ends of this association. + + The following table illustrates the solution space. + + Source | Target || Prin | Dep | + -------|--------||-------|-------| + 1 | 1 || - | - | + 1 | 0..1 || Sr | Ta | + 1 | * || Sr | Ta | + 0..1 | 1 || Ta | Sr | + 0..1 | 0..1 || - | - | + 0..1 | * || Sr | Ta | + * | 1 || Ta | Sr | + * | 0..1 || Ta | Sr | + * | * || - | - | + + + + + Allows configuration to be performed for an entity type in a model. + + An EntityTypeConfiguration can be obtained via the Entity method on + or a custom type derived from EntityTypeConfiguration + can be registered via the Configurations property on . + + + + + Initializes a new instance of EntityTypeConfiguration + + + + + Configures the primary key property(s) for this entity type. + + The type of the key. + + A lambda expression representing the property to be used as the primary key. + C#: t => t.Id + VB.Net: Function(t) t.Id + + If the primary key is made up of multiple properties then specify an anonymous type including the properties. + C#: t => new { t.Id1, t.Id2 } + VB.Net: Function(t) New With { t.Id1, t.Id2 } + + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures the entity set name to be used for this entity type. + The entity set name can only be configured for the base type in each set. + + The name of the entity set. + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures the table name that this entity type is mapped to. + + The name of the table. + + + + Configures the table name that this entity type is mapped to. + + The name of the table. + The database schema of the table. + + + + Allows advanced configuration related to how this entity type is mapped to the database schema. + By default, any configuration will also apply to any type derived from this entity type. + + Derived types can be configured via the overload of Map that configures a derived type or + by using an EntityTypeConfiguration for the derived type. + + The properties of an entity can be split between multiple tables using multiple Map calls. + + Calls to Map are additive, subsequent calls will not override configuration already preformed via Map. + + An action that performs configuration against an . + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Allows advanced configuration related to how a derived entity type is mapped to the database schema. + Calls to Map are additive, subsequent calls will not override configuration already preformed via Map. + + The derived entity type to be configured. + An action that performs configuration against an . + The same EntityTypeConfiguration instance so that multiple calls can be chained. + + + + Configures an optional relationship from this entity type. + Instances of the entity type will be able to be saved to the database without this relationship being specified. + The foreign key in the database will be nullable. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures a required relationship from this entity type. + Instances of the entity type will not be able to be saved to the database unless this relationship is specified. + The foreign key in the database will be non-nullable. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Configures a many relationship from this entity type. + + The type of the entity at the other end of the relationship. + + A lambda expression representing the navigation property for the relationship. + C#: t => t.MyProperty + VB.Net: Function(t) t.MyProperty + + A configuration object that can be used to further configure the relationship. + + + + Handles mapping from a CLR property to an EDM assocation and nav. prop. + + + + + Exception thrown by during model creation when an invalid model is generated. + + + + + Initializes a new instance of ModelValidationException + + + + + Initializes a new instance of ModelValidationException + + The exception message. + + + + Initializes a new instance of ModelValidationException + + The exception message. + The inner exception. + + + + Code Contracts hook methods - Called when contracts fail. Here we detect the most common preconditions + so we can throw the correct exceptions. It also means that we can write preconditions using the + simplest Contract.Requires() form. + + + + + Returns true if a variable of this type can be assigned a null value + + + + True if a reference type or a nullable value type, + false otherwise + + + + + Exception thrown from when validating entities fails. + + + + + Initializes a new instance of DbEntityValidationException + + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + Validation results. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + The inner exception. + + + + Initializes a new instance of DbEntityValidationException + + The exception message. + Validation results. + The inner exception. + + + + Subscribes the SerializeObjectState event. + + + + + Validation results. + + + + + Holds exception state that will be serialized when the exception is serialized. + + + + + Validation results. + + + + + Completes the deserialization. + + The deserialized object. + + + + Validation results. + + + + + Represents validation results for single entity. + + + + + Entity entry the results applies to. Never null. + + + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Creates an instance of class. + + + Entity entry the results applies to. Never null. + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Creates an instance of class. + + + Entity entry the results applies to. Never null. + + + List of instances. Never null. Can be empty meaning the entity is valid. + + + + + Gets an instance of the results applies to. + + + + + Gets validation errors. Never null. + + + + + Gets an indicator if the entity is valid. + + + + + Exception thrown from when an exception is thrown from the validation + code. + + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + + + + Initializes a new instance of DbUnexpectedValidationException + + The exception message. + The inner exception. + + + + Initializes a new instance of DbUnexpectedValidationException with the specified serialization info and + context. + + The serialization info. + The streaming context. + + + + Validation error. Can be either entity or property level validation error. + + + + + Name of the invalid property. Can be null (e.g. for entity level validations) + + + + + Validation error message. + + + + + Creates an instance of . + + Name of the invalid property. Can be null. + Validation error message. Can be null. + + + + Gets name of the invalid property. + + + + + Gets validation error message. + + + + diff --git a/Website/LOC.Website.Tests/bin/Release/LOC.Core.dll b/Website/LOC.Website.Tests/bin/Release/LOC.Core.dll new file mode 100644 index 000000000..e4c321427 Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Release/LOC.Core.dll differ diff --git a/Website/LOC.Website.Tests/bin/Release/LOC.Core.pdb b/Website/LOC.Website.Tests/bin/Release/LOC.Core.pdb new file mode 100644 index 000000000..ec97895a6 Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Release/LOC.Core.pdb differ diff --git a/Website/LOC.Website.Tests/bin/Release/LOC.Website.Common.dll b/Website/LOC.Website.Tests/bin/Release/LOC.Website.Common.dll new file mode 100644 index 000000000..8e5918a8a Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Release/LOC.Website.Common.dll differ diff --git a/Website/LOC.Website.Tests/bin/Release/LOC.Website.Common.pdb b/Website/LOC.Website.Tests/bin/Release/LOC.Website.Common.pdb new file mode 100644 index 000000000..b636f7a97 Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Release/LOC.Website.Common.pdb differ diff --git a/Website/LOC.Website.Tests/bin/Release/LOC.Website.Tests.dll b/Website/LOC.Website.Tests/bin/Release/LOC.Website.Tests.dll new file mode 100644 index 000000000..6e1271095 Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Release/LOC.Website.Tests.dll differ diff --git a/Website/LOC.Website.Tests/bin/Release/LOC.Website.Tests.pdb b/Website/LOC.Website.Tests/bin/Release/LOC.Website.Tests.pdb new file mode 100644 index 000000000..dc05f4d47 Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Release/LOC.Website.Tests.pdb differ diff --git a/Website/LOC.Website.Tests/bin/Release/Moq.dll b/Website/LOC.Website.Tests/bin/Release/Moq.dll new file mode 100644 index 000000000..3a3e653aa Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Release/Moq.dll differ diff --git a/Website/LOC.Website.Tests/bin/Release/Moq.xml b/Website/LOC.Website.Tests/bin/Release/Moq.xml new file mode 100644 index 000000000..13b8804b5 --- /dev/null +++ b/Website/LOC.Website.Tests/bin/Release/Moq.xml @@ -0,0 +1,5120 @@ + + + + Moq + + + + + Implements the fluent API. + + + + + The expectation will be considered only in the former condition. + + + + + + + The expectation will be considered only in the former condition. + + + + + + + + Setups the get. + + The type of the property. + The expression. + + + + + Setups the set. + + The type of the property. + The setter expression. + + + + + Setups the set. + + The setter expression. + + + + + Defines the Callback verb and overloads. + + + + + Helper interface used to hide the base + members from the fluent API to make it much cleaner + in Visual Studio intellisense. + + + + + + + + + + + + + + + + + Specifies a callback to invoke when the method is called. + + The callback method to invoke. + + The following example specifies a callback to set a boolean + value that can be used later: + + var called = false; + mock.Setup(x => x.Execute()) + .Callback(() => called = true); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The argument type of the invoked method. + The callback method to invoke. + + Invokes the given callback with the concrete invocation argument value. + + Notice how the specific string argument is retrieved by simply declaring + it as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute(It.IsAny<string>())) + .Callback((string command) => Console.WriteLine(command)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2) => Console.WriteLine(arg1 + arg2)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3) => Console.WriteLine(arg1 + arg2 + arg3)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The type of the fifteenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15)); + + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The type of the fifteenth argument of the invoked method. + The type of the sixteenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15, string arg16) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16)); + + + + + + Defines the Callback verb and overloads for callbacks on + setups that return a value. + + Mocked type. + Type of the return value of the setup. + + + + Specifies a callback to invoke when the method is called. + + The callback method to invoke. + + The following example specifies a callback to set a boolean value that can be used later: + + var called = false; + mock.Setup(x => x.Execute()) + .Callback(() => called = true) + .Returns(true); + + Note that in the case of value-returning methods, after the Callback + call you can still specify the return value. + + + + + Specifies a callback to invoke when the method is called that receives the original arguments. + + The type of the argument of the invoked method. + Callback method to invoke. + + Invokes the given callback with the concrete invocation argument value. + + Notice how the specific string argument is retrieved by simply declaring + it as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute(It.IsAny<string>())) + .Callback(command => Console.WriteLine(command)) + .Returns(true); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2) => Console.WriteLine(arg1 + arg2)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3) => Console.WriteLine(arg1 + arg2 + arg3)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The type of the fifteenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15)); + + + + + + Specifies a callback to invoke when the method is called that receives the original + arguments. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The type of the fifteenth argument of the invoked method. + The type of the sixteenth argument of the invoked method. + The callback method to invoke. + A reference to interface. + + Invokes the given callback with the concrete invocation arguments values. + + Notice how the specific arguments are retrieved by simply declaring + them as part of the lambda expression for the callback: + + + mock.Setup(x => x.Execute( + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>(), + It.IsAny<string>())) + .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16)); + + + + + + Defines the Raises verb. + + + + + Specifies the event that will be raised + when the setup is met. + + An expression that represents an event attach or detach action. + The event arguments to pass for the raised event. + + The following example shows how to raise an event when + the setup is met: + + var mock = new Mock<IContainer>(); + + mock.Setup(add => add.Add(It.IsAny<string>(), It.IsAny<object>())) + .Raises(add => add.Added += null, EventArgs.Empty); + + + + + + Specifies the event that will be raised + when the setup is matched. + + An expression that represents an event attach or detach action. + A function that will build the + to pass when raising the event. + + + + + Specifies the custom event that will be raised + when the setup is matched. + + An expression that represents an event attach or detach action. + The arguments to pass to the custom delegate (non EventHandler-compatible). + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + The type of the nineth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + The type of the nineth argument received by the expected invocation. + The type of the tenth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + The type of the nineth argument received by the expected invocation. + The type of the tenth argument received by the expected invocation. + The type of the eleventh argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + The type of the nineth argument received by the expected invocation. + The type of the tenth argument received by the expected invocation. + The type of the eleventh argument received by the expected invocation. + The type of the twelfth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + The type of the nineth argument received by the expected invocation. + The type of the tenth argument received by the expected invocation. + The type of the eleventh argument received by the expected invocation. + The type of the twelfth argument received by the expected invocation. + The type of the thirteenth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + The type of the nineth argument received by the expected invocation. + The type of the tenth argument received by the expected invocation. + The type of the eleventh argument received by the expected invocation. + The type of the twelfth argument received by the expected invocation. + The type of the thirteenth argument received by the expected invocation. + The type of the fourteenth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + The type of the nineth argument received by the expected invocation. + The type of the tenth argument received by the expected invocation. + The type of the eleventh argument received by the expected invocation. + The type of the twelfth argument received by the expected invocation. + The type of the thirteenth argument received by the expected invocation. + The type of the fourteenth argument received by the expected invocation. + The type of the fifteenth argument received by the expected invocation. + + + + + Specifies the event that will be raised when the setup is matched. + + The expression that represents an event attach or detach action. + The function that will build the + to pass when raising the event. + The type of the first argument received by the expected invocation. + The type of the second argument received by the expected invocation. + The type of the third argument received by the expected invocation. + The type of the fourth argument received by the expected invocation. + The type of the fifth argument received by the expected invocation. + The type of the sixth argument received by the expected invocation. + The type of the seventh argument received by the expected invocation. + The type of the eighth argument received by the expected invocation. + The type of the nineth argument received by the expected invocation. + The type of the tenth argument received by the expected invocation. + The type of the eleventh argument received by the expected invocation. + The type of the twelfth argument received by the expected invocation. + The type of the thirteenth argument received by the expected invocation. + The type of the fourteenth argument received by the expected invocation. + The type of the fifteenth argument received by the expected invocation. + The type of the sixteenth argument received by the expected invocation. + + + + + Defines the Returns verb. + + Mocked type. + Type of the return value from the expression. + + + + Specifies the value to return. + + The value to return, or . + + Return a true value from the method call: + + mock.Setup(x => x.Execute("ping")) + .Returns(true); + + + + + + Specifies a function that will calculate the value to return from the method. + + The function that will calculate the return value. + + Return a calculated value when the method is called: + + mock.Setup(x => x.Execute("ping")) + .Returns(() => returnValues[0]); + + The lambda expression to retrieve the return value is lazy-executed, + meaning that its value may change depending on the moment the method + is executed and the value the returnValues array has at + that moment. + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the argument of the invoked method. + The function that will calculate the return value. + + Return a calculated value which is evaluated lazily at the time of the invocation. + + The lookup list can change between invocations and the setup + will return different values accordingly. Also, notice how the specific + string argument is retrieved by simply declaring it as part of the lambda + expression: + + + mock.Setup(x => x.Execute(It.IsAny<string>())) + .Returns((string command) => returnValues[command]); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2) => arg1 + arg2); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3) => arg1 + arg2 + arg3); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4) => arg1 + arg2 + arg3 + arg4); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5) => arg1 + arg2 + arg3 + arg4 + arg5); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The type of the fifteenth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15); + + + + + + Specifies a function that will calculate the value to return from the method, + retrieving the arguments for the invocation. + + The type of the first argument of the invoked method. + The type of the second argument of the invoked method. + The type of the third argument of the invoked method. + The type of the fourth argument of the invoked method. + The type of the fifth argument of the invoked method. + The type of the sixth argument of the invoked method. + The type of the seventh argument of the invoked method. + The type of the eighth argument of the invoked method. + The type of the nineth argument of the invoked method. + The type of the tenth argument of the invoked method. + The type of the eleventh argument of the invoked method. + The type of the twelfth argument of the invoked method. + The type of the thirteenth argument of the invoked method. + The type of the fourteenth argument of the invoked method. + The type of the fifteenth argument of the invoked method. + The type of the sixteenth argument of the invoked method. + The function that will calculate the return value. + Returns a calculated value which is evaluated lazily at the time of the invocation. + + + The return value is calculated from the value of the actual method invocation arguments. + Notice how the arguments are retrieved by simply declaring them as part of the lambda + expression: + + + mock.Setup(x => x.Execute( + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>(), + It.IsAny<int>())) + .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15, string arg16) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16); + + + + + + Language for ReturnSequence + + + + + Returns value + + + + + Throws an exception + + + + + Throws an exception + + + + + The first method call or member access will be the + last segment of the expression (depth-first traversal), + which is the one we have to Setup rather than FluentMock. + And the last one is the one we have to Mock.Get rather + than FluentMock. + + + + + Base class for mocks and static helper class with methods that + apply to mocked objects, such as to + retrieve a from an object instance. + + + + + Creates an mock object of the indicated type. + + The type of the mocked object. + The mocked object created. + + + + Creates an mock object of the indicated type. + + The predicate with the specification of how the mocked object should behave. + The type of the mocked object. + The mocked object created. + + + + Initializes a new instance of the class. + + + + + Retrieves the mock object for the given object instance. + + Type of the mock to retrieve. Can be omitted as it's inferred + from the object instance passed in as the instance. + The instance of the mocked object.The mock associated with the mocked object. + The received instance + was not created by Moq. + + The following example shows how to add a new setup to an object + instance which is not the original but rather + the object associated with it: + + // Typed instance, not the mock, is retrieved from some test API. + HttpContextBase context = GetMockContext(); + + // context.Request is the typed object from the "real" API + // so in order to add a setup to it, we need to get + // the mock that "owns" it + Mock<HttpRequestBase> request = Mock.Get(context.Request); + mock.Setup(req => req.AppRelativeCurrentExecutionFilePath) + .Returns(tempUrl); + + + + + + Returns the mocked object value. + + + + + Verifies that all verifiable expectations have been met. + + This example sets up an expectation and marks it as verifiable. After + the mock is used, a Verify() call is issued on the mock + to ensure the method in the setup was invoked: + + var mock = new Mock<IWarehouse>(); + this.Setup(x => x.HasInventory(TALISKER, 50)).Verifiable().Returns(true); + ... + // other test code + ... + // Will throw if the test code has didn't call HasInventory. + this.Verify(); + + Not all verifiable expectations were met. + + + + Verifies all expectations regardless of whether they have + been flagged as verifiable. + + This example sets up an expectation without marking it as verifiable. After + the mock is used, a call is issued on the mock + to ensure that all expectations are met: + + var mock = new Mock<IWarehouse>(); + this.Setup(x => x.HasInventory(TALISKER, 50)).Returns(true); + ... + // other test code + ... + // Will throw if the test code has didn't call HasInventory, even + // that expectation was not marked as verifiable. + this.VerifyAll(); + + At least one expectation was not met. + + + + Gets the interceptor target for the given expression and root mock, + building the intermediate hierarchy of mock objects if necessary. + + + + + Raises the associated event with the given + event argument data. + + + + + Raises the associated event with the given + event argument data. + + + + + Adds an interface implementation to the mock, + allowing setups to be specified for it. + + This method can only be called before the first use + of the mock property, at which + point the runtime type has already been generated + and no more interfaces can be added to it. + + Also, must be an + interface and not a class, which must be specified + when creating the mock instead. + + + The mock type + has already been generated by accessing the property. + + The specified + is not an interface. + + The following example creates a mock for the main interface + and later adds to it to verify + it's called by the consumer code: + + var mock = new Mock<IProcessor>(); + mock.Setup(x => x.Execute("ping")); + + // add IDisposable interface + var disposable = mock.As<IDisposable>(); + disposable.Setup(d => d.Dispose()).Verifiable(); + + Type of interface to cast the mock to. + + + + + + + Behavior of the mock, according to the value set in the constructor. + + + + + Whether the base member virtual implementation will be called + for mocked classes if no setup is matched. Defaults to . + + + + + Specifies the behavior to use when returning default values for + unexpected invocations on loose mocks. + + + + + Gets the mocked object instance. + + + + + Retrieves the type of the mocked object, its generic type argument. + This is used in the auto-mocking of hierarchy access. + + + + + Specifies the class that will determine the default + value to return when invocations are made that + have no setups and need to return a default + value (for loose mocks). + + + + + Exposes the list of extra interfaces implemented by the mock. + + + + + Utility repository class to use to construct multiple + mocks when consistent verification is + desired for all of them. + + + If multiple mocks will be created during a test, passing + the desired (if different than the + or the one + passed to the repository constructor) and later verifying each + mock can become repetitive and tedious. + + This repository class helps in that scenario by providing a + simplified creation of multiple mocks with a default + (unless overriden by calling + ) and posterior verification. + + + + The following is a straightforward example on how to + create and automatically verify strict mocks using a : + + var repository = new MockRepository(MockBehavior.Strict); + + var foo = repository.Create<IFoo>(); + var bar = repository.Create<IBar>(); + + // no need to call Verifiable() on the setup + // as we'll be validating all of them anyway. + foo.Setup(f => f.Do()); + bar.Setup(b => b.Redo()); + + // exercise the mocks here + + repository.VerifyAll(); + // At this point all setups are already checked + // and an optional MockException might be thrown. + // Note also that because the mocks are strict, any invocation + // that doesn't have a matching setup will also throw a MockException. + + The following examples shows how to setup the repository + to create loose mocks and later verify only verifiable setups: + + var repository = new MockRepository(MockBehavior.Loose); + + var foo = repository.Create<IFoo>(); + var bar = repository.Create<IBar>(); + + // this setup will be verified when we verify the repository + foo.Setup(f => f.Do()).Verifiable(); + + // this setup will NOT be verified + foo.Setup(f => f.Calculate()); + + // this setup will be verified when we verify the repository + bar.Setup(b => b.Redo()).Verifiable(); + + // exercise the mocks here + // note that because the mocks are Loose, members + // called in the interfaces for which no matching + // setups exist will NOT throw exceptions, + // and will rather return default values. + + repository.Verify(); + // At this point verifiable setups are already checked + // and an optional MockException might be thrown. + + The following examples shows how to setup the repository with a + default strict behavior, overriding that default for a + specific mock: + + var repository = new MockRepository(MockBehavior.Strict); + + // this particular one we want loose + var foo = repository.Create<IFoo>(MockBehavior.Loose); + var bar = repository.Create<IBar>(); + + // specify setups + + // exercise the mocks here + + repository.Verify(); + + + + + + + Utility factory class to use to construct multiple + mocks when consistent verification is + desired for all of them. + + + If multiple mocks will be created during a test, passing + the desired (if different than the + or the one + passed to the factory constructor) and later verifying each + mock can become repetitive and tedious. + + This factory class helps in that scenario by providing a + simplified creation of multiple mocks with a default + (unless overriden by calling + ) and posterior verification. + + + + The following is a straightforward example on how to + create and automatically verify strict mocks using a : + + var factory = new MockFactory(MockBehavior.Strict); + + var foo = factory.Create<IFoo>(); + var bar = factory.Create<IBar>(); + + // no need to call Verifiable() on the setup + // as we'll be validating all of them anyway. + foo.Setup(f => f.Do()); + bar.Setup(b => b.Redo()); + + // exercise the mocks here + + factory.VerifyAll(); + // At this point all setups are already checked + // and an optional MockException might be thrown. + // Note also that because the mocks are strict, any invocation + // that doesn't have a matching setup will also throw a MockException. + + The following examples shows how to setup the factory + to create loose mocks and later verify only verifiable setups: + + var factory = new MockFactory(MockBehavior.Loose); + + var foo = factory.Create<IFoo>(); + var bar = factory.Create<IBar>(); + + // this setup will be verified when we verify the factory + foo.Setup(f => f.Do()).Verifiable(); + + // this setup will NOT be verified + foo.Setup(f => f.Calculate()); + + // this setup will be verified when we verify the factory + bar.Setup(b => b.Redo()).Verifiable(); + + // exercise the mocks here + // note that because the mocks are Loose, members + // called in the interfaces for which no matching + // setups exist will NOT throw exceptions, + // and will rather return default values. + + factory.Verify(); + // At this point verifiable setups are already checked + // and an optional MockException might be thrown. + + The following examples shows how to setup the factory with a + default strict behavior, overriding that default for a + specific mock: + + var factory = new MockFactory(MockBehavior.Strict); + + // this particular one we want loose + var foo = factory.Create<IFoo>(MockBehavior.Loose); + var bar = factory.Create<IBar>(); + + // specify setups + + // exercise the mocks here + + factory.Verify(); + + + + + + + Initializes the factory with the given + for newly created mocks from the factory. + + The behavior to use for mocks created + using the factory method if not overriden + by using the overload. + + + + Creates a new mock with the default + specified at factory construction time. + + Type to mock. + A new . + + + var factory = new MockFactory(MockBehavior.Strict); + + var foo = factory.Create<IFoo>(); + // use mock on tests + + factory.VerifyAll(); + + + + + + Creates a new mock with the default + specified at factory construction time and with the + the given constructor arguments for the class. + + + The mock will try to find the best match constructor given the + constructor arguments, and invoke that to initialize the instance. + This applies only to classes, not interfaces. + + Type to mock. + Constructor arguments for mocked classes. + A new . + + + var factory = new MockFactory(MockBehavior.Default); + + var mock = factory.Create<MyBase>("Foo", 25, true); + // use mock on tests + + factory.Verify(); + + + + + + Creates a new mock with the given . + + Type to mock. + Behavior to use for the mock, which overrides + the default behavior specified at factory construction time. + A new . + + The following example shows how to create a mock with a different + behavior to that specified as the default for the factory: + + var factory = new MockFactory(MockBehavior.Strict); + + var foo = factory.Create<IFoo>(MockBehavior.Loose); + + + + + + Creates a new mock with the given + and with the the given constructor arguments for the class. + + + The mock will try to find the best match constructor given the + constructor arguments, and invoke that to initialize the instance. + This applies only to classes, not interfaces. + + Type to mock. + Behavior to use for the mock, which overrides + the default behavior specified at factory construction time. + Constructor arguments for mocked classes. + A new . + + The following example shows how to create a mock with a different + behavior to that specified as the default for the factory, passing + constructor arguments: + + var factory = new MockFactory(MockBehavior.Default); + + var mock = factory.Create<MyBase>(MockBehavior.Strict, "Foo", 25, true); + + + + + + Implements creation of a new mock within the factory. + + Type to mock. + The behavior for the new mock. + Optional arguments for the construction of the mock. + + + + Verifies all verifiable expectations on all mocks created + by this factory. + + + One or more mocks had expectations that were not satisfied. + + + + Verifies all verifiable expectations on all mocks created + by this factory. + + + One or more mocks had expectations that were not satisfied. + + + + Invokes for each mock + in , and accumulates the resulting + that might be + thrown from the action. + + The action to execute against + each mock. + + + + Whether the base member virtual implementation will be called + for mocked classes if no setup is matched. Defaults to . + + + + + Specifies the behavior to use when returning default values for + unexpected invocations on loose mocks. + + + + + Gets the mocks that have been created by this factory and + that will get verified together. + + + + + Access the universe of mocks of the given type, to retrieve those + that behave according to the LINQ query specification. + + The type of the mocked object to query. + + + + Access the universe of mocks of the given type, to retrieve those + that behave according to the LINQ query specification. + + The predicate with the setup expressions. + The type of the mocked object to query. + + + + Creates an mock object of the indicated type. + + The type of the mocked object. + The mocked object created. + + + + Creates an mock object of the indicated type. + + The predicate with the setup expressions. + The type of the mocked object. + The mocked object created. + + + + Creates the mock query with the underlying queriable implementation. + + + + + Wraps the enumerator inside a queryable. + + + + + Method that is turned into the actual call from .Query{T}, to + transform the queryable query into a normal enumerable query. + This method is never used directly by consumers. + + + + + Initializes the repository with the given + for newly created mocks from the repository. + + The behavior to use for mocks created + using the repository method if not overriden + by using the overload. + + + + A that returns an empty default value + for invocations that do not have setups or return values, with loose mocks. + This is the default behavior for a mock. + + + + + Interface to be implemented by classes that determine the + default value of non-expected invocations. + + + + + Defines the default value to return in all the methods returning . + The type of the return value.The value to set as default. + + + + Provides a value for the given member and arguments. + + The member to provide a default value for. + + + + + The intention of is to create a more readable + string representation for the failure message. + + + + + Implements the fluent API. + + + + + Defines the Throws verb. + + + + + Specifies the exception to throw when the method is invoked. + + Exception instance to throw. + + This example shows how to throw an exception when the method is + invoked with an empty string argument: + + mock.Setup(x => x.Execute("")) + .Throws(new ArgumentException()); + + + + + + Specifies the type of exception to throw when the method is invoked. + + Type of exception to instantiate and throw when the setup is matched. + + This example shows how to throw an exception when the method is + invoked with an empty string argument: + + mock.Setup(x => x.Execute("")) + .Throws<ArgumentException>(); + + + + + + Implements the fluent API. + + + + + Defines occurrence members to constraint setups. + + + + + The expected invocation can happen at most once. + + + + var mock = new Mock<ICommand>(); + mock.Setup(foo => foo.Execute("ping")) + .AtMostOnce(); + + + + + + The expected invocation can happen at most specified number of times. + + The number of times to accept calls. + + + var mock = new Mock<ICommand>(); + mock.Setup(foo => foo.Execute("ping")) + .AtMost( 5 ); + + + + + + Defines the Verifiable verb. + + + + + Marks the expectation as verifiable, meaning that a call + to will check if this particular + expectation was met. + + + The following example marks the expectation as verifiable: + + mock.Expect(x => x.Execute("ping")) + .Returns(true) + .Verifiable(); + + + + + + Marks the expectation as verifiable, meaning that a call + to will check if this particular + expectation was met, and specifies a message for failures. + + + The following example marks the expectation as verifiable: + + mock.Expect(x => x.Execute("ping")) + .Returns(true) + .Verifiable("Ping should be executed always!"); + + + + + + Implements the fluent API. + + + + + We need this non-generics base class so that + we can use from + generic code. + + + + + Implements the fluent API. + + + + + Implements the fluent API. + + + + + Implements the fluent API. + + + + + Defines the Callback verb for property getter setups. + + + Mocked type. + Type of the property. + + + + Specifies a callback to invoke when the property is retrieved. + + Callback method to invoke. + + Invokes the given callback with the property value being set. + + mock.SetupGet(x => x.Suspended) + .Callback(() => called = true) + .Returns(true); + + + + + + Implements the fluent API. + + + + + Defines the Returns verb for property get setups. + + Mocked type. + Type of the property. + + + + Specifies the value to return. + + The value to return, or . + + Return a true value from the property getter call: + + mock.SetupGet(x => x.Suspended) + .Returns(true); + + + + + + Specifies a function that will calculate the value to return for the property. + + The function that will calculate the return value. + + Return a calculated value when the property is retrieved: + + mock.SetupGet(x => x.Suspended) + .Returns(() => returnValues[0]); + + The lambda expression to retrieve the return value is lazy-executed, + meaning that its value may change depending on the moment the property + is retrieved and the value the returnValues array has at + that moment. + + + + + Implements the fluent API. + + + + + Helper class to setup a full trace between many mocks + + + + + Initialize a trace setup + + + + + Allow sequence to be repeated + + + + + define nice api + + + + + Perform an expectation in the trace. + + + + + Marks a method as a matcher, which allows complete replacement + of the built-in class with your own argument + matching rules. + + + This feature has been deprecated in favor of the new + and simpler . + + + The argument matching is used to determine whether a concrete + invocation in the mock matches a given setup. This + matching mechanism is fully extensible. + + + There are two parts of a matcher: the compiler matcher + and the runtime matcher. + + + Compiler matcher + Used to satisfy the compiler requirements for the + argument. Needs to be a method optionally receiving any arguments + you might need for the matching, but with a return type that + matches that of the argument. + + Let's say I want to match a lists of orders that contains + a particular one. I might create a compiler matcher like the following: + + + public static class Orders + { + [Matcher] + public static IEnumerable<Order> Contains(Order order) + { + return null; + } + } + + Now we can invoke this static method instead of an argument in an + invocation: + + var order = new Order { ... }; + var mock = new Mock<IRepository<Order>>(); + + mock.Setup(x => x.Save(Orders.Contains(order))) + .Throws<ArgumentException>(); + + Note that the return value from the compiler matcher is irrelevant. + This method will never be called, and is just used to satisfy the + compiler and to signal Moq that this is not a method that we want + to be invoked at runtime. + + + + Runtime matcher + + The runtime matcher is the one that will actually perform evaluation + when the test is run, and is defined by convention to have the + same signature as the compiler matcher, but where the return + value is the first argument to the call, which contains the + object received by the actual invocation at runtime: + + public static bool Contains(IEnumerable<Order> orders, Order order) + { + return orders.Contains(order); + } + + At runtime, the mocked method will be invoked with a specific + list of orders. This value will be passed to this runtime + matcher as the first argument, while the second argument is the + one specified in the setup (x.Save(Orders.Contains(order))). + + The boolean returned determines whether the given argument has been + matched. If all arguments to the expected method are matched, then + the setup matches and is evaluated. + + + + + + Using this extensible infrastructure, you can easily replace the entire + set of matchers with your own. You can also avoid the + typical (and annoying) lengthy expressions that result when you have + multiple arguments that use generics. + + + The following is the complete example explained above: + + public static class Orders + { + [Matcher] + public static IEnumerable<Order> Contains(Order order) + { + return null; + } + + public static bool Contains(IEnumerable<Order> orders, Order order) + { + return orders.Contains(order); + } + } + + And the concrete test using this matcher: + + var order = new Order { ... }; + var mock = new Mock<IRepository<Order>>(); + + mock.Setup(x => x.Save(Orders.Contains(order))) + .Throws<ArgumentException>(); + + // use mock, invoke Save, and have the matcher filter. + + + + + + Provides a mock implementation of . + + Any interface type can be used for mocking, but for classes, only abstract and virtual members can be mocked. + + The behavior of the mock with regards to the setups and the actual calls is determined + by the optional that can be passed to the + constructor. + + Type to mock, which can be an interface or a class. + The following example shows establishing setups with specific values + for method invocations: + + // Arrange + var order = new Order(TALISKER, 50); + var mock = new Mock<IWarehouse>(); + + mock.Setup(x => x.HasInventory(TALISKER, 50)).Returns(true); + + // Act + order.Fill(mock.Object); + + // Assert + Assert.True(order.IsFilled); + + The following example shows how to use the class + to specify conditions for arguments instead of specific values: + + // Arrange + var order = new Order(TALISKER, 50); + var mock = new Mock<IWarehouse>(); + + // shows how to expect a value within a range + mock.Setup(x => x.HasInventory( + It.IsAny<string>(), + It.IsInRange(0, 100, Range.Inclusive))) + .Returns(false); + + // shows how to throw for unexpected calls. + mock.Setup(x => x.Remove( + It.IsAny<string>(), + It.IsAny<int>())) + .Throws(new InvalidOperationException()); + + // Act + order.Fill(mock.Object); + + // Assert + Assert.False(order.IsFilled); + + + + + + Obsolete. + + + + + Obsolete. + + + + + Obsolete. + + + + + Obsolete. + + + + + Obsolete. + + + + + Ctor invoked by AsTInterface exclusively. + + + + + Initializes an instance of the mock with default behavior. + + var mock = new Mock<IFormatProvider>(); + + + + + Initializes an instance of the mock with default behavior and with + the given constructor arguments for the class. (Only valid when is a class) + + The mock will try to find the best match constructor given the constructor arguments, and invoke that + to initialize the instance. This applies only for classes, not interfaces. + + var mock = new Mock<MyProvider>(someArgument, 25); + Optional constructor arguments if the mocked type is a class. + + + + Initializes an instance of the mock with the specified behavior. + + var mock = new Mock<IFormatProvider>(MockBehavior.Relaxed); + Behavior of the mock. + + + + Initializes an instance of the mock with a specific behavior with + the given constructor arguments for the class. + + The mock will try to find the best match constructor given the constructor arguments, and invoke that + to initialize the instance. This applies only to classes, not interfaces. + + var mock = new Mock<MyProvider>(someArgument, 25); + Behavior of the mock.Optional constructor arguments if the mocked type is a class. + + + + Returns the mocked object value. + + + + + Specifies a setup on the mocked type for a call to + to a void method. + + If more than one setup is specified for the same method or property, + the latest one wins and is the one that will be executed. + Lambda expression that specifies the expected method invocation. + + var mock = new Mock<IProcessor>(); + mock.Setup(x => x.Execute("ping")); + + + + + + Specifies a setup on the mocked type for a call to + to a value returning method. + Type of the return value. Typically omitted as it can be inferred from the expression. + If more than one setup is specified for the same method or property, + the latest one wins and is the one that will be executed. + Lambda expression that specifies the method invocation. + + mock.Setup(x => x.HasInventory("Talisker", 50)).Returns(true); + + + + + + Specifies a setup on the mocked type for a call to + to a property getter. + + If more than one setup is set for the same property getter, + the latest one wins and is the one that will be executed. + Type of the property. Typically omitted as it can be inferred from the expression.Lambda expression that specifies the property getter. + + mock.SetupGet(x => x.Suspended) + .Returns(true); + + + + + + Specifies a setup on the mocked type for a call to + to a property setter. + + If more than one setup is set for the same property setter, + the latest one wins and is the one that will be executed. + + This overloads allows the use of a callback already + typed for the property type. + + Type of the property. Typically omitted as it can be inferred from the expression.The Lambda expression that sets a property to a value. + + mock.SetupSet(x => x.Suspended = true); + + + + + + Specifies a setup on the mocked type for a call to + to a property setter. + + If more than one setup is set for the same property setter, + the latest one wins and is the one that will be executed. + Lambda expression that sets a property to a value. + + mock.SetupSet(x => x.Suspended = true); + + + + + + Specifies that the given property should have "property behavior", + meaning that setting its value will cause it to be saved and + later returned when the property is requested. (this is also + known as "stubbing"). + + Type of the property, inferred from the property + expression (does not need to be specified). + Property expression to stub. + If you have an interface with an int property Value, you might + stub it using the following straightforward call: + + var mock = new Mock<IHaveValue>(); + mock.Stub(v => v.Value); + + After the Stub call has been issued, setting and + retrieving the object value will behave as expected: + + IHaveValue v = mock.Object; + + v.Value = 5; + Assert.Equal(5, v.Value); + + + + + + Specifies that the given property should have "property behavior", + meaning that setting its value will cause it to be saved and + later returned when the property is requested. This overload + allows setting the initial value for the property. (this is also + known as "stubbing"). + + Type of the property, inferred from the property + expression (does not need to be specified). + Property expression to stub.Initial value for the property. + If you have an interface with an int property Value, you might + stub it using the following straightforward call: + + var mock = new Mock<IHaveValue>(); + mock.SetupProperty(v => v.Value, 5); + + After the SetupProperty call has been issued, setting and + retrieving the object value will behave as expected: + + IHaveValue v = mock.Object; + // Initial value was stored + Assert.Equal(5, v.Value); + + // New value set which changes the initial value + v.Value = 6; + Assert.Equal(6, v.Value); + + + + + + Specifies that the all properties on the mock should have "property behavior", + meaning that setting its value will cause it to be saved and + later returned when the property is requested. (this is also + known as "stubbing"). The default value for each property will be the + one generated as specified by the property for the mock. + + If the mock is set to , + the mocked default values will also get all properties setup recursively. + + + + + + + + Verifies that a specific invocation matching the given expression was performed on the mock. Use + in conjuntion with the default . + + This example assumes that the mock has been used, and later we want to verify that a given + invocation with specific parameters was performed: + + var mock = new Mock<IProcessor>(); + // exercise mock + //... + // Will throw if the test code didn't call Execute with a "ping" string argument. + mock.Verify(proc => proc.Execute("ping")); + + The invocation was not performed on the mock.Expression to verify. + + + + Verifies that a specific invocation matching the given expression was performed on the mock. Use + in conjuntion with the default . + + The invocation was not call the times specified by + . + Expression to verify.The number of times a method is allowed to be called. + + + + Verifies that a specific invocation matching the given expression was performed on the mock, + specifying a failure error message. Use in conjuntion with the default + . + + This example assumes that the mock has been used, and later we want to verify that a given + invocation with specific parameters was performed: + + var mock = new Mock<IProcessor>(); + // exercise mock + //... + // Will throw if the test code didn't call Execute with a "ping" string argument. + mock.Verify(proc => proc.Execute("ping")); + + The invocation was not performed on the mock.Expression to verify.Message to show if verification fails. + + + + Verifies that a specific invocation matching the given expression was performed on the mock, + specifying a failure error message. Use in conjuntion with the default + . + + The invocation was not call the times specified by + . + Expression to verify.The number of times a method is allowed to be called.Message to show if verification fails. + + + + Verifies that a specific invocation matching the given expression was performed on the mock. Use + in conjuntion with the default . + + This example assumes that the mock has been used, and later we want to verify that a given + invocation with specific parameters was performed: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't call HasInventory. + mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50)); + + The invocation was not performed on the mock.Expression to verify.Type of return value from the expression. + + + + Verifies that a specific invocation matching the given + expression was performed on the mock. Use in conjuntion + with the default . + + The invocation was not call the times specified by + . + Expression to verify.The number of times a method is allowed to be called.Type of return value from the expression. + + + + Verifies that a specific invocation matching the given + expression was performed on the mock, specifying a failure + error message. + + This example assumes that the mock has been used, + and later we want to verify that a given invocation + with specific parameters was performed: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't call HasInventory. + mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50), "When filling orders, inventory has to be checked"); + + The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.Type of return value from the expression. + + + + Verifies that a specific invocation matching the given + expression was performed on the mock, specifying a failure + error message. + + The invocation was not call the times specified by + . + Expression to verify.The number of times a method is allowed to be called.Message to show if verification fails.Type of return value from the expression. + + + + Verifies that a property was read on the mock. + + This example assumes that the mock has been used, + and later we want to verify that a given property + was retrieved from it: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't retrieve the IsClosed property. + mock.VerifyGet(warehouse => warehouse.IsClosed); + + The invocation was not performed on the mock.Expression to verify. + Type of the property to verify. Typically omitted as it can + be inferred from the expression's return type. + + + + + Verifies that a property was read on the mock. + + The invocation was not call the times specified by + . + The number of times a method is allowed to be called.Expression to verify. + Type of the property to verify. Typically omitted as it can + be inferred from the expression's return type. + + + + + Verifies that a property was read on the mock, specifying a failure + error message. + + This example assumes that the mock has been used, + and later we want to verify that a given property + was retrieved from it: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't retrieve the IsClosed property. + mock.VerifyGet(warehouse => warehouse.IsClosed); + + The invocation was not performed on the mock.Expression to verify.Message to show if verification fails. + Type of the property to verify. Typically omitted as it can + be inferred from the expression's return type. + + + + + Verifies that a property was read on the mock, specifying a failure + error message. + + The invocation was not call the times specified by + . + The number of times a method is allowed to be called.Expression to verify.Message to show if verification fails. + Type of the property to verify. Typically omitted as it can + be inferred from the expression's return type. + + + + + Verifies that a property was set on the mock. + + This example assumes that the mock has been used, + and later we want to verify that a given property + was set on it: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't set the IsClosed property. + mock.VerifySet(warehouse => warehouse.IsClosed = true); + + The invocation was not performed on the mock.Expression to verify. + + + + Verifies that a property was set on the mock. + + The invocation was not call the times specified by + . + The number of times a method is allowed to be called.Expression to verify. + + + + Verifies that a property was set on the mock, specifying + a failure message. + + This example assumes that the mock has been used, + and later we want to verify that a given property + was set on it: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't set the IsClosed property. + mock.VerifySet(warehouse => warehouse.IsClosed = true, "Warehouse should always be closed after the action"); + + The invocation was not performed on the mock.Expression to verify.Message to show if verification fails. + + + + Verifies that a property was set on the mock, specifying + a failure message. + + The invocation was not call the times specified by + . + The number of times a method is allowed to be called.Expression to verify.Message to show if verification fails. + + + + Raises the event referenced in using + the given argument. + + The argument is + invalid for the target event invocation, or the is + not an event attach or detach expression. + + The following example shows how to raise a event: + + var mock = new Mock<IViewModel>(); + + mock.Raise(x => x.PropertyChanged -= null, new PropertyChangedEventArgs("Name")); + + + This example shows how to invoke an event with a custom event arguments + class in a view that will cause its corresponding presenter to + react by changing its state: + + var mockView = new Mock<IOrdersView>(); + var presenter = new OrdersPresenter(mockView.Object); + + // Check that the presenter has no selection by default + Assert.Null(presenter.SelectedOrder); + + // Raise the event with a specific arguments data + mockView.Raise(v => v.SelectionChanged += null, new OrderEventArgs { Order = new Order("moq", 500) }); + + // Now the presenter reacted to the event, and we have a selected order + Assert.NotNull(presenter.SelectedOrder); + Assert.Equal("moq", presenter.SelectedOrder.ProductName); + + + + + + Raises the event referenced in using + the given argument for a non-EventHandler typed event. + + The arguments are + invalid for the target event invocation, or the is + not an event attach or detach expression. + + The following example shows how to raise a custom event that does not adhere to + the standard EventHandler: + + var mock = new Mock<IViewModel>(); + + mock.Raise(x => x.MyEvent -= null, "Name", bool, 25); + + + + + + Exposes the mocked object instance. + + + + + Provides legacy API members as extensions so that + existing code continues to compile, but new code + doesn't see then. + + + + + Obsolete. + + + + + Obsolete. + + + + + Obsolete. + + + + + Provides additional methods on mocks. + + + Provided as extension methods as they confuse the compiler + with the overloads taking Action. + + + + + Specifies a setup on the mocked type for a call to + to a property setter, regardless of its value. + + + If more than one setup is set for the same property setter, + the latest one wins and is the one that will be executed. + + Type of the property. Typically omitted as it can be inferred from the expression. + Type of the mock. + The target mock for the setup. + Lambda expression that specifies the property setter. + + + mock.SetupSet(x => x.Suspended); + + + + This method is not legacy, but must be on an extension method to avoid + confusing the compiler with the new Action syntax. + + + + + Verifies that a property has been set on the mock, regarless of its value. + + + This example assumes that the mock has been used, + and later we want to verify that a given invocation + with specific parameters was performed: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't set the IsClosed property. + mock.VerifySet(warehouse => warehouse.IsClosed); + + + The invocation was not performed on the mock. + Expression to verify. + The mock instance. + Mocked type. + Type of the property to verify. Typically omitted as it can + be inferred from the expression's return type. + + + + Verifies that a property has been set on the mock, specifying a failure + error message. + + + This example assumes that the mock has been used, + and later we want to verify that a given invocation + with specific parameters was performed: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't set the IsClosed property. + mock.VerifySet(warehouse => warehouse.IsClosed); + + + The invocation was not performed on the mock. + Expression to verify. + Message to show if verification fails. + The mock instance. + Mocked type. + Type of the property to verify. Typically omitted as it can + be inferred from the expression's return type. + + + + Verifies that a property has been set on the mock, regardless + of the value but only the specified number of times. + + + This example assumes that the mock has been used, + and later we want to verify that a given invocation + with specific parameters was performed: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't set the IsClosed property. + mock.VerifySet(warehouse => warehouse.IsClosed); + + + The invocation was not performed on the mock. + The invocation was not call the times specified by + . + The mock instance. + Mocked type. + The number of times a method is allowed to be called. + Expression to verify. + Type of the property to verify. Typically omitted as it can + be inferred from the expression's return type. + + + + Verifies that a property has been set on the mock, regardless + of the value but only the specified number of times, and specifying a failure + error message. + + + This example assumes that the mock has been used, + and later we want to verify that a given invocation + with specific parameters was performed: + + var mock = new Mock<IWarehouse>(); + // exercise mock + //... + // Will throw if the test code didn't set the IsClosed property. + mock.VerifySet(warehouse => warehouse.IsClosed); + + + The invocation was not performed on the mock. + The invocation was not call the times specified by + . + The mock instance. + Mocked type. + The number of times a method is allowed to be called. + Message to show if verification fails. + Expression to verify. + Type of the property to verify. Typically omitted as it can + be inferred from the expression's return type. + + + + Helper for sequencing return values in the same method. + + + + + Return a sequence of values, once per call. + + + + + Casts the expression to a lambda expression, removing + a cast if there's any. + + + + + Casts the body of the lambda expression to a . + + If the body is not a method call. + + + + Converts the body of the lambda expression into the referenced by it. + + + + + Checks whether the body of the lambda expression is a property access. + + + + + Checks whether the expression is a property access. + + + + + Checks whether the body of the lambda expression is a property indexer, which is true + when the expression is an whose + has + equal to . + + + + + Checks whether the expression is a property indexer, which is true + when the expression is an whose + has + equal to . + + + + + Creates an expression that casts the given expression to the + type. + + + + + TODO: remove this code when https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=331583 + is fixed. + + + + + Provides partial evaluation of subtrees, whenever they can be evaluated locally. + + Matt Warren: http://blogs.msdn.com/mattwar + Documented by InSTEDD: http://www.instedd.org + + + + Performs evaluation and replacement of independent sub-trees + + The root of the expression tree. + A function that decides whether a given expression + node can be part of the local function. + A new tree with sub-trees evaluated and replaced. + + + + Performs evaluation and replacement of independent sub-trees + + The root of the expression tree. + A new tree with sub-trees evaluated and replaced. + + + + Evaluates and replaces sub-trees when first candidate is reached (top-down) + + + + + Performs bottom-up analysis to determine which nodes can possibly + be part of an evaluated sub-tree. + + + + + Ensures the given is not null. + Throws otherwise. + + + + + Ensures the given string is not null or empty. + Throws in the first case, or + in the latter. + + + + + Checks an argument to ensure it is in the specified range including the edges. + + Type of the argument to check, it must be an type. + + The expression containing the name of the argument. + The argument value to check. + The minimun allowed value for the argument. + The maximun allowed value for the argument. + + + + Checks an argument to ensure it is in the specified range excluding the edges. + + Type of the argument to check, it must be an type. + + The expression containing the name of the argument. + The argument value to check. + The minimun allowed value for the argument. + The maximun allowed value for the argument. + + + + Implemented by all generated mock object instances. + + + + + Implemented by all generated mock object instances. + + + + + Reference the Mock that contains this as the mock.Object value. + + + + + Reference the Mock that contains this as the mock.Object value. + + + + + Implements the actual interception and method invocation for + all mocks. + + + + + Get an eventInfo for a given event name. Search type ancestors depth first if necessary. + + Name of the event, with the set_ or get_ prefix already removed + + + + Given a type return all of its ancestors, both types and interfaces. + + The type to find immediate ancestors of + + + + Implements the fluent API. + + + + + Defines the Callback verb for property setter setups. + + Type of the property. + + + + Specifies a callback to invoke when the property is set that receives the + property value being set. + + Callback method to invoke. + + Invokes the given callback with the property value being set. + + mock.SetupSet(x => x.Suspended) + .Callback((bool state) => Console.WriteLine(state)); + + + + + + Allows the specification of a matching condition for an + argument in a method invocation, rather than a specific + argument value. "It" refers to the argument being matched. + + This class allows the setup to match a method invocation + with an arbitrary value, with a value in a specified range, or + even one that matches a given predicate. + + + + + Matches any value of the given type. + + Typically used when the actual argument value for a method + call is not relevant. + + + // Throws an exception for a call to Remove with any string value. + mock.Setup(x => x.Remove(It.IsAny<string>())).Throws(new InvalidOperationException()); + + Type of the value. + + + + Matches any value that satisfies the given predicate. + Type of the argument to check.The predicate used to match the method argument. + Allows the specification of a predicate to perform matching + of method call arguments. + + This example shows how to return the value 1 whenever the argument to the + Do method is an even number. + + mock.Setup(x => x.Do(It.Is<int>(i => i % 2 == 0))) + .Returns(1); + + This example shows how to throw an exception if the argument to the + method is a negative number: + + mock.Setup(x => x.GetUser(It.Is<int>(i => i < 0))) + .Throws(new ArgumentException()); + + + + + + Matches any value that is in the range specified. + Type of the argument to check.The lower bound of the range.The upper bound of the range. + The kind of range. See . + + The following example shows how to expect a method call + with an integer argument within the 0..100 range. + + mock.Setup(x => x.HasInventory( + It.IsAny<string>(), + It.IsInRange(0, 100, Range.Inclusive))) + .Returns(false); + + + + + + Matches a string argument if it matches the given regular expression pattern. + The pattern to use to match the string argument value. + The following example shows how to expect a call to a method where the + string argument matches the given regular expression: + + mock.Setup(x => x.Check(It.IsRegex("[a-z]+"))).Returns(1); + + + + + + Matches a string argument if it matches the given regular expression pattern. + The pattern to use to match the string argument value.The options used to interpret the pattern. + The following example shows how to expect a call to a method where the + string argument matches the given regular expression, in a case insensitive way: + + mock.Setup(x => x.Check(It.IsRegex("[a-z]+", RegexOptions.IgnoreCase))).Returns(1); + + + + + + Matcher to treat static functions as matchers. + + mock.Setup(x => x.StringMethod(A.MagicString())); + + public static class A + { + [Matcher] + public static string MagicString() { return null; } + public static bool MagicString(string arg) + { + return arg == "magic"; + } + } + + Will succeed if: mock.Object.StringMethod("magic"); + and fail with any other call. + + + + + Options to customize the behavior of the mock. + + + + + Causes the mock to always throw + an exception for invocations that don't have a + corresponding setup. + + + + + Will never throw exceptions, returning default + values when necessary (null for reference types, + zero for value types or empty enumerables and arrays). + + + + + Default mock behavior, which equals . + + + + + Exception thrown by mocks when setups are not matched, + the mock is not properly setup, etc. + + + A distinct exception type is provided so that exceptions + thrown by the mock can be differentiated in tests that + expect other exceptions to be thrown (i.e. ArgumentException). + + Richer exception hierarchy/types are not provided as + tests typically should not catch or expect exceptions + from the mocks. These are typically the result of changes + in the tested class or its collaborators implementation, and + result in fixes in the mock setup so that they dissapear and + allow the test to pass. + + + + + + Supports the serialization infrastructure. + + Serialization information. + Streaming context. + + + + Supports the serialization infrastructure. + + Serialization information. + Streaming context. + + + + Made internal as it's of no use for + consumers, but it's important for + our own tests. + + + + + Used by the mock factory to accumulate verification + failures. + + + + + Supports the serialization infrastructure. + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to Mock type has already been initialized by accessing its Object property. Adding interfaces must be done before that.. + + + + + Looks up a localized string similar to Value cannot be an empty string.. + + + + + Looks up a localized string similar to Can only add interfaces to the mock.. + + + + + Looks up a localized string similar to Can't set return value for void method {0}.. + + + + + Looks up a localized string similar to Constructor arguments cannot be passed for interface mocks.. + + + + + Looks up a localized string similar to A matching constructor for the given arguments was not found on the mocked type.. + + + + + Looks up a localized string similar to Could not locate event for attach or detach method {0}.. + + + + + Looks up a localized string similar to Expression {0} involves a field access, which is not supported. Use properties instead.. + + + + + Looks up a localized string similar to Type to mock must be an interface or an abstract or non-sealed class. . + + + + + Looks up a localized string similar to Cannot retrieve a mock with the given object type {0} as it's not the main type of the mock or any of its additional interfaces. + Please cast the argument to one of the supported types: {1}. + Remember that there's no generics covariance in the CLR, so your object must be one of these types in order for the call to succeed.. + + + + + Looks up a localized string similar to The equals ("==" or "=" in VB) and the conditional 'and' ("&&" or "AndAlso" in VB) operators are the only ones supported in the query specification expression. Unsupported expression: {0}. + + + + + Looks up a localized string similar to LINQ method '{0}' not supported.. + + + + + Looks up a localized string similar to Expression contains a call to a method which is not virtual (overridable in VB) or abstract. Unsupported expression: {0}. + + + + + Looks up a localized string similar to Member {0}.{1} does not exist.. + + + + + Looks up a localized string similar to Method {0}.{1} is public. Use strong-typed Expect overload instead: + mock.Setup(x => x.{1}()); + . + + + + + Looks up a localized string similar to {0} invocation failed with mock behavior {1}. + {2}. + + + + + Looks up a localized string similar to Expected only {0} calls to {1}.. + + + + + Looks up a localized string similar to Expected only one call to {0}.. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock at least {2} times, but was {4} times: {1}. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock at least once, but was never performed: {1}. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock at most {3} times, but was {4} times: {1}. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock at most once, but was {4} times: {1}. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock between {2} and {3} times (Exclusive), but was {4} times: {1}. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock between {2} and {3} times (Inclusive), but was {4} times: {1}. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock exactly {2} times, but was {4} times: {1}. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock should never have been performed, but was {4} times: {1}. + + + + + Looks up a localized string similar to {0} + Expected invocation on the mock once, but was {4} times: {1}. + + + + + Looks up a localized string similar to All invocations on the mock must have a corresponding setup.. + + + + + Looks up a localized string similar to Object instance was not created by Moq.. + + + + + Looks up a localized string similar to Out expression must evaluate to a constant value.. + + + + + Looks up a localized string similar to Property {0}.{1} does not have a getter.. + + + + + Looks up a localized string similar to Property {0}.{1} does not exist.. + + + + + Looks up a localized string similar to Property {0}.{1} is write-only.. + + + + + Looks up a localized string similar to Property {0}.{1} is read-only.. + + + + + Looks up a localized string similar to Property {0}.{1} does not have a setter.. + + + + + Looks up a localized string similar to Cannot raise a mocked event unless it has been associated (attached) to a concrete event in a mocked object.. + + + + + Looks up a localized string similar to Ref expression must evaluate to a constant value.. + + + + + Looks up a localized string similar to Invocation needs to return a value and therefore must have a corresponding setup that provides it.. + + + + + Looks up a localized string similar to A lambda expression is expected as the argument to It.Is<T>.. + + + + + Looks up a localized string similar to Invocation {0} should not have been made.. + + + + + Looks up a localized string similar to Expression is not a method invocation: {0}. + + + + + Looks up a localized string similar to Expression is not a property access: {0}. + + + + + Looks up a localized string similar to Expression is not a property setter invocation.. + + + + + Looks up a localized string similar to Expression references a method that does not belong to the mocked object: {0}. + + + + + Looks up a localized string similar to Invalid setup on a non-virtual (overridable in VB) member: {0}. + + + + + Looks up a localized string similar to Type {0} does not implement required interface {1}. + + + + + Looks up a localized string similar to Type {0} does not from required type {1}. + + + + + Looks up a localized string similar to To specify a setup for public property {0}.{1}, use the typed overloads, such as: + mock.Setup(x => x.{1}).Returns(value); + mock.SetupGet(x => x.{1}).Returns(value); //equivalent to previous one + mock.SetupSet(x => x.{1}).Callback(callbackDelegate); + . + + + + + Looks up a localized string similar to Unsupported expression: {0}. + + + + + Looks up a localized string similar to Only property accesses are supported in intermediate invocations on a setup. Unsupported expression {0}.. + + + + + Looks up a localized string similar to Expression contains intermediate property access {0}.{1} which is of type {2} and cannot be mocked. Unsupported expression {3}.. + + + + + Looks up a localized string similar to Setter expression cannot use argument matchers that receive parameters.. + + + + + Looks up a localized string similar to Member {0} is not supported for protected mocking.. + + + + + Looks up a localized string similar to Setter expression can only use static custom matchers.. + + + + + Looks up a localized string similar to The following setups were not matched: + {0}. + + + + + Looks up a localized string similar to Invalid verify on a non-virtual (overridable in VB) member: {0}. + + + + + Allows setups to be specified for protected members by using their + name as a string, rather than strong-typing them which is not possible + due to their visibility. + + + + + Specifies a setup for a void method invocation with the given + , optionally specifying arguments for the method call. + + The name of the void method to be invoked. + The optional arguments for the invocation. If argument matchers are used, + remember to use rather than . + + + + Specifies a setup for an invocation on a property or a non void method with the given + , optionally specifying arguments for the method call. + + The name of the method or property to be invoked. + The optional arguments for the invocation. If argument matchers are used, + remember to use rather than . + The return type of the method or property. + + + + Specifies a setup for an invocation on a property getter with the given + . + + The name of the property. + The type of the property. + + + + Specifies a setup for an invocation on a property setter with the given + . + + The name of the property. + The property value. If argument matchers are used, + remember to use rather than . + The type of the property. + + + + Specifies a verify for a void method with the given , + optionally specifying arguments for the method call. Use in conjuntion with the default + . + + The invocation was not call the times specified by + . + The name of the void method to be verified. + The number of times a method is allowed to be called. + The optional arguments for the invocation. If argument matchers are used, + remember to use rather than . + + + + Specifies a verify for an invocation on a property or a non void method with the given + , optionally specifying arguments for the method call. + + The invocation was not call the times specified by + . + The name of the method or property to be invoked. + The optional arguments for the invocation. If argument matchers are used, + remember to use rather than . + The number of times a method is allowed to be called. + The type of return value from the expression. + + + + Specifies a verify for an invocation on a property getter with the given + . + The invocation was not call the times specified by + . + + The name of the property. + The number of times a method is allowed to be called. + The type of the property. + + + + Specifies a setup for an invocation on a property setter with the given + . + + The invocation was not call the times specified by + . + The name of the property. + The number of times a method is allowed to be called. + The property value. + The type of the property. If argument matchers are used, + remember to use rather than . + + + + Allows the specification of a matching condition for an + argument in a protected member setup, rather than a specific + argument value. "ItExpr" refers to the argument being matched. + + + Use this variant of argument matching instead of + for protected setups. + This class allows the setup to match a method invocation + with an arbitrary value, with a value in a specified range, or + even one that matches a given predicate, or null. + + + + + Matches a null value of the given type. + + + Required for protected mocks as the null value cannot be used + directly as it prevents proper method overload selection. + + + + // Throws an exception for a call to Remove with a null string value. + mock.Protected() + .Setup("Remove", ItExpr.IsNull<string>()) + .Throws(new InvalidOperationException()); + + + Type of the value. + + + + Matches any value of the given type. + + + Typically used when the actual argument value for a method + call is not relevant. + + + + // Throws an exception for a call to Remove with any string value. + mock.Protected() + .Setup("Remove", ItExpr.IsAny<string>()) + .Throws(new InvalidOperationException()); + + + Type of the value. + + + + Matches any value that satisfies the given predicate. + + Type of the argument to check. + The predicate used to match the method argument. + + Allows the specification of a predicate to perform matching + of method call arguments. + + + This example shows how to return the value 1 whenever the argument to the + Do method is an even number. + + mock.Protected() + .Setup("Do", ItExpr.Is<int>(i => i % 2 == 0)) + .Returns(1); + + This example shows how to throw an exception if the argument to the + method is a negative number: + + mock.Protected() + .Setup("GetUser", ItExpr.Is<int>(i => i < 0)) + .Throws(new ArgumentException()); + + + + + + Matches any value that is in the range specified. + + Type of the argument to check. + The lower bound of the range. + The upper bound of the range. + The kind of range. See . + + The following example shows how to expect a method call + with an integer argument within the 0..100 range. + + mock.Protected() + .Setup("HasInventory", + ItExpr.IsAny<string>(), + ItExpr.IsInRange(0, 100, Range.Inclusive)) + .Returns(false); + + + + + + Matches a string argument if it matches the given regular expression pattern. + + The pattern to use to match the string argument value. + + The following example shows how to expect a call to a method where the + string argument matches the given regular expression: + + mock.Protected() + .Setup("Check", ItExpr.IsRegex("[a-z]+")) + .Returns(1); + + + + + + Matches a string argument if it matches the given regular expression pattern. + + The pattern to use to match the string argument value. + The options used to interpret the pattern. + + The following example shows how to expect a call to a method where the + string argument matches the given regular expression, in a case insensitive way: + + mock.Protected() + .Setup("Check", ItExpr.IsRegex("[a-z]+", RegexOptions.IgnoreCase)) + .Returns(1); + + + + + + Enables the Protected() method on , + allowing setups to be set for protected members by using their + name as a string, rather than strong-typing them which is not possible + due to their visibility. + + + + + Enable protected setups for the mock. + + Mocked object type. Typically omitted as it can be inferred from the mock instance. + The mock to set the protected setups on. + + + + + + + + + + + + Kind of range to use in a filter specified through + . + + + + + The range includes the to and + from values. + + + + + The range does not include the to and + from values. + + + + + Determines the way default values are generated + calculated for loose mocks. + + + + + Default behavior, which generates empty values for + value types (i.e. default(int)), empty array and + enumerables, and nulls for all other reference types. + + + + + Whenever the default value generated by + is null, replaces this value with a mock (if the type + can be mocked). + + + For sealed classes, a null value will be generated. + + + + + A default implementation of IQueryable for use with QueryProvider + + + + + The is a + static method that returns an IQueryable of Mocks of T which is used to + apply the linq specification to. + + + + + Allows creation custom value matchers that can be used on setups and verification, + completely replacing the built-in class with your own argument + matching rules. + + See also . + + + + + Provided for the sole purpose of rendering the delegate passed to the + matcher constructor if no friendly render lambda is provided. + + + + + Initializes the match with the condition that + will be checked in order to match invocation + values. + The condition to match against actual values. + + + + + + + + + This method is used to set an expression as the last matcher invoked, + which is used in the SetupSet to allow matchers in the prop = value + delegate expression. This delegate is executed in "fluent" mode in + order to capture the value being set, and construct the corresponding + methodcall. + This is also used in the MatcherFactory for each argument expression. + This method ensures that when we execute the delegate, we + also track the matcher that was invoked, so that when we create the + methodcall we build the expression using it, rather than the null/default + value returned from the actual invocation. + + + + + Allows creation custom value matchers that can be used on setups and verification, + completely replacing the built-in class with your own argument + matching rules. + Type of the value to match. + The argument matching is used to determine whether a concrete + invocation in the mock matches a given setup. This + matching mechanism is fully extensible. + + Creating a custom matcher is straightforward. You just need to create a method + that returns a value from a call to with + your matching condition and optional friendly render expression: + + [Matcher] + public Order IsBigOrder() + { + return Match<Order>.Create( + o => o.GrandTotal >= 5000, + /* a friendly expression to render on failures */ + () => IsBigOrder()); + } + + This method can be used in any mock setup invocation: + + mock.Setup(m => m.Submit(IsBigOrder()).Throws<UnauthorizedAccessException>(); + + At runtime, Moq knows that the return value was a matcher (note that the method MUST be + annotated with the [Matcher] attribute in order to determine this) and + evaluates your predicate with the actual value passed into your predicate. + + Another example might be a case where you want to match a lists of orders + that contains a particular one. You might create matcher like the following: + + + public static class Orders + { + [Matcher] + public static IEnumerable<Order> Contains(Order order) + { + return Match<IEnumerable<Order>>.Create(orders => orders.Contains(order)); + } + } + + Now we can invoke this static method instead of an argument in an + invocation: + + var order = new Order { ... }; + var mock = new Mock<IRepository<Order>>(); + + mock.Setup(x => x.Save(Orders.Contains(order))) + .Throws<ArgumentException>(); + + + + + + Tracks the current mock and interception context. + + + + + Having an active fluent mock context means that the invocation + is being performed in "trial" mode, just to gather the + target method and arguments that need to be matched later + when the actual invocation is made. + + + + + A that returns an empty default value + for non-mockeable types, and mocks for all other types (interfaces and + non-sealed classes) that can be mocked. + + + + + Allows querying the universe of mocks for those that behave + according to the LINQ query specification. + + + This entry-point into Linq to Mocks is the only one in the root Moq + namespace to ease discovery. But to get all the mocking extension + methods on Object, a using of Moq.Linq must be done, so that the + polluting of the intellisense for all objects is an explicit opt-in. + + + + + Access the universe of mocks of the given type, to retrieve those + that behave according to the LINQ query specification. + + The type of the mocked object to query. + + + + Access the universe of mocks of the given type, to retrieve those + that behave according to the LINQ query specification. + + The predicate with the setup expressions. + The type of the mocked object to query. + + + + Creates an mock object of the indicated type. + + The type of the mocked object. + The mocked object created. + + + + Creates an mock object of the indicated type. + + The predicate with the setup expressions. + The type of the mocked object. + The mocked object created. + + + + Creates the mock query with the underlying queriable implementation. + + + + + Wraps the enumerator inside a queryable. + + + + + Method that is turned into the actual call from .Query{T}, to + transform the queryable query into a normal enumerable query. + This method is never used directly by consumers. + + + + + Extension method used to support Linq-like setup properties that are not virtual but do have + a getter and a setter, thereby allowing the use of Linq to Mocks to quickly initialize Dtos too :) + + + + + Helper extensions that are used by the query translator. + + + + + Retrieves a fluent mock from the given setup expression. + + + + + Defines the number of invocations allowed by a mocked method. + + + + + Specifies that a mocked method should be invoked times as minimum. + The minimun number of times.An object defining the allowed number of invocations. + + + + Specifies that a mocked method should be invoked one time as minimum. + An object defining the allowed number of invocations. + + + + Specifies that a mocked method should be invoked time as maximun. + The maximun number of times.An object defining the allowed number of invocations. + + + + Specifies that a mocked method should be invoked one time as maximun. + An object defining the allowed number of invocations. + + + + Specifies that a mocked method should be invoked between and + times. + The minimun number of times.The maximun number of times. + The kind of range. See . + An object defining the allowed number of invocations. + + + + Specifies that a mocked method should be invoked exactly times. + The times that a method or property can be called.An object defining the allowed number of invocations. + + + + Specifies that a mocked method should not be invoked. + An object defining the allowed number of invocations. + + + + Specifies that a mocked method should be invoked exactly one time. + An object defining the allowed number of invocations. + + + + Determines whether the specified is equal to this instance. + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Determines whether two specified objects have the same value. + + The first . + + The second . + + true if the value of left is the same as the value of right; otherwise, false. + + + + + Determines whether two specified objects have different values. + + The first . + + The second . + + true if the value of left is different from the value of right; otherwise, false. + + + + diff --git a/Website/LOC.Website.Tests/bin/Release/Newtonsoft.Json.dll b/Website/LOC.Website.Tests/bin/Release/Newtonsoft.Json.dll new file mode 100644 index 000000000..dc9283f4c Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Release/Newtonsoft.Json.dll differ diff --git a/Website/LOC.Website.Tests/bin/Release/Newtonsoft.Json.xml b/Website/LOC.Website.Tests/bin/Release/Newtonsoft.Json.xml new file mode 100644 index 000000000..ee891563c --- /dev/null +++ b/Website/LOC.Website.Tests/bin/Release/Newtonsoft.Json.xml @@ -0,0 +1,7343 @@ + + + + Newtonsoft.Json + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class with the specified . + + + + + Reads the next JSON token from the stream. + + true if the next token was read successfully; false if there are no more tokens to read. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Skips the children of the current token. + + + + + Sets the current token. + + The new token. + + + + Sets the current token and value. + + The new token. + The value. + + + + Sets the state based on current token type. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Releases unmanaged and - optionally - managed resources + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Changes the to Closed. + + + + + Gets the current reader state. + + The current reader state. + + + + Gets or sets a value indicating whether the underlying stream or + should be closed when the reader is closed. + + + true to close the underlying stream or when + the reader is closed; otherwise false. The default is true. + + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + Get or set how time zones are handling when reading JSON. + + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Gets the type of the current JSON token. + + + + + Gets the text value of the current JSON token. + + + + + Gets The Common Language Runtime (CLR) type for the current JSON token. + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Gets the path of the current JSON token. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Specifies the state of the reader. + + + + + The Read method has not been called. + + + + + The end of the file has been reached successfully. + + + + + Reader is at a property. + + + + + Reader is at the start of an object. + + + + + Reader is in an object. + + + + + Reader is at the start of an array. + + + + + Reader is in an array. + + + + + The Close method has been called. + + + + + Reader has just read a value. + + + + + Reader is at the start of a constructor. + + + + + Reader in a constructor. + + + + + An error occurred that prevents the read operation from continuing. + + + + + The end of the file has been reached successfully. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The reader. + + + + Initializes a new instance of the class. + + The stream. + if set to true the root object will be read as a JSON array. + The used when reading values from BSON. + + + + Initializes a new instance of the class. + + The reader. + if set to true the root object will be read as a JSON array. + The used when reading values from BSON. + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + + A . This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Changes the to Closed. + + + + + Gets or sets a value indicating whether binary data reading should compatible with incorrect Json.NET 3.5 written binary. + + + true if binary data reading will be compatible with incorrect Json.NET 3.5 written binary; otherwise, false. + + + + + Gets or sets a value indicating whether the root object will be read as a JSON array. + + + true if the root object will be read as a JSON array; otherwise, false. + + + + + Gets or sets the used when reading values from BSON. + + The used when reading values from BSON. + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Creates an instance of the JsonWriter class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the end of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the end of an array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end constructor. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes the end of the current Json object or array. + + + + + Writes the current token. + + The to read the token from. + + + + Writes the specified end token. + + The end token to write. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON without changing the writer's state. + + The raw JSON to write. + + + + Writes raw JSON where a value is expected and updates the writer's state. + + The raw JSON to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + An error will raised if the value cannot be written as a single JSON token. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Gets or sets a value indicating whether the underlying stream or + should be closed when the writer is closed. + + + true to close the underlying stream or when + the writer is closed; otherwise false. The default is true. + + + + + Gets the top. + + The top. + + + + Gets the state of the writer. + + + + + Gets the path of the writer. + + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling when writing JSON. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The writer. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Writes the end. + + The token. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes raw JSON where a value is expected and updates the writer's state. + + The raw JSON to write. + + + + Writes the beginning of a Json array. + + + + + Writes the beginning of a Json object. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Closes this stream and the underlying stream. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value that represents a BSON object id. + + + + + + Writes a BSON regex. + + The regex pattern. + The regex options. + + + + Gets or sets the used when writing values to BSON. + When set to no conversion will occur. + + The used when writing values to BSON. + + + + Represents a BSON Oid (object id). + + + + + Initializes a new instance of the class. + + The Oid value. + + + + Gets or sets the value of the Oid. + + The value of the Oid. + + + + Converts a binary value to and from a base 64 string value. + + + + + Converts an object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets the of the JSON produced by the JsonConverter. + + The of the JSON produced by the JsonConverter. + + + + Gets a value indicating whether this can read JSON. + + true if this can read JSON; otherwise, false. + + + + Gets a value indicating whether this can write JSON. + + true if this can write JSON; otherwise, false. + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Create a custom object + + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Creates an object which will then be populated by the serializer. + + Type of the object. + + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets a value indicating whether this can write JSON. + + + true if this can write JSON; otherwise, false. + + + + + Provides a base class for converting a to and from JSON. + + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an Entity Framework EntityKey to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an ExpandoObject to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets a value indicating whether this can write JSON. + + + true if this can write JSON; otherwise, false. + + + + + Converts a to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON and BSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from JSON and BSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts an to and from its name string value. + + + Converts an to and from its name string value. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + A cached representation of the Enum string representation to respect per Enum field name. + + The type of the Enum. + A map of enum field name to either the field name, or the configured enum member name (). + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Gets or sets a value indicating whether the written enum text should be camel case. + + true if the written enum text will be camel case; otherwise, false. + + + + Specifies how constructors are used when initializing objects during deserialization by the . + + + + + First attempt to use the public default constructor, then fall back to single paramatized constructor, then the non-public default constructor. + + + + + Json.NET will use a non-public default constructor before falling back to a paramatized constructor. + + + + + Converts a to and from a string (e.g. "1.2.3.4"). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing property value of the JSON that is being converted. + The calling serializer. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Specifies how dates are formatted when writing JSON text. + + + + + Dates are written in the ISO 8601 format, e.g. "2012-03-21T05:40Z". + + + + + Dates are written in the Microsoft JSON format, e.g. "\/Date(1198908717056)\/". + + + + + Specifies how to treat the time value when converting between string and . + + + + + Treat as local time. If the object represents a Coordinated Universal Time (UTC), it is converted to the local time. + + + + + Treat as a UTC. If the object represents a local time, it is converted to a UTC. + + + + + Treat as a local time if a is being converted to a string. + If a string is being converted to , convert to a local time if a time zone is specified. + + + + + Time zone information should be preserved when converting. + + + + + Specifies formatting options for the . + + + + + No special formatting is applied. This is the default. + + + + + Causes child objects to be indented according to the and settings. + + + + + Instructs the to use the specified constructor when deserializing that object. + + + + + Represents a raw JSON string. + + + + + Represents a value in JSON (string, integer, date, etc). + + + + + Represents an abstract JSON token. + + + + + Represents a collection of objects. + + The type of token + + + + Gets the with the specified key. + + + + + + Provides an interface to enable a class to return line and position information. + + + + + Gets a value indicating whether the class can return line information. + + + true if LineNumber and LinePosition can be provided; otherwise, false. + + + + + Gets the current line number. + + The current line number or 0 if no line information is available (for example, HasLineInfo returns false). + + + + Gets the current line position. + + The current line position or 0 if no line information is available (for example, HasLineInfo returns false). + + + + Compares the values of two tokens, including the values of all descendant tokens. + + The first to compare. + The second to compare. + true if the tokens are equal; otherwise false. + + + + Adds the specified content immediately after this token. + + A content object that contains simple content or a collection of content objects to be added after this token. + + + + Adds the specified content immediately before this token. + + A content object that contains simple content or a collection of content objects to be added before this token. + + + + Returns a collection of the ancestor tokens of this token. + + A collection of the ancestor tokens of this token. + + + + Returns a collection of the sibling tokens after this token, in document order. + + A collection of the sibling tokens after this tokens, in document order. + + + + Returns a collection of the sibling tokens before this token, in document order. + + A collection of the sibling tokens before this token, in document order. + + + + Gets the with the specified key converted to the specified type. + + The type to convert the token to. + The token key. + The converted token value. + + + + Returns a collection of the child tokens of this token, in document order. + + An of containing the child tokens of this , in document order. + + + + Returns a collection of the child tokens of this token, in document order, filtered by the specified type. + + The type to filter the child tokens on. + A containing the child tokens of this , in document order. + + + + Returns a collection of the child values of this token, in document order. + + The type to convert the values to. + A containing the child values of this , in document order. + + + + Removes this token from its parent. + + + + + Replaces this token with the specified token. + + The value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Returns the indented JSON for this token. + + + The indented JSON for this token. + + + + + Returns the JSON for this token using the given formatting and converters. + + Indicates how the output is formatted. + A collection of which will be used when writing the token. + The JSON for this token using the given formatting and converters. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Performs an implicit conversion from to . + + The value to create a from. + The initialized with the specified value. + + + + Creates an for this token. + + An that can be used to read this token and its descendants. + + + + Creates a from an object. + + The object that will be used to create . + A with the value of the specified object + + + + Creates a from an object using the specified . + + The object that will be used to create . + The that will be used when reading the object. + A with the value of the specified object + + + + Creates the specified .NET type from the . + + The new object created from the JSON value. + + + + Creates the specified .NET type from the using the specified . + + The that will be used when creating the object. + The new object created from the JSON value. + + + + Creates a from a . + + An positioned at the token to read into this . + + An that contains the token and its descendant tokens + that were read from the reader. The runtime type of the token is determined + by the token type of the first token encountered in the reader. + + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from a . + + An positioned at the token to read into this . + + An that contains the token and its descendant tokens + that were read from the reader. The runtime type of the token is determined + by the token type of the first token encountered in the reader. + + + + + Selects the token that matches the object path. + + + The object path from the current to the + to be returned. This must be a string of property names or array indexes separated + by periods, such as Tables[0].DefaultView[0].Price in C# or + Tables(0).DefaultView(0).Price in Visual Basic. + + The that matches the object path or a null reference if no matching token is found. + + + + Selects the token that matches the object path. + + + The object path from the current to the + to be returned. This must be a string of property names or array indexes separated + by periods, such as Tables[0].DefaultView[0].Price in C# or + Tables(0).DefaultView(0).Price in Visual Basic. + + A flag to indicate whether an error should be thrown if no token is found. + The that matches the object path. + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Creates a new instance of the . All child tokens are recursively cloned. + + A new instance of the . + + + + Gets a comparer that can compare two tokens for value equality. + + A that can compare two nodes for value equality. + + + + Gets or sets the parent. + + The parent. + + + + Gets the root of this . + + The root of this . + + + + Gets the node type for this . + + The type. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Gets the next sibling token of this node. + + The that contains the next sibling token. + + + + Gets the previous sibling token of this node. + + The that contains the previous sibling token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Get the first child token of this token. + + A containing the first child token of the . + + + + Get the last child token of this token. + + A containing the last child token of the . + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Creates a comment with the given value. + + The value. + A comment with the given value. + + + + Creates a string with the given value. + + The value. + A string with the given value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Indicates whether the current object is equal to another object of the same type. + + + true if the current object is equal to the parameter; otherwise, false. + + An object to compare with this object. + + + + Determines whether the specified is equal to the current . + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + + The parameter is null. + + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format. + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format provider. + + A that represents this instance. + + + + + Returns a that represents this instance. + + The format. + The format provider. + + A that represents this instance. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. + + An object to compare with this instance. + + A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: + Value + Meaning + Less than zero + This instance is less than . + Zero + This instance is equal to . + Greater than zero + This instance is greater than . + + + is not the same type as this instance. + + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Gets the node type for this . + + The type. + + + + Gets or sets the underlying token value. + + The underlying token value. + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class. + + The raw json. + + + + Creates an instance of with the content of the reader's current token. + + The reader. + An instance of with the content of the reader's current token. + + + + Indicating whether a property is required. + + + + + The property is not required. The default state. + + + + + The property must be defined in JSON but can be a null value. + + + + + The property must be defined in JSON and cannot be a null value. + + + + + Contract details for a used by the . + + + + + Contract details for a used by the . + + + + + Gets the underlying type for the contract. + + The underlying type for the contract. + + + + Gets or sets the type created during deserialization. + + The type created during deserialization. + + + + Gets or sets whether this type contract is serialized as a reference. + + Whether this type contract is serialized as a reference. + + + + Gets or sets the default for this contract. + + The converter. + + + + Gets or sets the method called immediately after deserialization of the object. + + The method called immediately after deserialization of the object. + + + + Gets or sets the method called during deserialization of the object. + + The method called during deserialization of the object. + + + + Gets or sets the method called after serialization of the object graph. + + The method called after serialization of the object graph. + + + + Gets or sets the method called before serialization of the object. + + The method called before serialization of the object. + + + + Gets or sets the default creator method used to create the object. + + The default creator method used to create the object. + + + + Gets or sets a value indicating whether the default creator is non public. + + true if the default object creator is non-public; otherwise, false. + + + + Gets or sets the method called when an error is thrown during the serialization of the object. + + The method called when an error is thrown during the serialization of the object. + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets the object's properties. + + The object's properties. + + + + Gets or sets the property name resolver. + + The property name resolver. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the ISerializable object constructor. + + The ISerializable object constructor. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Get and set values for a using dynamic methods. + + + + + Provides methods to get and set values. + + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + Initializes a new instance of the class. + + The member info. + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + Provides data for the Error event. + + + + + Initializes a new instance of the class. + + The current object. + The error context. + + + + Gets the current object the error event is being raised against. + + The current object the error event is being raised against. + + + + Gets the error context. + + The error context. + + + + Represents a view of a . + + + + + Initializes a new instance of the class. + + The name. + Type of the property. + + + + When overridden in a derived class, returns whether resetting an object changes its value. + + + true if resetting the component changes its value; otherwise, false. + + The component to test for reset capability. + + + + + When overridden in a derived class, gets the current value of the property on a component. + + + The value of a property for a given component. + + The component with the property for which to retrieve the value. + + + + + When overridden in a derived class, resets the value for this property of the component to the default value. + + The component with the property value that is to be reset to the default value. + + + + + When overridden in a derived class, sets the value of the component to a different value. + + The component with the property value that is to be set. + The new value. + + + + + When overridden in a derived class, determines a value indicating whether the value of this property needs to be persisted. + + + true if the property should be persisted; otherwise, false. + + The component with the property to be examined for persistence. + + + + + When overridden in a derived class, gets the type of the component this property is bound to. + + + A that represents the type of component this property is bound to. When the or methods are invoked, the object specified might be an instance of this type. + + + + + When overridden in a derived class, gets a value indicating whether this property is read-only. + + + true if the property is read-only; otherwise, false. + + + + + When overridden in a derived class, gets the type of the property. + + + A that represents the type of the property. + + + + + Gets the hash code for the name of the member. + + + + The hash code for the name of the member. + + + + + Used to resolve references when serializing and deserializing JSON by the . + + + + + Resolves a reference to its object. + + The serialization context. + The reference to resolve. + The object that + + + + Gets the reference for the sepecified object. + + The serialization context. + The object to get a reference for. + The reference to the object. + + + + Determines whether the specified object is referenced. + + The serialization context. + The object to test for a reference. + + true if the specified object is referenced; otherwise, false. + + + + + Adds a reference to the specified object. + + The serialization context. + The reference. + The object to reference. + + + + Specifies reference handling options for the . + + + + + Do not preserve references when serializing types. + + + + + Preserve references when serializing into a JSON object structure. + + + + + Preserve references when serializing into a JSON array structure. + + + + + Preserve references when serializing. + + + + + Instructs the how to serialize the collection. + + + + + Instructs the how to serialize the object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets the id. + + The id. + + + + Gets or sets the title. + + The title. + + + + Gets or sets the description. + + The description. + + + + Gets or sets a value that indicates whether to preserve object reference data. + + + true to keep object reference; otherwise, false. The default is false. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a flag indicating whether the array can contain null items + + A flag indicating whether the array can contain null items. + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets a value indicating whether null items are allowed in the collection. + + true if null items are allowed in the collection; otherwise, false. + + + + Specifies default value handling options for the . + + + + + Include members where the member value is the same as the member's default value when serializing objects. + Included members are written to JSON. Has no effect when deserializing. + + + + + Ignore members where the member value is the same as the member's default value when serializing objects + so that is is not written to JSON, and ignores setting members when the JSON value equals the member's default value. + + + + + Members with a default value but no JSON will be set to their default value when deserializing. + + + + + Ignore members where the member value is the same as the member's default value when serializing objects + and sets members to their default value when deserializing. + + + + + Instructs the to use the specified when serializing the member or class. + + + + + Initializes a new instance of the class. + + Type of the converter. + + + + Gets the type of the converter. + + The type of the converter. + + + + Instructs the how to serialize the object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified member serialization. + + The member serialization. + + + + Initializes a new instance of the class with the specified container Id. + + The container Id. + + + + Gets or sets the member serialization. + + The member serialization. + + + + Specifies the settings on a object. + + + + + Initializes a new instance of the class. + + + + + Gets or sets how reference loops (e.g. a class referencing itself) is handled. + + Reference loop handling. + + + + Gets or sets how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + Missing member handling. + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets or sets how null values are handled during serialization and deserialization. + + Null value handling. + + + + Gets or sets how null default are handled during serialization and deserialization. + + The default value handling. + + + + Gets or sets a collection that will be used during serialization. + + The converters. + + + + Gets or sets how object references are preserved by the serializer. + + The preserve references handling. + + + + Gets or sets how type name writing and reading is handled by the serializer. + + The type name handling. + + + + Gets or sets how a type name assembly is written and resolved by the serializer. + + The type name assembly format. + + + + Gets or sets how constructors are used during deserialization. + + The constructor handling. + + + + Gets or sets the contract resolver used by the serializer when + serializing .NET objects to JSON and vice versa. + + The contract resolver. + + + + Gets or sets the used by the serializer when resolving references. + + The reference resolver. + + + + Gets or sets the used by the serializer when resolving type names. + + The binder. + + + + Gets or sets the error handler called during serialization and deserialization. + + The error handler called during serialization and deserialization. + + + + Gets or sets the used by the serializer when invoking serialization callback methods. + + The context. + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling during serialization and deserialization. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Represents a reader that provides validation. + + + + + Initializes a new instance of the class that + validates the content returned from the given . + + The to read from while validating. + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. + + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Sets an event handler for receiving schema validation errors. + + + + + Gets the text value of the current Json token. + + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Gets the path of the current JSON token. + + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + + Gets the type of the current Json token. + + + + + + Gets the Common Language Runtime (CLR) type for the current Json token. + + + + + + Gets or sets the schema. + + The schema. + + + + Gets the used to construct this . + + The specified in the constructor. + + + + Compares tokens to determine whether they are equal. + + + + + Determines whether the specified objects are equal. + + The first object of type to compare. + The second object of type to compare. + + true if the specified objects are equal; otherwise, false. + + + + + Returns a hash code for the specified object. + + The for which a hash code is to be returned. + A hash code for the specified object. + The type of is a reference type and is null. + + + + Specifies the member serialization options for the . + + + + + All public members are serialized by default. Members can be excluded using or . + This is the default member serialization mode. + + + + + Only members must be marked with or are serialized. + This member serialization mode can also be set by marking the class with . + + + + + All public and private fields are serialized. Members can be excluded using or . + This member serialization mode can also be set by marking the class with . + + + + + Specifies how object creation is handled by the . + + + + + Reuse existing objects, create new objects when needed. + + + + + Only reuse existing objects. + + + + + Always create new objects. + + + + + Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Gets or sets the date time styles used when converting a date to and from JSON. + + The date time styles used when converting a date to and from JSON. + + + + Gets or sets the date time format used when converting a date to and from JSON. + + The date time format used when converting a date to and from JSON. + + + + Gets or sets the culture used when converting a date to and from JSON. + + The culture used when converting a date to and from JSON. + + + + Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + The calling serializer. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing property value of the JSON that is being converted. + The calling serializer. + The object value. + + + + Converts XML to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The calling serializer. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The existing value of object being read. + The calling serializer. + The object value. + + + + Checks if the attributeName is a namespace attribute. + + Attribute name to test. + The attribute name prefix if it has one, otherwise an empty string. + True if attribute name is for a namespace attribute, otherwise false. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Gets or sets the name of the root element to insert when deserializing to XML if the JSON structure has produces multiple root elements. + + The name of the deserialize root element. + + + + Gets or sets a flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + true if the array attibute is written to the XML; otherwise, false. + + + + Gets or sets a value indicating whether to write the root JSON object. + + true if the JSON root object is omitted; otherwise, false. + + + + Represents a reader that provides fast, non-cached, forward-only access to JSON text data. + + + + + Initializes a new instance of the class with the specified . + + The TextReader containing the XML data to read. + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Changes the state to closed. + + + + + Gets a value indicating whether the class can return line information. + + + true if LineNumber and LinePosition can be provided; otherwise, false. + + + + + Gets the current line number. + + + The current line number or 0 if no line information is available (for example, HasLineInfo returns false). + + + + + Gets the current line position. + + + The current line position or 0 if no line information is available (for example, HasLineInfo returns false). + + + + + Instructs the to always serialize the member with the specified name. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified name. + + Name of the property. + + + + Gets or sets the null value handling used when serializing this property. + + The null value handling. + + + + Gets or sets the default value handling used when serializing this property. + + The default value handling. + + + + Gets or sets the reference loop handling used when serializing this property. + + The reference loop handling. + + + + Gets or sets the object creation handling used when deserializing this property. + + The object creation handling. + + + + Gets or sets the type name handling used when serializing this property. + + The type name handling. + + + + Gets or sets whether this property's value is serialized as a reference. + + Whether this property's value is serialized as a reference. + + + + Gets or sets the order of serialization and deserialization of a member. + + The numeric order of serialization or deserialization. + + + + Gets or sets the name of the property. + + The name of the property. + + + + Gets or sets a value indicating whether this property is required. + + + A value indicating whether this property is required. + + + + + Instructs the not to serialize the public field or public read/write property value. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Creates an instance of the JsonWriter class using the specified . + + The TextWriter to write to. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the specified end token. + + The end token to write. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + + + + + Gets or sets which character to use to quote attribute values. + + + + + Gets or sets which character to use for indenting when is set to Formatting.Indented. + + + + + Gets or sets a value indicating whether object names will be surrounded with quotes. + + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Gets the line number indicating where the error occurred. + + The line number indicating where the error occurred. + + + + Gets the line position indicating where the error occurred. + + The line position indicating where the error occurred. + + + + Gets the path to the JSON where the error occurred. + + The path to the JSON where the error occurred. + + + + Represents a collection of . + + + + + Provides methods for converting between common language runtime types and JSON types. + + + + + Represents JavaScript's boolean value true as a string. This field is read-only. + + + + + Represents JavaScript's boolean value false as a string. This field is read-only. + + + + + Represents JavaScript's null as a string. This field is read-only. + + + + + Represents JavaScript's undefined as a string. This field is read-only. + + + + + Represents JavaScript's positive infinity as a string. This field is read-only. + + + + + Represents JavaScript's negative infinity as a string. This field is read-only. + + + + + Represents JavaScript's NaN as a string. This field is read-only. + + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation using the specified. + + The value to convert. + The format the date will be converted to. + The time zone handling when the date is converted to a string. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation using the specified. + + The value to convert. + The format the date will be converted to. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + The string delimiter character. + A JSON string representation of the . + + + + Converts the to its JSON string representation. + + The value to convert. + A JSON string representation of the . + + + + Serializes the specified object to a JSON string. + + The object to serialize. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string. + + The object to serialize. + Indicates how the output is formatted. + + A JSON string representation of the object. + + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A JSON string representation of the object. + + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Asynchronously serializes the specified object to a JSON string using a collection of . + + The object to serialize. + Indicates how the output is formatted. + The used to serialize the object. + If this is null, default serialization settings will be is used. + + A task that represents the asynchronous serialize operation. The value of the TResult parameter contains a JSON string representation of the object. + + + + + Deserializes the JSON to a .NET object. + + The JSON to deserialize. + The deserialized object from the Json string. + + + + Deserializes the JSON to a .NET object. + + The JSON to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The of object being deserialized. + The deserialized object from the Json string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + The deserialized object from the Json string. + + + + Deserializes the JSON to the given anonymous type. + + + The anonymous type to deserialize to. This can't be specified + traditionally and must be infered from the anonymous type passed + as a parameter. + + The JSON to deserialize. + The anonymous type object. + The deserialized anonymous type from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The object to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize to. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + The deserialized object from the JSON string. + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The type of the object to deserialize to. + The JSON to deserialize. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Asynchronously deserializes the JSON to the specified .NET type. + + The JSON to deserialize. + The type of the object to deserialize to. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous deserialize operation. The value of the TResult parameter contains the deserialized object from the JSON string. + + + + + Populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + + + Populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + + + Asynchronously populates the object with values from the JSON string. + + The JSON to populate values from. + The target object to populate values onto. + + The used to deserialize the object. + If this is null, default serialization settings will be is used. + + + A task that represents the asynchronous populate operation. + + + + + Serializes the XML node to a JSON string. + + The node to serialize. + A JSON string of the XmlNode. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + A JSON string of the XmlNode. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + Omits writing the root object. + A JSON string of the XmlNode. + + + + Deserializes the XmlNode from a JSON string. + + The JSON string. + The deserialized XmlNode + + + + Deserializes the XmlNode from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + The deserialized XmlNode + + + + Deserializes the XmlNode from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + + A flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + The deserialized XmlNode + + + + Serializes the to a JSON string. + + The node to convert to JSON. + A JSON string of the XNode. + + + + Serializes the to a JSON string. + + The node to convert to JSON. + Indicates how the output is formatted. + A JSON string of the XNode. + + + + Serializes the to a JSON string. + + The node to serialize. + Indicates how the output is formatted. + Omits writing the root object. + A JSON string of the XNode. + + + + Deserializes the from a JSON string. + + The JSON string. + The deserialized XNode + + + + Deserializes the from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + The deserialized XNode + + + + Deserializes the from a JSON string nested in a root elment. + + The JSON string. + The name of the root element to append when deserializing. + + A flag to indicate whether to write the Json.NET array attribute. + This attribute helps preserve arrays when converting the written XML back to JSON. + + The deserialized XNode + + + + The exception thrown when an error occurs during Json serialization or deserialization. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Serializes and deserializes objects into and from the JSON format. + The enables you to control how objects are encoded into JSON. + + + + + Initializes a new instance of the class. + + + + + Creates a new instance using the specified . + + The settings to be applied to the . + A new instance using the specified . + + + + Populates the JSON values onto the target object. + + The that contains the JSON structure to reader values from. + The target object to populate values onto. + + + + Populates the JSON values onto the target object. + + The that contains the JSON structure to reader values from. + The target object to populate values onto. + + + + Deserializes the Json structure contained by the specified . + + The that contains the JSON structure to deserialize. + The being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The type of the object to deserialize. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Occurs when the errors during serialization and deserialization. + + + + + Gets or sets the used by the serializer when resolving references. + + + + + Gets or sets the used by the serializer when resolving type names. + + + + + Gets or sets how type name writing and reading is handled by the serializer. + + + + + Gets or sets how a type name assembly is written and resolved by the serializer. + + The type name assembly format. + + + + Gets or sets how object references are preserved by the serializer. + + + + + Get or set how reference loops (e.g. a class referencing itself) is handled. + + + + + Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + + + + Get or set how null values are handled during serialization and deserialization. + + + + + Get or set how null default are handled during serialization and deserialization. + + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets or sets how constructors are used during deserialization. + + The constructor handling. + + + + Gets a collection that will be used during serialization. + + Collection that will be used during serialization. + + + + Gets or sets the contract resolver used by the serializer when + serializing .NET objects to JSON and vice versa. + + + + + Gets or sets the used by the serializer when invoking serialization callback methods. + + The context. + + + + Indicates how JSON text output is formatted. + + + + + Get or set how dates are written to JSON text. + + + + + Get or set how time zones are handling during serialization and deserialization. + + + + + Gets or sets the culture used when reading JSON. Defaults to . + + + + + Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a . + + + + + Contains the LINQ to JSON extension methods. + + + + + Returns a collection of tokens that contains the ancestors of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the ancestors of every node in the source collection. + + + + Returns a collection of tokens that contains the descendants of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the descendants of every node in the source collection. + + + + Returns a collection of child properties of every object in the source collection. + + An of that contains the source collection. + An of that contains the properties of every object in the source collection. + + + + Returns a collection of child values of every object in the source collection with the given key. + + An of that contains the source collection. + The token key. + An of that contains the values of every node in the source collection with the given key. + + + + Returns a collection of child values of every object in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child values of every object in the source collection with the given key. + + The type to convert the values to. + An of that contains the source collection. + The token key. + An that contains the converted values of every node in the source collection with the given key. + + + + Returns a collection of converted child values of every object in the source collection. + + The type to convert the values to. + An of that contains the source collection. + An that contains the converted values of every node in the source collection. + + + + Converts the value. + + The type to convert the value to. + A cast as a of . + A converted value. + + + + Converts the value. + + The source collection type. + The type to convert the value to. + A cast as a of . + A converted value. + + + + Returns a collection of child tokens of every array in the source collection. + + The source collection type. + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child tokens of every array in the source collection. + + An of that contains the source collection. + The type to convert the values to. + The source collection type. + An that contains the converted values of every node in the source collection. + + + + Returns the input typed as . + + An of that contains the source collection. + The input typed as . + + + + Returns the input typed as . + + The source collection type. + An of that contains the source collection. + The input typed as . + + + + Represents a JSON constructor. + + + + + Represents a token that can contain other tokens. + + + + + Raises the event. + + The instance containing the event data. + + + + Raises the event. + + The instance containing the event data. + + + + Raises the event. + + The instance containing the event data. + + + + Returns a collection of the child tokens of this token, in document order. + + + An of containing the child tokens of this , in document order. + + + + + Returns a collection of the child values of this token, in document order. + + The type to convert the values to. + + A containing the child values of this , in document order. + + + + + Returns a collection of the descendant tokens for this token in document order. + + An containing the descendant tokens of the . + + + + Adds the specified content as children of this . + + The content to be added. + + + + Adds the specified content as the first children of this . + + The content to be added. + + + + Creates an that can be used to add tokens to the . + + An that is ready to have content written to it. + + + + Replaces the children nodes of this token with the specified content. + + The content. + + + + Removes the child nodes from this token. + + + + + Occurs when the list changes or an item in the list changes. + + + + + Occurs before an item is added to the collection. + + + + + Occurs when the items list of the collection has changed, or the collection is reset. + + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Get the first child token of this token. + + + A containing the first child token of the . + + + + + Get the last child token of this token. + + + A containing the last child token of the . + + + + + Gets the count of child JSON tokens. + + The count of child JSON tokens + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name. + + The constructor name. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets or sets the name of this constructor. + + The constructor name. + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a collection of objects. + + The type of token + + + + An empty collection of objects. + + + + + Initializes a new instance of the struct. + + The enumerable. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + + + + Determines whether the specified is equal to this instance. + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Gets the with the specified key. + + + + + + Represents a JSON object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Gets an of this object's properties. + + An of this object's properties. + + + + Gets a the specified name. + + The property name. + A with the specified name or null. + + + + Gets an of this object's property values. + + An of this object's property values. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Creates a from an object. + + The object that will be used to create . + The that will be used to read the object. + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Adds the specified property name. + + Name of the property. + The value. + + + + Removes the property with the specified name. + + Name of the property. + true if item was successfully removed; otherwise, false. + + + + Tries the get value. + + Name of the property. + The value. + true if a value was successfully retrieved; otherwise, false. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Raises the event with the provided arguments. + + Name of the property. + + + + Raises the event with the provided arguments. + + Name of the property. + + + + Returns the properties for this instance of a component. + + + A that represents the properties for this component instance. + + + + + Returns the properties for this instance of a component using the attribute array as a filter. + + An array of type that is used as a filter. + + A that represents the filtered properties for this component instance. + + + + + Returns a collection of custom attributes for this instance of a component. + + + An containing the attributes for this object. + + + + + Returns the class name of this instance of a component. + + + The class name of the object, or null if the class does not have a name. + + + + + Returns the name of this instance of a component. + + + The name of the object, or null if the object does not have a name. + + + + + Returns a type converter for this instance of a component. + + + A that is the converter for this object, or null if there is no for this object. + + + + + Returns the default event for this instance of a component. + + + An that represents the default event for this object, or null if this object does not have events. + + + + + Returns the default property for this instance of a component. + + + A that represents the default property for this object, or null if this object does not have properties. + + + + + Returns an editor of the specified type for this instance of a component. + + A that represents the editor for this object. + + An of the specified type that is the editor for this object, or null if the editor cannot be found. + + + + + Returns the events for this instance of a component using the specified attribute array as a filter. + + An array of type that is used as a filter. + + An that represents the filtered events for this component instance. + + + + + Returns the events for this instance of a component. + + + An that represents the events for this component instance. + + + + + Returns an object that contains the property described by the specified property descriptor. + + A that represents the property whose owner is to be found. + + An that represents the owner of the specified property. + + + + + Returns the responsible for binding operations performed on this object. + + The expression tree representation of the runtime value. + + The to bind this object. + + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Occurs when a property value changes. + + + + + Occurs when a property value is changing. + + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets or sets the with the specified property name. + + + + + + Represents a JSON array. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Creates a from an object. + + The object that will be used to create . + The that will be used to read the object. + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Determines the index of a specific item in the . + + The object to locate in the . + + The index of if found in the list; otherwise, -1. + + + + + Inserts an item to the at the specified index. + + The zero-based index at which should be inserted. + The object to insert into the . + + is not a valid index in the . + The is read-only. + + + + Removes the item at the specified index. + + The zero-based index of the item to remove. + + is not a valid index in the . + The is read-only. + + + + Adds an item to the . + + The object to add to the . + The is read-only. + + + + Removes all items from the . + + The is read-only. + + + + Determines whether the contains a specific value. + + The object to locate in the . + + true if is found in the ; otherwise, false. + + + + + Removes the first occurrence of a specific object from the . + + The object to remove from the . + + true if was successfully removed from the ; otherwise, false. This method also returns false if is not found in the original . + + The is read-only. + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets the node type for this . + + The type. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets or sets the at the specified index. + + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class. + + The token to read from. + + + + Reads the next JSON token from the stream as a . + + + A or a null reference if the next JSON token is null. This method will return null at the end of an array. + + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream as a . + + A . This method will return null at the end of an array. + + + + Reads the next JSON token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Initializes a new instance of the class writing to the given . + + The container being written to. + + + + Initializes a new instance of the class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end. + + The token. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JSON. + + The raw JSON to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Gets the token being writen. + + The token being writen. + + + + Represents a JSON property. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class. + + The property name. + The property content. + + + + Initializes a new instance of the class. + + The property name. + The property content. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the JSON that was read from the specified . + + + + Gets the container's children tokens. + + The container's children tokens. + + + + Gets the property name. + + The property name. + + + + Gets or sets the property value. + + The property value. + + + + Gets the node type for this . + + The type. + + + + Specifies the type of token. + + + + + No token type has been set. + + + + + A JSON object. + + + + + A JSON array. + + + + + A JSON constructor. + + + + + A JSON object property. + + + + + A comment. + + + + + An integer value. + + + + + A float value. + + + + + A string value. + + + + + A boolean value. + + + + + A null value. + + + + + An undefined value. + + + + + A date value. + + + + + A raw JSON value. + + + + + A collection of bytes value. + + + + + A Guid value. + + + + + A Uri value. + + + + + A TimeSpan value. + + + + + Contains the JSON schema extension methods. + + + + + Determines whether the is valid. + + The source to test. + The schema to test with. + + true if the specified is valid; otherwise, false. + + + + + Determines whether the is valid. + + The source to test. + The schema to test with. + When this method returns, contains any error messages generated while validating. + + true if the specified is valid; otherwise, false. + + + + + Validates the specified . + + The source to test. + The schema to test with. + + + + Validates the specified . + + The source to test. + The schema to test with. + The validation event handler. + + + + Returns detailed information about the schema exception. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + The parameter is null. + The class name is null or is zero (0). + + + + Gets the line number indicating where the error occurred. + + The line number indicating where the error occurred. + + + + Gets the line position indicating where the error occurred. + + The line position indicating where the error occurred. + + + + Gets the path to the JSON where the error occurred. + + The path to the JSON where the error occurred. + + + + Resolves from an id. + + + + + Initializes a new instance of the class. + + + + + Gets a for the specified id. + + The id. + A for the specified id. + + + + Gets or sets the loaded schemas. + + The loaded schemas. + + + + Specifies undefined schema Id handling options for the . + + + + + Do not infer a schema Id. + + + + + Use the .NET type name as the schema Id. + + + + + Use the assembly qualified .NET type name as the schema Id. + + + + + Returns detailed information related to the . + + + + + Gets the associated with the validation error. + + The JsonSchemaException associated with the validation error. + + + + Gets the path of the JSON location where the validation error occurred. + + The path of the JSON location where the validation error occurred. + + + + Gets the text description corresponding to the validation error. + + The text description. + + + + Represents the callback method that will handle JSON schema validation events and the . + + + + + Resolves member mappings for a type, camel casing property names. + + + + + Used by to resolves a for a given . + + + + + Used by to resolves a for a given . + + + + + Resolves the contract for a given type. + + The type to resolve a contract for. + The contract for a given type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + If set to true the will use a cached shared with other resolvers of the same type. + Sharing the cache will significantly performance because expensive reflection will only happen once but could cause unexpected + behavior if different instances of the resolver are suppose to produce different results. When set to false it is highly + recommended to reuse instances with the . + + + + + Resolves the contract for a given type. + + The type to resolve a contract for. + The contract for a given type. + + + + Gets the serializable members for the type. + + The type to get serializable members for. + The serializable members for the type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates the constructor parameters. + + The constructor to create properties for. + The type's member properties. + Properties for the given . + + + + Creates a for the given . + + The matching member property. + The constructor parameter. + A created for the given . + + + + Resolves the default for the contract. + + Type of the object. + + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Creates a for the given type. + + Type of the object. + A for the given type. + + + + Determines which contract type is created for the given type. + + Type of the object. + A for the given type. + + + + Creates properties for the given . + + The type to create properties for. + /// The member serialization mode for the type. + Properties for the given . + + + + Creates the used by the serializer to get and set values from a member. + + The member. + The used by the serializer to get and set values from a member. + + + + Creates a for the given . + + The member's parent . + The member to create a for. + A created for the given . + + + + Resolves the name of the property. + + Name of the property. + Name of the property. + + + + Gets a value indicating whether members are being get and set using dynamic code generation. + This value is determined by the runtime permissions available. + + + true if using dynamic code generation; otherwise, false. + + + + + Gets or sets the default members search flags. + + The default members search flags. + + + + Gets or sets a value indicating whether compiler generated members should be serialized. + + + true if serialized compiler generated members; otherwise, false. + + + + + Gets or sets a value indicating whether to ignore the interface when serializing and deserializing types. + + + true if the interface will be ignored when serializing and deserializing types; otherwise, false. + + + + + Gets or sets a value indicating whether to ignore the attribute when serializing and deserializing types. + + + true if the attribute will be ignored when serializing and deserializing types; otherwise, false. + + + + + Initializes a new instance of the class. + + + + + Resolves the name of the property. + + Name of the property. + The property name camel cased. + + + + The default serialization binder used when resolving and loading classes from type names. + + + + + When overridden in a derived class, controls the binding of a serialized object to a type. + + Specifies the name of the serialized object. + Specifies the name of the serialized object. + + The type of the object the formatter creates a new instance of. + + + + + When overridden in a derived class, controls the binding of a serialized object to a type. + + The type of the object the formatter creates a new instance of. + Specifies the name of the serialized object. + Specifies the name of the serialized object. + + + + Provides information surrounding an error. + + + + + Gets or sets the error. + + The error. + + + + Gets the original object that caused the error. + + The original object that caused the error. + + + + Gets the member that caused the error. + + The member that caused the error. + + + + Gets the path of the JSON location where the error occurred. + + The path of the JSON location where the error occurred. + + + + Gets or sets a value indicating whether this is handled. + + true if handled; otherwise, false. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets the of the collection items. + + The of the collection items. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the property name resolver. + + The property name resolver. + + + + Gets the of the dictionary keys. + + The of the dictionary keys. + + + + Gets the of the dictionary values. + + The of the dictionary values. + + + + Maps a JSON property to a .NET member or constructor parameter. + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Gets or sets the name of the property. + + The name of the property. + + + + Gets or sets the type that declared this property. + + The type that declared this property. + + + + Gets or sets the order of serialization and deserialization of a member. + + The numeric order of serialization or deserialization. + + + + Gets or sets the name of the underlying member or parameter. + + The name of the underlying member or parameter. + + + + Gets the that will get and set the during serialization. + + The that will get and set the during serialization. + + + + Gets or sets the type of the property. + + The type of the property. + + + + Gets or sets the for the property. + If set this converter takes presidence over the contract converter for the property type. + + The converter. + + + + Gets the member converter. + + The member converter. + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + + Gets a value indicating whether this is readable. + + true if readable; otherwise, false. + + + + Gets a value indicating whether this is writable. + + true if writable; otherwise, false. + + + + Gets the default value. + + The default value. + + + + Gets a value indicating whether this is required. + + A value indicating whether this is required. + + + + Gets a value indicating whether this property preserves object references. + + + true if this instance is reference; otherwise, false. + + + + + Gets the property null value handling. + + The null value handling. + + + + Gets the property default value handling. + + The default value handling. + + + + Gets the property reference loop handling. + + The reference loop handling. + + + + Gets the property object creation handling. + + The object creation handling. + + + + Gets or sets the type name handling. + + The type name handling. + + + + Gets or sets a predicate used to determine whether the property should be serialize. + + A predicate used to determine whether the property should be serialize. + + + + Gets or sets a predicate used to determine whether the property should be serialized. + + A predicate used to determine whether the property should be serialized. + + + + Gets or sets an action used to set whether the property has been deserialized. + + An action used to set whether the property has been deserialized. + + + + A collection of objects. + + + + + Initializes a new instance of the class. + + The type. + + + + When implemented in a derived class, extracts the key from the specified element. + + The element from which to extract the key. + The key for the specified element. + + + + Adds a object. + + The property to add to the collection. + + + + Gets the closest matching object. + First attempts to get an exact case match of propertyName and then + a case insensitive match. + + Name of the property. + A matching property if found. + + + + Gets a property by property name. + + The name of the property to get. + Type property name string comparison. + A matching property if found. + + + + Specifies missing member handling options for the . + + + + + Ignore a missing member and do not attempt to deserialize it. + + + + + Throw a when a missing member is encountered during deserialization. + + + + + Specifies null value handling options for the . + + + + + Include null values when serializing and deserializing objects. + + + + + Ignore null values when serializing and deserializing objects. + + + + + Specifies reference loop handling options for the . + + + + + Throw a when a loop is encountered. + + + + + Ignore loop references and do not serialize. + + + + + Serialize loop references. + + + + + An in-memory representation of a JSON Schema. + + + + + Initializes a new instance of the class. + + + + + Reads a from the specified . + + The containing the JSON Schema to read. + The object representing the JSON Schema. + + + + Reads a from the specified . + + The containing the JSON Schema to read. + The to use when resolving schema references. + The object representing the JSON Schema. + + + + Load a from a string that contains schema JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Parses the specified json. + + The json. + The resolver. + A populated from the string that contains JSON. + + + + Writes this schema to a . + + A into which this method will write. + + + + Writes this schema to a using the specified . + + A into which this method will write. + The resolver used. + + + + Returns a that represents the current . + + + A that represents the current . + + + + + Gets or sets the id. + + + + + Gets or sets the title. + + + + + Gets or sets whether the object is required. + + + + + Gets or sets whether the object is read only. + + + + + Gets or sets whether the object is visible to users. + + + + + Gets or sets whether the object is transient. + + + + + Gets or sets the description of the object. + + + + + Gets or sets the types of values allowed by the object. + + The type. + + + + Gets or sets the pattern. + + The pattern. + + + + Gets or sets the minimum length. + + The minimum length. + + + + Gets or sets the maximum length. + + The maximum length. + + + + Gets or sets a number that the value should be divisble by. + + A number that the value should be divisble by. + + + + Gets or sets the minimum. + + The minimum. + + + + Gets or sets the maximum. + + The maximum. + + + + Gets or sets a flag indicating whether the value can not equal the number defined by the "minimum" attribute. + + A flag indicating whether the value can not equal the number defined by the "minimum" attribute. + + + + Gets or sets a flag indicating whether the value can not equal the number defined by the "maximum" attribute. + + A flag indicating whether the value can not equal the number defined by the "maximum" attribute. + + + + Gets or sets the minimum number of items. + + The minimum number of items. + + + + Gets or sets the maximum number of items. + + The maximum number of items. + + + + Gets or sets the of items. + + The of items. + + + + Gets or sets the of properties. + + The of properties. + + + + Gets or sets the of additional properties. + + The of additional properties. + + + + Gets or sets the pattern properties. + + The pattern properties. + + + + Gets or sets a value indicating whether additional properties are allowed. + + + true if additional properties are allowed; otherwise, false. + + + + + Gets or sets the required property if this property is present. + + The required property if this property is present. + + + + Gets or sets the identity. + + The identity. + + + + Gets or sets the a collection of valid enum values allowed. + + A collection of valid enum values allowed. + + + + Gets or sets a collection of options. + + A collection of options. + + + + Gets or sets disallowed types. + + The disallow types. + + + + Gets or sets the default value. + + The default value. + + + + Gets or sets the extend . + + The extended . + + + + Gets or sets the format. + + The format. + + + + Generates a from a specified . + + + + + Generate a from the specified type. + + The type to generate a from. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + The used to resolve schema references. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + Specify whether the generated root will be nullable. + A generated from the specified type. + + + + Generate a from the specified type. + + The type to generate a from. + The used to resolve schema references. + Specify whether the generated root will be nullable. + A generated from the specified type. + + + + Gets or sets how undefined schemas are handled by the serializer. + + + + + Gets or sets the contract resolver. + + The contract resolver. + + + + The value types allowed by the . + + + + + No type specified. + + + + + String type. + + + + + Float type. + + + + + Integer type. + + + + + Boolean type. + + + + + Object type. + + + + + Array type. + + + + + Null type. + + + + + Any type. + + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Gets or sets the object member serialization. + + The member object serialization. + + + + Gets the object's properties. + + The object's properties. + + + + Gets the constructor parameters required for any non-default constructor + + + + + Gets or sets the override constructor used to create the object. + This is set when a constructor is marked up using the + JsonConstructor attribute. + + The override constructor. + + + + Gets or sets the parametrized constructor used to create the object. + + The parametrized constructor. + + + + Contract details for a used by the . + + + + + Initializes a new instance of the class. + + The underlying type for the contract. + + + + Get and set values for a using reflection. + + + + + Initializes a new instance of the class. + + The member info. + + + + Sets the value. + + The target to set the value on. + The value to set on the target. + + + + Gets the value. + + The target to get the value from. + The value. + + + + When applied to a method, specifies that the method is called when an error occurs serializing an object. + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic that returns a result + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic, but uses one of the arguments for + the result. + + + + + Helper method for generating a MetaObject which calls a + specific method on Dynamic, but uses one of the arguments for + the result. + + + + + Returns a Restrictions object which includes our current restrictions merged + with a restriction limiting our type + + + + + Represents a method that constructs an object. + + + + + Specifies type name handling options for the . + + + + + Do not include the .NET type name when serializing types. + + + + + Include the .NET type name when serializing into a JSON object structure. + + + + + Include the .NET type name when serializing into a JSON array structure. + + + + + Always include the .NET type name when serializing. + + + + + Include the .NET type name when the type of the object being serialized is not the same as its declared type. + + + + + Converts the value to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert the value to. + The converted type. + + + + Converts the value to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert the value to. + The converted value if the conversion was successful or the default value of T if it failed. + + true if initialValue was converted successfully; otherwise, false. + + + + + Converts the value to the specified type. If the value is unable to be converted, the + value is checked whether it assignable to the specified type. + + The value to convert. + The culture to use when converting. + The type to convert or cast the value to. + + The converted type. If conversion was unsuccessful, the initial value + is returned if assignable to the target type. + + + + + Gets a dictionary of the names and values of an Enum type. + + + + + + Gets a dictionary of the names and values of an Enum type. + + The enum type to get names and values for. + + + + + Specifies the type of Json token. + + + + + This is returned by the if a method has not been called. + + + + + An object start token. + + + + + An array start token. + + + + + A constructor start token. + + + + + An object property name. + + + + + A comment. + + + + + Raw JSON. + + + + + An integer. + + + + + A float. + + + + + A string. + + + + + A boolean. + + + + + A null token. + + + + + An undefined token. + + + + + An object end token. + + + + + An array end token. + + + + + A constructor end token. + + + + + A Date. + + + + + Byte data. + + + + + Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Adds the elements of the specified collection to the specified generic IList. + + The list to add to. + The collection of elements to add. + + + + Returns the index of the first occurrence in a sequence by using a specified IEqualityComparer. + + The type of the elements of source. + A sequence in which to locate a value. + The object to locate in the sequence + An equality comparer to compare values. + The zero-based index of the first occurrence of value within the entire sequence, if found; otherwise, –1. + + + + Gets the type of the typed collection's items. + + The type. + The type of the typed collection's items. + + + + Gets the member's underlying type. + + The member. + The underlying type of the member. + + + + Determines whether the member is an indexed property. + + The member. + + true if the member is an indexed property; otherwise, false. + + + + + Determines whether the property is an indexed property. + + The property. + + true if the property is an indexed property; otherwise, false. + + + + + Gets the member's value on the object. + + The member. + The target object. + The member's value on the object. + + + + Sets the member's value on the target object. + + The member. + The target. + The value. + + + + Determines whether the specified MemberInfo can be read. + + The MemberInfo to determine whether can be read. + /// if set to true then allow the member to be gotten non-publicly. + + true if the specified MemberInfo can be read; otherwise, false. + + + + + Determines whether the specified MemberInfo can be set. + + The MemberInfo to determine whether can be set. + if set to true then allow the member to be set non-publicly. + if set to true then allow the member to be set if read-only. + + true if the specified MemberInfo can be set; otherwise, false. + + + + + Determines whether the string is all white space. Empty string will return false. + + The string to test whether it is all white space. + + true if the string is all white space; otherwise, false. + + + + + Nulls an empty string. + + The string. + Null if the string was null, otherwise the string unchanged. + + + + Specifies the state of the . + + + + + An exception has been thrown, which has left the in an invalid state. + You may call the method to put the in the Closed state. + Any other method calls results in an being thrown. + + + + + The method has been called. + + + + + An object is being written. + + + + + A array is being written. + + + + + A constructor is being written. + + + + + A property is being written. + + + + + A write method has not been called. + + + + diff --git a/Website/LOC.Website.Tests/bin/Release/StructureMap.dll b/Website/LOC.Website.Tests/bin/Release/StructureMap.dll new file mode 100644 index 000000000..28a17b021 Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Release/StructureMap.dll differ diff --git a/Website/LOC.Website.Tests/bin/Release/StructureMap.pdb b/Website/LOC.Website.Tests/bin/Release/StructureMap.pdb new file mode 100644 index 000000000..6c4dd1f78 Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Release/StructureMap.pdb differ diff --git a/Website/LOC.Website.Tests/bin/Release/StructureMap.xml b/Website/LOC.Website.Tests/bin/Release/StructureMap.xml new file mode 100644 index 000000000..6376709c4 --- /dev/null +++ b/Website/LOC.Website.Tests/bin/Release/StructureMap.xml @@ -0,0 +1,3931 @@ + + + + StructureMap + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Get the object of type T that is valid for this build session. + + + + + + + Get the object of type T that is valid for this build session by name. + + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Register a default object for the given PluginType that will + be used throughout the rest of the current object request + + + + + + + Same as GetInstance, but can gracefully return null if + the Type does not already exist + + + + + + + Same as GetInstance(name), but can gracefully return null if + the Type and name does not already exist + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Gets all objects in the current object graph that can be cast + to T that have already been created + + + + + + + Creates/Resolves every configured instance of PlutinType T + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Gets a reference to the BuildStack for this build session + + + + + The concrete type of the immediate parent object in the object graph + + + + + Gets the root "frame" of the object request + + + + + The requested instance name of the object graph + + + + + Expression Builder that has grammars for defining policies at the + PluginType level. This expression is used for registering + open generic types + + + + + Convenience method that sets the default concrete type of the PluginType. The "concreteType" + can only accept types that do not have any primitive constructor arguments. + StructureMap has to know how to construct all of the constructor argument types. + + + + + + + Use this configured Instance as is + + + + + + Shorter way to call TheDefaultIsConcreteType + + + + + + + Shortcut to add a value by type + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Configure this type as the supplied value + + + + + + Sets the object creation of the instances of the PluginType. For example: PerRequest, + Singleton, ThreadLocal, HttpContext, or Hybrid + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Registers an IBuildInterceptor for this Plugin Type that executes before + any object of this PluginType is created. IBuildInterceptor's can be + used to create a custom scope + + + + + + + Convenience method to mark a PluginFamily as a Singleton + + + + + + Convenience method to mark a PluginFamily as a Hybrid lifecycle + + + + + + Convenience method to mark a PluginFamily as HttpContext scoped + + + + + + + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. You can also chain other declarations after + this method to add constructor and setter arguments + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type by a specified name. You can also chain other declarations after + this method to add constructor and setter arguments + + + + + + + + Specify the value of this explicit argument + + + + + + + Pass in additional arguments by type T + + + + + + + + Pass in additional arguments by type + + + + + + + + Pass in additional arguments by name + + + + + + + Gets the default instance of type T using the explicitly configured arguments from the "args" + + + + + + + Gets a named instance of type T using the explicitly configured arguments from teh "args" + + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + Gets all configured instances of type T using explicitly configured arguments + + + + + + + Returns the System.Reflection.ConstructorInfo for the PluggedType. Uses either + the "greediest" constructor with the most arguments or the constructor function + marked with the [DefaultConstructor] + + + + + + The InstanceKey of the default instance of the PluginFamily + + + + + The CLR Type that defines the "Plugin" interface for the PluginFamily + + + + + Add an Assembly to the scanning operation + + + + + + Add an Assembly by name to the scanning operation + + + + + + Add the currently executing Assembly to the scanning operation + + + + + Add the Assembly that contains type T to the scanning operation + + + + + + Add the Assembly that contains type to the scanning operation + + + + + + Sweep the designated path and add any Assembly's found in this folder to the + scanning operation + + + + + + Sweep the designated path and add any Assembly's found in this folder to the + scanning operation. The assemblyFilter can be used to filter or limit the + Assembly's that are picked up. + + + + + + + Sweep the application base directory of current app domain and add any Assembly's + found to the scanning operation. + + + + + Sweep the application base directory of current app domain and add any Assembly's + found to the scanning operation. The assemblyFilter can be used to filter or limit the + Assembly's that are picked up. + + + + + Adds an ITypeScanner object to the scanning operation + + + + + + Creates and adds a new ITypeScanner of type T to this scanning operation + + + + + + Directs the scanning operation to automatically detect and include any Registry + classes found in the Assembly's being scanned + + + + + Add all concrete types of the Plugin Type as Instances of Plugin Type + + + + + + Add all concrete types of the Plugin Type as Instances of Plugin Type + + + + + + Makes this scanning operation ignore all [PluginFamily] and [Pluggable] attributes + + + + + Exclude types that match the Predicate from being scanned + + + + + + Exclude all types in this nameSpace or its children from the scanning operation + + + + + + Exclude all types in this nameSpace or its children from the scanning operation + + + + + + Only include types matching the Predicate in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Only include types from this nameSpace or its children in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Only include types from this nameSpace or its children in the scanning operation. You can + use multiple Include() calls in a single scanning operation + + + + + + Exclude this specific type from the scanning operation + + + + + + Adds a registration convention to be applied to all the types in this + logical "scan" operation + + + + + + Adds a registration convention to be applied to all the types in this + logical "scan" operation + + + + + Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete + class named "Something" that implements "ISomething" will be automatically + added to PluginType "ISomething" + + + + + Scans for PluginType's and Concrete Types that close the given open generic type + + + + + + + + + Automatically registers all concrete types without primitive arguments + against its first interface, if any + + + + + Directs the scanning to automatically register any type that is the single + implementation of an interface against that interface. + The filters apply + + + + + Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete + class named "Something" that implements "ISomething" will be automatically + added to PluginType "ISomething" + + + + + Scans for PluginType's and Concrete Types that close the given open generic type + + + + + + + + + Automatically registers all concrete types without primitive arguments + against its first interface, if any + + + + + Directs the scanning to automatically register any type that is the single + implementation of an interface against that interface. + The filters apply + + + + + A TypeInterceptor that is only applied if the MatchesType() + method is true for a given Type + + + + + An InstanceInterceptor can be registered on a per-Instance basis + to act on, or even replace, the object that is created before + it is passed back to the caller. This is primarily a hook + for runtime AOP scenarios. + + + + + Does this TypeInterceptor apply to the given type? + + + + + + + Specify how objects matching the Type predicate + will be intercepted + + + + + + Specify how objects matching the Type predicate + will be intercepted + + + + + + Used for auto-mocking container. When the factory is missing, we can generate a mock for it + + + + + An Instance class that builds objects by calling a constructor function on a concrete type + and filling setter properties. ConfiguredInstance should only be used for open generic types. + Favor SmartInstance{T} for all other usages. + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + Inline definition of a dependency array like IService[] or IHandler[] + + + + + + + Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE + + + + + + + Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE + + + + + + + Inline definition of a constructor or a setter property dependency + + + + + + + Starts the definition of a child instance specifying the argument name + in the case of a constructor function that consumes more than one argument + of type T + + + + + + + + Inline definition of a constructor dependency + + + + + + + + Inline definition of a setter dependency + + + + + + + + Start the definition of a primitive argument to a constructor argument + + + + + + + Configure a primitive constructor argument + + + + + + + Configures an array of Instance's for the array dependency + + + + + + + Part of the Fluent Interface, represents a nonprimitive argument to a + constructure function + + + + + Use a previously configured and named instance for the child + + + + + + + Start the definition of a child instance by defining the concrete type + + + + + + + Start the definition of a child instance by defining the concrete type + + + + + + + Registers a configured instance to use as the argument to the parent's + constructor + + + + + + + Directs StructureMap to fill this dependency with the Default Instance of the + constructor or property type + + + + + + Base class for many of the Instance subclasses to support + method chaining in the Registry DSL for common options + + + + + + Set the name of this Instance + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + + Register an InstanceInterceptor with this Instance + + + + + + + Used to override the constructor of a class to be used by StructureMap to create + a Pluggable object + + + + + Examines a System.Type object and determines the ConstructorInfo to use in creating + instances of the Type + + + + + + + Used to implicitly mark a class as a Plugin candidate for StructureMap + + + + + Determines whether a Type object is marked as Pluggable + + + + + + + The ConcreteKey alias of the Type + + + + + Declares a class, abstract class, or interface to be the target of a PluginFamily in the container + + + + + Determines if a Type object is marked as a PluginFamily + + + + + + + If set, determines the shared "scope" of the instance -- PerRequest, Singleton, ThreadLocal, + HttpContext, etc. + + + + + InstanceKey of the default instance. Used to implicitly define the default without + declaring the instance in StructureMap.config + + + + + Declares the target to be built by StructureMap as a Singleton. One object instance will + be created for each named instance + + + + + Marks a Property in a Pluggable class as filled by setter injection + + + + + Marks a method with no parameters as a method that validates an instance. StructureMap + uses this method to validate the configuration file. If the method does not throw an + exception, the object is assumed to be valid. + + + + + Returns an array of any MethodInfo's on a Type that are marked as ValidationMethod + + CLR Type to search for validation methods + + + + + Constants for the names of Xml nodes and attributes in the StructureMap.config + file + + + + + The name of the default configuration file. The value is always StructurMap.config + + + + + Returns the absolute path to the StructureMap.config file + + + + + + Expression Builder that has grammars for defining policies at the + PluginType level + + + + + Add multiple Instance's to this PluginType + + + + + + + Conditional binding of instances + + + + + + + Access to all of the uncommon Instance types + + + + + + + Access to all of the uncommon Instance types + + + + + + + Convenience method that sets the default concrete type of the PluginType. Type T + can only accept types that do not have any primitive constructor arguments. + StructureMap has to know how to construct all of the constructor argument types. + + + + + + + + Shorthand to say TheDefault.Is.ConstructedBy(func) + + + + + + + Shorthand to say TheDefault.Is.ConstructedBy(func) + + + + + + + Shorthand to say TheDefault.IsThis(@object) + + + + + + + Sets the object creation of the instances of the PluginType. For example: PerRequest, + Singleton, ThreadLocal, HttpContext, or Hybrid + + + + + + + Convenience method to mark a PluginFamily as a Singleton + + + + + + Convenience method to mark a PluginFamily as a Transient + + + + + + Convenience method to mark a PluginFamily as a Hybrid lifecycle + + + + + + Convenience method to mark a PluginFamily as HttpContext scoped + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Adds an Interceptor to only this PluginType + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register an Action to run against any object of this PluginType immediately after + it is created, but before the new object is passed back to the caller + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Register a Func to run against any object of this PluginType immediately after it is created, + but before the new object is passed back to the caller. Unlike OnCreation(), + EnrichWith() gives the the ability to return a different object. Use this method for runtime AOP + scenarios or to return a decorator. + + + + + + + Shortcut method to add an additional Instance to this Plugin Type + as just a Concrete Type. This will only work if the Concrete Type + has no primitive constructor or mandatory Setter arguments. + + + + + + + Registers an ILifecycle for this Plugin Type that executes before + any object of this PluginType is created. ILifecycle's can be + used to create a custom scope + + + + + + + Largely deprecated and unnecessary with the ability to add Xml configuration files + + + + + + + Forces StructureMap to always use a unique instance to + stop the "BuildSession" caching + + + + + + Adds the object to to the PLUGINTYPE + + + + + + + Add an Instance to this type created by a Lambda + + + + + + + Define the Default Instance for this PluginType + + + + + Expression class to help define a runtime Profile + + + + + Starts the definition of the default instance for the containing Profile. This is + still valid, but Type() is recommended + + + + + + + Designate or define the Instance for a type within + this Profile + + + + + + + Use statement to define the Profile defaults for a Generic type + + + + + + + Expression Builder inside of a Profile creation for + open generic types + + + + + Use this concreteType for the Instance of this Profile for the PluginType + + + + + + + Use this concreteType for the Instance of this Profile for the PluginType + + + + + + + Use this Instance for the Profile Instance of this Plugin Type + + + + + + + Use the named Instance as the Profile Instance for this PluginType + + + + + + + Use the named Instance as the Profile Instance for this PluginType + + + + + + + For this type and profile, build the object with this Lambda + + + + + + + Expression Builder within defining a Profile + + + + + + Use a named, preconfigured instance as the default instance for this profile + + + + + + + Use a named, preconfigured instance as the default instance for this profile + + + + + + + Define the default instance of the PluginType for the containing Profile + + + + + + + For this Profile, use an Instance with this Func + + + + + + + For this Profile, use an Instance with this Func + + + + + + + For this Profile, use this object + + + + + + + Access to the uncommon types of Instance + + + + + + For this Profile, use the Concrete Type + + + + + + + For this profile, use this concrete type + + + + + + + A Registry class provides methods and grammars for configuring a Container or ObjectFactory. + Using a Registry subclass is the recommended way of configuring a StructureMap Container. + + + public class MyRegistry : Registry + { + public MyRegistry() + { + ForRequestedType(typeof(IService)).TheDefaultIsConcreteType(typeof(Service)); + } + } + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Imports the configuration from another registry into this registry. + + + + + + Imports the configuration from another registry into this registry. + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + This method is a shortcut for specifying the default constructor and + setter arguments for a ConcreteType. ForConcreteType is shorthand for: + ForRequestedType[T]().Use[T].************** + when the PluginType and ConcreteType are the same Type + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Convenience method. Equivalent of ForRequestedType[PluginType]().AsSingletons() + + + + + + + Uses the configuration expressions of this Registry to create a PluginGraph + object that could be used to initialize a Container. This method is + mostly for internal usage, but might be helpful for diagnostics + + + + + + Adds an additional, non-Default Instance to the PluginType T. + + + + + + + Adds an additional, non-Default Instance to the designated pluginType + This method is mostly meant for open generic types + + + + + + + Expression Builder to define the defaults for a named Profile. Each call + to CreateProfile is additive. + + + + + + + An alternative way to use CreateProfile that uses ProfileExpression + as a Nested Closure. This usage will result in cleaner code for + multiple declarations + + + + + + + Registers a new TypeInterceptor object with the Container + + + + + + Allows you to define a TypeInterceptor inline with Lambdas or anonymous delegates + + + + + IfTypeMatches( ... ).InterceptWith( o => new ObjectWrapper(o) ); + + + + + Designates a policy for scanning assemblies to auto + register types + + + + + + Directs StructureMap to always inject dependencies into any and all public Setter properties + of the type PLUGINTYPE. + + + + + + + Creates automatic "policies" for which public setters are considered mandatory + properties by StructureMap that will be "setter injected" as part of the + construction process. + + + + + + Use to programmatically select the constructor function of a concrete + class. Applies globally to all Containers in a single AppDomain. + + + + + + + All requests For the "TO" types will be filled by fetching the "FROM" + type and casting it to "TO" + GetInstance(typeof(TO)) basically becomes (TO)GetInstance(typeof(FROM)) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( @object ) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( instance ) + + + + + + + + Shorthand for ForRequestedType(pluginType) + + + + + + + + Advanced Usage Only! Skips the Registry and goes right to the inner + Semantic Model of StructureMap. Use with care + + + + + + Adds the concreteType as an Instance of the pluginType. Mostly useful + for conventions + + + + + + + Adds the concreteType as an Instance of the pluginType with a name. Mostly + useful for conventions + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType. + Mostly useful for conventions + + + + + + Imports the configuration from another registry into this registry. + + + + + + Imports the configuration from another registry into this registry. + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + This method is a shortcut for specifying the default constructor and + setter arguments for a ConcreteType. ForConcreteType is shorthand for: + For[T]().Use[T].************** + when the PluginType and ConcreteType are the same Type + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Convenience method. Equivalent of ForRequestedType[PluginType]().Singletons() + + + + + + + Uses the configuration expressions of this Registry to create a PluginGraph + object that could be used to initialize a Container. This method is + mostly for internal usage, but might be helpful for diagnostics + + + + + + Adds an additional, non-Default Instance to the PluginType T. + + + + + + + Adds an additional, non-Default Instance to the designated pluginType + This method is mostly meant for open generic types + + + + + + + Expression Builder to define the defaults for a named Profile. Each call + to CreateProfile is additive. + + + + + + + An alternative way to use CreateProfile that uses ProfileExpression + as a Nested Closure. This usage will result in cleaner code for + multiple declarations + + + + + + + Registers a new TypeInterceptor object with the Container + + + + + + Allows you to define a TypeInterceptor inline with Lambdas or anonymous delegates + + + + + IfTypeMatches( ... ).InterceptWith( o => new ObjectWrapper(o) ); + + + + + Designates a policy for scanning assemblies to auto + register types + + + + + + Directs StructureMap to always inject dependencies into any and all public Setter properties + of the type PLUGINTYPE. + + + + + + + Creates automatic "policies" for which public setters are considered mandatory + properties by StructureMap that will be "setter injected" as part of the + construction process. + + + + + + Use to programmatically select the constructor function of a concrete + class. Applies globally to all Containers in a single AppDomain. + + + + + + + All requests For the "TO" types will be filled by fetching the "FROM" + type and casting it to "TO" + GetInstance(typeof(TO)) basically becomes (TO)GetInstance(typeof(FROM)) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( @object ) + + + + + + + Syntactic Sugar for saying ForRequestedType().TheDefault.IsThis( instance ) + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. BuildInstancesOf() + and ForRequestedType() are synonyms + + + + + + + Expression Builder used to define policies for a PluginType including + Scoping, the Default Instance, and interception. This method is specifically + meant for registering open generic types + + + + + + + Advanced Usage Only! Skips the Registry and goes right to the inner + Semantic Model of StructureMap. Use with care + + + + + + Define the constructor and setter arguments for the default T + + + + + + Thrown by IProperty classes when an invalid value is applied to + a property of an InstanceGraph + + + + + Main exception for StructureMap. Use the ErrorCode to aid in troubleshooting + StructureMap problems + + + + + Represents a concrete class that can be built by StructureMap as an instance of the parent + PluginFamily’s PluginType. The properties of a Plugin are the CLR Type of the concrete class, + and the human-friendly concrete key that StructureMap will use to identify the Type. + + + + + The ConcreteKey that identifies the Plugin within a PluginFamily + + + + + The concrete CLR Type represented by the Plugin + + + + + Property's that will be filled by setter injection + + + + + Conceptually speaking, a PluginFamily object represents a point of abstraction or variability in + the system. A PluginFamily defines a CLR Type that StructureMap can build, and all of the possible + Plugin’s implementing the CLR Type. + + + + + The CLR Type that defines the "Plugin" interface for the PluginFamily + + + + + The InstanceKey of the default instance of the PluginFamily + + + + + Custom collection class for PluginFamily's + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Models the runtime configuration of a StructureMap Container + + + + + Closes the PluginGraph for adding or removing members. Runs all the AssemblyScanner's + and attempts to attach concrete types to the proper plugin types. Calculates the Profile defaults. + + + + + Adds the concreteType as an Instance of the pluginType + + + + + + + Adds the concreteType as an Instance of the pluginType with a name + + + + + + + + Add the pluggedType as an instance to any configured pluginType where pluggedType + could be assigned to the pluginType + + + + + + Adds an AssemblyScanner to the PluginGraph. Used for Testing. + + + + + + Add configuration to a PluginGraph with the Registry DSL + + + + + + Designates whether a PluginGraph has been "Sealed." + + + + + Represents a PropertyInfo of a Plugin.PluggedType that is filled by Setter Injection + + + + + Custom collection class for SetterProperty objects + + + + + Designates a CLR type that is loaded by name. + + + + + Interface for a "Factory" pattern class that creates object instances of the PluginType + + + + + The main "container" object that implements the Service Locator pattern + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates or finds the named instance of T + + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Gets all configured instances of type T using explicitly configured arguments from the "args" + + + + + + + + Gets the default instance of type T using the explicitly configured arguments from the "args" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + Gets the named instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + + Starts a "Nested" Container for atomic, isolated access + + + + + + Starts a new "Nested" Container for atomic, isolated service location. Opens + + + + + + + Provides queryable access to the configured PluginType's and Instances of this Container + + + + + The name of the container. By default this is set to + a random Guid. This is a convience property to + assist with debugging. Feel free to set to anything, + as this is not used in any logic. + + + + + Default implementation of IInstanceFactory + + + + + Constructor to use when troubleshooting possible configuration issues. + + + + + + Constructor to create an Container + + PluginGraph containing the instance and type definitions + for the Container + + + + Creates or finds the named instance of T + + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + Gets the default instance of the pluginType using the explicitly configured arguments from the "args" + + + + + + + + Gets all configured instances of type T using explicitly configured arguments from the "args" + + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + + Starts a "Nested" Container for atomic, isolated access + + + + + + Starts a new "Nested" Container for atomic, isolated service location. Opens + + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Sets the default instance for the PluginType + + + + + + + Provides queryable access to the configured PluginType's and Instances of this Container + + + + + The name of the container. By default this is set to + a random Guid. This is a convience property to + assist with debugging. Feel free to set to anything, + as this is not used in any logic. + + + + + GoF Memento representing an Object Instance + + + + + Retrieves the named property value as a string + + + + + + + Template method for implementation specific retrieval of the named property + + + + + + + Returns the named child InstanceMemento + + + + + + + Template method for implementation specific retrieval of the named property + + + + + + + This method is made public for testing. It is not necessary for normal usage. + + + + + + Used to create a templated InstanceMemento + + + + + + + The named type of the object instance represented by the InstanceMemento. Translates to a concrete + type + + + + + The named key of the object instance represented by the InstanceMemento + + + + + Gets the referred template name + + + + + + Template pattern property specifying whether the InstanceMemento is simply a reference + to another named instance. Useful for child objects. + + + + + Template pattern property specifying the instance key that the InstanceMemento refers to + + + + + Is the InstanceMemento a reference to the default instance of the plugin type? + + + + + A TypeInterceptor that always applies to all Instances of a given Plugin Type + + + + + Abstract class that is the supertype of all storage and retrieval mechanisms of + InstanceMemento instances + + + + + Retrieves the named InstanceMemento + + The instanceKey of the requested InstanceMemento + + + + + Retrieves an array of all InstanceMemento's stored by this MementoSource + + + + + + Template pattern method. Determines if the MementoSource contains a definition for the + requested instanceKey. + + + + + + + Template pattern method. Retrieves an InstanceMemento for the instanceKey + + + + + + + The type of MementoSource + + + + + String description of the MementoSource. Used in the StructureMap-Client UI. + + + + + An in-memory implementation of InstanceMemento. + + + + + Creates an instance of MemoryInstanceMemento that represents a reference to another + instance. + + The referenced instance key to another instance + + + + + Creates a MemoryInstanceMemento that represents a reference to the default instance + of a plugin type. + + + + + + Constructs a MemoryInstanceMemento without properties + + The concrete key of the plugin type + The identifying instance key + + + + Constructs a MemoryInstanceMemento with properties + + The concrete key of the plugin type + The identifying instance key + NameValueCollection of instance properties + + + + Sets the value of the named property + + + + + + + Deletes a named property from the DefaultInstanceMemento + + + + + + Links a child InstanceMemento as a named property + + + + + + + Links an array of InstanceMemento's to a named array property + + + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + See InstanceMemento + + + + + The main static Facade for the StructureMap container + + + + + Restarts ObjectFactory and blows away all Singleton's and cached instances. Use with caution. + + + + + Remove and dispose all objects scoped by HttpContext. Call this method at the *end* of an Http request to clean up resources + + + + + Injects the given object into a Container as the default for the designated + pluginType. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Injects the given object into a Container as the default for the designated + PLUGINTYPE. Mostly used for temporarily setting up return values of the Container + to introduce mocks or stubs during automated testing scenarios + + + + + + + Returns a report detailing the complete configuration of all PluginTypes and Instances + + + + + + Use with caution! Does a full environment test of the configuration of this container. Will try to create every configured + instance and afterward calls any methods marked with the [ValidationMethod] attribute + + + + + Creates or finds the default instance of the pluginType + + + + + + + Creates or finds the default instance of type T + + + + + + + Creates a new instance of the requested type using the supplied Instance. Mostly used internally + + + + + + + + Creates a new instance of the requested type T using the supplied Instance. Mostly used internally + + + + + + + Creates or finds the named instance of the pluginType + + + + + + + + Creates or finds the named instance of T + + + + + + + + Creates or resolves all registered instances of the pluginType + + + + + + + Creates or resolves all registered instances of type T + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency or primitive argument + with the designated name should be the next value. + + + + + + + Starts a request for an instance or instances with explicitly configured arguments. Specifies that any dependency + of type T should be "arg" + + + + + + + + Removes all configured instances of type T from the Container. Use with caution! + + + + + + Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container. + + + + + + + + Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container. + + + + + + + Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container. + + + + + + + Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container. + + + + + + + + The "BuildUp" method takes in an already constructed object + and uses Setter Injection to push in configured dependencies + of that object + + + + + + Convenience method to request an object using an Open Generic + Type and its parameter Types + + + + + IFlattener flattener1 = container.ForGenericType(typeof (IFlattener<>)) + .WithParameters(typeof (Address)).GetInstanceAs<IFlattener>(); + + + + + + Used to add additional configuration to a Container *after* the initialization. + + + + + + Provides queryable access to the configured PluginType's and Instances of the inner Container + + + + + Sets the default instance for all PluginType's to the designated Profile. + + + + + Reads configuration XML documents and builds the structures necessary to initialize + the Container/IInstanceFactory/InstanceBuilder/ObjectInstanceActivator objects + + + + + Reads the configuration information and returns the PluginGraph definition of + plugin families and plugin's + + + + + + Generic implementation of an XmlMementoSource + + + + + Base class for all MementoSource classes that store InstanceMemento's as + node-normalized Xml + + + + + Implementation of MementoSource that stores and retrieves an XmlInstanceMemento per file in a named directory. + DirectoryXmlMementoSource is meant to simplify complicated object graph configurations by isolating each instance to a separate + editable file. + + + + + Stores an Xml InstanceMemento per file in a directory + + A ";" delimited list of directories to look for mementos. DirectoryXmlMementoSource + will use the FIRST directory it finds + The file extension of the InstanceMemento files without a dot. Typically "xml" + NodeNormalized or AttributeNormalized + + + + Implementation of MementoSource that stores and retrieves an XmlInstanceMemento per Embedded Resource file + in a named namespace. EmbeddedFolderXmlMementoSource is meant to simplify complicated object graph configurations + by isolating each instance to a separate + editable file. + + NodeNormalized or AttributeNormalized + The name of the Assembly with the embedded resources + The root namespace of all of the mementos. + The file extension of the memento files - "xml" + + + + An in-memory MementoSource + + + + + Retrieves Xml InstanceMemento's from an xml file stored as an embedded resource in an assembly. + + Designates the nodes that are memento nodes + NodeNormalized or AttributeNormalized + The name of the Assembly the file is embedded into + The path to the embedded resource within the file + + + + Default Constructor + + MementoSource that contains the Memento Templates + MementoSource that contains instances consisting of Template valuee + + + + Stores Attribute-normalized InstanceMemento's in an external file + + + + + Implementation of XmlMementoSource that reads InstanceMemento's from an external file. + Useful to break the StructureMap.config file into smaller pieces. + + + + + Default constructor + + Path to the xml file that contains the instance configuration + XPath expression to the parent node that contains the InstanceMemento nodes. + If empty, it defaults to the top node + The name of the nodes that are InstanceMemento nodes. Useful to store + different types of instances in the same file + + + + An implementation of InstanceMemento that stores properties as Xml attributes + Limited functionality + + + + + Implementation of InstanceMemento that stores information in a node-normalized + Xml format. + + + + + specify what type you'd like the service returned as + + + + + + + Specify the open generic type that should have a single generic parameter + + + + + + + Used as the argument in the Container.Configure() method to describe + configuration directives and specify the sources of configuration for + a Container + + + + + Creates and adds a Registry object of type T. + + The Registry Type + + + + Imports all the configuration from a Registry object + + + + + + Imports configuration from an Xml file. The fileName + must point to an Xml file with valid StructureMap + configuration + + + + + + Imports configuration directly from an XmlNode. This + method was intended for scenarios like Xml being embedded + into an assembly. The node must be a 'StructureMap' node + + + + + + If true, directs StructureMap to look for configuration in the App.config. + The default value is false. + + + + + Expression Builder to define an Instance + + + + + + Register a previously built Instance. This provides a "catch all" + method to attach custom Instance objects. Synonym for Instance() + + + + + + Inject this object directly. Synonym to Object() + + + + + + + Gives you full access to all the different ways to specify an "Instance" + + + + + An Expression Builder to define Instances of a PluginType. + This is mostly used for configuring open generic types + + + + + Shortcut to register a Concrete Type as an instance. This method supports + method chaining to allow you to add constructor and setter arguments for + the concrete type + + + + + + + Shortcut to simply use the Instance with the given name + + + + + + + An Expression Builder that is used throughout the Registry DSL to + add and define Instances + + + + + + Register a previously built Instance. This provides a "catch all" + method to attach custom Instance objects. Synonym for IsThis() + + + + + + Inject this object directly. Synonym to IsThis() + + + + + + + Build the Instance with the constructor function and setter arguments. Starts + the definition of a SmartInstance + + + + + + + Build the Instance with the constructor function and setter arguments. Starts + the definition of a SmartInstance + + + + + + + Build the Instance with the constructor function and setter arguments. Use this + method for open generic types, and favor the generic version of OfConcreteType + for all other types + + + + + + + Build the Instance with the constructor function and setter arguments. Use this + method for open generic types, and favor the generic version of OfConcreteType + for all other types + + + + + + + Create an Instance that builds an object by calling a Lambda or + an anonymous delegate with no arguments + + + + + + + Create an Instance that builds an object by calling a Lambda or + an anonymous delegate with the IContext representing + the current object graph. + + + + + + + Use the Instance of this PluginType with the specified name. This is + generally only used while configuring child dependencies within a deep + object graph + + + + + + + Use the default Instance of this PluginType. This is + generally only used while configuring child dependencies within a deep + object graph + + + + + + Creates an Instance that stores this object of type T, + and returns a cloned copy of the template. + + + + + + + Caches template as a serialized byte stream. Uses deserialization + to create copies when the Instance is built. + + + + + + + Creates an Instance that will load an ASCX user control from the url + + + + + + + Creates an Instance according to conditional rules + + + + + + + Used as an expression builder to specify setter injection policies + + + + + Directs StructureMap to treat all public setters of type T as + mandatory properties + + + + + + Directs StructureMap to tread all public setters with + a PropertyType that matches the predicate as a + mandatory setter + + + + + + Directs StructureMap to treat all public setters that match the + rule as mandatory properties + + + + + + Directs StructureMap to treat all public setters with a property + type in the specified namespace as mandatory properties + + + + + + Directs StructureMap to treat all public setters with a property + type in the specified namespace as mandatory properties + + + + + + Directs StructureMap to treat all public setters where to property name + matches the specified rule as a mandatory property + + + + + + Base class for creating an object instance from an InstanceMemento. SubClasses are + emitted for each concrete Plugin with constructor parameters. + + + + + Allows built-in registration conventions to be configurable through the assembly scanning DSL + + + Intended for StructureMap internal use only. + Custom registration convention instances can be directly configured + before being passed to IAssemblyScanner.With(IRegistrationConvention). + + + + + Simply query to see if there are any implementations registered + + + + + + Ejects any instances of this instance from the current container + and permanently removes the instance from the container configuration + + + + + + Eject all instances of this PluginType from the current container, + but leaves the lifecycle behavior + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + Models the state of a Container or ObjectFactory. Can be used to query for the + existence of types registered with StructureMap + + + + + Can StructureMap fulfill a request to ObjectFactory.GetInstance(pluginType) from the + current configuration. This does not include concrete classes that could be auto-configured + upon demand + + + + + + + Can StructureMap fulfill a request to ObjectFactory.GetInstance<T>() from the + current configuration. This does not include concrete classes that could be auto-configured + upon demand + + + + + + + Queryable access to all of the InstanceRef for a given PluginType + + + + + + + Queryable access to all of the InstanceRef for a given PluginType + + + + + + Does the current container have existing configuration for the "pluginType" + + + + + + + Does the current container have existing configuration for the type T + + + + + + Find the concrete type for the default Instance of T. + In other words, when I call Container.GetInstance(Type), + what do I get? May be indeterminate + + + + + + + Find the concrete type for the default Instance of pluginType. + In other words, when I call Container.GetInstance(Type), + what do I get? May be indeterminate + + + + + + Retrieves the configuration for the given type + + + + + + + Retrieves the configuration for the given type + + + + + + + Eject all objects, configuration, and Plugin Types matching this filter + + + + + + Eject all objects and configuration for any Plugin Type that matches this filter + + + + + + Eject all objects and Instance configuration for this PluginType + + + + + + Get each and every configured instance that could possibly + be cast to T + + + + + + + Access to all the Plugin Type registrations + + + + + Makes sure that every request for this object returns a unique object + + + + + Simply query to see if there are any implementations registered + + + + + + The "instance" that will be used when Container.GetInstance(PluginType) is called. + See InstanceRef for more information + + + + + The build "policy" for this PluginType. Used by the WhatDoIHave() diagnostics methods + + + + + All of the InstanceRef's registered + for this PluginType + + + + + The actual concrete type of this Instance. Not every type of IInstance + can determine the ConcreteType + + + + + Ejects and removes all objects and the configuration for the named instance from the + container + + + + + + + Ejects and removes all objects and configuration for the instances that match the filter + + + + + + + Determines if the pluggedType can be upcast to the pluginType + + + + + + + + Determines if the PluggedType is a valid Plugin into the + PluginType + + + + + + + + Imports configuration from an Xml file. The fileName + must point to an Xml file with valid StructureMap + configuration + + + + + + Imports configuration directly from an XmlNode. This + method was intended for scenarios like Xml being embedded + into an assembly. The node must be a 'StructureMap' node + + + + + + Creates and adds a Registry object of type T. + + The Registry Type + + + + Imports all the configuration from a Registry object + + + + + + If true, makes the existence of the StructureMap.config mandatory. + The default is false. + + + + + If true, the StructureMap.config file will be ignored even if it exists. + The default is false. + + + + + If true, directs StructureMap to look for configuration in the App.config. + The default value is false. + + + + + Designate the Default Profile. This will be applied as soon as the + Container is initialized. + + + + + Retrieves the configuration for the given type + + + + + + + Retrieves the configuration for the given type + + + + + + + Eject all objects, configuration, and Plugin Types matching this filter + + + + + + Eject all objects and configuration for any Plugin Type that matches this filter + + + + + + Eject all objects and Instance configuration for this PluginType + + + + + + Get each and every configured instance that could possibly + be cast to T + + + + + + + The requested PluginType of the Instance being create + + + + + The Name of the Instance being created + + + + + The actual ConcreteType being created. This will not always + be available + + + + + Models the current place in an object graph during the construction of + an instance. Provides contextual information that can be used + to alter the desired construction of child objects + + + + + The requested PluginType of the Instance being create + + + + + The Name of the Instance being created + + + + + The actual ConcreteType being created. This will not always + be available + + + + + Provides metadata about the object graph being constructed. More or less a stack trace of the GetInstance() pipeline + that can be used for "contextual" object construction + + + + + The top level of the object graph. Describes the original requested instance + + + + + The current BuildFrame + + + + + The immediate parent BuildFrame + + + + + Defines the value of a primitive argument to a constructur argument + + + + + Sets the value of the constructor argument + + + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings + + The key in appSettings for the value to use. + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings when it exists. Otherwise uses the provided default value. + + The key in appSettings for the value to use. + The value to use if an entry for does not exist in the appSettings section. + + + + + Instance that builds objects with by calling constructor functions and using setter properties + + The concrete type constructed by SmartInstance + + + + Sets the name of this Instance + + + + + + + Sets the name of this Instance + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + Register an Action to perform on the object created by this Instance + before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register a Func to potentially enrich or substitute for the object + created by this Instance before it is returned to the caller + + + + + + + Register an InstanceInterceptor with this Instance + + + + + + + Define a primitive constructor argument + + + + + + + Set simple setter properties + + + + + + + Define a primitive setter property by specifying the property name with + an expression + + + + + + + Define a primitive setter property by specifying the property name + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type. Do not + use this method if there is more than one constructor arguments of the same type + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type. Do not + use this method if there is more than one constructor arguments of the same type + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type and constructor name. + Use this method if there is more than one constructor arguments of the same type + + + + + + + + Inline definition of a constructor dependency. Select the constructor argument by type and constructor name. + Use this method if there is more than one constructor arguments of the same type + + + + + + + + Inline definition of a setter dependency. The property name is specified with an Expression + + + + + + + + Inline definition of a setter dependency. The property name is specified with an Expression + + + + + + + + Inline definition of a setter dependency. Only use this method if there + is only a single property of the SETTERTYPE + + + + + + + Inline definition of a setter dependency. Only use this method if there + is only a single property of the SETTERTYPE + + + + + + + Inline definition of a dependency on an Array of the CHILD type. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + Inline definition of a dependency on an Array of the CHILD type and the specified setter property or constructor argument name. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + + Inline definition of a dependency on an Array of the CHILD type. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + Inline definition of a dependency on an Array of the CHILD type and the specified setter property or constructor argument name. I.e. CHILD[]. + This method can be used for either constructor arguments or setter properties + + + + + + + + Expression Builder to help define multiple Instances for an Array dependency + + + + + + Nested Closure that allows you to add an unlimited number of child Instances + + + + + + + Specify an array of Instance objects directly for an Array dependency + + + + + + + Expression Builder that helps to define child dependencies inline + + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings + + The key in appSettings for the value to use. + + + + + Sets the value of the constructor argument to the key/value in the + AppSettings when it exists. Otherwise uses the provided default value. + + The key in appSettings for the value to use. + The value to use if an entry for does not exist in the appSettings section. + + + + + Nested Closure to define a child dependency inline + + + + + + + Shortcut to set an inline dependency to an Instance + + + + + + + Shortcut to set an inline dependency to a designated object + + + + + + + Shortcut to set an inline dependency to a designated object + + + + + + + Set an Inline dependency to the Default Instance of the Property type + Used mostly to force an optional Setter property to be filled by + StructureMap + + + + + + Shortcut method to define a child dependency inline + + + + + + + Shortcut method to define a child dependency inline and configure + the child dependency + + + + + + + Provides virtual methods that can be used by subclasses to parse an expression tree. + + + This class actually already exists in the System.Core assembly...as an internal class. + I can only speculate as to why it is internal, but it is obviously much too dangerous + for anyone outside of Microsoft to be using... + + + + diff --git a/Website/LOC.Website.Tests/bin/Release/nunit.framework.dll b/Website/LOC.Website.Tests/bin/Release/nunit.framework.dll new file mode 100644 index 000000000..eaea9eedf Binary files /dev/null and b/Website/LOC.Website.Tests/bin/Release/nunit.framework.dll differ diff --git a/Website/LOC.Website.Tests/bin/Release/nunit.framework.xml b/Website/LOC.Website.Tests/bin/Release/nunit.framework.xml new file mode 100644 index 000000000..47fadb6bf --- /dev/null +++ b/Website/LOC.Website.Tests/bin/Release/nunit.framework.xml @@ -0,0 +1,10845 @@ + + + + nunit.framework + + + + + Attribute used to apply a category to a test + + + + + The name of the category + + + + + Construct attribute for a given category based on + a name. The name may not contain the characters ',', + '+', '-' or '!'. However, this is not checked in the + constructor since it would cause an error to arise at + as the test was loaded without giving a clear indication + of where the problem is located. The error is handled + in NUnitFramework.cs by marking the test as not + runnable. + + The name of the category + + + + Protected constructor uses the Type name as the name + of the category. + + + + + The name of the category + + + + + Used to mark a field for use as a datapoint when executing a theory + within the same fixture that requires an argument of the field's Type. + + + + + Used to mark an array as containing a set of datapoints to be used + executing a theory within the same fixture that requires an argument + of the Type of the array elements. + + + + + Attribute used to provide descriptive text about a + test case or fixture. + + + + + Construct the attribute + + Text describing the test + + + + Gets the test description + + + + + Enumeration indicating how the expected message parameter is to be used + + + + Expect an exact match + + + Expect a message containing the parameter string + + + Match the regular expression provided as a parameter + + + Expect a message that starts with the parameter string + + + + ExpectedExceptionAttribute + + + + + + Constructor for a non-specific exception + + + + + Constructor for a given type of exception + + The type of the expected exception + + + + Constructor for a given exception name + + The full name of the expected exception + + + + Gets or sets the expected exception type + + + + + Gets or sets the full Type name of the expected exception + + + + + Gets or sets the expected message text + + + + + Gets or sets the user message displayed in case of failure + + + + + Gets or sets the type of match to be performed on the expected message + + + + + Gets the name of a method to be used as an exception handler + + + + + ExplicitAttribute marks a test or test fixture so that it will + only be run if explicitly executed from the gui or command line + or if it is included by use of a filter. The test will not be + run simply because an enclosing suite is run. + + + + + Default constructor + + + + + Constructor with a reason + + The reason test is marked explicit + + + + The reason test is marked explicit + + + + + Attribute used to mark a test that is to be ignored. + Ignored tests result in a warning message when the + tests are run. + + + + + Constructs the attribute without giving a reason + for ignoring the test. + + + + + Constructs the attribute giving a reason for ignoring the test + + The reason for ignoring the test + + + + The reason for ignoring a test + + + + + Abstract base for Attributes that are used to include tests + in the test run based on environmental settings. + + + + + Constructor with no included items specified, for use + with named property syntax. + + + + + Constructor taking one or more included items + + Comma-delimited list of included items + + + + Name of the item that is needed in order for + a test to run. Multiple itemss may be given, + separated by a comma. + + + + + Name of the item to be excluded. Multiple items + may be given, separated by a comma. + + + + + The reason for including or excluding the test + + + + + PlatformAttribute is used to mark a test fixture or an + individual method as applying to a particular platform only. + + + + + Constructor with no platforms specified, for use + with named property syntax. + + + + + Constructor taking one or more platforms + + Comma-deliminted list of platforms + + + + CultureAttribute is used to mark a test fixture or an + individual method as applying to a particular Culture only. + + + + + Constructor with no cultures specified, for use + with named property syntax. + + + + + Constructor taking one or more cultures + + Comma-deliminted list of cultures + + + + Marks a test to use a combinatorial join of any argument data + provided. NUnit will create a test case for every combination of + the arguments provided. This can result in a large number of test + cases and so should be used judiciously. This is the default join + type, so the attribute need not be used except as documentation. + + + + + PropertyAttribute is used to attach information to a test as a name/value pair.. + + + + + Construct a PropertyAttribute with a name and string value + + The name of the property + The property value + + + + Construct a PropertyAttribute with a name and int value + + The name of the property + The property value + + + + Construct a PropertyAttribute with a name and double value + + The name of the property + The property value + + + + Constructor for derived classes that set the + property dictionary directly. + + + + + Constructor for use by derived classes that use the + name of the type as the property name. Derived classes + must ensure that the Type of the property value is + a standard type supported by the BCL. Any custom + types will cause a serialization Exception when + in the client. + + + + + Gets the property dictionary for this attribute + + + + + Default constructor + + + + + Marks a test to use pairwise join of any argument data provided. + NUnit will attempt too excercise every pair of argument values at + least once, using as small a number of test cases as it can. With + only two arguments, this is the same as a combinatorial join. + + + + + Default constructor + + + + + Marks a test to use a sequential join of any argument data + provided. NUnit will use arguements for each parameter in + sequence, generating test cases up to the largest number + of argument values provided and using null for any arguments + for which it runs out of values. Normally, this should be + used with the same number of arguments for each parameter. + + + + + Default constructor + + + + + Summary description for MaxTimeAttribute. + + + + + Construct a MaxTimeAttribute, given a time in milliseconds. + + The maximum elapsed time in milliseconds + + + + RandomAttribute is used to supply a set of random values + to a single parameter of a parameterized test. + + + + + ValuesAttribute is used to provide literal arguments for + an individual parameter of a test. + + + + + Abstract base class for attributes that apply to parameters + and supply data for the parameter. + + + + + Gets the data to be provided to the specified parameter + + + + + The collection of data to be returned. Must + be set by any derived attribute classes. + We use an object[] so that the individual + elements may have their type changed in GetData + if necessary. + + + + + Construct with one argument + + + + + + Construct with two arguments + + + + + + + Construct with three arguments + + + + + + + + Construct with an array of arguments + + + + + + Get the collection of values to be used as arguments + + + + + Construct a set of doubles from 0.0 to 1.0, + specifying only the count. + + + + + + Construct a set of doubles from min to max + + + + + + + + Construct a set of ints from min to max + + + + + + + + Get the collection of values to be used as arguments + + + + + RangeAttribute is used to supply a range of values to an + individual parameter of a parameterized test. + + + + + Construct a range of ints using default step of 1 + + + + + + + Construct a range of ints specifying the step size + + + + + + + + Construct a range of longs + + + + + + + + Construct a range of doubles + + + + + + + + Construct a range of floats + + + + + + + + RepeatAttribute may be applied to test case in order + to run it multiple times. + + + + + Construct a RepeatAttribute + + The number of times to run the test + + + + RequiredAddinAttribute may be used to indicate the names of any addins + that must be present in order to run some or all of the tests in an + assembly. If the addin is not loaded, the entire assembly is marked + as NotRunnable. + + + + + Initializes a new instance of the class. + + The required addin. + + + + Gets the name of required addin. + + The required addin name. + + + + Summary description for SetCultureAttribute. + + + + + Construct given the name of a culture + + + + + + Summary description for SetUICultureAttribute. + + + + + Construct given the name of a culture + + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + SetUpFixtureAttribute is used to identify a SetUpFixture + + + + + Attribute used to mark a static (shared in VB) property + that returns a list of tests. + + + + + Attribute used to identify a method that is called + immediately after each test is run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Provide actions to execute before and after tests. + + + + + When implemented by an attribute, this interface implemented to provide actions to execute before and after tests. + + + + + Executed before each test is run + + Provides details about the test that is going to be run. + + + + Executed after each test is run + + Provides details about the test that has just been run. + + + + Provides the target for the action attribute + + The target for the action attribute + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + + [Test(Description = "more detailed description")] + publc void TestDescriptionMethod() + {} + } + + + + + + Descriptive text for this test + + + + + TestCaseAttribute is used to mark parameterized test cases + and provide them with their arguments. + + + + + The ITestCaseData interface is implemented by a class + that is able to return complete testcases for use by + a parameterized test method. + + NOTE: This interface is used in both the framework + and the core, even though that results in two different + types. However, sharing the source code guarantees that + the various implementations will be compatible and that + the core is able to reflect successfully over the + framework implementations of ITestCaseData. + + + + + Gets the argument list to be provided to the test + + + + + Gets the expected result + + + + + Indicates whether a result has been specified. + This is necessary because the result may be + null, so it's value cannot be checked. + + + + + Gets the expected exception Type + + + + + Gets the FullName of the expected exception + + + + + Gets the name to be used for the test + + + + + Gets the description of the test + + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + + Gets a value indicating whether this is explicit. + + true if explicit; otherwise, false. + + + + Gets the ignore reason. + + The ignore reason. + + + + Construct a TestCaseAttribute with a list of arguments. + This constructor is not CLS-Compliant + + + + + + Construct a TestCaseAttribute with a single argument + + + + + + Construct a TestCaseAttribute with a two arguments + + + + + + + Construct a TestCaseAttribute with a three arguments + + + + + + + + Gets the list of arguments to a test case + + + + + Gets or sets the expected result. + + The result. + + + + Gets the expected result. + + The result. + + + + Gets a flag indicating whether an expected + result has been set. + + + + + Gets a list of categories associated with this test; + + + + + Gets or sets the category associated with this test. + May be a single category or a comma-separated list. + + + + + Gets or sets the expected exception. + + The expected exception. + + + + Gets or sets the name the expected exception. + + The expected name of the exception. + + + + Gets or sets the expected message of the expected exception + + The expected message of the exception. + + + + Gets or sets the type of match to be performed on the expected message + + + + + Gets or sets the description. + + The description. + + + + Gets or sets the name of the test. + + The name of the test. + + + + Gets or sets the ignored status of the test + + + + + Gets or sets the ignored status of the test + + + + + Gets or sets the explicit status of the test + + + + + Gets or sets the reason for not running the test + + + + + Gets or sets the reason for not running the test. + Set has the side effect of marking the test as ignored. + + The ignore reason. + + + + FactoryAttribute indicates the source to be used to + provide test cases for a test method. + + + + + Construct with the name of the factory - for use with languages + that don't support params arrays. + + An array of the names of the factories that will provide data + + + + Construct with a Type and name - for use with languages + that don't support params arrays. + + The Type that will provide data + The name of the method, property or field that will provide data + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets or sets the category associated with this test. + May be a single category or a comma-separated list. + + + + + [TestFixture] + public class ExampleClass + {} + + + + + Default constructor + + + + + Construct with a object[] representing a set of arguments. + In .NET 2.0, the arguments may later be separated into + type arguments and constructor arguments. + + + + + + Descriptive text for this fixture + + + + + Gets and sets the category for this fixture. + May be a comma-separated list of categories. + + + + + Gets a list of categories for this fixture + + + + + The arguments originally provided to the attribute + + + + + Gets or sets a value indicating whether this should be ignored. + + true if ignore; otherwise, false. + + + + Gets or sets the ignore reason. May set Ignored as a side effect. + + The ignore reason. + + + + Get or set the type arguments. If not set + explicitly, any leading arguments that are + Types are taken as type arguments. + + + + + Attribute used to identify a method that is + called before any tests in a fixture are run. + + + + + Attribute used to identify a method that is called after + all the tests in a fixture have run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + + [Test(Description = "more detailed description")] + publc void TestDescriptionMethod() + {} + } + + + + + + Used on a method, marks the test with a timeout value in milliseconds. + The test will be run in a separate thread and is cancelled if the timeout + is exceeded. Used on a method or assembly, sets the default timeout + for all contained test methods. + + + + + Construct a TimeoutAttribute given a time in milliseconds + + The timeout value in milliseconds + + + + Marks a test that must run in the STA, causing it + to run in a separate thread if necessary. + + On methods, you may also use STAThreadAttribute + to serve the same purpose. + + + + + Construct a RequiresSTAAttribute + + + + + Marks a test that must run in the MTA, causing it + to run in a separate thread if necessary. + + On methods, you may also use MTAThreadAttribute + to serve the same purpose. + + + + + Construct a RequiresMTAAttribute + + + + + Marks a test that must run on a separate thread. + + + + + Construct a RequiresThreadAttribute + + + + + Construct a RequiresThreadAttribute, specifying the apartment + + + + + ValueSourceAttribute indicates the source to be used to + provide data for one parameter of a test method. + + + + + Construct with the name of the factory - for use with languages + that don't support params arrays. + + The name of the data source to be used + + + + Construct with a Type and name - for use with languages + that don't support params arrays. + + The Type that will provide data + The name of the method, property or field that will provide data + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + AttributeExistsConstraint tests for the presence of a + specified attribute on a Type. + + + + + The Constraint class is the base of all built-in constraints + within NUnit. It provides the operator overloads used to combine + constraints. + + + + + The IConstraintExpression interface is implemented by all + complete and resolvable constraints and expressions. + + + + + Return the top-level constraint for this expression + + + + + + Static UnsetObject used to detect derived constraints + failing to set the actual value. + + + + + The actual value being tested against a constraint + + + + + The display name of this Constraint for use by ToString() + + + + + Argument fields used by ToString(); + + + + + The builder holding this constraint + + + + + Construct a constraint with no arguments + + + + + Construct a constraint with one argument + + + + + Construct a constraint with two arguments + + + + + Sets the ConstraintBuilder holding this constraint + + + + + Write the failure message to the MessageWriter provided + as an argument. The default implementation simply passes + the constraint and the actual value to the writer, which + then displays the constraint description and the value. + + Constraints that need to provide additional details, + such as where the error occured can override this. + + The MessageWriter on which to display the message + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Test whether the constraint is satisfied by an + ActualValueDelegate that returns the value to be tested. + The default implementation simply evaluates the delegate + but derived classes may override it to provide for delayed + processing. + + An ActualValueDelegate + True for success, false for failure + + + + Test whether the constraint is satisfied by a given reference. + The default implementation simply dereferences the value but + derived classes may override it to provide for delayed processing. + + A reference to the value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + Default override of ToString returns the constraint DisplayName + followed by any arguments within angle brackets. + + + + + + Returns the string representation of this constraint + + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + + This operator creates a constraint that is satisfied if the + argument constraint is not satisfied. + + + + + Returns a DelayedConstraint with the specified delay time. + + The delay in milliseconds. + + + + + Returns a DelayedConstraint with the specified delay time + and polling interval. + + The delay in milliseconds. + The interval at which to test the constraint. + + + + + The display name of this Constraint for use by ToString(). + The default value is the name of the constraint with + trailing "Constraint" removed. Derived classes may set + this to another name in their constructors. + + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + + Returns a ConstraintExpression by appending Or + to the current constraint. + + + + + Class used to detect any derived constraints + that fail to set the actual value in their + Matches override. + + + + + Constructs an AttributeExistsConstraint for a specific attribute Type + + + + + + Tests whether the object provides the expected attribute. + + A Type, MethodInfo, or other ICustomAttributeProvider + True if the expected attribute is present, otherwise false + + + + Writes the description of the constraint to the specified writer + + + + + AttributeConstraint tests that a specified attribute is present + on a Type or other provider and that the value of the attribute + satisfies some other constraint. + + + + + Abstract base class used for prefixes + + + + + The base constraint + + + + + Construct given a base constraint + + + + + + Constructs an AttributeConstraint for a specified attriute + Type and base constraint. + + + + + + + Determines whether the Type or other provider has the + expected attribute and if its value matches the + additional constraint specified. + + + + + Writes a description of the attribute to the specified writer. + + + + + Writes the actual value supplied to the specified writer. + + + + + Returns a string representation of the constraint. + + + + + BasicConstraint is the abstract base for constraints that + perform a simple comparison to a constant value. + + + + + Initializes a new instance of the class. + + The expected. + The description. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + NullConstraint tests that the actual value is null + + + + + Initializes a new instance of the class. + + + + + TrueConstraint tests that the actual value is true + + + + + Initializes a new instance of the class. + + + + + FalseConstraint tests that the actual value is false + + + + + Initializes a new instance of the class. + + + + + NaNConstraint tests that the actual value is a double or float NaN + + + + + Test that the actual value is an NaN + + + + + + + Write the constraint description to a specified writer + + + + + + BinaryConstraint is the abstract base of all constraints + that combine two other constraints in some fashion. + + + + + The first constraint being combined + + + + + The second constraint being combined + + + + + Construct a BinaryConstraint from two other constraints + + The first constraint + The second constraint + + + + AndConstraint succeeds only if both members succeed. + + + + + Create an AndConstraint from two other constraints + + The first constraint + The second constraint + + + + Apply both member constraints to an actual value, succeeding + succeeding only if both of them succeed. + + The actual value + True if the constraints both succeeded + + + + Write a description for this contraint to a MessageWriter + + The MessageWriter to receive the description + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + OrConstraint succeeds if either member succeeds + + + + + Create an OrConstraint from two other constraints + + The first constraint + The second constraint + + + + Apply the member constraints to an actual value, succeeding + succeeding as soon as one of them succeeds. + + The actual value + True if either constraint succeeded + + + + Write a description for this contraint to a MessageWriter + + The MessageWriter to receive the description + + + + CollectionConstraint is the abstract base class for + constraints that operate on collections. + + + + + Construct an empty CollectionConstraint + + + + + Construct a CollectionConstraint + + + + + + Determines whether the specified enumerable is empty. + + The enumerable. + + true if the specified enumerable is empty; otherwise, false. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Protected method to be implemented by derived classes + + + + + + + CollectionItemsEqualConstraint is the abstract base class for all + collection constraints that apply some notion of item equality + as a part of their operation. + + + + + Construct an empty CollectionConstraint + + + + + Construct a CollectionConstraint + + + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Compares two collection members for equality + + + + + Return a new CollectionTally for use in making tests + + The collection to be included in the tally + + + + Flag the constraint to ignore case and return self. + + + + + EmptyCollectionConstraint tests whether a collection is empty. + + + + + Check that the collection is empty + + + + + + + Write the constraint description to a MessageWriter + + + + + + UniqueItemsConstraint tests whether all the items in a + collection are unique. + + + + + Check that all items are unique. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + CollectionContainsConstraint is used to test whether a collection + contains an expected object as a member. + + + + + Construct a CollectionContainsConstraint + + + + + + Test whether the expected item is contained in the collection + + + + + + + Write a descripton of the constraint to a MessageWriter + + + + + + CollectionEquivalentCOnstraint is used to determine whether two + collections are equivalent. + + + + + Construct a CollectionEquivalentConstraint + + + + + + Test whether two collections are equivalent + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + CollectionSubsetConstraint is used to determine whether + one collection is a subset of another + + + + + Construct a CollectionSubsetConstraint + + The collection that the actual value is expected to be a subset of + + + + Test whether the actual collection is a subset of + the expected collection provided. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + CollectionOrderedConstraint is used to test whether a collection is ordered. + + + + + Construct a CollectionOrderedConstraint + + + + + Modifies the constraint to use an IComparer and returns self. + + + + + Modifies the constraint to use an IComparer<T> and returns self. + + + + + Modifies the constraint to use a Comparison<T> and returns self. + + + + + Modifies the constraint to test ordering by the value of + a specified property and returns self. + + + + + Test whether the collection is ordered + + + + + + + Write a description of the constraint to a MessageWriter + + + + + + Returns the string representation of the constraint. + + + + + + If used performs a reverse comparison + + + + + CollectionTally counts (tallies) the number of + occurences of each object in one or more enumerations. + + + + + Construct a CollectionTally object from a comparer and a collection + + + + + Try to remove an object from the tally + + The object to remove + True if successful, false if the object was not found + + + + Try to remove a set of objects from the tally + + The objects to remove + True if successful, false if any object was not found + + + + The number of objects remaining in the tally + + + + + ComparisonAdapter class centralizes all comparisons of + values in NUnit, adapting to the use of any provided + IComparer, IComparer<T> or Comparison<T> + + + + + Returns a ComparisonAdapter that wraps an IComparer + + + + + Returns a ComparisonAdapter that wraps an IComparer<T> + + + + + Returns a ComparisonAdapter that wraps a Comparison<T> + + + + + Compares two objects + + + + + Gets the default ComparisonAdapter, which wraps an + NUnitComparer object. + + + + + Construct a ComparisonAdapter for an IComparer + + + + + Compares two objects + + + + + + + + Construct a default ComparisonAdapter + + + + + ComparisonAdapter<T> extends ComparisonAdapter and + allows use of an IComparer<T> or Comparison<T> + to actually perform the comparison. + + + + + Construct a ComparisonAdapter for an IComparer<T> + + + + + Compare a Type T to an object + + + + + Construct a ComparisonAdapter for a Comparison<T> + + + + + Compare a Type T to an object + + + + + Abstract base class for constraints that compare values to + determine if one is greater than, equal to or less than + the other. This class supplies the Using modifiers. + + + + + ComparisonAdapter to be used in making the comparison + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + Modifies the constraint to use an IComparer and returns self + + + + + Modifies the constraint to use an IComparer<T> and returns self + + + + + Modifies the constraint to use a Comparison<T> and returns self + + + + + Delegate used to delay evaluation of the actual value + to be used in evaluating a constraint + + + + + ConstraintBuilder maintains the stacks that are used in + processing a ConstraintExpression. An OperatorStack + is used to hold operators that are waiting for their + operands to be reognized. a ConstraintStack holds + input constraints as well as the results of each + operator applied. + + + + + Initializes a new instance of the class. + + + + + Appends the specified operator to the expression by first + reducing the operator stack and then pushing the new + operator on the stack. + + The operator to push. + + + + Appends the specified constraint to the expresson by pushing + it on the constraint stack. + + The constraint to push. + + + + Sets the top operator right context. + + The right context. + + + + Reduces the operator stack until the topmost item + precedence is greater than or equal to the target precedence. + + The target precedence. + + + + Resolves this instance, returning a Constraint. If the builder + is not currently in a resolvable state, an exception is thrown. + + The resolved constraint + + + + Gets a value indicating whether this instance is resolvable. + + + true if this instance is resolvable; otherwise, false. + + + + + OperatorStack is a type-safe stack for holding ConstraintOperators + + + + + Initializes a new instance of the class. + + The builder. + + + + Pushes the specified operator onto the stack. + + The op. + + + + Pops the topmost operator from the stack. + + + + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + + Gets the topmost operator without modifying the stack. + + The top. + + + + ConstraintStack is a type-safe stack for holding Constraints + + + + + Initializes a new instance of the class. + + The builder. + + + + Pushes the specified constraint. As a side effect, + the constraint's builder field is set to the + ConstraintBuilder owning this stack. + + The constraint. + + + + Pops this topmost constrait from the stack. + As a side effect, the constraint's builder + field is set to null. + + + + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + + Gets the topmost constraint without modifying the stack. + + The topmost constraint + + + + ConstraintExpression represents a compound constraint in the + process of being constructed from a series of syntactic elements. + + Individual elements are appended to the expression as they are + reognized. Once an actual Constraint is appended, the expression + returns a resolvable Constraint. + + + + + ConstraintExpressionBase is the abstract base class for the + ConstraintExpression class, which represents a + compound constraint in the process of being constructed + from a series of syntactic elements. + + NOTE: ConstraintExpressionBase is separate because the + ConstraintExpression class was generated in earlier + versions of NUnit. The two classes may be combined + in a future version. + + + + + The ConstraintBuilder holding the elements recognized so far + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the + class passing in a ConstraintBuilder, which may be pre-populated. + + The builder. + + + + Returns a string representation of the expression as it + currently stands. This should only be used for testing, + since it has the side-effect of resolving the expression. + + + + + + Appends an operator to the expression and returns the + resulting expression itself. + + + + + Appends a self-resolving operator to the expression and + returns a new ResolvableConstraintExpression. + + + + + Appends a constraint to the expression and returns that + constraint, which is associated with the current state + of the expression being built. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the + class passing in a ConstraintBuilder, which may be pre-populated. + + The builder. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + With is currently a NOP - reserved for future use. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + + Returns a constraint that fails if the actual + value matches the pattern supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + The ConstraintOperator class is used internally by a + ConstraintBuilder to represent an operator that + modifies or combines constraints. + + Constraint operators use left and right precedence + values to determine whether the top operator on the + stack should be reduced before pushing a new operator. + + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + + The precedence value used when the operator + is on the top of the stack. + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + The syntax element preceding this operator + + + + + The syntax element folowing this operator + + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + + The precedence value used when the operator + is on the top of the stack. + + + + + PrefixOperator takes a single constraint and modifies + it's action in some way. + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Returns the constraint created by applying this + prefix to another constraint. + + + + + + + Negates the test of the constraint it wraps. + + + + + Constructs a new NotOperator + + + + + Returns a NotConstraint applied to its argument. + + + + + Abstract base for operators that indicate how to + apply a constraint to items in a collection. + + + + + Constructs a CollectionOperator + + + + + Represents a constraint that succeeds if all the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + they all succeed. + + + + + Represents a constraint that succeeds if any of the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + any of them succeed. + + + + + Represents a constraint that succeeds if none of the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + + Represents a constraint that succeeds if the specified + count of members of a collection match a base constraint. + + + + + Construct an ExactCountOperator for a specified count + + The expected count + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + + Represents a constraint that simply wraps the + constraint provided as an argument, without any + further functionality, but which modifes the + order of evaluation because of its precedence. + + + + + Constructor for the WithOperator + + + + + Returns a constraint that wraps its argument + + + + + Abstract base class for operators that are able to reduce to a + constraint whether or not another syntactic element follows. + + + + + Operator used to test for the presence of a named Property + on an object and optionally apply further tests to the + value of that property. + + + + + Constructs a PropOperator for a particular named property + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Gets the name of the property to which the operator applies + + + + + Operator that tests for the presence of a particular attribute + on a type and optionally applies further tests to the attribute. + + + + + Construct an AttributeOperator for a particular Type + + The Type of attribute tested + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Operator that tests that an exception is thrown and + optionally applies further tests to the exception. + + + + + Construct a ThrowsOperator + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Abstract base class for all binary operators + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Abstract method that produces a constraint by applying + the operator to its left and right constraint arguments. + + + + + Gets the left precedence of the operator + + + + + Gets the right precedence of the operator + + + + + Operator that requires both it's arguments to succeed + + + + + Construct an AndOperator + + + + + Apply the operator to produce an AndConstraint + + + + + Operator that requires at least one of it's arguments to succeed + + + + + Construct an OrOperator + + + + + Apply the operator to produce an OrConstraint + + + + + ContainsConstraint tests a whether a string contains a substring + or a collection contains an object. It postpones the decision of + which test to use until the type of the actual argument is known. + This allows testing whether a string is contained in a collection + or as a substring of another string using the same syntax. + + + + + Initializes a new instance of the class. + + The expected. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to ignore case and return self. + + + + + Applies a delay to the match so that a match can be evaluated in the future. + + + + + Creates a new DelayedConstraint + + The inner constraint two decorate + The time interval after which the match is performed + If the value of is less than 0 + + + + Creates a new DelayedConstraint + + The inner constraint two decorate + The time interval after which the match is performed + The time interval used for polling + If the value of is less than 0 + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + + Test whether the constraint is satisfied by a delegate + + The delegate whose value is to be tested + True for if the base constraint fails, false if it succeeds + + + + Test whether the constraint is satisfied by a given reference. + Overridden to wait for the specified delay period before + calling the base constraint with the dereferenced value. + + A reference to the value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a MessageWriter. + + The writer on which the actual value is displayed + + + + Returns the string representation of the constraint. + + + + + EmptyDirectoryConstraint is used to test that a directory is empty + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + EmptyConstraint tests a whether a string or collection is empty, + postponing the decision about which test is applied until the + type of the actual argument is known. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + EqualConstraint is able to compare an actual value with the + expected value provided in its constructor. Two objects are + considered equal if both are null, or if both have the same + value. NUnit has special semantics for some object types. + + + + + If true, strings in error messages will be clipped + + + + + NUnitEqualityComparer used to test equality. + + + + + Initializes a new instance of the class. + + The expected value. + + + + Flag the constraint to use a tolerance when determining equality. + + Tolerance value to be used + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write a failure message. Overridden to provide custom + failure messages for EqualConstraint. + + The MessageWriter to write to + + + + Write description of this constraint + + The MessageWriter to write to + + + + Display the failure information for two collections that did not match. + + The MessageWriter on which to display + The expected collection. + The actual collection + The depth of this failure in a set of nested collections + + + + Displays a single line showing the types and sizes of the expected + and actual enumerations, collections or arrays. If both are identical, + the value is only shown once. + + The MessageWriter on which to display + The expected collection or array + The actual collection or array + The indentation level for the message line + + + + Displays a single line showing the point in the expected and actual + arrays at which the comparison failed. If the arrays have different + structures or dimensions, both values are shown. + + The MessageWriter on which to display + The expected array + The actual array + Index of the failure point in the underlying collections + The indentation level for the message line + + + + Display the failure information for two IEnumerables that did not match. + + The MessageWriter on which to display + The expected enumeration. + The actual enumeration + The depth of this failure in a set of nested collections + + + + Flag the constraint to ignore case and return self. + + + + + Flag the constraint to suppress string clipping + and return self. + + + + + Flag the constraint to compare arrays as collections + and return self. + + + + + Switches the .Within() modifier to interpret its tolerance as + a distance in representable values (see remarks). + + Self. + + Ulp stands for "unit in the last place" and describes the minimum + amount a given value can change. For any integers, an ulp is 1 whole + digit. For floating point values, the accuracy of which is better + for smaller numbers and worse for larger numbers, an ulp depends + on the size of the number. Using ulps for comparison of floating + point results instead of fixed tolerances is safer because it will + automatically compensate for the added inaccuracy of larger numbers. + + + + + Switches the .Within() modifier to interpret its tolerance as + a percentage that the actual values is allowed to deviate from + the expected value. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in days. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in hours. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in minutes. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in seconds. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in milliseconds. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in clock ticks. + + Self + + + + EqualityAdapter class handles all equality comparisons + that use an IEqualityComparer, IEqualityComparer<T> + or a ComparisonAdapter. + + + + + Compares two objects, returning true if they are equal + + + + + Returns true if the two objects can be compared by this adapter. + The base adapter cannot handle IEnumerables except for strings. + + + + + Returns an EqualityAdapter that wraps an IComparer. + + + + + Returns an EqualityAdapter that wraps an IEqualityComparer. + + + + + Returns an EqualityAdapter that wraps an IEqualityComparer<T>. + + + + + Returns an EqualityAdapter that wraps an IComparer<T>. + + + + + Returns an EqualityAdapter that wraps a Comparison<T>. + + + + + EqualityAdapter that wraps an IComparer. + + + + + Returns true if the two objects can be compared by this adapter. + Generic adapter requires objects of the specified type. + + + + + EqualityAdapter that wraps an IComparer. + + + + Helper routines for working with floating point numbers + + + The floating point comparison code is based on this excellent article: + http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm + + + "ULP" means Unit in the Last Place and in the context of this library refers to + the distance between two adjacent floating point numbers. IEEE floating point + numbers can only represent a finite subset of natural numbers, with greater + accuracy for smaller numbers and lower accuracy for very large numbers. + + + If a comparison is allowed "2 ulps" of deviation, that means the values are + allowed to deviate by up to 2 adjacent floating point values, which might be + as low as 0.0000001 for small numbers or as high as 10.0 for large numbers. + + + + + Compares two floating point values for equality + First floating point value to be compared + Second floating point value t be compared + + Maximum number of representable floating point values that are allowed to + be between the left and the right floating point values + + True if both numbers are equal or close to being equal + + + Floating point values can only represent a finite subset of natural numbers. + For example, the values 2.00000000 and 2.00000024 can be stored in a float, + but nothing inbetween them. + + + This comparison will count how many possible floating point values are between + the left and the right number. If the number of possible values between both + numbers is less than or equal to maxUlps, then the numbers are considered as + being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + Compares two double precision floating point values for equality + First double precision floating point value to be compared + Second double precision floating point value t be compared + + Maximum number of representable double precision floating point values that are + allowed to be between the left and the right double precision floating point values + + True if both numbers are equal or close to being equal + + + Double precision floating point values can only represent a limited series of + natural numbers. For example, the values 2.0000000000000000 and 2.0000000000000004 + can be stored in a double, but nothing inbetween them. + + + This comparison will count how many possible double precision floating point + values are between the left and the right number. If the number of possible + values between both numbers is less than or equal to maxUlps, then the numbers + are considered as being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + + Reinterprets the memory contents of a floating point value as an integer value + + + Floating point value whose memory contents to reinterpret + + + The memory contents of the floating point value interpreted as an integer + + + + + Reinterprets the memory contents of a double precision floating point + value as an integer value + + + Double precision floating point value whose memory contents to reinterpret + + + The memory contents of the double precision floating point value + interpreted as an integer + + + + + Reinterprets the memory contents of an integer as a floating point value + + Integer value whose memory contents to reinterpret + + The memory contents of the integer value interpreted as a floating point value + + + + + Reinterprets the memory contents of an integer value as a double precision + floating point value + + Integer whose memory contents to reinterpret + + The memory contents of the integer interpreted as a double precision + floating point value + + + + Union of a floating point variable and an integer + + + The union's value as a floating point variable + + + The union's value as an integer + + + The union's value as an unsigned integer + + + Union of a double precision floating point variable and a long + + + The union's value as a double precision floating point variable + + + The union's value as a long + + + The union's value as an unsigned long + + + + Tests whether a value is greater than the value supplied to its constructor + + + + + The value against which a comparison is to be made + + + + + Initializes a new instance of the class. + + The expected value. + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Tests whether a value is greater than or equal to the value supplied to its constructor + + + + + The value against which a comparison is to be made + + + + + Initializes a new instance of the class. + + The expected value. + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Tests whether a value is less than the value supplied to its constructor + + + + + The value against which a comparison is to be made + + + + + Initializes a new instance of the class. + + The expected value. + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Tests whether a value is less than or equal to the value supplied to its constructor + + + + + The value against which a comparison is to be made + + + + + Initializes a new instance of the class. + + The expected value. + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + MessageWriter is the abstract base for classes that write + constraint descriptions and messages in some form. The + class has separate methods for writing various components + of a message, allowing implementations to tailor the + presentation as needed. + + + + + Construct a MessageWriter given a culture + + + + + Method to write single line message with optional args, usually + written to precede the general failure message. + + The message to be written + Any arguments used in formatting the message + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a givel + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The constraint that failed + + + + Display Expected and Actual lines for given values. This + method may be called by constraints that need more control over + the display of actual and expected values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + + Display Expected and Actual lines for given values, including + a tolerance value on the Expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + + Display the expected and actual string values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in locating the point where the strings differ + If true, the strings should be clipped to fit the line + + + + Writes the text for a connector. + + The connector. + + + + Writes the text for a predicate. + + The predicate. + + + + Writes the text for an expected value. + + The expected value. + + + + Writes the text for a modifier + + The modifier. + + + + Writes the text for an actual value. + + The actual value. + + + + Writes the text for a generalized value. + + The value. + + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Abstract method to get the max line length + + + + + Static methods used in creating messages + + + + + Static string used when strings are clipped + + + + + Returns the representation of a type as used in NUnitLite. + This is the same as Type.ToString() except for arrays, + which are displayed with their declared sizes. + + + + + + + Converts any control characters in a string + to their escaped representation. + + The string to be converted + The converted string + + + + Return the a string representation for a set of indices into an array + + Array of indices for which a string is needed + + + + Get an array of indices representing the point in a enumerable, + collection or array corresponding to a single int index into the + collection. + + The collection to which the indices apply + Index in the collection + Array of indices + + + + Clip a string to a given length, starting at a particular offset, returning the clipped + string with ellipses representing the removed parts + + The string to be clipped + The maximum permitted length of the result string + The point at which to start clipping + The clipped string + + + + Clip the expected and actual strings in a coordinated fashion, + so that they may be displayed together. + + + + + + + + + Shows the position two strings start to differ. Comparison + starts at the start index. + + The expected string + The actual string + The index in the strings at which comparison should start + Boolean indicating whether case should be ignored + -1 if no mismatch found, or the index where mismatch found + + + + The Numerics class contains common operations on numeric values. + + + + + Checks the type of the object, returning true if + the object is a numeric type. + + The object to check + true if the object is a numeric type + + + + Checks the type of the object, returning true if + the object is a floating point numeric type. + + The object to check + true if the object is a floating point numeric type + + + + Checks the type of the object, returning true if + the object is a fixed point numeric type. + + The object to check + true if the object is a fixed point numeric type + + + + Test two numeric values for equality, performing the usual numeric + conversions and using a provided or default tolerance. If the tolerance + provided is Empty, this method may set it to a default tolerance. + + The expected value + The actual value + A reference to the tolerance in effect + True if the values are equal + + + + Compare two numeric values, performing the usual numeric conversions. + + The expected value + The actual value + The relationship of the values to each other + + + + NUnitComparer encapsulates NUnit's default behavior + in comparing two objects. + + + + + Compares two objects + + + + + + + + Returns the default NUnitComparer. + + + + + Generic version of NUnitComparer + + + + + + Compare two objects of the same type + + + + + NUnitEqualityComparer encapsulates NUnit's handling of + equality tests between objects. + + + + + + + + + + Compares two objects for equality within a tolerance + + The first object to compare + The second object to compare + The tolerance to use in the comparison + + + + + If true, all string comparisons will ignore case + + + + + If true, arrays will be treated as collections, allowing + those of different dimensions to be compared + + + + + Comparison objects used in comparisons for some constraints. + + + + + Compares two objects for equality within a tolerance. + + + + + Helper method to compare two arrays + + + + + Method to compare two DirectoryInfo objects + + first directory to compare + second directory to compare + true if equivalent, false if not + + + + Returns the default NUnitEqualityComparer + + + + + Gets and sets a flag indicating whether case should + be ignored in determining equality. + + + + + Gets and sets a flag indicating that arrays should be + compared as collections, without regard to their shape. + + + + + Gets and sets an external comparer to be used to + test for equality. It is applied to members of + collections, in place of NUnit's own logic. + + + + + Gets the list of failure points for the last Match performed. + + + + + FailurePoint class represents one point of failure + in an equality test. + + + + + The location of the failure + + + + + The expected value + + + + + The actual value + + + + + Indicates whether the expected value is valid + + + + + Indicates whether the actual value is valid + + + + + PathConstraint serves as the abstract base of constraints + that operate on paths and provides several helper methods. + + + + + The expected path used in the constraint + + + + + The actual path being tested + + + + + Flag indicating whether a caseInsensitive comparison should be made + + + + + Construct a PathConstraint for a give expected path + + The expected path + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Returns true if the expected path and actual path match + + + + + Returns the string representation of this constraint + + + + + Canonicalize the provided path + + + The path in standardized form + + + + Test whether two paths are the same + + The first path + The second path + Indicates whether case should be ignored + + + + + Test whether one path is under another path + + The first path - supposed to be the parent path + The second path - supposed to be the child path + Indicates whether case should be ignored + + + + + Test whether one path is the same as or under another path + + The first path - supposed to be the parent path + The second path - supposed to be the child path + + + + + Modifies the current instance to be case-insensitve + and returns it. + + + + + Modifies the current instance to be case-sensitve + and returns it. + + + + + Summary description for SamePathConstraint. + + + + + Initializes a new instance of the class. + + The expected path + + + + Test whether the constraint is satisfied by a given value + + The expected path + The actual path + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + SubPathConstraint tests that the actual path is under the expected path + + + + + Initializes a new instance of the class. + + The expected path + + + + Test whether the constraint is satisfied by a given value + + The expected path + The actual path + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + SamePathOrUnderConstraint tests that one path is under another + + + + + Initializes a new instance of the class. + + The expected path + + + + Test whether the constraint is satisfied by a given value + + The expected path + The actual path + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Predicate constraint wraps a Predicate in a constraint, + returning success if the predicate is true. + + + + + Construct a PredicateConstraint from a predicate + + + + + Determines whether the predicate succeeds when applied + to the actual value. + + + + + Writes the description to a MessageWriter + + + + + NotConstraint negates the effect of some other constraint + + + + + Initializes a new instance of the class. + + The base constraint to be negated. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a MessageWriter. + + The writer on which the actual value is displayed + + + + AllItemsConstraint applies another constraint to each + item in a collection, succeeding if they all succeed. + + + + + Construct an AllItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + SomeItemsConstraint applies another constraint to each + item in a collection, succeeding if any of them succeeds. + + + + + Construct a SomeItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + succeeding if any item succeeds. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + NoItemConstraint applies another constraint to each + item in a collection, failing if any of them succeeds. + + + + + Construct a SomeItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + ExactCoutConstraint applies another constraint to each + item in a collection, succeeding only if a specified + number of items succeed. + + + + + Construct an ExactCountConstraint on top of an existing constraint + + + + + + + Apply the item constraint to each item in the collection, + succeeding only if the expected number of items pass. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + PropertyExistsConstraint tests that a named property + exists on the object provided through Match. + + Originally, PropertyConstraint provided this feature + in addition to making optional tests on the vaue + of the property. The two constraints are now separate. + + + + + Initializes a new instance of the class. + + The name of the property. + + + + Test whether the property exists for a given object + + The object to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. + + The writer on which the actual value is displayed + + + + Returns the string representation of the constraint. + + + + + + PropertyConstraint extracts a named property and uses + its value as the actual value for a chained constraint. + + + + + Initializes a new instance of the class. + + The name. + The constraint to apply to the property. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + Returns the string representation of the constraint. + + + + + + RangeConstraint tests whethe two values are within a + specified range. + + + + + Initializes a new instance of the class. + + From. + To. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + ResolvableConstraintExpression is used to represent a compound + constraint being constructed at a point where the last operator + may either terminate the expression or may have additional + qualifying constraints added to it. + + It is used, for example, for a Property element or for + an Exception element, either of which may be optionally + followed by constraints that apply to the property or + exception. + + + + + Create a new instance of ResolvableConstraintExpression + + + + + Create a new instance of ResolvableConstraintExpression, + passing in a pre-populated ConstraintBuilder. + + + + + Resolve the current expression to a Constraint + + + + + Appends an And Operator to the expression + + + + + Appends an Or operator to the expression. + + + + + ReusableConstraint wraps a resolved constraint so that it + may be saved and reused as needed. + + + + + Construct a ReusableConstraint + + The constraint or expression to be reused + + + + Conversion operator from a normal constraint to a ReusableConstraint. + + The original constraint to be wrapped as a ReusableConstraint + + + + + Returns the string representation of the constraint. + + A string representing the constraint + + + + Resolves the ReusableConstraint by returning the constraint + that it originally wrapped. + + A resolved constraint + + + + SameAsConstraint tests whether an object is identical to + the object passed to its constructor + + + + + Initializes a new instance of the class. + + The expected object. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + BinarySerializableConstraint tests whether + an object is serializable in binary format. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + Returns the string representation + + + + + BinarySerializableConstraint tests whether + an object is serializable in binary format. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + Returns the string representation of this constraint + + + + + StringConstraint is the abstract base for constraints + that operate on strings. It supports the IgnoreCase + modifier for string operations. + + + + + The expected value + + + + + Indicates whether tests should be case-insensitive + + + + + Constructs a StringConstraint given an expected value + + The expected value + + + + Modify the constraint to ignore case in matching. + + + + + EmptyStringConstraint tests whether a string is empty. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + NullEmptyStringConstraint tests whether a string is either null or empty. + + + + + Constructs a new NullOrEmptyStringConstraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + SubstringConstraint can test whether a string contains + the expected substring. + + + + + Initializes a new instance of the class. + + The expected. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + StartsWithConstraint can test whether a string starts + with an expected substring. + + + + + Initializes a new instance of the class. + + The expected string + + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + EndsWithConstraint can test whether a string ends + with an expected substring. + + + + + Initializes a new instance of the class. + + The expected string + + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + RegexConstraint can test whether a string matches + the pattern provided. + + + + + Initializes a new instance of the class. + + The pattern. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + ThrowsConstraint is used to test the exception thrown by + a delegate by applying a constraint to it. + + + + + Initializes a new instance of the class, + using a constraint to be applied to the exception. + + A constraint to apply to the caught exception. + + + + Executes the code of the delegate and captures any exception. + If a non-null base constraint was provided, it applies that + constraint to the exception. + + A delegate representing the code to be tested + True if an exception is thrown and the constraint succeeds, otherwise false + + + + Converts an ActualValueDelegate to a TestDelegate + before calling the primary overload. + + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + Returns the string representation of this constraint + + + + + Get the actual exception thrown - used by Assert.Throws. + + + + + ThrowsNothingConstraint tests that a delegate does not + throw an exception. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True if no exception is thrown, otherwise false + + + + Converts an ActualValueDelegate to a TestDelegate + before calling the primary overload. + + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + Modes in which the tolerance value for a comparison can + be interpreted. + + + + + The tolerance was created with a value, without specifying + how the value would be used. This is used to prevent setting + the mode more than once and is generally changed to Linear + upon execution of the test. + + + + + The tolerance is used as a numeric range within which + two compared values are considered to be equal. + + + + + Interprets the tolerance as the percentage by which + the two compared values my deviate from each other. + + + + + Compares two values based in their distance in + representable numbers. + + + + + The Tolerance class generalizes the notion of a tolerance + within which an equality test succeeds. Normally, it is + used with numeric types, but it can be used with any + type that supports taking a difference between two + objects and comparing that difference to a value. + + + + + Constructs a linear tolerance of a specdified amount + + + + + Constructs a tolerance given an amount and ToleranceMode + + + + + Tests that the current Tolerance is linear with a + numeric value, throwing an exception if it is not. + + + + + Returns an empty Tolerance object, equivalent to + specifying no tolerance. In most cases, it results + in an exact match but for floats and doubles a + default tolerance may be used. + + + + + Returns a zero Tolerance object, equivalent to + specifying an exact match. + + + + + Gets the ToleranceMode for the current Tolerance + + + + + Gets the value of the current Tolerance instance. + + + + + Returns a new tolerance, using the current amount as a percentage. + + + + + Returns a new tolerance, using the current amount in Ulps. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of days. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of hours. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of minutes. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of seconds. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of milliseconds. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of clock ticks. + + + + + Returns true if the current tolerance is empty. + + + + + TypeConstraint is the abstract base for constraints + that take a Type as their expected value. + + + + + The expected Type used by the constraint + + + + + Construct a TypeConstraint for a given Type + + + + + + Write the actual value for a failing constraint test to a + MessageWriter. TypeConstraints override this method to write + the name of the type. + + The writer on which the actual value is displayed + + + + ExactTypeConstraint is used to test that an object + is of the exact type provided in the constructor + + + + + Construct an ExactTypeConstraint for a given Type + + The expected Type. + + + + Test that an object is of the exact type specified + + The actual value. + True if the tested object is of the exact type provided, otherwise false. + + + + Write the description of this constraint to a MessageWriter + + The MessageWriter to use + + + + ExceptionTypeConstraint is a special version of ExactTypeConstraint + used to provided detailed info about the exception thrown in + an error message. + + + + + Constructs an ExceptionTypeConstraint + + + + + Write the actual value for a failing constraint test to a + MessageWriter. Overriden to write additional information + in the case of an Exception. + + The MessageWriter to use + + + + InstanceOfTypeConstraint is used to test that an object + is of the same type provided or derived from it. + + + + + Construct an InstanceOfTypeConstraint for the type provided + + The expected Type + + + + Test whether an object is of the specified type or a derived type + + The object to be tested + True if the object is of the provided type or derives from it, otherwise false. + + + + Write a description of this constraint to a MessageWriter + + The MessageWriter to use + + + + AssignableFromConstraint is used to test that an object + can be assigned from a given Type. + + + + + Construct an AssignableFromConstraint for the type provided + + + + + + Test whether an object can be assigned from the specified type + + The object to be tested + True if the object can be assigned a value of the expected Type, otherwise false. + + + + Write a description of this constraint to a MessageWriter + + The MessageWriter to use + + + + AssignableToConstraint is used to test that an object + can be assigned to a given Type. + + + + + Construct an AssignableToConstraint for the type provided + + + + + + Test whether an object can be assigned to the specified type + + The object to be tested + True if the object can be assigned a value of the expected Type, otherwise false. + + + + Write a description of this constraint to a MessageWriter + + The MessageWriter to use + + + + Thrown when an assertion failed. + + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Thrown when an assertion failed. + + + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Thrown when a test executes inconclusively. + + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Thrown when an assertion failed. + + + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + + + + + + + Compares two objects of a given Type for equality within a tolerance + + The first object to compare + The second object to compare + The tolerance to use in the comparison + + + + + The different targets a test action attribute can be applied to + + + + + Default target, which is determined by where the action attribute is attached + + + + + Target a individual test case + + + + + Target a suite of test cases + + + + + Delegate used by tests that execute code and + capture any thrown exception. + + + + + The Assert class contains a collection of static methods that + implement the most common assertions used in NUnit. + + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Helper for Assert.AreEqual(double expected, double actual, ...) + allowing code generation to work consistently. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + + + + Throws an with the message and arguments + that are passed in. This is used by the other Assert functions. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This is used by the other Assert functions. + + The message to initialize the with. + + + + Throws an . + This is used by the other Assert functions. + + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + + + + Throws an . + This causes the test to be reported as ignored. + + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + + + + Throws an . + This causes the test to be reported as Inconclusive. + + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + + This method is provided for use by VB developers needing to test + the value of properties with private setters. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + The message that will be displayed on failure + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestSnippet delegate + The message that will be displayed on failure + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestSnippet delegate + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestSnippet delegate + The message that will be displayed on failure + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestSnippet delegate + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + + Verifies that a delegate does not throw an exception + + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate does not throw an exception. + + A TestSnippet delegate + The message that will be displayed on failure + + + + Verifies that a delegate does not throw an exception. + + A TestSnippet delegate + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + The message to display in case of failure + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + The message to display in case of failure + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + + + + Assert that a string is either null or equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is either null or equal to string.Empty + + The string to be tested + The message to display in case of failure + + + + Assert that a string is either null or equal to string.Empty + + The string to be tested + + + + Assert that a string is not null or empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is not null or empty + + The string to be tested + The message to display in case of failure + + + + Assert that a string is not null or empty + + The string to be tested + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + The message to display in case of failure + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + + + + Gets the number of assertions executed so far and + resets the counter to zero. + + + + + AssertionHelper is an optional base class for user tests, + allowing the use of shorter names for constraints and + asserts and avoiding conflict with the definition of + , from which it inherits much of its + behavior, in certain mock object frameworks. + + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. Works + identically to Assert.That + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. Works + identically to Assert.That. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. Works + identically to Assert.That + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to Assert.That. + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to Assert.That. + + The evaluated condition + The message to display if the condition is false + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically Assert.That. + + The evaluated condition + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Returns a ListMapper based on a collection. + + The original collection + + + + + Provides static methods to express the assumptions + that must be met for a test to give a meaningful + result. If an assumption is not met, the test + should produce an inconclusive result. + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + + + + Asserts that a condition is true. If the condition is false the + method throws an . + + The evaluated condition + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + A set of Assert methods operationg on one or more collections + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + The message that will be displayed on failure + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable containing objects to be considered + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable containing objects to be considered + The message that will be displayed on failure + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + The message that will be displayed on failure + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + The message that will be displayed on failure + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + The message that will be displayed on failure + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that superset is not a subject of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + + Asserts that superset is not a subject of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + + + + Asserts that superset is not a subject of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that superset is a subset of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + + Asserts that superset is a subset of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + + + + Asserts that superset is a subset of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + The message to be displayed on failure + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + + + + Static helper class used in the constraint-based syntax + + + + + Creates a new SubstringConstraint + + The value of the substring + A SubstringConstraint + + + + Creates a new CollectionContainsConstraint. + + The item that should be found. + A new CollectionContainsConstraint + + + + Summary description for DirectoryAssert + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are not equal + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are equal + Arguments to be used in formatting the message + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are equal + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + + Summary description for FileAssert. + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + The message to display if objects are not equal + + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if objects are not equal + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if objects are not equal + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + The message to be displayed when the two Stream are the same. + Arguments to be used in formatting the message + + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + The message to be displayed when the Streams are the same. + + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if objects are not equal + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if objects are not equal + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + + + + GlobalSettings is a place for setting default values used + by the framework in performing asserts. + + + + + Default tolerance for floating point equality + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Interface implemented by a user fixture in order to + validate any expected exceptions. It is only called + for test methods marked with the ExpectedException + attribute. + + + + + Method to handle an expected exception + + The exception to be handled + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + The Iz class is a synonym for Is intended for use in VB, + which regards Is as a keyword. + + + + + The List class is a helper class with properties and methods + that supply a number of constraints used with lists and collections. + + + + + List.Map returns a ListMapper, which can be used to map + the original collection to another collection. + + + + + + + ListMapper is used to transform a collection used as an actual argument + producing another collection to be used in the assertion. + + + + + Construct a ListMapper based on a collection + + The collection to be transformed + + + + Produces a collection containing all the values of a property + + The collection of property values + + + + + Randomizer returns a set of random values in a repeatable + way, to allow re-running of tests if necessary. + + + + + Get a randomizer for a particular member, returning + one that has already been created if it exists. + This ensures that the same values are generated + each time the tests are reloaded. + + + + + Get a randomizer for a particular parameter, returning + one that has already been created if it exists. + This ensures that the same values are generated + each time the tests are reloaded. + + + + + Construct a randomizer using a random seed + + + + + Construct a randomizer using a specified seed + + + + + Return an array of random doubles between 0.0 and 1.0. + + + + + + + Return an array of random doubles with values in a specified range. + + + + + Return an array of random ints with values in a specified range. + + + + + Get a random seed for use in creating a randomizer. + + + + + The SpecialValue enum is used to represent TestCase arguments + that cannot be used as arguments to an Attribute. + + + + + Null represents a null value, which cannot be used as an + argument to an attriute under .NET 1.x + + + + + Basic Asserts on strings. + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + + Asserts that a string is not found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that two strings are Notequal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + The message to display in case of failure + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + The message to display in case of failure + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + + + + The TestCaseData class represents a set of arguments + and other parameter info to be used for a parameterized + test case. It provides a number of instance modifiers + for use in initializing the test case. + + Note: Instance modifiers are getters that return + the same instance after modifying it's state. + + + + + The argument list to be provided to the test + + + + + The expected result to be returned + + + + + Set to true if this has an expected result + + + + + The expected exception Type + + + + + The FullName of the expected exception + + + + + The name to be used for the test + + + + + The description of the test + + + + + A dictionary of properties, used to add information + to tests without requiring the class to change. + + + + + If true, indicates that the test case is to be ignored + + + + + If true, indicates that the test case is marked explicit + + + + + The reason for ignoring a test case + + + + + Initializes a new instance of the class. + + The arguments. + + + + Initializes a new instance of the class. + + The argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + The third argument. + + + + Sets the expected result for the test + + The expected result + A modified TestCaseData + + + + Sets the expected exception type for the test + + Type of the expected exception. + The modified TestCaseData instance + + + + Sets the expected exception type for the test + + FullName of the expected exception. + The modified TestCaseData instance + + + + Sets the name of the test case + + The modified TestCaseData instance + + + + Sets the description for the test case + being constructed. + + The description. + The modified TestCaseData instance. + + + + Applies a category to the test + + + + + + + Applies a named property to the test + + + + + + + + Applies a named property to the test + + + + + + + + Applies a named property to the test + + + + + + + + Ignores this TestCase. + + + + + + Ignores this TestCase, specifying the reason. + + The reason. + + + + + Marks this TestCase as Explicit + + + + + + Marks this TestCase as Explicit, specifying the reason. + + The reason. + + + + + Gets the argument list to be provided to the test + + + + + Gets the expected result + + + + + Returns true if the result has been set + + + + + Gets the expected exception Type + + + + + Gets the FullName of the expected exception + + + + + Gets the name to be used for the test + + + + + Gets the description of the test + + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + + Gets a value indicating whether this is explicit. + + true if explicit; otherwise, false. + + + + Gets the ignore reason. + + The ignore reason. + + + + Gets a list of categories associated with this test. + + + + + Gets the property dictionary for this test + + + + + Provide the context information of the current test + + + + + Constructs a TestContext using the provided context dictionary + + A context dictionary + + + + Get the current test context. This is created + as needed. The user may save the context for + use within a test, but it should not be used + outside the test for which it is created. + + + + + Gets a TestAdapter representing the currently executing test in this context. + + + + + Gets a ResultAdapter representing the current result for the test + executing in this context. + + + + + Gets the directory containing the current test assembly. + + + + + Gets the directory to be used for outputing files created + by this test run. + + + + + TestAdapter adapts a Test for consumption by + the user test code. + + + + + Constructs a TestAdapter for this context + + The context dictionary + + + + The name of the test. + + + + + The FullName of the test + + + + + The properties of the test. + + + + + ResultAdapter adapts a TestResult for consumption by + the user test code. + + + + + Construct a ResultAdapter for a context + + The context holding the result + + + + The TestState of current test. This maps to the ResultState + used in nunit.core and is subject to change in the future. + + + + + The TestStatus of current test. This enum will be used + in future versions of NUnit and so is to be preferred + to the TestState value. + + + + + Provides details about a test + + + + + Creates an instance of TestDetails + + The fixture that the test is a member of, if available. + The method that implements the test, if available. + The full name of the test. + A string representing the type of test, e.g. "Test Case". + Indicates if the test represents a suite of tests. + + + + The fixture that the test is a member of, if available. + + + + + The method that implements the test, if available. + + + + + The full name of the test. + + + + + A string representing the type of test, e.g. "Test Case". + + + + + Indicates if the test represents a suite of tests. + + + + + The ResultState enum indicates the result of running a test + + + + + The result is inconclusive + + + + + The test was not runnable. + + + + + The test has been skipped. + + + + + The test has been ignored. + + + + + The test succeeded + + + + + The test failed + + + + + The test encountered an unexpected exception + + + + + The test was cancelled by the user + + + + + The TestStatus enum indicates the result of running a test + + + + + The test was inconclusive + + + + + The test has skipped + + + + + The test succeeded + + + + + The test failed + + + + + Helper class with static methods used to supply constraints + that operate on strings. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + + Returns a constraint that fails if the actual + value matches the pattern supplied as an argument. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + TextMessageWriter writes constraint descriptions and messages + in displayable form as a text stream. It tailors the display + of individual message components to form the standard message + format of NUnit assertion failure messages. + + + + + Prefix used for the expected value line of a message + + + + + Prefix used for the actual value line of a message + + + + + Length of a message prefix + + + + + Construct a TextMessageWriter + + + + + Construct a TextMessageWriter, specifying a user message + and optional formatting arguments. + + + + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a givel + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The constraint that failed + + + + Display Expected and Actual lines for given values. This + method may be called by constraints that need more control over + the display of actual and expected values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + + Display Expected and Actual lines for given values, including + a tolerance value on the expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + + Display the expected and actual string values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in string comparisons + If true, clip the strings to fit the max line length + + + + Writes the text for a connector. + + The connector. + + + + Writes the text for a predicate. + + The predicate. + + + + Write the text for a modifier. + + The modifier. + + + + Writes the text for an expected value. + + The expected value. + + + + Writes the text for an actual value. + + The actual value. + + + + Writes the text for a generalized value. + + The value. + + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Write the generic 'Expected' line for a constraint + + The constraint that failed + + + + Write the generic 'Expected' line for a given value + + The expected value + + + + Write the generic 'Expected' line for a given value + and tolerance. + + The expected value + The tolerance within which the test was made + + + + Write the generic 'Actual' line for a constraint + + The constraint for which the actual value is to be written + + + + Write the generic 'Actual' line for a given value + + The actual value causing a failure + + + + Gets or sets the maximum line length for this writer + + + + + Helper class with properties and methods that supply + constraints that operate on exceptions. + + + + + Creates a constraint specifying the exact type of exception expected + + + + + Creates a constraint specifying the exact type of exception expected + + + + + Creates a constraint specifying the type of exception expected + + + + + Creates a constraint specifying the type of exception expected + + + + + Creates a constraint specifying an expected exception + + + + + Creates a constraint specifying an exception with a given InnerException + + + + + Creates a constraint specifying an expected TargetInvocationException + + + + + Creates a constraint specifying an expected TargetInvocationException + + + + + Creates a constraint specifying an expected TargetInvocationException + + + + + Creates a constraint specifying that no exception is thrown + + + + diff --git a/Website/LOC.Website.Tests/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Website/LOC.Website.Tests/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 000000000..271bfcec0 Binary files /dev/null and b/Website/LOC.Website.Tests/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Website/LOC.Website.Tests/obj/Debug/LOC.Website.Tests.csproj.FileListAbsolute.txt b/Website/LOC.Website.Tests/obj/Debug/LOC.Website.Tests.csproj.FileListAbsolute.txt new file mode 100644 index 000000000..2a0ed9dcc --- /dev/null +++ b/Website/LOC.Website.Tests/obj/Debug/LOC.Website.Tests.csproj.FileListAbsolute.txt @@ -0,0 +1,20 @@ +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Debug\LOC.Website.Tests.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Debug\LOC.Website.Tests.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Debug\LOC.Core.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Debug\LOC.Website.Common.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Debug\Moq.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Debug\nunit.framework.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Debug\EntityFramework.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Debug\StructureMap.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Debug\Newtonsoft.Json.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Debug\LOC.Core.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Debug\LOC.Website.Common.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Debug\Moq.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Debug\nunit.framework.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Debug\EntityFramework.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Debug\StructureMap.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Debug\StructureMap.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Debug\Newtonsoft.Json.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\obj\Debug\LOC.Website.Tests.csprojResolveAssemblyReference.cache +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\obj\Debug\LOC.Website.Tests.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\obj\Debug\LOC.Website.Tests.pdb diff --git a/Website/LOC.Website.Tests/obj/Debug/LOC.Website.Tests.csprojResolveAssemblyReference.cache b/Website/LOC.Website.Tests/obj/Debug/LOC.Website.Tests.csprojResolveAssemblyReference.cache new file mode 100644 index 000000000..d121c5b0c Binary files /dev/null and b/Website/LOC.Website.Tests/obj/Debug/LOC.Website.Tests.csprojResolveAssemblyReference.cache differ diff --git a/Website/LOC.Website.Tests/obj/Debug/LOC.Website.Tests.dll b/Website/LOC.Website.Tests/obj/Debug/LOC.Website.Tests.dll new file mode 100644 index 000000000..5922c2c16 Binary files /dev/null and b/Website/LOC.Website.Tests/obj/Debug/LOC.Website.Tests.dll differ diff --git a/Website/LOC.Website.Tests/obj/Debug/LOC.Website.Tests.pdb b/Website/LOC.Website.Tests/obj/Debug/LOC.Website.Tests.pdb new file mode 100644 index 000000000..03c9555af Binary files /dev/null and b/Website/LOC.Website.Tests/obj/Debug/LOC.Website.Tests.pdb differ diff --git a/Website/LOC.Website.Tests/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache b/Website/LOC.Website.Tests/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 000000000..0f602c217 Binary files /dev/null and b/Website/LOC.Website.Tests/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Website/LOC.Website.Tests/obj/Release/LOC.Website.Tests.csproj.FileListAbsolute.txt b/Website/LOC.Website.Tests/obj/Release/LOC.Website.Tests.csproj.FileListAbsolute.txt new file mode 100644 index 000000000..1dbc4ea20 --- /dev/null +++ b/Website/LOC.Website.Tests/obj/Release/LOC.Website.Tests.csproj.FileListAbsolute.txt @@ -0,0 +1,20 @@ +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Release\LOC.Website.Tests.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Release\LOC.Website.Tests.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Release\LOC.Core.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Release\LOC.Website.Common.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Release\Moq.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Release\nunit.framework.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Release\EntityFramework.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Release\StructureMap.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Release\Newtonsoft.Json.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Release\LOC.Core.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Release\LOC.Website.Common.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Release\Moq.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Release\nunit.framework.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Release\EntityFramework.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Release\StructureMap.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Release\StructureMap.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\bin\Release\Newtonsoft.Json.xml +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\obj\Release\LOC.Website.Tests.dll +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\obj\Release\LOC.Website.Tests.pdb +C:\Work\Nautilus\Minecraft\Website\LOC.Website.Tests\obj\Release\LOC.Website.Tests.csprojResolveAssemblyReference.cache diff --git a/Website/LOC.Website.Tests/obj/Release/LOC.Website.Tests.csprojResolveAssemblyReference.cache b/Website/LOC.Website.Tests/obj/Release/LOC.Website.Tests.csprojResolveAssemblyReference.cache new file mode 100644 index 000000000..bb5c767e6 Binary files /dev/null and b/Website/LOC.Website.Tests/obj/Release/LOC.Website.Tests.csprojResolveAssemblyReference.cache differ diff --git a/Website/LOC.Website.Tests/obj/Release/LOC.Website.Tests.dll b/Website/LOC.Website.Tests/obj/Release/LOC.Website.Tests.dll new file mode 100644 index 000000000..6e1271095 Binary files /dev/null and b/Website/LOC.Website.Tests/obj/Release/LOC.Website.Tests.dll differ diff --git a/Website/LOC.Website.Tests/obj/Release/LOC.Website.Tests.pdb b/Website/LOC.Website.Tests/obj/Release/LOC.Website.Tests.pdb new file mode 100644 index 000000000..dc05f4d47 Binary files /dev/null and b/Website/LOC.Website.Tests/obj/Release/LOC.Website.Tests.pdb differ diff --git a/Website/LOC.Website.Web/App_Start/StructuremapMvc.cs b/Website/LOC.Website.Web/App_Start/StructuremapMvc.cs new file mode 100644 index 000000000..777c9e89b --- /dev/null +++ b/Website/LOC.Website.Web/App_Start/StructuremapMvc.cs @@ -0,0 +1,15 @@ +using LOC.Website.Web.App_Start; + +[assembly: WebActivator.PreApplicationStartMethod(typeof(StructuremapMvc), "Start")] + +namespace LOC.Website.Web.App_Start { + using System.Web.Mvc; + using DependencyResolution; + + public static class StructuremapMvc { + public static void Start() { + var container = IoC.Initialize(); + DependencyResolver.SetResolver(new SmDependencyResolver(container)); + } + } +} \ No newline at end of file diff --git a/Website/LOC.Website.Web/Areas/Manage/Controllers/AccountsController.cs b/Website/LOC.Website.Web/Areas/Manage/Controllers/AccountsController.cs new file mode 100644 index 000000000..ee95616f4 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Controllers/AccountsController.cs @@ -0,0 +1,120 @@ +namespace LOC.Website.Web.Areas.Manage.Controllers +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Web.Mvc; + using Common; + using Common.Contexts; + using Common.Models; + using System.Data.Entity; + using Core.Model.Account; + using Core.Model.GameServer; + using Core.Tokens.Client; + + public class AccountsController : ManageControllerBase + { + private readonly IAccountAdministrator _accountAdministrator; + private readonly ILogger _logger; + private LocContext context = new LocContext(); + + public AccountsController(IAccountAdministrator accountAdministrator, ILogger logger) + { + _accountAdministrator = accountAdministrator; + _logger = logger; + } + + public ViewResult Index(string searchString) + { + var accounts = new List(); + + if (!String.IsNullOrEmpty(searchString)) + { + accounts = _accountAdministrator.GetAllAccountsMatching(searchString); + } + + return View(accounts); + } + + public ViewResult Details(int id) + { + var account = context.Accounts.Where(x => x.AccountId == id).Include(x => x.Rank).Include(x => x.Transactions.Select(y => y.SalesPackage)).Include(x => x.PvpTransactions).First(); + return View(account); + } + + public ViewResult AccountLogins(int id) + { + var logins = context.Logins.Where(x => x.Account.AccountId == id).Include(x => x.Account).Include(x => x.IpAddress).Include(x => x.MacAddress); + return View(logins); + } + + public ActionResult Create() + { + return View(); + } + + public void TestLogin() + { + _accountAdministrator.Login(new LoginRequestToken + { + IpAddress = "127.0.0.1", + MacAddress = null, + Name = "defek7", + Server = new Server { ConnectionAddress = "127.0.0.1", Name = "Test" } + }); + } + + [HttpPost] + public ActionResult Create(Account account) + { + if (ModelState.IsValid) + { + context.Accounts.Add(account); + context.SaveChanges(); + return RedirectToAction("Index"); + } + + return View(account); + } + + public ActionResult Edit(int id) + { + Account account = context.Accounts.Single(x => x.AccountId == id); + return View(account); + } + + [HttpPost] + public ActionResult Edit(Account account) + { + if (ModelState.IsValid) + { + _accountAdministrator.UpdateAccount(account); + return RedirectToAction("Index"); + } + return View(account); + } + + public ActionResult Delete(int id) + { + Account account = context.Accounts.Single(x => x.AccountId == id); + return View(account); + } + + [HttpPost, ActionName("Delete")] + public ActionResult DeleteConfirmed(int id) + { + Account account = context.Accounts.Single(x => x.AccountId == id); + context.Accounts.Remove(account); + context.SaveChanges(); + return RedirectToAction("Index"); + } + + protected override void Dispose(bool disposing) + { + if (disposing) { + context.Dispose(); + } + base.Dispose(disposing); + } + } +} \ No newline at end of file diff --git a/Website/LOC.Website.Web/Areas/Manage/Controllers/GameSalesPackageController.cs b/Website/LOC.Website.Web/Areas/Manage/Controllers/GameSalesPackageController.cs new file mode 100644 index 000000000..8387dbed7 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Controllers/GameSalesPackageController.cs @@ -0,0 +1,76 @@ +namespace LOC.Website.Web.Areas.Manage.Controllers +{ + using System.Web.Mvc; + using Common.Models; + using Core.Model.Sales; + + public class GameSalesPackageController : ManageControllerBase + { + private readonly IGameSalesPackageAdministrator _gameSalesPackageAdministrator; + + public GameSalesPackageController(IGameSalesPackageAdministrator gameSalesPackageAdministrator) + { + _gameSalesPackageAdministrator = gameSalesPackageAdministrator; + } + + public ViewResult Index() + { + return View(_gameSalesPackageAdministrator.GetSalesPackages()); + } + + public ViewResult Details(int id) + { + GameSalesPackage gamesalespackage = _gameSalesPackageAdministrator.GetGameSalesPackageById(id); + return View(gamesalespackage); + } + + public ActionResult Create() + { + return View(); + } + + [HttpPost] + public ActionResult Create(GameSalesPackage gamesalespackage) + { + if (ModelState.IsValid) + { + _gameSalesPackageAdministrator.AddSalesPackage(gamesalespackage); + return RedirectToAction("Index"); + } + + return View(gamesalespackage); + } + + public ActionResult Edit(int id) + { + GameSalesPackage gamesalespackage = _gameSalesPackageAdministrator.GetGameSalesPackageById(id); + return View(gamesalespackage); + } + + [HttpPost] + public ActionResult Edit(GameSalesPackage gamesalespackage) + { + if (ModelState.IsValid) + { + _gameSalesPackageAdministrator.UpdateSalesPackage(gamesalespackage); + return RedirectToAction("Index"); + } + return View(gamesalespackage); + } + + public ActionResult Delete(int id) + { + GameSalesPackage gamesalespackage = _gameSalesPackageAdministrator.GetGameSalesPackageById(id); + return View(gamesalespackage); + } + + [HttpPost, ActionName("Delete")] + public ActionResult DeleteConfirmed(int id) + { + GameSalesPackage gamesalespackage = _gameSalesPackageAdministrator.GetGameSalesPackageById(id); + _gameSalesPackageAdministrator.DeleteSalesPackage(gamesalespackage); + + return RedirectToAction("Index"); + } + } +} \ No newline at end of file diff --git a/Website/LOC.Website.Web/Areas/Manage/Controllers/LogController.cs b/Website/LOC.Website.Web/Areas/Manage/Controllers/LogController.cs new file mode 100644 index 000000000..9fc742f54 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Controllers/LogController.cs @@ -0,0 +1,58 @@ +using System.Linq; +using System.Web.Mvc; +using LOC.Core; +using LOC.Website.Common.Contexts; + +namespace LOC.Website.Web.Areas.Manage.Controllers +{ + public class LogController : ManageControllerBase + { + private LocContext context = new LocContext(); + + // + // GET: /Log/ + + public ViewResult Index() + { + return View(context.LogEntries.ToList()); + } + + // + // GET: /Log/Details/5 + + public ViewResult Details(int id) + { + LogEntry logentry = context.LogEntries.Single(x => x.LogEntryId == id); + return View(logentry); + } + + // + // GET: /Log/Delete/5 + + public ActionResult Delete(int id) + { + LogEntry logentry = context.LogEntries.Single(x => x.LogEntryId == id); + return View(logentry); + } + + // + // POST: /Log/Delete/5 + + [HttpPost, ActionName("Delete")] + public ActionResult DeleteConfirmed(int id) + { + LogEntry logentry = context.LogEntries.Single(x => x.LogEntryId == id); + context.LogEntries.Remove(logentry); + context.SaveChanges(); + return RedirectToAction("Index"); + } + + protected override void Dispose(bool disposing) + { + if (disposing) { + context.Dispose(); + } + base.Dispose(disposing); + } + } +} \ No newline at end of file diff --git a/Website/LOC.Website.Web/Areas/Manage/Controllers/ManageControllerBase.cs b/Website/LOC.Website.Web/Areas/Manage/Controllers/ManageControllerBase.cs new file mode 100644 index 000000000..88aff3f12 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Controllers/ManageControllerBase.cs @@ -0,0 +1,9 @@ +namespace LOC.Website.Web.Areas.Manage.Controllers +{ + using System.Web.Mvc; + + [Authorize(Roles = "Admins")] + public abstract class ManageControllerBase : Controller + { + } +} diff --git a/Website/LOC.Website.Web/Areas/Manage/Controllers/PaymentsController.cs b/Website/LOC.Website.Web/Areas/Manage/Controllers/PaymentsController.cs new file mode 100644 index 000000000..e1f82ba0d --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Controllers/PaymentsController.cs @@ -0,0 +1,24 @@ +namespace LOC.Website.Web.Areas.Manage.Controllers +{ + using System.Collections.Generic; + using System.Data.Entity; + using System.Linq; + using System.Web.Mvc; + using Common.Contexts; + using Core.Model.Sales; + + public class PaymentsController : ManageControllerBase + { + private LocContext context = new LocContext(); + + public ActionResult Index() + { + return View(context.Set().Include(x => x.SalesPackage).Include(x => x.Account).ToList()); + } + + public ViewResult Details(int dayOfYear) + { + return View(context.Transactions.Where(x => x.Time.DayOfYear == dayOfYear).ToList()); + } + } +} diff --git a/Website/LOC.Website.Web/Areas/Manage/Controllers/ServerManagementController.cs b/Website/LOC.Website.Web/Areas/Manage/Controllers/ServerManagementController.cs new file mode 100644 index 000000000..4b9bc71cf --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Controllers/ServerManagementController.cs @@ -0,0 +1,28 @@ +namespace LOC.Website.Web.Areas.Manage.Controllers +{ + using System.Web.Mvc; + using Common; + using Newtonsoft.Json; + + public class ServerManagement : ManageControllerBase + { + private readonly IGameServerMonitor _gameServerMonitor; + + public ServerManagement() + { + _gameServerMonitor = GameServerMonitor.Instance; + } + + [HttpPost] + public ActionResult UpdateServerStatuses() + { + var json = JsonConvert.SerializeObject(_gameServerMonitor.ServerStatuses); + return Content(json, "application/json"); + } + + public ActionResult Index() + { + return View(); + } + } +} diff --git a/Website/LOC.Website.Web/Areas/Manage/Controllers/SkillsController.cs b/Website/LOC.Website.Web/Areas/Manage/Controllers/SkillsController.cs new file mode 100644 index 000000000..08390c9e9 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Controllers/SkillsController.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.Entity; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using LOC.Core.Model.PvpServer; +using LOC.Website.Common.Contexts; + +namespace LOC.Website.Web.Areas.Manage.Controllers +{ + using Core.Model.Sales; + + public class SkillsController : ManageControllerBase + { + private LocContext db = new LocContext(); + + public ViewResult Index(string searchString) + { + var skills = new List(); + + if (!String.IsNullOrEmpty(searchString)) + { + skills = db.Skills.Include(x => x.SalesPackage).Where(c => c.Name.ToUpper().Contains(searchString.ToUpper())).ToList(); + } + + return View(skills); + } + + public ViewResult Details(int id) + { + Skill skill = db.Skills.Include(x => x.SalesPackage).FirstOrDefault(x => x.SkillId == id); + return View(skill); + } + + public ActionResult Edit(int id) + { + Skill skill = db.Skills.Include(x => x.SalesPackage).FirstOrDefault(x => x.SkillId == id); + return View(skill); + } + + public ActionResult RefundAccounts(int skillId) + { + var skill = db.Skills.Include(x => x.SalesPackage).FirstOrDefault(x => x.SkillId == skillId); + var accounts = db.Accounts.Where(x => x.PvpTransactions.Any(y => y.GameSalesPackageId == skill.SalesPackage.GameSalesPackageId)).ToList(); + + foreach (var account in accounts) + { + account.Gems += skill.SalesPackage.Gems; + account.PvpTransactions.Remove(account.PvpTransactions.First(x => x.GameSalesPackageId == skill.SalesPackage.GameSalesPackageId)); + } + + db.SaveChanges(); + + return RedirectToAction("Index"); + } + + // + // POST: /Manage/Skills/Edit/5 + + [HttpPost] + public ActionResult Edit(Skill skill) + { + if (ModelState.IsValid) + { + var editedSkill = db.Skills.Include(x => x.SalesPackage).First(x => x.SkillId == skill.SkillId); + db.Set().Attach(editedSkill); + + var editedPackage = db.PvpSalesPackages.First(x => x.GameSalesPackageId == editedSkill.SalesPackage.GameSalesPackageId); + db.Set().Attach(editedPackage); + + editedPackage.Gems = skill.SalesPackage.Gems; + editedPackage.Economy = skill.SalesPackage.Economy; + editedPackage.Free = skill.SalesPackage.Free; + + editedSkill.Name = skill.Name; + editedSkill.Level = skill.Level; + editedSkill.SalesPackage = editedPackage; + + db.SaveChanges(); + + return RedirectToAction("Index", "Skills", new { searchString = skill.Name}); + } + return View(skill); + } + + // + // GET: /Manage/Skills/Delete/5 + + public ActionResult Delete(int id) + { + Skill skill = db.Skills.Find(id); + return View(skill); + } + + // + // POST: /Manage/Skills/Delete/5 + + [HttpPost, ActionName("Delete")] + public ActionResult DeleteConfirmed(int id) + { + Skill skill = db.Skills.Find(id); + db.Skills.Remove(skill); + db.SaveChanges(); + return RedirectToAction("Index"); + } + + protected override void Dispose(bool disposing) + { + db.Dispose(); + base.Dispose(disposing); + } + } +} \ No newline at end of file diff --git a/Website/LOC.Website.Web/Areas/Manage/ManageAreaRegistration.cs b/Website/LOC.Website.Web/Areas/Manage/ManageAreaRegistration.cs new file mode 100644 index 000000000..6c4e656fc --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/ManageAreaRegistration.cs @@ -0,0 +1,24 @@ +using System.Web.Mvc; + +namespace LOC.Website.Web.Areas.Manage +{ + public class ManageAreaRegistration : AreaRegistration + { + public override string AreaName + { + get + { + return "Manage"; + } + } + + public override void RegisterArea(AreaRegistrationContext context) + { + context.MapRoute( + "Manage_default", + "Manage/{controller}/{action}/{id}", + new { action = "Index", id = UrlParameter.Optional } + ); + } + } +} diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/AccountLogins.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/AccountLogins.cshtml new file mode 100644 index 000000000..10f05bef7 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/AccountLogins.cshtml @@ -0,0 +1,28 @@ +@model IEnumerable + +@{ + ViewBag.Title = "Account Logins"; +} + +

Account Logins

+ +
+ Logins | @Html.ActionLink("Back to Account", "Details", new { id = Model.First().Account.AccountId }) + +
+ + + + + + + @foreach (var login in @Model) + { + + + + + + } +
IpAddressServerDate
@(login.IpAddress.Address)@(login.ServerId)@(new DateTime().AddTicks(login.Time))
+ diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/Create.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/Create.cshtml new file mode 100644 index 000000000..e46c3435e --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/Create.cshtml @@ -0,0 +1,29 @@ +@model LOC.Core.Model.Account.Account + +@{ + ViewBag.Title = "Create"; +} + +

Create

+ + + + +@using (Html.BeginForm()) { + @Html.ValidationSummary(true) +
+ Account + + @Html.Partial("_CreateOrEdit", Model) + +

+ +

+
+} + +
+ @Html.ActionLink("Back to List", "Index") +
+ + diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/Delete.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/Delete.cshtml new file mode 100644 index 000000000..8169ab55f --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/Delete.cshtml @@ -0,0 +1,44 @@ +@model LOC.Core.Model.Account.Account + +@{ + ViewBag.Title = "Delete"; +} + +

Delete

+ +

Are you sure you want to delete this?

+
+ Account + +
Name
+
@Model.Name
+ +
Banned
+
@Model.Banned
+ +
BanMessage
+
@Model.BanMessage
+ +
Rank
+
@(Model.Rank == null ? "None" : Model.Rank.Name)
+ +
Expires
+
@Model.Expires
+ +
Logins
+
@(Model.Logins == null ? "None" : Model.Logins.Count.ToString())
+ +
IpAddresses
+
@(Model.IpAddresses == null ? "None" : Model.IpAddresses.Count.ToString())
+ +
HungerGameClasses
+
@(Model.HungerGameClasses == null ? "None" : Model.HungerGameClasses.Count.ToString())
+
+@using (Html.BeginForm()) { +

+ | + @Html.ActionLink("Back to List", "Index") +

+} + + diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/Details.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/Details.cshtml new file mode 100644 index 000000000..78dedd769 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/Details.cshtml @@ -0,0 +1,85 @@ +@model LOC.Core.Model.Account.Account + +@{ + ViewBag.Title = "Details"; +} + +

Details

+ +
+ Account | @Html.ActionLink("Edit", "Edit", new { id=Model.AccountId }) | @Html.ActionLink("Back to List", "Index") + +
+
Name:
@Model.Name
+
+
Status:
+ @if (Model.Banned) + { + Banned + } + else + { + In Good Standing + } +
+
+
+
Rank:
@(Model.Rank == null ? "None" : Model.Rank.Name)
+
+ @if (Model.Rank != null && (Model.Rank.Name == "SILVER" || Model.Rank.Name == "GOLD")) + { +
+
Rank Expires:
+
@(Model.RankExpire)
+ } +
+
+
Web Sales Transactions:
+ @if (Model.Transactions != null && Model.Transactions.Count > 0) + { + foreach (var transaction in Model.Transactions) + { +
+
@transaction.Time
+
@transaction.SalesPackage.Name
+
@transaction.SalesPackage.Price
+ } + } + else + { +
None
+ } +
+
Game Ttem Transactions:
+ @if (Model.PvpTransactions != null && Model.PvpTransactions.Count > 0) + { + foreach (var transaction in Model.PvpTransactions) + { +
+
@transaction.GameSalesPackageId
+ } + } + else + { +
None
+ } +
+
IpAddresses:
+ @if (Model.IpAddresses != null && Model.IpAddresses.Count > 0) + { + foreach (var ipAddress in Model.IpAddresses) + { +
+
@ipAddress.Address
+ } + } + else + { +
None
+ } +
+ +
+
+ + diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/Edit.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/Edit.cshtml new file mode 100644 index 000000000..ff6ef724e --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/Edit.cshtml @@ -0,0 +1,28 @@ +@model LOC.Core.Model.Account.Account + +@{ + ViewBag.Title = "Edit"; +} + +

Edit

+ + + + +@using (Html.BeginForm()) { + @Html.ValidationSummary(true) +
+ Account + + @Html.HiddenFor(model => model.AccountId) + @Html.Partial("_CreateOrEdit", Model) + +

+ +

+
+} + +
+ @Html.ActionLink("Back to List", "Index") +
diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/Index.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/Index.cshtml new file mode 100644 index 000000000..8d376cd6d --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/Index.cshtml @@ -0,0 +1,57 @@ +@model IEnumerable + +@{ + ViewBag.Title = "Manage Accounts"; +} + +

@ViewBag.Title

+ +@using (Html.BeginForm()) +{ +

+ Find by name: @Html.TextBox("SearchString")   +

+} + +@if (Model.Count() != 0) +{ + + + + + + + + + @foreach (var item in Model) + { + + + + + + + } +
+ Name + + Banned + + Rank + + Expires +
+ @Html.ActionLink(item.Name, "Details", new { id = item.AccountId }) + + @if (!item.Banned) + { + @("False") + } + + @(item.Rank == null ? "None" : item.Rank.Name) + + @(item.Expires == 0 ? "Never" : new DateTime(item.Expires, DateTimeKind.Local).ToString()) +
+} + + diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/_CreateOrEdit.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/_CreateOrEdit.cshtml new file mode 100644 index 000000000..166e748d0 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Accounts/_CreateOrEdit.cshtml @@ -0,0 +1,36 @@ +@model LOC.Core.Model.Account.Account + +@* This partial view defines form fields that will appear when creating and editing entities *@ + +
+ @Html.LabelFor(model => model.Name) +
+
+ @Html.EditorFor(model => model.Name) + @Html.ValidationMessageFor(model => model.Name) +
+ +
+ @Html.LabelFor(model => model.Banned) +
+
+ @Html.EditorFor(model => model.Banned) + @Html.ValidationMessageFor(model => model.Banned) +
+ +
+ @Html.LabelFor(model => model.Reason) +
+
+ @Html.EditorFor(model => model.Reason) + @Html.ValidationMessageFor(model => model.Reason) +
+ +
+ @Html.LabelFor(model => model.Expires) +
+
+ @Html.EditorFor(model => model.Expires) + @Html.ValidationMessageFor(model => model.Expires) +
+ diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/GameSalesPackage/Create.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/GameSalesPackage/Create.cshtml new file mode 100644 index 000000000..5b576007e --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/GameSalesPackage/Create.cshtml @@ -0,0 +1,57 @@ +@model LOC.Core.Model.Sales.GameSalesPackage + +@{ + ViewBag.Title = "Create"; +} + +

Create

+ + + + +@using (Html.BeginForm()) { + @Html.ValidationSummary(true) +
+ GameSalesPackage + +
+ @Html.LabelFor(model => model.Tokens) +
+
+ @Html.EditorFor(model => model.Tokens) + @Html.ValidationMessageFor(model => model.Tokens) +
+ +
+ @Html.LabelFor(model => model.Credits) +
+
+ @Html.EditorFor(model => model.Credits) + @Html.ValidationMessageFor(model => model.Credits) +
+ +
+ @Html.LabelFor(model => model.Points) +
+
+ @Html.EditorFor(model => model.Points) + @Html.ValidationMessageFor(model => model.Points) +
+ +
+ @Html.LabelFor(model => model.Free) +
+
+ @Html.EditorFor(model => model.Free) + @Html.ValidationMessageFor(model => model.Free) +
+ +

+ +

+
+} + +
+ @Html.ActionLink("Back to List", "Index") +
diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/GameSalesPackage/Delete.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/GameSalesPackage/Delete.cshtml new file mode 100644 index 000000000..756485f7f --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/GameSalesPackage/Delete.cshtml @@ -0,0 +1,38 @@ +@model LOC.Core.Model.Sales.GameSalesPackage + +@{ + ViewBag.Title = "Delete"; +} + +

Delete

+ +

Are you sure you want to delete this?

+
+ GameSalesPackage + +
Tokens
+
+ @Html.DisplayFor(model => model.Tokens) +
+ +
Credits
+
+ @Html.DisplayFor(model => model.Credits) +
+ +
Points
+
+ @Html.DisplayFor(model => model.Points) +
+ +
Free
+
+ @Html.DisplayFor(model => model.Free) +
+
+@using (Html.BeginForm()) { +

+ | + @Html.ActionLink("Back to List", "Index") +

+} diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/GameSalesPackage/Details.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/GameSalesPackage/Details.cshtml new file mode 100644 index 000000000..4ac0f8b6b --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/GameSalesPackage/Details.cshtml @@ -0,0 +1,40 @@ +@model LOC.Core.Model.Sales.GameSalesPackage + +@{ + ViewBag.Title = "Details"; +} + +

Details

+ +
+ GameSalesPackage + +
Id
+
+ @Html.DisplayFor(model => model.GameSalesPackageId) +
+ +
Tokens
+
+ @Html.DisplayFor(model => model.Tokens) +
+ +
Credits
+
+ @Html.DisplayFor(model => model.Credits) +
+ +
Points
+
+ @Html.DisplayFor(model => model.Points) +
+ +
Free
+
+ @Html.DisplayFor(model => model.Free) +
+
+

+ @Html.ActionLink("Edit", "Edit", new { id=Model.GameSalesPackageId }) | + @Html.ActionLink("Back to List", "Index") +

diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/GameSalesPackage/Edit.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/GameSalesPackage/Edit.cshtml new file mode 100644 index 000000000..d94b9c391 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/GameSalesPackage/Edit.cshtml @@ -0,0 +1,59 @@ +@model LOC.Core.Model.Sales.GameSalesPackage + +@{ + ViewBag.Title = "Edit"; +} + +

Edit

+ + + + +@using (Html.BeginForm()) { + @Html.ValidationSummary(true) +
+ GameSalesPackage + + @Html.HiddenFor(model => model.GameSalesPackageId) + +
+ @Html.LabelFor(model => model.Tokens) +
+
+ @Html.EditorFor(model => model.Tokens) + @Html.ValidationMessageFor(model => model.Tokens) +
+ +
+ @Html.LabelFor(model => model.Credits) +
+
+ @Html.EditorFor(model => model.Credits) + @Html.ValidationMessageFor(model => model.Credits) +
+ +
+ @Html.LabelFor(model => model.Points) +
+
+ @Html.EditorFor(model => model.Points) + @Html.ValidationMessageFor(model => model.Points) +
+ +
+ @Html.LabelFor(model => model.Free) +
+
+ @Html.EditorFor(model => model.Free) + @Html.ValidationMessageFor(model => model.Free) +
+ +

+ +

+
+} + +
+ @Html.ActionLink("Back to List", "Index") +
diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/GameSalesPackage/Index.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/GameSalesPackage/Index.cshtml new file mode 100644 index 000000000..4cfaf9001 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/GameSalesPackage/Index.cshtml @@ -0,0 +1,57 @@ +@model IEnumerable + +@{ + ViewBag.Title = "Index"; +} + +

Index

+ +

+ @Html.ActionLink("Create New", "Create") +

+ + + + + + + + + + +@foreach (var item in Model) { + + + + + + + + +} + +
+ ID + + Tokens + + Credits + + Points + + Free +
+ @Html.DisplayFor(modelItem => item.GameSalesPackageId) + + @Html.DisplayFor(modelItem => item.Tokens) + + @Html.DisplayFor(modelItem => item.Credits) + + @Html.DisplayFor(modelItem => item.Points) + + @Html.DisplayFor(modelItem => item.Free) + + @Html.ActionLink("Edit", "Edit", new { id=item.GameSalesPackageId }) | + @Html.ActionLink("Details", "Details", new { id=item.GameSalesPackageId }) | + @Html.ActionLink("Delete", "Delete", new { id=item.GameSalesPackageId }) +
diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Log/Delete.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Log/Delete.cshtml new file mode 100644 index 000000000..6db28e28a --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Log/Delete.cshtml @@ -0,0 +1,29 @@ +@model LOC.Core.LogEntry + +@{ + ViewBag.Title = "Delete"; +} + +

Delete

+ +

Are you sure you want to delete this?

+
+ LogEntry + +
Date
+
@String.Format("{0:g}", Model.Date)
+ +
Category
+
@Model.Category
+ +
Message
+
@Model.Message
+
+@using (Html.BeginForm()) { +

+ | + @Html.ActionLink("Back to List", "Index") +

+} + + diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Log/Details.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Log/Details.cshtml new file mode 100644 index 000000000..7a34b903e --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Log/Details.cshtml @@ -0,0 +1,26 @@ +@model LOC.Core.LogEntry + +@{ + ViewBag.Title = "Details"; +} + +

Details

+ +
+ LogEntry + +
Date
+
@String.Format("{0:g}", Model.Date)
+ +
Category
+
@Model.Category
+ +
Message
+
@Model.Message
+
+

+ @Html.ActionLink("Edit", "Edit", new { id=Model.LogEntryId }) | + @Html.ActionLink("Back to List", "Index") +

+ + diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Log/Index.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Log/Index.cshtml new file mode 100644 index 000000000..ad2bfe0cd --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Log/Index.cshtml @@ -0,0 +1,43 @@ +@model IEnumerable + +@{ + ViewBag.Title = "Index"; +} + +

Index

+ + + + + + + + + +@foreach (var item in Model) { + + + + + + +} + +
+ Date + + Category + + Message +
+ @Html.ActionLink("Details", "Details", new { id=item.LogEntryId }) | + @Html.ActionLink("Delete", "Delete", new { id=item.LogEntryId }) + + @String.Format("{0:g}", item.Date) + + @item.Category + + @item.Message +
+ + diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Log/_CreateOrEdit.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Log/_CreateOrEdit.cshtml new file mode 100644 index 000000000..49eba140f --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Log/_CreateOrEdit.cshtml @@ -0,0 +1,28 @@ +@model LOC.Core.LogEntry + +@* This partial view defines form fields that will appear when creating and editing entities *@ + +
+ @Html.LabelFor(model => model.Date) +
+
+ @Html.EditorFor(model => model.Date) + @Html.ValidationMessageFor(model => model.Date) +
+ +
+ @Html.LabelFor(model => model.Category) +
+
+ @Html.EditorFor(model => model.Category) + @Html.ValidationMessageFor(model => model.Category) +
+ +
+ @Html.LabelFor(model => model.Message) +
+
+ @Html.EditorFor(model => model.Message) + @Html.ValidationMessageFor(model => model.Message) +
+ diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Payments/Details.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Payments/Details.cshtml new file mode 100644 index 000000000..e0c2c9fc1 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Payments/Details.cshtml @@ -0,0 +1,24 @@ +@model List + +@{ + ViewBag.Title = "Payment Details"; +} + +

Details

+ +
+ @Html.ActionLink("Back to List", "Index") + +
+
+
    + @foreach (var transaction in Model) + { + @Html.Partial("_WriteTransaction", transaction) + } +
+
+
+
+ + diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Payments/Index.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Payments/Index.cshtml new file mode 100644 index 000000000..e575cbea9 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Payments/Index.cshtml @@ -0,0 +1,138 @@ +@using LOC.Core.Model.Sales +@model IEnumerable + +@{ + ViewBag.Title = "Nautilus Studios, LLC Payment Stats"; + var week = GetWeek(Model, 0); +} + +

Payment Stats

+ +@helper Diff(decimal before, decimal after) +{ + @after.ToString("$0.00") + + if(before > 0) + { + var diff = (after / before) - 1; + var color = diff >= 0 ? "green" : "red"; + @diff.ToString("+00%;-00%") + } +} + +@functions{ + public decimal[] GetWeek(IEnumerable payments, int x) + { + decimal sum = 0; + decimal[] days = new decimal[9]; + + DateTime start = DateTime.Today.AddDays(-(int)DateTime.Today.DayOfWeek + 1).AddDays(x * -7); + + for (int i = 0; i < 7; i++) + { + days[i] = payments.Where(c => c.Time.Date == start.AddDays(i)).Sum(c => (decimal?)c.Profit) ?? 0m; + } + + days[7] = days.Sum(); + var now = DateTime.Now.AddDays(x * -7); + days[8] = payments.Where(c => c.Time.Date == now.Date && c.Time < now).Sum(c => (decimal?)c.Profit) ?? 0m; + + return days; + + } + +} + +
+@DateTime.Now +

Weekly Stats

+ + + + + + + + + + + + + + + + + @for (int i = 1; i < 12; i++) + { + DateTime start = DateTime.Today.AddDays(-(int)DateTime.Today.DayOfWeek + 1).AddDays((i - 1) * -7); + var end = DateTime.Now.AddDays((i) * -7); + var next = GetWeek(Model, i); + + + @if(i == 1) + { + var last = Model.Where(c => c.Time >= start.AddDays(-7) && c.Time < end).Sum(c => (decimal?)c.Profit) ?? 0m; + + } + else + { + + } + + + @for (int j = 0; j < 7; j++) + { + + } + + + + week = next; + } + +
DateTotalTodayMondayTuesdayWednesdayThursdayFridaySaturdaySunday
@start.ToString("MM/dd")@last.ToString("$0.00") | @Diff(last, week[7])@Diff(next[7], week[7])@Diff(next[8], week[8])@Html.ActionLink(@week[j].ToString("$0.00"), "Details", new { dayOfYear = DateTime.Now.AddDays((i - 1) * -7).DayOfYear })
+ + Last 7 Days: @((Model.Where(c => c.Time > DateTime.Now.AddDays(-7)).Sum(c => c.Profit)).ToString("$0.00"))
+ Two Weeks ago: @((Model.Where(c => c.Time > DateTime.Now.AddDays(-14) && c.Time <= DateTime.Now.AddDays(-7)).Sum(c => c.Profit)).ToString("$0.00")) +

Monthly Income:

+ @for (int i = 0; i < 3; i++) + { + var date = DateTime.Today.AddMonths(-i); + var list = Model.Where(c => c.Time.Month == date.Month && c.Time.Year == date.Year); + var old = Model.Where(c => c.Time.Month < date.Month && c.Time.Year == date.Year || c.Time.Year < date.Year); + var amount = list.Sum(c => (decimal?)c.Profit) ?? 0; + + var last = Model.Where(c => c.Time.Month == date.AddMonths(-1).Month && c.Time.Year == date.AddMonths(-1).Year); + + if (i == 0) + { + last = last.Where(c => c.Time.Day <= date.Day); + } + + var lastTotal = last.Sum(c => (decimal?)c.Profit) ?? 0; + + var recurringPayments = list.Where(c => old.Any(d => d.Account.AccountId == c.Account.AccountId)).Sum(c => (decimal?)c.Profit) ?? 0; + + + @date.ToString("MMMM yyyy")
+ +
@amount.ToString("$#,##0.00") + @if (lastTotal > 0) + { + var diff = (amount / lastTotal) - 1; + var color = diff >= 0 ? "green" : "red"; + @diff.ToString("+0%;-0%") + } +
+ if (amount > 0 && lastTotal > 0) + { + Recurring: @recurringPayments.ToString("$#,##0.00") @((recurringPayments / lastTotal).ToString("0%")) + } +
+
+ } +
+
+
+ +
\ No newline at end of file diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Payments/_WriteTransaction.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Payments/_WriteTransaction.cshtml new file mode 100644 index 000000000..61f8bb5a9 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Payments/_WriteTransaction.cshtml @@ -0,0 +1,11 @@ +@model LOC.Core.Model.Sales.Transaction + +
+
+

@Model.Account.Name

+

@Model.SalesPackage.Name

+

@Model.Profit.ToString("$0.00")

+

@Model.Fee.ToString("$0.00")

+

@Model.Time

+
+
diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/ServerManagement/Index.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/ServerManagement/Index.cshtml new file mode 100644 index 000000000..2f977e742 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/ServerManagement/Index.cshtml @@ -0,0 +1,281 @@ +@{ + ViewBag.Title = "Servers"; +} + +

Servers

+ + + + + + + +
Going to update this in a few seconds...
\ No newline at end of file diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Shared/_Layout.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Shared/_Layout.cshtml new file mode 100644 index 000000000..136254351 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Shared/_Layout.cshtml @@ -0,0 +1,132 @@ + + + + +@ViewBag.Title + + + + + + + + + + + + + + + + +
+
+ +
+
+ + +
+ +
+ @RenderBody() +
+
+ + + +
+
+
+ + + + \ No newline at end of file diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Skills/Delete.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Skills/Delete.cshtml new file mode 100644 index 000000000..57dbd8c49 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Skills/Delete.cshtml @@ -0,0 +1,28 @@ +@model LOC.Core.Model.PvpServer.Skill + +@{ + ViewBag.Title = "Delete"; +} + +

Delete

+ +

Are you sure you want to delete this?

+
+ Skill + +
Name
+
+ @Html.DisplayFor(model => model.Name) +
+ +
Level
+
+ @Html.DisplayFor(model => model.Level) +
+
+@using (Html.BeginForm()) { +

+ | + @Html.ActionLink("Back to List", "Index") +

+} diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Skills/Details.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Skills/Details.cshtml new file mode 100644 index 000000000..d0d0942ee --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Skills/Details.cshtml @@ -0,0 +1,50 @@ +@model LOC.Core.Model.PvpServer.Skill + +@{ + ViewBag.Title = "Details"; +} + +

Details

+ +
+ Skill + +
Name
+
+ @Html.DisplayFor(model => model.Name) +
+ +
Level
+
+ @Html.DisplayFor(model => model.Level) +
+ +
Id
+
+ @Html.DisplayFor(model => model.SalesPackage.GameSalesPackageId) +
+ +
Tokens
+
+ @Html.DisplayFor(model => model.SalesPackage.Tokens) +
+ +
Credits
+
+ @Html.DisplayFor(model => model.SalesPackage.Credits) +
+ +
Points
+
+ @Html.DisplayFor(model => model.SalesPackage.Points) +
+ +
Free
+
+ @Html.DisplayFor(model => model.SalesPackage.Free) +
+
+

+ @Html.ActionLink("Edit", "Edit", new { id=Model.SkillId }) | + @Html.ActionLink("Back to List", "Index") +

diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Skills/Edit.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Skills/Edit.cshtml new file mode 100644 index 000000000..da4dddf48 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Skills/Edit.cshtml @@ -0,0 +1,67 @@ +@model LOC.Core.Model.PvpServer.Skill + +@{ + ViewBag.Title = "Edit"; +} + +

Edit

+ + + + +@using (Html.BeginForm()) { + @Html.ValidationSummary(true) +
+ Skill + + @Html.HiddenFor(model => model.SkillId) + +
+ @Html.LabelFor(model => model.Name) +
+
+ @Html.EditorFor(model => model.Name) + @Html.ValidationMessageFor(model => model.Name) +
+ +
+ @Html.LabelFor(model => model.Level) +
+
+ @Html.EditorFor(model => model.Level) + @Html.ValidationMessageFor(model => model.Level) +
+ +
Tokens
+
+ @Html.EditorFor(model => model.SalesPackage.Tokens) + @Html.ValidationMessageFor(model => model.SalesPackage.Tokens) +
+ +
Credits
+
+ @Html.EditorFor(model => model.SalesPackage.Credits) + @Html.ValidationMessageFor(model => model.SalesPackage.Credits) +
+ +
Points
+
+ @Html.EditorFor(model => model.SalesPackage.Points) + @Html.ValidationMessageFor(model => model.SalesPackage.Points) +
+ +
Free
+
+ @Html.EditorFor(model => model.SalesPackage.Free) + @Html.ValidationMessageFor(model => model.SalesPackage.Free) +
+ +

+ +

+
+} + +
+ @Html.ActionLink("Back to List", "Index") +
diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Skills/Index.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/Skills/Index.cshtml new file mode 100644 index 000000000..323e24fe5 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Skills/Index.cshtml @@ -0,0 +1,71 @@ +@model IEnumerable + +@{ + ViewBag.Title = "Index"; +} + +

Index

+ +@using (Html.BeginForm()) +{ +

+ Find by name: @Html.TextBox("SearchString")   +

+} + + + + + + + + + + + + + +@foreach (var item in Model) { + + + + + + + + + + +} + +
+ Name + + Level + + Tokens + + Credits + + Points + + Free +
+ @Html.DisplayFor(modelItem => item.Name) + + @Html.DisplayFor(modelItem => item.Level) + + @Html.DisplayFor(modelItem => item.SalesPackage.Tokens) + + @Html.DisplayFor(modelItem => item.SalesPackage.Credits) + + @Html.DisplayFor(modelItem => item.SalesPackage.Points) + + @Html.DisplayFor(modelItem => item.SalesPackage.Free) + + @Html.ActionLink("Refund Accounts", "RefundAccounts", "Skills", new { skillId = item.SkillId }, null) + + @Html.ActionLink("Edit", "Edit", new { id = item.SkillId }) | + @Html.ActionLink("Details", "Details", new { id = item.SkillId }) | + @Html.ActionLink("Delete", "Delete", new { id = item.SkillId }) +
diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/Web.config b/Website/LOC.Website.Web/Areas/Manage/Views/Web.config new file mode 100644 index 000000000..a4def2a3d --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/Web.config @@ -0,0 +1,58 @@ + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Website/LOC.Website.Web/Areas/Manage/Views/_ViewStart.cshtml b/Website/LOC.Website.Web/Areas/Manage/Views/_ViewStart.cshtml new file mode 100644 index 000000000..efda124b1 --- /dev/null +++ b/Website/LOC.Website.Web/Areas/Manage/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "~/Views/Shared/_Layout.cshtml"; +} \ No newline at end of file diff --git a/Website/LOC.Website.Web/Content/Images/Bosses.png b/Website/LOC.Website.Web/Content/Images/Bosses.png new file mode 100644 index 000000000..b238b01a1 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Bosses.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Customization.png b/Website/LOC.Website.Web/Content/Images/Customization.png new file mode 100644 index 000000000..e62a79cca Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Customization.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Diamond.png b/Website/LOC.Website.Web/Content/Images/Diamond.png new file mode 100644 index 000000000..b40daf622 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Diamond.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Dominate.png b/Website/LOC.Website.Web/Content/Images/Dominate.png new file mode 100644 index 000000000..ed816fca6 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Dominate.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Double.png b/Website/LOC.Website.Web/Content/Images/Double.png new file mode 100644 index 000000000..af29728e0 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Double.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Emerald.png b/Website/LOC.Website.Web/Content/Images/Emerald.png new file mode 100644 index 000000000..38b2980ad Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Emerald.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Gamemodes.png b/Website/LOC.Website.Web/Content/Images/Gamemodes.png new file mode 100644 index 000000000..ed816fca6 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Gamemodes.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Gold.png b/Website/LOC.Website.Web/Content/Images/Gold.png new file mode 100644 index 000000000..f37dd38bb Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Gold.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Mega.png b/Website/LOC.Website.Web/Content/Images/Mega.png new file mode 100644 index 000000000..6cc30a01b Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Mega.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Pvp.png b/Website/LOC.Website.Web/Content/Images/Pvp.png new file mode 100644 index 000000000..b238b01a1 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Pvp.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Silver.png b/Website/LOC.Website.Web/Content/Images/Silver.png new file mode 100644 index 000000000..def587f82 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Silver.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Single.png b/Website/LOC.Website.Web/Content/Images/Single.png new file mode 100644 index 000000000..cefcf5ada Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Single.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Truck.png b/Website/LOC.Website.Web/Content/Images/Truck.png new file mode 100644 index 000000000..72296744e Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Truck.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Ultra.png b/Website/LOC.Website.Web/Content/Images/Ultra.png new file mode 100644 index 000000000..ea62f0366 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Ultra.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Wiki/Assassin.png b/Website/LOC.Website.Web/Content/Images/Wiki/Assassin.png new file mode 100644 index 000000000..cde92b332 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Wiki/Assassin.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Wiki/Brute.png b/Website/LOC.Website.Web/Content/Images/Wiki/Brute.png new file mode 100644 index 000000000..f90b9a8c8 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Wiki/Brute.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Wiki/Knight.png b/Website/LOC.Website.Web/Content/Images/Wiki/Knight.png new file mode 100644 index 000000000..823f4f765 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Wiki/Knight.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Wiki/Mage.png b/Website/LOC.Website.Web/Content/Images/Wiki/Mage.png new file mode 100644 index 000000000..6fafb377d Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Wiki/Mage.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Wiki/Ranger.png b/Website/LOC.Website.Web/Content/Images/Wiki/Ranger.png new file mode 100644 index 000000000..2ca8cb7eb Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Wiki/Ranger.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Wiki/SkillBook.png b/Website/LOC.Website.Web/Content/Images/Wiki/SkillBook.png new file mode 100644 index 000000000..e9971402f Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Wiki/SkillBook.png differ diff --git a/Website/LOC.Website.Web/Content/Images/Wiki/blue_dye.jpg b/Website/LOC.Website.Web/Content/Images/Wiki/blue_dye.jpg new file mode 100644 index 000000000..9b65507ea Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Wiki/blue_dye.jpg differ diff --git a/Website/LOC.Website.Web/Content/Images/Wiki/bow.jpg b/Website/LOC.Website.Web/Content/Images/Wiki/bow.jpg new file mode 100644 index 000000000..99e2cfb1f Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Wiki/bow.jpg differ diff --git a/Website/LOC.Website.Web/Content/Images/Wiki/green_dye.jpg b/Website/LOC.Website.Web/Content/Images/Wiki/green_dye.jpg new file mode 100644 index 000000000..44807ae90 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Wiki/green_dye.jpg differ diff --git a/Website/LOC.Website.Web/Content/Images/Wiki/iron_axe.jpg b/Website/LOC.Website.Web/Content/Images/Wiki/iron_axe.jpg new file mode 100644 index 000000000..c732338e3 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Wiki/iron_axe.jpg differ diff --git a/Website/LOC.Website.Web/Content/Images/Wiki/iron_sword.jpg b/Website/LOC.Website.Web/Content/Images/Wiki/iron_sword.jpg new file mode 100644 index 000000000..4610ae40d Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Wiki/iron_sword.jpg differ diff --git a/Website/LOC.Website.Web/Content/Images/Wiki/orange_dye.jpg b/Website/LOC.Website.Web/Content/Images/Wiki/orange_dye.jpg new file mode 100644 index 000000000..b04aca275 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Wiki/orange_dye.jpg differ diff --git a/Website/LOC.Website.Web/Content/Images/Wiki/red_dye.jpg b/Website/LOC.Website.Web/Content/Images/Wiki/red_dye.jpg new file mode 100644 index 000000000..275529b4d Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Wiki/red_dye.jpg differ diff --git a/Website/LOC.Website.Web/Content/Images/Wiki/yellow_dye.jpg b/Website/LOC.Website.Web/Content/Images/Wiki/yellow_dye.jpg new file mode 100644 index 000000000..91405d7b4 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/Wiki/yellow_dye.jpg differ diff --git a/Website/LOC.Website.Web/Content/Images/dom1.png b/Website/LOC.Website.Web/Content/Images/dom1.png new file mode 100644 index 000000000..aea5886dc Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/dom1.png differ diff --git a/Website/LOC.Website.Web/Content/Images/dom10.png b/Website/LOC.Website.Web/Content/Images/dom10.png new file mode 100644 index 000000000..452328f4f Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/dom10.png differ diff --git a/Website/LOC.Website.Web/Content/Images/dom11.png b/Website/LOC.Website.Web/Content/Images/dom11.png new file mode 100644 index 000000000..c781edc04 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/dom11.png differ diff --git a/Website/LOC.Website.Web/Content/Images/dom12.png b/Website/LOC.Website.Web/Content/Images/dom12.png new file mode 100644 index 000000000..7556b1eb1 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/dom12.png differ diff --git a/Website/LOC.Website.Web/Content/Images/dom13.png b/Website/LOC.Website.Web/Content/Images/dom13.png new file mode 100644 index 000000000..459201536 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/dom13.png differ diff --git a/Website/LOC.Website.Web/Content/Images/dom14.png b/Website/LOC.Website.Web/Content/Images/dom14.png new file mode 100644 index 000000000..c5f748cdd Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/dom14.png differ diff --git a/Website/LOC.Website.Web/Content/Images/dom15.png b/Website/LOC.Website.Web/Content/Images/dom15.png new file mode 100644 index 000000000..554b6fdd0 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/dom15.png differ diff --git a/Website/LOC.Website.Web/Content/Images/dom2.png b/Website/LOC.Website.Web/Content/Images/dom2.png new file mode 100644 index 000000000..595a1d4ef Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/dom2.png differ diff --git a/Website/LOC.Website.Web/Content/Images/dom3.png b/Website/LOC.Website.Web/Content/Images/dom3.png new file mode 100644 index 000000000..64bfc1517 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/dom3.png differ diff --git a/Website/LOC.Website.Web/Content/Images/dom4.png b/Website/LOC.Website.Web/Content/Images/dom4.png new file mode 100644 index 000000000..313cf8071 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/dom4.png differ diff --git a/Website/LOC.Website.Web/Content/Images/dom5.png b/Website/LOC.Website.Web/Content/Images/dom5.png new file mode 100644 index 000000000..26fb17cfa Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/dom5.png differ diff --git a/Website/LOC.Website.Web/Content/Images/dom6.png b/Website/LOC.Website.Web/Content/Images/dom6.png new file mode 100644 index 000000000..dbe4ce24f Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/dom6.png differ diff --git a/Website/LOC.Website.Web/Content/Images/dom7.png b/Website/LOC.Website.Web/Content/Images/dom7.png new file mode 100644 index 000000000..1854cf012 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/dom7.png differ diff --git a/Website/LOC.Website.Web/Content/Images/dom8.png b/Website/LOC.Website.Web/Content/Images/dom8.png new file mode 100644 index 000000000..11c762321 Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/dom8.png differ diff --git a/Website/LOC.Website.Web/Content/Images/dom9.png b/Website/LOC.Website.Web/Content/Images/dom9.png new file mode 100644 index 000000000..4454e244a Binary files /dev/null and b/Website/LOC.Website.Web/Content/Images/dom9.png differ diff --git a/Website/LOC.Website.Web/Content/Site.css b/Website/LOC.Website.Web/Content/Site.css new file mode 100644 index 000000000..72bd83a7c --- /dev/null +++ b/Website/LOC.Website.Web/Content/Site.css @@ -0,0 +1,338 @@ +/*---------------------------------------------------------- +The base color for this template is #5c87b2. If you'd like +to use a different color start by replacing all instances of +#5c87b2 with your new color. +----------------------------------------------------------*/ +body +{ + background-color: #5c87b2; + font-size: 75%; + font-family: Verdana, Tahoma, Arial, "Helvetica Neue", Helvetica, Sans-Serif; + margin: 0; + padding: 0; + color: #696969; +} + +a:visited +{ + color: #505abc; +} +a:hover +{ + color: #1d60ff; + text-decoration: none; +} +a:active +{ + color: #12eb87; +} + +p, ul +{ + margin-bottom: 20px; + line-height: 1.6em; +} + +/* HEADINGS +----------------------------------------------------------*/ +h1, h2, h3, h4, h5, h6 +{ + font-size: 1.5em; + color: #000; +} + +h1 +{ + font-size: 2em; + padding-bottom: 0; + margin-bottom: 0; +} +h2 +{ + padding: 0 0 10px 0; +} +h3 +{ + font-size: 1.2em; +} +h4 +{ + font-size: 1.1em; +} +h5, h6 +{ + font-size: 1em; +} + +/* this rule styles

tags that are the +first child of the left and right table columns */ +.rightColumn > h1, .rightColumn > h2, .leftColumn > h1, .leftColumn > h2 +{ + margin-top: 0; +} + +/* PRIMARY LAYOUT ELEMENTS +----------------------------------------------------------*/ + +/* you can specify a greater or lesser percentage for the +page width. Or, you can specify an exact pixel width. */ +.page +{ + width: 90%; + margin-left: auto; + margin-right: auto; +} + +#header +{ + position: relative; + margin-bottom: 0px; + color: #000; + padding: 0; +} + +#header h1 +{ + font-weight: bold; + padding: 5px 0; + margin: 0; + color: #fff; + border: none; + line-height: 2em; + font-size: 32px !important; +} + +#main +{ + padding: 30px 30px 15px 30px; + background-color: #fff; + margin-bottom: 30px; + _height: 1px; /* only IE6 applies CSS properties starting with an underscore */ +} + +#footer +{ + color: #999; + padding: 10px 0; + text-align: center; + line-height: normal; + margin: 0; + font-size: .9em; +} + +/* TAB MENU +----------------------------------------------------------*/ +ul#menu +{ + border-bottom: 1px #5C87B2 solid; + padding: 0 0 2px; + position: relative; + margin: 0; + text-align: right; +} + +ul#menu li +{ + display: inline; + list-style: none; +} + +ul#menu li#greeting +{ + padding: 10px 20px; + font-weight: bold; + text-decoration: none; + line-height: 2.8em; + color: #fff; +} + +ul#menu li a +{ + padding: 10px 20px; + font-weight: bold; + text-decoration: none; + line-height: 2.8em; + background-color: #e8eef4; + color: #034af3; +} + +ul#menu li a:hover +{ + background-color: #fff; + text-decoration: none; +} + +ul#menu li a:active +{ + background-color: #a6e2a6; + text-decoration: none; +} + +ul#menu li.selected a +{ + background-color: #fff; + color: #000; +} + +/* FORM LAYOUT ELEMENTS +----------------------------------------------------------*/ + +fieldset +{ + border:1px solid #ddd; + padding:0 1.4em 1.4em 1.4em; + margin:0 0 1.5em 0; +} + +legend +{ + font-size:1.2em; + font-weight: bold; +} + +textarea +{ + min-height: 75px; +} + +input[type="text"] +{ + width: 200px; + border: 1px solid #CCC; +} + +input[type="password"] +{ + width: 200px; + border: 1px solid #CCC; +} + +/* MISC +----------------------------------------------------------*/ +html { + overflow-y: scroll; +} + +.clear +{ + clear: both; +} + +.error +{ + color:Red; +} + +#menucontainer +{ + margin-top:40px; +} + +div#title +{ + display:block; + float:left; + text-align:left; +} + +#logindisplay +{ + font-size:1.1em; + display:block; + text-align:right; + margin:10px; + color:White; +} + +#logindisplay a:link +{ + color: white; + text-decoration: underline; +} + +#logindisplay a:visited +{ + color: white; + text-decoration: underline; +} + +#logindisplay a:hover +{ + color: white; + text-decoration: none; +} + +/* Styles for validation helpers +-----------------------------------------------------------*/ +.field-validation-error +{ + color: #ff0000; +} + +.field-validation-valid +{ + display: none; +} + +.input-validation-error +{ + border: 1px solid #ff0000; + background-color: #ffeeee; +} + +.validation-summary-errors +{ + font-weight: bold; + color: #ff0000; +} + +.validation-summary-valid +{ + display: none; +} + +/* Styles for editor and display helpers +----------------------------------------------------------*/ +.display-label, +.editor-label +{ + margin: 1em 0 0 0; +} + +.display-field, +.editor-field +{ + margin:0.5em 0 0 0; +} + +.text-box +{ + width: 30em; +} + +.text-box.multi-line +{ + height: 6.5em; +} + +.tri-state +{ + width: 6em; +} + +.container { + +} + +.navHolder { + -webkit-box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.1), 0 1px 10px rgba(0, 0, 0, 0.1); + -moz-box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.1), 0 1px 10px rgba(0, 0, 0, 0.1); + box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.1), 0 1px 10px rgba(0, 0, 0, 0.1); + width:940px; +} + +.navButtons li { + margin-top:9px; + margin-left:20px; + float: left; +} \ No newline at end of file diff --git a/Website/LOC.Website.Web/Content/css/bootstrap-responsive.css b/Website/LOC.Website.Web/Content/css/bootstrap-responsive.css new file mode 100644 index 000000000..9259d26dc --- /dev/null +++ b/Website/LOC.Website.Web/Content/css/bootstrap-responsive.css @@ -0,0 +1,1058 @@ +/*! + * Bootstrap Responsive v2.1.1 + * + * Copyright 2012 Twitter, Inc + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Designed and built with all the love in the world @twitter by @mdo and @fat. + */ + +.clearfix { + *zoom: 1; +} + +.clearfix:before, +.clearfix:after { + display: table; + line-height: 0; + content: ""; +} + +.clearfix:after { + clear: both; +} + +.hide-text { + font: 0/0 a; + color: transparent; + text-shadow: none; + background-color: transparent; + border: 0; +} + +.input-block-level { + display: block; + width: 100%; + min-height: 30px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.hidden { + display: none; + visibility: hidden; +} + +.visible-phone { + display: none !important; +} + +.visible-tablet { + display: none !important; +} + +.hidden-desktop { + display: none !important; +} + +.visible-desktop { + display: inherit !important; +} + +@media (min-width: 768px) and (max-width: 979px) { + .hidden-desktop { + display: inherit !important; + } + .visible-desktop { + display: none !important ; + } + .visible-tablet { + display: inherit !important; + } + .hidden-tablet { + display: none !important; + } +} + +@media (max-width: 767px) { + .hidden-desktop { + display: inherit !important; + } + .visible-desktop { + display: none !important; + } + .visible-phone { + display: inherit !important; + } + .hidden-phone { + display: none !important; + } +} + +@media (min-width: 1200px) { + .row { + margin-left: -30px; + *zoom: 1; + } + .row:before, + .row:after { + display: table; + line-height: 0; + content: ""; + } + .row:after { + clear: both; + } + [class*="span"] { + float: left; + min-height: 1px; + margin-left: 30px; + } + .container, + .navbar-static-top .container, + .navbar-fixed-top .container, + .navbar-fixed-bottom .container { + width: 1170px; + } + .span12 { + width: 1170px; + } + .span11 { + width: 1070px; + } + .span10 { + width: 970px; + } + .span9 { + width: 870px; + } + .span8 { + width: 770px; + } + .span7 { + width: 670px; + } + .span6 { + width: 570px; + } + .span5 { + width: 470px; + } + .span4 { + width: 370px; + } + .span3 { + width: 270px; + } + .span2 { + width: 170px; + } + .span1 { + width: 70px; + } + .offset12 { + margin-left: 1230px; + } + .offset11 { + margin-left: 1130px; + } + .offset10 { + margin-left: 1030px; + } + .offset9 { + margin-left: 930px; + } + .offset8 { + margin-left: 830px; + } + .offset7 { + margin-left: 730px; + } + .offset6 { + margin-left: 630px; + } + .offset5 { + margin-left: 530px; + } + .offset4 { + margin-left: 430px; + } + .offset3 { + margin-left: 330px; + } + .offset2 { + margin-left: 230px; + } + .offset1 { + margin-left: 130px; + } + .row-fluid { + width: 100%; + *zoom: 1; + } + .row-fluid:before, + .row-fluid:after { + display: table; + line-height: 0; + content: ""; + } + .row-fluid:after { + clear: both; + } + .row-fluid [class*="span"] { + display: block; + float: left; + width: 100%; + min-height: 30px; + margin-left: 2.564102564102564%; + *margin-left: 2.5109110747408616%; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + } + .row-fluid [class*="span"]:first-child { + margin-left: 0; + } + .row-fluid .span12 { + width: 100%; + *width: 99.94680851063829%; + } + .row-fluid .span11 { + width: 91.45299145299145%; + *width: 91.39979996362975%; + } + .row-fluid .span10 { + width: 82.90598290598291%; + *width: 82.8527914166212%; + } + .row-fluid .span9 { + width: 74.35897435897436%; + *width: 74.30578286961266%; + } + .row-fluid .span8 { + width: 65.81196581196582%; + *width: 65.75877432260411%; + } + .row-fluid .span7 { + width: 57.26495726495726%; + *width: 57.21176577559556%; + } + .row-fluid .span6 { + width: 48.717948717948715%; + *width: 48.664757228587014%; + } + .row-fluid .span5 { + width: 40.17094017094017%; + *width: 40.11774868157847%; + } + .row-fluid .span4 { + width: 31.623931623931625%; + *width: 31.570740134569924%; + } + .row-fluid .span3 { + width: 23.076923076923077%; + *width: 23.023731587561375%; + } + .row-fluid .span2 { + width: 14.52991452991453%; + *width: 14.476723040552828%; + } + .row-fluid .span1 { + width: 5.982905982905983%; + *width: 5.929714493544281%; + } + .row-fluid .offset12 { + margin-left: 105.12820512820512%; + *margin-left: 105.02182214948171%; + } + .row-fluid .offset12:first-child { + margin-left: 102.56410256410257%; + *margin-left: 102.45771958537915%; + } + .row-fluid .offset11 { + margin-left: 96.58119658119658%; + *margin-left: 96.47481360247316%; + } + .row-fluid .offset11:first-child { + margin-left: 94.01709401709402%; + *margin-left: 93.91071103837061%; + } + .row-fluid .offset10 { + margin-left: 88.03418803418803%; + *margin-left: 87.92780505546462%; + } + .row-fluid .offset10:first-child { + margin-left: 85.47008547008548%; + *margin-left: 85.36370249136206%; + } + .row-fluid .offset9 { + margin-left: 79.48717948717949%; + *margin-left: 79.38079650845607%; + } + .row-fluid .offset9:first-child { + margin-left: 76.92307692307693%; + *margin-left: 76.81669394435352%; + } + .row-fluid .offset8 { + margin-left: 70.94017094017094%; + *margin-left: 70.83378796144753%; + } + .row-fluid .offset8:first-child { + margin-left: 68.37606837606839%; + *margin-left: 68.26968539734497%; + } + .row-fluid .offset7 { + margin-left: 62.393162393162385%; + *margin-left: 62.28677941443899%; + } + .row-fluid .offset7:first-child { + margin-left: 59.82905982905982%; + *margin-left: 59.72267685033642%; + } + .row-fluid .offset6 { + margin-left: 53.84615384615384%; + *margin-left: 53.739770867430444%; + } + .row-fluid .offset6:first-child { + margin-left: 51.28205128205128%; + *margin-left: 51.175668303327875%; + } + .row-fluid .offset5 { + margin-left: 45.299145299145295%; + *margin-left: 45.1927623204219%; + } + .row-fluid .offset5:first-child { + margin-left: 42.73504273504273%; + *margin-left: 42.62865975631933%; + } + .row-fluid .offset4 { + margin-left: 36.75213675213675%; + *margin-left: 36.645753773413354%; + } + .row-fluid .offset4:first-child { + margin-left: 34.18803418803419%; + *margin-left: 34.081651209310785%; + } + .row-fluid .offset3 { + margin-left: 28.205128205128204%; + *margin-left: 28.0987452264048%; + } + .row-fluid .offset3:first-child { + margin-left: 25.641025641025642%; + *margin-left: 25.53464266230224%; + } + .row-fluid .offset2 { + margin-left: 19.65811965811966%; + *margin-left: 19.551736679396257%; + } + .row-fluid .offset2:first-child { + margin-left: 17.094017094017094%; + *margin-left: 16.98763411529369%; + } + .row-fluid .offset1 { + margin-left: 11.11111111111111%; + *margin-left: 11.004728132387708%; + } + .row-fluid .offset1:first-child { + margin-left: 8.547008547008547%; + *margin-left: 8.440625568285142%; + } + input, + textarea, + .uneditable-input { + margin-left: 0; + } + .controls-row [class*="span"] + [class*="span"] { + margin-left: 30px; + } + input.span12, + textarea.span12, + .uneditable-input.span12 { + width: 1156px; + } + input.span11, + textarea.span11, + .uneditable-input.span11 { + width: 1056px; + } + input.span10, + textarea.span10, + .uneditable-input.span10 { + width: 956px; + } + input.span9, + textarea.span9, + .uneditable-input.span9 { + width: 856px; + } + input.span8, + textarea.span8, + .uneditable-input.span8 { + width: 756px; + } + input.span7, + textarea.span7, + .uneditable-input.span7 { + width: 656px; + } + input.span6, + textarea.span6, + .uneditable-input.span6 { + width: 556px; + } + input.span5, + textarea.span5, + .uneditable-input.span5 { + width: 456px; + } + input.span4, + textarea.span4, + .uneditable-input.span4 { + width: 356px; + } + input.span3, + textarea.span3, + .uneditable-input.span3 { + width: 256px; + } + input.span2, + textarea.span2, + .uneditable-input.span2 { + width: 156px; + } + input.span1, + textarea.span1, + .uneditable-input.span1 { + width: 56px; + } + .thumbnails { + margin-left: -30px; + } + .thumbnails > li { + margin-left: 30px; + } + .row-fluid .thumbnails { + margin-left: 0; + } +} + +@media (min-width: 768px) and (max-width: 979px) { + .row { + margin-left: -20px; + *zoom: 1; + } + .row:before, + .row:after { + display: table; + line-height: 0; + content: ""; + } + .row:after { + clear: both; + } + [class*="span"] { + float: left; + min-height: 1px; + margin-left: 20px; + } + .container, + .navbar-static-top .container, + .navbar-fixed-top .container, + .navbar-fixed-bottom .container { + width: 724px; + } + .span12 { + width: 724px; + } + .span11 { + width: 662px; + } + .span10 { + width: 600px; + } + .span9 { + width: 538px; + } + .span8 { + width: 476px; + } + .span7 { + width: 414px; + } + .span6 { + width: 352px; + } + .span5 { + width: 290px; + } + .span4 { + width: 228px; + } + .span3 { + width: 166px; + } + .span2 { + width: 104px; + } + .span1 { + width: 42px; + } + .offset12 { + margin-left: 764px; + } + .offset11 { + margin-left: 702px; + } + .offset10 { + margin-left: 640px; + } + .offset9 { + margin-left: 578px; + } + .offset8 { + margin-left: 516px; + } + .offset7 { + margin-left: 454px; + } + .offset6 { + margin-left: 392px; + } + .offset5 { + margin-left: 330px; + } + .offset4 { + margin-left: 268px; + } + .offset3 { + margin-left: 206px; + } + .offset2 { + margin-left: 144px; + } + .offset1 { + margin-left: 82px; + } + .row-fluid { + width: 100%; + *zoom: 1; + } + .row-fluid:before, + .row-fluid:after { + display: table; + line-height: 0; + content: ""; + } + .row-fluid:after { + clear: both; + } + .row-fluid [class*="span"] { + display: block; + float: left; + width: 100%; + min-height: 30px; + margin-left: 2.7624309392265194%; + *margin-left: 2.709239449864817%; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + } + .row-fluid [class*="span"]:first-child { + margin-left: 0; + } + .row-fluid .span12 { + width: 100%; + *width: 99.94680851063829%; + } + .row-fluid .span11 { + width: 91.43646408839778%; + *width: 91.38327259903608%; + } + .row-fluid .span10 { + width: 82.87292817679558%; + *width: 82.81973668743387%; + } + .row-fluid .span9 { + width: 74.30939226519337%; + *width: 74.25620077583166%; + } + .row-fluid .span8 { + width: 65.74585635359117%; + *width: 65.69266486422946%; + } + .row-fluid .span7 { + width: 57.18232044198895%; + *width: 57.12912895262725%; + } + .row-fluid .span6 { + width: 48.61878453038674%; + *width: 48.56559304102504%; + } + .row-fluid .span5 { + width: 40.05524861878453%; + *width: 40.00205712942283%; + } + .row-fluid .span4 { + width: 31.491712707182323%; + *width: 31.43852121782062%; + } + .row-fluid .span3 { + width: 22.92817679558011%; + *width: 22.87498530621841%; + } + .row-fluid .span2 { + width: 14.3646408839779%; + *width: 14.311449394616199%; + } + .row-fluid .span1 { + width: 5.801104972375691%; + *width: 5.747913483013988%; + } + .row-fluid .offset12 { + margin-left: 105.52486187845304%; + *margin-left: 105.41847889972962%; + } + .row-fluid .offset12:first-child { + margin-left: 102.76243093922652%; + *margin-left: 102.6560479605031%; + } + .row-fluid .offset11 { + margin-left: 96.96132596685082%; + *margin-left: 96.8549429881274%; + } + .row-fluid .offset11:first-child { + margin-left: 94.1988950276243%; + *margin-left: 94.09251204890089%; + } + .row-fluid .offset10 { + margin-left: 88.39779005524862%; + *margin-left: 88.2914070765252%; + } + .row-fluid .offset10:first-child { + margin-left: 85.6353591160221%; + *margin-left: 85.52897613729868%; + } + .row-fluid .offset9 { + margin-left: 79.8342541436464%; + *margin-left: 79.72787116492299%; + } + .row-fluid .offset9:first-child { + margin-left: 77.07182320441989%; + *margin-left: 76.96544022569647%; + } + .row-fluid .offset8 { + margin-left: 71.2707182320442%; + *margin-left: 71.16433525332079%; + } + .row-fluid .offset8:first-child { + margin-left: 68.50828729281768%; + *margin-left: 68.40190431409427%; + } + .row-fluid .offset7 { + margin-left: 62.70718232044199%; + *margin-left: 62.600799341718584%; + } + .row-fluid .offset7:first-child { + margin-left: 59.94475138121547%; + *margin-left: 59.838368402492065%; + } + .row-fluid .offset6 { + margin-left: 54.14364640883978%; + *margin-left: 54.037263430116376%; + } + .row-fluid .offset6:first-child { + margin-left: 51.38121546961326%; + *margin-left: 51.27483249088986%; + } + .row-fluid .offset5 { + margin-left: 45.58011049723757%; + *margin-left: 45.47372751851417%; + } + .row-fluid .offset5:first-child { + margin-left: 42.81767955801105%; + *margin-left: 42.71129657928765%; + } + .row-fluid .offset4 { + margin-left: 37.01657458563536%; + *margin-left: 36.91019160691196%; + } + .row-fluid .offset4:first-child { + margin-left: 34.25414364640884%; + *margin-left: 34.14776066768544%; + } + .row-fluid .offset3 { + margin-left: 28.45303867403315%; + *margin-left: 28.346655695309746%; + } + .row-fluid .offset3:first-child { + margin-left: 25.69060773480663%; + *margin-left: 25.584224756083227%; + } + .row-fluid .offset2 { + margin-left: 19.88950276243094%; + *margin-left: 19.783119783707537%; + } + .row-fluid .offset2:first-child { + margin-left: 17.12707182320442%; + *margin-left: 17.02068884448102%; + } + .row-fluid .offset1 { + margin-left: 11.32596685082873%; + *margin-left: 11.219583872105325%; + } + .row-fluid .offset1:first-child { + margin-left: 8.56353591160221%; + *margin-left: 8.457152932878806%; + } + input, + textarea, + .uneditable-input { + margin-left: 0; + } + .controls-row [class*="span"] + [class*="span"] { + margin-left: 20px; + } + input.span12, + textarea.span12, + .uneditable-input.span12 { + width: 710px; + } + input.span11, + textarea.span11, + .uneditable-input.span11 { + width: 648px; + } + input.span10, + textarea.span10, + .uneditable-input.span10 { + width: 586px; + } + input.span9, + textarea.span9, + .uneditable-input.span9 { + width: 524px; + } + input.span8, + textarea.span8, + .uneditable-input.span8 { + width: 462px; + } + input.span7, + textarea.span7, + .uneditable-input.span7 { + width: 400px; + } + input.span6, + textarea.span6, + .uneditable-input.span6 { + width: 338px; + } + input.span5, + textarea.span5, + .uneditable-input.span5 { + width: 276px; + } + input.span4, + textarea.span4, + .uneditable-input.span4 { + width: 214px; + } + input.span3, + textarea.span3, + .uneditable-input.span3 { + width: 152px; + } + input.span2, + textarea.span2, + .uneditable-input.span2 { + width: 90px; + } + input.span1, + textarea.span1, + .uneditable-input.span1 { + width: 28px; + } +} + +@media (max-width: 767px) { + body { + padding-right: 20px; + padding-left: 20px; + } + .navbar-fixed-top, + .navbar-fixed-bottom, + .navbar-static-top { + margin-right: -20px; + margin-left: -20px; + } + .container-fluid { + padding: 0; + } + .dl-horizontal dt { + float: none; + width: auto; + clear: none; + text-align: left; + } + .dl-horizontal dd { + margin-left: 0; + } + .container { + width: auto; + } + .row-fluid { + width: 100%; + } + .row, + .thumbnails { + margin-left: 0; + } + .thumbnails > li { + float: none; + margin-left: 0; + } + [class*="span"], + .row-fluid [class*="span"] { + display: block; + float: none; + width: 100%; + margin-left: 0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + } + .span12, + .row-fluid .span12 { + width: 100%; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + } + .input-large, + .input-xlarge, + .input-xxlarge, + input[class*="span"], + select[class*="span"], + textarea[class*="span"], + .uneditable-input { + display: block; + width: 100%; + min-height: 30px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + } + .input-prepend input, + .input-append input, + .input-prepend input[class*="span"], + .input-append input[class*="span"] { + display: inline-block; + width: auto; + } + .controls-row [class*="span"] + [class*="span"] { + margin-left: 0; + } + .modal { + position: fixed; + top: 20px; + right: 20px; + left: 20px; + width: auto; + margin: 0; + } + .modal.fade.in { + top: auto; + } +} + +@media (max-width: 480px) { + .nav-collapse { + -webkit-transform: translate3d(0, 0, 0); + } + .page-header h1 small { + display: block; + line-height: 20px; + } + input[type="checkbox"], + input[type="radio"] { + border: 1px solid #ccc; + } + .form-horizontal .control-label { + float: none; + width: auto; + padding-top: 0; + text-align: left; + } + .form-horizontal .controls { + margin-left: 0; + } + .form-horizontal .control-list { + padding-top: 0; + } + .form-horizontal .form-actions { + padding-right: 10px; + padding-left: 10px; + } + .modal { + top: 10px; + right: 10px; + left: 10px; + } + .modal-header .close { + padding: 10px; + margin: -10px; + } + .carousel-caption { + position: static; + } +} + +@media (max-width: 979px) { + body { + padding-top: 0; + } + .navbar-fixed-top, + .navbar-fixed-bottom { + position: static; + } + .navbar-fixed-top { + margin-bottom: 20px; + } + .navbar-fixed-bottom { + margin-top: 20px; + } + .navbar-fixed-top .navbar-inner, + .navbar-fixed-bottom .navbar-inner { + padding: 5px; + } + .navbar .container { + width: auto; + padding: 0; + } + .navbar .brand { + padding-right: 10px; + padding-left: 10px; + margin: 0 0 0 -5px; + } + .nav-collapse { + clear: both; + } + .nav-collapse .nav { + float: none; + margin: 0 0 10px; + } + .nav-collapse .nav > li { + float: none; + } + .nav-collapse .nav > li > a { + margin-bottom: 2px; + } + .nav-collapse .nav > .divider-vertical { + display: none; + } + .nav-collapse .nav .nav-header { + color: #777777; + text-shadow: none; + } + .nav-collapse .nav > li > a, + .nav-collapse .dropdown-menu a { + padding: 9px 15px; + font-weight: bold; + color: #777777; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + } + .nav-collapse .btn { + padding: 4px 10px 4px; + font-weight: normal; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + } + .nav-collapse .dropdown-menu li + li a { + margin-bottom: 2px; + } + .nav-collapse .nav > li > a:hover, + .nav-collapse .dropdown-menu a:hover { + background-color: #f2f2f2; + } + .navbar-inverse .nav-collapse .nav > li > a:hover, + .navbar-inverse .nav-collapse .dropdown-menu a:hover { + background-color: #111111; + } + .nav-collapse.in .btn-group { + padding: 0; + margin-top: 5px; + } + .nav-collapse .dropdown-menu { + position: static; + top: auto; + left: auto; + display: block; + float: none; + max-width: none; + padding: 0; + margin: 0 15px; + background-color: transparent; + border: none; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; + } + .nav-collapse .dropdown-menu:before, + .nav-collapse .dropdown-menu:after { + display: none; + } + .nav-collapse .dropdown-menu .divider { + display: none; + } + .nav-collapse .nav > li > .dropdown-menu:before, + .nav-collapse .nav > li > .dropdown-menu:after { + display: none; + } + .nav-collapse .navbar-form, + .nav-collapse .navbar-search { + float: none; + padding: 10px 15px; + margin: 10px 0; + border-top: 1px solid #f2f2f2; + border-bottom: 1px solid #f2f2f2; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1); + } + .navbar-inverse .nav-collapse .navbar-form, + .navbar-inverse .nav-collapse .navbar-search { + border-top-color: #111111; + border-bottom-color: #111111; + } + .navbar .nav-collapse .nav.pull-right { + float: none; + margin-left: 0; + } + .nav-collapse, + .nav-collapse.collapse { + height: 0; + overflow: hidden; + } + .navbar .btn-navbar { + display: block; + } + .navbar-static .navbar-inner { + padding-right: 10px; + padding-left: 10px; + } +} + +@media (min-width: 980px) { + .nav-collapse.collapse { + height: auto !important; + overflow: visible !important; + } +} diff --git a/Website/LOC.Website.Web/Content/css/bootstrap-responsive.min.css b/Website/LOC.Website.Web/Content/css/bootstrap-responsive.min.css new file mode 100644 index 000000000..7b0158da0 --- /dev/null +++ b/Website/LOC.Website.Web/Content/css/bootstrap-responsive.min.css @@ -0,0 +1,9 @@ +/*! + * Bootstrap Responsive v2.1.1 + * + * Copyright 2012 Twitter, Inc + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Designed and built with all the love in the world @twitter by @mdo and @fat. + */.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;line-height:0;content:""}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.hidden{display:none;visibility:hidden}.visible-phone{display:none!important}.visible-tablet{display:none!important}.hidden-desktop{display:none!important}.visible-desktop{display:inherit!important}@media(min-width:768px) and (max-width:979px){.hidden-desktop{display:inherit!important}.visible-desktop{display:none!important}.visible-tablet{display:inherit!important}.hidden-tablet{display:none!important}}@media(max-width:767px){.hidden-desktop{display:inherit!important}.visible-desktop{display:none!important}.visible-phone{display:inherit!important}.hidden-phone{display:none!important}}@media(min-width:1200px){.row{margin-left:-30px;*zoom:1}.row:before,.row:after{display:table;line-height:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:30px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:1170px}.span12{width:1170px}.span11{width:1070px}.span10{width:970px}.span9{width:870px}.span8{width:770px}.span7{width:670px}.span6{width:570px}.span5{width:470px}.span4{width:370px}.span3{width:270px}.span2{width:170px}.span1{width:70px}.offset12{margin-left:1230px}.offset11{margin-left:1130px}.offset10{margin-left:1030px}.offset9{margin-left:930px}.offset8{margin-left:830px}.offset7{margin-left:730px}.offset6{margin-left:630px}.offset5{margin-left:530px}.offset4{margin-left:430px}.offset3{margin-left:330px}.offset2{margin-left:230px}.offset1{margin-left:130px}.row-fluid{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block;float:left;width:100%;min-height:30px;margin-left:2.564102564102564%;*margin-left:2.5109110747408616%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.45299145299145%;*width:91.39979996362975%}.row-fluid .span10{width:82.90598290598291%;*width:82.8527914166212%}.row-fluid .span9{width:74.35897435897436%;*width:74.30578286961266%}.row-fluid .span8{width:65.81196581196582%;*width:65.75877432260411%}.row-fluid .span7{width:57.26495726495726%;*width:57.21176577559556%}.row-fluid .span6{width:48.717948717948715%;*width:48.664757228587014%}.row-fluid .span5{width:40.17094017094017%;*width:40.11774868157847%}.row-fluid .span4{width:31.623931623931625%;*width:31.570740134569924%}.row-fluid .span3{width:23.076923076923077%;*width:23.023731587561375%}.row-fluid .span2{width:14.52991452991453%;*width:14.476723040552828%}.row-fluid .span1{width:5.982905982905983%;*width:5.929714493544281%}.row-fluid .offset12{margin-left:105.12820512820512%;*margin-left:105.02182214948171%}.row-fluid .offset12:first-child{margin-left:102.56410256410257%;*margin-left:102.45771958537915%}.row-fluid .offset11{margin-left:96.58119658119658%;*margin-left:96.47481360247316%}.row-fluid .offset11:first-child{margin-left:94.01709401709402%;*margin-left:93.91071103837061%}.row-fluid .offset10{margin-left:88.03418803418803%;*margin-left:87.92780505546462%}.row-fluid .offset10:first-child{margin-left:85.47008547008548%;*margin-left:85.36370249136206%}.row-fluid .offset9{margin-left:79.48717948717949%;*margin-left:79.38079650845607%}.row-fluid .offset9:first-child{margin-left:76.92307692307693%;*margin-left:76.81669394435352%}.row-fluid .offset8{margin-left:70.94017094017094%;*margin-left:70.83378796144753%}.row-fluid .offset8:first-child{margin-left:68.37606837606839%;*margin-left:68.26968539734497%}.row-fluid .offset7{margin-left:62.393162393162385%;*margin-left:62.28677941443899%}.row-fluid .offset7:first-child{margin-left:59.82905982905982%;*margin-left:59.72267685033642%}.row-fluid .offset6{margin-left:53.84615384615384%;*margin-left:53.739770867430444%}.row-fluid .offset6:first-child{margin-left:51.28205128205128%;*margin-left:51.175668303327875%}.row-fluid .offset5{margin-left:45.299145299145295%;*margin-left:45.1927623204219%}.row-fluid .offset5:first-child{margin-left:42.73504273504273%;*margin-left:42.62865975631933%}.row-fluid .offset4{margin-left:36.75213675213675%;*margin-left:36.645753773413354%}.row-fluid .offset4:first-child{margin-left:34.18803418803419%;*margin-left:34.081651209310785%}.row-fluid .offset3{margin-left:28.205128205128204%;*margin-left:28.0987452264048%}.row-fluid .offset3:first-child{margin-left:25.641025641025642%;*margin-left:25.53464266230224%}.row-fluid .offset2{margin-left:19.65811965811966%;*margin-left:19.551736679396257%}.row-fluid .offset2:first-child{margin-left:17.094017094017094%;*margin-left:16.98763411529369%}.row-fluid .offset1{margin-left:11.11111111111111%;*margin-left:11.004728132387708%}.row-fluid .offset1:first-child{margin-left:8.547008547008547%;*margin-left:8.440625568285142%}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:30px}input.span12,textarea.span12,.uneditable-input.span12{width:1156px}input.span11,textarea.span11,.uneditable-input.span11{width:1056px}input.span10,textarea.span10,.uneditable-input.span10{width:956px}input.span9,textarea.span9,.uneditable-input.span9{width:856px}input.span8,textarea.span8,.uneditable-input.span8{width:756px}input.span7,textarea.span7,.uneditable-input.span7{width:656px}input.span6,textarea.span6,.uneditable-input.span6{width:556px}input.span5,textarea.span5,.uneditable-input.span5{width:456px}input.span4,textarea.span4,.uneditable-input.span4{width:356px}input.span3,textarea.span3,.uneditable-input.span3{width:256px}input.span2,textarea.span2,.uneditable-input.span2{width:156px}input.span1,textarea.span1,.uneditable-input.span1{width:56px}.thumbnails{margin-left:-30px}.thumbnails>li{margin-left:30px}.row-fluid .thumbnails{margin-left:0}}@media(min-width:768px) and (max-width:979px){.row{margin-left:-20px;*zoom:1}.row:before,.row:after{display:table;line-height:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:20px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:724px}.span12{width:724px}.span11{width:662px}.span10{width:600px}.span9{width:538px}.span8{width:476px}.span7{width:414px}.span6{width:352px}.span5{width:290px}.span4{width:228px}.span3{width:166px}.span2{width:104px}.span1{width:42px}.offset12{margin-left:764px}.offset11{margin-left:702px}.offset10{margin-left:640px}.offset9{margin-left:578px}.offset8{margin-left:516px}.offset7{margin-left:454px}.offset6{margin-left:392px}.offset5{margin-left:330px}.offset4{margin-left:268px}.offset3{margin-left:206px}.offset2{margin-left:144px}.offset1{margin-left:82px}.row-fluid{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block;float:left;width:100%;min-height:30px;margin-left:2.7624309392265194%;*margin-left:2.709239449864817%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.43646408839778%;*width:91.38327259903608%}.row-fluid .span10{width:82.87292817679558%;*width:82.81973668743387%}.row-fluid .span9{width:74.30939226519337%;*width:74.25620077583166%}.row-fluid .span8{width:65.74585635359117%;*width:65.69266486422946%}.row-fluid .span7{width:57.18232044198895%;*width:57.12912895262725%}.row-fluid .span6{width:48.61878453038674%;*width:48.56559304102504%}.row-fluid .span5{width:40.05524861878453%;*width:40.00205712942283%}.row-fluid .span4{width:31.491712707182323%;*width:31.43852121782062%}.row-fluid .span3{width:22.92817679558011%;*width:22.87498530621841%}.row-fluid .span2{width:14.3646408839779%;*width:14.311449394616199%}.row-fluid .span1{width:5.801104972375691%;*width:5.747913483013988%}.row-fluid .offset12{margin-left:105.52486187845304%;*margin-left:105.41847889972962%}.row-fluid .offset12:first-child{margin-left:102.76243093922652%;*margin-left:102.6560479605031%}.row-fluid .offset11{margin-left:96.96132596685082%;*margin-left:96.8549429881274%}.row-fluid .offset11:first-child{margin-left:94.1988950276243%;*margin-left:94.09251204890089%}.row-fluid .offset10{margin-left:88.39779005524862%;*margin-left:88.2914070765252%}.row-fluid .offset10:first-child{margin-left:85.6353591160221%;*margin-left:85.52897613729868%}.row-fluid .offset9{margin-left:79.8342541436464%;*margin-left:79.72787116492299%}.row-fluid .offset9:first-child{margin-left:77.07182320441989%;*margin-left:76.96544022569647%}.row-fluid .offset8{margin-left:71.2707182320442%;*margin-left:71.16433525332079%}.row-fluid .offset8:first-child{margin-left:68.50828729281768%;*margin-left:68.40190431409427%}.row-fluid .offset7{margin-left:62.70718232044199%;*margin-left:62.600799341718584%}.row-fluid .offset7:first-child{margin-left:59.94475138121547%;*margin-left:59.838368402492065%}.row-fluid .offset6{margin-left:54.14364640883978%;*margin-left:54.037263430116376%}.row-fluid .offset6:first-child{margin-left:51.38121546961326%;*margin-left:51.27483249088986%}.row-fluid .offset5{margin-left:45.58011049723757%;*margin-left:45.47372751851417%}.row-fluid .offset5:first-child{margin-left:42.81767955801105%;*margin-left:42.71129657928765%}.row-fluid .offset4{margin-left:37.01657458563536%;*margin-left:36.91019160691196%}.row-fluid .offset4:first-child{margin-left:34.25414364640884%;*margin-left:34.14776066768544%}.row-fluid .offset3{margin-left:28.45303867403315%;*margin-left:28.346655695309746%}.row-fluid .offset3:first-child{margin-left:25.69060773480663%;*margin-left:25.584224756083227%}.row-fluid .offset2{margin-left:19.88950276243094%;*margin-left:19.783119783707537%}.row-fluid .offset2:first-child{margin-left:17.12707182320442%;*margin-left:17.02068884448102%}.row-fluid .offset1{margin-left:11.32596685082873%;*margin-left:11.219583872105325%}.row-fluid .offset1:first-child{margin-left:8.56353591160221%;*margin-left:8.457152932878806%}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:20px}input.span12,textarea.span12,.uneditable-input.span12{width:710px}input.span11,textarea.span11,.uneditable-input.span11{width:648px}input.span10,textarea.span10,.uneditable-input.span10{width:586px}input.span9,textarea.span9,.uneditable-input.span9{width:524px}input.span8,textarea.span8,.uneditable-input.span8{width:462px}input.span7,textarea.span7,.uneditable-input.span7{width:400px}input.span6,textarea.span6,.uneditable-input.span6{width:338px}input.span5,textarea.span5,.uneditable-input.span5{width:276px}input.span4,textarea.span4,.uneditable-input.span4{width:214px}input.span3,textarea.span3,.uneditable-input.span3{width:152px}input.span2,textarea.span2,.uneditable-input.span2{width:90px}input.span1,textarea.span1,.uneditable-input.span1{width:28px}}@media(max-width:767px){body{padding-right:20px;padding-left:20px}.navbar-fixed-top,.navbar-fixed-bottom,.navbar-static-top{margin-right:-20px;margin-left:-20px}.container-fluid{padding:0}.dl-horizontal dt{float:none;width:auto;clear:none;text-align:left}.dl-horizontal dd{margin-left:0}.container{width:auto}.row-fluid{width:100%}.row,.thumbnails{margin-left:0}.thumbnails>li{float:none;margin-left:0}[class*="span"],.row-fluid [class*="span"]{display:block;float:none;width:100%;margin-left:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.span12,.row-fluid .span12{width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.input-large,.input-xlarge,.input-xxlarge,input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.input-prepend input,.input-append input,.input-prepend input[class*="span"],.input-append input[class*="span"]{display:inline-block;width:auto}.controls-row [class*="span"]+[class*="span"]{margin-left:0}.modal{position:fixed;top:20px;right:20px;left:20px;width:auto;margin:0}.modal.fade.in{top:auto}}@media(max-width:480px){.nav-collapse{-webkit-transform:translate3d(0,0,0)}.page-header h1 small{display:block;line-height:20px}input[type="checkbox"],input[type="radio"]{border:1px solid #ccc}.form-horizontal .control-label{float:none;width:auto;padding-top:0;text-align:left}.form-horizontal .controls{margin-left:0}.form-horizontal .control-list{padding-top:0}.form-horizontal .form-actions{padding-right:10px;padding-left:10px}.modal{top:10px;right:10px;left:10px}.modal-header .close{padding:10px;margin:-10px}.carousel-caption{position:static}}@media(max-width:979px){body{padding-top:0}.navbar-fixed-top,.navbar-fixed-bottom{position:static}.navbar-fixed-top{margin-bottom:20px}.navbar-fixed-bottom{margin-top:20px}.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding:5px}.navbar .container{width:auto;padding:0}.navbar .brand{padding-right:10px;padding-left:10px;margin:0 0 0 -5px}.nav-collapse{clear:both}.nav-collapse .nav{float:none;margin:0 0 10px}.nav-collapse .nav>li{float:none}.nav-collapse .nav>li>a{margin-bottom:2px}.nav-collapse .nav>.divider-vertical{display:none}.nav-collapse .nav .nav-header{color:#777;text-shadow:none}.nav-collapse .nav>li>a,.nav-collapse .dropdown-menu a{padding:9px 15px;font-weight:bold;color:#777;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.nav-collapse .btn{padding:4px 10px 4px;font-weight:normal;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.nav-collapse .dropdown-menu li+li a{margin-bottom:2px}.nav-collapse .nav>li>a:hover,.nav-collapse .dropdown-menu a:hover{background-color:#f2f2f2}.navbar-inverse .nav-collapse .nav>li>a:hover,.navbar-inverse .nav-collapse .dropdown-menu a:hover{background-color:#111}.nav-collapse.in .btn-group{padding:0;margin-top:5px}.nav-collapse .dropdown-menu{position:static;top:auto;left:auto;display:block;float:none;max-width:none;padding:0;margin:0 15px;background-color:transparent;border:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.nav-collapse .dropdown-menu:before,.nav-collapse .dropdown-menu:after{display:none}.nav-collapse .dropdown-menu .divider{display:none}.nav-collapse .nav>li>.dropdown-menu:before,.nav-collapse .nav>li>.dropdown-menu:after{display:none}.nav-collapse .navbar-form,.nav-collapse .navbar-search{float:none;padding:10px 15px;margin:10px 0;border-top:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1)}.navbar-inverse .nav-collapse .navbar-form,.navbar-inverse .nav-collapse .navbar-search{border-top-color:#111;border-bottom-color:#111}.navbar .nav-collapse .nav.pull-right{float:none;margin-left:0}.nav-collapse,.nav-collapse.collapse{height:0;overflow:hidden}.navbar .btn-navbar{display:block}.navbar-static .navbar-inner{padding-right:10px;padding-left:10px}}@media(min-width:980px){.nav-collapse.collapse{height:auto!important;overflow:visible!important}} diff --git a/Website/LOC.Website.Web/Content/css/bootstrap.css b/Website/LOC.Website.Web/Content/css/bootstrap.css new file mode 100644 index 000000000..23ec367ec --- /dev/null +++ b/Website/LOC.Website.Web/Content/css/bootstrap.css @@ -0,0 +1,5774 @@ +/*! + * Bootstrap v2.1.1 + * + * Copyright 2012 Twitter, Inc + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Designed and built with all the love in the world @twitter by @mdo and @fat. + */a + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +nav, +section { + display: block; +} + +audio, +canvas, +video { + display: inline-block; + *display: inline; + *zoom: 1; +} + +audio:not([controls]) { + display: none; +} + +html { + font-size: 100%; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} + +a:focus { + outline: thin dotted #333; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} + +a:hover, +a:active { + outline: 0; +} + +sub, +sup { + position: relative; + font-size: 75%; + line-height: 0; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +img { + width: auto\9; + height: auto; + max-width: 100%; + vertical-align: middle; + border: 0; + -ms-interpolation-mode: bicubic; +} + +#map_canvas img { + max-width: none; +} + +button, +input, +select, +textarea { + margin: 0; + font-size: 100%; + vertical-align: middle; +} + +button, +input { + *overflow: visible; + line-height: normal; +} + +button::-moz-focus-inner, +input::-moz-focus-inner { + padding: 0; + border: 0; +} + +button, +input[type="button"], +input[type="reset"], +input[type="submit"] { + cursor: pointer; + -webkit-appearance: button; +} + +input[type="search"] { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + -webkit-appearance: textfield; +} + +input[type="search"]::-webkit-search-decoration, +input[type="search"]::-webkit-search-cancel-button { + -webkit-appearance: none; +} + +textarea { + overflow: auto; + vertical-align: top; +} + +.clearfix { + *zoom: 1; +} + +.clearfix:before, +.clearfix:after { + display: table; + line-height: 0; + content: ""; +} + +.clearfix:after { + clear: both; +} + +.hide-text { + font: 0/0 a; + color: transparent; + text-shadow: none; + background-color: transparent; + border: 0; +} + +.input-block-level { + display: block; + width: 100%; + min-height: 30px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +body { + margin: 0; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; + line-height: 20px; + color: #333333; + background-color: #ffffff; +} + +a { + color: #0088cc; + text-decoration: none; +} + +a:hover { + color: #005580; + text-decoration: none; +} + +.img-rounded { + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; +} + +.img-polaroid { + padding: 4px; + background-color: #fff; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, 0.2); + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); +} + +.img-circle { + -webkit-border-radius: 500px; + -moz-border-radius: 500px; + border-radius: 500px; +} + +.row { + margin-left: -20px; + *zoom: 1; +} + +.row:before, +.row:after { + display: table; + line-height: 0; + content: ""; +} + +.row:after { + clear: both; +} + +[class*="span"] { + float: left; + min-height: 1px; + margin-left: 20px; +} + +.container, +.navbar-static-top .container, +.navbar-fixed-top .container, +.navbar-fixed-bottom .container { + width: 940px; +} + +.span12 { + width: 940px; +} + +.span11 { + width: 860px; +} + +.span10 { + width: 780px; +} + +.span9 { + width: 700px; +} + +.span8 { + width: 620px; +} + +.span7 { + width: 540px; +} + +.span6 { + width: 460px; +} + +.span5 { + width: 380px; +} + +.span4 { + width: 300px; +} + +.span3 { + width: 220px; +} + +.span2 { + width: 140px; +} + +.span1 { + width: 60px; +} + +.offset12 { + margin-left: 980px; +} + +.offset11 { + margin-left: 900px; +} + +.offset10 { + margin-left: 820px; +} + +.offset9 { + margin-left: 740px; +} + +.offset8 { + margin-left: 660px; +} + +.offset7 { + margin-left: 580px; +} + +.offset6 { + margin-left: 500px; +} + +.offset5 { + margin-left: 420px; +} + +.offset4 { + margin-left: 340px; +} + +.offset3 { + margin-left: 260px; +} + +.offset2 { + margin-left: 180px; +} + +.offset1 { + margin-left: 100px; +} + +.row-fluid { + width: 100%; + *zoom: 1; +} + +.row-fluid:before, +.row-fluid:after { + display: table; + line-height: 0; + content: ""; +} + +.row-fluid:after { + clear: both; +} + +.row-fluid [class*="span"] { + display: block; + float: left; + width: 100%; + min-height: 30px; + margin-left: 2.127659574468085%; + *margin-left: 2.074468085106383%; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.row-fluid [class*="span"]:first-child { + margin-left: 0; +} + +.row-fluid .span12 { + width: 100%; + *width: 99.94680851063829%; +} + +.row-fluid .span11 { + width: 91.48936170212765%; + *width: 91.43617021276594%; +} + +.row-fluid .span10 { + width: 82.97872340425532%; + *width: 82.92553191489361%; +} + +.row-fluid .span9 { + width: 74.46808510638297%; + *width: 74.41489361702126%; +} + +.row-fluid .span8 { + width: 65.95744680851064%; + *width: 65.90425531914893%; +} + +.row-fluid .span7 { + width: 57.44680851063829%; + *width: 57.39361702127659%; +} + +.row-fluid .span6 { + width: 48.93617021276595%; + *width: 48.88297872340425%; +} + +.row-fluid .span5 { + width: 40.42553191489362%; + *width: 40.37234042553192%; +} + +.row-fluid .span4 { + width: 31.914893617021278%; + *width: 31.861702127659576%; +} + +.row-fluid .span3 { + width: 23.404255319148934%; + *width: 23.351063829787233%; +} + +.row-fluid .span2 { + width: 14.893617021276595%; + *width: 14.840425531914894%; +} + +.row-fluid .span1 { + width: 6.382978723404255%; + *width: 6.329787234042553%; +} + +.row-fluid .offset12 { + margin-left: 104.25531914893617%; + *margin-left: 104.14893617021275%; +} + +.row-fluid .offset12:first-child { + margin-left: 102.12765957446808%; + *margin-left: 102.02127659574467%; +} + +.row-fluid .offset11 { + margin-left: 95.74468085106382%; + *margin-left: 95.6382978723404%; +} + +.row-fluid .offset11:first-child { + margin-left: 93.61702127659574%; + *margin-left: 93.51063829787232%; +} + +.row-fluid .offset10 { + margin-left: 87.23404255319149%; + *margin-left: 87.12765957446807%; +} + +.row-fluid .offset10:first-child { + margin-left: 85.1063829787234%; + *margin-left: 84.99999999999999%; +} + +.row-fluid .offset9 { + margin-left: 78.72340425531914%; + *margin-left: 78.61702127659572%; +} + +.row-fluid .offset9:first-child { + margin-left: 76.59574468085106%; + *margin-left: 76.48936170212764%; +} + +.row-fluid .offset8 { + margin-left: 70.2127659574468%; + *margin-left: 70.10638297872339%; +} + +.row-fluid .offset8:first-child { + margin-left: 68.08510638297872%; + *margin-left: 67.9787234042553%; +} + +.row-fluid .offset7 { + margin-left: 61.70212765957446%; + *margin-left: 61.59574468085106%; +} + +.row-fluid .offset7:first-child { + margin-left: 59.574468085106375%; + *margin-left: 59.46808510638297%; +} + +.row-fluid .offset6 { + margin-left: 53.191489361702125%; + *margin-left: 53.085106382978715%; +} + +.row-fluid .offset6:first-child { + margin-left: 51.063829787234035%; + *margin-left: 50.95744680851063%; +} + +.row-fluid .offset5 { + margin-left: 44.68085106382979%; + *margin-left: 44.57446808510638%; +} + +.row-fluid .offset5:first-child { + margin-left: 42.5531914893617%; + *margin-left: 42.4468085106383%; +} + +.row-fluid .offset4 { + margin-left: 36.170212765957444%; + *margin-left: 36.06382978723405%; +} + +.row-fluid .offset4:first-child { + margin-left: 34.04255319148936%; + *margin-left: 33.93617021276596%; +} + +.row-fluid .offset3 { + margin-left: 27.659574468085104%; + *margin-left: 27.5531914893617%; +} + +.row-fluid .offset3:first-child { + margin-left: 25.53191489361702%; + *margin-left: 25.425531914893618%; +} + +.row-fluid .offset2 { + margin-left: 19.148936170212764%; + *margin-left: 19.04255319148936%; +} + +.row-fluid .offset2:first-child { + margin-left: 17.02127659574468%; + *margin-left: 16.914893617021278%; +} + +.row-fluid .offset1 { + margin-left: 10.638297872340425%; + *margin-left: 10.53191489361702%; +} + +.row-fluid .offset1:first-child { + margin-left: 8.51063829787234%; + *margin-left: 8.404255319148938%; +} + +[class*="span"].hide, +.row-fluid [class*="span"].hide { + display: none; +} + +[class*="span"].pull-right, +.row-fluid [class*="span"].pull-right { + float: right; +} + +.container { + margin-right: auto; + margin-left: auto; + *zoom: 1; +} + +.container:before, +.container:after { + display: table; + line-height: 0; + content: ""; +} + +.container:after { + clear: both; +} + +.container-fluid { + padding-right: 20px; + padding-left: 20px; + *zoom: 1; +} + +.container-fluid:before, +.container-fluid:after { + display: table; + line-height: 0; + content: ""; +} + +.container-fluid:after { + clear: both; +} + +p { + margin: 0 0 10px; +} + +.lead { + margin-bottom: 20px; + font-size: 21px; + font-weight: 200; + line-height: 30px; +} + +small { + font-size: 85%; +} + +strong { + font-weight: bold; +} + +em { + font-style: italic; +} + +cite { + font-style: normal; +} + +.muted { + color: #999999; +} + +.text-warning { + color: #c09853; +} + +.text-error { + color: #b94a48; +} + +.text-info { + color: #3a87ad; +} + +.text-success { + color: #468847; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + margin: 10px 0; + font-family: inherit; + font-weight: bold; + line-height: 1; + color: inherit; + text-rendering: optimizelegibility; +} + +h1 small, +h2 small, +h3 small, +h4 small, +h5 small, +h6 small { + font-weight: normal; + line-height: 1; + color: #999999; +} + +h1 { + font-size: 36px; + line-height: 40px; +} + +h2 { + font-size: 30px; + line-height: 40px; +} + +h3 { + font-size: 24px; + line-height: 40px; +} + +h4 { + font-size: 18px; + line-height: 20px; +} + +h5 { + font-size: 14px; + line-height: 20px; +} + +h6 { + font-size: 12px; + line-height: 20px; +} + +h1 small { + font-size: 24px; +} + +h2 small { + font-size: 18px; +} + +h3 small { + font-size: 14px; +} + +h4 small { + font-size: 14px; +} + +.page-header { + padding-bottom: 9px; + margin: 20px 0 30px; + border-bottom: 1px solid #eeeeee; +} + +ul, +ol { + padding: 0; + margin: 0 0 10px 25px; +} + +ul ul, +ul ol, +ol ol, +ol ul { + margin-bottom: 0; +} + +li { + line-height: 20px; +} + +ul.unstyled, +ol.unstyled { + margin-left: 0; + list-style: none; +} + +dl { + margin-bottom: 20px; +} + +dt, +dd { + line-height: 20px; +} + +dt { + font-weight: bold; +} + +dd { + margin-left: 10px; +} + +.dl-horizontal { + *zoom: 1; +} + +.dl-horizontal:before, +.dl-horizontal:after { + display: table; + line-height: 0; + content: ""; +} + +.dl-horizontal:after { + clear: both; +} + +.dl-horizontal dt { + float: left; + width: 160px; + overflow: hidden; + clear: left; + text-align: right; + text-overflow: ellipsis; + white-space: nowrap; +} + +.dl-horizontal dd { + margin-left: 180px; +} + +hr { + margin: 20px 0; + border: 0; + border-top: 1px solid #eeeeee; + border-bottom: 1px solid #ffffff; +} + +abbr[title] { + cursor: help; + border-bottom: 1px dotted #999999; +} + +abbr.initialism { + font-size: 90%; + text-transform: uppercase; +} + +blockquote { + padding: 0 0 0 15px; + margin: 0 0 20px; + border-left: 5px solid #eeeeee; +} + +blockquote p { + margin-bottom: 0; + font-size: 16px; + font-weight: 300; + line-height: 25px; +} + +blockquote small { + display: block; + line-height: 20px; + color: #999999; +} + +blockquote small:before { + content: '\2014 \00A0'; +} + +blockquote.pull-right { + float: right; + padding-right: 15px; + padding-left: 0; + border-right: 5px solid #eeeeee; + border-left: 0; +} + +blockquote.pull-right p, +blockquote.pull-right small { + text-align: right; +} + +blockquote.pull-right small:before { + content: ''; +} + +blockquote.pull-right small:after { + content: '\00A0 \2014'; +} + +q:before, +q:after, +blockquote:before, +blockquote:after { + content: ""; +} + +address { + display: block; + margin-bottom: 20px; + font-style: normal; + line-height: 20px; +} + +code, +pre { + padding: 0 3px 2px; + font-family: Monaco, Menlo, Consolas, "Courier New", monospace; + font-size: 12px; + color: #333333; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} + +code { + padding: 2px 4px; + color: #d14; + background-color: #f7f7f9; + border: 1px solid #e1e1e8; +} + +pre { + display: block; + padding: 9.5px; + margin: 0 0 10px; + font-size: 13px; + line-height: 20px; + word-break: break-all; + word-wrap: break-word; + white-space: pre; + white-space: pre-wrap; + background-color: #f5f5f5; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, 0.15); + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +pre.prettyprint { + margin-bottom: 20px; +} + +pre code { + padding: 0; + color: inherit; + background-color: transparent; + border: 0; +} + +.pre-scrollable { + max-height: 340px; + overflow-y: scroll; +} + +form { + margin: 0 0 20px; +} + +fieldset { + padding: 0; + margin: 0; + border: 0; +} + +legend { + display: block; + width: 100%; + padding: 0; + margin-bottom: 20px; + font-size: 21px; + line-height: 40px; + color: #333333; + border: 0; + border-bottom: 1px solid #e5e5e5; +} + +legend small { + font-size: 15px; + color: #999999; +} + +label, +input, +button, +select, +textarea { + font-size: 14px; + font-weight: normal; + line-height: 20px; +} + +input, +button, +select, +textarea { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; +} + +label { + display: block; + margin-bottom: 5px; +} + +select, +textarea, +input[type="text"], +input[type="password"], +input[type="datetime"], +input[type="datetime-local"], +input[type="date"], +input[type="month"], +input[type="time"], +input[type="week"], +input[type="number"], +input[type="email"], +input[type="url"], +input[type="search"], +input[type="tel"], +input[type="color"], +.uneditable-input { + display: inline-block; + height: 20px; + padding: 4px 6px; + margin-bottom: 9px; + font-size: 14px; + line-height: 20px; + color: #555555; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} + +input, +textarea, +.uneditable-input { + width: 206px; +} + +textarea { + height: auto; +} + +textarea, +input[type="text"], +input[type="password"], +input[type="datetime"], +input[type="datetime-local"], +input[type="date"], +input[type="month"], +input[type="time"], +input[type="week"], +input[type="number"], +input[type="email"], +input[type="url"], +input[type="search"], +input[type="tel"], +input[type="color"], +.uneditable-input { + background-color: #ffffff; + border: 1px solid #cccccc; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -webkit-transition: border linear 0.2s, box-shadow linear 0.2s; + -moz-transition: border linear 0.2s, box-shadow linear 0.2s; + -o-transition: border linear 0.2s, box-shadow linear 0.2s; + transition: border linear 0.2s, box-shadow linear 0.2s; +} + +textarea:focus, +input[type="text"]:focus, +input[type="password"]:focus, +input[type="datetime"]:focus, +input[type="datetime-local"]:focus, +input[type="date"]:focus, +input[type="month"]:focus, +input[type="time"]:focus, +input[type="week"]:focus, +input[type="number"]:focus, +input[type="email"]:focus, +input[type="url"]:focus, +input[type="search"]:focus, +input[type="tel"]:focus, +input[type="color"]:focus, +.uneditable-input:focus { + border-color: rgba(82, 168, 236, 0.8); + outline: 0; + outline: thin dotted \9; + /* IE6-9 */ + + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); +} + +input[type="radio"], +input[type="checkbox"] { + margin: 4px 0 0; + margin-top: 1px \9; + *margin-top: 0; + line-height: normal; + cursor: pointer; +} + +input[type="file"], +input[type="image"], +input[type="submit"], +input[type="reset"], +input[type="button"], +input[type="radio"], +input[type="checkbox"] { + width: auto; +} + +select, +input[type="file"] { + height: 30px; + /* In IE7, the height of the select element cannot be changed by height, only font-size */ + + *margin-top: 4px; + /* For IE7, add top margin to align select with labels */ + + line-height: 30px; +} + +select { + width: 220px; + background-color: #ffffff; + border: 1px solid #cccccc; +} + +select[multiple], +select[size] { + height: auto; +} + +select:focus, +input[type="file"]:focus, +input[type="radio"]:focus, +input[type="checkbox"]:focus { + outline: thin dotted #333; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} + +.uneditable-input, +.uneditable-textarea { + color: #999999; + cursor: not-allowed; + background-color: #fcfcfc; + border-color: #cccccc; + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); + -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); +} + +.uneditable-input { + overflow: hidden; + white-space: nowrap; +} + +.uneditable-textarea { + width: auto; + height: auto; +} + +input:-moz-placeholder, +textarea:-moz-placeholder { + color: #999999; +} + +input:-ms-input-placeholder, +textarea:-ms-input-placeholder { + color: #999999; +} + +input::-webkit-input-placeholder, +textarea::-webkit-input-placeholder { + color: #999999; +} + +.radio, +.checkbox { + min-height: 18px; + padding-left: 18px; +} + +.radio input[type="radio"], +.checkbox input[type="checkbox"] { + float: left; + margin-left: -18px; +} + +.controls > .radio:first-child, +.controls > .checkbox:first-child { + padding-top: 5px; +} + +.radio.inline, +.checkbox.inline { + display: inline-block; + padding-top: 5px; + margin-bottom: 0; + vertical-align: middle; +} + +.radio.inline + .radio.inline, +.checkbox.inline + .checkbox.inline { + margin-left: 10px; +} + +.input-mini { + width: 60px; +} + +.input-small { + width: 90px; +} + +.input-medium { + width: 150px; +} + +.input-large { + width: 210px; +} + +.input-xlarge { + width: 270px; +} + +.input-xxlarge { + width: 530px; +} + +input[class*="span"], +select[class*="span"], +textarea[class*="span"], +.uneditable-input[class*="span"], +.row-fluid input[class*="span"], +.row-fluid select[class*="span"], +.row-fluid textarea[class*="span"], +.row-fluid .uneditable-input[class*="span"] { + float: none; + margin-left: 0; +} + +.input-append input[class*="span"], +.input-append .uneditable-input[class*="span"], +.input-prepend input[class*="span"], +.input-prepend .uneditable-input[class*="span"], +.row-fluid input[class*="span"], +.row-fluid select[class*="span"], +.row-fluid textarea[class*="span"], +.row-fluid .uneditable-input[class*="span"], +.row-fluid .input-prepend [class*="span"], +.row-fluid .input-append [class*="span"] { + display: inline-block; +} + +input, +textarea, +.uneditable-input { + margin-left: 0; +} + +.controls-row [class*="span"] + [class*="span"] { + margin-left: 20px; +} + +input.span12, +textarea.span12, +.uneditable-input.span12 { + width: 926px; +} + +input.span11, +textarea.span11, +.uneditable-input.span11 { + width: 846px; +} + +input.span10, +textarea.span10, +.uneditable-input.span10 { + width: 766px; +} + +input.span9, +textarea.span9, +.uneditable-input.span9 { + width: 686px; +} + +input.span8, +textarea.span8, +.uneditable-input.span8 { + width: 606px; +} + +input.span7, +textarea.span7, +.uneditable-input.span7 { + width: 526px; +} + +input.span6, +textarea.span6, +.uneditable-input.span6 { + width: 446px; +} + +input.span5, +textarea.span5, +.uneditable-input.span5 { + width: 366px; +} + +input.span4, +textarea.span4, +.uneditable-input.span4 { + width: 286px; +} + +input.span3, +textarea.span3, +.uneditable-input.span3 { + width: 206px; +} + +input.span2, +textarea.span2, +.uneditable-input.span2 { + width: 126px; +} + +input.span1, +textarea.span1, +.uneditable-input.span1 { + width: 46px; +} + +.controls-row { + *zoom: 1; +} + +.controls-row:before, +.controls-row:after { + display: table; + line-height: 0; + content: ""; +} + +.controls-row:after { + clear: both; +} + +.controls-row [class*="span"] { + float: left; +} + +input[disabled], +select[disabled], +textarea[disabled], +input[readonly], +select[readonly], +textarea[readonly] { + cursor: not-allowed; + background-color: #eeeeee; +} + +input[type="radio"][disabled], +input[type="checkbox"][disabled], +input[type="radio"][readonly], +input[type="checkbox"][readonly] { + background-color: transparent; +} + +.control-group.warning > label, +.control-group.warning .help-block, +.control-group.warning .help-inline { + color: #c09853; +} + +.control-group.warning .checkbox, +.control-group.warning .radio, +.control-group.warning input, +.control-group.warning select, +.control-group.warning textarea { + color: #c09853; +} + +.control-group.warning input, +.control-group.warning select, +.control-group.warning textarea { + border-color: #c09853; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +} + +.control-group.warning input:focus, +.control-group.warning select:focus, +.control-group.warning textarea:focus { + border-color: #a47e3c; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e; + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e; +} + +.control-group.warning .input-prepend .add-on, +.control-group.warning .input-append .add-on { + color: #c09853; + background-color: #fcf8e3; + border-color: #c09853; +} + +.control-group.error > label, +.control-group.error .help-block, +.control-group.error .help-inline { + color: #b94a48; +} + +.control-group.error .checkbox, +.control-group.error .radio, +.control-group.error input, +.control-group.error select, +.control-group.error textarea { + color: #b94a48; +} + +.control-group.error input, +.control-group.error select, +.control-group.error textarea { + border-color: #b94a48; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +} + +.control-group.error input:focus, +.control-group.error select:focus, +.control-group.error textarea:focus { + border-color: #953b39; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392; + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392; +} + +.control-group.error .input-prepend .add-on, +.control-group.error .input-append .add-on { + color: #b94a48; + background-color: #f2dede; + border-color: #b94a48; +} + +.control-group.success > label, +.control-group.success .help-block, +.control-group.success .help-inline { + color: #468847; +} + +.control-group.success .checkbox, +.control-group.success .radio, +.control-group.success input, +.control-group.success select, +.control-group.success textarea { + color: #468847; +} + +.control-group.success input, +.control-group.success select, +.control-group.success textarea { + border-color: #468847; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +} + +.control-group.success input:focus, +.control-group.success select:focus, +.control-group.success textarea:focus { + border-color: #356635; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b; + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b; +} + +.control-group.success .input-prepend .add-on, +.control-group.success .input-append .add-on { + color: #468847; + background-color: #dff0d8; + border-color: #468847; +} + +.control-group.info > label, +.control-group.info .help-block, +.control-group.info .help-inline { + color: #3a87ad; +} + +.control-group.info .checkbox, +.control-group.info .radio, +.control-group.info input, +.control-group.info select, +.control-group.info textarea { + color: #3a87ad; +} + +.control-group.info input, +.control-group.info select, +.control-group.info textarea { + border-color: #3a87ad; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +} + +.control-group.info input:focus, +.control-group.info select:focus, +.control-group.info textarea:focus { + border-color: #2d6987; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3; + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3; +} + +.control-group.info .input-prepend .add-on, +.control-group.info .input-append .add-on { + color: #3a87ad; + background-color: #d9edf7; + border-color: #3a87ad; +} + +input:focus:required:invalid, +textarea:focus:required:invalid, +select:focus:required:invalid { + color: #b94a48; + border-color: #ee5f5b; +} + +input:focus:required:invalid:focus, +textarea:focus:required:invalid:focus, +select:focus:required:invalid:focus { + border-color: #e9322d; + -webkit-box-shadow: 0 0 6px #f8b9b7; + -moz-box-shadow: 0 0 6px #f8b9b7; + box-shadow: 0 0 6px #f8b9b7; +} + +.form-actions { + padding: 19px 20px 20px; + margin-top: 20px; + margin-bottom: 20px; + background-color: #f5f5f5; + border-top: 1px solid #e5e5e5; + *zoom: 1; +} + +.form-actions:before, +.form-actions:after { + display: table; + line-height: 0; + content: ""; +} + +.form-actions:after { + clear: both; +} + +.help-block, +.help-inline { + color: #595959; +} + +.help-block { + display: block; + margin-bottom: 10px; +} + +.help-inline { + display: inline-block; + *display: inline; + padding-left: 5px; + vertical-align: middle; + *zoom: 1; +} + +.input-append, +.input-prepend { + margin-bottom: 5px; + font-size: 0; + white-space: nowrap; +} + +.input-append input, +.input-prepend input, +.input-append select, +.input-prepend select, +.input-append .uneditable-input, +.input-prepend .uneditable-input { + position: relative; + margin-bottom: 0; + *margin-left: 0; + font-size: 14px; + vertical-align: top; + -webkit-border-radius: 0 3px 3px 0; + -moz-border-radius: 0 3px 3px 0; + border-radius: 0 3px 3px 0; +} + +.input-append input:focus, +.input-prepend input:focus, +.input-append select:focus, +.input-prepend select:focus, +.input-append .uneditable-input:focus, +.input-prepend .uneditable-input:focus { + z-index: 2; +} + +.input-append .add-on, +.input-prepend .add-on { + display: inline-block; + width: auto; + height: 20px; + min-width: 16px; + padding: 4px 5px; + font-size: 14px; + font-weight: normal; + line-height: 20px; + text-align: center; + text-shadow: 0 1px 0 #ffffff; + background-color: #eeeeee; + border: 1px solid #ccc; +} + +.input-append .add-on, +.input-prepend .add-on, +.input-append .btn, +.input-prepend .btn { + vertical-align: top; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} + +.input-append .active, +.input-prepend .active { + background-color: #a9dba9; + border-color: #46a546; +} + +.input-prepend .add-on, +.input-prepend .btn { + margin-right: -1px; +} + +.input-prepend .add-on:first-child, +.input-prepend .btn:first-child { + -webkit-border-radius: 3px 0 0 3px; + -moz-border-radius: 3px 0 0 3px; + border-radius: 3px 0 0 3px; +} + +.input-append input, +.input-append select, +.input-append .uneditable-input { + -webkit-border-radius: 3px 0 0 3px; + -moz-border-radius: 3px 0 0 3px; + border-radius: 3px 0 0 3px; +} + +.input-append .add-on, +.input-append .btn { + margin-left: -1px; +} + +.input-append .add-on:last-child, +.input-append .btn:last-child { + -webkit-border-radius: 0 3px 3px 0; + -moz-border-radius: 0 3px 3px 0; + border-radius: 0 3px 3px 0; +} + +.input-prepend.input-append input, +.input-prepend.input-append select, +.input-prepend.input-append .uneditable-input { + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} + +.input-prepend.input-append .add-on:first-child, +.input-prepend.input-append .btn:first-child { + margin-right: -1px; + -webkit-border-radius: 3px 0 0 3px; + -moz-border-radius: 3px 0 0 3px; + border-radius: 3px 0 0 3px; +} + +.input-prepend.input-append .add-on:last-child, +.input-prepend.input-append .btn:last-child { + margin-left: -1px; + -webkit-border-radius: 0 3px 3px 0; + -moz-border-radius: 0 3px 3px 0; + border-radius: 0 3px 3px 0; +} + +input.search-query { + padding-right: 14px; + padding-right: 4px \9; + padding-left: 14px; + padding-left: 4px \9; + /* IE7-8 doesn't have border-radius, so don't indent the padding */ + + margin-bottom: 0; + -webkit-border-radius: 15px; + -moz-border-radius: 15px; + border-radius: 15px; +} + +/* Allow for input prepend/append in search forms */ + +.form-search .input-append .search-query, +.form-search .input-prepend .search-query { + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} + +.form-search .input-append .search-query { + -webkit-border-radius: 14px 0 0 14px; + -moz-border-radius: 14px 0 0 14px; + border-radius: 14px 0 0 14px; +} + +.form-search .input-append .btn { + -webkit-border-radius: 0 14px 14px 0; + -moz-border-radius: 0 14px 14px 0; + border-radius: 0 14px 14px 0; +} + +.form-search .input-prepend .search-query { + -webkit-border-radius: 0 14px 14px 0; + -moz-border-radius: 0 14px 14px 0; + border-radius: 0 14px 14px 0; +} + +.form-search .input-prepend .btn { + -webkit-border-radius: 14px 0 0 14px; + -moz-border-radius: 14px 0 0 14px; + border-radius: 14px 0 0 14px; +} + +.form-search input, +.form-inline input, +.form-horizontal input, +.form-search textarea, +.form-inline textarea, +.form-horizontal textarea, +.form-search select, +.form-inline select, +.form-horizontal select, +.form-search .help-inline, +.form-inline .help-inline, +.form-horizontal .help-inline, +.form-search .uneditable-input, +.form-inline .uneditable-input, +.form-horizontal .uneditable-input, +.form-search .input-prepend, +.form-inline .input-prepend, +.form-horizontal .input-prepend, +.form-search .input-append, +.form-inline .input-append, +.form-horizontal .input-append { + display: inline-block; + *display: inline; + margin-bottom: 0; + vertical-align: middle; + *zoom: 1; +} + +.form-search .hide, +.form-inline .hide, +.form-horizontal .hide { + display: none; +} + +.form-search label, +.form-inline label, +.form-search .btn-group, +.form-inline .btn-group { + display: inline-block; +} + +.form-search .input-append, +.form-inline .input-append, +.form-search .input-prepend, +.form-inline .input-prepend { + margin-bottom: 0; +} + +.form-search .radio, +.form-search .checkbox, +.form-inline .radio, +.form-inline .checkbox { + padding-left: 0; + margin-bottom: 0; + vertical-align: middle; +} + +.form-search .radio input[type="radio"], +.form-search .checkbox input[type="checkbox"], +.form-inline .radio input[type="radio"], +.form-inline .checkbox input[type="checkbox"] { + float: left; + margin-right: 3px; + margin-left: 0; +} + +.control-group { + margin-bottom: 10px; +} + +legend + .control-group { + margin-top: 20px; + -webkit-margin-top-collapse: separate; +} + +.form-horizontal .control-group { + margin-bottom: 20px; + *zoom: 1; +} + +.form-horizontal .control-group:before, +.form-horizontal .control-group:after { + display: table; + line-height: 0; + content: ""; +} + +.form-horizontal .control-group:after { + clear: both; +} + +.form-horizontal .control-label { + float: left; + width: 160px; + padding-top: 5px; + text-align: right; +} + +.form-horizontal .controls { + *display: inline-block; + *padding-left: 20px; + margin-left: 180px; + *margin-left: 0; +} + +.form-horizontal .controls:first-child { + *padding-left: 180px; +} + +.form-horizontal .help-block { + margin-bottom: 0; +} + +.form-horizontal input + .help-block, +.form-horizontal select + .help-block, +.form-horizontal textarea + .help-block { + margin-top: 10px; +} + +.form-horizontal .form-actions { + padding-left: 180px; +} + +table { + max-width: 100%; + background-color: transparent; + border-collapse: collapse; + border-spacing: 0; +} + +.table { + width: 100%; + margin-bottom: 20px; +} + +.table th, +.table td { + padding: 8px; + line-height: 20px; + text-align: left; + vertical-align: top; + border-top: 1px solid #dddddd; +} + +.table th { + font-weight: bold; +} + +.table thead th { + vertical-align: bottom; +} + +.table caption + thead tr:first-child th, +.table caption + thead tr:first-child td, +.table colgroup + thead tr:first-child th, +.table colgroup + thead tr:first-child td, +.table thead:first-child tr:first-child th, +.table thead:first-child tr:first-child td { + border-top: 0; +} + +.table tbody + tbody { + border-top: 2px solid #dddddd; +} + +.table-condensed th, +.table-condensed td { + padding: 4px 5px; +} + +.table-bordered { + border: 1px solid #dddddd; + border-collapse: separate; + *border-collapse: collapse; + border-left: 0; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +.table-bordered th, +.table-bordered td { + border-left: 1px solid #dddddd; +} + +.table-bordered caption + thead tr:first-child th, +.table-bordered caption + tbody tr:first-child th, +.table-bordered caption + tbody tr:first-child td, +.table-bordered colgroup + thead tr:first-child th, +.table-bordered colgroup + tbody tr:first-child th, +.table-bordered colgroup + tbody tr:first-child td, +.table-bordered thead:first-child tr:first-child th, +.table-bordered tbody:first-child tr:first-child th, +.table-bordered tbody:first-child tr:first-child td { + border-top: 0; +} + +.table-bordered thead:first-child tr:first-child th:first-child, +.table-bordered tbody:first-child tr:first-child td:first-child { + -webkit-border-top-left-radius: 4px; + border-top-left-radius: 4px; + -moz-border-radius-topleft: 4px; +} + +.table-bordered thead:first-child tr:first-child th:last-child, +.table-bordered tbody:first-child tr:first-child td:last-child { + -webkit-border-top-right-radius: 4px; + border-top-right-radius: 4px; + -moz-border-radius-topright: 4px; +} + +.table-bordered thead:last-child tr:last-child th:first-child, +.table-bordered tbody:last-child tr:last-child td:first-child, +.table-bordered tfoot:last-child tr:last-child td:first-child { + -webkit-border-radius: 0 0 0 4px; + -moz-border-radius: 0 0 0 4px; + border-radius: 0 0 0 4px; + -webkit-border-bottom-left-radius: 4px; + border-bottom-left-radius: 4px; + -moz-border-radius-bottomleft: 4px; +} + +.table-bordered thead:last-child tr:last-child th:last-child, +.table-bordered tbody:last-child tr:last-child td:last-child, +.table-bordered tfoot:last-child tr:last-child td:last-child { + -webkit-border-bottom-right-radius: 4px; + border-bottom-right-radius: 4px; + -moz-border-radius-bottomright: 4px; +} + +.table-bordered caption + thead tr:first-child th:first-child, +.table-bordered caption + tbody tr:first-child td:first-child, +.table-bordered colgroup + thead tr:first-child th:first-child, +.table-bordered colgroup + tbody tr:first-child td:first-child { + -webkit-border-top-left-radius: 4px; + border-top-left-radius: 4px; + -moz-border-radius-topleft: 4px; +} + +.table-bordered caption + thead tr:first-child th:last-child, +.table-bordered caption + tbody tr:first-child td:last-child, +.table-bordered colgroup + thead tr:first-child th:last-child, +.table-bordered colgroup + tbody tr:first-child td:last-child { + -webkit-border-top-right-radius: 4px; + border-top-right-radius: 4px; + -moz-border-radius-topleft: 4px; +} + +.table-striped tbody tr:nth-child(odd) td, +.table-striped tbody tr:nth-child(odd) th { + background-color: #f9f9f9; +} + +.table-hover tbody tr:hover td, +.table-hover tbody tr:hover th { + background-color: #f5f5f5; +} + +table [class*=span], +.row-fluid table [class*=span] { + display: table-cell; + float: none; + margin-left: 0; +} + +.table .span1 { + float: none; + width: 44px; + margin-left: 0; +} + +.table .span2 { + float: none; + width: 124px; + margin-left: 0; +} + +.table .span3 { + float: none; + width: 204px; + margin-left: 0; +} + +.table .span4 { + float: none; + width: 284px; + margin-left: 0; +} + +.table .span5 { + float: none; + width: 364px; + margin-left: 0; +} + +.table .span6 { + float: none; + width: 444px; + margin-left: 0; +} + +.table .span7 { + float: none; + width: 524px; + margin-left: 0; +} + +.table .span8 { + float: none; + width: 604px; + margin-left: 0; +} + +.table .span9 { + float: none; + width: 684px; + margin-left: 0; +} + +.table .span10 { + float: none; + width: 764px; + margin-left: 0; +} + +.table .span11 { + float: none; + width: 844px; + margin-left: 0; +} + +.table .span12 { + float: none; + width: 924px; + margin-left: 0; +} + +.table .span13 { + float: none; + width: 1004px; + margin-left: 0; +} + +.table .span14 { + float: none; + width: 1084px; + margin-left: 0; +} + +.table .span15 { + float: none; + width: 1164px; + margin-left: 0; +} + +.table .span16 { + float: none; + width: 1244px; + margin-left: 0; +} + +.table .span17 { + float: none; + width: 1324px; + margin-left: 0; +} + +.table .span18 { + float: none; + width: 1404px; + margin-left: 0; +} + +.table .span19 { + float: none; + width: 1484px; + margin-left: 0; +} + +.table .span20 { + float: none; + width: 1564px; + margin-left: 0; +} + +.table .span21 { + float: none; + width: 1644px; + margin-left: 0; +} + +.table .span22 { + float: none; + width: 1724px; + margin-left: 0; +} + +.table .span23 { + float: none; + width: 1804px; + margin-left: 0; +} + +.table .span24 { + float: none; + width: 1884px; + margin-left: 0; +} + +.table tbody tr.success td { + background-color: #dff0d8; +} + +.table tbody tr.error td { + background-color: #f2dede; +} + +.table tbody tr.warning td { + background-color: #fcf8e3; +} + +.table tbody tr.info td { + background-color: #d9edf7; +} + +.table-hover tbody tr.success:hover td { + background-color: #d0e9c6; +} + +.table-hover tbody tr.error:hover td { + background-color: #ebcccc; +} + +.table-hover tbody tr.warning:hover td { + background-color: #faf2cc; +} + +.table-hover tbody tr.info:hover td { + background-color: #c4e3f3; +} + +[class^="icon-"], +[class*=" icon-"] { + display: inline-block; + width: 14px; + height: 14px; + margin-top: 1px; + *margin-right: .3em; + line-height: 14px; + vertical-align: text-top; + background-image: url("../img/glyphicons-halflings.png"); + background-position: 14px 14px; + background-repeat: no-repeat; +} + +/* White icons with optional class, or on hover/active states of certain elements */ + +.icon-white, +.nav-tabs > .active > a > [class^="icon-"], +.nav-tabs > .active > a > [class*=" icon-"], +.nav-pills > .active > a > [class^="icon-"], +.nav-pills > .active > a > [class*=" icon-"], +.nav-list > .active > a > [class^="icon-"], +.nav-list > .active > a > [class*=" icon-"], +.navbar-inverse .nav > .active > a > [class^="icon-"], +.navbar-inverse .nav > .active > a > [class*=" icon-"], +.dropdown-menu > li > a:hover > [class^="icon-"], +.dropdown-menu > li > a:hover > [class*=" icon-"], +.dropdown-menu > .active > a > [class^="icon-"], +.dropdown-menu > .active > a > [class*=" icon-"] { + background-image: url("../img/glyphicons-halflings-white.png"); +} + +.icon-glass { + background-position: 0 0; +} + +.icon-music { + background-position: -24px 0; +} + +.icon-search { + background-position: -48px 0; +} + +.icon-envelope { + background-position: -72px 0; +} + +.icon-heart { + background-position: -96px 0; +} + +.icon-star { + background-position: -120px 0; +} + +.icon-star-empty { + background-position: -144px 0; +} + +.icon-user { + background-position: -168px 0; +} + +.icon-film { + background-position: -192px 0; +} + +.icon-th-large { + background-position: -216px 0; +} + +.icon-th { + background-position: -240px 0; +} + +.icon-th-list { + background-position: -264px 0; +} + +.icon-ok { + background-position: -288px 0; +} + +.icon-remove { + background-position: -312px 0; +} + +.icon-zoom-in { + background-position: -336px 0; +} + +.icon-zoom-out { + background-position: -360px 0; +} + +.icon-off { + background-position: -384px 0; +} + +.icon-signal { + background-position: -408px 0; +} + +.icon-cog { + background-position: -432px 0; +} + +.icon-trash { + background-position: -456px 0; +} + +.icon-home { + background-position: 0 -24px; +} + +.icon-file { + background-position: -24px -24px; +} + +.icon-time { + background-position: -48px -24px; +} + +.icon-road { + background-position: -72px -24px; +} + +.icon-download-alt { + background-position: -96px -24px; +} + +.icon-download { + background-position: -120px -24px; +} + +.icon-upload { + background-position: -144px -24px; +} + +.icon-inbox { + background-position: -168px -24px; +} + +.icon-play-circle { + background-position: -192px -24px; +} + +.icon-repeat { + background-position: -216px -24px; +} + +.icon-refresh { + background-position: -240px -24px; +} + +.icon-list-alt { + background-position: -264px -24px; +} + +.icon-lock { + background-position: -287px -24px; +} + +.icon-flag { + background-position: -312px -24px; +} + +.icon-headphones { + background-position: -336px -24px; +} + +.icon-volume-off { + background-position: -360px -24px; +} + +.icon-volume-down { + background-position: -384px -24px; +} + +.icon-volume-up { + background-position: -408px -24px; +} + +.icon-qrcode { + background-position: -432px -24px; +} + +.icon-barcode { + background-position: -456px -24px; +} + +.icon-tag { + background-position: 0 -48px; +} + +.icon-tags { + background-position: -25px -48px; +} + +.icon-book { + background-position: -48px -48px; +} + +.icon-bookmark { + background-position: -72px -48px; +} + +.icon-print { + background-position: -96px -48px; +} + +.icon-camera { + background-position: -120px -48px; +} + +.icon-font { + background-position: -144px -48px; +} + +.icon-bold { + background-position: -167px -48px; +} + +.icon-italic { + background-position: -192px -48px; +} + +.icon-text-height { + background-position: -216px -48px; +} + +.icon-text-width { + background-position: -240px -48px; +} + +.icon-align-left { + background-position: -264px -48px; +} + +.icon-align-center { + background-position: -288px -48px; +} + +.icon-align-right { + background-position: -312px -48px; +} + +.icon-align-justify { + background-position: -336px -48px; +} + +.icon-list { + background-position: -360px -48px; +} + +.icon-indent-left { + background-position: -384px -48px; +} + +.icon-indent-right { + background-position: -408px -48px; +} + +.icon-facetime-video { + background-position: -432px -48px; +} + +.icon-picture { + background-position: -456px -48px; +} + +.icon-pencil { + background-position: 0 -72px; +} + +.icon-map-marker { + background-position: -24px -72px; +} + +.icon-adjust { + background-position: -48px -72px; +} + +.icon-tint { + background-position: -72px -72px; +} + +.icon-edit { + background-position: -96px -72px; +} + +.icon-share { + background-position: -120px -72px; +} + +.icon-check { + background-position: -144px -72px; +} + +.icon-move { + background-position: -168px -72px; +} + +.icon-step-backward { + background-position: -192px -72px; +} + +.icon-fast-backward { + background-position: -216px -72px; +} + +.icon-backward { + background-position: -240px -72px; +} + +.icon-play { + background-position: -264px -72px; +} + +.icon-pause { + background-position: -288px -72px; +} + +.icon-stop { + background-position: -312px -72px; +} + +.icon-forward { + background-position: -336px -72px; +} + +.icon-fast-forward { + background-position: -360px -72px; +} + +.icon-step-forward { + background-position: -384px -72px; +} + +.icon-eject { + background-position: -408px -72px; +} + +.icon-chevron-left { + background-position: -432px -72px; +} + +.icon-chevron-right { + background-position: -456px -72px; +} + +.icon-plus-sign { + background-position: 0 -96px; +} + +.icon-minus-sign { + background-position: -24px -96px; +} + +.icon-remove-sign { + background-position: -48px -96px; +} + +.icon-ok-sign { + background-position: -72px -96px; +} + +.icon-question-sign { + background-position: -96px -96px; +} + +.icon-info-sign { + background-position: -120px -96px; +} + +.icon-screenshot { + background-position: -144px -96px; +} + +.icon-remove-circle { + background-position: -168px -96px; +} + +.icon-ok-circle { + background-position: -192px -96px; +} + +.icon-ban-circle { + background-position: -216px -96px; +} + +.icon-arrow-left { + background-position: -240px -96px; +} + +.icon-arrow-right { + background-position: -264px -96px; +} + +.icon-arrow-up { + background-position: -289px -96px; +} + +.icon-arrow-down { + background-position: -312px -96px; +} + +.icon-share-alt { + background-position: -336px -96px; +} + +.icon-resize-full { + background-position: -360px -96px; +} + +.icon-resize-small { + background-position: -384px -96px; +} + +.icon-plus { + background-position: -408px -96px; +} + +.icon-minus { + background-position: -433px -96px; +} + +.icon-asterisk { + background-position: -456px -96px; +} + +.icon-exclamation-sign { + background-position: 0 -120px; +} + +.icon-gift { + background-position: -24px -120px; +} + +.icon-leaf { + background-position: -48px -120px; +} + +.icon-fire { + background-position: -72px -120px; +} + +.icon-eye-open { + background-position: -96px -120px; +} + +.icon-eye-close { + background-position: -120px -120px; +} + +.icon-warning-sign { + background-position: -144px -120px; +} + +.icon-plane { + background-position: -168px -120px; +} + +.icon-calendar { + background-position: -192px -120px; +} + +.icon-random { + width: 16px; + background-position: -216px -120px; +} + +.icon-comment { + background-position: -240px -120px; +} + +.icon-magnet { + background-position: -264px -120px; +} + +.icon-chevron-up { + background-position: -288px -120px; +} + +.icon-chevron-down { + background-position: -313px -119px; +} + +.icon-retweet { + background-position: -336px -120px; +} + +.icon-shopping-cart { + background-position: -360px -120px; +} + +.icon-folder-close { + background-position: -384px -120px; +} + +.icon-folder-open { + width: 16px; + background-position: -408px -120px; +} + +.icon-resize-vertical { + background-position: -432px -119px; +} + +.icon-resize-horizontal { + background-position: -456px -118px; +} + +.icon-hdd { + background-position: 0 -144px; +} + +.icon-bullhorn { + background-position: -24px -144px; +} + +.icon-bell { + background-position: -48px -144px; +} + +.icon-certificate { + background-position: -72px -144px; +} + +.icon-thumbs-up { + background-position: -96px -144px; +} + +.icon-thumbs-down { + background-position: -120px -144px; +} + +.icon-hand-right { + background-position: -144px -144px; +} + +.icon-hand-left { + background-position: -168px -144px; +} + +.icon-hand-up { + background-position: -192px -144px; +} + +.icon-hand-down { + background-position: -216px -144px; +} + +.icon-circle-arrow-right { + background-position: -240px -144px; +} + +.icon-circle-arrow-left { + background-position: -264px -144px; +} + +.icon-circle-arrow-up { + background-position: -288px -144px; +} + +.icon-circle-arrow-down { + background-position: -312px -144px; +} + +.icon-globe { + background-position: -336px -144px; +} + +.icon-wrench { + background-position: -360px -144px; +} + +.icon-tasks { + background-position: -384px -144px; +} + +.icon-filter { + background-position: -408px -144px; +} + +.icon-briefcase { + background-position: -432px -144px; +} + +.icon-fullscreen { + background-position: -456px -144px; +} + +.dropup, +.dropdown { + position: relative; +} + +.dropdown-toggle { + *margin-bottom: -3px; +} + +.dropdown-toggle:active, +.open .dropdown-toggle { + outline: 0; +} + +.caret { + display: inline-block; + width: 0; + height: 0; + vertical-align: top; + border-top: 4px solid #000000; + border-right: 4px solid transparent; + border-left: 4px solid transparent; + content: ""; +} + +.dropdown .caret { + margin-top: 8px; + margin-left: 2px; +} + +.dropdown-menu { + position: absolute; + top: 100%; + left: 0; + z-index: 1000; + display: none; + float: left; + min-width: 160px; + padding: 5px 0; + margin: 2px 0 0; + list-style: none; + background-color: #ffffff; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, 0.2); + *border-right-width: 2px; + *border-bottom-width: 2px; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; + -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); + box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; +} + +.dropdown-menu.pull-right { + right: 0; + left: auto; +} + +.dropdown-menu .divider { + *width: 100%; + height: 1px; + margin: 9px 1px; + *margin: -5px 0 5px; + overflow: hidden; + background-color: #e5e5e5; + border-bottom: 1px solid #ffffff; +} + +.dropdown-menu a { + display: block; + padding: 3px 20px; + clear: both; + font-weight: normal; + line-height: 20px; + color: #333333; + white-space: nowrap; +} + +.dropdown-menu li > a:hover, +.dropdown-menu li > a:focus, +.dropdown-submenu:hover > a { + color: #ffffff; + text-decoration: none; + background-color: #0088cc; + background-color: #0081c2; + background-image: -moz-linear-gradient(top, #0088cc, #0077b3); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3)); + background-image: -webkit-linear-gradient(top, #0088cc, #0077b3); + background-image: -o-linear-gradient(top, #0088cc, #0077b3); + background-image: linear-gradient(to bottom, #0088cc, #0077b3); + background-repeat: repeat-x; + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0); +} + +.dropdown-menu .active > a, +.dropdown-menu .active > a:hover { + color: #ffffff; + text-decoration: none; + background-color: #0088cc; + background-color: #0081c2; + background-image: linear-gradient(to bottom, #0088cc, #0077b3); + background-image: -moz-linear-gradient(top, #0088cc, #0077b3); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3)); + background-image: -webkit-linear-gradient(top, #0088cc, #0077b3); + background-image: -o-linear-gradient(top, #0088cc, #0077b3); + background-repeat: repeat-x; + outline: 0; + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0); +} + +.dropdown-menu .disabled > a, +.dropdown-menu .disabled > a:hover { + color: #999999; +} + +.dropdown-menu .disabled > a:hover { + text-decoration: none; + cursor: default; + background-color: transparent; +} + +.open { + *z-index: 1000; +} + +.open > .dropdown-menu { + display: block; +} + +.pull-right > .dropdown-menu { + right: 0; + left: auto; +} + +.dropup .caret, +.navbar-fixed-bottom .dropdown .caret { + border-top: 0; + border-bottom: 4px solid #000000; + content: ""; +} + +.dropup .dropdown-menu, +.navbar-fixed-bottom .dropdown .dropdown-menu { + top: auto; + bottom: 100%; + margin-bottom: 1px; +} + +.dropdown-submenu { + position: relative; +} + +.dropdown-submenu > .dropdown-menu { + top: 0; + left: 100%; + margin-top: -6px; + margin-left: -1px; + -webkit-border-radius: 0 6px 6px 6px; + -moz-border-radius: 0 6px 6px 6px; + border-radius: 0 6px 6px 6px; +} + +.dropdown-submenu:hover > .dropdown-menu { + display: block; +} + +.dropdown-submenu > a:after { + display: block; + float: right; + width: 0; + height: 0; + margin-top: 5px; + margin-right: -10px; + border-color: transparent; + border-left-color: #cccccc; + border-style: solid; + border-width: 5px 0 5px 5px; + content: " "; +} + +.dropdown-submenu:hover > a:after { + border-left-color: #ffffff; +} + +.dropdown .dropdown-menu .nav-header { + padding-right: 20px; + padding-left: 20px; +} + +.typeahead { + margin-top: 2px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +.well { + min-height: 20px; + padding: 19px; + margin-bottom: 20px; + background-color: #f5f5f5; + border: 1px solid #e3e3e3; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); +} + +.well blockquote { + border-color: #ddd; + border-color: rgba(0, 0, 0, 0.15); +} + +.well-large { + padding: 24px; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; +} + +.well-small { + padding: 9px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} + +.fade { + opacity: 0; + -webkit-transition: opacity 0.15s linear; + -moz-transition: opacity 0.15s linear; + -o-transition: opacity 0.15s linear; + transition: opacity 0.15s linear; +} + +.fade.in { + opacity: 1; +} + +.collapse { + position: relative; + height: 0; + overflow: hidden; + -webkit-transition: height 0.35s ease; + -moz-transition: height 0.35s ease; + -o-transition: height 0.35s ease; + transition: height 0.35s ease; +} + +.collapse.in { + height: auto; +} + +.close { + float: right; + font-size: 20px; + font-weight: bold; + line-height: 20px; + color: #000000; + text-shadow: 0 1px 0 #ffffff; + opacity: 0.2; + filter: alpha(opacity=20); +} + +.close:hover { + color: #000000; + text-decoration: none; + cursor: pointer; + opacity: 0.4; + filter: alpha(opacity=40); +} + +button.close { + padding: 0; + cursor: pointer; + background: transparent; + border: 0; + -webkit-appearance: none; +} + +.btn { + display: inline-block; + *display: inline; + padding: 4px 14px; + margin-bottom: 0; + *margin-left: .3em; + font-size: 14px; + line-height: 20px; + *line-height: 20px; + color: #333333; + text-align: center; + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); + vertical-align: middle; + cursor: pointer; + background-color: #f5f5f5; + *background-color: #e6e6e6; + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); + background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); + background-image: linear-gradient(to bottom, #ffffff, #e6e6e6); + background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); + background-repeat: repeat-x; + border: 1px solid #bbbbbb; + *border: 0; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + border-color: #e6e6e6 #e6e6e6 #bfbfbf; + border-bottom-color: #a2a2a2; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0); + filter: progid:dximagetransform.microsoft.gradient(enabled=false); + *zoom: 1; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); +} + +.btn:hover, +.btn:active, +.btn.active, +.btn.disabled, +.btn[disabled] { + color: #333333; + background-color: #e6e6e6; + *background-color: #d9d9d9; +} + +.btn:active, +.btn.active { + background-color: #cccccc \9; +} + +.btn:first-child { + *margin-left: 0; +} + +.btn:hover { + color: #333333; + text-decoration: none; + background-color: #e6e6e6; + *background-color: #d9d9d9; + /* Buttons in IE7 don't get borders, so darken on hover */ + + background-position: 0 -15px; + -webkit-transition: background-position 0.1s linear; + -moz-transition: background-position 0.1s linear; + -o-transition: background-position 0.1s linear; + transition: background-position 0.1s linear; +} + +.btn:focus { + outline: thin dotted #333; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} + +.btn.active, +.btn:active { + background-color: #e6e6e6; + background-color: #d9d9d9 \9; + background-image: none; + outline: 0; + -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); +} + +.btn.disabled, +.btn[disabled] { + cursor: default; + background-color: #e6e6e6; + background-image: none; + opacity: 0.65; + filter: alpha(opacity=65); + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} + +.btn-large { + padding: 9px 14px; + font-size: 16px; + line-height: normal; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} + +.btn-large [class^="icon-"] { + margin-top: 2px; +} + +.btn-small { + padding: 3px 9px; + font-size: 12px; + line-height: 18px; +} + +.btn-small [class^="icon-"] { + margin-top: 0; +} + +.btn-mini { + padding: 2px 6px; + font-size: 11px; + line-height: 17px; +} + +.btn-block { + display: block; + width: 100%; + padding-right: 0; + padding-left: 0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.btn-block + .btn-block { + margin-top: 5px; +} + +input[type="submit"].btn-block, +input[type="reset"].btn-block, +input[type="button"].btn-block { + width: 100%; +} + +.btn-primary.active, +.btn-warning.active, +.btn-danger.active, +.btn-success.active, +.btn-info.active, +.btn-inverse.active { + color: rgba(255, 255, 255, 0.75); +} + +.btn { + border-color: #c5c5c5; + border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); +} + +.btn-primary { + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #006dcc; + *background-color: #0044cc; + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); + background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); + background-image: -o-linear-gradient(top, #0088cc, #0044cc); + background-image: linear-gradient(to bottom, #0088cc, #0044cc); + background-image: -moz-linear-gradient(top, #0088cc, #0044cc); + background-repeat: repeat-x; + border-color: #0044cc #0044cc #002a80; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0); + filter: progid:dximagetransform.microsoft.gradient(enabled=false); +} + +.btn-primary:hover, +.btn-primary:active, +.btn-primary.active, +.btn-primary.disabled, +.btn-primary[disabled] { + color: #ffffff; + background-color: #0044cc; + *background-color: #003bb3; +} + +.btn-primary:active, +.btn-primary.active { + background-color: #003399 \9; +} + +.btn-warning { + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #faa732; + *background-color: #f89406; + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406)); + background-image: -webkit-linear-gradient(top, #fbb450, #f89406); + background-image: -o-linear-gradient(top, #fbb450, #f89406); + background-image: linear-gradient(to bottom, #fbb450, #f89406); + background-image: -moz-linear-gradient(top, #fbb450, #f89406); + background-repeat: repeat-x; + border-color: #f89406 #f89406 #ad6704; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0); + filter: progid:dximagetransform.microsoft.gradient(enabled=false); +} + +.btn-warning:hover, +.btn-warning:active, +.btn-warning.active, +.btn-warning.disabled, +.btn-warning[disabled] { + color: #ffffff; + background-color: #f89406; + *background-color: #df8505; +} + +.btn-warning:active, +.btn-warning.active { + background-color: #c67605 \9; +} + +.btn-danger { + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #da4f49; + *background-color: #bd362f; + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f)); + background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f); + background-image: -o-linear-gradient(top, #ee5f5b, #bd362f); + background-image: linear-gradient(to bottom, #ee5f5b, #bd362f); + background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f); + background-repeat: repeat-x; + border-color: #bd362f #bd362f #802420; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffbd362f', GradientType=0); + filter: progid:dximagetransform.microsoft.gradient(enabled=false); +} + +.btn-danger:hover, +.btn-danger:active, +.btn-danger.active, +.btn-danger.disabled, +.btn-danger[disabled] { + color: #ffffff; + background-color: #bd362f; + *background-color: #a9302a; +} + +.btn-danger:active, +.btn-danger.active { + background-color: #942a25 \9; +} + +.btn-success { + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #5bb75b; + *background-color: #51a351; + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351)); + background-image: -webkit-linear-gradient(top, #62c462, #51a351); + background-image: -o-linear-gradient(top, #62c462, #51a351); + background-image: linear-gradient(to bottom, #62c462, #51a351); + background-image: -moz-linear-gradient(top, #62c462, #51a351); + background-repeat: repeat-x; + border-color: #51a351 #51a351 #387038; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff51a351', GradientType=0); + filter: progid:dximagetransform.microsoft.gradient(enabled=false); +} + +.btn-success:hover, +.btn-success:active, +.btn-success.active, +.btn-success.disabled, +.btn-success[disabled] { + color: #ffffff; + background-color: #51a351; + *background-color: #499249; +} + +.btn-success:active, +.btn-success.active { + background-color: #408140 \9; +} + +.btn-info { + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #49afcd; + *background-color: #2f96b4; + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#2f96b4)); + background-image: -webkit-linear-gradient(top, #5bc0de, #2f96b4); + background-image: -o-linear-gradient(top, #5bc0de, #2f96b4); + background-image: linear-gradient(to bottom, #5bc0de, #2f96b4); + background-image: -moz-linear-gradient(top, #5bc0de, #2f96b4); + background-repeat: repeat-x; + border-color: #2f96b4 #2f96b4 #1f6377; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2f96b4', GradientType=0); + filter: progid:dximagetransform.microsoft.gradient(enabled=false); +} + +.btn-info:hover, +.btn-info:active, +.btn-info.active, +.btn-info.disabled, +.btn-info[disabled] { + color: #ffffff; + background-color: #2f96b4; + *background-color: #2a85a0; +} + +.btn-info:active, +.btn-info.active { + background-color: #24748c \9; +} + +.btn-inverse { + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #363636; + *background-color: #222222; + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#444444), to(#222222)); + background-image: -webkit-linear-gradient(top, #444444, #222222); + background-image: -o-linear-gradient(top, #444444, #222222); + background-image: linear-gradient(to bottom, #444444, #222222); + background-image: -moz-linear-gradient(top, #444444, #222222); + background-repeat: repeat-x; + border-color: #222222 #222222 #000000; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ff444444', endColorstr='#ff222222', GradientType=0); + filter: progid:dximagetransform.microsoft.gradient(enabled=false); +} + +.btn-inverse:hover, +.btn-inverse:active, +.btn-inverse.active, +.btn-inverse.disabled, +.btn-inverse[disabled] { + color: #ffffff; + background-color: #222222; + *background-color: #151515; +} + +.btn-inverse:active, +.btn-inverse.active { + background-color: #080808 \9; +} + +button.btn, +input[type="submit"].btn { + *padding-top: 3px; + *padding-bottom: 3px; +} + +button.btn::-moz-focus-inner, +input[type="submit"].btn::-moz-focus-inner { + padding: 0; + border: 0; +} + +button.btn.btn-large, +input[type="submit"].btn.btn-large { + *padding-top: 7px; + *padding-bottom: 7px; +} + +button.btn.btn-small, +input[type="submit"].btn.btn-small { + *padding-top: 3px; + *padding-bottom: 3px; +} + +button.btn.btn-mini, +input[type="submit"].btn.btn-mini { + *padding-top: 1px; + *padding-bottom: 1px; +} + +.btn-link, +.btn-link:active, +.btn-link[disabled] { + background-color: transparent; + background-image: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} + +.btn-link { + color: #0088cc; + cursor: pointer; + border-color: transparent; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} + +.btn-link:hover { + color: #005580; + text-decoration: underline; + background-color: transparent; +} + +.btn-link[disabled]:hover { + color: #333333; + text-decoration: none; +} + +.btn-group { + position: relative; + *margin-left: .3em; + font-size: 0; + white-space: nowrap; + vertical-align: middle; +} + +.btn-group:first-child { + *margin-left: 0; +} + +.btn-group + .btn-group { + margin-left: 5px; +} + +.btn-toolbar { + margin-top: 10px; + margin-bottom: 10px; + font-size: 0; +} + +.btn-toolbar .btn-group { + display: inline-block; + *display: inline; + /* IE7 inline-block hack */ + + *zoom: 1; +} + +.btn-toolbar .btn + .btn, +.btn-toolbar .btn-group + .btn, +.btn-toolbar .btn + .btn-group { + margin-left: 5px; +} + +.btn-group > .btn { + position: relative; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} + +.btn-group > .btn + .btn { + margin-left: -1px; +} + +.btn-group > .btn, +.btn-group > .dropdown-menu { + font-size: 14px; +} + +.btn-group > .btn-mini { + font-size: 11px; +} + +.btn-group > .btn-small { + font-size: 12px; +} + +.btn-group > .btn-large { + font-size: 16px; +} + +.btn-group > .btn:first-child { + margin-left: 0; + -webkit-border-bottom-left-radius: 4px; + border-bottom-left-radius: 4px; + -webkit-border-top-left-radius: 4px; + border-top-left-radius: 4px; + -moz-border-radius-bottomleft: 4px; + -moz-border-radius-topleft: 4px; +} + +.btn-group > .btn:last-child, +.btn-group > .dropdown-toggle { + -webkit-border-top-right-radius: 4px; + border-top-right-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + border-bottom-right-radius: 4px; + -moz-border-radius-topright: 4px; + -moz-border-radius-bottomright: 4px; +} + +.btn-group > .btn.large:first-child { + margin-left: 0; + -webkit-border-bottom-left-radius: 6px; + border-bottom-left-radius: 6px; + -webkit-border-top-left-radius: 6px; + border-top-left-radius: 6px; + -moz-border-radius-bottomleft: 6px; + -moz-border-radius-topleft: 6px; +} + +.btn-group > .btn.large:last-child, +.btn-group > .large.dropdown-toggle { + -webkit-border-top-right-radius: 6px; + border-top-right-radius: 6px; + -webkit-border-bottom-right-radius: 6px; + border-bottom-right-radius: 6px; + -moz-border-radius-topright: 6px; + -moz-border-radius-bottomright: 6px; +} + +.btn-group > .btn:hover, +.btn-group > .btn:focus, +.btn-group > .btn:active, +.btn-group > .btn.active { + z-index: 2; +} + +.btn-group .dropdown-toggle:active, +.btn-group.open .dropdown-toggle { + outline: 0; +} + +.btn-group > .btn + .dropdown-toggle { + *padding-top: 5px; + padding-right: 8px; + *padding-bottom: 5px; + padding-left: 8px; + -webkit-box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.125), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.125), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.125), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); +} + +.btn-group > .btn-mini + .dropdown-toggle { + *padding-top: 2px; + padding-right: 5px; + *padding-bottom: 2px; + padding-left: 5px; +} + +.btn-group > .btn-small + .dropdown-toggle { + *padding-top: 5px; + *padding-bottom: 4px; +} + +.btn-group > .btn-large + .dropdown-toggle { + *padding-top: 7px; + padding-right: 12px; + *padding-bottom: 7px; + padding-left: 12px; +} + +.btn-group.open .dropdown-toggle { + background-image: none; + -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); +} + +.btn-group.open .btn.dropdown-toggle { + background-color: #e6e6e6; +} + +.btn-group.open .btn-primary.dropdown-toggle { + background-color: #0044cc; +} + +.btn-group.open .btn-warning.dropdown-toggle { + background-color: #f89406; +} + +.btn-group.open .btn-danger.dropdown-toggle { + background-color: #bd362f; +} + +.btn-group.open .btn-success.dropdown-toggle { + background-color: #51a351; +} + +.btn-group.open .btn-info.dropdown-toggle { + background-color: #2f96b4; +} + +.btn-group.open .btn-inverse.dropdown-toggle { + background-color: #222222; +} + +.btn .caret { + margin-top: 8px; + margin-left: 0; +} + +.btn-mini .caret, +.btn-small .caret, +.btn-large .caret { + margin-top: 6px; +} + +.btn-large .caret { + border-top-width: 5px; + border-right-width: 5px; + border-left-width: 5px; +} + +.dropup .btn-large .caret { + border-top: 0; + border-bottom: 5px solid #000000; +} + +.btn-primary .caret, +.btn-warning .caret, +.btn-danger .caret, +.btn-info .caret, +.btn-success .caret, +.btn-inverse .caret { + border-top-color: #ffffff; + border-bottom-color: #ffffff; +} + +.btn-group-vertical { + display: inline-block; + *display: inline; + /* IE7 inline-block hack */ + + *zoom: 1; +} + +.btn-group-vertical .btn { + display: block; + float: none; + width: 100%; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} + +.btn-group-vertical .btn + .btn { + margin-top: -1px; + margin-left: 0; +} + +.btn-group-vertical .btn:first-child { + -webkit-border-radius: 4px 4px 0 0; + -moz-border-radius: 4px 4px 0 0; + border-radius: 4px 4px 0 0; +} + +.btn-group-vertical .btn:last-child { + -webkit-border-radius: 0 0 4px 4px; + -moz-border-radius: 0 0 4px 4px; + border-radius: 0 0 4px 4px; +} + +.btn-group-vertical .btn-large:first-child { + -webkit-border-radius: 6px 6px 0 0; + -moz-border-radius: 6px 6px 0 0; + border-radius: 6px 6px 0 0; +} + +.btn-group-vertical .btn-large:last-child { + -webkit-border-radius: 0 0 6px 6px; + -moz-border-radius: 0 0 6px 6px; + border-radius: 0 0 6px 6px; +} + +.alert { + padding: 8px 35px 8px 14px; + margin-bottom: 20px; + color: #c09853; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); + background-color: #fcf8e3; + border: 1px solid #fbeed5; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +.alert h4 { + margin: 0; +} + +.alert .close { + position: relative; + top: -2px; + right: -21px; + line-height: 20px; +} + +.alert-success { + color: #468847; + background-color: #dff0d8; + border-color: #d6e9c6; +} + +.alert-danger, +.alert-error { + color: #b94a48; + background-color: #f2dede; + border-color: #eed3d7; +} + +.alert-info { + color: #3a87ad; + background-color: #d9edf7; + border-color: #bce8f1; +} + +.alert-block { + padding-top: 14px; + padding-bottom: 14px; +} + +.alert-block > p, +.alert-block > ul { + margin-bottom: 0; +} + +.alert-block p + p { + margin-top: 5px; +} + +.nav { + margin-bottom: 20px; + margin-left: 0; + list-style: none; +} + +.nav > li > a { + display: block; +} + +.nav > li > a:hover { + text-decoration: none; + background-color: #eeeeee; +} + +.nav > .pull-right { + float: right; +} + +.nav-header { + display: block; + padding: 3px 15px; + font-size: 11px; + font-weight: bold; + line-height: 20px; + color: #999999; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); + text-transform: uppercase; +} + +.nav li + .nav-header { + margin-top: 9px; +} + +.nav-list { + padding-right: 15px; + padding-left: 15px; + margin-bottom: 0; +} + +.nav-list > li > a, +.nav-list .nav-header { + margin-right: -15px; + margin-left: -15px; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); +} + +.nav-list > li > a { + padding: 3px 15px; +} + +.nav-list > .active > a, +.nav-list > .active > a:hover { + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); + background-color: #0088cc; +} + +.nav-list [class^="icon-"] { + margin-right: 2px; +} + +.nav-list .divider { + *width: 100%; + height: 1px; + margin: 9px 1px; + *margin: -5px 0 5px; + overflow: hidden; + background-color: #e5e5e5; + border-bottom: 1px solid #ffffff; +} + +.nav-tabs, +.nav-pills { + *zoom: 1; +} + +.nav-tabs:before, +.nav-pills:before, +.nav-tabs:after, +.nav-pills:after { + display: table; + line-height: 0; + content: ""; +} + +.nav-tabs:after, +.nav-pills:after { + clear: both; +} + +.nav-tabs > li, +.nav-pills > li { + float: left; +} + +.nav-tabs > li > a, +.nav-pills > li > a { + padding-right: 12px; + padding-left: 12px; + margin-right: 2px; + line-height: 14px; +} + +.nav-tabs { + border-bottom: 1px solid #ddd; +} + +.nav-tabs > li { + margin-bottom: -1px; +} + +.nav-tabs > li > a { + padding-top: 8px; + padding-bottom: 8px; + line-height: 20px; + border: 1px solid transparent; + -webkit-border-radius: 4px 4px 0 0; + -moz-border-radius: 4px 4px 0 0; + border-radius: 4px 4px 0 0; +} + +.nav-tabs > li > a:hover { + border-color: #eeeeee #eeeeee #dddddd; +} + +.nav-tabs > .active > a, +.nav-tabs > .active > a:hover { + color: #555555; + cursor: default; + background-color: #ffffff; + border: 1px solid #ddd; + border-bottom-color: transparent; +} + +.nav-pills > li > a { + padding-top: 8px; + padding-bottom: 8px; + margin-top: 2px; + margin-bottom: 2px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} + +.nav-pills > .active > a, +.nav-pills > .active > a:hover { + color: #ffffff; + background-color: #0088cc; +} + +.nav-stacked > li { + float: none; +} + +.nav-stacked > li > a { + margin-right: 0; +} + +.nav-tabs.nav-stacked { + border-bottom: 0; +} + +.nav-tabs.nav-stacked > li > a { + border: 1px solid #ddd; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} + +.nav-tabs.nav-stacked > li:first-child > a { + -webkit-border-top-right-radius: 4px; + border-top-right-radius: 4px; + -webkit-border-top-left-radius: 4px; + border-top-left-radius: 4px; + -moz-border-radius-topright: 4px; + -moz-border-radius-topleft: 4px; +} + +.nav-tabs.nav-stacked > li:last-child > a { + -webkit-border-bottom-right-radius: 4px; + border-bottom-right-radius: 4px; + -webkit-border-bottom-left-radius: 4px; + border-bottom-left-radius: 4px; + -moz-border-radius-bottomright: 4px; + -moz-border-radius-bottomleft: 4px; +} + +.nav-tabs.nav-stacked > li > a:hover { + z-index: 2; + border-color: #ddd; +} + +.nav-pills.nav-stacked > li > a { + margin-bottom: 3px; +} + +.nav-pills.nav-stacked > li:last-child > a { + margin-bottom: 1px; +} + +.nav-tabs .dropdown-menu { + -webkit-border-radius: 0 0 6px 6px; + -moz-border-radius: 0 0 6px 6px; + border-radius: 0 0 6px 6px; +} + +.nav-pills .dropdown-menu { + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; +} + +.nav .dropdown-toggle .caret { + margin-top: 6px; + border-top-color: #0088cc; + border-bottom-color: #0088cc; +} + +.nav .dropdown-toggle:hover .caret { + border-top-color: #005580; + border-bottom-color: #005580; +} + +/* move down carets for tabs */ + +.nav-tabs .dropdown-toggle .caret { + margin-top: 8px; +} + +.nav .active .dropdown-toggle .caret { + border-top-color: #fff; + border-bottom-color: #fff; +} + +.nav-tabs .active .dropdown-toggle .caret { + border-top-color: #555555; + border-bottom-color: #555555; +} + +.nav > .dropdown.active > a:hover { + cursor: pointer; +} + +.nav-tabs .open .dropdown-toggle, +.nav-pills .open .dropdown-toggle, +.nav > li.dropdown.open.active > a:hover { + color: #ffffff; + background-color: #999999; + border-color: #999999; +} + +.nav li.dropdown.open .caret, +.nav li.dropdown.open.active .caret, +.nav li.dropdown.open a:hover .caret { + border-top-color: #ffffff; + border-bottom-color: #ffffff; + opacity: 1; + filter: alpha(opacity=100); +} + +.tabs-stacked .open > a:hover { + border-color: #999999; +} + +.tabbable { + *zoom: 1; +} + +.tabbable:before, +.tabbable:after { + display: table; + line-height: 0; + content: ""; +} + +.tabbable:after { + clear: both; +} + +.tab-content { + overflow: auto; +} + +.tabs-below > .nav-tabs, +.tabs-right > .nav-tabs, +.tabs-left > .nav-tabs { + border-bottom: 0; +} + +.tab-content > .tab-pane, +.pill-content > .pill-pane { + display: none; +} + +.tab-content > .active, +.pill-content > .active { + display: block; +} + +.tabs-below > .nav-tabs { + border-top: 1px solid #ddd; +} + +.tabs-below > .nav-tabs > li { + margin-top: -1px; + margin-bottom: 0; +} + +.tabs-below > .nav-tabs > li > a { + -webkit-border-radius: 0 0 4px 4px; + -moz-border-radius: 0 0 4px 4px; + border-radius: 0 0 4px 4px; +} + +.tabs-below > .nav-tabs > li > a:hover { + border-top-color: #ddd; + border-bottom-color: transparent; +} + +.tabs-below > .nav-tabs > .active > a, +.tabs-below > .nav-tabs > .active > a:hover { + border-color: transparent #ddd #ddd #ddd; +} + +.tabs-left > .nav-tabs > li, +.tabs-right > .nav-tabs > li { + float: none; +} + +.tabs-left > .nav-tabs > li > a, +.tabs-right > .nav-tabs > li > a { + min-width: 74px; + margin-right: 0; + margin-bottom: 3px; +} + +.tabs-left > .nav-tabs { + float: left; + margin-right: 19px; + border-right: 1px solid #ddd; +} + +.tabs-left > .nav-tabs > li > a { + margin-right: -1px; + -webkit-border-radius: 4px 0 0 4px; + -moz-border-radius: 4px 0 0 4px; + border-radius: 4px 0 0 4px; +} + +.tabs-left > .nav-tabs > li > a:hover { + border-color: #eeeeee #dddddd #eeeeee #eeeeee; +} + +.tabs-left > .nav-tabs .active > a, +.tabs-left > .nav-tabs .active > a:hover { + border-color: #ddd transparent #ddd #ddd; + *border-right-color: #ffffff; +} + +.tabs-right > .nav-tabs { + float: right; + margin-left: 19px; + border-left: 1px solid #ddd; +} + +.tabs-right > .nav-tabs > li > a { + margin-left: -1px; + -webkit-border-radius: 0 4px 4px 0; + -moz-border-radius: 0 4px 4px 0; + border-radius: 0 4px 4px 0; +} + +.tabs-right > .nav-tabs > li > a:hover { + border-color: #eeeeee #eeeeee #eeeeee #dddddd; +} + +.tabs-right > .nav-tabs .active > a, +.tabs-right > .nav-tabs .active > a:hover { + border-color: #ddd #ddd #ddd transparent; + *border-left-color: #ffffff; +} + +.nav > .disabled > a { + color: #999999; +} + +.nav > .disabled > a:hover { + text-decoration: none; + cursor: default; + background-color: transparent; +} + +.navbar { + *position: relative; + *z-index: 2; + margin-bottom: 20px; + overflow: visible; + color: #777777; +} + +.navbar-inner { + min-height: 40px; + padding-right: 20px; + padding-left: 20px; + background-color: #fafafa; + background-image: -moz-linear-gradient(top, #bababa, #f2f2f2); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#bababa), to(#f2f2f2)); + background-image: -webkit-linear-gradient(top, #bababa, #f2f2f2); + background-image: -o-linear-gradient(top, #bababa, #f2f2f2); + background-image: linear-gradient(to bottom, #bababa, #f2f2f2); + background-repeat: repeat-x; + border: 1px solid #d4d4d4; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff2f2f2', GradientType=0); + *zoom: 1; + -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065); + -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065); + box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065); +} + +.navbar-inner:before, +.navbar-inner:after { + display: table; + line-height: 0; + content: ""; +} + +.navbar-inner:after { + clear: both; +} + +.navbar .container { + width: auto; +} + +.nav-collapse.collapse { + height: auto; +} + +.navbar .brand { + display: block; + float: left; + padding: 10px 20px 10px; + margin-left: 150px; + font-size: 20px; + font-weight: 200; + color: #000000; + text-shadow: 0 1px 0 #ffffff; +} + +.navbar .brand:hover { + text-decoration: none; +} + +.navbar-text { + margin-bottom: 0; + line-height: 40px; +} + +.navbar-link { + color: #777777; +} + +.navbar-link:hover { + color: #333333; +} + +.navbar .divider-vertical { + height: 40px; + margin: 0 9px; + border-right: 1px solid #ffffff; + border-left: 1px solid #f2f2f2; +} + +.navbar .btn, +.navbar .btn-group { + margin-top: 5px; +} + +.navbar .btn-group .btn, +.navbar .input-prepend .btn, +.navbar .input-append .btn { + margin-top: 0; +} + +.navbar-form { + margin-bottom: 0; + *zoom: 1; +} + +.navbar-form:before, +.navbar-form:after { + display: table; + line-height: 0; + content: ""; +} + +.navbar-form:after { + clear: both; +} + +.navbar-form input, +.navbar-form select, +.navbar-form .radio, +.navbar-form .checkbox { + margin-top: 5px; +} + +.navbar-form input, +.navbar-form select, +.navbar-form .btn { + display: inline-block; + margin-bottom: 0; +} + +.navbar-form input[type="image"], +.navbar-form input[type="checkbox"], +.navbar-form input[type="radio"] { + margin-top: 3px; +} + +.navbar-form .input-append, +.navbar-form .input-prepend { + margin-top: 6px; + white-space: nowrap; +} + +.navbar-form .input-append input, +.navbar-form .input-prepend input { + margin-top: 0; +} + +.navbar-search { + position: relative; + float: left; + margin-top: 5px; + margin-bottom: 0; +} + +.navbar-search .search-query { + padding: 4px 14px; + margin-bottom: 0; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 13px; + font-weight: normal; + line-height: 1; + -webkit-border-radius: 15px; + -moz-border-radius: 15px; + border-radius: 15px; +} + +.navbar-static-top { + position: static; + width: 100%; + margin-bottom: 0; +} + +.navbar-static-top .navbar-inner { + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} + +.navbar-fixed-top, +.navbar-fixed-bottom { + position: fixed; + right: 0; + left: 0; + z-index: 1030; + margin-bottom: 0; +} + +.navbar-fixed-top .navbar-inner, +.navbar-static-top .navbar-inner { + border-width: 0 0 1px; +} + +.navbar-fixed-bottom .navbar-inner { + border-width: 1px 0 0; +} + +.navbar-fixed-top .navbar-inner, +.navbar-fixed-bottom .navbar-inner { + padding-right: 0; + padding-left: 0; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} + +.navbar-static-top .container, +.navbar-fixed-top .container, +.navbar-fixed-bottom .container { + width: 940px; +} + +.navbar-fixed-top { + top: 0; +} + +.navbar-fixed-top .navbar-inner, +.navbar-static-top .navbar-inner { + -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1), 0 1px 10px rgba(0, 0, 0, 0.1); + -moz-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1), 0 1px 10px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1), 0 1px 10px rgba(0, 0, 0, 0.1); +} + +.navbar-fixed-bottom { + bottom: 0; +} + +.navbar-fixed-bottom .navbar-inner { + -webkit-box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.1), 0 -1px 10px rgba(0, 0, 0, 0.1); + -moz-box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.1), 0 -1px 10px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.1), 0 -1px 10px rgba(0, 0, 0, 0.1); +} + +.navbar .nav { + position: relative; + left: 0; + display: block; + float: left; + margin: 0 10px 0 0; +} + +.navbar .nav.pull-right { + float: right; + margin-left: 0; +} + +.navbar .nav > li { + float: left; +} + +.navbar .nav > li > a { + float: none; + padding: 10px 15px 10px; + color: #777777; + text-decoration: none; + text-shadow: 0 1px 0 #ffffff; +} + +.navbar .nav .dropdown-toggle .caret { + margin-top: 8px; +} + +.navbar .nav > li > a:focus, +.navbar .nav > li > a:hover { + color: #333333; + text-decoration: none; + background-color: transparent; +} + +.navbar .nav > .active > a, +.navbar .nav > .active > a:hover, +.navbar .nav > .active > a:focus { + color: #555555; + text-decoration: none; + background-color: #e5e5e5; + -webkit-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125); + -moz-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125); + box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125); +} + +.navbar .btn-navbar { + display: none; + float: right; + padding: 7px 10px; + margin-right: 5px; + margin-left: 5px; + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #ededed; + *background-color: #e5e5e5; + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f2f2f2), to(#e5e5e5)); + background-image: -webkit-linear-gradient(top, #f2f2f2, #e5e5e5); + background-image: -o-linear-gradient(top, #f2f2f2, #e5e5e5); + background-image: linear-gradient(to bottom, #f2f2f2, #e5e5e5); + background-image: -moz-linear-gradient(top, #f2f2f2, #e5e5e5); + background-repeat: repeat-x; + border-color: #e5e5e5 #e5e5e5 #bfbfbf; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffe5e5e5', GradientType=0); + filter: progid:dximagetransform.microsoft.gradient(enabled=false); + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); +} + +.navbar .btn-navbar:hover, +.navbar .btn-navbar:active, +.navbar .btn-navbar.active, +.navbar .btn-navbar.disabled, +.navbar .btn-navbar[disabled] { + color: #ffffff; + background-color: #e5e5e5; + *background-color: #d9d9d9; +} + +.navbar .btn-navbar:active, +.navbar .btn-navbar.active { + background-color: #cccccc \9; +} + +.navbar .btn-navbar .icon-bar { + display: block; + width: 18px; + height: 2px; + background-color: #f5f5f5; + -webkit-border-radius: 1px; + -moz-border-radius: 1px; + border-radius: 1px; + -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); + -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); + box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); +} + +.btn-navbar .icon-bar + .icon-bar { + margin-top: 3px; +} + +.navbar .nav > li > .dropdown-menu:before { + position: absolute; + top: -7px; + left: 9px; + display: inline-block; + border-right: 7px solid transparent; + border-bottom: 7px solid #ccc; + border-left: 7px solid transparent; + border-bottom-color: rgba(0, 0, 0, 0.2); + content: ''; +} + +.navbar .nav > li > .dropdown-menu:after { + position: absolute; + top: -6px; + left: 10px; + display: inline-block; + border-right: 6px solid transparent; + border-bottom: 6px solid #ffffff; + border-left: 6px solid transparent; + content: ''; +} + +.navbar-fixed-bottom .nav > li > .dropdown-menu:before { + top: auto; + bottom: -7px; + border-top: 7px solid #ccc; + border-bottom: 0; + border-top-color: rgba(0, 0, 0, 0.2); +} + +.navbar-fixed-bottom .nav > li > .dropdown-menu:after { + top: auto; + bottom: -6px; + border-top: 6px solid #ffffff; + border-bottom: 0; +} + +.navbar .nav li.dropdown.open > .dropdown-toggle, +.navbar .nav li.dropdown.active > .dropdown-toggle, +.navbar .nav li.dropdown.open.active > .dropdown-toggle { + color: #555555; + background-color: #e5e5e5; +} + +.navbar .nav li.dropdown > .dropdown-toggle .caret { + border-top-color: #777777; + border-bottom-color: #777777; +} + +.navbar .nav li.dropdown.open > .dropdown-toggle .caret, +.navbar .nav li.dropdown.active > .dropdown-toggle .caret, +.navbar .nav li.dropdown.open.active > .dropdown-toggle .caret { + border-top-color: #555555; + border-bottom-color: #555555; +} + +.navbar .pull-right > li > .dropdown-menu, +.navbar .nav > li > .dropdown-menu.pull-right { + right: 0; + left: auto; +} + +.navbar .pull-right > li > .dropdown-menu:before, +.navbar .nav > li > .dropdown-menu.pull-right:before { + right: 12px; + left: auto; +} + +.navbar .pull-right > li > .dropdown-menu:after, +.navbar .nav > li > .dropdown-menu.pull-right:after { + right: 13px; + left: auto; +} + +.navbar .pull-right > li > .dropdown-menu .dropdown-menu, +.navbar .nav > li > .dropdown-menu.pull-right .dropdown-menu { + right: 100%; + left: auto; + margin-right: -1px; + margin-left: 0; + -webkit-border-radius: 6px 0 6px 6px; + -moz-border-radius: 6px 0 6px 6px; + border-radius: 6px 0 6px 6px; +} + +.navbar-inverse { + color: #999999; +} + +.navbar-inverse .navbar-inner { + background-color: #1b1b1b; + background-image: -moz-linear-gradient(top, #222222, #111111); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#222222), to(#111111)); + background-image: -webkit-linear-gradient(top, #222222, #111111); + background-image: -o-linear-gradient(top, #222222, #111111); + background-image: linear-gradient(to bottom, #222222, #111111); + background-repeat: repeat-x; + border-color: #252525; + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff111111', GradientType=0); +} + +.navbar-inverse .brand, +.navbar-inverse .nav > li > a { + color: #999999; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} + +.navbar-inverse .brand:hover, +.navbar-inverse .nav > li > a:hover { + color: #ffffff; +} + +.navbar-inverse .nav > li > a:focus, +.navbar-inverse .nav > li > a:hover { + color: #ffffff; + background-color: transparent; +} + +.navbar-inverse .nav .active > a, +.navbar-inverse .nav .active > a:hover, +.navbar-inverse .nav .active > a:focus { + color: #ffffff; + background-color: #111111; +} + +.navbar-inverse .navbar-link { + color: #999999; +} + +.navbar-inverse .navbar-link:hover { + color: #ffffff; +} + +.navbar-inverse .divider-vertical { + border-right-color: #222222; + border-left-color: #111111; +} + +.navbar-inverse .nav li.dropdown.open > .dropdown-toggle, +.navbar-inverse .nav li.dropdown.active > .dropdown-toggle, +.navbar-inverse .nav li.dropdown.open.active > .dropdown-toggle { + color: #ffffff; + background-color: #111111; +} + +.navbar-inverse .nav li.dropdown > .dropdown-toggle .caret { + border-top-color: #999999; + border-bottom-color: #999999; +} + +.navbar-inverse .nav li.dropdown.open > .dropdown-toggle .caret, +.navbar-inverse .nav li.dropdown.active > .dropdown-toggle .caret, +.navbar-inverse .nav li.dropdown.open.active > .dropdown-toggle .caret { + border-top-color: #ffffff; + border-bottom-color: #ffffff; +} + +.navbar-inverse .navbar-search .search-query { + color: #ffffff; + background-color: #515151; + border-color: #111111; + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.15); + -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.15); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.15); + -webkit-transition: none; + -moz-transition: none; + -o-transition: none; + transition: none; +} + +.navbar-inverse .navbar-search .search-query:-moz-placeholder { + color: #cccccc; +} + +.navbar-inverse .navbar-search .search-query:-ms-input-placeholder { + color: #cccccc; +} + +.navbar-inverse .navbar-search .search-query::-webkit-input-placeholder { + color: #cccccc; +} + +.navbar-inverse .navbar-search .search-query:focus, +.navbar-inverse .navbar-search .search-query.focused { + padding: 5px 15px; + color: #333333; + text-shadow: 0 1px 0 #ffffff; + background-color: #ffffff; + border: 0; + outline: 0; + -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); + -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); + box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); +} + +.navbar-inverse .btn-navbar { + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #0e0e0e; + *background-color: #040404; + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#151515), to(#040404)); + background-image: -webkit-linear-gradient(top, #151515, #040404); + background-image: -o-linear-gradient(top, #151515, #040404); + background-image: linear-gradient(to bottom, #151515, #040404); + background-image: -moz-linear-gradient(top, #151515, #040404); + background-repeat: repeat-x; + border-color: #040404 #040404 #000000; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ff151515', endColorstr='#ff040404', GradientType=0); + filter: progid:dximagetransform.microsoft.gradient(enabled=false); +} + +.navbar-inverse .btn-navbar:hover, +.navbar-inverse .btn-navbar:active, +.navbar-inverse .btn-navbar.active, +.navbar-inverse .btn-navbar.disabled, +.navbar-inverse .btn-navbar[disabled] { + color: #ffffff; + background-color: #040404; + *background-color: #000000; +} + +.navbar-inverse .btn-navbar:active, +.navbar-inverse .btn-navbar.active { + background-color: #000000 \9; +} + +.breadcrumb { + padding: 8px 15px; + margin: 0 0 20px; + list-style: none; + background-color: #f5f5f5; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +.breadcrumb li { + display: inline-block; + *display: inline; + text-shadow: 0 1px 0 #ffffff; + *zoom: 1; +} + +.breadcrumb .divider { + padding: 0 5px; + color: #ccc; +} + +.breadcrumb .active { + color: #999999; +} + +.pagination { + height: 40px; + margin: 20px 0; +} + +.pagination ul { + display: inline-block; + *display: inline; + margin-bottom: 0; + margin-left: 0; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + *zoom: 1; + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); +} + +.pagination ul > li { + display: inline; +} + +.pagination ul > li > a, +.pagination ul > li > span { + float: left; + padding: 0 14px; + line-height: 38px; + text-decoration: none; + background-color: #ffffff; + border: 1px solid #dddddd; + border-left-width: 0; +} + +.pagination ul > li > a:hover, +.pagination ul > .active > a, +.pagination ul > .active > span { + background-color: #f5f5f5; +} + +.pagination ul > .active > a, +.pagination ul > .active > span { + color: #999999; + cursor: default; +} + +.pagination ul > .disabled > span, +.pagination ul > .disabled > a, +.pagination ul > .disabled > a:hover { + color: #999999; + cursor: default; + background-color: transparent; +} + +.pagination ul > li:first-child > a, +.pagination ul > li:first-child > span { + border-left-width: 1px; + -webkit-border-radius: 3px 0 0 3px; + -moz-border-radius: 3px 0 0 3px; + border-radius: 3px 0 0 3px; +} + +.pagination ul > li:last-child > a, +.pagination ul > li:last-child > span { + -webkit-border-radius: 0 3px 3px 0; + -moz-border-radius: 0 3px 3px 0; + border-radius: 0 3px 3px 0; +} + +.pagination-centered { + text-align: center; +} + +.pagination-right { + text-align: right; +} + +.pager { + margin: 20px 0; + text-align: center; + list-style: none; + *zoom: 1; +} + +.pager:before, +.pager:after { + display: table; + line-height: 0; + content: ""; +} + +.pager:after { + clear: both; +} + +.pager li { + display: inline; +} + +.pager a, +.pager span { + display: inline-block; + padding: 5px 14px; + background-color: #fff; + border: 1px solid #ddd; + -webkit-border-radius: 15px; + -moz-border-radius: 15px; + border-radius: 15px; +} + +.pager a:hover { + text-decoration: none; + background-color: #f5f5f5; +} + +.pager .next a, +.pager .next span { + float: right; +} + +.pager .previous a { + float: left; +} + +.pager .disabled a, +.pager .disabled a:hover, +.pager .disabled span { + color: #999999; + cursor: default; + background-color: #fff; +} + +.modal-open .modal .dropdown-menu { + z-index: 2050; +} + +.modal-open .modal .dropdown.open { + *z-index: 2050; +} + +.modal-open .modal .popover { + z-index: 2060; +} + +.modal-open .modal .tooltip { + z-index: 2080; +} + +.modal-backdrop { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1040; + background-color: #000000; +} + +.modal-backdrop.fade { + opacity: 0; +} + +.modal-backdrop, +.modal-backdrop.fade.in { + opacity: 0.8; + filter: alpha(opacity=80); +} + +.modal { + position: fixed; + top: 50%; + left: 50%; + z-index: 1050; + width: 560px; + margin: -250px 0 0 -280px; + overflow: auto; + background-color: #ffffff; + border: 1px solid #999; + border: 1px solid rgba(0, 0, 0, 0.3); + *border: 1px solid #999; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; + -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); + -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); + box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); + -webkit-background-clip: padding-box; + -moz-background-clip: padding-box; + background-clip: padding-box; +} + +.modal.fade { + top: -25%; + -webkit-transition: opacity 0.3s linear, top 0.3s ease-out; + -moz-transition: opacity 0.3s linear, top 0.3s ease-out; + -o-transition: opacity 0.3s linear, top 0.3s ease-out; + transition: opacity 0.3s linear, top 0.3s ease-out; +} + +.modal.fade.in { + top: 50%; +} + +.modal-header { + padding: 9px 15px; + border-bottom: 1px solid #eee; +} + +.modal-header .close { + margin-top: 2px; +} + +.modal-header h3 { + margin: 0; + line-height: 30px; +} + +.modal-body { + max-height: 400px; + padding: 15px; + overflow-y: auto; +} + +.modal-form { + margin-bottom: 0; +} + +.modal-footer { + padding: 14px 15px 15px; + margin-bottom: 0; + text-align: right; + background-color: #f5f5f5; + border-top: 1px solid #ddd; + -webkit-border-radius: 0 0 6px 6px; + -moz-border-radius: 0 0 6px 6px; + border-radius: 0 0 6px 6px; + *zoom: 1; + -webkit-box-shadow: inset 0 1px 0 #ffffff; + -moz-box-shadow: inset 0 1px 0 #ffffff; + box-shadow: inset 0 1px 0 #ffffff; +} + +.modal-footer:before, +.modal-footer:after { + display: table; + line-height: 0; + content: ""; +} + +.modal-footer:after { + clear: both; +} + +.modal-footer .btn + .btn { + margin-bottom: 0; + margin-left: 5px; +} + +.modal-footer .btn-group .btn + .btn { + margin-left: -1px; +} + +.tooltip { + position: absolute; + z-index: 1030; + display: block; + padding: 5px; + font-size: 11px; + opacity: 0; + filter: alpha(opacity=0); + visibility: visible; +} + +.tooltip.in { + opacity: 0.8; + filter: alpha(opacity=80); +} + +.tooltip.top { + margin-top: -3px; +} + +.tooltip.right { + margin-left: 3px; +} + +.tooltip.bottom { + margin-top: 3px; +} + +.tooltip.left { + margin-left: -3px; +} + +.tooltip-inner { + max-width: 200px; + padding: 3px 8px; + color: #ffffff; + text-align: center; + text-decoration: none; + background-color: #000000; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +.tooltip-arrow { + position: absolute; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; +} + +.tooltip.top .tooltip-arrow { + bottom: 0; + left: 50%; + margin-left: -5px; + border-top-color: #000000; + border-width: 5px 5px 0; +} + +.tooltip.right .tooltip-arrow { + top: 50%; + left: 0; + margin-top: -5px; + border-right-color: #000000; + border-width: 5px 5px 5px 0; +} + +.tooltip.left .tooltip-arrow { + top: 50%; + right: 0; + margin-top: -5px; + border-left-color: #000000; + border-width: 5px 0 5px 5px; +} + +.tooltip.bottom .tooltip-arrow { + top: 0; + left: 50%; + margin-left: -5px; + border-bottom-color: #000000; + border-width: 0 5px 5px; +} + +.popover { + position: absolute; + top: 0; + left: 0; + z-index: 1010; + display: none; + width: 236px; + padding: 1px; + background-color: #ffffff; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, 0.2); + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; + -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); + box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; +} + +.popover.top { + margin-bottom: 10px; +} + +.popover.right { + margin-left: 10px; +} + +.popover.bottom { + margin-top: 10px; +} + +.popover.left { + margin-right: 10px; +} + +.popover-title { + padding: 8px 14px; + margin: 0; + font-size: 14px; + font-weight: normal; + line-height: 18px; + background-color: #f7f7f7; + border-bottom: 1px solid #ebebeb; + -webkit-border-radius: 5px 5px 0 0; + -moz-border-radius: 5px 5px 0 0; + border-radius: 5px 5px 0 0; +} + +.popover-content { + padding: 9px 14px; +} + +.popover-content p, +.popover-content ul, +.popover-content ol { + margin-bottom: 0; +} + +.popover .arrow, +.popover .arrow:after { + position: absolute; + display: inline-block; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; +} + +.popover .arrow:after { + z-index: -1; + content: ""; +} + +.popover.top .arrow { + bottom: -10px; + left: 50%; + margin-left: -10px; + border-top-color: #ffffff; + border-width: 10px 10px 0; +} + +.popover.top .arrow:after { + bottom: -1px; + left: -11px; + border-top-color: rgba(0, 0, 0, 0.25); + border-width: 11px 11px 0; +} + +.popover.right .arrow { + top: 50%; + left: -10px; + margin-top: -10px; + border-right-color: #ffffff; + border-width: 10px 10px 10px 0; +} + +.popover.right .arrow:after { + bottom: -11px; + left: -1px; + border-right-color: rgba(0, 0, 0, 0.25); + border-width: 11px 11px 11px 0; +} + +.popover.bottom .arrow { + top: -10px; + left: 50%; + margin-left: -10px; + border-bottom-color: #ffffff; + border-width: 0 10px 10px; +} + +.popover.bottom .arrow:after { + top: -1px; + left: -11px; + border-bottom-color: rgba(0, 0, 0, 0.25); + border-width: 0 11px 11px; +} + +.popover.left .arrow { + top: 50%; + right: -10px; + margin-top: -10px; + border-left-color: #ffffff; + border-width: 10px 0 10px 10px; +} + +.popover.left .arrow:after { + right: -1px; + bottom: -11px; + border-left-color: rgba(0, 0, 0, 0.25); + border-width: 11px 0 11px 11px; +} + +.thumbnails { + margin-left: -20px; + list-style: none; + *zoom: 1; +} + +.thumbnails:before, +.thumbnails:after { + display: table; + line-height: 0; + content: ""; +} + +.thumbnails:after { + clear: both; +} + +.row-fluid .thumbnails { + margin-left: 0; +} + +.thumbnails > li { + float: left; + margin-bottom: 20px; + margin-left: 20px; +} + +.thumbnail { + display: block; + padding: 4px; + line-height: 20px; + border: 1px solid #ddd; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055); + -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055); + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055); + -webkit-transition: all 0.2s ease-in-out; + -moz-transition: all 0.2s ease-in-out; + -o-transition: all 0.2s ease-in-out; + transition: all 0.2s ease-in-out; +} + +a.thumbnail:hover { + border-color: #0088cc; + -webkit-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); + -moz-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); + box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); +} + +.thumbnail > img { + display: block; + max-width: 100%; + margin-right: auto; + margin-left: auto; +} + +.thumbnail .caption { + padding: 9px; + color: #555555; +} + +.label, +.badge { + font-size: 11.844px; + font-weight: bold; + line-height: 14px; + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + white-space: nowrap; + vertical-align: baseline; + background-color: #999999; +} + +.label { + padding: 1px 4px 2px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} + +.badge { + padding: 1px 9px 2px; + -webkit-border-radius: 9px; + -moz-border-radius: 9px; + border-radius: 9px; +} + +a.label:hover, +a.badge:hover { + color: #ffffff; + text-decoration: none; + cursor: pointer; +} + +.label-important, +.badge-important { + background-color: #b94a48; +} + +.label-important[href], +.badge-important[href] { + background-color: #953b39; +} + +.label-warning, +.badge-warning { + background-color: #f89406; +} + +.label-warning[href], +.badge-warning[href] { + background-color: #c67605; +} + +.label-success, +.badge-success { + background-color: #468847; +} + +.label-success[href], +.badge-success[href] { + background-color: #356635; +} + +.label-info, +.badge-info { + background-color: #3a87ad; +} + +.label-info[href], +.badge-info[href] { + background-color: #2d6987; +} + +.label-inverse, +.badge-inverse { + background-color: #333333; +} + +.label-inverse[href], +.badge-inverse[href] { + background-color: #1a1a1a; +} + +.btn .label, +.btn .badge { + position: relative; + top: -1px; +} + +.btn-mini .label, +.btn-mini .badge { + top: 0; +} + +@-webkit-keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} + +@-moz-keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} + +@-ms-keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} + +@-o-keyframes progress-bar-stripes { + from { + background-position: 0 0; + } + to { + background-position: 40px 0; + } +} + +@keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} + +.progress { + height: 20px; + margin-bottom: 20px; + overflow: hidden; + background-color: #f7f7f7; + background-image: -moz-linear-gradient(top, #f5f5f5, #f9f9f9); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#f9f9f9)); + background-image: -webkit-linear-gradient(top, #f5f5f5, #f9f9f9); + background-image: -o-linear-gradient(top, #f5f5f5, #f9f9f9); + background-image: linear-gradient(to bottom, #f5f5f5, #f9f9f9); + background-repeat: repeat-x; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#fff9f9f9', GradientType=0); + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); +} + +.progress .bar { + float: left; + width: 0; + height: 100%; + font-size: 12px; + color: #ffffff; + text-align: center; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #0e90d2; + background-image: -moz-linear-gradient(top, #149bdf, #0480be); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#149bdf), to(#0480be)); + background-image: -webkit-linear-gradient(top, #149bdf, #0480be); + background-image: -o-linear-gradient(top, #149bdf, #0480be); + background-image: linear-gradient(to bottom, #149bdf, #0480be); + background-repeat: repeat-x; + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ff149bdf', endColorstr='#ff0480be', GradientType=0); + -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); + -moz-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); + box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-transition: width 0.6s ease; + -moz-transition: width 0.6s ease; + -o-transition: width 0.6s ease; + transition: width 0.6s ease; +} + +.progress .bar + .bar { + -webkit-box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.15), inset 0 -1px 0 rgba(0, 0, 0, 0.15); + -moz-box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.15), inset 0 -1px 0 rgba(0, 0, 0, 0.15); + box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.15), inset 0 -1px 0 rgba(0, 0, 0, 0.15); +} + +.progress-striped .bar { + background-color: #149bdf; + background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + -webkit-background-size: 40px 40px; + -moz-background-size: 40px 40px; + -o-background-size: 40px 40px; + background-size: 40px 40px; +} + +.progress.active .bar { + -webkit-animation: progress-bar-stripes 2s linear infinite; + -moz-animation: progress-bar-stripes 2s linear infinite; + -ms-animation: progress-bar-stripes 2s linear infinite; + -o-animation: progress-bar-stripes 2s linear infinite; + animation: progress-bar-stripes 2s linear infinite; +} + +.progress-danger .bar, +.progress .bar-danger { + background-color: #dd514c; + background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#c43c35)); + background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35); + background-image: -o-linear-gradient(top, #ee5f5b, #c43c35); + background-image: linear-gradient(to bottom, #ee5f5b, #c43c35); + background-repeat: repeat-x; + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffc43c35', GradientType=0); +} + +.progress-danger.progress-striped .bar, +.progress-striped .bar-danger { + background-color: #ee5f5b; + background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} + +.progress-success .bar, +.progress .bar-success { + background-color: #5eb95e; + background-image: -moz-linear-gradient(top, #62c462, #57a957); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#57a957)); + background-image: -webkit-linear-gradient(top, #62c462, #57a957); + background-image: -o-linear-gradient(top, #62c462, #57a957); + background-image: linear-gradient(to bottom, #62c462, #57a957); + background-repeat: repeat-x; + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff57a957', GradientType=0); +} + +.progress-success.progress-striped .bar, +.progress-striped .bar-success { + background-color: #62c462; + background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} + +.progress-info .bar, +.progress .bar-info { + background-color: #4bb1cf; + background-image: -moz-linear-gradient(top, #5bc0de, #339bb9); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#339bb9)); + background-image: -webkit-linear-gradient(top, #5bc0de, #339bb9); + background-image: -o-linear-gradient(top, #5bc0de, #339bb9); + background-image: linear-gradient(to bottom, #5bc0de, #339bb9); + background-repeat: repeat-x; + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff339bb9', GradientType=0); +} + +.progress-info.progress-striped .bar, +.progress-striped .bar-info { + background-color: #5bc0de; + background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} + +.progress-warning .bar, +.progress .bar-warning { + background-color: #faa732; + background-image: -moz-linear-gradient(top, #fbb450, #f89406); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406)); + background-image: -webkit-linear-gradient(top, #fbb450, #f89406); + background-image: -o-linear-gradient(top, #fbb450, #f89406); + background-image: linear-gradient(to bottom, #fbb450, #f89406); + background-repeat: repeat-x; + filter: progid:dximagetransform.microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0); +} + +.progress-warning.progress-striped .bar, +.progress-striped .bar-warning { + background-color: #fbb450; + background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} + +.accordion { + margin-bottom: 20px; +} + +.accordion-group { + margin-bottom: 2px; + border: 1px solid #e5e5e5; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +.accordion-heading { + border-bottom: 0; +} + +.accordion-heading .accordion-toggle { + display: block; + padding: 8px 15px; +} + +.accordion-toggle { + cursor: pointer; +} + +.accordion-inner { + padding: 9px 15px; + border-top: 1px solid #e5e5e5; +} + +.carousel { + position: relative; + margin-bottom: 20px; + line-height: 1; +} + +.carousel-inner { + position: relative; + width: 100%; + overflow: hidden; +} + +.carousel .item { + position: relative; + display: none; + -webkit-transition: 0.6s ease-in-out left; + -moz-transition: 0.6s ease-in-out left; + -o-transition: 0.6s ease-in-out left; + transition: 0.6s ease-in-out left; +} + +.carousel .item > img { + display: block; + line-height: 1; +} + +.carousel .active, +.carousel .next, +.carousel .prev { + display: block; +} + +.carousel .active { + left: 0; +} + +.carousel .next, +.carousel .prev { + position: absolute; + top: 0; + width: 100%; +} + +.carousel .next { + left: 100%; +} + +.carousel .prev { + left: -100%; +} + +.carousel .next.left, +.carousel .prev.right { + left: 0; +} + +.carousel .active.left { + left: -100%; +} + +.carousel .active.right { + left: 100%; +} + +.carousel-control { + position: absolute; + top: 40%; + left: 15px; + width: 40px; + height: 40px; + margin-top: -20px; + font-size: 60px; + font-weight: 100; + line-height: 30px; + color: #ffffff; + text-align: center; + background: #222222; + border: 3px solid #ffffff; + -webkit-border-radius: 23px; + -moz-border-radius: 23px; + border-radius: 23px; + opacity: 0.5; + filter: alpha(opacity=50); +} + +.carousel-control.right { + right: 15px; + left: auto; +} + +.carousel-control:hover { + color: #ffffff; + text-decoration: none; + opacity: 0.9; + filter: alpha(opacity=90); +} + +.carousel-caption { + position: absolute; + right: 0; + bottom: 0; + left: 0; + padding: 15px; + background: #333333; + background: rgba(0, 0, 0, 0.75); +} + +.carousel-caption h4, +.carousel-caption p { + line-height: 20px; + color: #ffffff; +} + +.carousel-caption h4 { + margin: 0 0 5px; +} + +.carousel-caption p { + margin-bottom: 0; +} + +.hero-unit { + padding: 60px; + margin-bottom: 30px; + background-color: #eeeeee; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; +} + +.hero-unit h1 { + margin-bottom: 0; + font-size: 60px; + line-height: 1; + letter-spacing: -1px; + color: inherit; +} + +.hero-unit p { + font-size: 18px; + font-weight: 200; + line-height: 30px; + color: inherit; +} + +.pull-right { + float: right; +} + +.pull-left { + float: left; +} + +.hide { + display: none; +} + +.show { + display: block; +} + +.invisible { + visibility: hidden; +} + +.affix { + position: fixed; +} diff --git a/Website/LOC.Website.Web/Content/css/bootstrap.min.css b/Website/LOC.Website.Web/Content/css/bootstrap.min.css new file mode 100644 index 000000000..31d8b960a --- /dev/null +++ b/Website/LOC.Website.Web/Content/css/bootstrap.min.css @@ -0,0 +1,9 @@ +/*! + * Bootstrap v2.1.1 + * + * Copyright 2012 Twitter, Inc + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Designed and built with all the love in the world @twitter by @mdo and @fat. + */article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}a:hover,a:active{outline:0}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{width:auto\9;height:auto;max-width:100%;vertical-align:middle;border:0;-ms-interpolation-mode:bicubic}#map_canvas img{max-width:none}button,input,select,textarea{margin:0;font-size:100%;vertical-align:middle}button,input{*overflow:visible;line-height:normal}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}button,input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button}input[type="search"]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type="search"]::-webkit-search-decoration,input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none}textarea{overflow:auto;vertical-align:top}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;line-height:0;content:""}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}body{margin:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:20px;color:#333;background-color:#fff}a{color:#08c;text-decoration:none}a:hover{color:#005580;text-decoration:underline}.img-rounded{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.img-polaroid{padding:4px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.1);box-shadow:0 1px 3px rgba(0,0,0,0.1)}.img-circle{-webkit-border-radius:500px;-moz-border-radius:500px;border-radius:500px}.row{margin-left:-20px;*zoom:1}.row:before,.row:after{display:table;line-height:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:20px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px}.span12{width:940px}.span11{width:860px}.span10{width:780px}.span9{width:700px}.span8{width:620px}.span7{width:540px}.span6{width:460px}.span5{width:380px}.span4{width:300px}.span3{width:220px}.span2{width:140px}.span1{width:60px}.offset12{margin-left:980px}.offset11{margin-left:900px}.offset10{margin-left:820px}.offset9{margin-left:740px}.offset8{margin-left:660px}.offset7{margin-left:580px}.offset6{margin-left:500px}.offset5{margin-left:420px}.offset4{margin-left:340px}.offset3{margin-left:260px}.offset2{margin-left:180px}.offset1{margin-left:100px}.row-fluid{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block;float:left;width:100%;min-height:30px;margin-left:2.127659574468085%;*margin-left:2.074468085106383%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.48936170212765%;*width:91.43617021276594%}.row-fluid .span10{width:82.97872340425532%;*width:82.92553191489361%}.row-fluid .span9{width:74.46808510638297%;*width:74.41489361702126%}.row-fluid .span8{width:65.95744680851064%;*width:65.90425531914893%}.row-fluid .span7{width:57.44680851063829%;*width:57.39361702127659%}.row-fluid .span6{width:48.93617021276595%;*width:48.88297872340425%}.row-fluid .span5{width:40.42553191489362%;*width:40.37234042553192%}.row-fluid .span4{width:31.914893617021278%;*width:31.861702127659576%}.row-fluid .span3{width:23.404255319148934%;*width:23.351063829787233%}.row-fluid .span2{width:14.893617021276595%;*width:14.840425531914894%}.row-fluid .span1{width:6.382978723404255%;*width:6.329787234042553%}.row-fluid .offset12{margin-left:104.25531914893617%;*margin-left:104.14893617021275%}.row-fluid .offset12:first-child{margin-left:102.12765957446808%;*margin-left:102.02127659574467%}.row-fluid .offset11{margin-left:95.74468085106382%;*margin-left:95.6382978723404%}.row-fluid .offset11:first-child{margin-left:93.61702127659574%;*margin-left:93.51063829787232%}.row-fluid .offset10{margin-left:87.23404255319149%;*margin-left:87.12765957446807%}.row-fluid .offset10:first-child{margin-left:85.1063829787234%;*margin-left:84.99999999999999%}.row-fluid .offset9{margin-left:78.72340425531914%;*margin-left:78.61702127659572%}.row-fluid .offset9:first-child{margin-left:76.59574468085106%;*margin-left:76.48936170212764%}.row-fluid .offset8{margin-left:70.2127659574468%;*margin-left:70.10638297872339%}.row-fluid .offset8:first-child{margin-left:68.08510638297872%;*margin-left:67.9787234042553%}.row-fluid .offset7{margin-left:61.70212765957446%;*margin-left:61.59574468085106%}.row-fluid .offset7:first-child{margin-left:59.574468085106375%;*margin-left:59.46808510638297%}.row-fluid .offset6{margin-left:53.191489361702125%;*margin-left:53.085106382978715%}.row-fluid .offset6:first-child{margin-left:51.063829787234035%;*margin-left:50.95744680851063%}.row-fluid .offset5{margin-left:44.68085106382979%;*margin-left:44.57446808510638%}.row-fluid .offset5:first-child{margin-left:42.5531914893617%;*margin-left:42.4468085106383%}.row-fluid .offset4{margin-left:36.170212765957444%;*margin-left:36.06382978723405%}.row-fluid .offset4:first-child{margin-left:34.04255319148936%;*margin-left:33.93617021276596%}.row-fluid .offset3{margin-left:27.659574468085104%;*margin-left:27.5531914893617%}.row-fluid .offset3:first-child{margin-left:25.53191489361702%;*margin-left:25.425531914893618%}.row-fluid .offset2{margin-left:19.148936170212764%;*margin-left:19.04255319148936%}.row-fluid .offset2:first-child{margin-left:17.02127659574468%;*margin-left:16.914893617021278%}.row-fluid .offset1{margin-left:10.638297872340425%;*margin-left:10.53191489361702%}.row-fluid .offset1:first-child{margin-left:8.51063829787234%;*margin-left:8.404255319148938%}[class*="span"].hide,.row-fluid [class*="span"].hide{display:none}[class*="span"].pull-right,.row-fluid [class*="span"].pull-right{float:right}.container{margin-right:auto;margin-left:auto;*zoom:1}.container:before,.container:after{display:table;line-height:0;content:""}.container:after{clear:both}.container-fluid{padding-right:20px;padding-left:20px;*zoom:1}.container-fluid:before,.container-fluid:after{display:table;line-height:0;content:""}.container-fluid:after{clear:both}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:21px;font-weight:200;line-height:30px}small{font-size:85%}strong{font-weight:bold}em{font-style:italic}cite{font-style:normal}.muted{color:#999}.text-warning{color:#c09853}.text-error{color:#b94a48}.text-info{color:#3a87ad}.text-success{color:#468847}h1,h2,h3,h4,h5,h6{margin:10px 0;font-family:inherit;font-weight:bold;line-height:1;color:inherit;text-rendering:optimizelegibility}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;line-height:1;color:#999}h1{font-size:36px;line-height:40px}h2{font-size:30px;line-height:40px}h3{font-size:24px;line-height:40px}h4{font-size:18px;line-height:20px}h5{font-size:14px;line-height:20px}h6{font-size:12px;line-height:20px}h1 small{font-size:24px}h2 small{font-size:18px}h3 small{font-size:14px}h4 small{font-size:14px}.page-header{padding-bottom:9px;margin:20px 0 30px;border-bottom:1px solid #eee}ul,ol{padding:0;margin:0 0 10px 25px}ul ul,ul ol,ol ol,ol ul{margin-bottom:0}li{line-height:20px}ul.unstyled,ol.unstyled{margin-left:0;list-style:none}dl{margin-bottom:20px}dt,dd{line-height:20px}dt{font-weight:bold}dd{margin-left:10px}.dl-horizontal{*zoom:1}.dl-horizontal:before,.dl-horizontal:after{display:table;line-height:0;content:""}.dl-horizontal:after{clear:both}.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}hr{margin:20px 0;border:0;border-top:1px solid #eee;border-bottom:1px solid #fff}abbr[title]{cursor:help;border-bottom:1px dotted #999}abbr.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:0 0 0 15px;margin:0 0 20px;border-left:5px solid #eee}blockquote p{margin-bottom:0;font-size:16px;font-weight:300;line-height:25px}blockquote small{display:block;line-height:20px;color:#999}blockquote small:before{content:'\2014 \00A0'}blockquote.pull-right{float:right;padding-right:15px;padding-left:0;border-right:5px solid #eee;border-left:0}blockquote.pull-right p,blockquote.pull-right small{text-align:right}blockquote.pull-right small:before{content:''}blockquote.pull-right small:after{content:'\00A0 \2014'}q:before,q:after,blockquote:before,blockquote:after{content:""}address{display:block;margin-bottom:20px;font-style:normal;line-height:20px}code,pre{padding:0 3px 2px;font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;color:#333;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}code{padding:2px 4px;color:#d14;background-color:#f7f7f9;border:1px solid #e1e1e8}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:20px;word-break:break-all;word-wrap:break-word;white-space:pre;white-space:pre-wrap;background-color:#f5f5f5;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.15);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}pre.prettyprint{margin-bottom:20px}pre code{padding:0;color:inherit;background-color:transparent;border:0}.pre-scrollable{max-height:340px;overflow-y:scroll}form{margin:0 0 20px}fieldset{padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:40px;color:#333;border:0;border-bottom:1px solid #e5e5e5}legend small{font-size:15px;color:#999}label,input,button,select,textarea{font-size:14px;font-weight:normal;line-height:20px}input,button,select,textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}label{display:block;margin-bottom:5px}select,textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{display:inline-block;height:20px;padding:4px 6px;margin-bottom:9px;font-size:14px;line-height:20px;color:#555;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}input,textarea,.uneditable-input{width:206px}textarea{height:auto}textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{background-color:#fff;border:1px solid #ccc;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border linear .2s,box-shadow linear .2s;-moz-transition:border linear .2s,box-shadow linear .2s;-o-transition:border linear .2s,box-shadow linear .2s;transition:border linear .2s,box-shadow linear .2s}textarea:focus,input[type="text"]:focus,input[type="password"]:focus,input[type="datetime"]:focus,input[type="datetime-local"]:focus,input[type="date"]:focus,input[type="month"]:focus,input[type="time"]:focus,input[type="week"]:focus,input[type="number"]:focus,input[type="email"]:focus,input[type="url"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="color"]:focus,.uneditable-input:focus{border-color:rgba(82,168,236,0.8);outline:0;outline:thin dotted \9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6)}input[type="radio"],input[type="checkbox"]{margin:4px 0 0;margin-top:1px \9;*margin-top:0;line-height:normal;cursor:pointer}input[type="file"],input[type="image"],input[type="submit"],input[type="reset"],input[type="button"],input[type="radio"],input[type="checkbox"]{width:auto}select,input[type="file"]{height:30px;*margin-top:4px;line-height:30px}select{width:220px;background-color:#fff;border:1px solid #ccc}select[multiple],select[size]{height:auto}select:focus,input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.uneditable-input,.uneditable-textarea{color:#999;cursor:not-allowed;background-color:#fcfcfc;border-color:#ccc;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.025);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.025);box-shadow:inset 0 1px 2px rgba(0,0,0,0.025)}.uneditable-input{overflow:hidden;white-space:nowrap}.uneditable-textarea{width:auto;height:auto}input:-moz-placeholder,textarea:-moz-placeholder{color:#999}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#999}input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{color:#999}.radio,.checkbox{min-height:18px;padding-left:18px}.radio input[type="radio"],.checkbox input[type="checkbox"]{float:left;margin-left:-18px}.controls>.radio:first-child,.controls>.checkbox:first-child{padding-top:5px}.radio.inline,.checkbox.inline{display:inline-block;padding-top:5px;margin-bottom:0;vertical-align:middle}.radio.inline+.radio.inline,.checkbox.inline+.checkbox.inline{margin-left:10px}.input-mini{width:60px}.input-small{width:90px}.input-medium{width:150px}.input-large{width:210px}.input-xlarge{width:270px}.input-xxlarge{width:530px}input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"]{float:none;margin-left:0}.input-append input[class*="span"],.input-append .uneditable-input[class*="span"],.input-prepend input[class*="span"],.input-prepend .uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"],.row-fluid .input-prepend [class*="span"],.row-fluid .input-append [class*="span"]{display:inline-block}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:20px}input.span12,textarea.span12,.uneditable-input.span12{width:926px}input.span11,textarea.span11,.uneditable-input.span11{width:846px}input.span10,textarea.span10,.uneditable-input.span10{width:766px}input.span9,textarea.span9,.uneditable-input.span9{width:686px}input.span8,textarea.span8,.uneditable-input.span8{width:606px}input.span7,textarea.span7,.uneditable-input.span7{width:526px}input.span6,textarea.span6,.uneditable-input.span6{width:446px}input.span5,textarea.span5,.uneditable-input.span5{width:366px}input.span4,textarea.span4,.uneditable-input.span4{width:286px}input.span3,textarea.span3,.uneditable-input.span3{width:206px}input.span2,textarea.span2,.uneditable-input.span2{width:126px}input.span1,textarea.span1,.uneditable-input.span1{width:46px}.controls-row{*zoom:1}.controls-row:before,.controls-row:after{display:table;line-height:0;content:""}.controls-row:after{clear:both}.controls-row [class*="span"]{float:left}input[disabled],select[disabled],textarea[disabled],input[readonly],select[readonly],textarea[readonly]{cursor:not-allowed;background-color:#eee}input[type="radio"][disabled],input[type="checkbox"][disabled],input[type="radio"][readonly],input[type="checkbox"][readonly]{background-color:transparent}.control-group.warning>label,.control-group.warning .help-block,.control-group.warning .help-inline{color:#c09853}.control-group.warning .checkbox,.control-group.warning .radio,.control-group.warning input,.control-group.warning select,.control-group.warning textarea{color:#c09853}.control-group.warning input,.control-group.warning select,.control-group.warning textarea{border-color:#c09853;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.warning input:focus,.control-group.warning select:focus,.control-group.warning textarea:focus{border-color:#a47e3c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e}.control-group.warning .input-prepend .add-on,.control-group.warning .input-append .add-on{color:#c09853;background-color:#fcf8e3;border-color:#c09853}.control-group.error>label,.control-group.error .help-block,.control-group.error .help-inline{color:#b94a48}.control-group.error .checkbox,.control-group.error .radio,.control-group.error input,.control-group.error select,.control-group.error textarea{color:#b94a48}.control-group.error input,.control-group.error select,.control-group.error textarea{border-color:#b94a48;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.error input:focus,.control-group.error select:focus,.control-group.error textarea:focus{border-color:#953b39;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392}.control-group.error .input-prepend .add-on,.control-group.error .input-append .add-on{color:#b94a48;background-color:#f2dede;border-color:#b94a48}.control-group.success>label,.control-group.success .help-block,.control-group.success .help-inline{color:#468847}.control-group.success .checkbox,.control-group.success .radio,.control-group.success input,.control-group.success select,.control-group.success textarea{color:#468847}.control-group.success input,.control-group.success select,.control-group.success textarea{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.success input:focus,.control-group.success select:focus,.control-group.success textarea:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b}.control-group.success .input-prepend .add-on,.control-group.success .input-append .add-on{color:#468847;background-color:#dff0d8;border-color:#468847}.control-group.info>label,.control-group.info .help-block,.control-group.info .help-inline{color:#3a87ad}.control-group.info .checkbox,.control-group.info .radio,.control-group.info input,.control-group.info select,.control-group.info textarea{color:#3a87ad}.control-group.info input,.control-group.info select,.control-group.info textarea{border-color:#3a87ad;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.info input:focus,.control-group.info select:focus,.control-group.info textarea:focus{border-color:#2d6987;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3}.control-group.info .input-prepend .add-on,.control-group.info .input-append .add-on{color:#3a87ad;background-color:#d9edf7;border-color:#3a87ad}input:focus:required:invalid,textarea:focus:required:invalid,select:focus:required:invalid{color:#b94a48;border-color:#ee5f5b}input:focus:required:invalid:focus,textarea:focus:required:invalid:focus,select:focus:required:invalid:focus{border-color:#e9322d;-webkit-box-shadow:0 0 6px #f8b9b7;-moz-box-shadow:0 0 6px #f8b9b7;box-shadow:0 0 6px #f8b9b7}.form-actions{padding:19px 20px 20px;margin-top:20px;margin-bottom:20px;background-color:#f5f5f5;border-top:1px solid #e5e5e5;*zoom:1}.form-actions:before,.form-actions:after{display:table;line-height:0;content:""}.form-actions:after{clear:both}.help-block,.help-inline{color:#595959}.help-block{display:block;margin-bottom:10px}.help-inline{display:inline-block;*display:inline;padding-left:5px;vertical-align:middle;*zoom:1}.input-append,.input-prepend{margin-bottom:5px;font-size:0;white-space:nowrap}.input-append input,.input-prepend input,.input-append select,.input-prepend select,.input-append .uneditable-input,.input-prepend .uneditable-input{position:relative;margin-bottom:0;*margin-left:0;font-size:14px;vertical-align:top;-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}.input-append input:focus,.input-prepend input:focus,.input-append select:focus,.input-prepend select:focus,.input-append .uneditable-input:focus,.input-prepend .uneditable-input:focus{z-index:2}.input-append .add-on,.input-prepend .add-on{display:inline-block;width:auto;height:20px;min-width:16px;padding:4px 5px;font-size:14px;font-weight:normal;line-height:20px;text-align:center;text-shadow:0 1px 0 #fff;background-color:#eee;border:1px solid #ccc}.input-append .add-on,.input-prepend .add-on,.input-append .btn,.input-prepend .btn{vertical-align:top;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.input-append .active,.input-prepend .active{background-color:#a9dba9;border-color:#46a546}.input-prepend .add-on,.input-prepend .btn{margin-right:-1px}.input-prepend .add-on:first-child,.input-prepend .btn:first-child{-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.input-append input,.input-append select,.input-append .uneditable-input{-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.input-append .add-on,.input-append .btn{margin-left:-1px}.input-append .add-on:last-child,.input-append .btn:last-child{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}.input-prepend.input-append input,.input-prepend.input-append select,.input-prepend.input-append .uneditable-input{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.input-prepend.input-append .add-on:first-child,.input-prepend.input-append .btn:first-child{margin-right:-1px;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.input-prepend.input-append .add-on:last-child,.input-prepend.input-append .btn:last-child{margin-left:-1px;-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}input.search-query{padding-right:14px;padding-right:4px \9;padding-left:14px;padding-left:4px \9;margin-bottom:0;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.form-search .input-append .search-query,.form-search .input-prepend .search-query{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.form-search .input-append .search-query{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px}.form-search .input-append .btn{-webkit-border-radius:0 14px 14px 0;-moz-border-radius:0 14px 14px 0;border-radius:0 14px 14px 0}.form-search .input-prepend .search-query{-webkit-border-radius:0 14px 14px 0;-moz-border-radius:0 14px 14px 0;border-radius:0 14px 14px 0}.form-search .input-prepend .btn{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px}.form-search input,.form-inline input,.form-horizontal input,.form-search textarea,.form-inline textarea,.form-horizontal textarea,.form-search select,.form-inline select,.form-horizontal select,.form-search .help-inline,.form-inline .help-inline,.form-horizontal .help-inline,.form-search .uneditable-input,.form-inline .uneditable-input,.form-horizontal .uneditable-input,.form-search .input-prepend,.form-inline .input-prepend,.form-horizontal .input-prepend,.form-search .input-append,.form-inline .input-append,.form-horizontal .input-append{display:inline-block;*display:inline;margin-bottom:0;vertical-align:middle;*zoom:1}.form-search .hide,.form-inline .hide,.form-horizontal .hide{display:none}.form-search label,.form-inline label,.form-search .btn-group,.form-inline .btn-group{display:inline-block}.form-search .input-append,.form-inline .input-append,.form-search .input-prepend,.form-inline .input-prepend{margin-bottom:0}.form-search .radio,.form-search .checkbox,.form-inline .radio,.form-inline .checkbox{padding-left:0;margin-bottom:0;vertical-align:middle}.form-search .radio input[type="radio"],.form-search .checkbox input[type="checkbox"],.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{float:left;margin-right:3px;margin-left:0}.control-group{margin-bottom:10px}legend+.control-group{margin-top:20px;-webkit-margin-top-collapse:separate}.form-horizontal .control-group{margin-bottom:20px;*zoom:1}.form-horizontal .control-group:before,.form-horizontal .control-group:after{display:table;line-height:0;content:""}.form-horizontal .control-group:after{clear:both}.form-horizontal .control-label{float:left;width:160px;padding-top:5px;text-align:right}.form-horizontal .controls{*display:inline-block;*padding-left:20px;margin-left:180px;*margin-left:0}.form-horizontal .controls:first-child{*padding-left:180px}.form-horizontal .help-block{margin-bottom:0}.form-horizontal input+.help-block,.form-horizontal select+.help-block,.form-horizontal textarea+.help-block{margin-top:10px}.form-horizontal .form-actions{padding-left:180px}table{max-width:100%;background-color:transparent;border-collapse:collapse;border-spacing:0}.table{width:100%;margin-bottom:20px}.table th,.table td{padding:8px;line-height:20px;text-align:left;vertical-align:top;border-top:1px solid #ddd}.table th{font-weight:bold}.table thead th{vertical-align:bottom}.table caption+thead tr:first-child th,.table caption+thead tr:first-child td,.table colgroup+thead tr:first-child th,.table colgroup+thead tr:first-child td,.table thead:first-child tr:first-child th,.table thead:first-child tr:first-child td{border-top:0}.table tbody+tbody{border-top:2px solid #ddd}.table-condensed th,.table-condensed td{padding:4px 5px}.table-bordered{border:1px solid #ddd;border-collapse:separate;*border-collapse:collapse;border-left:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.table-bordered th,.table-bordered td{border-left:1px solid #ddd}.table-bordered caption+thead tr:first-child th,.table-bordered caption+tbody tr:first-child th,.table-bordered caption+tbody tr:first-child td,.table-bordered colgroup+thead tr:first-child th,.table-bordered colgroup+tbody tr:first-child th,.table-bordered colgroup+tbody tr:first-child td,.table-bordered thead:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child td{border-top:0}.table-bordered thead:first-child tr:first-child th:first-child,.table-bordered tbody:first-child tr:first-child td:first-child{-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topleft:4px}.table-bordered thead:first-child tr:first-child th:last-child,.table-bordered tbody:first-child tr:first-child td:last-child{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-topright:4px}.table-bordered thead:last-child tr:last-child th:first-child,.table-bordered tbody:last-child tr:last-child td:first-child,.table-bordered tfoot:last-child tr:last-child td:first-child{-webkit-border-radius:0 0 0 4px;-moz-border-radius:0 0 0 4px;border-radius:0 0 0 4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px}.table-bordered thead:last-child tr:last-child th:last-child,.table-bordered tbody:last-child tr:last-child td:last-child,.table-bordered tfoot:last-child tr:last-child td:last-child{-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px}.table-bordered caption+thead tr:first-child th:first-child,.table-bordered caption+tbody tr:first-child td:first-child,.table-bordered colgroup+thead tr:first-child th:first-child,.table-bordered colgroup+tbody tr:first-child td:first-child{-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topleft:4px}.table-bordered caption+thead tr:first-child th:last-child,.table-bordered caption+tbody tr:first-child td:last-child,.table-bordered colgroup+thead tr:first-child th:last-child,.table-bordered colgroup+tbody tr:first-child td:last-child{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-topleft:4px}.table-striped tbody tr:nth-child(odd) td,.table-striped tbody tr:nth-child(odd) th{background-color:#f9f9f9}.table-hover tbody tr:hover td,.table-hover tbody tr:hover th{background-color:#f5f5f5}table [class*=span],.row-fluid table [class*=span]{display:table-cell;float:none;margin-left:0}.table .span1{float:none;width:44px;margin-left:0}.table .span2{float:none;width:124px;margin-left:0}.table .span3{float:none;width:204px;margin-left:0}.table .span4{float:none;width:284px;margin-left:0}.table .span5{float:none;width:364px;margin-left:0}.table .span6{float:none;width:444px;margin-left:0}.table .span7{float:none;width:524px;margin-left:0}.table .span8{float:none;width:604px;margin-left:0}.table .span9{float:none;width:684px;margin-left:0}.table .span10{float:none;width:764px;margin-left:0}.table .span11{float:none;width:844px;margin-left:0}.table .span12{float:none;width:924px;margin-left:0}.table .span13{float:none;width:1004px;margin-left:0}.table .span14{float:none;width:1084px;margin-left:0}.table .span15{float:none;width:1164px;margin-left:0}.table .span16{float:none;width:1244px;margin-left:0}.table .span17{float:none;width:1324px;margin-left:0}.table .span18{float:none;width:1404px;margin-left:0}.table .span19{float:none;width:1484px;margin-left:0}.table .span20{float:none;width:1564px;margin-left:0}.table .span21{float:none;width:1644px;margin-left:0}.table .span22{float:none;width:1724px;margin-left:0}.table .span23{float:none;width:1804px;margin-left:0}.table .span24{float:none;width:1884px;margin-left:0}.table tbody tr.success td{background-color:#dff0d8}.table tbody tr.error td{background-color:#f2dede}.table tbody tr.warning td{background-color:#fcf8e3}.table tbody tr.info td{background-color:#d9edf7}.table-hover tbody tr.success:hover td{background-color:#d0e9c6}.table-hover tbody tr.error:hover td{background-color:#ebcccc}.table-hover tbody tr.warning:hover td{background-color:#faf2cc}.table-hover tbody tr.info:hover td{background-color:#c4e3f3}[class^="icon-"],[class*=" icon-"]{display:inline-block;width:14px;height:14px;margin-top:1px;*margin-right:.3em;line-height:14px;vertical-align:text-top;background-image:url("../img/glyphicons-halflings.png");background-position:14px 14px;background-repeat:no-repeat}.icon-white,.nav-tabs>.active>a>[class^="icon-"],.nav-tabs>.active>a>[class*=" icon-"],.nav-pills>.active>a>[class^="icon-"],.nav-pills>.active>a>[class*=" icon-"],.nav-list>.active>a>[class^="icon-"],.nav-list>.active>a>[class*=" icon-"],.navbar-inverse .nav>.active>a>[class^="icon-"],.navbar-inverse .nav>.active>a>[class*=" icon-"],.dropdown-menu>li>a:hover>[class^="icon-"],.dropdown-menu>li>a:hover>[class*=" icon-"],.dropdown-menu>.active>a>[class^="icon-"],.dropdown-menu>.active>a>[class*=" icon-"]{background-image:url("../img/glyphicons-halflings-white.png")}.icon-glass{background-position:0 0}.icon-music{background-position:-24px 0}.icon-search{background-position:-48px 0}.icon-envelope{background-position:-72px 0}.icon-heart{background-position:-96px 0}.icon-star{background-position:-120px 0}.icon-star-empty{background-position:-144px 0}.icon-user{background-position:-168px 0}.icon-film{background-position:-192px 0}.icon-th-large{background-position:-216px 0}.icon-th{background-position:-240px 0}.icon-th-list{background-position:-264px 0}.icon-ok{background-position:-288px 0}.icon-remove{background-position:-312px 0}.icon-zoom-in{background-position:-336px 0}.icon-zoom-out{background-position:-360px 0}.icon-off{background-position:-384px 0}.icon-signal{background-position:-408px 0}.icon-cog{background-position:-432px 0}.icon-trash{background-position:-456px 0}.icon-home{background-position:0 -24px}.icon-file{background-position:-24px -24px}.icon-time{background-position:-48px -24px}.icon-road{background-position:-72px -24px}.icon-download-alt{background-position:-96px -24px}.icon-download{background-position:-120px -24px}.icon-upload{background-position:-144px -24px}.icon-inbox{background-position:-168px -24px}.icon-play-circle{background-position:-192px -24px}.icon-repeat{background-position:-216px -24px}.icon-refresh{background-position:-240px -24px}.icon-list-alt{background-position:-264px -24px}.icon-lock{background-position:-287px -24px}.icon-flag{background-position:-312px -24px}.icon-headphones{background-position:-336px -24px}.icon-volume-off{background-position:-360px -24px}.icon-volume-down{background-position:-384px -24px}.icon-volume-up{background-position:-408px -24px}.icon-qrcode{background-position:-432px -24px}.icon-barcode{background-position:-456px -24px}.icon-tag{background-position:0 -48px}.icon-tags{background-position:-25px -48px}.icon-book{background-position:-48px -48px}.icon-bookmark{background-position:-72px -48px}.icon-print{background-position:-96px -48px}.icon-camera{background-position:-120px -48px}.icon-font{background-position:-144px -48px}.icon-bold{background-position:-167px -48px}.icon-italic{background-position:-192px -48px}.icon-text-height{background-position:-216px -48px}.icon-text-width{background-position:-240px -48px}.icon-align-left{background-position:-264px -48px}.icon-align-center{background-position:-288px -48px}.icon-align-right{background-position:-312px -48px}.icon-align-justify{background-position:-336px -48px}.icon-list{background-position:-360px -48px}.icon-indent-left{background-position:-384px -48px}.icon-indent-right{background-position:-408px -48px}.icon-facetime-video{background-position:-432px -48px}.icon-picture{background-position:-456px -48px}.icon-pencil{background-position:0 -72px}.icon-map-marker{background-position:-24px -72px}.icon-adjust{background-position:-48px -72px}.icon-tint{background-position:-72px -72px}.icon-edit{background-position:-96px -72px}.icon-share{background-position:-120px -72px}.icon-check{background-position:-144px -72px}.icon-move{background-position:-168px -72px}.icon-step-backward{background-position:-192px -72px}.icon-fast-backward{background-position:-216px -72px}.icon-backward{background-position:-240px -72px}.icon-play{background-position:-264px -72px}.icon-pause{background-position:-288px -72px}.icon-stop{background-position:-312px -72px}.icon-forward{background-position:-336px -72px}.icon-fast-forward{background-position:-360px -72px}.icon-step-forward{background-position:-384px -72px}.icon-eject{background-position:-408px -72px}.icon-chevron-left{background-position:-432px -72px}.icon-chevron-right{background-position:-456px -72px}.icon-plus-sign{background-position:0 -96px}.icon-minus-sign{background-position:-24px -96px}.icon-remove-sign{background-position:-48px -96px}.icon-ok-sign{background-position:-72px -96px}.icon-question-sign{background-position:-96px -96px}.icon-info-sign{background-position:-120px -96px}.icon-screenshot{background-position:-144px -96px}.icon-remove-circle{background-position:-168px -96px}.icon-ok-circle{background-position:-192px -96px}.icon-ban-circle{background-position:-216px -96px}.icon-arrow-left{background-position:-240px -96px}.icon-arrow-right{background-position:-264px -96px}.icon-arrow-up{background-position:-289px -96px}.icon-arrow-down{background-position:-312px -96px}.icon-share-alt{background-position:-336px -96px}.icon-resize-full{background-position:-360px -96px}.icon-resize-small{background-position:-384px -96px}.icon-plus{background-position:-408px -96px}.icon-minus{background-position:-433px -96px}.icon-asterisk{background-position:-456px -96px}.icon-exclamation-sign{background-position:0 -120px}.icon-gift{background-position:-24px -120px}.icon-leaf{background-position:-48px -120px}.icon-fire{background-position:-72px -120px}.icon-eye-open{background-position:-96px -120px}.icon-eye-close{background-position:-120px -120px}.icon-warning-sign{background-position:-144px -120px}.icon-plane{background-position:-168px -120px}.icon-calendar{background-position:-192px -120px}.icon-random{width:16px;background-position:-216px -120px}.icon-comment{background-position:-240px -120px}.icon-magnet{background-position:-264px -120px}.icon-chevron-up{background-position:-288px -120px}.icon-chevron-down{background-position:-313px -119px}.icon-retweet{background-position:-336px -120px}.icon-shopping-cart{background-position:-360px -120px}.icon-folder-close{background-position:-384px -120px}.icon-folder-open{width:16px;background-position:-408px -120px}.icon-resize-vertical{background-position:-432px -119px}.icon-resize-horizontal{background-position:-456px -118px}.icon-hdd{background-position:0 -144px}.icon-bullhorn{background-position:-24px -144px}.icon-bell{background-position:-48px -144px}.icon-certificate{background-position:-72px -144px}.icon-thumbs-up{background-position:-96px -144px}.icon-thumbs-down{background-position:-120px -144px}.icon-hand-right{background-position:-144px -144px}.icon-hand-left{background-position:-168px -144px}.icon-hand-up{background-position:-192px -144px}.icon-hand-down{background-position:-216px -144px}.icon-circle-arrow-right{background-position:-240px -144px}.icon-circle-arrow-left{background-position:-264px -144px}.icon-circle-arrow-up{background-position:-288px -144px}.icon-circle-arrow-down{background-position:-312px -144px}.icon-globe{background-position:-336px -144px}.icon-wrench{background-position:-360px -144px}.icon-tasks{background-position:-384px -144px}.icon-filter{background-position:-408px -144px}.icon-briefcase{background-position:-432px -144px}.icon-fullscreen{background-position:-456px -144px}.dropup,.dropdown{position:relative}.dropdown-toggle{*margin-bottom:-3px}.dropdown-toggle:active,.open .dropdown-toggle{outline:0}.caret{display:inline-block;width:0;height:0;vertical-align:top;border-top:4px solid #000;border-right:4px solid transparent;border-left:4px solid transparent;content:""}.dropdown .caret{margin-top:8px;margin-left:2px}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);*border-right-width:2px;*border-bottom-width:2px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #fff}.dropdown-menu a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:20px;color:#333;white-space:nowrap}.dropdown-menu li>a:hover,.dropdown-menu li>a:focus,.dropdown-submenu:hover>a{color:#fff;text-decoration:none;background-color:#08c;background-color:#0081c2;background-image:-moz-linear-gradient(top,#08c,#0077b3);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#0077b3));background-image:-webkit-linear-gradient(top,#08c,#0077b3);background-image:-o-linear-gradient(top,#08c,#0077b3);background-image:linear-gradient(to bottom,#08c,#0077b3);background-repeat:repeat-x;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0077b3',GradientType=0)}.dropdown-menu .active>a,.dropdown-menu .active>a:hover{color:#fff;text-decoration:none;background-color:#08c;background-color:#0081c2;background-image:linear-gradient(to bottom,#08c,#0077b3);background-image:-moz-linear-gradient(top,#08c,#0077b3);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#0077b3));background-image:-webkit-linear-gradient(top,#08c,#0077b3);background-image:-o-linear-gradient(top,#08c,#0077b3);background-repeat:repeat-x;outline:0;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0077b3',GradientType=0)}.dropdown-menu .disabled>a,.dropdown-menu .disabled>a:hover{color:#999}.dropdown-menu .disabled>a:hover{text-decoration:none;cursor:default;background-color:transparent}.open{*z-index:1000}.open>.dropdown-menu{display:block}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid #000;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}.dropdown-submenu{position:relative}.dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:-6px;margin-left:-1px;-webkit-border-radius:0 6px 6px 6px;-moz-border-radius:0 6px 6px 6px;border-radius:0 6px 6px 6px}.dropdown-submenu:hover>.dropdown-menu{display:block}.dropdown-submenu>a:after{display:block;float:right;width:0;height:0;margin-top:5px;margin-right:-10px;border-color:transparent;border-left-color:#ccc;border-style:solid;border-width:5px 0 5px 5px;content:" "}.dropdown-submenu:hover>a:after{border-left-color:#fff}.dropdown .dropdown-menu .nav-header{padding-right:20px;padding-left:20px}.typeahead{margin-top:2px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);box-shadow:inset 0 1px 1px rgba(0,0,0,0.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,0.15)}.well-large{padding:24px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.well-small{padding:9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.fade{opacity:0;-webkit-transition:opacity .15s linear;-moz-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;-moz-transition:height .35s ease;-o-transition:height .35s ease;transition:height .35s ease}.collapse.in{height:auto}.close{float:right;font-size:20px;font-weight:bold;line-height:20px;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20)}.close:hover{color:#000;text-decoration:none;cursor:pointer;opacity:.4;filter:alpha(opacity=40)}button.close{padding:0;cursor:pointer;background:transparent;border:0;-webkit-appearance:none}.btn{display:inline-block;*display:inline;padding:4px 14px;margin-bottom:0;*margin-left:.3em;font-size:14px;line-height:20px;*line-height:20px;color:#333;text-align:center;text-shadow:0 1px 1px rgba(255,255,255,0.75);vertical-align:middle;cursor:pointer;background-color:#f5f5f5;*background-color:#e6e6e6;background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-repeat:repeat-x;border:1px solid #bbb;*border:0;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-bottom-color:#a2a2a2;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffe6e6e6',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false);*zoom:1;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05)}.btn:hover,.btn:active,.btn.active,.btn.disabled,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn:active,.btn.active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:hover{color:#333;text-decoration:none;background-color:#e6e6e6;*background-color:#d9d9d9;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.active,.btn:active{background-color:#e6e6e6;background-color:#d9d9d9 \9;background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05)}.btn.disabled,.btn[disabled]{cursor:default;background-color:#e6e6e6;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:9px 14px;font-size:16px;line-height:normal;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.btn-large [class^="icon-"]{margin-top:2px}.btn-small{padding:3px 9px;font-size:12px;line-height:18px}.btn-small [class^="icon-"]{margin-top:0}.btn-mini{padding:2px 6px;font-size:11px;line-height:17px}.btn-block{display:block;width:100%;padding-right:0;padding-left:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%}.btn-primary.active,.btn-warning.active,.btn-danger.active,.btn-success.active,.btn-info.active,.btn-inverse.active{color:rgba(255,255,255,0.75)}.btn{border-color:#c5c5c5;border-color:rgba(0,0,0,0.15) rgba(0,0,0,0.15) rgba(0,0,0,0.25)}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#006dcc;*background-color:#04c;background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-image:-moz-linear-gradient(top,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0044cc',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false)}.btn-primary:hover,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary:active,.btn-primary.active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#faa732;*background-color:#f89406;background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:dximagetransform.microsoft.gradient(startColorstr='#fffbb450',endColorstr='#fff89406',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false)}.btn-warning:hover,.btn-warning:active,.btn-warning.active,.btn-warning.disabled,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning:active,.btn-warning.active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#da4f49;*background-color:#bd362f;background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-repeat:repeat-x;border-color:#bd362f #bd362f #802420;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ffee5f5b',endColorstr='#ffbd362f',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false)}.btn-danger:hover,.btn-danger:active,.btn-danger.active,.btn-danger.disabled,.btn-danger[disabled]{color:#fff;background-color:#bd362f;*background-color:#a9302a}.btn-danger:active,.btn-danger.active{background-color:#942a25 \9}.btn-success{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#5bb75b;*background-color:#51a351;background-image:-webkit-gradient(linear,0 0,0 100%,from(#62c462),to(#51a351));background-image:-webkit-linear-gradient(top,#62c462,#51a351);background-image:-o-linear-gradient(top,#62c462,#51a351);background-image:linear-gradient(to bottom,#62c462,#51a351);background-image:-moz-linear-gradient(top,#62c462,#51a351);background-repeat:repeat-x;border-color:#51a351 #51a351 #387038;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff62c462',endColorstr='#ff51a351',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false)}.btn-success:hover,.btn-success:active,.btn-success.active,.btn-success.disabled,.btn-success[disabled]{color:#fff;background-color:#51a351;*background-color:#499249}.btn-success:active,.btn-success.active{background-color:#408140 \9}.btn-info{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#49afcd;*background-color:#2f96b4;background-image:-webkit-gradient(linear,0 0,0 100%,from(#5bc0de),to(#2f96b4));background-image:-webkit-linear-gradient(top,#5bc0de,#2f96b4);background-image:-o-linear-gradient(top,#5bc0de,#2f96b4);background-image:linear-gradient(to bottom,#5bc0de,#2f96b4);background-image:-moz-linear-gradient(top,#5bc0de,#2f96b4);background-repeat:repeat-x;border-color:#2f96b4 #2f96b4 #1f6377;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff5bc0de',endColorstr='#ff2f96b4',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false)}.btn-info:hover,.btn-info:active,.btn-info.active,.btn-info.disabled,.btn-info[disabled]{color:#fff;background-color:#2f96b4;*background-color:#2a85a0}.btn-info:active,.btn-info.active{background-color:#24748c \9}.btn-inverse{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#363636;*background-color:#222;background-image:-webkit-gradient(linear,0 0,0 100%,from(#444),to(#222));background-image:-webkit-linear-gradient(top,#444,#222);background-image:-o-linear-gradient(top,#444,#222);background-image:linear-gradient(to bottom,#444,#222);background-image:-moz-linear-gradient(top,#444,#222);background-repeat:repeat-x;border-color:#222 #222 #000;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff444444',endColorstr='#ff222222',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false)}.btn-inverse:hover,.btn-inverse:active,.btn-inverse.active,.btn-inverse.disabled,.btn-inverse[disabled]{color:#fff;background-color:#222;*background-color:#151515}.btn-inverse:active,.btn-inverse.active{background-color:#080808 \9}button.btn,input[type="submit"].btn{*padding-top:3px;*padding-bottom:3px}button.btn::-moz-focus-inner,input[type="submit"].btn::-moz-focus-inner{padding:0;border:0}button.btn.btn-large,input[type="submit"].btn.btn-large{*padding-top:7px;*padding-bottom:7px}button.btn.btn-small,input[type="submit"].btn.btn-small{*padding-top:3px;*padding-bottom:3px}button.btn.btn-mini,input[type="submit"].btn.btn-mini{*padding-top:1px;*padding-bottom:1px}.btn-link,.btn-link:active,.btn-link[disabled]{background-color:transparent;background-image:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-link{color:#08c;cursor:pointer;border-color:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-link:hover{color:#005580;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover{color:#333;text-decoration:none}.btn-group{position:relative;*margin-left:.3em;font-size:0;white-space:nowrap;vertical-align:middle}.btn-group:first-child{*margin-left:0}.btn-group+.btn-group{margin-left:5px}.btn-toolbar{margin-top:10px;margin-bottom:10px;font-size:0}.btn-toolbar .btn-group{display:inline-block;*display:inline;*zoom:1}.btn-toolbar .btn+.btn,.btn-toolbar .btn-group+.btn,.btn-toolbar .btn+.btn-group{margin-left:5px}.btn-group>.btn{position:relative;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-group>.btn+.btn{margin-left:-1px}.btn-group>.btn,.btn-group>.dropdown-menu{font-size:14px}.btn-group>.btn-mini{font-size:11px}.btn-group>.btn-small{font-size:12px}.btn-group>.btn-large{font-size:16px}.btn-group>.btn:first-child{margin-left:0;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-moz-border-radius-topleft:4px}.btn-group>.btn:last-child,.btn-group>.dropdown-toggle{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-bottomright:4px}.btn-group>.btn.large:first-child{margin-left:0;-webkit-border-bottom-left-radius:6px;border-bottom-left-radius:6px;-webkit-border-top-left-radius:6px;border-top-left-radius:6px;-moz-border-radius-bottomleft:6px;-moz-border-radius-topleft:6px}.btn-group>.btn.large:last-child,.btn-group>.large.dropdown-toggle{-webkit-border-top-right-radius:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;border-bottom-right-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:6px}.btn-group>.btn:hover,.btn-group>.btn:focus,.btn-group>.btn:active,.btn-group>.btn.active{z-index:2}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{*padding-top:5px;padding-right:8px;*padding-bottom:5px;padding-left:8px;-webkit-box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05)}.btn-group>.btn-mini+.dropdown-toggle{*padding-top:2px;padding-right:5px;*padding-bottom:2px;padding-left:5px}.btn-group>.btn-small+.dropdown-toggle{*padding-top:5px;*padding-bottom:4px}.btn-group>.btn-large+.dropdown-toggle{*padding-top:7px;padding-right:12px;*padding-bottom:7px;padding-left:12px}.btn-group.open .dropdown-toggle{background-image:none;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05)}.btn-group.open .btn.dropdown-toggle{background-color:#e6e6e6}.btn-group.open .btn-primary.dropdown-toggle{background-color:#04c}.btn-group.open .btn-warning.dropdown-toggle{background-color:#f89406}.btn-group.open .btn-danger.dropdown-toggle{background-color:#bd362f}.btn-group.open .btn-success.dropdown-toggle{background-color:#51a351}.btn-group.open .btn-info.dropdown-toggle{background-color:#2f96b4}.btn-group.open .btn-inverse.dropdown-toggle{background-color:#222}.btn .caret{margin-top:8px;margin-left:0}.btn-mini .caret,.btn-small .caret,.btn-large .caret{margin-top:6px}.btn-large .caret{border-top-width:5px;border-right-width:5px;border-left-width:5px}.dropup .btn-large .caret{border-top:0;border-bottom:5px solid #000}.btn-primary .caret,.btn-warning .caret,.btn-danger .caret,.btn-info .caret,.btn-success .caret,.btn-inverse .caret{border-top-color:#fff;border-bottom-color:#fff}.btn-group-vertical{display:inline-block;*display:inline;*zoom:1}.btn-group-vertical .btn{display:block;float:none;width:100%;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-group-vertical .btn+.btn{margin-top:-1px;margin-left:0}.btn-group-vertical .btn:first-child{-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0}.btn-group-vertical .btn:last-child{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px}.btn-group-vertical .btn-large:first-child{-webkit-border-radius:6px 6px 0 0;-moz-border-radius:6px 6px 0 0;border-radius:6px 6px 0 0}.btn-group-vertical .btn-large:last-child{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.alert{padding:8px 35px 8px 14px;margin-bottom:20px;color:#c09853;text-shadow:0 1px 0 rgba(255,255,255,0.5);background-color:#fcf8e3;border:1px solid #fbeed5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.alert h4{margin:0}.alert .close{position:relative;top:-2px;right:-21px;line-height:20px}.alert-success{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.alert-danger,.alert-error{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.alert-info{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.alert-block{padding-top:14px;padding-bottom:14px}.alert-block>p,.alert-block>ul{margin-bottom:0}.alert-block p+p{margin-top:5px}.nav{margin-bottom:20px;margin-left:0;list-style:none}.nav>li>a{display:block}.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>.pull-right{float:right}.nav-header{display:block;padding:3px 15px;font-size:11px;font-weight:bold;line-height:20px;color:#999;text-shadow:0 1px 0 rgba(255,255,255,0.5);text-transform:uppercase}.nav li+.nav-header{margin-top:9px}.nav-list{padding-right:15px;padding-left:15px;margin-bottom:0}.nav-list>li>a,.nav-list .nav-header{margin-right:-15px;margin-left:-15px;text-shadow:0 1px 0 rgba(255,255,255,0.5)}.nav-list>li>a{padding:3px 15px}.nav-list>.active>a,.nav-list>.active>a:hover{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.2);background-color:#08c}.nav-list [class^="icon-"]{margin-right:2px}.nav-list .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #fff}.nav-tabs,.nav-pills{*zoom:1}.nav-tabs:before,.nav-pills:before,.nav-tabs:after,.nav-pills:after{display:table;line-height:0;content:""}.nav-tabs:after,.nav-pills:after{clear:both}.nav-tabs>li,.nav-pills>li{float:left}.nav-tabs>li>a,.nav-pills>li>a{padding-right:12px;padding-left:12px;margin-right:2px;line-height:14px}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{margin-bottom:-1px}.nav-tabs>li>a{padding-top:8px;padding-bottom:8px;line-height:20px;border:1px solid transparent;-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>.active>a,.nav-tabs>.active>a:hover{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-pills>li>a{padding-top:8px;padding-bottom:8px;margin-top:2px;margin-bottom:2px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.nav-pills>.active>a,.nav-pills>.active>a:hover{color:#fff;background-color:#08c}.nav-stacked>li{float:none}.nav-stacked>li>a{margin-right:0}.nav-tabs.nav-stacked{border-bottom:0}.nav-tabs.nav-stacked>li>a{border:1px solid #ddd;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.nav-tabs.nav-stacked>li:first-child>a{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-topleft:4px}.nav-tabs.nav-stacked>li:last-child>a{-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomright:4px;-moz-border-radius-bottomleft:4px}.nav-tabs.nav-stacked>li>a:hover{z-index:2;border-color:#ddd}.nav-pills.nav-stacked>li>a{margin-bottom:3px}.nav-pills.nav-stacked>li:last-child>a{margin-bottom:1px}.nav-tabs .dropdown-menu{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.nav-pills .dropdown-menu{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.nav .dropdown-toggle .caret{margin-top:6px;border-top-color:#08c;border-bottom-color:#08c}.nav .dropdown-toggle:hover .caret{border-top-color:#005580;border-bottom-color:#005580}.nav-tabs .dropdown-toggle .caret{margin-top:8px}.nav .active .dropdown-toggle .caret{border-top-color:#fff;border-bottom-color:#fff}.nav-tabs .active .dropdown-toggle .caret{border-top-color:#555;border-bottom-color:#555}.nav>.dropdown.active>a:hover{cursor:pointer}.nav-tabs .open .dropdown-toggle,.nav-pills .open .dropdown-toggle,.nav>li.dropdown.open.active>a:hover{color:#fff;background-color:#999;border-color:#999}.nav li.dropdown.open .caret,.nav li.dropdown.open.active .caret,.nav li.dropdown.open a:hover .caret{border-top-color:#fff;border-bottom-color:#fff;opacity:1;filter:alpha(opacity=100)}.tabs-stacked .open>a:hover{border-color:#999}.tabbable{*zoom:1}.tabbable:before,.tabbable:after{display:table;line-height:0;content:""}.tabbable:after{clear:both}.tab-content{overflow:auto}.tabs-below>.nav-tabs,.tabs-right>.nav-tabs,.tabs-left>.nav-tabs{border-bottom:0}.tab-content>.tab-pane,.pill-content>.pill-pane{display:none}.tab-content>.active,.pill-content>.active{display:block}.tabs-below>.nav-tabs{border-top:1px solid #ddd}.tabs-below>.nav-tabs>li{margin-top:-1px;margin-bottom:0}.tabs-below>.nav-tabs>li>a{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px}.tabs-below>.nav-tabs>li>a:hover{border-top-color:#ddd;border-bottom-color:transparent}.tabs-below>.nav-tabs>.active>a,.tabs-below>.nav-tabs>.active>a:hover{border-color:transparent #ddd #ddd #ddd}.tabs-left>.nav-tabs>li,.tabs-right>.nav-tabs>li{float:none}.tabs-left>.nav-tabs>li>a,.tabs-right>.nav-tabs>li>a{min-width:74px;margin-right:0;margin-bottom:3px}.tabs-left>.nav-tabs{float:left;margin-right:19px;border-right:1px solid #ddd}.tabs-left>.nav-tabs>li>a{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.tabs-left>.nav-tabs>li>a:hover{border-color:#eee #ddd #eee #eee}.tabs-left>.nav-tabs .active>a,.tabs-left>.nav-tabs .active>a:hover{border-color:#ddd transparent #ddd #ddd;*border-right-color:#fff}.tabs-right>.nav-tabs{float:right;margin-left:19px;border-left:1px solid #ddd}.tabs-right>.nav-tabs>li>a{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.tabs-right>.nav-tabs>li>a:hover{border-color:#eee #eee #eee #ddd}.tabs-right>.nav-tabs .active>a,.tabs-right>.nav-tabs .active>a:hover{border-color:#ddd #ddd #ddd transparent;*border-left-color:#fff}.nav>.disabled>a{color:#999}.nav>.disabled>a:hover{text-decoration:none;cursor:default;background-color:transparent}.navbar{*position:relative;*z-index:2;margin-bottom:20px;overflow:visible;color:#777}.navbar-inner{min-height:40px;padding-right:20px;padding-left:20px;background-color:#fafafa;background-image:-moz-linear-gradient(top,#fff,#f2f2f2);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#f2f2f2));background-image:-webkit-linear-gradient(top,#fff,#f2f2f2);background-image:-o-linear-gradient(top,#fff,#f2f2f2);background-image:linear-gradient(to bottom,#fff,#f2f2f2);background-repeat:repeat-x;border:1px solid #d4d4d4;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ffffffff',endColorstr='#fff2f2f2',GradientType=0);*zoom:1;-webkit-box-shadow:0 1px 4px rgba(0,0,0,0.065);-moz-box-shadow:0 1px 4px rgba(0,0,0,0.065);box-shadow:0 1px 4px rgba(0,0,0,0.065)}.navbar-inner:before,.navbar-inner:after{display:table;line-height:0;content:""}.navbar-inner:after{clear:both}.navbar .container{width:auto}.nav-collapse.collapse{height:auto}.navbar .brand{display:block;float:left;padding:10px 20px 10px;margin-left:-20px;font-size:20px;font-weight:200;color:#777;text-shadow:0 1px 0 #fff}.navbar .brand:hover{text-decoration:none}.navbar-text{margin-bottom:0;line-height:40px}.navbar-link{color:#777}.navbar-link:hover{color:#333}.navbar .divider-vertical{height:40px;margin:0 9px;border-right:1px solid #fff;border-left:1px solid #f2f2f2}.navbar .btn,.navbar .btn-group{margin-top:5px}.navbar .btn-group .btn,.navbar .input-prepend .btn,.navbar .input-append .btn{margin-top:0}.navbar-form{margin-bottom:0;*zoom:1}.navbar-form:before,.navbar-form:after{display:table;line-height:0;content:""}.navbar-form:after{clear:both}.navbar-form input,.navbar-form select,.navbar-form .radio,.navbar-form .checkbox{margin-top:5px}.navbar-form input,.navbar-form select,.navbar-form .btn{display:inline-block;margin-bottom:0}.navbar-form input[type="image"],.navbar-form input[type="checkbox"],.navbar-form input[type="radio"]{margin-top:3px}.navbar-form .input-append,.navbar-form .input-prepend{margin-top:6px;white-space:nowrap}.navbar-form .input-append input,.navbar-form .input-prepend input{margin-top:0}.navbar-search{position:relative;float:left;margin-top:5px;margin-bottom:0}.navbar-search .search-query{padding:4px 14px;margin-bottom:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;font-weight:normal;line-height:1;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.navbar-static-top{position:static;width:100%;margin-bottom:0}.navbar-static-top .navbar-inner{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030;margin-bottom:0}.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{border-width:0 0 1px}.navbar-fixed-bottom .navbar-inner{border-width:1px 0 0}.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding-right:0;padding-left:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px}.navbar-fixed-top{top:0}.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.1),0 1px 10px rgba(0,0,0,0.1);-moz-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.1),0 1px 10px rgba(0,0,0,0.1);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.1),0 1px 10px rgba(0,0,0,0.1)}.navbar-fixed-bottom{bottom:0}.navbar-fixed-bottom .navbar-inner{-webkit-box-shadow:inset 0 1px 0 rgba(0,0,0,0.1),0 -1px 10px rgba(0,0,0,0.1);-moz-box-shadow:inset 0 1px 0 rgba(0,0,0,0.1),0 -1px 10px rgba(0,0,0,0.1);box-shadow:inset 0 1px 0 rgba(0,0,0,0.1),0 -1px 10px rgba(0,0,0,0.1)}.navbar .nav{position:relative;left:0;display:block;float:left;margin:0 10px 0 0}.navbar .nav.pull-right{float:right;margin-right:0}.navbar .nav>li{float:left}.navbar .nav>li>a{float:none;padding:10px 15px 10px;color:#777;text-decoration:none;text-shadow:0 1px 0 #fff}.navbar .nav .dropdown-toggle .caret{margin-top:8px}.navbar .nav>li>a:focus,.navbar .nav>li>a:hover{color:#333;text-decoration:none;background-color:transparent}.navbar .nav>.active>a,.navbar .nav>.active>a:hover,.navbar .nav>.active>a:focus{color:#555;text-decoration:none;background-color:#e5e5e5;-webkit-box-shadow:inset 0 3px 8px rgba(0,0,0,0.125);-moz-box-shadow:inset 0 3px 8px rgba(0,0,0,0.125);box-shadow:inset 0 3px 8px rgba(0,0,0,0.125)}.navbar .btn-navbar{display:none;float:right;padding:7px 10px;margin-right:5px;margin-left:5px;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#ededed;*background-color:#e5e5e5;background-image:-webkit-gradient(linear,0 0,0 100%,from(#f2f2f2),to(#e5e5e5));background-image:-webkit-linear-gradient(top,#f2f2f2,#e5e5e5);background-image:-o-linear-gradient(top,#f2f2f2,#e5e5e5);background-image:linear-gradient(to bottom,#f2f2f2,#e5e5e5);background-image:-moz-linear-gradient(top,#f2f2f2,#e5e5e5);background-repeat:repeat-x;border-color:#e5e5e5 #e5e5e5 #bfbfbf;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:dximagetransform.microsoft.gradient(startColorstr='#fff2f2f2',endColorstr='#ffe5e5e5',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075)}.navbar .btn-navbar:hover,.navbar .btn-navbar:active,.navbar .btn-navbar.active,.navbar .btn-navbar.disabled,.navbar .btn-navbar[disabled]{color:#fff;background-color:#e5e5e5;*background-color:#d9d9d9}.navbar .btn-navbar:active,.navbar .btn-navbar.active{background-color:#ccc \9}.navbar .btn-navbar .icon-bar{display:block;width:18px;height:2px;background-color:#f5f5f5;-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,0.25);-moz-box-shadow:0 1px 0 rgba(0,0,0,0.25);box-shadow:0 1px 0 rgba(0,0,0,0.25)}.btn-navbar .icon-bar+.icon-bar{margin-top:3px}.navbar .nav>li>.dropdown-menu:before{position:absolute;top:-7px;left:9px;display:inline-block;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-left:7px solid transparent;border-bottom-color:rgba(0,0,0,0.2);content:''}.navbar .nav>li>.dropdown-menu:after{position:absolute;top:-6px;left:10px;display:inline-block;border-right:6px solid transparent;border-bottom:6px solid #fff;border-left:6px solid transparent;content:''}.navbar-fixed-bottom .nav>li>.dropdown-menu:before{top:auto;bottom:-7px;border-top:7px solid #ccc;border-bottom:0;border-top-color:rgba(0,0,0,0.2)}.navbar-fixed-bottom .nav>li>.dropdown-menu:after{top:auto;bottom:-6px;border-top:6px solid #fff;border-bottom:0}.navbar .nav li.dropdown.open>.dropdown-toggle,.navbar .nav li.dropdown.active>.dropdown-toggle,.navbar .nav li.dropdown.open.active>.dropdown-toggle{color:#555;background-color:#e5e5e5}.navbar .nav li.dropdown>.dropdown-toggle .caret{border-top-color:#777;border-bottom-color:#777}.navbar .nav li.dropdown.open>.dropdown-toggle .caret,.navbar .nav li.dropdown.active>.dropdown-toggle .caret,.navbar .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#555;border-bottom-color:#555}.navbar .pull-right>li>.dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right{right:0;left:auto}.navbar .pull-right>li>.dropdown-menu:before,.navbar .nav>li>.dropdown-menu.pull-right:before{right:12px;left:auto}.navbar .pull-right>li>.dropdown-menu:after,.navbar .nav>li>.dropdown-menu.pull-right:after{right:13px;left:auto}.navbar .pull-right>li>.dropdown-menu .dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right .dropdown-menu{right:100%;left:auto;margin-right:-1px;margin-left:0;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px}.navbar-inverse{color:#999}.navbar-inverse .navbar-inner{background-color:#1b1b1b;background-image:-moz-linear-gradient(top,#222,#111);background-image:-webkit-gradient(linear,0 0,0 100%,from(#222),to(#111));background-image:-webkit-linear-gradient(top,#222,#111);background-image:-o-linear-gradient(top,#222,#111);background-image:linear-gradient(to bottom,#222,#111);background-repeat:repeat-x;border-color:#252525;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff222222',endColorstr='#ff111111',GradientType=0)}.navbar-inverse .brand,.navbar-inverse .nav>li>a{color:#999;text-shadow:0 -1px 0 rgba(0,0,0,0.25)}.navbar-inverse .brand:hover,.navbar-inverse .nav>li>a:hover{color:#fff}.navbar-inverse .nav>li>a:focus,.navbar-inverse .nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .nav .active>a,.navbar-inverse .nav .active>a:hover,.navbar-inverse .nav .active>a:focus{color:#fff;background-color:#111}.navbar-inverse .navbar-link{color:#999}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .divider-vertical{border-right-color:#222;border-left-color:#111}.navbar-inverse .nav li.dropdown.open>.dropdown-toggle,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle{color:#fff;background-color:#111}.navbar-inverse .nav li.dropdown>.dropdown-toggle .caret{border-top-color:#999;border-bottom-color:#999}.navbar-inverse .nav li.dropdown.open>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#fff;border-bottom-color:#fff}.navbar-inverse .navbar-search .search-query{color:#fff;background-color:#515151;border-color:#111;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);-webkit-transition:none;-moz-transition:none;-o-transition:none;transition:none}.navbar-inverse .navbar-search .search-query:-moz-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query:-ms-input-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query::-webkit-input-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query:focus,.navbar-inverse .navbar-search .search-query.focused{padding:5px 15px;color:#333;text-shadow:0 1px 0 #fff;background-color:#fff;border:0;outline:0;-webkit-box-shadow:0 0 3px rgba(0,0,0,0.15);-moz-box-shadow:0 0 3px rgba(0,0,0,0.15);box-shadow:0 0 3px rgba(0,0,0,0.15)}.navbar-inverse .btn-navbar{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#0e0e0e;*background-color:#040404;background-image:-webkit-gradient(linear,0 0,0 100%,from(#151515),to(#040404));background-image:-webkit-linear-gradient(top,#151515,#040404);background-image:-o-linear-gradient(top,#151515,#040404);background-image:linear-gradient(to bottom,#151515,#040404);background-image:-moz-linear-gradient(top,#151515,#040404);background-repeat:repeat-x;border-color:#040404 #040404 #000;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff151515',endColorstr='#ff040404',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false)}.navbar-inverse .btn-navbar:hover,.navbar-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active,.navbar-inverse .btn-navbar.disabled,.navbar-inverse .btn-navbar[disabled]{color:#fff;background-color:#040404;*background-color:#000}.navbar-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active{background-color:#000 \9}.breadcrumb{padding:8px 15px;margin:0 0 20px;list-style:none;background-color:#f5f5f5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.breadcrumb li{display:inline-block;*display:inline;text-shadow:0 1px 0 #fff;*zoom:1}.breadcrumb .divider{padding:0 5px;color:#ccc}.breadcrumb .active{color:#999}.pagination{height:40px;margin:20px 0}.pagination ul{display:inline-block;*display:inline;margin-bottom:0;margin-left:0;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;*zoom:1;-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:0 1px 2px rgba(0,0,0,0.05);box-shadow:0 1px 2px rgba(0,0,0,0.05)}.pagination ul>li{display:inline}.pagination ul>li>a,.pagination ul>li>span{float:left;padding:0 14px;line-height:38px;text-decoration:none;background-color:#fff;border:1px solid #ddd;border-left-width:0}.pagination ul>li>a:hover,.pagination ul>.active>a,.pagination ul>.active>span{background-color:#f5f5f5}.pagination ul>.active>a,.pagination ul>.active>span{color:#999;cursor:default}.pagination ul>.disabled>span,.pagination ul>.disabled>a,.pagination ul>.disabled>a:hover{color:#999;cursor:default;background-color:transparent}.pagination ul>li:first-child>a,.pagination ul>li:first-child>span{border-left-width:1px;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.pagination ul>li:last-child>a,.pagination ul>li:last-child>span{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}.pagination-centered{text-align:center}.pagination-right{text-align:right}.pager{margin:20px 0;text-align:center;list-style:none;*zoom:1}.pager:before,.pager:after{display:table;line-height:0;content:""}.pager:after{clear:both}.pager li{display:inline}.pager a,.pager span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.pager a:hover{text-decoration:none;background-color:#f5f5f5}.pager .next a,.pager .next span{float:right}.pager .previous a{float:left}.pager .disabled a,.pager .disabled a:hover,.pager .disabled span{color:#999;cursor:default;background-color:#fff}.modal-open .modal .dropdown-menu{z-index:2050}.modal-open .modal .dropdown.open{*z-index:2050}.modal-open .modal .popover{z-index:2060}.modal-open .modal .tooltip{z-index:2080}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{opacity:0}.modal-backdrop,.modal-backdrop.fade.in{opacity:.8;filter:alpha(opacity=80)}.modal{position:fixed;top:50%;left:50%;z-index:1050;width:560px;margin:-250px 0 0 -280px;overflow:auto;background-color:#fff;border:1px solid #999;border:1px solid rgba(0,0,0,0.3);*border:1px solid #999;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0,0,0,0.3);-moz-box-shadow:0 3px 7px rgba(0,0,0,0.3);box-shadow:0 3px 7px rgba(0,0,0,0.3);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box}.modal.fade{top:-25%;-webkit-transition:opacity .3s linear,top .3s ease-out;-moz-transition:opacity .3s linear,top .3s ease-out;-o-transition:opacity .3s linear,top .3s ease-out;transition:opacity .3s linear,top .3s ease-out}.modal.fade.in{top:50%}.modal-header{padding:9px 15px;border-bottom:1px solid #eee}.modal-header .close{margin-top:2px}.modal-header h3{margin:0;line-height:30px}.modal-body{max-height:400px;padding:15px;overflow-y:auto}.modal-form{margin-bottom:0}.modal-footer{padding:14px 15px 15px;margin-bottom:0;text-align:right;background-color:#f5f5f5;border-top:1px solid #ddd;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;*zoom:1;-webkit-box-shadow:inset 0 1px 0 #fff;-moz-box-shadow:inset 0 1px 0 #fff;box-shadow:inset 0 1px 0 #fff}.modal-footer:before,.modal-footer:after{display:table;line-height:0;content:""}.modal-footer:after{clear:both}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.tooltip{position:absolute;z-index:1030;display:block;padding:5px;font-size:11px;opacity:0;filter:alpha(opacity=0);visibility:visible}.tooltip.in{opacity:.8;filter:alpha(opacity=80)}.tooltip.top{margin-top:-3px}.tooltip.right{margin-left:3px}.tooltip.bottom{margin-top:3px}.tooltip.left{margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-top-color:#000;border-width:5px 5px 0}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-right-color:#000;border-width:5px 5px 5px 0}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-left-color:#000;border-width:5px 0 5px 5px}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-bottom-color:#000;border-width:0 5px 5px}.popover{position:absolute;top:0;left:0;z-index:1010;display:none;width:236px;padding:1px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}.popover.top{margin-bottom:10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-right:10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;font-weight:normal;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover-content p,.popover-content ul,.popover-content ol{margin-bottom:0}.popover .arrow,.popover .arrow:after{position:absolute;display:inline-block;width:0;height:0;border-color:transparent;border-style:solid}.popover .arrow:after{z-index:-1;content:""}.popover.top .arrow{bottom:-10px;left:50%;margin-left:-10px;border-top-color:#fff;border-width:10px 10px 0}.popover.top .arrow:after{bottom:-1px;left:-11px;border-top-color:rgba(0,0,0,0.25);border-width:11px 11px 0}.popover.right .arrow{top:50%;left:-10px;margin-top:-10px;border-right-color:#fff;border-width:10px 10px 10px 0}.popover.right .arrow:after{bottom:-11px;left:-1px;border-right-color:rgba(0,0,0,0.25);border-width:11px 11px 11px 0}.popover.bottom .arrow{top:-10px;left:50%;margin-left:-10px;border-bottom-color:#fff;border-width:0 10px 10px}.popover.bottom .arrow:after{top:-1px;left:-11px;border-bottom-color:rgba(0,0,0,0.25);border-width:0 11px 11px}.popover.left .arrow{top:50%;right:-10px;margin-top:-10px;border-left-color:#fff;border-width:10px 0 10px 10px}.popover.left .arrow:after{right:-1px;bottom:-11px;border-left-color:rgba(0,0,0,0.25);border-width:11px 0 11px 11px}.thumbnails{margin-left:-20px;list-style:none;*zoom:1}.thumbnails:before,.thumbnails:after{display:table;line-height:0;content:""}.thumbnails:after{clear:both}.row-fluid .thumbnails{margin-left:0}.thumbnails>li{float:left;margin-bottom:20px;margin-left:20px}.thumbnail{display:block;padding:4px;line-height:20px;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.055);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.055);box-shadow:0 1px 3px rgba(0,0,0,0.055);-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}a.thumbnail:hover{border-color:#08c;-webkit-box-shadow:0 1px 4px rgba(0,105,214,0.25);-moz-box-shadow:0 1px 4px rgba(0,105,214,0.25);box-shadow:0 1px 4px rgba(0,105,214,0.25)}.thumbnail>img{display:block;max-width:100%;margin-right:auto;margin-left:auto}.thumbnail .caption{padding:9px;color:#555}.label,.badge{font-size:11.844px;font-weight:bold;line-height:14px;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);white-space:nowrap;vertical-align:baseline;background-color:#999}.label{padding:1px 4px 2px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.badge{padding:1px 9px 2px;-webkit-border-radius:9px;-moz-border-radius:9px;border-radius:9px}a.label:hover,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.label-important,.badge-important{background-color:#b94a48}.label-important[href],.badge-important[href]{background-color:#953b39}.label-warning,.badge-warning{background-color:#f89406}.label-warning[href],.badge-warning[href]{background-color:#c67605}.label-success,.badge-success{background-color:#468847}.label-success[href],.badge-success[href]{background-color:#356635}.label-info,.badge-info{background-color:#3a87ad}.label-info[href],.badge-info[href]{background-color:#2d6987}.label-inverse,.badge-inverse{background-color:#333}.label-inverse[href],.badge-inverse[href]{background-color:#1a1a1a}.btn .label,.btn .badge{position:relative;top:-1px}.btn-mini .label,.btn-mini .badge{top:0}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-moz-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-ms-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:0 0}to{background-position:40px 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f7f7f7;background-image:-moz-linear-gradient(top,#f5f5f5,#f9f9f9);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f5f5f5),to(#f9f9f9));background-image:-webkit-linear-gradient(top,#f5f5f5,#f9f9f9);background-image:-o-linear-gradient(top,#f5f5f5,#f9f9f9);background-image:linear-gradient(to bottom,#f5f5f5,#f9f9f9);background-repeat:repeat-x;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#fff5f5f5',endColorstr='#fff9f9f9',GradientType=0);-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1)}.progress .bar{float:left;width:0;height:100%;font-size:12px;color:#fff;text-align:center;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#0e90d2;background-image:-moz-linear-gradient(top,#149bdf,#0480be);background-image:-webkit-gradient(linear,0 0,0 100%,from(#149bdf),to(#0480be));background-image:-webkit-linear-gradient(top,#149bdf,#0480be);background-image:-o-linear-gradient(top,#149bdf,#0480be);background-image:linear-gradient(to bottom,#149bdf,#0480be);background-repeat:repeat-x;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff149bdf',endColorstr='#ff0480be',GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-moz-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:width .6s ease;-moz-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress .bar+.bar{-webkit-box-shadow:inset 1px 0 0 rgba(0,0,0,0.15),inset 0 -1px 0 rgba(0,0,0,0.15);-moz-box-shadow:inset 1px 0 0 rgba(0,0,0,0.15),inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 1px 0 0 rgba(0,0,0,0.15),inset 0 -1px 0 rgba(0,0,0,0.15)}.progress-striped .bar{background-color:#149bdf;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;-moz-background-size:40px 40px;-o-background-size:40px 40px;background-size:40px 40px}.progress.active .bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-moz-animation:progress-bar-stripes 2s linear infinite;-ms-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-danger .bar,.progress .bar-danger{background-color:#dd514c;background-image:-moz-linear-gradient(top,#ee5f5b,#c43c35);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#c43c35));background-image:-webkit-linear-gradient(top,#ee5f5b,#c43c35);background-image:-o-linear-gradient(top,#ee5f5b,#c43c35);background-image:linear-gradient(to bottom,#ee5f5b,#c43c35);background-repeat:repeat-x;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ffee5f5b',endColorstr='#ffc43c35',GradientType=0)}.progress-danger.progress-striped .bar,.progress-striped .bar-danger{background-color:#ee5f5b;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-success .bar,.progress .bar-success{background-color:#5eb95e;background-image:-moz-linear-gradient(top,#62c462,#57a957);background-image:-webkit-gradient(linear,0 0,0 100%,from(#62c462),to(#57a957));background-image:-webkit-linear-gradient(top,#62c462,#57a957);background-image:-o-linear-gradient(top,#62c462,#57a957);background-image:linear-gradient(to bottom,#62c462,#57a957);background-repeat:repeat-x;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff62c462',endColorstr='#ff57a957',GradientType=0)}.progress-success.progress-striped .bar,.progress-striped .bar-success{background-color:#62c462;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-info .bar,.progress .bar-info{background-color:#4bb1cf;background-image:-moz-linear-gradient(top,#5bc0de,#339bb9);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5bc0de),to(#339bb9));background-image:-webkit-linear-gradient(top,#5bc0de,#339bb9);background-image:-o-linear-gradient(top,#5bc0de,#339bb9);background-image:linear-gradient(to bottom,#5bc0de,#339bb9);background-repeat:repeat-x;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff5bc0de',endColorstr='#ff339bb9',GradientType=0)}.progress-info.progress-striped .bar,.progress-striped .bar-info{background-color:#5bc0de;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-warning .bar,.progress .bar-warning{background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#fffbb450',endColorstr='#fff89406',GradientType=0)}.progress-warning.progress-striped .bar,.progress-striped .bar-warning{background-color:#fbb450;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.accordion{margin-bottom:20px}.accordion-group{margin-bottom:2px;border:1px solid #e5e5e5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.accordion-heading{border-bottom:0}.accordion-heading .accordion-toggle{display:block;padding:8px 15px}.accordion-toggle{cursor:pointer}.accordion-inner{padding:9px 15px;border-top:1px solid #e5e5e5}.carousel{position:relative;margin-bottom:20px;line-height:1}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel .item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-moz-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel .item>img{display:block;line-height:1}.carousel .active,.carousel .next,.carousel .prev{display:block}.carousel .active{left:0}.carousel .next,.carousel .prev{position:absolute;top:0;width:100%}.carousel .next{left:100%}.carousel .prev{left:-100%}.carousel .next.left,.carousel .prev.right{left:0}.carousel .active.left{left:-100%}.carousel .active.right{left:100%}.carousel-control{position:absolute;top:40%;left:15px;width:40px;height:40px;margin-top:-20px;font-size:60px;font-weight:100;line-height:30px;color:#fff;text-align:center;background:#222;border:3px solid #fff;-webkit-border-radius:23px;-moz-border-radius:23px;border-radius:23px;opacity:.5;filter:alpha(opacity=50)}.carousel-control.right{right:15px;left:auto}.carousel-control:hover{color:#fff;text-decoration:none;opacity:.9;filter:alpha(opacity=90)}.carousel-caption{position:absolute;right:0;bottom:0;left:0;padding:15px;background:#333;background:rgba(0,0,0,0.75)}.carousel-caption h4,.carousel-caption p{line-height:20px;color:#fff}.carousel-caption h4{margin:0 0 5px}.carousel-caption p{margin-bottom:0}.hero-unit{padding:60px;margin-bottom:30px;background-color:#eee;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.hero-unit h1{margin-bottom:0;font-size:60px;line-height:1;letter-spacing:-1px;color:inherit}.hero-unit p{font-size:18px;font-weight:200;line-height:30px;color:inherit}.pull-right{float:right}.pull-left{float:left}.hide{display:none}.show{display:block}.invisible{visibility:hidden}.affix{position:fixed} diff --git a/Website/LOC.Website.Web/Content/img/Untitled-2.psd b/Website/LOC.Website.Web/Content/img/Untitled-2.psd new file mode 100644 index 000000000..fbe3ca9d1 Binary files /dev/null and b/Website/LOC.Website.Web/Content/img/Untitled-2.psd differ diff --git a/Website/LOC.Website.Web/Content/img/glyphicons-halflings-white.png b/Website/LOC.Website.Web/Content/img/glyphicons-halflings-white.png new file mode 100644 index 000000000..3bf6484a2 Binary files /dev/null and b/Website/LOC.Website.Web/Content/img/glyphicons-halflings-white.png differ diff --git a/Website/LOC.Website.Web/Content/img/glyphicons-halflings.png b/Website/LOC.Website.Web/Content/img/glyphicons-halflings.png new file mode 100644 index 000000000..a99699932 Binary files /dev/null and b/Website/LOC.Website.Web/Content/img/glyphicons-halflings.png differ diff --git a/Website/LOC.Website.Web/Content/img/logobtntest.png b/Website/LOC.Website.Web/Content/img/logobtntest.png new file mode 100644 index 000000000..95aa3efdb Binary files /dev/null and b/Website/LOC.Website.Web/Content/img/logobtntest.png differ diff --git a/Website/LOC.Website.Web/Content/js/bootstrap.js b/Website/LOC.Website.Web/Content/js/bootstrap.js new file mode 100644 index 000000000..a8ca2a891 --- /dev/null +++ b/Website/LOC.Website.Web/Content/js/bootstrap.js @@ -0,0 +1,2287 @@ +/* =================================================== + * bootstrap-transition.js v2.3.1 + * http://twitter.github.com/bootstrap/javascript.html#transitions + * =================================================== + * Copyright 2012 Twitter, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================================================== */ + + +!function ($) { + + "use strict"; // jshint ;_; + + + /* CSS TRANSITION SUPPORT (http://www.modernizr.com/) + * ======================================================= */ + + $(function () { + + $.support.transition = (function () { + + var transitionEnd = (function () { + + var el = document.createElement('bootstrap') + , transEndEventNames = { + 'WebkitTransition' : 'webkitTransitionEnd' + , 'MozTransition' : 'transitionend' + , 'OTransition' : 'oTransitionEnd otransitionend' + , 'transition' : 'transitionend' + } + , name + + for (name in transEndEventNames){ + if (el.style[name] !== undefined) { + return transEndEventNames[name] + } + } + + }()) + + return transitionEnd && { + end: transitionEnd + } + + })() + + }) + +}(window.jQuery); +/* ========================================================= + * bootstrap-modal.js v2.3.1 + * http://twitter.github.com/bootstrap/javascript.html#modals + * ========================================================= + * Copyright 2012 Twitter, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================================================= */ + + +!function ($) { + + "use strict"; // jshint ;_; + + + /* MODAL CLASS DEFINITION + * ====================== */ + + var Modal = function (element, options) { + this.options = options + this.$element = $(element) + .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) + this.options.remote && this.$element.find('.modal-body').load(this.options.remote) + } + + Modal.prototype = { + + constructor: Modal + + , toggle: function () { + return this[!this.isShown ? 'show' : 'hide']() + } + + , show: function () { + var that = this + , e = $.Event('show') + + this.$element.trigger(e) + + if (this.isShown || e.isDefaultPrevented()) return + + this.isShown = true + + this.escape() + + this.backdrop(function () { + var transition = $.support.transition && that.$element.hasClass('fade') + + if (!that.$element.parent().length) { + that.$element.appendTo(document.body) //don't move modals dom position + } + + that.$element.show() + + if (transition) { + that.$element[0].offsetWidth // force reflow + } + + that.$element + .addClass('in') + .attr('aria-hidden', false) + + that.enforceFocus() + + transition ? + that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) : + that.$element.focus().trigger('shown') + + }) + } + + , hide: function (e) { + e && e.preventDefault() + + var that = this + + e = $.Event('hide') + + this.$element.trigger(e) + + if (!this.isShown || e.isDefaultPrevented()) return + + this.isShown = false + + this.escape() + + $(document).off('focusin.modal') + + this.$element + .removeClass('in') + .attr('aria-hidden', true) + + $.support.transition && this.$element.hasClass('fade') ? + this.hideWithTransition() : + this.hideModal() + } + + , enforceFocus: function () { + var that = this + $(document).on('focusin.modal', function (e) { + if (that.$element[0] !== e.target && !that.$element.has(e.target).length) { + that.$element.focus() + } + }) + } + + , escape: function () { + var that = this + if (this.isShown && this.options.keyboard) { + this.$element.on('keyup.dismiss.modal', function ( e ) { + e.which == 27 && that.hide() + }) + } else if (!this.isShown) { + this.$element.off('keyup.dismiss.modal') + } + } + + , hideWithTransition: function () { + var that = this + , timeout = setTimeout(function () { + that.$element.off($.support.transition.end) + that.hideModal() + }, 500) + + this.$element.one($.support.transition.end, function () { + clearTimeout(timeout) + that.hideModal() + }) + } + + , hideModal: function () { + var that = this + this.$element.hide() + this.backdrop(function () { + that.removeBackdrop() + that.$element.trigger('hidden') + }) + } + + , removeBackdrop: function () { + this.$backdrop && this.$backdrop.remove() + this.$backdrop = null + } + + , backdrop: function (callback) { + var that = this + , animate = this.$element.hasClass('fade') ? 'fade' : '' + + if (this.isShown && this.options.backdrop) { + var doAnimate = $.support.transition && animate + + this.$backdrop = $('